Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/CXSPA-7972
Browse files Browse the repository at this point in the history
  • Loading branch information
developpeurweb authored Aug 20, 2024
2 parents 019f4a3 + fc480fb commit 70ff3c8
Show file tree
Hide file tree
Showing 189 changed files with 5,022 additions and 159 deletions.
6 changes: 5 additions & 1 deletion .env-cmdrc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
"CX_REQUESTED_DELIVERY_DATE": "true",
"CX_PDF_INVOICES": "true"
},
"omf":{
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s9-public.model-t.myhybris.cloud",
"CX_OMF": "true"
},
"requested-delivery-date": {
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s8-public.model-t.myhybris.cloud",
"CX_REQUESTED_DELIVERY_DATE": "true"
Expand Down Expand Up @@ -83,7 +87,7 @@
"CX_OPPS": "true"
},
"s4-service":{
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s8-public.model-t.myhybris.cloud",
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s1-public.model-t.myhybris.cloud",
"CX_S4_SERVICE": "true",
"CX_B2B": "true"
}
Expand Down
3 changes: 3 additions & 0 deletions core-libs/setup/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,9 @@
"@spartacus/epd-visualization/root": [
"../../integration-libs/epd-visualization/root/public_api"
],
"@spartacus/omf": ["../../integration-libs/omf/public_api"],
"@spartacus/omf/order": ["../../integration-libs/omf/order/public_api"],
"@spartacus/omf/root": ["../../integration-libs/omf/root/public_api"],
"@spartacus/opps": ["../../integration-libs/opps/public_api"],
"@spartacus/opps/root": ["../../integration-libs/opps/root/public_api"],
"@spartacus/s4-service/assets": [
Expand Down
1 change: 1 addition & 0 deletions extra-webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ module.exports = {
),
'@spartacus/s4om': path.join(__dirname, 'integration-libs/s4om'),
'@spartacus/s4-service': path.join(__dirname, 'integration-libs/s4-service'),
'@spartacus/omf': path.join(__dirname, 'integration-libs/omf'),
},
},
};
3 changes: 3 additions & 0 deletions feature-libs/asm/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,9 @@
"@spartacus/epd-visualization/root": [
"../../integration-libs/epd-visualization/root/public_api"
],
"@spartacus/omf": ["../../integration-libs/omf/public_api"],
"@spartacus/omf/order": ["../../integration-libs/omf/order/public_api"],
"@spartacus/omf/root": ["../../integration-libs/omf/root/public_api"],
"@spartacus/opps": ["../../integration-libs/opps/public_api"],
"@spartacus/opps/root": ["../../integration-libs/opps/root/public_api"],
"@spartacus/s4-service/assets": [
Expand Down
3 changes: 3 additions & 0 deletions feature-libs/cart/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@
"@spartacus/epd-visualization/root": [
"../../integration-libs/epd-visualization/root/public_api"
],
"@spartacus/omf": ["../../integration-libs/omf/public_api"],
"@spartacus/omf/order": ["../../integration-libs/omf/order/public_api"],
"@spartacus/omf/root": ["../../integration-libs/omf/root/public_api"],
"@spartacus/opps": ["../../integration-libs/opps/public_api"],
"@spartacus/opps/root": ["../../integration-libs/opps/root/public_api"],
"@spartacus/s4-service/assets": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"checkoutMode": {
"deliveryMethod": "Delivery Method",
"deliveryOptions": "Delivery Options",
"standardDelivery": "Standard Delivery",
"premiumDelivery": "Premium Delivery",
"deliveryEntries": "Items to be Shipped"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<fieldset *cxFeature="'a11yDeliveryModeRadiogroup'" role="radiogroup">
<legend class="cx-checkout-title d-none d-lg-block d-xl-block">
{{ 'checkoutMode.deliveryMethod' | cxTranslate }}
</legend>
<ng-container *cxFeature="'!showDeliveryOptionsTranslation'">
<legend class="cx-checkout-title d-none d-lg-block d-xl-block">
{{ 'checkoutMode.deliveryMethod' | cxTranslate }}
</legend>
</ng-container>

<ng-container *cxFeature="'showDeliveryOptionsTranslation'">
<legend class="cx-checkout-title d-none d-lg-block d-xl-block">
{{ 'checkoutMode.deliveryOptions' | cxTranslate }}
</legend>
</ng-container>

<ng-container
*ngIf="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ class MockGlobalMessageService implements Partial<GlobalMessageService> {
add() {}
}

class MockFeatureConfigService {
isEnabled() {
class MockFeatureConfigService implements Partial<FeatureConfigService> {
isEnabled(_feature: string): boolean {
return true;
}
}
Expand All @@ -128,6 +128,7 @@ describe('CheckoutDeliveryModeComponent', () => {
let checkoutStepService: CheckoutStepService;
let checkoutDeliveryModesFacade: CheckoutDeliveryModesFacade;
let globalMessageService: GlobalMessageService;
let featureConfigService: FeatureConfigService;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
Expand Down Expand Up @@ -165,6 +166,7 @@ describe('CheckoutDeliveryModeComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(CheckoutDeliveryModeComponent);
component = fixture.componentInstance;
featureConfigService = TestBed.inject(FeatureConfigService);
});

it('should be created', () => {
Expand All @@ -181,6 +183,13 @@ describe('CheckoutDeliveryModeComponent', () => {
expect(modes).toEqual(mockSupportedDeliveryModes);
});

it('should display delivery options when showDeliveryOptionsTranslation feature is enabled', () => {
spyOn(featureConfigService, 'isEnabled').and.returnValue(true);
fixture.detectChanges();
const legend = fixture.debugElement.query(By.css('legend')).nativeElement;
expect(legend.textContent).toContain('checkoutMode.deliveryOptions');
});

it('should pre-select preferred delivery mode if not chosen before', () => {
spyOn(checkoutConfigService, 'getPreferredDeliveryMode').and.callThrough();
supportedDeliveryModes$.next(mockSupportedDeliveryModes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import {
ActiveCartFacade,
CartOutlets,
Expand All @@ -16,7 +16,11 @@ import {
CheckoutDeliveryModesFacade,
CheckoutStepType,
} from '@spartacus/checkout/base/root';
import { Address, TranslationService } from '@spartacus/core';
import {
Address,
FeatureConfigService,
TranslationService,
} from '@spartacus/core';
import { deliveryAddressCard, deliveryModeCard } from '@spartacus/order/root';
import { Card, ICON_TYPE } from '@spartacus/storefront';
import { combineLatest, Observable } from 'rxjs';
Expand All @@ -29,6 +33,11 @@ import { CheckoutStepService } from '../../services/checkout-step.service';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CheckoutReviewShippingComponent {
protected featureConfig = inject(FeatureConfigService);
private showDeliveryOptionsTranslation = this.featureConfig.isEnabled(
'showDeliveryOptionsTranslation'
);

readonly cartOutlets = CartOutlets;
iconTypes = ICON_TYPE;

Expand Down Expand Up @@ -85,7 +94,11 @@ export class CheckoutReviewShippingComponent {

getDeliveryModeCard(deliveryMode: DeliveryMode): Observable<Card> {
return combineLatest([
this.translationService.translate('checkoutMode.deliveryMethod'),
this.translationService.translate(
this.showDeliveryOptionsTranslation
? 'checkoutMode.deliveryOptions'
: 'checkoutMode.deliveryMethod'
),
]).pipe(map(([textTitle]) => deliveryModeCard(textTitle, deliveryMode)));
}
}
3 changes: 3 additions & 0 deletions feature-libs/checkout/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@
"@spartacus/epd-visualization/root": [
"../../integration-libs/epd-visualization/root/public_api"
],
"@spartacus/omf": ["../../integration-libs/omf/public_api"],
"@spartacus/omf/order": ["../../integration-libs/omf/order/public_api"],
"@spartacus/omf/root": ["../../integration-libs/omf/root/public_api"],
"@spartacus/opps": ["../../integration-libs/opps/public_api"],
"@spartacus/opps/root": ["../../integration-libs/opps/root/public_api"],
"@spartacus/s4-service/assets": [
Expand Down
3 changes: 3 additions & 0 deletions feature-libs/customer-ticketing/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@
"@spartacus/epd-visualization/root": [
"../../integration-libs/epd-visualization/root/public_api"
],
"@spartacus/omf": ["../../integration-libs/omf/public_api"],
"@spartacus/omf/order": ["../../integration-libs/omf/order/public_api"],
"@spartacus/omf/root": ["../../integration-libs/omf/root/public_api"],
"@spartacus/opps": ["../../integration-libs/opps/public_api"],
"@spartacus/opps/root": ["../../integration-libs/opps/root/public_api"],
"@spartacus/s4-service/assets": [
Expand Down
3 changes: 3 additions & 0 deletions feature-libs/estimated-delivery-date/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@
"@spartacus/epd-visualization/root": [
"../../integration-libs/epd-visualization/root/public_api"
],
"@spartacus/omf": ["../../integration-libs/omf/public_api"],
"@spartacus/omf/order": ["../../integration-libs/omf/order/public_api"],
"@spartacus/omf/root": ["../../integration-libs/omf/root/public_api"],
"@spartacus/opps": ["../../integration-libs/opps/public_api"],
"@spartacus/opps/root": ["../../integration-libs/opps/root/public_api"],
"@spartacus/s4-service/assets": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
<cx-amend-order-items *ngIf="entries$ | async as entries" [entries]="entries">
</cx-amend-order-items>

<cx-form-errors [control]="form.get('entries')"></cx-form-errors>
<cx-form-errors
*cxFeature="'!a11yRepeatedCancelOrderError'"
[control]="form.get('entries')"
></cx-form-errors>

<ng-container *ngTemplateOutlet="actions"></ng-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { NgModule } from '@angular/core';
import {
AuthGuard,
CmsConfig,
provideDefaultConfig,
FeaturesConfigModule,
I18nModule,
provideDefaultConfig,
} from '@spartacus/core';
import {
FormErrorsModule,
Expand All @@ -30,6 +31,7 @@ import { CancelOrderComponent } from './cancel-order.component';
AmendOrderActionsModule,
FormErrorsModule,
MessageComponentModule,
FeaturesConfigModule,
],
providers: [
provideDefaultConfig(<CmsConfig>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ <h2>
params: order
} | cxUrl
"
[queryParams]="getQueryParams(order)"
>
{{ 'orderHistory.orderId' | cxTranslate }} {{ order?.code }}</a
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ import {
TranslationService,
} from '@spartacus/core';
import { MyAccountV2OrderHistoryService } from '@spartacus/order/core';
import { EMPTY, Observable, of } from 'rxjs';
import { ReplenishmentOrderHistoryFacade } from '../../../root/facade';
import { OrderHistoryList, OrderHistoryView } from '../../../root/model';
import { BehaviorSubject, EMPTY, Observable, of } from 'rxjs';
import {
OrderHistoryFacade,
ReplenishmentOrderHistoryFacade,
} from '../../../root/facade';
import { Order, OrderHistoryList, OrderHistoryView } from '../../../root/model';
import { MyAccountV2OrderHistoryComponent } from './my-account-v2-order-history.component';
import { Params } from '@angular/router';

const mockOrders: OrderHistoryList = {
orders: [
Expand Down Expand Up @@ -60,6 +64,24 @@ class MockUrlPipe implements PipeTransform {
transform() {}
}

class MockOrderHistoryFacade implements Partial<OrderHistoryFacade> {
getOrderHistoryList(): Observable<OrderHistoryList> {
return new BehaviorSubject<OrderHistoryList>(mockOrders);
}
getOrderHistoryListLoaded(): Observable<boolean> {
return of(true);
}
getQueryParams(_order: Order): Params | null {
return null;
}
loadOrderList(
_pageSize: number,
_currentPage?: number,
_sort?: string
): void {}
clearOrderList() {}
}

class MockMyAccountV2OrderHistoryService
implements Partial<MyAccountV2OrderHistoryService>
{
Expand Down Expand Up @@ -119,6 +141,7 @@ describe('MyAccountV2OrderHistoryComponent', () => {
],
providers: [
{ provide: RoutingService, useClass: MockRoutingService },
{ provide: OrderHistoryFacade, useClass: MockOrderHistoryFacade },
{
provide: MyAccountV2OrderHistoryService,
useClass: MockMyAccountV2OrderHistoryService,
Expand Down Expand Up @@ -164,10 +187,15 @@ describe('MyAccountV2OrderHistoryComponent', () => {
By.css('.cx-my-account-v2-order-history-code')
);
codes[1].triggerEventHandler('click');
expect(routingService.go).toHaveBeenCalledWith({
cxRoute: 'orderDetails',
params: mockOrders.orders?.[1],
});
expect(routingService.go).toHaveBeenCalledWith(
{
cxRoute: 'orderDetails',
params: mockOrders.orders?.[1],
},
{
queryParams: null,
}
);
});

it('should display pagination', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ <h2 *ngIf="!type.replenishmentOrder">
params: order
} | cxUrl
"
[queryParams]="getQueryParams(order)"
class="cx-order-history-value"
>
{{ order?.code }}</a
Expand All @@ -124,6 +125,7 @@ <h2 *ngIf="!type.replenishmentOrder">
params: order
} | cxUrl
"
[queryParams]="getQueryParams(order)"
class="cx-order-history-value"
>
{{ order.purchaseOrderNumber }}</a
Expand All @@ -141,6 +143,7 @@ <h2 *ngIf="!type.replenishmentOrder">
params: order
} | cxUrl
"
[queryParams]="getQueryParams(order)"
class="cx-order-history-value"
>
{{ order.costCenter?.name }}</a
Expand All @@ -159,6 +162,7 @@ <h2 *ngIf="!type.replenishmentOrder">
params: order
} | cxUrl
"
[queryParams]="getQueryParams(order)"
class="cx-order-history-value"
>{{ order?.placed | cxDate: 'longDate' }}</a
>
Expand All @@ -174,6 +178,7 @@ <h2 *ngIf="!type.replenishmentOrder">
params: order
} | cxUrl
"
[queryParams]="getQueryParams(order)"
class="cx-order-history-value"
>
{{
Expand All @@ -193,6 +198,7 @@ <h2 *ngIf="!type.replenishmentOrder">
params: order
} | cxUrl
"
[queryParams]="getQueryParams(order)"
class="cx-order-history-value"
>
{{ order?.total.formattedValue }}</a
Expand Down
Loading

0 comments on commit 70ff3c8

Please sign in to comment.