Skip to content

Commit

Permalink
Merge branch 'develop' into feature/CXSPA-8570
Browse files Browse the repository at this point in the history
  • Loading branch information
Platonn authored Oct 4, 2024
2 parents 0d27fea + 88f03c1 commit fa7bd45
Show file tree
Hide file tree
Showing 53 changed files with 518 additions and 379 deletions.
10 changes: 5 additions & 5 deletions core-libs/setup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/setup",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "Includes features that makes Spartacus and it's setup easier and streamlined.",
"keywords": [
"spartacus",
Expand All @@ -21,10 +21,10 @@
"peerDependencies": {
"@angular/core": "^17.0.5",
"@angular/ssr": "^17.0.5",
"@spartacus/cart": "2211.29.0-2",
"@spartacus/core": "2211.29.0-2",
"@spartacus/order": "2211.29.0-2",
"@spartacus/user": "2211.29.0-2"
"@spartacus/cart": "2211.29.0",
"@spartacus/core": "2211.29.0",
"@spartacus/order": "2211.29.0",
"@spartacus/user": "2211.29.0"
},
"optionalDependencies": {
"@angular/platform-server": "^17.0.5",
Expand Down
18 changes: 9 additions & 9 deletions feature-libs/asm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/asm",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "ASM feature library for Spartacus",
"keywords": [
"spartacus",
Expand Down Expand Up @@ -32,14 +32,14 @@
"@ng-select/ng-select": "^12.0.4",
"@ngrx/effects": "^17.0.1",
"@ngrx/store": "^17.0.1",
"@spartacus/cart": "2211.29.0-2",
"@spartacus/core": "2211.29.0-2",
"@spartacus/order": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefinder": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/user": "2211.29.0-2",
"@spartacus/cart": "2211.29.0",
"@spartacus/core": "2211.29.0",
"@spartacus/order": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefinder": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"@spartacus/user": "2211.29.0",
"rxjs": "^7.8.0"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</ng-container>

<button
#addToCartDialogTriggerEl
*ngIf="hasStock"
[ngClass]="
options?.displayAddToCart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import {
ChangeDetectorRef,
Component,
ComponentRef,
ElementRef,
HostListener,
Input,
OnDestroy,
OnInit,
Optional,
ViewChild,
inject,
} from '@angular/core';
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
Expand Down Expand Up @@ -55,6 +57,11 @@ export class AddToCartComponent implements OnInit, OnDestroy {
*/
@Input() product: Product;

/**
* Element responsible for opening the modal. The reference is used to refocus the modal after it closes.
*/
@ViewChild('addToCartDialogTriggerEl') addToCartDialogTriggerEl: ElementRef;

maxQuantity: number;

hasStock: boolean = false;
Expand All @@ -77,9 +84,7 @@ export class AddToCartComponent implements OnInit, OnDestroy {

iconTypes = ICON_TYPE;

@Optional() featureConfigService = inject(FeatureConfigService, {
optional: true,
});
private featureConfigService = inject(FeatureConfigService);

/**
* We disable the dialog launch on quantity input,
Expand Down Expand Up @@ -228,6 +233,9 @@ export class AddToCartComponent implements OnInit, OnDestroy {
newEvent.quantity = quantity;
newEvent.numberOfEntriesBeforeAdd = numberOfEntriesBeforeAdd;
newEvent.pickupStoreName = storeName;
if (this.featureConfigService.isEnabled('a11yDialogTriggerRefocus')) {
newEvent.triggerElementRef = this.addToCartDialogTriggerEl;
}
return newEvent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class AddedToCartDialogEventListener implements OnDestroy {

const dialog = this.launchDialogService.openDialog(
LAUNCH_CALLER.ADDED_TO_CART,
undefined,
event?.triggerElementRef,
undefined,
addToCartData
);
Expand Down
6 changes: 6 additions & 0 deletions feature-libs/cart/base/root/events/cart.events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ElementRef } from '@angular/core';
import { CxEvent } from '@spartacus/core';
import { OrderEntry } from '../models/cart.model';

Expand Down Expand Up @@ -127,6 +128,11 @@ export class CartUiEventAddToCart extends CxEvent {
quantity: number;
numberOfEntriesBeforeAdd: number;
pickupStoreName?: string;
/**
* Since the event can be used to open a dialog, we need to know which element triggered it.
* This way we can refocus on it after the dialog is closed.
*/
triggerElementRef?: ElementRef;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions feature-libs/cart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/cart",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "",
"keywords": [
"spartacus",
Expand Down Expand Up @@ -37,11 +37,11 @@
"@ng-select/ng-select": "^12.0.4",
"@ngrx/effects": "^17.0.1",
"@ngrx/store": "^17.0.1",
"@spartacus/core": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/user": "2211.29.0-2",
"@spartacus/core": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"@spartacus/user": "2211.29.0",
"bootstrap": "^4.6.2",
"rxjs": "^7.8.0"
},
Expand Down
16 changes: 8 additions & 8 deletions feature-libs/checkout/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/checkout",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "Checkout feature library for Spartacus",
"keywords": [
"spartacus",
Expand Down Expand Up @@ -32,13 +32,13 @@
"@angular/router": "^17.0.5",
"@ng-select/ng-select": "^12.0.4",
"@ngrx/store": "^17.0.1",
"@spartacus/cart": "2211.29.0-2",
"@spartacus/core": "2211.29.0-2",
"@spartacus/order": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/user": "2211.29.0-2",
"@spartacus/cart": "2211.29.0",
"@spartacus/core": "2211.29.0",
"@spartacus/order": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"@spartacus/user": "2211.29.0",
"bootstrap": "^4.6.2",
"rxjs": "^7.8.0"
},
Expand Down
12 changes: 6 additions & 6 deletions feature-libs/customer-ticketing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/customer-ticketing",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "Customer-Ticketing library for Spartacus",
"keywords": [
"spartacus",
Expand Down Expand Up @@ -30,11 +30,11 @@
"@angular/core": "^17.0.5",
"@angular/forms": "^17.0.5",
"@angular/router": "^17.0.5",
"@spartacus/cart": "2211.29.0-2",
"@spartacus/core": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/cart": "2211.29.0",
"@spartacus/core": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"rxjs": "^7.8.0"
},
"publishConfig": {
Expand Down
14 changes: 7 additions & 7 deletions feature-libs/estimated-delivery-date/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/estimated-delivery-date",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "Estimated Delivery Date library for Spartacus",
"keywords": [
"spartacus",
Expand Down Expand Up @@ -28,12 +28,12 @@
"@angular-devkit/schematics": "^17.0.5",
"@angular/common": "^17.0.5",
"@angular/core": "^17.0.5",
"@spartacus/cart": "2211.29.0-2",
"@spartacus/core": "2211.29.0-2",
"@spartacus/order": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/cart": "2211.29.0",
"@spartacus/core": "2211.29.0",
"@spartacus/order": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"rxjs": "^7.8.0"
},
"publishConfig": {
Expand Down
16 changes: 8 additions & 8 deletions feature-libs/order/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/order",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "Order feature library for Spartacus",
"keywords": [
"spartacus",
Expand Down Expand Up @@ -33,13 +33,13 @@
"@ng-select/ng-select": "^12.0.4",
"@ngrx/effects": "^17.0.1",
"@ngrx/store": "^17.0.1",
"@spartacus/cart": "2211.29.0-2",
"@spartacus/core": "2211.29.0-2",
"@spartacus/pdf-invoices": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/user": "2211.29.0-2",
"@spartacus/cart": "2211.29.0",
"@spartacus/core": "2211.29.0",
"@spartacus/pdf-invoices": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"@spartacus/user": "2211.29.0",
"rxjs": "^7.8.0"
},
"publishConfig": {
Expand Down
16 changes: 8 additions & 8 deletions feature-libs/organization/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/organization",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "Organization library for Spartacus",
"keywords": [
"spartacus",
Expand Down Expand Up @@ -33,13 +33,13 @@
"@ng-select/ng-select": "^12.0.4",
"@ngrx/effects": "^17.0.1",
"@ngrx/store": "^17.0.1",
"@spartacus/cart": "2211.29.0-2",
"@spartacus/core": "2211.29.0-2",
"@spartacus/order": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/user": "2211.29.0-2",
"@spartacus/cart": "2211.29.0",
"@spartacus/core": "2211.29.0",
"@spartacus/order": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"@spartacus/user": "2211.29.0",
"bootstrap": "^4.6.2",
"rxjs": "^7.8.0"
},
Expand Down
10 changes: 5 additions & 5 deletions feature-libs/pdf-invoices/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/pdf-invoices",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "Invoices library for Spartacus",
"keywords": [
"spartacus",
Expand Down Expand Up @@ -29,10 +29,10 @@
"@angular/common": "^17.0.5",
"@angular/core": "^17.0.5",
"@angular/forms": "^17.0.5",
"@spartacus/core": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/core": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"rxjs": "^7.8.0"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
[selectedOption]="pickupOption$ | async"
[displayPickupLocation]="displayPickupLocation$ | async"
(pickupOptionChange)="onPickupOptionChange($event)"
(pickupLocationChange)="openDialog()"
(pickupLocationChange)="openDialog($event)"
></cx-pickup-options>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { CommonModule } from '@angular/common';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { I18nTestingModule, Product } from '@spartacus/core';
import {
FeatureConfigService,
I18nTestingModule,
Product,
} from '@spartacus/core';

import {
AugmentedPointOfService,
Expand All @@ -13,8 +17,8 @@ import {
} from '@spartacus/pickup-in-store/root';
import {
CurrentProductService,
LaunchDialogService,
LAUNCH_CALLER,
LaunchDialogService,
} from '@spartacus/storefront';
import { Observable, of, Subscription } from 'rxjs';
import { PdpPickupOptionsContainerComponent } from './pdp-pickup-options-container.component';
Expand Down Expand Up @@ -80,6 +84,12 @@ class MockCurrentLocationService {
}
}

class MockFeatureConfigService {
isEnabled() {
return true;
}
}

describe('PdpPickupOptionsComponent', () => {
let component: PdpPickupOptionsContainerComponent;
let fixture: ComponentFixture<PdpPickupOptionsContainerComponent>;
Expand Down Expand Up @@ -118,6 +128,10 @@ describe('PdpPickupOptionsComponent', () => {
provide: CurrentLocationService,
useClass: MockCurrentLocationService,
},
{
provide: FeatureConfigService,
useClass: MockFeatureConfigService,
},
],
});

Expand Down
Loading

0 comments on commit fa7bd45

Please sign in to comment.