diff --git a/.env-cmdrc b/.env-cmdrc index 32dd9037fe6..a8bec18cc0b 100644 --- a/.env-cmdrc +++ b/.env-cmdrc @@ -46,9 +46,13 @@ "CX_B2B": "true" }, "s4om": { - "CX_BASE_URL": "https://backoffice.c2twgq1sul-sapcxteam1-d11-public.model-t.myhybris.cloud", - "CX_CDC": "false", + "CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s8-public.model-t.myhybris.cloud", "CX_B2B": "true", - "CX_S4OM": "true" + "CX_S4OM": "true", + "CX_REQUESTED_DELIVERY_DATE": "true" + }, + "requested-delivery-date": { + "CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s8-public.model-t.myhybris.cloud", + "CX_REQUESTED_DELIVERY_DATE": "true" } } diff --git a/core-libs/setup/tsconfig.spec.json b/core-libs/setup/tsconfig.spec.json index 825c5531f0f..a186e6ab397 100644 --- a/core-libs/setup/tsconfig.spec.json +++ b/core-libs/setup/tsconfig.spec.json @@ -375,6 +375,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/extra-webpack.config.js b/extra-webpack.config.js index 23568878b1d..663f036087e 100644 --- a/extra-webpack.config.js +++ b/extra-webpack.config.js @@ -42,6 +42,10 @@ module.exports = { '@spartacus/asm': path.join(__dirname, 'feature-libs/asm'), '@spartacus/smartedit': path.join(__dirname, 'feature-libs/smartedit'), '@spartacus/qualtrics': path.join(__dirname, 'feature-libs/qualtrics'), + '@spartacus/requested-delivery-date': path.join( + __dirname, + 'feature-libs/requested-delivery-date' + ), '@spartacus/tracking': path.join(__dirname, 'feature-libs/tracking'), '@spartacus/cart': path.join(__dirname, 'feature-libs/cart'), '@spartacus/order': path.join(__dirname, 'feature-libs/order'), @@ -53,7 +57,10 @@ module.exports = { __dirname, 'feature-libs/customer-ticketing' ), - '@spartacus/pickup-in-store': path.join(__dirname, 'feature-libs/pickup-in-store'), + '@spartacus/pickup-in-store': path.join( + __dirname, + 'feature-libs/pickup-in-store' + ), '@spartacus/s4om': path.join(__dirname, 'integration-libs/s4om'), }, }, diff --git a/feature-libs/asm/tsconfig.schematics.json b/feature-libs/asm/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/asm/tsconfig.schematics.json +++ b/feature-libs/asm/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/cart/base/root/models/cart-outlets.model.ts b/feature-libs/cart/base/root/models/cart-outlets.model.ts index 5f819a5ddaf..c07b2245d29 100644 --- a/feature-libs/cart/base/root/models/cart-outlets.model.ts +++ b/feature-libs/cart/base/root/models/cart-outlets.model.ts @@ -19,4 +19,6 @@ export enum CartOutlets { ADD_TO_CART_CONTAINER = 'cx-add-to-cart-container', PICKUP_INFO = 'cx-pickup-info', ADD_TO_CART_PICKUP_OPTION = 'cx-add-to-cart-pickup-option', + DELIVERY_MODE = 'cx-delivery-mode', + ORDER_OVERVIEW = 'cx-order-overview', } diff --git a/feature-libs/cart/tsconfig.schematics.json b/feature-libs/cart/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/cart/tsconfig.schematics.json +++ b/feature-libs/cart/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/checkout/b2b/components/checkout-review-submit/checkout-review-submit.component.html b/feature-libs/checkout/b2b/components/checkout-review-submit/checkout-review-submit.component.html index 323fceabfdd..ade77552529 100644 --- a/feature-libs/checkout/b2b/components/checkout-review-submit/checkout-review-submit.component.html +++ b/feature-libs/checkout/b2b/components/checkout-review-submit/checkout-review-submit.component.html @@ -131,10 +131,33 @@

+ + + + + diff --git a/feature-libs/checkout/base/components/checkout-delivery-mode/checkout-delivery-mode.component.spec.ts b/feature-libs/checkout/base/components/checkout-delivery-mode/checkout-delivery-mode.component.spec.ts index 5d4201668e9..595d94d5356 100644 --- a/feature-libs/checkout/base/components/checkout-delivery-mode/checkout-delivery-mode.component.spec.ts +++ b/feature-libs/checkout/base/components/checkout-delivery-mode/checkout-delivery-mode.component.spec.ts @@ -5,6 +5,7 @@ import { By } from '@angular/platform-browser'; import { ActivatedRoute } from '@angular/router'; import { ActiveCartFacade, + Cart, DeliveryMode, OrderEntry, } from '@spartacus/cart/base/root'; @@ -60,6 +61,14 @@ class MockCheckoutStepService implements Partial { getBackBntText = createSpy().and.returnValue('common.back'); } +const mockCart: Cart = { + code: '123456789', + description: 'testCartDescription', + name: 'testCartName', +}; + +const cart$ = new BehaviorSubject(mockCart); + const mockActivatedRoute = { snapshot: { url: ['checkout', 'delivery-mode'], @@ -91,6 +100,7 @@ class MockCartService implements Partial { getDeliveryEntries = () => deliveryEntries$.asObservable(); hasPickupItems = () => hasPickupItems$.asObservable(); getPickupEntries = createSpy().and.returnValue(of([])); + getActive = () => cart$.asObservable(); } class MockGlobalMessageService implements Partial { diff --git a/feature-libs/checkout/base/components/checkout-delivery-mode/checkout-delivery-mode.module.ts b/feature-libs/checkout/base/components/checkout-delivery-mode/checkout-delivery-mode.module.ts index 3698ddc6c7f..994f76717ed 100644 --- a/feature-libs/checkout/base/components/checkout-delivery-mode/checkout-delivery-mode.module.ts +++ b/feature-libs/checkout/base/components/checkout-delivery-mode/checkout-delivery-mode.module.ts @@ -9,9 +9,9 @@ import { NgModule } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; import { CmsConfig, + FeaturesConfigModule, I18nModule, provideDefaultConfig, - FeaturesConfigModule, } from '@spartacus/core'; import { OutletModule, @@ -31,6 +31,7 @@ import { CheckoutDeliveryModeComponent } from './checkout-delivery-mode.componen OutletModule, PageComponentModule, FeaturesConfigModule, + FeaturesConfigModule, ], providers: [ provideDefaultConfig({ diff --git a/feature-libs/checkout/base/components/checkout-review-submit/checkout-review-submit.component.html b/feature-libs/checkout/base/components/checkout-review-submit/checkout-review-submit.component.html index 102d635a15a..af9615ad854 100644 --- a/feature-libs/checkout/base/components/checkout-review-submit/checkout-review-submit.component.html +++ b/feature-libs/checkout/base/components/checkout-review-submit/checkout-review-submit.component.html @@ -58,10 +58,33 @@

@@ -153,6 +171,15 @@ + + + + + + diff --git a/feature-libs/order/components/order-details/order-overview/order-overview.component.ts b/feature-libs/order/components/order-details/order-overview/order-overview.component.ts index f7a18ddc2ba..7a212ab8311 100644 --- a/feature-libs/order/components/order-details/order-overview/order-overview.component.ts +++ b/feature-libs/order/components/order-details/order-overview/order-overview.component.ts @@ -5,7 +5,11 @@ */ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { DeliveryMode, PaymentDetails } from '@spartacus/cart/base/root'; +import { + CartOutlets, + DeliveryMode, + PaymentDetails, +} from '@spartacus/cart/base/root'; import { Address, CmsOrderDetailOverviewComponent, @@ -23,6 +27,8 @@ import { OrderDetailsService } from '../order-details.service'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class OrderOverviewComponent { + readonly cartOutlets = CartOutlets; + order$: Observable = this.orderDetailsService.getOrderDetails(); isOrderLoading$: Observable = typeof this.orderDetailsService.isOrderDetailsLoading === 'function' diff --git a/feature-libs/order/tsconfig.schematics.json b/feature-libs/order/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/order/tsconfig.schematics.json +++ b/feature-libs/order/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/organization/tsconfig.schematics.json b/feature-libs/organization/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/organization/tsconfig.schematics.json +++ b/feature-libs/organization/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/pickup-in-store/tsconfig.lib.json b/feature-libs/pickup-in-store/tsconfig.lib.json index 55e1a18086a..371a4445768 100644 --- a/feature-libs/pickup-in-store/tsconfig.lib.json +++ b/feature-libs/pickup-in-store/tsconfig.lib.json @@ -62,6 +62,12 @@ "@spartacus/cart/wish-list": ["dist/cart/wish-list"], "@spartacus/cart/wish-list/root": ["dist/cart/wish-list/root"], "@spartacus/core": ["dist/core"], + "@spartacus/order/assets": ["dist/order/assets"], + "@spartacus/order/components": ["dist/order/components"], + "@spartacus/order/core": ["dist/order/core"], + "@spartacus/order": ["dist/order"], + "@spartacus/order/occ": ["dist/order/occ"], + "@spartacus/order/root": ["dist/order/root"], "@spartacus/storefinder/assets": ["dist/storefinder/assets"], "@spartacus/storefinder/components": ["dist/storefinder/components"], "@spartacus/storefinder/core": ["dist/storefinder/core"], @@ -81,13 +87,7 @@ "@spartacus/user/profile/core": ["dist/user/profile/core"], "@spartacus/user/profile": ["dist/user/profile"], "@spartacus/user/profile/occ": ["dist/user/profile/occ"], - "@spartacus/user/profile/root": ["dist/user/profile/root"], - "@spartacus/order/assets": ["dist/order/assets"], - "@spartacus/order/components": ["dist/order/components"], - "@spartacus/order/core": ["dist/order/core"], - "@spartacus/order": ["dist/order"], - "@spartacus/order/occ": ["dist/order/occ"], - "@spartacus/order/root": ["dist/order/root"] + "@spartacus/user/profile/root": ["dist/user/profile/root"] }, "strict": true }, diff --git a/feature-libs/pickup-in-store/tsconfig.schematics.json b/feature-libs/pickup-in-store/tsconfig.schematics.json index 4e68f07aa60..a6671c2be12 100644 --- a/feature-libs/pickup-in-store/tsconfig.schematics.json +++ b/feature-libs/pickup-in-store/tsconfig.schematics.json @@ -388,6 +388,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/product-configurator/tsconfig.lib.json b/feature-libs/product-configurator/tsconfig.lib.json index 367e3b22560..8bd6f6883a6 100644 --- a/feature-libs/product-configurator/tsconfig.lib.json +++ b/feature-libs/product-configurator/tsconfig.lib.json @@ -15,48 +15,6 @@ "types": [], "lib": ["es2020", "dom"], "paths": { - "@spartacus/checkout": ["dist/checkout"], - "@spartacus/checkout/b2b/assets": ["dist/checkout/b2b/assets"], - "@spartacus/checkout/b2b/components": ["dist/checkout/b2b/components"], - "@spartacus/checkout/b2b/core": ["dist/checkout/b2b/core"], - "@spartacus/checkout/b2b": ["dist/checkout/b2b"], - "@spartacus/checkout/b2b/occ": ["dist/checkout/b2b/occ"], - "@spartacus/checkout/b2b/root": ["dist/checkout/b2b/root"], - "@spartacus/checkout/base/assets": ["dist/checkout/base/assets"], - "@spartacus/checkout/base/components": ["dist/checkout/base/components"], - "@spartacus/checkout/base/core": ["dist/checkout/base/core"], - "@spartacus/checkout/base": ["dist/checkout/base"], - "@spartacus/checkout/base/occ": ["dist/checkout/base/occ"], - "@spartacus/checkout/base/root": ["dist/checkout/base/root"], - "@spartacus/checkout/scheduled-replenishment/assets": [ - "dist/checkout/scheduled-replenishment/assets" - ], - "@spartacus/checkout/scheduled-replenishment/components": [ - "dist/checkout/scheduled-replenishment/components" - ], - "@spartacus/checkout/scheduled-replenishment": [ - "dist/checkout/scheduled-replenishment" - ], - "@spartacus/checkout/scheduled-replenishment/root": [ - "dist/checkout/scheduled-replenishment/root" - ], - "@spartacus/core": ["dist/core"], - "@spartacus/storefront": ["dist/storefrontlib"], - "@spartacus/order/assets": ["dist/order/assets"], - "@spartacus/order/components": ["dist/order/components"], - "@spartacus/order/core": ["dist/order/core"], - "@spartacus/order": ["dist/order"], - "@spartacus/order/occ": ["dist/order/occ"], - "@spartacus/order/root": ["dist/order/root"], - "@spartacus/cart/import-export/assets": [ - "dist/cart/import-export/assets" - ], - "@spartacus/cart/import-export/components": [ - "dist/cart/import-export/components" - ], - "@spartacus/cart/import-export/core": ["dist/cart/import-export/core"], - "@spartacus/cart/import-export": ["dist/cart/import-export"], - "@spartacus/cart/import-export/root": ["dist/cart/import-export/root"], "@spartacus/cart/base/assets": ["dist/cart/base/assets"], "@spartacus/cart/base/components/add-to-cart": [ "dist/cart/base/components/add-to-cart" @@ -69,6 +27,15 @@ "@spartacus/cart/base": ["dist/cart/base"], "@spartacus/cart/base/occ": ["dist/cart/base/occ"], "@spartacus/cart/base/root": ["dist/cart/base/root"], + "@spartacus/cart/import-export/assets": [ + "dist/cart/import-export/assets" + ], + "@spartacus/cart/import-export/components": [ + "dist/cart/import-export/components" + ], + "@spartacus/cart/import-export/core": ["dist/cart/import-export/core"], + "@spartacus/cart/import-export": ["dist/cart/import-export"], + "@spartacus/cart/import-export/root": ["dist/cart/import-export/root"], "@spartacus/cart": ["dist/cart"], "@spartacus/cart/quick-order/assets": ["dist/cart/quick-order/assets"], "@spartacus/cart/quick-order/components": [ @@ -95,6 +62,39 @@ "@spartacus/cart/wish-list/core": ["dist/cart/wish-list/core"], "@spartacus/cart/wish-list": ["dist/cart/wish-list"], "@spartacus/cart/wish-list/root": ["dist/cart/wish-list/root"], + "@spartacus/checkout/b2b/assets": ["dist/checkout/b2b/assets"], + "@spartacus/checkout/b2b/components": ["dist/checkout/b2b/components"], + "@spartacus/checkout/b2b/core": ["dist/checkout/b2b/core"], + "@spartacus/checkout/b2b": ["dist/checkout/b2b"], + "@spartacus/checkout/b2b/occ": ["dist/checkout/b2b/occ"], + "@spartacus/checkout/b2b/root": ["dist/checkout/b2b/root"], + "@spartacus/checkout/base/assets": ["dist/checkout/base/assets"], + "@spartacus/checkout/base/components": ["dist/checkout/base/components"], + "@spartacus/checkout/base/core": ["dist/checkout/base/core"], + "@spartacus/checkout/base": ["dist/checkout/base"], + "@spartacus/checkout/base/occ": ["dist/checkout/base/occ"], + "@spartacus/checkout/base/root": ["dist/checkout/base/root"], + "@spartacus/checkout": ["dist/checkout"], + "@spartacus/checkout/scheduled-replenishment/assets": [ + "dist/checkout/scheduled-replenishment/assets" + ], + "@spartacus/checkout/scheduled-replenishment/components": [ + "dist/checkout/scheduled-replenishment/components" + ], + "@spartacus/checkout/scheduled-replenishment": [ + "dist/checkout/scheduled-replenishment" + ], + "@spartacus/checkout/scheduled-replenishment/root": [ + "dist/checkout/scheduled-replenishment/root" + ], + "@spartacus/core": ["dist/core"], + "@spartacus/order/assets": ["dist/order/assets"], + "@spartacus/order/components": ["dist/order/components"], + "@spartacus/order/core": ["dist/order/core"], + "@spartacus/order": ["dist/order"], + "@spartacus/order/occ": ["dist/order/occ"], + "@spartacus/order/root": ["dist/order/root"], + "@spartacus/storefront": ["dist/storefrontlib"], "@spartacus/user/account/assets": ["dist/user/account/assets"], "@spartacus/user/account/components": ["dist/user/account/components"], "@spartacus/user/account/core": ["dist/user/account/core"], diff --git a/feature-libs/product-configurator/tsconfig.schematics.json b/feature-libs/product-configurator/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/product-configurator/tsconfig.schematics.json +++ b/feature-libs/product-configurator/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/product/tsconfig.schematics.json b/feature-libs/product/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/product/tsconfig.schematics.json +++ b/feature-libs/product/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/qualtrics/tsconfig.schematics.json b/feature-libs/qualtrics/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/qualtrics/tsconfig.schematics.json +++ b/feature-libs/qualtrics/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/requested-delivery-date/.eslintrc.json b/feature-libs/requested-delivery-date/.eslintrc.json new file mode 100644 index 00000000000..862b5a870b0 --- /dev/null +++ b/feature-libs/requested-delivery-date/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "../../.eslintrc.json", + "ignorePatterns": ["schematics/**/*.d.ts"] +} diff --git a/feature-libs/requested-delivery-date/README.md b/feature-libs/requested-delivery-date/README.md new file mode 100644 index 00000000000..6e061e29cb4 --- /dev/null +++ b/feature-libs/requested-delivery-date/README.md @@ -0,0 +1,3 @@ +# Requested Delivery Date + +Requested Delivery Date allows customers to provide a delivery date for which the item would be needed. The minimum date would be fetched from the S/4 HANA system and used along with the Order. diff --git a/feature-libs/requested-delivery-date/_index.scss b/feature-libs/requested-delivery-date/_index.scss new file mode 100644 index 00000000000..86f72a0df42 --- /dev/null +++ b/feature-libs/requested-delivery-date/_index.scss @@ -0,0 +1,2 @@ +@import '@spartacus/styles/scss/core'; +@import './styles/index'; diff --git a/feature-libs/requested-delivery-date/assets/ng-package.json b/feature-libs/requested-delivery-date/assets/ng-package.json new file mode 100644 index 00000000000..38e01ac17de --- /dev/null +++ b/feature-libs/requested-delivery-date/assets/ng-package.json @@ -0,0 +1,6 @@ +{ + "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", + "lib": { + "entryFile": "./public_api.ts" + } +} diff --git a/feature-libs/requested-delivery-date/assets/public_api.ts b/feature-libs/requested-delivery-date/assets/public_api.ts new file mode 100644 index 00000000000..f3d8f426ab4 --- /dev/null +++ b/feature-libs/requested-delivery-date/assets/public_api.ts @@ -0,0 +1,7 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './translations/translations'; diff --git a/feature-libs/requested-delivery-date/assets/translations/en/index.ts b/feature-libs/requested-delivery-date/assets/translations/en/index.ts new file mode 100644 index 00000000000..6e31c96fd7b --- /dev/null +++ b/feature-libs/requested-delivery-date/assets/translations/en/index.ts @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { requestedDeliveryDate } from './requested-delivery-date'; + +export const en = { + requestedDeliveryDate, +}; diff --git a/feature-libs/requested-delivery-date/assets/translations/en/requested-delivery-date.ts b/feature-libs/requested-delivery-date/assets/translations/en/requested-delivery-date.ts new file mode 100644 index 00000000000..6d89369eac5 --- /dev/null +++ b/feature-libs/requested-delivery-date/assets/translations/en/requested-delivery-date.ts @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export const requestedDeliveryDate = { + requestedDeliveryDate: { + datePickerLabel: 'Request Delivery Date', + readOnlyTextLabel: 'Requested Delivery Date', + successMessage: 'Delivery Date updated successfully.', + errorMessage: 'Something went wrong. Unable to update the requested date.', + }, +}; diff --git a/feature-libs/requested-delivery-date/assets/translations/translations.ts b/feature-libs/requested-delivery-date/assets/translations/translations.ts new file mode 100644 index 00000000000..ceded4e2c21 --- /dev/null +++ b/feature-libs/requested-delivery-date/assets/translations/translations.ts @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { TranslationChunksConfig, TranslationResources } from '@spartacus/core'; +import { en } from './en/index'; + +export const requestedDeliveryDateTranslations: TranslationResources = { + en, +}; + +export const requestedDeliveryDateTranslationChunksConfig: TranslationChunksConfig = + { + requestedDeliveryDate: ['requestedDeliveryDate'], + }; diff --git a/feature-libs/requested-delivery-date/core/connectors/index.ts b/feature-libs/requested-delivery-date/core/connectors/index.ts new file mode 100644 index 00000000000..aa0d3a7fbe4 --- /dev/null +++ b/feature-libs/requested-delivery-date/core/connectors/index.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './requested-delivery-date.adapter'; +export * from './requested-delivery-date.connector'; diff --git a/feature-libs/requested-delivery-date/core/connectors/requested-delivery-date.adapter.ts b/feature-libs/requested-delivery-date/core/connectors/requested-delivery-date.adapter.ts new file mode 100644 index 00000000000..0fb381574a7 --- /dev/null +++ b/feature-libs/requested-delivery-date/core/connectors/requested-delivery-date.adapter.ts @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Observable } from 'rxjs'; + +export abstract class RequestedDeliveryDateAdapter { + /** + * Abstract method used to set the requested delivery date for a cart entry + */ + abstract setRequestedDeliveryDate( + userId: string, + cartId: string, + requestedDate: string + ): Observable<{}>; +} diff --git a/feature-libs/requested-delivery-date/core/connectors/requested-delivery-date.connector.spec.ts b/feature-libs/requested-delivery-date/core/connectors/requested-delivery-date.connector.spec.ts new file mode 100644 index 00000000000..4fe26a9ab56 --- /dev/null +++ b/feature-libs/requested-delivery-date/core/connectors/requested-delivery-date.connector.spec.ts @@ -0,0 +1,56 @@ +import { TestBed } from '@angular/core/testing'; +import { of } from 'rxjs'; +import { take } from 'rxjs/operators'; +import { RequestedDeliveryDateAdapter } from './requested-delivery-date.adapter'; +import { RequestedDeliveryDateConnector } from './requested-delivery-date.connector'; +import createSpy = jasmine.createSpy; + +const mockUserId = 'userId1'; +const mockCartId = '00012345'; +const mockRequestedDate = '15-09-2023'; + +class MockRequestedDeliveryDateAdapter + implements Partial +{ + setRequestedDeliveryDate = createSpy( + 'RequestedDeliveryDateAdapter.setRequestedDeliveryDate' + ).and.callFake((_userId: string, _cartId: string, _date: Date) => of()); +} + +describe('RequestedDeliveryDateConnector', () => { + let service: RequestedDeliveryDateConnector; + let adapter: RequestedDeliveryDateAdapter; + + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [ + RequestedDeliveryDateConnector, + { + provide: RequestedDeliveryDateAdapter, + useClass: MockRequestedDeliveryDateAdapter, + }, + ], + }); + + service = TestBed.inject(RequestedDeliveryDateConnector); + adapter = TestBed.inject(RequestedDeliveryDateAdapter); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); + + it('setRequestedDeliveryDate should call adapter', () => { + let result; + service + .setRequestedDeliveryDate(mockUserId, mockCartId, mockRequestedDate) + .pipe(take(1)) + .subscribe((res) => (result = res)); + expect(result).toBeUndefined(); + expect(adapter.setRequestedDeliveryDate).toHaveBeenCalledWith( + mockUserId, + mockCartId, + mockRequestedDate + ); + }); +}); diff --git a/feature-libs/requested-delivery-date/core/connectors/requested-delivery-date.connector.ts b/feature-libs/requested-delivery-date/core/connectors/requested-delivery-date.connector.ts new file mode 100644 index 00000000000..e9b8359ad9a --- /dev/null +++ b/feature-libs/requested-delivery-date/core/connectors/requested-delivery-date.connector.ts @@ -0,0 +1,24 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { RequestedDeliveryDateAdapter } from './requested-delivery-date.adapter'; + +@Injectable({ + providedIn: 'root', +}) +export class RequestedDeliveryDateConnector { + constructor(protected adapter: RequestedDeliveryDateAdapter) {} + + public setRequestedDeliveryDate( + userId: string, + cartId: string, + requestedDate: string + ): Observable<{}> { + return this.adapter.setRequestedDeliveryDate(userId, cartId, requestedDate); + } +} diff --git a/feature-libs/requested-delivery-date/core/http-interceptors/bad-request/requested-delivery-date-badrequest.handler.spec.ts b/feature-libs/requested-delivery-date/core/http-interceptors/bad-request/requested-delivery-date-badrequest.handler.spec.ts new file mode 100644 index 00000000000..edb25e19df4 --- /dev/null +++ b/feature-libs/requested-delivery-date/core/http-interceptors/bad-request/requested-delivery-date-badrequest.handler.spec.ts @@ -0,0 +1,64 @@ +import { HttpErrorResponse, HttpRequest } from '@angular/common/http'; +import { TestBed } from '@angular/core/testing'; +import { + GlobalMessageService, + GlobalMessageType, + HttpResponseStatus, +} from '@spartacus/core'; +import { RequestedDeliveryDateBadRequestHandler } from './requested-delivery-date-badrequest.handler'; + +class MockGlobalMessageService { + add() {} +} + +const MockRequest = {} as HttpRequest; + +const MockRDDBadRequestResponse = { + error: { + errors: [ + { + message: 'checkout.multi.requestedretrievaldatevalid.error', + type: 'ValidationError', + }, + ], + }, +} as HttpErrorResponse; + +describe('RequestedDeliveryDateBadRequestHandler', () => { + let service: RequestedDeliveryDateBadRequestHandler; + let globalMessageService: GlobalMessageService; + + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [ + RequestedDeliveryDateBadRequestHandler, + { + provide: GlobalMessageService, + useClass: MockGlobalMessageService, + }, + ], + }); + service = TestBed.inject(RequestedDeliveryDateBadRequestHandler); + globalMessageService = TestBed.inject(GlobalMessageService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); + + it('should register 400 responseStatus ', () => { + expect(service.responseStatus).toEqual(HttpResponseStatus.BAD_REQUEST); + }); + + it('should handle wrong date bad request', () => { + spyOn(globalMessageService, 'add'); + service.handleError(MockRequest, MockRDDBadRequestResponse); + + expect(globalMessageService.add).toHaveBeenCalledWith( + { + key: 'requestedDeliveryDate.errorMessage', + }, + GlobalMessageType.MSG_TYPE_ERROR + ); + }); +}); diff --git a/feature-libs/requested-delivery-date/core/http-interceptors/bad-request/requested-delivery-date-badrequest.handler.ts b/feature-libs/requested-delivery-date/core/http-interceptors/bad-request/requested-delivery-date-badrequest.handler.ts new file mode 100644 index 00000000000..fdc07f28460 --- /dev/null +++ b/feature-libs/requested-delivery-date/core/http-interceptors/bad-request/requested-delivery-date-badrequest.handler.ts @@ -0,0 +1,49 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { HttpErrorResponse, HttpRequest } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { + ErrorModel, + GlobalMessageType, + HttpErrorHandler, + HttpResponseStatus, + Priority, +} from '@spartacus/core'; + +@Injectable({ + providedIn: 'root', +}) +export class RequestedDeliveryDateBadRequestHandler extends HttpErrorHandler { + responseStatus = HttpResponseStatus.BAD_REQUEST; + + hasMatch(errorResponse: HttpErrorResponse): boolean { + return ( + super.hasMatch(errorResponse) && this.getErrors(errorResponse)?.length > 0 + ); + } + + handleError(request: HttpRequest, response: HttpErrorResponse) { + if (request && this.getErrors(response)?.length) { + this.globalMessageService.add( + { key: 'requestedDeliveryDate.errorMessage' }, + GlobalMessageType.MSG_TYPE_ERROR + ); + } + } + + protected getErrors(response: HttpErrorResponse): ErrorModel[] { + return (response.error?.errors).filter( + (error: any) => + error?.type === 'ValidationError' && + error?.message === 'checkout.multi.requestedretrievaldatevalid.error' + ); + } + + getPriority(): Priority { + return Priority.NORMAL; + } +} diff --git a/feature-libs/requested-delivery-date/core/http-interceptors/index.ts b/feature-libs/requested-delivery-date/core/http-interceptors/index.ts new file mode 100644 index 00000000000..59dc0b1a99d --- /dev/null +++ b/feature-libs/requested-delivery-date/core/http-interceptors/index.ts @@ -0,0 +1,7 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './bad-request/requested-delivery-date-badrequest.handler'; diff --git a/feature-libs/requested-delivery-date/core/ng-package.json b/feature-libs/requested-delivery-date/core/ng-package.json new file mode 100644 index 00000000000..38e01ac17de --- /dev/null +++ b/feature-libs/requested-delivery-date/core/ng-package.json @@ -0,0 +1,6 @@ +{ + "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", + "lib": { + "entryFile": "./public_api.ts" + } +} diff --git a/feature-libs/requested-delivery-date/core/public_api.ts b/feature-libs/requested-delivery-date/core/public_api.ts new file mode 100644 index 00000000000..68e7d9884cc --- /dev/null +++ b/feature-libs/requested-delivery-date/core/public_api.ts @@ -0,0 +1,10 @@ +/* + * SPDX-FileCopyrightText: 2022 SAP Spartacus team + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './connectors'; +export * from './requested-delivery-date-core.module'; +export * from './services/index'; diff --git a/feature-libs/requested-delivery-date/core/requested-delivery-date-core.module.ts b/feature-libs/requested-delivery-date/core/requested-delivery-date-core.module.ts new file mode 100644 index 00000000000..aba8955e922 --- /dev/null +++ b/feature-libs/requested-delivery-date/core/requested-delivery-date-core.module.ts @@ -0,0 +1,30 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { NgModule } from '@angular/core'; +import { HttpErrorHandler } from '@spartacus/core'; +import { RequestedDeliveryDateFacade } from '@spartacus/requested-delivery-date/root'; +import { RequestedDeliveryDateConnector } from './connectors/requested-delivery-date.connector'; +import { RequestedDeliveryDateBadRequestHandler } from './http-interceptors/bad-request/requested-delivery-date-badrequest.handler'; +import { RequestedDeliveryDateService } from './services'; + +@NgModule({ + imports: [], + providers: [ + RequestedDeliveryDateService, + { + provide: RequestedDeliveryDateFacade, + useExisting: RequestedDeliveryDateService, + }, + { + provide: HttpErrorHandler, + useExisting: RequestedDeliveryDateBadRequestHandler, + multi: true, + }, + RequestedDeliveryDateConnector, + ], +}) +export class RequestedDeliveryDateCoreModule {} diff --git a/feature-libs/requested-delivery-date/core/services/index.ts b/feature-libs/requested-delivery-date/core/services/index.ts new file mode 100644 index 00000000000..ebfd31df225 --- /dev/null +++ b/feature-libs/requested-delivery-date/core/services/index.ts @@ -0,0 +1,7 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './requested-delivery-date.service'; diff --git a/feature-libs/requested-delivery-date/core/services/requested-delivery-date.service.spec.ts b/feature-libs/requested-delivery-date/core/services/requested-delivery-date.service.spec.ts new file mode 100644 index 00000000000..ff56059dc10 --- /dev/null +++ b/feature-libs/requested-delivery-date/core/services/requested-delivery-date.service.spec.ts @@ -0,0 +1,61 @@ +import { TestBed } from '@angular/core/testing'; +import { of } from 'rxjs'; +import { RequestedDeliveryDateConnector } from '../connectors/requested-delivery-date.connector'; +import { RequestedDeliveryDateService } from './requested-delivery-date.service'; + +import createSpy = jasmine.createSpy; + +const mockUserId = 'userId1'; +const mockCartId = '00012345'; +const mockRequestedDate = '15-09-2023'; + +class MockRequestedDeliveryDateConnector + implements Partial +{ + setRequestedDeliveryDate = createSpy().and.callFake(() => of()); +} + +describe('RequestedDeliveryDateService', () => { + let service: RequestedDeliveryDateService; + let connector: RequestedDeliveryDateConnector; + + describe('Current user', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [ + RequestedDeliveryDateService, + { + provide: RequestedDeliveryDateConnector, + useClass: MockRequestedDeliveryDateConnector, + }, + ], + }); + + service = TestBed.inject(RequestedDeliveryDateService); + connector = TestBed.inject(RequestedDeliveryDateConnector); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); + + it('should set requested delivery date', () => { + let result; + service + .setRequestedDeliveryDate(mockUserId, mockCartId, mockRequestedDate) + .subscribe((data) => { + result = data; + }) + .unsubscribe(); + expect(result).toBeUndefined(); + }); + + it('should call connector', () => { + service + .setRequestedDeliveryDate(mockUserId, mockCartId, mockRequestedDate) + .subscribe(() => {}) + .unsubscribe(); + expect(connector.setRequestedDeliveryDate).toHaveBeenCalled(); + }); + }); +}); diff --git a/feature-libs/requested-delivery-date/core/services/requested-delivery-date.service.ts b/feature-libs/requested-delivery-date/core/services/requested-delivery-date.service.ts new file mode 100644 index 00000000000..328968dd441 --- /dev/null +++ b/feature-libs/requested-delivery-date/core/services/requested-delivery-date.service.ts @@ -0,0 +1,34 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Injectable } from '@angular/core'; +import { RequestedDeliveryDateFacade } from '@spartacus/requested-delivery-date/root'; +import { Observable } from 'rxjs'; +import { RequestedDeliveryDateConnector } from '../connectors/requested-delivery-date.connector'; + +@Injectable() +export class RequestedDeliveryDateService + implements RequestedDeliveryDateFacade +{ + /** + * Set requested delivery date + */ + setRequestedDeliveryDate( + userId: string, + cartId: string, + requestedDate: string + ): Observable<{}> { + return this.requestedDeliveryDateConnector.setRequestedDeliveryDate( + userId, + cartId, + requestedDate + ); + } + + constructor( + protected requestedDeliveryDateConnector: RequestedDeliveryDateConnector + ) {} +} diff --git a/feature-libs/requested-delivery-date/jest.schematics.config.js b/feature-libs/requested-delivery-date/jest.schematics.config.js new file mode 100644 index 00000000000..9d613f804c1 --- /dev/null +++ b/feature-libs/requested-delivery-date/jest.schematics.config.js @@ -0,0 +1,36 @@ +const { pathsToModuleNameMapper } = require('ts-jest'); +const { compilerOptions } = require('./tsconfig.schematics.json'); +const { defaultTransformerOptions } = require('jest-preset-angular/presets'); + +/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ +module.exports = { + preset: 'jest-preset-angular', + globalSetup: 'jest-preset-angular/global-setup', + moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths || {}, { + prefix: '/', + }), + setupFilesAfterEnv: ['/setup-jest.ts'], + testMatch: ['**/+(*_)+(spec).+(ts)'], + transform: { + '^.+\\.(ts|js|mjs|html|svg)$': [ + 'jest-preset-angular', + { + ...defaultTransformerOptions, + tsconfig: '/tsconfig.schematics.json', + }, + ], + }, + + collectCoverage: false, + coverageReporters: ['json', 'lcov', 'text', 'clover'], + coverageDirectory: + '/../../coverage/requested-delivery-date/schematics', + coverageThreshold: { + global: { + statements: 90, + branches: 90, + functions: 90, + lines: 90, + }, + }, +}; diff --git a/feature-libs/requested-delivery-date/karma.conf.js b/feature-libs/requested-delivery-date/karma.conf.js new file mode 100644 index 00000000000..e451c881c40 --- /dev/null +++ b/feature-libs/requested-delivery-date/karma.conf.js @@ -0,0 +1,50 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['parallel', 'jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-parallel'), + require('karma-jasmine'), + require('karma-coverage'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('@angular-devkit/build-angular/plugins/karma'), + ], + parallelOptions: { + executors: 2, + shardStrategy: 'round-robin', + }, + client: { + clearContext: false, // leave Jasmine Spec Runner output visible in browser + jasmine: { + random: false, + }, + }, + reporters: ['progress', 'kjhtml', 'dots'], + coverageReporter: { + dir: require('path').join( + __dirname, + '../../coverage/requested-delivery-date' + ), + reporters: [{ type: 'lcov', subdir: '.' }, { type: 'text-summary' }], + check: { + global: { + statements: 90, + lines: 90, + branches: 75, + functions: 85, + }, + }, + }, + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true, + }); +}; diff --git a/feature-libs/requested-delivery-date/ng-package.json b/feature-libs/requested-delivery-date/ng-package.json new file mode 100644 index 00000000000..d12af3d785d --- /dev/null +++ b/feature-libs/requested-delivery-date/ng-package.json @@ -0,0 +1,8 @@ +{ + "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/requested-delivery-date", + "lib": { + "entryFile": "./public_api.ts" + }, + "assets": ["**/*.scss", "schematics/**/*.json", "schematics/**/*.js"] +} diff --git a/feature-libs/requested-delivery-date/occ/adapters/index.ts b/feature-libs/requested-delivery-date/occ/adapters/index.ts new file mode 100644 index 00000000000..8b47daab834 --- /dev/null +++ b/feature-libs/requested-delivery-date/occ/adapters/index.ts @@ -0,0 +1,7 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './occ-requested-delivery-date.adapter'; diff --git a/feature-libs/requested-delivery-date/occ/adapters/occ-requested-delivery-date.adapter.spec.ts b/feature-libs/requested-delivery-date/occ/adapters/occ-requested-delivery-date.adapter.spec.ts new file mode 100644 index 00000000000..e65f66370c7 --- /dev/null +++ b/feature-libs/requested-delivery-date/occ/adapters/occ-requested-delivery-date.adapter.spec.ts @@ -0,0 +1,107 @@ +import { HttpClient, HttpErrorResponse } from '@angular/common/http'; +import { + HttpClientTestingModule, + HttpTestingController, +} from '@angular/common/http/testing'; +import { TestBed } from '@angular/core/testing'; +import { HttpErrorModel, OccConfig, OccEndpoints } from '@spartacus/core'; +import { throwError } from 'rxjs'; +import { take } from 'rxjs/operators'; +import { OccRequestedDeliveryDateAdapter } from './occ-requested-delivery-date.adapter'; + +const mockUserId = 'userId1'; +const mockCartId = '00012345'; +const mockRequestedDate = '15-09-2023'; + +const MockOccModuleConfig: OccConfig = { + backend: { + occ: { + baseUrl: '', + prefix: '', + endpoints: { + requestedDeliveryDate: + 'users/${userId}/carts/${cartId}/requestedretrievaldate', + } as OccEndpoints, + }, + }, + context: { + baseSite: [''], + }, +}; + +const mockValidationError = new HttpErrorResponse({ + error: { + errors: [ + { + message: 'checkout.multi.requestedretrievaldatevalid.error', + reason: 'invalid', + type: 'ValidationError', + }, + ], + }, +}); + +describe('OccRequestedDeliveryDateAdapter', () => { + let service: OccRequestedDeliveryDateAdapter; + let httpClient: HttpClient; + let httpMock: HttpTestingController; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [ + OccRequestedDeliveryDateAdapter, + { provide: OccConfig, useValue: MockOccModuleConfig }, + ], + }); + service = TestBed.inject(OccRequestedDeliveryDateAdapter); + httpClient = TestBed.inject(HttpClient); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); + + describe(`set requested delivery date`, () => { + it(`should set requested delivery date for cart for given user id, cart id`, (done) => { + service + .setRequestedDeliveryDate(mockUserId, mockCartId, mockRequestedDate) + .pipe(take(1)) + .subscribe((result) => { + expect(result).toEqual(''); + done(); + }); + + const mockReq = httpMock.expectOne((req) => { + return ( + req.method === 'PUT' && + req.url === + `users/${mockUserId}/carts/${mockCartId}/requestedretrievaldate?requestedRetrievalAt=${mockRequestedDate}` + ); + }); + + expect(mockReq.cancelled).toBeFalsy(); + mockReq.flush(''); + expect(mockReq.request.responseType).toEqual('json'); + }); + + it(`should result in error when Validation Error is thrown`, () => { + spyOn(httpClient, 'put').and.returnValue(throwError(mockValidationError)); + + let result: HttpErrorModel | undefined; + const subscription = service + .setRequestedDeliveryDate(mockUserId, mockCartId, mockRequestedDate) + .pipe(take(1)) + .subscribe({ error: (err: any) => (result = err) }); + + expect(result).toEqual(mockValidationError); + + subscription.unsubscribe(); + }); + }); +}); diff --git a/feature-libs/requested-delivery-date/occ/adapters/occ-requested-delivery-date.adapter.ts b/feature-libs/requested-delivery-date/occ/adapters/occ-requested-delivery-date.adapter.ts new file mode 100644 index 00000000000..6e484dd5ef5 --- /dev/null +++ b/feature-libs/requested-delivery-date/occ/adapters/occ-requested-delivery-date.adapter.ts @@ -0,0 +1,45 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { + InterceptorUtil, + OccEndpointsService, + USE_CLIENT_TOKEN, +} from '@spartacus/core'; +import { RequestedDeliveryDateAdapter } from '@spartacus/requested-delivery-date/core'; + +@Injectable() +export class OccRequestedDeliveryDateAdapter + implements RequestedDeliveryDateAdapter +{ + constructor( + protected http: HttpClient, + protected occEndpoints: OccEndpointsService + ) {} + + setRequestedDeliveryDate( + userId: string, + cartId: string, + requestedRetrievalAt: string + ) { + let headers = new HttpHeaders({ + 'Content-Type': 'application/x-www-form-urlencoded', + }); + headers = InterceptorUtil.createHeader(USE_CLIENT_TOKEN, true, headers); + + const url = this.occEndpoints.buildUrl('requestedDeliveryDate', { + urlParams: { + userId, + cartId, + }, + queryParams: { requestedRetrievalAt }, + }); + + return this.http.put(url, { headers }); + } +} diff --git a/feature-libs/requested-delivery-date/occ/config/default-occ-requested-delivery-date-config.ts b/feature-libs/requested-delivery-date/occ/config/default-occ-requested-delivery-date-config.ts new file mode 100644 index 00000000000..df99c19a8be --- /dev/null +++ b/feature-libs/requested-delivery-date/occ/config/default-occ-requested-delivery-date-config.ts @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { OccConfig } from '@spartacus/core'; + +export const defaultOccRequestedDeliveryDateConfig: OccConfig = { + backend: { + occ: { + endpoints: { + requestedDeliveryDate: + 'users/${userId}/carts/${cartId}/requestedretrievaldate', + }, + }, + }, +}; diff --git a/feature-libs/requested-delivery-date/occ/model/index.ts b/feature-libs/requested-delivery-date/occ/model/index.ts new file mode 100644 index 00000000000..5b7bb4ef8f5 --- /dev/null +++ b/feature-libs/requested-delivery-date/occ/model/index.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// Imported for side effects (module augmentation) +import './occ-requested-delivery-date-endpoints.model'; diff --git a/feature-libs/requested-delivery-date/occ/model/occ-requested-delivery-date-endpoints.model.ts b/feature-libs/requested-delivery-date/occ/model/occ-requested-delivery-date-endpoints.model.ts new file mode 100644 index 00000000000..fdec787b0a2 --- /dev/null +++ b/feature-libs/requested-delivery-date/occ/model/occ-requested-delivery-date-endpoints.model.ts @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { OccEndpoint } from '@spartacus/core'; + +declare module '@spartacus/core' { + interface OccEndpoints { + /** + * Endpoint for requested delivery date + * + * @member {string} + */ + requestedDeliveryDate?: string | OccEndpoint; + } +} diff --git a/feature-libs/requested-delivery-date/occ/ng-package.json b/feature-libs/requested-delivery-date/occ/ng-package.json new file mode 100644 index 00000000000..38e01ac17de --- /dev/null +++ b/feature-libs/requested-delivery-date/occ/ng-package.json @@ -0,0 +1,6 @@ +{ + "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", + "lib": { + "entryFile": "./public_api.ts" + } +} diff --git a/feature-libs/requested-delivery-date/occ/public_api.ts b/feature-libs/requested-delivery-date/occ/public_api.ts new file mode 100644 index 00000000000..0ca2932226d --- /dev/null +++ b/feature-libs/requested-delivery-date/occ/public_api.ts @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './adapters/index'; +export * from './model/index'; +export * from './requested-delivery-date-occ.module'; diff --git a/feature-libs/requested-delivery-date/occ/requested-delivery-date-occ.module.ts b/feature-libs/requested-delivery-date/occ/requested-delivery-date-occ.module.ts new file mode 100644 index 00000000000..59c4a8808fd --- /dev/null +++ b/feature-libs/requested-delivery-date/occ/requested-delivery-date-occ.module.ts @@ -0,0 +1,24 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { provideDefaultConfig } from '@spartacus/core'; +import { RequestedDeliveryDateAdapter } from '@spartacus/requested-delivery-date/core'; +import { OccRequestedDeliveryDateAdapter } from './adapters/occ-requested-delivery-date.adapter'; +import { defaultOccRequestedDeliveryDateConfig } from './config/default-occ-requested-delivery-date-config'; + +@NgModule({ + imports: [CommonModule], + providers: [ + provideDefaultConfig(defaultOccRequestedDeliveryDateConfig), + { + provide: RequestedDeliveryDateAdapter, + useClass: OccRequestedDeliveryDateAdapter, + }, + ], +}) +export class RequestedDeliveryDateOccModule {} diff --git a/feature-libs/requested-delivery-date/package.json b/feature-libs/requested-delivery-date/package.json new file mode 100644 index 00000000000..cbeacc85e4a --- /dev/null +++ b/feature-libs/requested-delivery-date/package.json @@ -0,0 +1,45 @@ +{ + "name": "@spartacus/requested-delivery-date", + "version": "6.3.0-1", + "description": "Requested Delivery Date library for Spartacus", + "keywords": [ + "spartacus", + "framework", + "storefront", + "requested-delivery-date" + ], + "homepage": "https://github.com/SAP/spartacus", + "repository": "https://github.com/SAP/spartacus/tree/develop/feature-libs/requested-delivery-date", + "license": "Apache-2.0", + "exports": { + ".": { + "sass": "./_index.scss" + } + }, + "scripts": { + "build:schematics": "npm run clean:schematics && ../../node_modules/.bin/tsc -p ./tsconfig.schematics.json", + "clean:schematics": "../../node_modules/.bin/rimraf --glob \"schematics/**/*.js\" \"schematics/**/*.js.map\" \"schematics/**/*.d.ts\"", + "test:schematics": "npm --prefix ../../projects/schematics/ run clean && npm run clean:schematics && ../../node_modules/.bin/jest --config ./jest.schematics.config.js" + }, + "dependencies": { + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@angular-devkit/schematics": "^15.2.4", + "@angular/common": "^15.2.4", + "@angular/core": "^15.2.4", + "@angular/forms": "^15.2.4", + "@spartacus/cart": "6.3.0-1", + "@spartacus/checkout": "6.3.0-1", + "@spartacus/core": "6.3.0-1", + "@spartacus/order": "6.3.0-1", + "@spartacus/schematics": "6.3.0-1", + "@spartacus/storefront": "6.3.0-1", + "@spartacus/styles": "6.3.0-1", + "rxjs": "^6.6.0" + }, + "publishConfig": { + "access": "public" + }, + "schematics": "./schematics/collection.json" +} diff --git a/feature-libs/requested-delivery-date/project.json b/feature-libs/requested-delivery-date/project.json new file mode 100644 index 00000000000..9d42bce5e90 --- /dev/null +++ b/feature-libs/requested-delivery-date/project.json @@ -0,0 +1,40 @@ +{ + "name": "requested-delivery-date", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "library", + "sourceRoot": "feature-libs/requested-delivery-date", + "prefix": "cx", + "targets": { + "build": { + "executor": "./tools/build-lib:augmented-types", + "options": { + "tsConfig": "feature-libs/requested-delivery-date/tsconfig.lib.json", + "project": "feature-libs/requested-delivery-date/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "feature-libs/requested-delivery-date/tsconfig.lib.prod.json" + } + } + }, + "test": { + "executor": "@angular-devkit/build-angular:karma", + "options": { + "main": "feature-libs/requested-delivery-date/test.ts", + "tsConfig": "feature-libs/requested-delivery-date/tsconfig.spec.json", + "polyfills": ["zone.js", "zone.js/testing"], + "karmaConfig": "feature-libs/requested-delivery-date/karma.conf.js" + } + }, + "lint": { + "executor": "@angular-eslint/builder:lint", + "options": { + "lintFilePatterns": [ + "feature-libs/requested-delivery-date/**/*.ts", + "feature-libs/requested-delivery-date/**/*.html" + ] + } + } + }, + "tags": ["type:feature"] +} diff --git a/feature-libs/requested-delivery-date/public_api.ts b/feature-libs/requested-delivery-date/public_api.ts new file mode 100644 index 00000000000..1076e3d5a24 --- /dev/null +++ b/feature-libs/requested-delivery-date/public_api.ts @@ -0,0 +1,10 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Public API Surface of requested-delivery-date + */ +export * from './requested-delivery-date.module'; diff --git a/feature-libs/requested-delivery-date/requested-delivery-date.module.ts b/feature-libs/requested-delivery-date/requested-delivery-date.module.ts new file mode 100644 index 00000000000..3f262129034 --- /dev/null +++ b/feature-libs/requested-delivery-date/requested-delivery-date.module.ts @@ -0,0 +1,15 @@ +/* + * SPDX-FileCopyrightText: 2022 SAP Spartacus team + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { NgModule } from '@angular/core'; +import { RequestedDeliveryDateCoreModule } from '@spartacus/requested-delivery-date/core'; +import { RequestedDeliveryDateOccModule } from '@spartacus/requested-delivery-date/occ'; + +@NgModule({ + imports: [RequestedDeliveryDateCoreModule, RequestedDeliveryDateOccModule], +}) +export class RequestedDeliveryDateModule {} diff --git a/feature-libs/requested-delivery-date/root/components/delivery-mode-date-picker/delivery-mode-date-picker.component.html b/feature-libs/requested-delivery-date/root/components/delivery-mode-date-picker/delivery-mode-date-picker.component.html new file mode 100644 index 00000000000..1429921411c --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/delivery-mode-date-picker/delivery-mode-date-picker.component.html @@ -0,0 +1,30 @@ + + + + + +
+
+ +
+
+
+
diff --git a/feature-libs/requested-delivery-date/root/components/delivery-mode-date-picker/delivery-mode-date-picker.component.spec.ts b/feature-libs/requested-delivery-date/root/components/delivery-mode-date-picker/delivery-mode-date-picker.component.spec.ts new file mode 100644 index 00000000000..2341afccc78 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/delivery-mode-date-picker/delivery-mode-date-picker.component.spec.ts @@ -0,0 +1,286 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { + CxDatePipe, + EventService, + GlobalMessageService, + GlobalMessageType, + I18nTestingModule, + LanguageService, + TranslationService, +} from '@spartacus/core'; +import { + Card, + CardModule, + DatePickerModule, + OutletContextData, +} from '@spartacus/storefront'; +import { of, throwError } from 'rxjs'; +import { RequestedDeliveryDateFacade } from '../../facade/requested-delivery-date.facade'; +import { DeliveryModeDatePickerComponent } from './delivery-mode-date-picker.component'; + +describe('DeliveryModeDatePickerComponent', () => { + let component: DeliveryModeDatePickerComponent; + let fixture: ComponentFixture; + + const requestedDelDateFacadeMock = { + setRequestedDeliveryDate: jasmine + .createSpy('setRequestedDeliveryDate') + .and.returnValue(of({})), + }; + + const mockedGlobalMessageService = { + add: () => {}, + remove: () => {}, + }; + + const mockLanguageService = { + getActive: () => of('en'), + }; + + const translationServiceMock = { + translate: jasmine + .createSpy('translate') + .and.returnValue(of('Delivery Date')), + }; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [DeliveryModeDatePickerComponent], + imports: [I18nTestingModule, DatePickerModule, CardModule], + providers: [ + CxDatePipe, + EventService, + { + provide: RequestedDeliveryDateFacade, + useValue: requestedDelDateFacadeMock, + }, + { provide: GlobalMessageService, useValue: mockedGlobalMessageService }, + { provide: TranslationService, useValue: translationServiceMock }, + { provide: LanguageService, useValue: mockLanguageService }, + { + provide: OutletContextData, + useValue: { + context: undefined, + }, + }, + ], + }).compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(DeliveryModeDatePickerComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + afterEach(() => { + fixture.destroy(); + }); + + it('should create the component', () => { + expect(component).toBeTruthy(); + }); + + describe('Render the component based on the Outlet Context readonly attribute', () => { + it('should display card with translated text when outlet context readonly attribute is true', () => { + const data = TestBed.inject(OutletContextData); + const isoDate = '2023-09-15'; + const formattedDate = 'Sep 15, 2023'; + data.context$ = of({ + item: { + requestedRetrievalAt: isoDate, + earliestRetrievalAt: isoDate, + }, + readonly: true, + }); + const textTitle = 'Delivery Date'; + + component.ngOnInit(); + fixture.detectChanges(); + + let card: Card = {}; + component + .getRequestedDeliveryDateCardContent(isoDate) + .subscribe((result) => { + card = result; + }); + + const expectedCard: Card = { + text: [textTitle, isoDate], + }; + + expect(card).toBeTruthy(); + expect(card).toEqual(expectedCard); + + const cardElement = fixture.debugElement.query( + By.css('.cx-card-label:first-child') + )?.nativeElement; + const cardText = fixture.debugElement.query( + By.css('cx-card > div > div > div > div > div:nth-child(2) > div') + )?.nativeElement; + + expect(cardElement.textContent).toContain(textTitle); + expect(cardText.textContent).toContain(formattedDate); + }); + + it('should display date picker component when outlet context readonly attribute is false', () => { + const data = TestBed.inject(OutletContextData); + const earliestDate = '2023-03-05'; + const requestedDate = '2023-09-15'; + + data.context$ = of({ + item: { + requestedRetrievalAt: requestedDate, + earliestRetrievalAt: earliestDate, + }, + readonly: false, + }); + const datePickerLab = 'requestedDeliveryDate.datePickerLabel'; + + component.ngOnInit(); + fixture.detectChanges(); + + const datePickerLabelEl = fixture.debugElement.query( + By.css('form > label > div') + )?.nativeElement; + const datePickerEl = fixture.debugElement.query( + By.css('cx-date-picker') + )?.nativeElement; + + expect(datePickerLabelEl.textContent).toContain(datePickerLab); + expect(datePickerEl.innerHTML).toContain('min="2023-03-05"'); + expect(component['form'].get('requestDeliveryDate')?.value).toBeTruthy(); + }); + }); + + it('should initialize form with requestedRetrievalAt value', () => { + const requestedRetrievalAt = '2023-09-15'; + component['cartEntry'] = { + requestedRetrievalAt, + } as any; + component.ngOnInit(); + expect(component['form'].get('requestDeliveryDate')?.value).toEqual( + requestedRetrievalAt + ); + }); + + it('should set requestedRetrievalAt with earliestRetrievalAt if requestedRetrievalAt is not present', () => { + const earliestRetrievalAt = '2023-09-15'; + component['cartEntry'] = { + earliestRetrievalAt, + code: '123', + user: { + uid: 'current', + }, + } as any; + component.ngOnInit(); + expect(component['requestedRetrievalAt']).toEqual(earliestRetrievalAt); + expect(component['form'].get('requestDeliveryDate')?.value).toEqual( + earliestRetrievalAt + ); + expect( + component['requestedDelDateFacade'].setRequestedDeliveryDate + ).toHaveBeenCalled(); + }); + + it('should call setRequestedDeliveryDate when form value changes and show info message on success', (done) => { + spyOn(component['globalMessageService'], 'add'); + const requestedRetrievalAt = '2023-05-03'; + const earliestRetrievalAt = '2023-09-15'; + const data = TestBed.inject(OutletContextData); + data.context$ = of({ + item: { + requestedRetrievalAt, + earliestRetrievalAt, + code: '123', + user: { + uid: 'current', + }, + }, + readonly: false, + }); + + component.ngOnInit(); + fixture.detectChanges(); + const newRequestedRetrievalAt = '2023-09-15'; + component['form'].patchValue({ + requestDeliveryDate: newRequestedRetrievalAt, + }); + + //Manually trigger change event for date picker. + const event = new Event('update'); + const datePickerEl: HTMLInputElement = fixture.debugElement.query( + By.css('cx-date-picker') + )?.nativeElement; + datePickerEl.dispatchEvent(event); + + expect( + component['requestedDelDateFacade'].setRequestedDeliveryDate + ).toHaveBeenCalled(); + component['requestedDelDateFacade'] + .setRequestedDeliveryDate('current', '123', newRequestedRetrievalAt) + .subscribe(() => { + expect(component['globalMessageService'].add).toHaveBeenCalledWith( + { key: 'requestedDeliveryDate.successMessage' }, + GlobalMessageType.MSG_TYPE_INFO + ); + done(); + }); + }); + + it('should show error message when backend OCC API returns UnknownResourceError', (done) => { + spyOn(component['globalMessageService'], 'add'); + + component['requestedDelDateFacade'].setRequestedDeliveryDate = jasmine + .createSpy('setRequestedDeliveryDate') + .and.returnValue( + throwError({ + error: { + errors: [ + { + message: + 'There is no resource for path /occ/v2/powertools-spa/users/user.lname%40sap-cx.com/carts/0000003004/requestedretrievaldate', + type: 'UnknownResourceError', + }, + ], + }, + }) + ); + + const earliestRetrievalAt = '2023-09-15'; + component['cartEntry'] = { + earliestRetrievalAt, + code: '123', + user: { + uid: 'current', + }, + } as any; + component.ngOnInit(); + expect(component['requestedRetrievalAt']).toEqual(earliestRetrievalAt); + expect(component['form'].get('requestDeliveryDate')?.value).toEqual( + earliestRetrievalAt + ); + expect( + component['requestedDelDateFacade'].setRequestedDeliveryDate + ).toHaveBeenCalled(); + + component['requestedDelDateFacade'] + .setRequestedDeliveryDate('current', '123', earliestRetrievalAt) + .subscribe({ + error: () => { + expect(component['globalMessageService'].add).toHaveBeenCalledWith( + { key: 'requestedDeliveryDate.errorMessage' }, + GlobalMessageType.MSG_TYPE_ERROR + ); + done(); + }, + }); + }); + + it('should unsubscribe from subscription on component destruction', () => { + spyOn(component['subscription'], 'unsubscribe'); + component.ngOnDestroy(); + expect(component['subscription'].unsubscribe).toHaveBeenCalled(); + }); +}); diff --git a/feature-libs/requested-delivery-date/root/components/delivery-mode-date-picker/delivery-mode-date-picker.component.ts b/feature-libs/requested-delivery-date/root/components/delivery-mode-date-picker/delivery-mode-date-picker.component.ts new file mode 100644 index 00000000000..5911eedb6fa --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/delivery-mode-date-picker/delivery-mode-date-picker.component.ts @@ -0,0 +1,154 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { HttpErrorResponse } from '@angular/common/http'; +import { Component, OnDestroy, OnInit, Optional } from '@angular/core'; +import { FormControl, FormGroup } from '@angular/forms'; +import { Cart } from '@spartacus/cart/base/root'; +import { CheckoutSupportedDeliveryModesQueryReloadEvent } from '@spartacus/checkout/base/root'; +import { + CxDatePipe, + ErrorModel, + EventService, + GlobalMessageService, + GlobalMessageType, + TranslationService, +} from '@spartacus/core'; +import { Card, OutletContextData } from '@spartacus/storefront'; +import { Observable, Subscription } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; +import { RequestedDeliveryDateFacade } from '../../facade/requested-delivery-date.facade'; +import { DateValidationService } from '../shared/date-validation.service'; + +@Component({ + selector: 'cx-request-delivery-date', + templateUrl: './delivery-mode-date-picker.component.html', + providers: [CxDatePipe], +}) +export class DeliveryModeDatePickerComponent implements OnInit, OnDestroy { + constructor( + protected datePipe: CxDatePipe, + protected requestedDelDateFacade: RequestedDeliveryDateFacade, + protected dateValidationService: DateValidationService, + protected eventService: EventService, + protected translation: TranslationService, + protected globalMessageService: GlobalMessageService, + @Optional() protected deliveryOutlet?: OutletContextData + ) {} + + protected cartEntry: Cart = {}; + protected subscription = new Subscription(); + + protected earliestRetrievalAt: string | undefined; + protected requestedRetrievalAt: string | undefined; + protected form: FormGroup = new FormGroup({ + requestDeliveryDate: new FormControl(), + }); + protected isDatePickerReadOnly: boolean = true; + + ngOnInit(): void { + if (this.deliveryOutlet?.context$) { + this.subscription.add( + this.deliveryOutlet.context$.subscribe((context) => { + this.cartEntry = context?.item; + this.isDatePickerReadOnly = context?.readonly || false; + }) + ); + } + + if (this.isEarliestRetrievalDatePresent()) { + this.earliestRetrievalAt = this.cartEntry.earliestRetrievalAt; + } + if (this.isRequestedDeliveryDatePresent()) { + this.requestedRetrievalAt = this.cartEntry.requestedRetrievalAt; + } else { + //set the value of requestedRetrievalAt as earliestRetrievalAt and update occ. + this.requestedRetrievalAt = this.earliestRetrievalAt; + this.setRequestedDeliveryDate(); + } + this.form.patchValue({ + requestDeliveryDate: this.requestedRetrievalAt, + }); + } + + isEarliestRetrievalDatePresent(): boolean { + return this.dateValidationService.isDateStringValid( + this.cartEntry?.earliestRetrievalAt + ); + } + + isRequestedDeliveryDatePresent(): boolean { + return this.dateValidationService.isDateStringValid( + this.cartEntry?.requestedRetrievalAt + ); + } + + getRequestedDeliveryDateCardContent( + isoDate: string | null + ): Observable { + return this.translation + .translate('requestedDeliveryDate.readOnlyTextLabel') + .pipe( + filter(() => Boolean(isoDate)), + map((textTitle) => { + return { + text: [textTitle, isoDate], + } as Card; + }) + ); + } + + setRequestedDeliveryDate() { + const userId = this.cartEntry?.user?.uid || ''; + const cartId = this.cartEntry?.code || ''; + const requestedDate = + this.form?.get('requestDeliveryDate')?.value || + this.requestedRetrievalAt || + ''; + + if ( + userId.length === 0 || + cartId.length === 0 || + requestedDate.length === 0 + ) { + return; + } + this.subscription.add( + this.requestedDelDateFacade + .setRequestedDeliveryDate(userId, cartId, requestedDate) + .subscribe({ + next: () => { + this.eventService.dispatch( + {}, + CheckoutSupportedDeliveryModesQueryReloadEvent + ); + this.globalMessageService.add( + { key: 'requestedDeliveryDate.successMessage' }, + GlobalMessageType.MSG_TYPE_INFO + ); + }, + error: (error: HttpErrorResponse) => { + if (error && this.getErrors(error)?.length) { + this.globalMessageService.add( + { key: 'requestedDeliveryDate.errorMessage' }, + GlobalMessageType.MSG_TYPE_ERROR + ); + } + }, + }) + ); + } + + getErrors(response: HttpErrorResponse): ErrorModel[] { + return (response.error?.errors).filter( + (error: any) => error?.type === 'UnknownResourceError' + ); + } + + ngOnDestroy(): void { + this.subscription.unsubscribe(); + } +} diff --git a/feature-libs/requested-delivery-date/root/components/index.ts b/feature-libs/requested-delivery-date/root/components/index.ts new file mode 100644 index 00000000000..d2c7af18ba0 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/index.ts @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './delivery-mode-date-picker/delivery-mode-date-picker.component'; +export * from './order-overview-delivery-date/order-overview-delivery-date.component'; +export * from './requested-delivery-date-components.module'; diff --git a/feature-libs/requested-delivery-date/root/components/order-overview-delivery-date/order-overview-delivery-date.component.html b/feature-libs/requested-delivery-date/root/components/order-overview-delivery-date/order-overview-delivery-date.component.html new file mode 100644 index 00000000000..a85f0c6d637 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/order-overview-delivery-date/order-overview-delivery-date.component.html @@ -0,0 +1,8 @@ + + + diff --git a/feature-libs/requested-delivery-date/root/components/order-overview-delivery-date/order-overview-delivery-date.component.spec.ts b/feature-libs/requested-delivery-date/root/components/order-overview-delivery-date/order-overview-delivery-date.component.spec.ts new file mode 100644 index 00000000000..9511956fff4 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/order-overview-delivery-date/order-overview-delivery-date.component.spec.ts @@ -0,0 +1,69 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { I18nTestingModule, TranslationService } from '@spartacus/core'; +import { Card, OutletContextData } from '@spartacus/storefront'; +import { of } from 'rxjs'; +import { OrderOverviewDeliveryDateComponent } from './order-overview-delivery-date.component'; + +describe('OrderOverviewDeliveryDateComponent', () => { + let component: OrderOverviewDeliveryDateComponent; + let fixture: ComponentFixture; + + const translationServiceMock = { + translate: jasmine + .createSpy('translate') + .and.returnValue(of('Translated Text')), + }; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [OrderOverviewDeliveryDateComponent], + imports: [I18nTestingModule], + providers: [ + { provide: TranslationService, useValue: translationServiceMock }, + ], + }).compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(OrderOverviewDeliveryDateComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + afterEach(() => { + fixture.destroy(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should set order property when context changes', () => { + const order = { code: '123' } as any; + component['orderOutlet'] = { + context$: of({ item: order }), + } as OutletContextData; + component.ngOnInit(); + expect(component.order).toEqual(order); + }); + + it('should return card content with translated text and isoDate', () => { + const isoDate = '2022-01-01'; + const expectedCard: Card = { + title: 'Translated Text', + text: [isoDate], + }; + + const result$ = component.getRequestedDeliveryDateCardContent(isoDate); + + result$.subscribe((card) => { + expect(card).toEqual(expectedCard); + }); + }); + + it('should unsubscribe from subscription on component destruction', () => { + spyOn(component['subscription'], 'unsubscribe'); + component.ngOnDestroy(); + expect(component['subscription'].unsubscribe).toHaveBeenCalled(); + }); +}); diff --git a/feature-libs/requested-delivery-date/root/components/order-overview-delivery-date/order-overview-delivery-date.component.ts b/feature-libs/requested-delivery-date/root/components/order-overview-delivery-date/order-overview-delivery-date.component.ts new file mode 100644 index 00000000000..1520459a195 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/order-overview-delivery-date/order-overview-delivery-date.component.ts @@ -0,0 +1,64 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Component, OnDestroy, OnInit, Optional } from '@angular/core'; +import { TranslationService } from '@spartacus/core'; +import { Order } from '@spartacus/order/root'; +import { Card, OutletContextData } from '@spartacus/storefront'; +import { Observable, Subscription } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; +import { DateValidationService } from '../shared/date-validation.service'; + +@Component({ + selector: 'cx-order-overview-delivery-date', + templateUrl: './order-overview-delivery-date.component.html', +}) +export class OrderOverviewDeliveryDateComponent implements OnInit, OnDestroy { + constructor( + protected dateValidationService: DateValidationService, + protected translation: TranslationService, + @Optional() protected orderOutlet?: OutletContextData + ) {} + + protected subscription = new Subscription(); + order: Order; + + ngOnInit(): void { + if (this.orderOutlet?.context$) { + this.subscription.add( + this.orderOutlet.context$.subscribe( + (context) => (this.order = context?.item) + ) + ); + } + } + + isRequestedDeliveryDatePresent(): boolean { + return this.dateValidationService.isDateStringValid( + this.order?.requestedRetrievalAt + ); + } + + getRequestedDeliveryDateCardContent( + isoDate: string | null + ): Observable { + return this.translation + .translate('requestedDeliveryDate.readOnlyTextLabel') + .pipe( + filter(() => Boolean(isoDate)), + map((textTitle) => { + return { + title: textTitle, + text: [isoDate], + } as Card; + }) + ); + } + + ngOnDestroy(): void { + this.subscription.unsubscribe(); + } +} diff --git a/feature-libs/requested-delivery-date/root/components/requested-delivery-date-components.module.ts b/feature-libs/requested-delivery-date/root/components/requested-delivery-date-components.module.ts new file mode 100644 index 00000000000..a844ca1effc --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/requested-delivery-date-components.module.ts @@ -0,0 +1,32 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { ReactiveFormsModule } from '@angular/forms'; +import { I18nModule } from '@spartacus/core'; +import { CardModule, DatePickerModule } from '@spartacus/storefront'; +import { DeliveryModeDatePickerComponent } from './delivery-mode-date-picker/delivery-mode-date-picker.component'; +import { OrderOverviewDeliveryDateComponent } from './order-overview-delivery-date/order-overview-delivery-date.component'; + +@NgModule({ + imports: [ + CommonModule, + DatePickerModule, + I18nModule, + ReactiveFormsModule, + CardModule, + ], + declarations: [ + DeliveryModeDatePickerComponent, + OrderOverviewDeliveryDateComponent, + ], + exports: [ + DeliveryModeDatePickerComponent, + OrderOverviewDeliveryDateComponent, + ], +}) +export class RequestedDeliveryDateComponentsModule {} diff --git a/feature-libs/requested-delivery-date/root/components/shared/date-validation.service.spec.ts b/feature-libs/requested-delivery-date/root/components/shared/date-validation.service.spec.ts new file mode 100644 index 00000000000..5e947fcaca0 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/shared/date-validation.service.spec.ts @@ -0,0 +1,35 @@ +import { TestBed } from '@angular/core/testing'; +import { DateValidationService } from './date-validation.service'; + +const mockValidDate = '15-09-2023'; +const mockInvalidDate1 = '32-09-2023'; +const mockInvalidDate2 = '29-02-rddo'; +const mockInvalidDate3 = ''; +const mockInvalidDate4 = 'abcd'; + +describe('DateValidationService', () => { + let service: DateValidationService; + + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [DateValidationService], + }); + + service = TestBed.inject(DateValidationService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); + + it('should validate correct Dates', () => { + expect(service.isDateStringValid(mockValidDate)).toBeTruthy(); + }); + + it('should invalidate wrong Dates', () => { + expect(service.isDateStringValid(mockInvalidDate1)).toBeFalsy(); + expect(service.isDateStringValid(mockInvalidDate2)).toBeFalsy(); + expect(service.isDateStringValid(mockInvalidDate3)).toBeFalsy(); + expect(service.isDateStringValid(mockInvalidDate4)).toBeFalsy(); + }); +}); diff --git a/feature-libs/requested-delivery-date/root/components/shared/date-validation.service.ts b/feature-libs/requested-delivery-date/root/components/shared/date-validation.service.ts new file mode 100644 index 00000000000..2410013bd29 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/components/shared/date-validation.service.ts @@ -0,0 +1,28 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root', +}) +export class DateValidationService { + /** + * Validates if the string is containing a date string. + * @param value Date string in the format 'dd-mm-yyy' + * @returns true if valid, false if invalid + */ + isDateStringValid(value: string | undefined): boolean { + return ( + value != null && + value !== undefined && + value.length > 0 && + !isNaN( + new Date(value.replace(/(\d{2})-(\d{2})-(\d{4})/, '$2/$1/$3')).getDate() //convert 'dd-mm-yyyy' into 'mm/dd/yyyy' + ) + ); + } +} diff --git a/feature-libs/requested-delivery-date/root/facade/index.ts b/feature-libs/requested-delivery-date/root/facade/index.ts new file mode 100644 index 00000000000..e4a8bad6ac2 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/facade/index.ts @@ -0,0 +1,7 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './requested-delivery-date.facade'; diff --git a/feature-libs/requested-delivery-date/root/facade/requested-delivery-date.facade.ts b/feature-libs/requested-delivery-date/root/facade/requested-delivery-date.facade.ts new file mode 100644 index 00000000000..1fea680bbf3 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/facade/requested-delivery-date.facade.ts @@ -0,0 +1,33 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Injectable } from '@angular/core'; +import { facadeFactory } from '@spartacus/core'; +import { Observable } from 'rxjs'; +import { REQUESTED_DELIVERY_DATE_FEATURE } from '../feature-name'; + +export function requestedDeliveryDateFacadeFactory() { + return facadeFactory({ + facade: RequestedDeliveryDateFacade, + feature: REQUESTED_DELIVERY_DATE_FEATURE, + methods: ['setRequestedDeliveryDate'], + }); +} + +@Injectable({ + providedIn: 'root', + useFactory: requestedDeliveryDateFacadeFactory, +}) +export abstract class RequestedDeliveryDateFacade { + /** + * Set the requested delivery date + */ + abstract setRequestedDeliveryDate( + userId: string, + cartId: string, + requestedDate: string + ): Observable<{}>; +} diff --git a/feature-libs/requested-delivery-date/root/feature-name.ts b/feature-libs/requested-delivery-date/root/feature-name.ts new file mode 100644 index 00000000000..de942fd4fbb --- /dev/null +++ b/feature-libs/requested-delivery-date/root/feature-name.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export const REQUESTED_DELIVERY_DATE_FEATURE = 'requestedDeliveryDate'; +export const REQUESTED_DELIVERY_DATE_CORE_FEATURE = 'requestedDeliveryDateCore'; diff --git a/feature-libs/requested-delivery-date/root/model/augmented-core.model.ts b/feature-libs/requested-delivery-date/root/model/augmented-core.model.ts new file mode 100644 index 00000000000..13494181400 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/model/augmented-core.model.ts @@ -0,0 +1,21 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import '@spartacus/cart/base/root'; +import '@spartacus/order/root'; + +declare module '@spartacus/cart/base/root' { + interface Cart { + earliestRetrievalAt?: string; + requestedRetrievalAt?: string; + } +} + +declare module '@spartacus/order/root' { + interface Order { + requestedRetrievalAt?: string; + } +} diff --git a/feature-libs/requested-delivery-date/root/model/index.ts b/feature-libs/requested-delivery-date/root/model/index.ts new file mode 100644 index 00000000000..1b216202084 --- /dev/null +++ b/feature-libs/requested-delivery-date/root/model/index.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// Imported for side effects (module augmentation) +import './augmented-core.model'; diff --git a/feature-libs/requested-delivery-date/root/ng-package.json b/feature-libs/requested-delivery-date/root/ng-package.json new file mode 100644 index 00000000000..38e01ac17de --- /dev/null +++ b/feature-libs/requested-delivery-date/root/ng-package.json @@ -0,0 +1,6 @@ +{ + "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", + "lib": { + "entryFile": "./public_api.ts" + } +} diff --git a/feature-libs/requested-delivery-date/root/public_api.ts b/feature-libs/requested-delivery-date/root/public_api.ts new file mode 100644 index 00000000000..f20c3d9911d --- /dev/null +++ b/feature-libs/requested-delivery-date/root/public_api.ts @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2022 SAP Spartacus team + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './components/index'; //Make components available without being CMS driven +export * from './facade/index'; +export * from './feature-name'; +export * from './model/index'; +export * from './requested-delivery-date-root.module'; diff --git a/feature-libs/requested-delivery-date/root/requested-delivery-date-root.module.ts b/feature-libs/requested-delivery-date/root/requested-delivery-date-root.module.ts new file mode 100644 index 00000000000..47fbc3bef9d --- /dev/null +++ b/feature-libs/requested-delivery-date/root/requested-delivery-date-root.module.ts @@ -0,0 +1,51 @@ +/* + * SPDX-FileCopyrightText: 2022 SAP Spartacus team + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { NgModule } from '@angular/core'; +import { CartOutlets } from '@spartacus/cart/base/root'; +import { CmsConfig, provideDefaultConfigFactory } from '@spartacus/core'; +import { OutletPosition, provideOutlet } from '@spartacus/storefront'; +import { DeliveryModeDatePickerComponent } from './components/delivery-mode-date-picker/delivery-mode-date-picker.component'; +import { OrderOverviewDeliveryDateComponent } from './components/order-overview-delivery-date/order-overview-delivery-date.component'; +import { + REQUESTED_DELIVERY_DATE_CORE_FEATURE, + REQUESTED_DELIVERY_DATE_FEATURE, +} from './feature-name'; + +export function defaultRequestedDeliveryDateComponentsConfig(): CmsConfig { + const config: CmsConfig = { + featureModules: { + [REQUESTED_DELIVERY_DATE_FEATURE]: { + cmsComponents: [ + 'DeliveryModeDatePickerComponent', + 'OrderOverviewDeliveryDateComponent', + ], + }, + // by default core is bundled together with components + [REQUESTED_DELIVERY_DATE_CORE_FEATURE]: REQUESTED_DELIVERY_DATE_FEATURE, + }, + }; + + return config; +} + +@NgModule({ + providers: [ + provideOutlet({ + id: CartOutlets.DELIVERY_MODE, + position: OutletPosition.AFTER, + component: DeliveryModeDatePickerComponent, + }), + provideOutlet({ + id: CartOutlets.ORDER_OVERVIEW, + position: OutletPosition.AFTER, + component: OrderOverviewDeliveryDateComponent, + }), + provideDefaultConfigFactory(defaultRequestedDeliveryDateComponentsConfig), + ], +}) +export class RequestedDeliveryDateRootModule {} diff --git a/feature-libs/requested-delivery-date/schematics/.gitignore b/feature-libs/requested-delivery-date/schematics/.gitignore new file mode 100644 index 00000000000..c88f4d69e15 --- /dev/null +++ b/feature-libs/requested-delivery-date/schematics/.gitignore @@ -0,0 +1,18 @@ +# Outputs +**/*.js +**/*.js.map +**/*.d.ts + +# IDEs +.idea/ +jsconfig.json +.vscode/ + +# Misc +node_modules/ +npm-debug.log* +yarn-error.log* + +# Mac OSX Finder files. +**/.DS_Store +.DS_Store diff --git a/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/__snapshots__/index_spec.ts.snap b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/__snapshots__/index_spec.ts.snap new file mode 100644 index 00000000000..621f8c67463 --- /dev/null +++ b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/__snapshots__/index_spec.ts.snap @@ -0,0 +1,130 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Spartacus Requested Delivery Date schematics: ng-add Requested Delivery Date feature eager loading should import appropriate modules 1`] = `""`; + +exports[`Spartacus Requested Delivery Date schematics: ng-add Requested Delivery Date feature general setup should add the feature using the lazy loading syntax 1`] = `""`; + +exports[`Spartacus Requested Delivery Date schematics: ng-add Requested Delivery Date feature general setup styling should create a proper scss file 1`] = ` +"@import "../../styles-config"; +@import "@spartacus/requested-delivery-date"; +" +`; + +exports[`Spartacus Requested Delivery Date schematics: ng-add Requested Delivery Date feature general setup styling should update angular.json 1`] = ` +"{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "", + "projects": { + "schematics-test": { + "projectType": "application", + "schematics": { + "@schematics/angular:component": { + "style": "scss" + } + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/schematics-test", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": [ + "zone.js" + ], + "tsConfig": "tsconfig.app.json", + "inlineStyleLanguage": "scss", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss", + "src/styles/spartacus/requested-delivery-date.scss" + ], + "scripts": [], + "stylePreprocessorOptions": { + "includePaths": [ + "node_modules/" + ] + } + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "2.5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kb", + "maximumError": "4kb" + } + ], + "outputHashing": "all" + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "browserTarget": "schematics-test:build:production" + }, + "development": { + "browserTarget": "schematics-test:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "schematics-test:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "polyfills": [ + "zone.js", + "zone.js/testing" + ], + "tsConfig": "tsconfig.spec.json", + "inlineStyleLanguage": "scss", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss", + "src/styles/spartacus/requested-delivery-date.scss" + ], + "scripts": [], + "stylePreprocessorOptions": { + "includePaths": [ + "node_modules/" + ] + } + } + } + } + } + } +}" +`; diff --git a/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index.ts b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index.ts new file mode 100644 index 00000000000..36117e0edf7 --- /dev/null +++ b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index.ts @@ -0,0 +1,46 @@ +/* + * SPDX-FileCopyrightText: 2022 SAP Spartacus team + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { + chain, + Rule, + SchematicContext, + Tree, +} from '@angular-devkit/schematics'; +import { + addFeatures, + addPackageJsonDependenciesForLibrary, + analyzeApplication, + analyzeCrossFeatureDependencies, + finalizeInstallation, + LibraryOptions as SpartacusRequestedDeliveryDateOptions, + readPackageJson, + validateSpartacusInstallation, +} from '@spartacus/schematics'; +import { peerDependencies } from '../../package.json'; + +export function addRequestedDeliveryDateFeature( + options: SpartacusRequestedDeliveryDateOptions +): Rule { + return (tree: Tree, _context: SchematicContext): Rule => { + const packageJson = readPackageJson(tree); + validateSpartacusInstallation(packageJson); + + const features = analyzeCrossFeatureDependencies( + options.features as string[] + ); + + return chain([ + analyzeApplication(options, features), + + addFeatures(options, features), + addPackageJsonDependenciesForLibrary(peerDependencies, options), + + finalizeInstallation(options, features), + ]); + }; +} diff --git a/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index_spec.ts b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index_spec.ts new file mode 100644 index 00000000000..cff43d68f33 --- /dev/null +++ b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/index_spec.ts @@ -0,0 +1,181 @@ +/// + +import { + SchematicTestRunner, + UnitTestTree, +} from '@angular-devkit/schematics/testing'; +import { + Schema as ApplicationOptions, + Style, +} from '@schematics/angular/application/schema'; +import { Schema as WorkspaceOptions } from '@schematics/angular/workspace/schema'; +import { + LibraryOptions as RequestedDeliveryDateOptions, + requestedDeliveryDateFeatureModulePath, + REQUESTED_DELIVERY_DATE_FEATURE_NAME, + SpartacusOptions, + SPARTACUS_REQUESTED_DELIVERY_DATE, + SPARTACUS_SCHEMATICS, +} from '@spartacus/schematics'; +import * as path from 'path'; +import { peerDependencies } from '../../package.json'; + +const collectionPath = path.join(__dirname, '../collection.json'); +const scssFilePath = 'src/styles/spartacus/requested-delivery-date.scss'; + +describe('Spartacus Requested Delivery Date schematics: ng-add', () => { + const schematicRunner = new SchematicTestRunner( + SPARTACUS_REQUESTED_DELIVERY_DATE, + collectionPath + ); + + let appTree: UnitTestTree; + + const workspaceOptions: WorkspaceOptions = { + name: 'workspace', + version: '0.5.0', + }; + + const appOptions: ApplicationOptions = { + name: 'schematics-test', + inlineStyle: false, + inlineTemplate: false, + routing: false, + style: Style.Scss, + skipTests: false, + projectRoot: '', + }; + + const spartacusDefaultOptions: SpartacusOptions = { + project: 'schematics-test', + lazy: true, + features: [], + }; + + const libraryNoFeaturesOptions: RequestedDeliveryDateOptions = { + project: 'schematics-test', + lazy: true, + features: [], + }; + + const rddOptions: RequestedDeliveryDateOptions = { + ...libraryNoFeaturesOptions, + features: [REQUESTED_DELIVERY_DATE_FEATURE_NAME], + }; + + beforeEach(async () => { + schematicRunner.registerCollection( + SPARTACUS_SCHEMATICS, + '../../projects/schematics/src/collection.json' + ); + + appTree = await schematicRunner.runExternalSchematic( + '@schematics/angular', + 'workspace', + workspaceOptions + ); + + appTree = await schematicRunner.runExternalSchematic( + '@schematics/angular', + 'application', + appOptions, + appTree + ); + + appTree = await schematicRunner.runExternalSchematic( + SPARTACUS_SCHEMATICS, + 'ng-add', + { ...spartacusDefaultOptions, name: 'schematics-test' }, + appTree + ); + }); + + describe('Without features', () => { + beforeEach(async () => { + appTree = await schematicRunner.runSchematic( + 'ng-add', + libraryNoFeaturesOptions, + appTree + ); + }); + + it('should not create any of the feature modules', () => { + expect( + appTree.exists(requestedDeliveryDateFeatureModulePath) + ).toBeFalsy(); + }); + + it('should install necessary Spartacus libraries', () => { + const packageJson = JSON.parse(appTree.readContent('package.json')); + let dependencies: Record = {}; + dependencies = { ...packageJson.dependencies }; + dependencies = { ...dependencies, ...packageJson.devDependencies }; + + for (const toAdd in peerDependencies) { + // skip the SPARTACUS_SCHEMATICS, as those are added only when running by the Angular CLI, and not in the testing environment + if ( + !peerDependencies.hasOwnProperty(toAdd) || + toAdd === SPARTACUS_SCHEMATICS + ) { + continue; + } + // TODO: after 4.0: use this test, as we'll have synced versions between lib's and root package.json + // const expectedVersion = (peerDependencies as Record< + // string, + // string + // >)[toAdd]; + const expectedDependency = dependencies[toAdd]; + expect(expectedDependency).toBeTruthy(); + // expect(expectedDependency).toEqual(expectedVersion); + } + }); + }); + + describe('Requested Delivery Date feature', () => { + describe('general setup', () => { + beforeEach(async () => { + appTree = await schematicRunner.runSchematic( + 'ng-add', + rddOptions, + appTree + ); + }); + + it('should add the feature using the lazy loading syntax', async () => { + const module = appTree.readContent( + requestedDeliveryDateFeatureModulePath + ); + expect(module).toMatchSnapshot(); + }); + + describe('styling', () => { + it('should create a proper scss file', () => { + const scssContent = appTree.readContent(scssFilePath); + expect(scssContent).toMatchSnapshot(); + }); + + it('should update angular.json', async () => { + const content = appTree.readContent('/angular.json'); + expect(content).toMatchSnapshot(); + }); + }); + }); + + describe('eager loading', () => { + beforeEach(async () => { + appTree = await schematicRunner.runSchematic( + 'ng-add', + { ...rddOptions, lazy: false }, + appTree + ); + }); + + it('should import appropriate modules', async () => { + const module = appTree.readContent( + requestedDeliveryDateFeatureModulePath + ); + expect(module).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/schema.json b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/schema.json new file mode 100644 index 00000000000..536d90100ba --- /dev/null +++ b/feature-libs/requested-delivery-date/schematics/add-requested-delivery-date/schema.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/schema", + "$id": "RequestedDeliveryDateSchematics", + "title": "Requested Delivery Date Schematics", + "type": "object", + "properties": { + "project": { + "type": "string", + "description": "The name of the project.", + "$default": { + "$source": "projectName" + } + }, + "debug": { + "description": "Display additional details during the running process.", + "type": "boolean", + "default": false + }, + "lazy": { + "type": "boolean", + "description": "Lazy load the Requested Delivery Date.", + "default": true + }, + "features": { + "type": "array", + "uniqueItems": true, + "default": ["Requested-Delivery-Date"] + } + }, + "required": [] +} diff --git a/feature-libs/requested-delivery-date/schematics/collection.json b/feature-libs/requested-delivery-date/schematics/collection.json new file mode 100644 index 00000000000..6c428a2907e --- /dev/null +++ b/feature-libs/requested-delivery-date/schematics/collection.json @@ -0,0 +1,18 @@ +{ + "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json", + "schematics": { + "ng-add": { + "factory": "./add-requested-delivery-date/index#addRequestedDeliveryDateFeature", + "description": "Add Requested Delivery Date feature", + "schema": "./add-requested-delivery-date/schema.json", + "private": true, + "hidden": true, + "aliases": ["install"] + }, + "add": { + "factory": "./add-requested-delivery-date/index#addRequestedDeliveryDateFeature", + "description": "Add and configure Requested Delivery Date feature", + "schema": "./add-requested-delivery-date/schema.json" + } + } +} diff --git a/feature-libs/requested-delivery-date/setup-jest.ts b/feature-libs/requested-delivery-date/setup-jest.ts new file mode 100644 index 00000000000..919fe8743ac --- /dev/null +++ b/feature-libs/requested-delivery-date/setup-jest.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import 'jest-preset-angular/setup-jest'; +import 'zone.js'; diff --git a/feature-libs/requested-delivery-date/styles/_index.scss b/feature-libs/requested-delivery-date/styles/_index.scss new file mode 100644 index 00000000000..93340d0a5ca --- /dev/null +++ b/feature-libs/requested-delivery-date/styles/_index.scss @@ -0,0 +1 @@ +@import './requested-delivery-date'; diff --git a/feature-libs/requested-delivery-date/styles/_requested-delivery-date.scss b/feature-libs/requested-delivery-date/styles/_requested-delivery-date.scss new file mode 100644 index 00000000000..267824bf4bb --- /dev/null +++ b/feature-libs/requested-delivery-date/styles/_requested-delivery-date.scss @@ -0,0 +1,25 @@ +cx-request-delivery-date { + form { + width: 100%; + } + + cx-card { + .cx-card { + .card-body { + padding-top: 0; + } + } + } +} + +// Avoid bottom padding in the delivery method, as the padding +// would add extra space with the delivey mode date picker +.cx-review-card-shipping { + cx-card { + .cx-card { + .card-body { + padding-bottom: 0; + } + } + } +} diff --git a/feature-libs/requested-delivery-date/test.ts b/feature-libs/requested-delivery-date/test.ts new file mode 100644 index 00000000000..bd3bae74074 --- /dev/null +++ b/feature-libs/requested-delivery-date/test.ts @@ -0,0 +1,22 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting, +} from '@angular/platform-browser-dynamic/testing'; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting(), + { + teardown: { destroyAfterEach: false }, + } +); diff --git a/feature-libs/requested-delivery-date/tsconfig.lib.json b/feature-libs/requested-delivery-date/tsconfig.lib.json new file mode 100644 index 00000000000..78d0becdbd7 --- /dev/null +++ b/feature-libs/requested-delivery-date/tsconfig.lib.json @@ -0,0 +1,124 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/lib", + "declarationMap": true, + "forceConsistentCasingInFileNames": true, + "target": "es2020", + "module": "es2020", + "moduleResolution": "node", + "declaration": true, + "sourceMap": true, + "inlineSources": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "importHelpers": true, + "types": [], + "lib": ["dom", "esnext"], + "strict": true, + "paths": { + "@spartacus/cart/base/assets": ["dist/cart/base/assets"], + "@spartacus/cart/base/components/add-to-cart": [ + "dist/cart/base/components/add-to-cart" + ], + "@spartacus/cart/base/components/mini-cart": [ + "dist/cart/base/components/mini-cart" + ], + "@spartacus/cart/base/components": ["dist/cart/base/components"], + "@spartacus/cart/base/core": ["dist/cart/base/core"], + "@spartacus/cart/base": ["dist/cart/base"], + "@spartacus/cart/base/occ": ["dist/cart/base/occ"], + "@spartacus/cart/base/root": ["dist/cart/base/root"], + "@spartacus/cart/import-export/assets": [ + "dist/cart/import-export/assets" + ], + "@spartacus/cart/import-export/components": [ + "dist/cart/import-export/components" + ], + "@spartacus/cart/import-export/core": ["dist/cart/import-export/core"], + "@spartacus/cart/import-export": ["dist/cart/import-export"], + "@spartacus/cart/import-export/root": ["dist/cart/import-export/root"], + "@spartacus/cart": ["dist/cart"], + "@spartacus/cart/quick-order/assets": ["dist/cart/quick-order/assets"], + "@spartacus/cart/quick-order/components": [ + "dist/cart/quick-order/components" + ], + "@spartacus/cart/quick-order/core": ["dist/cart/quick-order/core"], + "@spartacus/cart/quick-order": ["dist/cart/quick-order"], + "@spartacus/cart/quick-order/root": ["dist/cart/quick-order/root"], + "@spartacus/cart/saved-cart/assets": ["dist/cart/saved-cart/assets"], + "@spartacus/cart/saved-cart/components": [ + "dist/cart/saved-cart/components" + ], + "@spartacus/cart/saved-cart/core": ["dist/cart/saved-cart/core"], + "@spartacus/cart/saved-cart": ["dist/cart/saved-cart"], + "@spartacus/cart/saved-cart/occ": ["dist/cart/saved-cart/occ"], + "@spartacus/cart/saved-cart/root": ["dist/cart/saved-cart/root"], + "@spartacus/cart/wish-list/assets": ["dist/cart/wish-list/assets"], + "@spartacus/cart/wish-list/components/add-to-wishlist": [ + "dist/cart/wish-list/components/add-to-wishlist" + ], + "@spartacus/cart/wish-list/components": [ + "dist/cart/wish-list/components" + ], + "@spartacus/cart/wish-list/core": ["dist/cart/wish-list/core"], + "@spartacus/cart/wish-list": ["dist/cart/wish-list"], + "@spartacus/cart/wish-list/root": ["dist/cart/wish-list/root"], + "@spartacus/core": ["dist/core"], + "@spartacus/checkout/b2b/assets": ["dist/checkout/b2b/assets"], + "@spartacus/checkout/b2b/components": ["dist/checkout/b2b/components"], + "@spartacus/checkout/b2b/core": ["dist/checkout/b2b/core"], + "@spartacus/checkout/b2b": ["dist/checkout/b2b"], + "@spartacus/checkout/b2b/occ": ["dist/checkout/b2b/occ"], + "@spartacus/checkout/b2b/root": ["dist/checkout/b2b/root"], + "@spartacus/checkout/base/assets": ["dist/checkout/base/assets"], + "@spartacus/checkout/base/components": ["dist/checkout/base/components"], + "@spartacus/checkout/base/core": ["dist/checkout/base/core"], + "@spartacus/checkout/base": ["dist/checkout/base"], + "@spartacus/checkout/base/occ": ["dist/checkout/base/occ"], + "@spartacus/checkout/base/root": ["dist/checkout/base/root"], + "@spartacus/checkout": ["dist/checkout"], + "@spartacus/checkout/scheduled-replenishment/assets": [ + "dist/checkout/scheduled-replenishment/assets" + ], + "@spartacus/checkout/scheduled-replenishment/components": [ + "dist/checkout/scheduled-replenishment/components" + ], + "@spartacus/checkout/scheduled-replenishment": [ + "dist/checkout/scheduled-replenishment" + ], + "@spartacus/checkout/scheduled-replenishment/root": [ + "dist/checkout/scheduled-replenishment/root" + ], + "@spartacus/order/assets": ["dist/order/assets"], + "@spartacus/order/components": ["dist/order/components"], + "@spartacus/order/core": ["dist/order/core"], + "@spartacus/order": ["dist/order"], + "@spartacus/order/occ": ["dist/order/occ"], + "@spartacus/order/root": ["dist/order/root"], + "@spartacus/storefront": ["dist/storefrontlib"], + "@spartacus/user/account/assets": ["dist/user/account/assets"], + "@spartacus/user/account/components": ["dist/user/account/components"], + "@spartacus/user/account/core": ["dist/user/account/core"], + "@spartacus/user/account": ["dist/user/account"], + "@spartacus/user/account/occ": ["dist/user/account/occ"], + "@spartacus/user/account/root": ["dist/user/account/root"], + "@spartacus/user": ["dist/user"], + "@spartacus/user/profile/assets": ["dist/user/profile/assets"], + "@spartacus/user/profile/components": ["dist/user/profile/components"], + "@spartacus/user/profile/core": ["dist/user/profile/core"], + "@spartacus/user/profile": ["dist/user/profile"], + "@spartacus/user/profile/occ": ["dist/user/profile/occ"], + "@spartacus/user/profile/root": ["dist/user/profile/root"] + } + }, + "angularCompilerOptions": { + "skipTemplateCodegen": true, + "strictMetadataEmit": true, + "fullTemplateTypeCheck": true, + "strictInjectionParameters": true, + "enableResourceInlining": true, + "strictInputAccessModifiers": true + }, + "exclude": ["test.ts", "setup-jest.ts", "**/*.spec.ts"] +} diff --git a/feature-libs/requested-delivery-date/tsconfig.lib.prod.json b/feature-libs/requested-delivery-date/tsconfig.lib.prod.json new file mode 100644 index 00000000000..0d1bf3896fa --- /dev/null +++ b/feature-libs/requested-delivery-date/tsconfig.lib.prod.json @@ -0,0 +1,11 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ + +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/feature-libs/requested-delivery-date/tsconfig.schematics.json b/feature-libs/requested-delivery-date/tsconfig.schematics.json new file mode 100644 index 00000000000..bc2b2041ba7 --- /dev/null +++ b/feature-libs/requested-delivery-date/tsconfig.schematics.json @@ -0,0 +1,541 @@ +{ + "compilerOptions": { + "baseUrl": "./", + "module": "CommonJs", + "types": ["jest"], + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitThis": true, + "noUnusedParameters": true, + "noUnusedLocals": true, + "skipDefaultLibCheck": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true, + "strictNullChecks": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "paths": { + "@spartacus/schematics": ["../../projects/schematics/index"], + "@spartacus/setup": ["../../core-libs/setup/public_api"], + "@spartacus/setup/ssr": ["../../core-libs/setup/ssr/public_api"], + "@spartacus/asm/assets": ["../../feature-libs/asm/assets/public_api"], + "@spartacus/asm/components": [ + "../../feature-libs/asm/components/public_api" + ], + "@spartacus/asm/core": ["../../feature-libs/asm/core/public_api"], + "@spartacus/asm": ["../../feature-libs/asm/public_api"], + "@spartacus/asm/occ": ["../../feature-libs/asm/occ/public_api"], + "@spartacus/asm/root": ["../../feature-libs/asm/root/public_api"], + "@spartacus/cart/base/assets": [ + "../../feature-libs/cart/base/assets/public_api" + ], + "@spartacus/cart/base/components/add-to-cart": [ + "../../feature-libs/cart/base/components/add-to-cart/public_api" + ], + "@spartacus/cart/base/components/mini-cart": [ + "../../feature-libs/cart/base/components/mini-cart/public_api" + ], + "@spartacus/cart/base/components": [ + "../../feature-libs/cart/base/components/public_api" + ], + "@spartacus/cart/base/core": [ + "../../feature-libs/cart/base/core/public_api" + ], + "@spartacus/cart/base": ["../../feature-libs/cart/base/public_api"], + "@spartacus/cart/base/occ": [ + "../../feature-libs/cart/base/occ/public_api" + ], + "@spartacus/cart/base/root": [ + "../../feature-libs/cart/base/root/public_api" + ], + "@spartacus/cart/import-export/assets": [ + "../../feature-libs/cart/import-export/assets/public_api" + ], + "@spartacus/cart/import-export/components": [ + "../../feature-libs/cart/import-export/components/public_api" + ], + "@spartacus/cart/import-export/core": [ + "../../feature-libs/cart/import-export/core/public_api" + ], + "@spartacus/cart/import-export": [ + "../../feature-libs/cart/import-export/public_api" + ], + "@spartacus/cart/import-export/root": [ + "../../feature-libs/cart/import-export/root/public_api" + ], + "@spartacus/cart": ["../../feature-libs/cart/public_api"], + "@spartacus/cart/quick-order/assets": [ + "../../feature-libs/cart/quick-order/assets/public_api" + ], + "@spartacus/cart/quick-order/components": [ + "../../feature-libs/cart/quick-order/components/public_api" + ], + "@spartacus/cart/quick-order/core": [ + "../../feature-libs/cart/quick-order/core/public_api" + ], + "@spartacus/cart/quick-order": [ + "../../feature-libs/cart/quick-order/public_api" + ], + "@spartacus/cart/quick-order/root": [ + "../../feature-libs/cart/quick-order/root/public_api" + ], + "@spartacus/cart/saved-cart/assets": [ + "../../feature-libs/cart/saved-cart/assets/public_api" + ], + "@spartacus/cart/saved-cart/components": [ + "../../feature-libs/cart/saved-cart/components/public_api" + ], + "@spartacus/cart/saved-cart/core": [ + "../../feature-libs/cart/saved-cart/core/public_api" + ], + "@spartacus/cart/saved-cart": [ + "../../feature-libs/cart/saved-cart/public_api" + ], + "@spartacus/cart/saved-cart/occ": [ + "../../feature-libs/cart/saved-cart/occ/public_api" + ], + "@spartacus/cart/saved-cart/root": [ + "../../feature-libs/cart/saved-cart/root/public_api" + ], + "@spartacus/cart/wish-list/assets": [ + "../../feature-libs/cart/wish-list/assets/public_api" + ], + "@spartacus/cart/wish-list/components/add-to-wishlist": [ + "../../feature-libs/cart/wish-list/components/add-to-wishlist/public_api" + ], + "@spartacus/cart/wish-list/components": [ + "../../feature-libs/cart/wish-list/components/public_api" + ], + "@spartacus/cart/wish-list/core": [ + "../../feature-libs/cart/wish-list/core/public_api" + ], + "@spartacus/cart/wish-list": [ + "../../feature-libs/cart/wish-list/public_api" + ], + "@spartacus/cart/wish-list/root": [ + "../../feature-libs/cart/wish-list/root/public_api" + ], + "@spartacus/checkout/b2b/assets": [ + "../../feature-libs/checkout/b2b/assets/public_api" + ], + "@spartacus/checkout/b2b/components": [ + "../../feature-libs/checkout/b2b/components/public_api" + ], + "@spartacus/checkout/b2b/core": [ + "../../feature-libs/checkout/b2b/core/public_api" + ], + "@spartacus/checkout/b2b": ["../../feature-libs/checkout/b2b/public_api"], + "@spartacus/checkout/b2b/occ": [ + "../../feature-libs/checkout/b2b/occ/public_api" + ], + "@spartacus/checkout/b2b/root": [ + "../../feature-libs/checkout/b2b/root/public_api" + ], + "@spartacus/checkout/base/assets": [ + "../../feature-libs/checkout/base/assets/public_api" + ], + "@spartacus/checkout/base/components": [ + "../../feature-libs/checkout/base/components/public_api" + ], + "@spartacus/checkout/base/core": [ + "../../feature-libs/checkout/base/core/public_api" + ], + "@spartacus/checkout/base": [ + "../../feature-libs/checkout/base/public_api" + ], + "@spartacus/checkout/base/occ": [ + "../../feature-libs/checkout/base/occ/public_api" + ], + "@spartacus/checkout/base/root": [ + "../../feature-libs/checkout/base/root/public_api" + ], + "@spartacus/checkout": ["../../feature-libs/checkout/public_api"], + "@spartacus/checkout/scheduled-replenishment/assets": [ + "../../feature-libs/checkout/scheduled-replenishment/assets/public_api" + ], + "@spartacus/checkout/scheduled-replenishment/components": [ + "../../feature-libs/checkout/scheduled-replenishment/components/public_api" + ], + "@spartacus/checkout/scheduled-replenishment": [ + "../../feature-libs/checkout/scheduled-replenishment/public_api" + ], + "@spartacus/checkout/scheduled-replenishment/root": [ + "../../feature-libs/checkout/scheduled-replenishment/root/public_api" + ], + "@spartacus/customer-ticketing/assets": [ + "../../feature-libs/customer-ticketing/assets/public_api" + ], + "@spartacus/customer-ticketing/components": [ + "../../feature-libs/customer-ticketing/components/public_api" + ], + "@spartacus/customer-ticketing/core": [ + "../../feature-libs/customer-ticketing/core/public_api" + ], + "@spartacus/customer-ticketing": [ + "../../feature-libs/customer-ticketing/public_api" + ], + "@spartacus/customer-ticketing/occ": [ + "../../feature-libs/customer-ticketing/occ/public_api" + ], + "@spartacus/customer-ticketing/root": [ + "../../feature-libs/customer-ticketing/root/public_api" + ], + "@spartacus/order/assets": ["../../feature-libs/order/assets/public_api"], + "@spartacus/order/components": [ + "../../feature-libs/order/components/public_api" + ], + "@spartacus/order/core": ["../../feature-libs/order/core/public_api"], + "@spartacus/order": ["../../feature-libs/order/public_api"], + "@spartacus/order/occ": ["../../feature-libs/order/occ/public_api"], + "@spartacus/order/root": ["../../feature-libs/order/root/public_api"], + "@spartacus/organization/account-summary/assets": [ + "../../feature-libs/organization/account-summary/assets/public_api" + ], + "@spartacus/organization/account-summary/components": [ + "../../feature-libs/organization/account-summary/components/public_api" + ], + "@spartacus/organization/account-summary/core": [ + "../../feature-libs/organization/account-summary/core/public_api" + ], + "@spartacus/organization/account-summary": [ + "../../feature-libs/organization/account-summary/public_api" + ], + "@spartacus/organization/account-summary/occ": [ + "../../feature-libs/organization/account-summary/occ/public_api" + ], + "@spartacus/organization/account-summary/root": [ + "../../feature-libs/organization/account-summary/root/public_api" + ], + "@spartacus/organization/administration/assets": [ + "../../feature-libs/organization/administration/assets/public_api" + ], + "@spartacus/organization/administration/components": [ + "../../feature-libs/organization/administration/components/public_api" + ], + "@spartacus/organization/administration/core": [ + "../../feature-libs/organization/administration/core/public_api" + ], + "@spartacus/organization/administration": [ + "../../feature-libs/organization/administration/public_api" + ], + "@spartacus/organization/administration/occ": [ + "../../feature-libs/organization/administration/occ/public_api" + ], + "@spartacus/organization/administration/root": [ + "../../feature-libs/organization/administration/root/public_api" + ], + "@spartacus/organization": ["../../feature-libs/organization/public_api"], + "@spartacus/organization/order-approval/assets": [ + "../../feature-libs/organization/order-approval/assets/public_api" + ], + "@spartacus/organization/order-approval": [ + "../../feature-libs/organization/order-approval/public_api" + ], + "@spartacus/organization/order-approval/root": [ + "../../feature-libs/organization/order-approval/root/public_api" + ], + "@spartacus/organization/unit-order/assets": [ + "../../feature-libs/organization/unit-order/assets/public_api" + ], + "@spartacus/organization/unit-order/components": [ + "../../feature-libs/organization/unit-order/components/public_api" + ], + "@spartacus/organization/unit-order/core": [ + "../../feature-libs/organization/unit-order/core/public_api" + ], + "@spartacus/organization/unit-order": [ + "../../feature-libs/organization/unit-order/public_api" + ], + "@spartacus/organization/unit-order/occ": [ + "../../feature-libs/organization/unit-order/occ/public_api" + ], + "@spartacus/organization/unit-order/root": [ + "../../feature-libs/organization/unit-order/root/public_api" + ], + "@spartacus/organization/user-registration/assets": [ + "../../feature-libs/organization/user-registration/assets/public_api" + ], + "@spartacus/organization/user-registration/components": [ + "../../feature-libs/organization/user-registration/components/public_api" + ], + "@spartacus/organization/user-registration/core": [ + "../../feature-libs/organization/user-registration/core/public_api" + ], + "@spartacus/organization/user-registration": [ + "../../feature-libs/organization/user-registration/public_api" + ], + "@spartacus/organization/user-registration/occ": [ + "../../feature-libs/organization/user-registration/occ/public_api" + ], + "@spartacus/organization/user-registration/root": [ + "../../feature-libs/organization/user-registration/root/public_api" + ], + "@spartacus/pickup-in-store/assets": [ + "../../feature-libs/pickup-in-store/assets/public_api" + ], + "@spartacus/pickup-in-store/components": [ + "../../feature-libs/pickup-in-store/components/public_api" + ], + "@spartacus/pickup-in-store/core": [ + "../../feature-libs/pickup-in-store/core/public_api" + ], + "@spartacus/pickup-in-store": [ + "../../feature-libs/pickup-in-store/public_api" + ], + "@spartacus/pickup-in-store/occ": [ + "../../feature-libs/pickup-in-store/occ/public_api" + ], + "@spartacus/pickup-in-store/root": [ + "../../feature-libs/pickup-in-store/root/public_api" + ], + "@spartacus/product-configurator/common/assets": [ + "../../feature-libs/product-configurator/common/assets/public_api" + ], + "@spartacus/product-configurator/common": [ + "../../feature-libs/product-configurator/common/public_api" + ], + "@spartacus/product-configurator": [ + "../../feature-libs/product-configurator/public_api" + ], + "@spartacus/product-configurator/rulebased/cpq": [ + "../../feature-libs/product-configurator/rulebased/cpq/public_api" + ], + "@spartacus/product-configurator/rulebased": [ + "../../feature-libs/product-configurator/rulebased/public_api" + ], + "@spartacus/product-configurator/rulebased/root": [ + "../../feature-libs/product-configurator/rulebased/root/public_api" + ], + "@spartacus/product-configurator/textfield": [ + "../../feature-libs/product-configurator/textfield/public_api" + ], + "@spartacus/product-configurator/textfield/root": [ + "../../feature-libs/product-configurator/textfield/root/public_api" + ], + "@spartacus/product/bulk-pricing/assets": [ + "../../feature-libs/product/bulk-pricing/assets/public_api" + ], + "@spartacus/product/bulk-pricing/components": [ + "../../feature-libs/product/bulk-pricing/components/public_api" + ], + "@spartacus/product/bulk-pricing/core": [ + "../../feature-libs/product/bulk-pricing/core/public_api" + ], + "@spartacus/product/bulk-pricing": [ + "../../feature-libs/product/bulk-pricing/public_api" + ], + "@spartacus/product/bulk-pricing/occ": [ + "../../feature-libs/product/bulk-pricing/occ/public_api" + ], + "@spartacus/product/bulk-pricing/root": [ + "../../feature-libs/product/bulk-pricing/root/public_api" + ], + "@spartacus/product/future-stock/assets": [ + "../../feature-libs/product/future-stock/assets/public_api" + ], + "@spartacus/product/future-stock/components": [ + "../../feature-libs/product/future-stock/components/public_api" + ], + "@spartacus/product/future-stock/core": [ + "../../feature-libs/product/future-stock/core/public_api" + ], + "@spartacus/product/future-stock": [ + "../../feature-libs/product/future-stock/public_api" + ], + "@spartacus/product/future-stock/occ": [ + "../../feature-libs/product/future-stock/occ/public_api" + ], + "@spartacus/product/future-stock/root": [ + "../../feature-libs/product/future-stock/root/public_api" + ], + "@spartacus/product/image-zoom/assets": [ + "../../feature-libs/product/image-zoom/assets/public_api" + ], + "@spartacus/product/image-zoom/components": [ + "../../feature-libs/product/image-zoom/components/public_api" + ], + "@spartacus/product/image-zoom": [ + "../../feature-libs/product/image-zoom/public_api" + ], + "@spartacus/product/image-zoom/root": [ + "../../feature-libs/product/image-zoom/root/public_api" + ], + "@spartacus/product": ["../../feature-libs/product/public_api"], + "@spartacus/product/variants/assets": [ + "../../feature-libs/product/variants/assets/public_api" + ], + "@spartacus/product/variants/components": [ + "../../feature-libs/product/variants/components/public_api" + ], + "@spartacus/product/variants": [ + "../../feature-libs/product/variants/public_api" + ], + "@spartacus/product/variants/occ": [ + "../../feature-libs/product/variants/occ/public_api" + ], + "@spartacus/product/variants/root": [ + "../../feature-libs/product/variants/root/public_api" + ], + "@spartacus/qualtrics/components": [ + "../../feature-libs/qualtrics/components/public_api" + ], + "@spartacus/qualtrics": ["../../feature-libs/qualtrics/public_api"], + "@spartacus/qualtrics/root": [ + "../../feature-libs/qualtrics/root/public_api" + ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], + "@spartacus/smartedit/core": [ + "../../feature-libs/smartedit/core/public_api" + ], + "@spartacus/smartedit": ["../../feature-libs/smartedit/public_api"], + "@spartacus/smartedit/root": [ + "../../feature-libs/smartedit/root/public_api" + ], + "@spartacus/storefinder/assets": [ + "../../feature-libs/storefinder/assets/public_api" + ], + "@spartacus/storefinder/components": [ + "../../feature-libs/storefinder/components/public_api" + ], + "@spartacus/storefinder/core": [ + "../../feature-libs/storefinder/core/public_api" + ], + "@spartacus/storefinder": ["../../feature-libs/storefinder/public_api"], + "@spartacus/storefinder/occ": [ + "../../feature-libs/storefinder/occ/public_api" + ], + "@spartacus/storefinder/root": [ + "../../feature-libs/storefinder/root/public_api" + ], + "@spartacus/tracking": ["../../feature-libs/tracking/public_api"], + "@spartacus/tracking/personalization/core": [ + "../../feature-libs/tracking/personalization/core/public_api" + ], + "@spartacus/tracking/personalization": [ + "../../feature-libs/tracking/personalization/public_api" + ], + "@spartacus/tracking/personalization/root": [ + "../../feature-libs/tracking/personalization/root/public_api" + ], + "@spartacus/tracking/tms/aep": [ + "../../feature-libs/tracking/tms/aep/public_api" + ], + "@spartacus/tracking/tms/core": [ + "../../feature-libs/tracking/tms/core/public_api" + ], + "@spartacus/tracking/tms/gtm": [ + "../../feature-libs/tracking/tms/gtm/public_api" + ], + "@spartacus/tracking/tms": ["../../feature-libs/tracking/tms/public_api"], + "@spartacus/user/account/assets": [ + "../../feature-libs/user/account/assets/public_api" + ], + "@spartacus/user/account/components": [ + "../../feature-libs/user/account/components/public_api" + ], + "@spartacus/user/account/core": [ + "../../feature-libs/user/account/core/public_api" + ], + "@spartacus/user/account": ["../../feature-libs/user/account/public_api"], + "@spartacus/user/account/occ": [ + "../../feature-libs/user/account/occ/public_api" + ], + "@spartacus/user/account/root": [ + "../../feature-libs/user/account/root/public_api" + ], + "@spartacus/user": ["../../feature-libs/user/public_api"], + "@spartacus/user/profile/assets": [ + "../../feature-libs/user/profile/assets/public_api" + ], + "@spartacus/user/profile/components": [ + "../../feature-libs/user/profile/components/public_api" + ], + "@spartacus/user/profile/core": [ + "../../feature-libs/user/profile/core/public_api" + ], + "@spartacus/user/profile": ["../../feature-libs/user/profile/public_api"], + "@spartacus/user/profile/occ": [ + "../../feature-libs/user/profile/occ/public_api" + ], + "@spartacus/user/profile/root": [ + "../../feature-libs/user/profile/root/public_api" + ], + "@spartacus/cdc/assets": ["../../integration-libs/cdc/assets/public_api"], + "@spartacus/cdc/components": [ + "../../integration-libs/cdc/components/public_api" + ], + "@spartacus/cdc/core": ["../../integration-libs/cdc/core/public_api"], + "@spartacus/cdc": ["../../integration-libs/cdc/public_api"], + "@spartacus/cdc/organization/administration": [ + "../../integration-libs/cdc/organization/administration/public_api" + ], + "@spartacus/cdc/organization/user-registration": [ + "../../integration-libs/cdc/organization/user-registration/public_api" + ], + "@spartacus/cdc/root": ["../../integration-libs/cdc/root/public_api"], + "@spartacus/cdc/user-account": [ + "../../integration-libs/cdc/user-account/public_api" + ], + "@spartacus/cdc/user-profile": [ + "../../integration-libs/cdc/user-profile/public_api" + ], + "@spartacus/cds": ["../../integration-libs/cds/public_api"], + "@spartacus/digital-payments/assets": [ + "../../integration-libs/digital-payments/assets/public_api" + ], + "@spartacus/digital-payments": [ + "../../integration-libs/digital-payments/public_api" + ], + "@spartacus/epd-visualization/assets": [ + "../../integration-libs/epd-visualization/assets/public_api" + ], + "@spartacus/epd-visualization/components": [ + "../../integration-libs/epd-visualization/components/public_api" + ], + "@spartacus/epd-visualization/core": [ + "../../integration-libs/epd-visualization/core/public_api" + ], + "@spartacus/epd-visualization/epd-visualization-api": [ + "../../integration-libs/epd-visualization/epd-visualization-api/public_api" + ], + "@spartacus/epd-visualization": [ + "../../integration-libs/epd-visualization/public_api" + ], + "@spartacus/epd-visualization/root": [ + "../../integration-libs/epd-visualization/root/public_api" + ], + "@spartacus/s4om/assets": [ + "../../integration-libs/s4om/assets/public_api" + ], + "@spartacus/s4om": ["../../integration-libs/s4om/public_api"], + "@spartacus/s4om/root": ["../../integration-libs/s4om/root/public_api"], + "@spartacus/segment-refs": [ + "../../integration-libs/segment-refs/public_api" + ], + "@spartacus/segment-refs/root": [ + "../../integration-libs/segment-refs/root/public_api" + ], + "@spartacus/assets": ["../../projects/assets/src/public_api"], + "@spartacus/core": ["../../projects/core/public_api"], + "@spartacus/storefront": ["../../projects/storefrontlib/public_api"] + } + }, + "include": ["schematics/**/*.ts"], + "exclude": ["schematics/*/files/**/*", "schematics/**/*_spec.ts"] +} diff --git a/feature-libs/requested-delivery-date/tsconfig.spec.json b/feature-libs/requested-delivery-date/tsconfig.spec.json new file mode 100644 index 00000000000..9f660f8b0a1 --- /dev/null +++ b/feature-libs/requested-delivery-date/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "strict": false, + "module": "es2020", + "types": ["jasmine", "node"], + "skipLibCheck": true, + "resolveJsonModule": true, + "esModuleInterop": true + }, + "files": ["test.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts"] +} diff --git a/feature-libs/smartedit/tsconfig.schematics.json b/feature-libs/smartedit/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/smartedit/tsconfig.schematics.json +++ b/feature-libs/smartedit/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/storefinder/tsconfig.schematics.json b/feature-libs/storefinder/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/storefinder/tsconfig.schematics.json +++ b/feature-libs/storefinder/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/tracking/tsconfig.schematics.json b/feature-libs/tracking/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/tracking/tsconfig.schematics.json +++ b/feature-libs/tracking/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/feature-libs/user/tsconfig.schematics.json b/feature-libs/user/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/feature-libs/user/tsconfig.schematics.json +++ b/feature-libs/user/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/integration-libs/cdc/tsconfig.lib.json b/integration-libs/cdc/tsconfig.lib.json index 334f8a94ce6..1568a835dd2 100644 --- a/integration-libs/cdc/tsconfig.lib.json +++ b/integration-libs/cdc/tsconfig.lib.json @@ -9,6 +9,7 @@ "sourceMap": true, "inlineSources": true, "experimentalDecorators": true, + "emitDecoratorMetadata": true, "importHelpers": true, "strict": true, "types": [], @@ -21,20 +22,6 @@ "@spartacus/asm/occ": ["dist/asm/occ"], "@spartacus/asm/root": ["dist/asm/root"], "@spartacus/core": ["dist/core"], - "@spartacus/storefront": ["dist/storefrontlib"], - "@spartacus/user/account/assets": ["dist/user/account/assets"], - "@spartacus/user/account/components": ["dist/user/account/components"], - "@spartacus/user/account/core": ["dist/user/account/core"], - "@spartacus/user/account": ["dist/user/account"], - "@spartacus/user/account/occ": ["dist/user/account/occ"], - "@spartacus/user/account/root": ["dist/user/account/root"], - "@spartacus/user": ["dist/user"], - "@spartacus/user/profile/assets": ["dist/user/profile/assets"], - "@spartacus/user/profile/components": ["dist/user/profile/components"], - "@spartacus/user/profile/core": ["dist/user/profile/core"], - "@spartacus/user/profile": ["dist/user/profile"], - "@spartacus/user/profile/occ": ["dist/user/profile/occ"], - "@spartacus/user/profile/root": ["dist/user/profile/root"], "@spartacus/organization/account-summary/assets": [ "dist/organization/account-summary/assets" ], @@ -115,6 +102,20 @@ "@spartacus/organization/user-registration/root": [ "dist/organization/user-registration/root" ], + "@spartacus/storefront": ["dist/storefrontlib"], + "@spartacus/user/account/assets": ["dist/user/account/assets"], + "@spartacus/user/account/components": ["dist/user/account/components"], + "@spartacus/user/account/core": ["dist/user/account/core"], + "@spartacus/user/account": ["dist/user/account"], + "@spartacus/user/account/occ": ["dist/user/account/occ"], + "@spartacus/user/account/root": ["dist/user/account/root"], + "@spartacus/user": ["dist/user"], + "@spartacus/user/profile/assets": ["dist/user/profile/assets"], + "@spartacus/user/profile/components": ["dist/user/profile/components"], + "@spartacus/user/profile/core": ["dist/user/profile/core"], + "@spartacus/user/profile": ["dist/user/profile"], + "@spartacus/user/profile/occ": ["dist/user/profile/occ"], + "@spartacus/user/profile/root": ["dist/user/profile/root"], "@spartacus/cart/base/assets": ["dist/cart/base/assets"], "@spartacus/cart/base/components/add-to-cart": [ "dist/cart/base/components/add-to-cart" diff --git a/integration-libs/cdc/tsconfig.schematics.json b/integration-libs/cdc/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/integration-libs/cdc/tsconfig.schematics.json +++ b/integration-libs/cdc/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/integration-libs/cds/tsconfig.schematics.json b/integration-libs/cds/tsconfig.schematics.json index 780e4cdc0d9..0fbbe795fcc 100644 --- a/integration-libs/cds/tsconfig.schematics.json +++ b/integration-libs/cds/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/integration-libs/digital-payments/tsconfig.lib.json b/integration-libs/digital-payments/tsconfig.lib.json index e7b50e33065..ae852f43a4f 100644 --- a/integration-libs/digital-payments/tsconfig.lib.json +++ b/integration-libs/digital-payments/tsconfig.lib.json @@ -12,40 +12,6 @@ "types": [], "lib": ["dom", "esnext"], "paths": { - "@spartacus/checkout": ["dist/checkout"], - "@spartacus/checkout/b2b/assets": ["dist/checkout/b2b/assets"], - "@spartacus/checkout/b2b/components": ["dist/checkout/b2b/components"], - "@spartacus/checkout/b2b/core": ["dist/checkout/b2b/core"], - "@spartacus/checkout/b2b": ["dist/checkout/b2b"], - "@spartacus/checkout/b2b/occ": ["dist/checkout/b2b/occ"], - "@spartacus/checkout/b2b/root": ["dist/checkout/b2b/root"], - "@spartacus/checkout/base/assets": ["dist/checkout/base/assets"], - "@spartacus/checkout/base/components": ["dist/checkout/base/components"], - "@spartacus/checkout/base/core": ["dist/checkout/base/core"], - "@spartacus/checkout/base": ["dist/checkout/base"], - "@spartacus/checkout/base/occ": ["dist/checkout/base/occ"], - "@spartacus/checkout/base/root": ["dist/checkout/base/root"], - "@spartacus/checkout/scheduled-replenishment/assets": [ - "dist/checkout/scheduled-replenishment/assets" - ], - "@spartacus/checkout/scheduled-replenishment/components": [ - "dist/checkout/scheduled-replenishment/components" - ], - "@spartacus/checkout/scheduled-replenishment": [ - "dist/checkout/scheduled-replenishment" - ], - "@spartacus/checkout/scheduled-replenishment/root": [ - "dist/checkout/scheduled-replenishment/root" - ], - "@spartacus/cart/import-export/assets": [ - "dist/cart/import-export/assets" - ], - "@spartacus/cart/import-export/components": [ - "dist/cart/import-export/components" - ], - "@spartacus/cart/import-export/core": ["dist/cart/import-export/core"], - "@spartacus/cart/import-export": ["dist/cart/import-export"], - "@spartacus/cart/import-export/root": ["dist/cart/import-export/root"], "@spartacus/cart/base/assets": ["dist/cart/base/assets"], "@spartacus/cart/base/components/add-to-cart": [ "dist/cart/base/components/add-to-cart" @@ -58,6 +24,15 @@ "@spartacus/cart/base": ["dist/cart/base"], "@spartacus/cart/base/occ": ["dist/cart/base/occ"], "@spartacus/cart/base/root": ["dist/cart/base/root"], + "@spartacus/cart/import-export/assets": [ + "dist/cart/import-export/assets" + ], + "@spartacus/cart/import-export/components": [ + "dist/cart/import-export/components" + ], + "@spartacus/cart/import-export/core": ["dist/cart/import-export/core"], + "@spartacus/cart/import-export": ["dist/cart/import-export"], + "@spartacus/cart/import-export/root": ["dist/cart/import-export/root"], "@spartacus/cart": ["dist/cart"], "@spartacus/cart/quick-order/assets": ["dist/cart/quick-order/assets"], "@spartacus/cart/quick-order/components": [ @@ -84,14 +59,33 @@ "@spartacus/cart/wish-list/core": ["dist/cart/wish-list/core"], "@spartacus/cart/wish-list": ["dist/cart/wish-list"], "@spartacus/cart/wish-list/root": ["dist/cart/wish-list/root"], + "@spartacus/checkout/b2b/assets": ["dist/checkout/b2b/assets"], + "@spartacus/checkout/b2b/components": ["dist/checkout/b2b/components"], + "@spartacus/checkout/b2b/core": ["dist/checkout/b2b/core"], + "@spartacus/checkout/b2b": ["dist/checkout/b2b"], + "@spartacus/checkout/b2b/occ": ["dist/checkout/b2b/occ"], + "@spartacus/checkout/b2b/root": ["dist/checkout/b2b/root"], + "@spartacus/checkout/base/assets": ["dist/checkout/base/assets"], + "@spartacus/checkout/base/components": ["dist/checkout/base/components"], + "@spartacus/checkout/base/core": ["dist/checkout/base/core"], + "@spartacus/checkout/base": ["dist/checkout/base"], + "@spartacus/checkout/base/occ": ["dist/checkout/base/occ"], + "@spartacus/checkout/base/root": ["dist/checkout/base/root"], + "@spartacus/checkout": ["dist/checkout"], + "@spartacus/checkout/scheduled-replenishment/assets": [ + "dist/checkout/scheduled-replenishment/assets" + ], + "@spartacus/checkout/scheduled-replenishment/components": [ + "dist/checkout/scheduled-replenishment/components" + ], + "@spartacus/checkout/scheduled-replenishment": [ + "dist/checkout/scheduled-replenishment" + ], + "@spartacus/checkout/scheduled-replenishment/root": [ + "dist/checkout/scheduled-replenishment/root" + ], "@spartacus/core": ["dist/core"], "@spartacus/storefront": ["dist/storefrontlib"], - "@spartacus/order/assets": ["dist/order/assets"], - "@spartacus/order/components": ["dist/order/components"], - "@spartacus/order/core": ["dist/order/core"], - "@spartacus/order": ["dist/order"], - "@spartacus/order/occ": ["dist/order/occ"], - "@spartacus/order/root": ["dist/order/root"], "@spartacus/user/account/assets": ["dist/user/account/assets"], "@spartacus/user/account/components": ["dist/user/account/components"], "@spartacus/user/account/core": ["dist/user/account/core"], @@ -104,7 +98,13 @@ "@spartacus/user/profile/core": ["dist/user/profile/core"], "@spartacus/user/profile": ["dist/user/profile"], "@spartacus/user/profile/occ": ["dist/user/profile/occ"], - "@spartacus/user/profile/root": ["dist/user/profile/root"] + "@spartacus/user/profile/root": ["dist/user/profile/root"], + "@spartacus/order/assets": ["dist/order/assets"], + "@spartacus/order/components": ["dist/order/components"], + "@spartacus/order/core": ["dist/order/core"], + "@spartacus/order": ["dist/order"], + "@spartacus/order/occ": ["dist/order/occ"], + "@spartacus/order/root": ["dist/order/root"] } }, "angularCompilerOptions": { diff --git a/integration-libs/digital-payments/tsconfig.schematics.json b/integration-libs/digital-payments/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/integration-libs/digital-payments/tsconfig.schematics.json +++ b/integration-libs/digital-payments/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/integration-libs/epd-visualization/tsconfig.schematics.json b/integration-libs/epd-visualization/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/integration-libs/epd-visualization/tsconfig.schematics.json +++ b/integration-libs/epd-visualization/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/integration-libs/s4om/package.json b/integration-libs/s4om/package.json index b2d3272ddc6..d0ddb7f36b9 100644 --- a/integration-libs/s4om/package.json +++ b/integration-libs/s4om/package.json @@ -25,6 +25,7 @@ "@angular/core": "^15.2.4", "@spartacus/cart": "6.3.0-1", "@spartacus/core": "6.3.0-1", + "@spartacus/requested-delivery-date": "6.3.0-1", "@spartacus/schematics": "6.3.0-1", "@spartacus/storefront": "6.3.0-1", "@spartacus/styles": "6.3.0-1", diff --git a/integration-libs/s4om/root/s4om-root.module.ts b/integration-libs/s4om/root/s4om-root.module.ts index 8eb751b08b2..a176a2349d7 100644 --- a/integration-libs/s4om/root/s4om-root.module.ts +++ b/integration-libs/s4om/root/s4om-root.module.ts @@ -6,12 +6,16 @@ import { NgModule } from '@angular/core'; import { CartOutlets } from '@spartacus/cart/base/root'; +import { RequestedDeliveryDateComponentsModule } from '@spartacus/requested-delivery-date/root'; import { OutletPosition, provideOutlet } from '@spartacus/storefront'; import { ScheduleLinesComponent } from './components/schedule-lines/schedule-lines.component'; import { ScheduleLinesModule } from './components/schedule-lines/schedule-lines.module'; @NgModule({ - imports: [ScheduleLinesModule], + imports: [ + ScheduleLinesModule, + RequestedDeliveryDateComponentsModule, //Adding dependency with Requested Delivery Date so that the library gets installed along with S4OM + ], providers: [ provideOutlet({ id: CartOutlets.ITEM_DETAILS, diff --git a/integration-libs/s4om/schematics/add-s4om/schema.json b/integration-libs/s4om/schematics/add-s4om/schema.json index 8aa903b709f..19c66cb018b 100644 --- a/integration-libs/s4om/schematics/add-s4om/schema.json +++ b/integration-libs/s4om/schematics/add-s4om/schema.json @@ -24,7 +24,18 @@ "features": { "type": "array", "uniqueItems": true, - "default": ["S4HANA-Order-Management"] + "default": ["S4HANA-Order-Management"], + "x-prompt": { + "message": "Which S/4 HANA Order Management features would you like to set up?", + "type": "list", + "items": [ + { "value": "S4HANA-Order-Management", "label": "Schedule Lines" }, + { + "value": "Requested-Delivery-Date", + "label": "Requested Delivery Date" + } + ] + } } }, "required": [] diff --git a/integration-libs/s4om/tsconfig.lib.json b/integration-libs/s4om/tsconfig.lib.json index 81f7bd8bf7e..1c370c142e5 100644 --- a/integration-libs/s4om/tsconfig.lib.json +++ b/integration-libs/s4om/tsconfig.lib.json @@ -62,6 +62,19 @@ "@spartacus/cart/wish-list/root": ["dist/cart/wish-list/root"], "@spartacus/core": ["dist/core"], "@spartacus/storefront": ["dist/storefrontlib"], + "@spartacus/requested-delivery-date/assets": [ + "dist/requested-delivery-date/assets" + ], + "@spartacus/requested-delivery-date/core": [ + "dist/requested-delivery-date/core" + ], + "@spartacus/requested-delivery-date": ["dist/requested-delivery-date"], + "@spartacus/requested-delivery-date/occ": [ + "dist/requested-delivery-date/occ" + ], + "@spartacus/requested-delivery-date/root": [ + "dist/requested-delivery-date/root" + ], "@spartacus/user/account/assets": ["dist/user/account/assets"], "@spartacus/user/account/components": ["dist/user/account/components"], "@spartacus/user/account/core": ["dist/user/account/core"], @@ -74,7 +87,38 @@ "@spartacus/user/profile/core": ["dist/user/profile/core"], "@spartacus/user/profile": ["dist/user/profile"], "@spartacus/user/profile/occ": ["dist/user/profile/occ"], - "@spartacus/user/profile/root": ["dist/user/profile/root"] + "@spartacus/user/profile/root": ["dist/user/profile/root"], + "@spartacus/checkout/b2b/assets": ["dist/checkout/b2b/assets"], + "@spartacus/checkout/b2b/components": ["dist/checkout/b2b/components"], + "@spartacus/checkout/b2b/core": ["dist/checkout/b2b/core"], + "@spartacus/checkout/b2b": ["dist/checkout/b2b"], + "@spartacus/checkout/b2b/occ": ["dist/checkout/b2b/occ"], + "@spartacus/checkout/b2b/root": ["dist/checkout/b2b/root"], + "@spartacus/checkout/base/assets": ["dist/checkout/base/assets"], + "@spartacus/checkout/base/components": ["dist/checkout/base/components"], + "@spartacus/checkout/base/core": ["dist/checkout/base/core"], + "@spartacus/checkout/base": ["dist/checkout/base"], + "@spartacus/checkout/base/occ": ["dist/checkout/base/occ"], + "@spartacus/checkout/base/root": ["dist/checkout/base/root"], + "@spartacus/checkout": ["dist/checkout"], + "@spartacus/checkout/scheduled-replenishment/assets": [ + "dist/checkout/scheduled-replenishment/assets" + ], + "@spartacus/checkout/scheduled-replenishment/components": [ + "dist/checkout/scheduled-replenishment/components" + ], + "@spartacus/checkout/scheduled-replenishment": [ + "dist/checkout/scheduled-replenishment" + ], + "@spartacus/checkout/scheduled-replenishment/root": [ + "dist/checkout/scheduled-replenishment/root" + ], + "@spartacus/order/assets": ["dist/order/assets"], + "@spartacus/order/components": ["dist/order/components"], + "@spartacus/order/core": ["dist/order/core"], + "@spartacus/order": ["dist/order"], + "@spartacus/order/occ": ["dist/order/occ"], + "@spartacus/order/root": ["dist/order/root"] }, "resolveJsonModule": true, "esModuleInterop": true diff --git a/integration-libs/s4om/tsconfig.schematics.json b/integration-libs/s4om/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/integration-libs/s4om/tsconfig.schematics.json +++ b/integration-libs/s4om/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/integration-libs/segment-refs/tsconfig.schematics.json b/integration-libs/segment-refs/tsconfig.schematics.json index 762073f61f1..1652ce2b588 100644 --- a/integration-libs/segment-refs/tsconfig.schematics.json +++ b/integration-libs/segment-refs/tsconfig.schematics.json @@ -372,6 +372,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/package.json b/package.json index 24c65ec45a2..cf194e346ae 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "build:digital-payments": "npm --prefix integration-libs/digital-payments run build:schematics && nx build digital-payments --configuration production", "build:epd-visualization": "npm --prefix integration-libs/epd-visualization run build:schematics && nx build epd-visualization --configuration production", "build:order": "npm --prefix feature-libs/order run build:schematics && nx build order --configuration production", - "build:libs": "nx build core --configuration production && nx build storefrontlib --configuration production && concurrently --kill-others-on-fail npm:build:schematics npm:build:user && npm run build:cart && npm run build:order && concurrently --kill-others-on-fail npm:build:checkout npm:build:asm npm:build:tracking npm:build:customer-ticketing && concurrently --kill-others-on-fail npm:build:organization npm:build:product npm:build:product-configurator npm:build:storefinder && concurrently --kill-others-on-fail npm:build:smartedit npm:build:qualtrics npm:build:assets npm:build:cds npm:build:cdc npm:build:digital-payments npm:build:epd-visualization npm:build:s4om npm:build:segment-refs npm:build:pickup-in-store && npm run build:setup", + "build:libs": "nx build core --configuration production && nx build storefrontlib --configuration production && concurrently --kill-others-on-fail npm:build:schematics npm:build:user && npm run build:cart && npm run build:order && concurrently --kill-others-on-fail npm:build:checkout npm:build:asm npm:build:tracking npm:build:customer-ticketing && concurrently --kill-others-on-fail npm:build:organization npm:build:product npm:build:product-configurator npm:build:requested-delivery-date npm:build:storefinder && concurrently --kill-others-on-fail npm:build:smartedit npm:build:qualtrics npm:build:assets npm:build:cds npm:build:cdc npm:build:digital-payments npm:build:epd-visualization npm:build:s4om npm:build:segment-refs npm:build:pickup-in-store && npm run build:setup", "build:organization": "npm --prefix feature-libs/organization run build:schematics && nx build organization --configuration production", "build:pickup-in-store": "npm --prefix feature-libs/pickup-in-store run build:schematics && nx build pickup-in-store --configuration production", "build:product": "npm --prefix feature-libs/product run build:schematics && nx build product --configuration production", @@ -30,6 +30,7 @@ "build:s4om": "npm --prefix integration-libs/s4om run build:schematics && nx build s4om --configuration production", "build:segment-refs": "npm --prefix integration-libs/segment-refs run build:schematics && nx build segment-refs --configuration production", "build:qualtrics": "npm --prefix feature-libs/qualtrics run build:schematics && nx build qualtrics --configuration production", + "build:requested-delivery-date": "npm --prefix feature-libs/requested-delivery-date run build:schematics && nx build requested-delivery-date --configuration production", "build:schematics": "npm --prefix projects/schematics run build", "build:setup": "nx build setup --configuration production", "build:ssr": "env-cmd --no-override -e dev,b2c,$SPA_ENV nx run storefrontapp:server:production", @@ -81,7 +82,7 @@ "start:prod": "env-cmd --no-override -e dev,b2c,$SPA_ENV nx serve storefrontapp --configuration=production", "start:pwa": "cd ./dist/storefrontapp/ && http-server --silent --proxy http://localhost:4200? -p 4200", "test": "nx test", - "test:libs": "concurrently \"nx test core --code-coverage\" \"nx test storefrontlib --code-coverage\" \"nx test cart --code-coverage\" \"nx test organization --code-coverage\" \"nx test storefinder --code-coverage\" \"nx test smartedit --code-coverage\" \"nx test asm --code-coverage\" \"nx test qualtrics --code-coverage\" \"nx test product --code-coverage\" \"nx test product-configurator --code-coverage\" \"nx test customer-ticketing --code-coverage\" \"nx test cdc --code-coverage\" \"nx test setup --code-coverage\" \"nx test checkout --code-coverage\" \"nx test order --code-coverage\" \"nx test digital-payments --code-coverage\" \"nx test epd-visualization --code-coverage\" \"nx test pickup-in-store --code-coverage\"", + "test:libs": "concurrently \"nx test core --code-coverage\" \"nx test storefrontlib --code-coverage\" \"nx test cart --code-coverage\" \"nx test organization --code-coverage\" \"nx test storefinder --code-coverage\" \"nx test smartedit --code-coverage\" \"nx test asm --code-coverage\" \"nx test qualtrics --code-coverage\" \"nx test product --code-coverage\" \"nx test product-configurator --code-coverage\" \"nx test customer-ticketing --code-coverage\" \"nx test cdc --code-coverage\" \"nx test setup --code-coverage\" \"nx test checkout --code-coverage\" \"nx test order --code-coverage\" \"nx test digital-payments --code-coverage\" \"nx test epd-visualization --code-coverage\" \"nx test pickup-in-store --code-coverage\" \"nx test s4om --code-coverage\" \"nx test requested-delivery-date --code-coverage\"", "test:storefront:lib": "nx test storefrontlib --source-map --code-coverage", "dev:ssr": "env-cmd --no-override -e dev,b2c,$SPA_ENV cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 nx run storefrontapp:serve-ssr", "serve:ssr": "node dist/storefrontapp-server/main.js", diff --git a/projects/schematics/package.json b/projects/schematics/package.json index ef94a58cd77..69b9829e9b0 100644 --- a/projects/schematics/package.json +++ b/projects/schematics/package.json @@ -55,6 +55,7 @@ "@spartacus/product", "@spartacus/product-configurator", "@spartacus/qualtrics", + "@spartacus/requested-delivery-date", "@spartacus/smartedit", "@spartacus/storefinder", "@spartacus/tracking", @@ -64,6 +65,7 @@ "@spartacus/cds", "@spartacus/digital-payments", "@spartacus/epd-visualization", + "@spartacus/s4om", "@spartacus/customer-ticketing" ] }, diff --git a/projects/schematics/src/add-spartacus/schema.json b/projects/schematics/src/add-spartacus/schema.json index 02927e05dc3..f115637f01f 100644 --- a/projects/schematics/src/add-spartacus/schema.json +++ b/projects/schematics/src/add-spartacus/schema.json @@ -44,6 +44,7 @@ "Textfield-Configurator", "CPQ-Configurator", "Qualtrics", + "Requested-Delivery-Date", "S4HANA-Order-Management", "SmartEdit", "Store-Finder", @@ -186,6 +187,10 @@ "value": "Qualtrics", "label": "Qualtrics" }, + { + "value": "Requested-Delivery-Date", + "label": "Requested Delivery Date" + }, { "value": "S4HANA-Order-Management", "label": "S/4HANA Order Management (b2b feature)" diff --git a/projects/schematics/src/dependencies.json b/projects/schematics/src/dependencies.json index 9d4d2f7c75b..aecd2065dfd 100644 --- a/projects/schematics/src/dependencies.json +++ b/projects/schematics/src/dependencies.json @@ -211,6 +211,20 @@ "bootstrap": "^4.6.2", "rxjs": "^6.6.0" }, + "@spartacus/requested-delivery-date": { + "@angular-devkit/schematics": "^15.2.4", + "@angular/common": "^15.2.4", + "@angular/core": "^15.2.4", + "@angular/forms": "^15.2.4", + "@spartacus/cart": "6.3.0-1", + "@spartacus/checkout": "6.3.0-1", + "@spartacus/core": "6.3.0-1", + "@spartacus/order": "6.3.0-1", + "@spartacus/schematics": "6.3.0-1", + "@spartacus/storefront": "6.3.0-1", + "@spartacus/styles": "6.3.0-1", + "rxjs": "^6.6.0" + }, "@spartacus/smartedit": { "@angular-devkit/schematics": "^15.2.4", "@angular/common": "^15.2.4", @@ -322,6 +336,7 @@ "@angular/core": "^15.2.4", "@spartacus/cart": "6.3.0-1", "@spartacus/core": "6.3.0-1", + "@spartacus/requested-delivery-date": "6.3.0-1", "@spartacus/schematics": "6.3.0-1", "@spartacus/storefront": "6.3.0-1", "@spartacus/styles": "6.3.0-1", diff --git a/projects/schematics/src/shared/lib-configs/requested-delivery-date-schematics-config.ts b/projects/schematics/src/shared/lib-configs/requested-delivery-date-schematics-config.ts new file mode 100644 index 00000000000..bdd9ffdca55 --- /dev/null +++ b/projects/schematics/src/shared/lib-configs/requested-delivery-date-schematics-config.ts @@ -0,0 +1,66 @@ +/* + * SPDX-FileCopyrightText: 2022 SAP Spartacus team + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { + CART_BASE_FEATURE_NAME, + CHECKOUT_BASE_FEATURE_NAME, + ORDER_FEATURE_NAME, + REQUESTED_DELIVERY_DATE_FEATURE_NAME, + SPARTACUS_REQUESTED_DELIVERY_DATE, + SPARTACUS_REQUESTED_DELIVERY_DATE_ASSETS, + SPARTACUS_REQUESTED_DELIVERY_DATE_ROOT, +} from '../libs-constants'; +import { SchematicConfig } from '../utils/lib-utils'; + +export const REQUESTED_DELIVERY_DATE_FEATURE_NAME_CONSTANT = + 'REQUESTED_DELIVERY_DATE_FEATURE'; +export const REQUESTED_DELIVERY_DATE_FOLDER_NAME = 'requested-delivery-date'; +export const REQUESTED_DELIVERY_DATE_TRANSLATIONS = + 'requestedDeliveryDateTranslations'; +export const REQUESTED_DELIVERY_DATE_TRANSLATION_CHUNKS_CONFIG = + 'requestedDeliveryDateTranslationChunksConfig'; +export const REQUESTED_DELIVERY_DATE_ROOT_MODULE = + 'RequestedDeliveryDateRootModule'; +export const REQUESTED_DELIVERY_DATE_MODULE = 'RequestedDeliveryDateModule'; + +export const REQUESTED_DELIVERY_DATE_SCSS_FILE_NAME = + 'requested-delivery-date.scss'; + +export const REQUESTED_DELIVERY_DATE_SCHEMATICS_CONFIG: SchematicConfig = { + library: { + featureName: REQUESTED_DELIVERY_DATE_FEATURE_NAME, + mainScope: SPARTACUS_REQUESTED_DELIVERY_DATE, + }, + folderName: REQUESTED_DELIVERY_DATE_FOLDER_NAME, + moduleName: REQUESTED_DELIVERY_DATE_MODULE, + featureModule: { + name: REQUESTED_DELIVERY_DATE_MODULE, + importPath: SPARTACUS_REQUESTED_DELIVERY_DATE, + }, + rootModule: { + name: REQUESTED_DELIVERY_DATE_ROOT_MODULE, + importPath: SPARTACUS_REQUESTED_DELIVERY_DATE_ROOT, + }, + styles: { + scssFileName: REQUESTED_DELIVERY_DATE_SCSS_FILE_NAME, + importStyle: SPARTACUS_REQUESTED_DELIVERY_DATE, + }, + lazyLoadingChunk: { + moduleSpecifier: SPARTACUS_REQUESTED_DELIVERY_DATE_ROOT, + namedImports: [REQUESTED_DELIVERY_DATE_FEATURE_NAME_CONSTANT], + }, + i18n: { + resources: REQUESTED_DELIVERY_DATE_TRANSLATIONS, + chunks: REQUESTED_DELIVERY_DATE_TRANSLATION_CHUNKS_CONFIG, + importPath: SPARTACUS_REQUESTED_DELIVERY_DATE_ASSETS, + }, + dependencyFeatures: [ + CART_BASE_FEATURE_NAME, + CHECKOUT_BASE_FEATURE_NAME, + ORDER_FEATURE_NAME, + ], +}; diff --git a/projects/schematics/src/shared/libs-constants.ts b/projects/schematics/src/shared/libs-constants.ts index 29bc42e9e69..39faa1c6383 100644 --- a/projects/schematics/src/shared/libs-constants.ts +++ b/projects/schematics/src/shared/libs-constants.ts @@ -144,6 +144,10 @@ export const SPARTACUS_QUALTRICS = `@spartacus/qualtrics`; export const SPARTACUS_QUALTRICS_COMPONENTS = `@spartacus/qualtrics/components`; export const SPARTACUS_QUALTRICS_ROOT = `@spartacus/qualtrics/root`; +export const SPARTACUS_REQUESTED_DELIVERY_DATE = `@spartacus/requested-delivery-date`; +export const SPARTACUS_REQUESTED_DELIVERY_DATE_ROOT = `@spartacus/requested-delivery-date/root`; +export const SPARTACUS_REQUESTED_DELIVERY_DATE_ASSETS = `@spartacus/requested-delivery-date/assets`; + export const SPARTACUS_SMARTEDIT = `@spartacus/smartedit`; export const SPARTACUS_SMARTEDIT_ROOT = `@spartacus/smartedit/root`; @@ -247,6 +251,8 @@ export const PRODUCT_CONFIGURATOR_CPQ_FEATURE_NAME = 'CPQ-Configurator'; export const QUALTRICS_FEATURE_NAME = 'Qualtrics'; +export const REQUESTED_DELIVERY_DATE_FEATURE_NAME = 'Requested-Delivery-Date'; + export const SMARTEDIT_FEATURE_NAME = 'SmartEdit'; export const STOREFINDER_FEATURE_NAME = 'Store-Finder'; diff --git a/projects/schematics/src/shared/schematics-config-mappings.ts b/projects/schematics/src/shared/schematics-config-mappings.ts index b427f5e5493..0cb429e3a52 100644 --- a/projects/schematics/src/shared/schematics-config-mappings.ts +++ b/projects/schematics/src/shared/schematics-config-mappings.ts @@ -30,8 +30,8 @@ import { ORGANIZATION_ACCOUNT_SUMMARY_SCHEMATICS_CONFIG, ORGANIZATION_ADMINISTRATION_SCHEMATICS_CONFIG, ORGANIZATION_ORDER_APPROVAL_SCHEMATICS_CONFIG, - ORGANIZATION_USER_REGISTRATION_SCHEMATICS_CONFIG, ORGANIZATION_UNIT_ORDER_SCHEMATICS_CONFIG, + ORGANIZATION_USER_REGISTRATION_SCHEMATICS_CONFIG, } from './lib-configs/organization-schematics-config'; import { PICKUP_IN_STORE_SCHEMATICS_CONFIG } from './lib-configs/pickup-in-store-schematics-config'; import { @@ -41,11 +41,12 @@ import { } from './lib-configs/product-configurator-schematics-config'; import { PRODUCT_BULK_PRICING_SCHEMATICS_CONFIG, + PRODUCT_FUTURE_STOCK_SCHEMATICS_CONFIG, PRODUCT_IMAGE_ZOOM_SCHEMATICS_CONFIG, PRODUCT_VARIANTS_SCHEMATICS_CONFIG, - PRODUCT_FUTURE_STOCK_SCHEMATICS_CONFIG, } from './lib-configs/product-schematics-config'; import { QUALTRICS_SCHEMATICS_CONFIG } from './lib-configs/qualtrics-schematics-config'; +import { REQUESTED_DELIVERY_DATE_SCHEMATICS_CONFIG } from './lib-configs/requested-delivery-date-schematics-config'; import { SMARTEDIT_SCHEMATICS_CONFIG } from './lib-configs/smartedit-schematics-config'; import { STOREFINDER_SCHEMATICS_CONFIG } from './lib-configs/storefinder-schematics-config'; import { @@ -57,7 +58,6 @@ import { USER_ACCOUNT_SCHEMATICS_CONFIG, USER_PROFILE_SCHEMATICS_CONFIG, } from './lib-configs/user-schematics-config'; - import { Module, SchematicConfig } from './utils/lib-utils'; /** @@ -99,6 +99,8 @@ export const SCHEMATICS_CONFIGS: SchematicConfig[] = [ QUALTRICS_SCHEMATICS_CONFIG, + REQUESTED_DELIVERY_DATE_SCHEMATICS_CONFIG, + SMARTEDIT_SCHEMATICS_CONFIG, STOREFINDER_SCHEMATICS_CONFIG, diff --git a/projects/schematics/src/shared/utils/graph-utils_spec.ts b/projects/schematics/src/shared/utils/graph-utils_spec.ts index ecda68acfa1..deaa8f366e0 100644 --- a/projects/schematics/src/shared/utils/graph-utils_spec.ts +++ b/projects/schematics/src/shared/utils/graph-utils_spec.ts @@ -15,6 +15,7 @@ import { SPARTACUS_PRODUCT, SPARTACUS_PRODUCT_CONFIGURATOR, SPARTACUS_QUALTRICS, + SPARTACUS_REQUESTED_DELIVERY_DATE, SPARTACUS_S4OM, SPARTACUS_SEGMENT_REFS, SPARTACUS_SMARTEDIT, @@ -129,6 +130,7 @@ describe('Graph utils', () => { SPARTACUS_CART, SPARTACUS_ORDER, SPARTACUS_CHECKOUT, + SPARTACUS_REQUESTED_DELIVERY_DATE, SPARTACUS_TRACKING, SPARTACUS_ORGANIZATION, SPARTACUS_ASM, @@ -184,6 +186,7 @@ describe('Graph utils', () => { "CDC", "Customer-Ticketing", "SmartEdit", + "Requested-Delivery-Date", "Qualtrics", "Future-Stock", "Product-Variants", diff --git a/projects/schematics/src/shared/utils/test-utils.ts b/projects/schematics/src/shared/utils/test-utils.ts index 65558722568..f6cdf7aedf3 100644 --- a/projects/schematics/src/shared/utils/test-utils.ts +++ b/projects/schematics/src/shared/utils/test-utils.ts @@ -69,6 +69,8 @@ export const productConfiguratorRulebasedWrapperModulePath = 'src/app/spartacus/features/product-configurator/rulebased-configurator-wrapper.module.ts'; export const qualtricsFeatureModulePath = 'src/app/spartacus/features/qualtrics/qualtrics-feature.module.ts'; +export const requestedDeliveryDateFeatureModulePath = + 'src/app/spartacus/features/requested-delivery-date/requested-delivery-date-feature.module.ts'; export const smartEditFeatureModulePath = 'src/app/spartacus/features/smartedit/smart-edit-feature.module.ts'; export const storeFinderFeatureModulePath = diff --git a/projects/storefrontapp-e2e-cypress/cypress/e2e/vendor/requested-delivery-date/requested-delivery-date.e2e.cy.ts b/projects/storefrontapp-e2e-cypress/cypress/e2e/vendor/requested-delivery-date/requested-delivery-date.e2e.cy.ts new file mode 100644 index 00000000000..21aa07b32f4 --- /dev/null +++ b/projects/storefrontapp-e2e-cypress/cypress/e2e/vendor/requested-delivery-date/requested-delivery-date.e2e.cy.ts @@ -0,0 +1,168 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import * as b2bCheckout from '../../../helpers/b2b/b2b-checkout'; +import { + interceptOrdersEndpoint, + waitForResponse, +} from '../../../helpers/order-history'; +import * as rddHelper from '../../../helpers/vendor/requested-delivery-date/requested-delivery-date'; +import * as s4Helper from '../../../helpers/vendor/s4om/s4om'; +import { + ORDER_REQUEST_ENDPOINT, + order_type, + POWERTOOLS_BASESITE, + USER_REQUEST_ENDPOINT, +} from '../../../sample-data/b2b-checkout'; +import { isolateTestsBefore } from '../../../support/utils/test-isolation'; + +//Set the date in mmm dd, yyyy format +const formattedDate = new Date().toLocaleDateString('en', { + year: 'numeric', + month: 'short', + day: 'numeric', +}); +const today = new Date(); + +//Set the date in yyyy-mm-dd format +const inputDate = `${today.getFullYear()}-${today.toLocaleString('default', { + month: '2-digit', +})}-${today.toLocaleString('default', { day: '2-digit' })}`; + +describe('Requested Delivery Date', { testIsolation: false }, () => { + isolateTestsBefore(); + before(() => { + cy.window().then((win) => win.sessionStorage.clear()); + Cypress.env('BASE_SITE', POWERTOOLS_BASESITE); + Cypress.env('OCC_PREFIX_USER_ENDPOINT', USER_REQUEST_ENDPOINT); + Cypress.env('OCC_PREFIX_ORDER_ENDPOINT', ORDER_REQUEST_ENDPOINT); + }); + + beforeEach(() => { + cy.restoreLocalStorage(); + }); + + afterEach(() => { + cy.saveLocalStorage(); + }); + + describe('Requested Delivery Date in Checkout Flow', () => { + it('should be able to login as a b2b user', () => { + s4Helper.loginS4OMB2bUser(); + }); + + it('should add a S4 HANA product (TG-11) to cart', () => { + s4Helper.resetCart(); //clear the cart + s4Helper.addB2bS4ProductToCart(); //Ensure that the cart has only 1 S4 product + }); + + it('should proceed to checkout and select Account payment type', () => { + s4Helper.proceedtoCheckOutS4Product(); + b2bCheckout.enterPONumber(rddHelper.poNumber); + b2bCheckout.selectAccountPayment(); + }); + + it('should select shipping address', () => { + s4Helper.selectS4OMAccountShippingAddress(); + }); + + it('should select delivery mode and display Request Delivery Date form', () => { + rddHelper.selectAccountDeliveryMode(); + }); + + it('should show an error when an invalid delivery date is provided', () => { + rddHelper.updateRequestedDeliveryDate('1000-01-01'); + rddHelper.verifyDeliveryDateErrorMessage(); + }); + + it('should show an info message when the delivery date is updated', () => { + rddHelper.updateRequestedDeliveryDate(inputDate); + rddHelper.verifyDeliveryDateInfoMessage(); + }); + + it('should review and display the Requested Delivery Date', () => { + rddHelper.proceedToOrderReviewPage(); + rddHelper.verifyRDDOrderReviewPage(formattedDate); + }); + + it('should route back to the select delivery mode step when the edit button is clicked', () => { + rddHelper.editDeliveryMethodOrderReviewPage(); + rddHelper.proceedToOrderReviewPage(); + }); + + it('should place order', () => { + rddHelper.verifyRDDOrderReviewPage(formattedDate); + b2bCheckout.reviewB2bReviewOrderPage( + s4Helper.s4omB2bAccountShipToUser, + s4Helper.cartWithS4OMB2bProductAndPremiumShipping, + true, + order_type.PLACE_ORDER, + s4Helper.s4omTabbingOrderConfig, + rddHelper.poNumber, + s4Helper.s4omCostCenter, + s4Helper.s4omB2BUnit + ); + b2bCheckout.placeOrder('/order-confirmation'); + }); + + it('should display order confirmation summary page with Requested delivery date', () => { + s4Helper.reviewB2bOrderDetail( + s4Helper.s4omB2bAccountShipToUser, + s4Helper.s4omProduct, + s4Helper.cartWithS4OMB2bProductAndPremiumShipping, + true, + null, + rddHelper.poNumber, + s4Helper.s4omCostCenter, + s4Helper.s4omB2BUnit + ); + rddHelper.verifyRDDOrderDetailPage(formattedDate); + s4Helper.setOrderConfirmationIdInSessionStorage('rddOrderId'); + }); + }); + + describe('Requested Delivery Date in Order History', () => { + it('should be able to view order in order history with PO# and Cost center', () => { + cy.visit('/my-account/orders'); + const ordersAlias = interceptOrdersEndpoint(); + waitForResponse(ordersAlias); + + const rddOrderId = window.sessionStorage.getItem('rddOrderId'); + cy.wrap(rddOrderId).should('not.be.null'); + s4Helper.findRowInOrderHistoryTable( + ordersAlias, + rddOrderId, + rddHelper.poNumber + ); + }); + + it('should be able to view a past order detail in order detail page with requested delivery date information', () => { + cy.intercept({ + method: 'GET', + pathname: `${Cypress.env('OCC_PREFIX')}/${Cypress.env( + 'BASE_SITE' + )}/users/current/orders/*`, + }).as('getOrderDetail'); + + const rddOrderId = window.sessionStorage.getItem('rddOrderId'); + cy.visit('/my-account/order/' + rddOrderId); + cy.wait('@getOrderDetail'); + + s4Helper.reviewB2bOrderDetail( + s4Helper.s4omB2bAccountShipToUser, + s4Helper.s4omProduct, + s4Helper.cartWithS4OMB2bProductAndPremiumShipping, + true, + null, + rddHelper.poNumber, + s4Helper.s4omCostCenter, + s4Helper.s4omB2BUnit, + false + ); + rddHelper.verifyRDDOrderDetailPage(formattedDate); + }); + }); +}); diff --git a/projects/storefrontapp-e2e-cypress/cypress/e2e/vendor/s4om/s4om-schedule-lines.e2e.cy.ts b/projects/storefrontapp-e2e-cypress/cypress/e2e/vendor/s4om/s4om-schedule-lines.e2e.cy.ts index 2ad0229bac4..18547e65088 100644 --- a/projects/storefrontapp-e2e-cypress/cypress/e2e/vendor/s4om/s4om-schedule-lines.e2e.cy.ts +++ b/projects/storefrontapp-e2e-cypress/cypress/e2e/vendor/s4om/s4om-schedule-lines.e2e.cy.ts @@ -18,8 +18,10 @@ import { POWERTOOLS_BASESITE, USER_REQUEST_ENDPOINT, } from '../../../sample-data/b2b-checkout'; +import { isolateTestsBefore } from '../../../support/utils/test-isolation'; -describe('S4HANA Order management', () => { +describe('S4HANA Order management', { testIsolation: false }, () => { + isolateTestsBefore(); before(() => { cy.window().then((win) => win.sessionStorage.clear()); Cypress.env('BASE_SITE', POWERTOOLS_BASESITE); @@ -65,7 +67,7 @@ describe('S4HANA Order management', () => { }); it('should select delivery mode', () => { - b2bCheckout.selectAccountDeliveryMode(); + s4omHelper.selectAccountDeliveryMode(); }); it('should review and place order', () => { @@ -87,10 +89,12 @@ describe('S4HANA Order management', () => { s4omHelper.cartWithS4OMB2bProductAndPremiumShipping, true, null, + s4omHelper.s4omPONumber, s4omHelper.s4omCostCenter, s4omHelper.s4omB2BUnit ); s4omHelper.verifyScheduleLineInfo(); + s4omHelper.setOrderConfirmationIdInSessionStorage('s4omOrderId'); }); }); describe('Schedule lines in Order History', () => { @@ -99,9 +103,14 @@ describe('S4HANA Order management', () => { const ordersAlias = interceptOrdersEndpoint(); waitForResponse(ordersAlias); - cy.get('cx-order-history h2').should('contain', 'Order history'); - cy.get('.cx-order-history-po a').should('contain', poNumber); - //cy.get('.cx-order-history-cost-center a').should('contain', s4omHelper.s4omCostCenter); + const s4omPastOrderId = + window.sessionStorage.getItem('s4omOrderId') || '103439'; + cy.wrap(s4omPastOrderId).should('not.be.null'); + s4omHelper.findRowInOrderHistoryTable( + ordersAlias, + s4omPastOrderId, + poNumber + ); }); it('should be able to view a past order detail in order detail page with schedule line delivery information', () => { @@ -112,7 +121,11 @@ describe('S4HANA Order management', () => { )}/users/current/orders/*`, }).as('getOrderDetail'); - cy.visit('/my-account/order/' + s4omHelper.s4omPastOrderId); + const s4omPastOrderId = + window.sessionStorage.getItem('s4omOrderId') || + s4omHelper.s4omPastOrderId; + cy.wrap(s4omPastOrderId).should('not.be.null'); + cy.visit('/my-account/order/' + s4omPastOrderId); cy.wait('@getOrderDetail'); s4omHelper.reviewB2bOrderDetail( @@ -121,6 +134,7 @@ describe('S4HANA Order management', () => { s4omHelper.cartWithS4OMB2bProductAndPremiumShipping, true, null, + s4omHelper.s4omPONumber, s4omHelper.s4omCostCenter, s4omHelper.s4omB2BUnit, false diff --git a/projects/storefrontapp-e2e-cypress/cypress/helpers/b2b/b2b-checkout.ts b/projects/storefrontapp-e2e-cypress/cypress/helpers/b2b/b2b-checkout.ts index 3b0f90c1806..7937013ef08 100644 --- a/projects/storefrontapp-e2e-cypress/cypress/helpers/b2b/b2b-checkout.ts +++ b/projects/storefrontapp-e2e-cypress/cypress/helpers/b2b/b2b-checkout.ts @@ -158,14 +158,14 @@ export function addB2bProductToCart() { addCheapProductToCart(products[0]); } -export function enterPONumber() { +export function enterPONumber(poNum: string = poNumber) { cy.get('cx-payment-type .cx-payment-type-container').should( 'contain', 'Payment method' ); cy.get('cx-payment-type').within(() => { - cy.get('.form-control').clear().type(poNumber); + cy.get('.form-control').clear().type(poNum); }); // Accessibility @@ -320,7 +320,10 @@ export function reviewB2bReviewOrderPage( cartData: SampleCartProduct, isAccount: boolean, orderType: string, - conf: TabbingOrderConfig = config + conf: TabbingOrderConfig = config, + poNum: string = poNumber, + costCtr: string = costCenter, + b2bUnt: string = b2bUnit ) { verifyReviewOrderPage(); @@ -329,7 +332,7 @@ export function reviewB2bReviewOrderPage( .contains('cx-card', 'Purchase Order Number') .find('.cx-card-container') .within(() => { - cy.findByText(poNumber); + cy.findByText(poNum); }); cy.get('.cx-review-summary-card') @@ -343,8 +346,8 @@ export function reviewB2bReviewOrderPage( .contains('cx-card', 'Cost Center') .find('.cx-card-container') .within(() => { - cy.findByText(costCenter); - cy.findByText(`(${b2bUnit})`); + cy.findByText(costCtr); + cy.findByText(`(${b2bUnt})`); }); } diff --git a/projects/storefrontapp-e2e-cypress/cypress/helpers/vendor/requested-delivery-date/requested-delivery-date.ts b/projects/storefrontapp-e2e-cypress/cypress/helpers/vendor/requested-delivery-date/requested-delivery-date.ts new file mode 100644 index 00000000000..c3f8432f38b --- /dev/null +++ b/projects/storefrontapp-e2e-cypress/cypress/helpers/vendor/requested-delivery-date/requested-delivery-date.ts @@ -0,0 +1,173 @@ +/* + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { + b2bDeliveryAddress, + b2bDeliveryModeStub, +} from '../../../sample-data/b2b-checkout'; +import { interceptGet } from '../../../support/utils/intercept'; +import { tabbingOrderConfig } from '../../accessibility/b2b/tabbing-order.config'; +import { verifyTabbingOrder } from '../../accessibility/tabbing-order'; +import { + TabbingOrderConfig, + TabbingOrderTypes, +} from '../../accessibility/tabbing-order.model'; +import { + interceptCheckoutB2BDetailsEndpoint, + interceptPutDeliveryModeEndpoint, +} from '../../b2b/b2b-checkout'; +import { waitForPage } from '../../checkout-flow'; +import * as alerts from '../../global-message'; + +export const poNumber = '777'; + +export const rddDeliveryModeTabbingConfig: TabbingOrderConfig = { + ...tabbingOrderConfig, + deliveryMode: [ + { value: 'Method ofPayment', type: TabbingOrderTypes.LINK }, + { value: 'ShippingAddress', type: TabbingOrderTypes.LINK }, + { value: 'deliveryModeId', type: TabbingOrderTypes.RADIO }, + { value: 'deliveryModeId', type: TabbingOrderTypes.RADIO }, + { value: 'requestedDeliveryDate', type: TabbingOrderTypes.GENERIC_INPUT }, + { value: 'Back', type: TabbingOrderTypes.BUTTON }, + { value: 'Continue', type: TabbingOrderTypes.BUTTON }, + ], +}; + +export function selectAccountDeliveryMode() { + const getCheckoutDetails = interceptCheckoutB2BDetailsEndpoint( + b2bDeliveryModeStub, + b2bDeliveryAddress.id + ); + const putDeliveryMode = interceptPutDeliveryModeEndpoint(); + + interceptGet( + 'cart_refresh', + '/users/*/carts/*?fields=DEFAULT,potentialProductPromotions*' + ); + + cy.get('.cx-checkout-title').should('contain', 'Delivery Method'); + cy.wait(`@${getCheckoutDetails}`) + .its('response.statusCode') + .should('eq', 200); + cy.get('cx-delivery-mode input').first().should('be.checked'); + cy.get('cx-delivery-mode input').eq(1).click(); + + cy.wait(`@${putDeliveryMode}`).its('response.statusCode').should('eq', 200); + cy.get('cx-delivery-mode input').first().should('not.be.checked'); + + cy.get('input[type=radio][formcontrolname=deliveryModeId]').should( + 'not.be.disabled' + ); + cy.get( + 'input[type=radio][formcontrolname=deliveryModeId]:not(:disabled)' + ).then(() => { + // Accessibility + verifyTabbingOrder( + 'cx-page-layout.MultiStepCheckoutSummaryPageTemplate', + rddDeliveryModeTabbingConfig.deliveryMode + ); + }); + cy.wait(`@cart_refresh`).then((xhr) => { + expect(xhr.request.method).to.eq('GET'); + expect(xhr.response.statusCode).to.eq(200); + if (xhr && xhr.response && xhr.response.body) { + if (!xhr.response.body.requestedRetrievalAt) { + const alert = alerts.getAlert(); + alert.should('contain', 'Delivery Date updated successfully.'); + cy.get('cx-global-message .alert', { timeout: 5000 }).should( + 'not.exist' + ); + } + } + }); + + verifyRDDDatePickerExists(); +} + +export function verifyRDDDatePickerExists() { + cy.get('cx-request-delivery-date').should('exist'); + cy.get('cx-request-delivery-date').within(() => { + cy.get('cx-date-picker').should('exist'); + cy.get('input[type="date"]', { timeout: 3000 }).should('not.be.disabled'); + }); +} + +export function updateRequestedDeliveryDate(date: string) { + interceptPutRequestedRetrievalAtEndpoint(); + cy.get('cx-date-picker').within(() => { + cy.get('input[type="date"]', { timeout: 3000 }) + .should('not.be.disabled') + .type(date) + .trigger('update'); + }); +} + +export function verifyDeliveryDateErrorMessage() { + cy.wait(`@putRetrievalAt`).its('response.statusCode').should('eq', 400); + //verify error message is shown. + const alert = alerts.getErrorAlert(); + alert.should( + 'contain', + 'Something went wrong. Unable to update the requested date.' + ); +} + +export function verifyDeliveryDateInfoMessage() { + const getCheckoutDetails = interceptCheckoutB2BDetailsEndpoint( + b2bDeliveryModeStub, + b2bDeliveryAddress.id + ); + + cy.wait(`@${getCheckoutDetails}`) + .its('response.statusCode') + .should('eq', 200); + + cy.wait(`@putRetrievalAt`).its('response.statusCode').should('eq', 200); + //verify info message is shown. + const alert = alerts.getAlert(); + alert.should('contain', 'Delivery Date updated successfully.'); +} + +export function proceedToOrderReviewPage() { + const orderReview = waitForPage('/checkout/review-order', 'getReviewOrder'); + cy.get('button.btn-primary').should('be.enabled').click(); + cy.wait(`@${orderReview}`, { timeout: 30000 }) + .its('response.statusCode') + .should('eq', 200); +} + +export function verifyRDDOrderReviewPage(date: string) { + cy.get('.cx-review-summary-card') + .contains('cx-card', 'Delivery Method') + .get('cx-request-delivery-date') + .within(() => { + cy.findByText('Requested Delivery Date'); + cy.findByText(date); + }); +} + +export function editDeliveryMethodOrderReviewPage() { + cy.get('.cx-review-card-shipping > .cx-review-summary-edit-step > a').click(); + verifyRDDDatePickerExists(); +} + +export function verifyRDDOrderDetailPage(date: string) { + cy.get('cx-order-overview-delivery-date').should('exist'); + cy.get('cx-order-overview-delivery-date').within(() => { + cy.findByText('Requested Delivery Date'); + cy.findByText(date); + }); +} + +export function interceptPutRequestedRetrievalAtEndpoint() { + cy.intercept({ + method: 'PUT', + path: `${Cypress.env('OCC_PREFIX')}/${Cypress.env( + 'BASE_SITE' + )}/**/requestedretrievaldate?requestedRetrievalAt=*`, + }).as('putRetrievalAt'); +} diff --git a/projects/storefrontapp-e2e-cypress/cypress/helpers/vendor/s4om/s4om.ts b/projects/storefrontapp-e2e-cypress/cypress/helpers/vendor/s4om/s4om.ts index be0ccfe1748..901eb81a8e2 100644 --- a/projects/storefrontapp-e2e-cypress/cypress/helpers/vendor/s4om/s4om.ts +++ b/projects/storefrontapp-e2e-cypress/cypress/helpers/vendor/s4om/s4om.ts @@ -5,6 +5,8 @@ */ import { + b2bDeliveryAddress, + b2bDeliveryModeStub, cartWithB2bProductAndPremiumShipping, poNumber, POWERTOOLS_BASESITE, @@ -16,18 +18,21 @@ import { SampleUser, } from '../../../sample-data/checkout-flow'; import { AccountData } from '../../../support/require-logged-in.commands'; +import { interceptGet, interceptPost } from '../../../support/utils/intercept'; import { tabbingOrderConfig } from '../../accessibility/b2b/tabbing-order.config'; import { verifyTabbingOrder } from '../../accessibility/tabbing-order'; import { TabbingOrderConfig, TabbingOrderTypes, } from '../../accessibility/tabbing-order.model'; -import { addProductToCart } from '../../applied-promotions'; import { login } from '../../auth-forms'; -import { interceptPutDeliveryModeEndpoint } from '../../b2b/b2b-checkout'; +import { + interceptCheckoutB2BDetailsEndpoint, + interceptPutDeliveryModeEndpoint, +} from '../../b2b/b2b-checkout'; import { clearActiveCart, goToCart, validateEmptyCart } from '../../cart'; -//import { interceptPaymentTypesEndpoint } from "../../b2b/b2b-checkout"; import { waitForPage, waitForProductPage } from '../../checkout-flow'; +import { LOCATORS } from '../../pickup-in-store-utils'; export const s4omB2BUser: AccountData = { registrationData: { @@ -46,14 +51,14 @@ export const s4omB2bAccountShipToUser: SampleUser = { fullName: 'James Weber', address: { city: 'Chicago', - line1: 'Sunset, 87654, California, Beverly Hills, 90210', + line1: 'Sunset', }, }; export const cartWithS4OMB2bProductAndPremiumShipping: SampleCartProduct = { estimatedShipping: '$16.99', - total: '$17.55', - totalAndShipping: '$34.54', + total: '$12.55', + totalAndShipping: '$30.72', }; export const s4omProduct: SampleProduct = { @@ -62,9 +67,10 @@ export const s4omProduct: SampleProduct = { }; export const s4omProductLink: string = s4omProduct.code + '/multi-eco-33i'; -export const s4omCostCenter: string = '17100005_CC'; +export const s4omPONumber: string = poNumber; +export const s4omCostCenter: string = '17100003_CC'; export const s4omB2BUnit: string = 'Dell Bont Industries'; -export const s4omPastOrderId: string = '787'; +export const s4omPastOrderId: string = '103300'; const acceptAndSubmitOrder = [ { @@ -80,7 +86,7 @@ const acceptAndSubmitOrder = [ export const s4omAccountReviewOrderGeneral = [ { value: 'Method ofPayment', type: TabbingOrderTypes.LINK }, - { value: 'DeliveryAddress', type: TabbingOrderTypes.LINK }, + { value: 'ShippingAddress', type: TabbingOrderTypes.LINK }, { value: 'DeliveryMode', type: TabbingOrderTypes.LINK }, { value: '/powertools-spa/en/USD/checkout/payment-type', @@ -120,6 +126,19 @@ export const s4omAccountReviewOrderGeneral = [ }, ]; +export const s4omDeliveryModeTabbingConfig: TabbingOrderConfig = { + ...tabbingOrderConfig, + deliveryMode: [ + { value: 'Method ofPayment', type: TabbingOrderTypes.LINK }, + { value: 'ShippingAddress', type: TabbingOrderTypes.LINK }, + { value: 'deliveryModeId', type: TabbingOrderTypes.RADIO }, + { value: 'deliveryModeId', type: TabbingOrderTypes.RADIO }, + { value: 'requestedDeliveryDate', type: TabbingOrderTypes.GENERIC_INPUT }, + { value: 'Back', type: TabbingOrderTypes.BUTTON }, + { value: 'Continue', type: TabbingOrderTypes.BUTTON }, + ], +}; + export const s4omTabbingOrderConfig: TabbingOrderConfig = { ...tabbingOrderConfig, checkoutReviewOrder: [ @@ -145,6 +164,7 @@ export function loginS4OMB2bUser() { cy.window().then((win) => win.sessionStorage.clear()); cy.visit('/login'); + cy.get(LOCATORS.ALLOW_COOKIES_BUTTON).click(); login( s4omB2BUser.registrationData.email, s4omB2BUser.registrationData.password @@ -165,7 +185,41 @@ export function addB2bS4ProductToCart() { cy.get('h1').should('contain', s4omProduct.name); }); - addProductToCart(); + interceptPost(`cart_entry`, `/orgUsers/current/carts/*/entries*`); + + interceptGet( + 'cart_refresh', + '/users/*/carts/*?fields=DEFAULT,potentialProductPromotions*' + ); + cy.get('cx-add-to-cart') + .findByText(/Add To Cart/i) + .click(); + + //Obtain schedule line info from Cart Entry + cy.wait('@cart_entry') + .then((xhr) => { + expect(xhr.request.method).to.eq('POST'); + if ( + xhr && + xhr.response && + xhr.response.body && + xhr.response.body.entry && + xhr.response.body.entry.scheduleLines + ) { + window.sessionStorage.setItem( + 'TG11-scheduleLines', + JSON.stringify(xhr.response.body.entry.scheduleLines) + ); + } + }) + .its('response.statusCode') + .should('eq', 200); + + cy.wait(`@cart_refresh`); + + cy.get('cx-added-to-cart-dialog').within(() => { + cy.get('.cx-name .cx-link').should('contain', s4omProduct.name); + }); } export function resetCart() { @@ -184,9 +238,29 @@ export function goToCart() { } export function verifyScheduleLineInfo() { - cy.get('[class="cx-schedule-line-info"]').within(() => { - cy.findByText('Quantity'); - }); + let scheduleLines = window.sessionStorage.getItem('TG11-scheduleLines'); + cy.wrap('scheduleLines').should('not.be.null'); + + scheduleLines = JSON.parse(scheduleLines); + cy.wrap('scheduleLines').should('have.length.at.least', 1); + + for (let i = 0; i < scheduleLines.length; i++) { + cy.get('[aria-describedby="cx-schedule-line-info-' + i + '"]').within( + () => { + const confirmedDate = new Date( + scheduleLines[i]['confirmedAt'] + ).toLocaleDateString('en', { + year: 'numeric', + month: 'numeric', + day: 'numeric', + }); + + cy.contains(confirmedDate); + cy.contains('Qty'); + cy.contains(scheduleLines[i]['confirmedQuantity']); + } + ); + } } export function proceedtoCheckOutS4Product() { @@ -200,7 +274,9 @@ export function proceedtoCheckOutS4Product() { export function selectS4OMAccountShippingAddress() { const putDeliveryMode = interceptPutDeliveryModeEndpoint(); - cy.wait(7000); //delivery address loads slow + cy.get('.cx-delivery-address-card-inner > cx-card .card-header', { + timeout: 15000, + }).should('contain', 'Selected'); //delivery address loads slow cy.get('.cx-checkout-title').should('contain', 'Shipping Address'); cy.get('cx-order-summary .cx-summary-partials .cx-summary-row') .first() @@ -234,12 +310,53 @@ export function selectS4OMAccountShippingAddress() { cy.wait(`@${putDeliveryMode}`).its('response.statusCode').should('eq', 200); } +export function selectAccountDeliveryMode() { + const getCheckoutDetails = interceptCheckoutB2BDetailsEndpoint( + b2bDeliveryModeStub, + b2bDeliveryAddress.id + ); + const putDeliveryMode = interceptPutDeliveryModeEndpoint(); + + cy.get('.cx-checkout-title').should('contain', 'Delivery Method'); + + cy.get('cx-delivery-mode input').first().should('be.checked'); + cy.get('cx-delivery-mode input').eq(1).click(); + + cy.wait(`@${putDeliveryMode}`).its('response.statusCode').should('eq', 200); + cy.wait(`@${getCheckoutDetails}`) + .its('response.statusCode') + .should('eq', 200); + + cy.get('cx-delivery-mode input').first().should('not.be.checked'); + + cy.get( + 'input[type=radio][formcontrolname=deliveryModeId]:not(:disabled)' + ).then(() => { + // Accessibility + verifyTabbingOrder( + 'cx-page-layout.MultiStepCheckoutSummaryPageTemplate', + s4omDeliveryModeTabbingConfig.deliveryMode + ); + }); + + const orderReview = waitForPage('/checkout/review-order', 'getReviewOrder'); + + cy.get('.cx-checkout-btns button.btn-primary') + .should('be.enabled') + .click({ force: true }); + + cy.wait(`@${orderReview}`, { timeout: 30000 }) + .its('response.statusCode') + .should('eq', 200); +} + export function reviewB2bOrderDetail( sampleUser: SampleUser = s4omB2bAccountShipToUser, sampleProduct: SampleProduct = s4omProduct, cartData: SampleCartProduct, isAccount: boolean = true, replenishment?: string, + poNum: string = s4omPONumber, costCtr: string = s4omCostCenter, b2bUnt: string = s4omB2BUnit, isOrderConfirmation: boolean = true @@ -253,14 +370,16 @@ export function reviewB2bOrderDetail( cy.get('cx-order-overview .container').within(() => { cy.get('.cx-summary-card:nth-child(1)').within(() => { - cy.get('cx-card:nth-child(1)').within(() => { - if (!replenishment) { - cy.get('.cx-card-title').should('contain', 'Order Number'); - } else { - cy.get('.cx-card-title').should('contain', 'Replenishment #'); - } - cy.get('.cx-card-label').should('not.be.empty'); - }); + cy.get('cx-card:nth-child(1)') + .first() + .within(() => { + if (!replenishment) { + cy.get('.cx-card-title').should('contain', 'Order Number'); + } else { + cy.get('.cx-card-title').should('contain', 'Replenishment #'); + } + cy.get('.cx-card-label').should('not.be.empty'); + }); if (!replenishment) { cy.get('cx-card:nth-child(2)').within(() => { cy.get('.cx-card-title').should('contain', 'Placed on'); @@ -279,15 +398,29 @@ export function reviewB2bOrderDetail( }); if (!replenishment) { - cy.get('.cx-summary-card:nth-child(2) .cx-card').within(() => { - cy.contains(poNumber); - if (isAccount) { - cy.contains('Account'); - cy.contains(costCtr); - cy.contains(`(${b2bUnt})`); - } else { - cy.contains('Credit Card'); - } + cy.get('.cx-summary-card:nth-child(2)').within(() => { + cy.get('.cx-card') + .eq(0) + .within(() => { + cy.contains(poNum); + }); + cy.get('.cx-card') + .eq(1) + .within(() => { + if (isAccount) { + cy.contains('Account'); + } else { + cy.contains('Credit Card'); + } + }); + cy.get('.cx-card') + .eq(2) + .within(() => { + if (isAccount) { + cy.contains(costCtr); + cy.contains(`(${b2bUnt})`); + } + }); }); } else { cy.get('.cx-summary-card:nth-child(2) .cx-card').within(() => { @@ -296,7 +429,7 @@ export function reviewB2bOrderDetail( }); cy.get('.cx-summary-card:nth-child(3) .cx-card').within(() => { - cy.contains(poNumber); + cy.contains(poNum); if (isAccount) { cy.contains('Account'); cy.contains(costCtr); @@ -308,18 +441,25 @@ export function reviewB2bOrderDetail( } if (!replenishment) { - cy.get('.cx-summary-card:nth-child(3) .cx-card').within(() => { - cy.contains(sampleUser.fullName); - cy.contains(sampleUser.address.line1); - - if ( - cartData.estimatedShipping === - cartWithB2bProductAndPremiumShipping.estimatedShipping - ) { - cy.contains('Premium Delivery'); - } else { - cy.contains('Standard Delivery'); - } + cy.get('.cx-summary-card:nth-child(3)').within(() => { + cy.get('.cx-card') + .eq(0) + .within(() => { + cy.contains(sampleUser.fullName); + cy.contains(sampleUser.address.line1); + }); + cy.get('.cx-card') + .eq(1) + .within(() => { + if ( + cartData.estimatedShipping === + cartWithB2bProductAndPremiumShipping.estimatedShipping + ) { + cy.contains('Premium Delivery'); + } else { + cy.contains('Standard Delivery'); + } + }); }); } else { cy.get('.cx-summary-card:nth-child(4) .cx-card').within(() => { @@ -345,3 +485,47 @@ export function reviewB2bOrderDetail( cartData.totalAndShipping ); } + +export function setOrderConfirmationIdInSessionStorage(alias: string) { + cy.get('cx-order-overview .container').within(() => { + cy.get('.cx-summary-card:nth-child(1)').within(() => { + cy.get('cx-card:nth-child(1)') + .first() + .within(() => { + cy.get('.cx-card-title').should('contain', 'Order Number'); + cy.get('.cx-card-label').then(($el) => { + window.sessionStorage.setItem(alias, $el.text().trim()); + }); + }); + }); + }); + return alias; +} + +export function findRowInOrderHistoryTable( + orderAPIAlias: string, + orderId: string, + poNum: string, + costCenter?: string +) { + cy.get('cx-order-history h2').should('contain', 'Order history'); + + let index = 2; //start navigating from the second page + cy.get('#order-history-table').as('orderHistoryTable'); + const goToNextPage = () => { + cy.get('@orderHistoryTable').then(($odt) => { + if ($odt.html().includes(orderId)) { + cy.get('.cx-order-history-code a').should('contain', orderId); + cy.get('.cx-order-history-po a').should('contain', poNum); + if (costCenter) { + cy.get('.cx-order-history-po a').should('contain', costCenter); + } + } else { + cy.get('cx-pagination').findByText(index).first().click(); + index++; + cy.wait(`@${orderAPIAlias}`).then(goToNextPage); + } + }); + }; + goToNextPage(); +} diff --git a/projects/storefrontapp/project.json b/projects/storefrontapp/project.json index 36b2eb16a26..d52aecd7154 100644 --- a/projects/storefrontapp/project.json +++ b/projects/storefrontapp/project.json @@ -57,6 +57,10 @@ "input": "projects/storefrontapp/src/styles/lib-qualtrics.scss", "bundleName": "qualtrics" }, + { + "input": "projects/storefrontapp/src/styles/lib-requested-delivery-date.scss", + "bundleName": "requested-delivery-date" + }, { "input": "projects/storefrontapp/src/styles/lib-cart.scss", "bundleName": "cart" diff --git a/projects/storefrontapp/src/app/spartacus/features/requested-delivery-date/requested-delivery-date-feature.module.ts b/projects/storefrontapp/src/app/spartacus/features/requested-delivery-date/requested-delivery-date-feature.module.ts new file mode 100644 index 00000000000..fe1dd2a6726 --- /dev/null +++ b/projects/storefrontapp/src/app/spartacus/features/requested-delivery-date/requested-delivery-date-feature.module.ts @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: 2022 SAP Spartacus team + * SPDX-FileCopyrightText: 2023 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { NgModule } from '@angular/core'; +import { CmsConfig, I18nConfig, provideConfig } from '@spartacus/core'; +import { + requestedDeliveryDateTranslationChunksConfig, + requestedDeliveryDateTranslations, +} from '@spartacus/requested-delivery-date/assets'; +import { + RequestedDeliveryDateRootModule, + REQUESTED_DELIVERY_DATE_FEATURE, +} from '@spartacus/requested-delivery-date/root'; + +@NgModule({ + imports: [RequestedDeliveryDateRootModule], + providers: [ + provideConfig({ + featureModules: { + [REQUESTED_DELIVERY_DATE_FEATURE]: { + module: () => + import('@spartacus/requested-delivery-date').then( + (m) => m.RequestedDeliveryDateModule + ), + }, + }, + }), + provideConfig({ + i18n: { + resources: requestedDeliveryDateTranslations, + chunks: requestedDeliveryDateTranslationChunksConfig, + }, + }), + ], +}) +export class RequestedDeliveryDateFeatureModule {} diff --git a/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts b/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts index 55a57924202..64a36f93193 100644 --- a/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts +++ b/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts @@ -37,16 +37,16 @@ import { NavigationEventModule, NavigationModule, NotificationPreferenceModule, - PDFModule, PageTitleModule, PaymentMethodsModule, + PDFModule, ProductCarouselModule, ProductDetailsPageModule, ProductFacetNavigationModule, ProductImagesModule, ProductIntroModule, - ProductListModule, ProductListingPageModule, + ProductListModule, ProductPageEventModule, ProductReferencesModule, ProductSummaryModule, @@ -85,6 +85,7 @@ import { ImageZoomFeatureModule } from './features/product/product-image-zoom-fe import { VariantsFeatureModule } from './features/product/product-variants-feature.module'; import { QualtricsFeatureModule } from './features/qualtrics/qualtrics-feature.module'; import { OrganizationUserRegistrationFeatureModule } from './features/registration-feature.module'; +import { RequestedDeliveryDateFeatureModule } from './features/requested-delivery-date/requested-delivery-date-feature.module'; import { S4OMFeatureModule } from './features/s4om/s4om-feature.module'; import { SegmentRefsFeatureModule } from './features/segment-refs/segment-refs-feature.module'; import { SmartEditFeatureModule } from './features/smartedit/smartedit-feature.module'; @@ -126,6 +127,9 @@ if (environment.s4om) { if (environment.segmentRefs) { featureModules.push(SegmentRefsFeatureModule); } +if (environment.requestedDeliveryDate) { + featureModules.push(RequestedDeliveryDateFeatureModule); +} @NgModule({ imports: [ diff --git a/projects/storefrontapp/src/environments/environment.prod.ts b/projects/storefrontapp/src/environments/environment.prod.ts index 79f9fbe2f07..52f3d2609ca 100644 --- a/projects/storefrontapp/src/environments/environment.prod.ts +++ b/projects/storefrontapp/src/environments/environment.prod.ts @@ -18,4 +18,5 @@ export const environment: Environment = { epdVisualization: buildProcess.env.CX_EPD_VISUALIZATION, s4om: buildProcess.env.CX_S4OM, segmentRefs: buildProcess.env.CX_SEGMENT_REFS, + requestedDeliveryDate: buildProcess.env.CX_REQUESTED_DELIVERY_DATE, }; diff --git a/projects/storefrontapp/src/environments/environment.ts b/projects/storefrontapp/src/environments/environment.ts index b7a561e1809..18033dad14d 100644 --- a/projects/storefrontapp/src/environments/environment.ts +++ b/projects/storefrontapp/src/environments/environment.ts @@ -31,4 +31,5 @@ export const environment: Environment = { epdVisualization: buildProcess.env.CX_EPD_VISUALIZATION ?? false, s4om: buildProcess.env.CX_S4OM ?? false, segmentRefs: buildProcess.env.CX_SEGMENT_REFS ?? false, + requestedDeliveryDate: buildProcess.env.CX_REQUESTED_DELIVERY_DATE ?? false, }; diff --git a/projects/storefrontapp/src/environments/models/build.process.env.d.ts b/projects/storefrontapp/src/environments/models/build.process.env.d.ts index 0293384c55a..b6e0f46055d 100644 --- a/projects/storefrontapp/src/environments/models/build.process.env.d.ts +++ b/projects/storefrontapp/src/environments/models/build.process.env.d.ts @@ -20,4 +20,5 @@ interface Env { CX_EPD_VISUALIZATION: boolean; CX_S4OM: boolean; CX_SEGMENT_REFS: boolean; + CX_REQUESTED_DELIVERY_DATE: boolean; } diff --git a/projects/storefrontapp/src/environments/models/environment.model.ts b/projects/storefrontapp/src/environments/models/environment.model.ts index 1a6cff360b6..4e6b60e944d 100644 --- a/projects/storefrontapp/src/environments/models/environment.model.ts +++ b/projects/storefrontapp/src/environments/models/environment.model.ts @@ -16,4 +16,5 @@ export interface Environment { epdVisualization: boolean; s4om: boolean; segmentRefs: boolean; + requestedDeliveryDate: boolean; } diff --git a/projects/storefrontapp/src/styles/lib-requested-delivery-date.scss b/projects/storefrontapp/src/styles/lib-requested-delivery-date.scss new file mode 100644 index 00000000000..e312d35ff2d --- /dev/null +++ b/projects/storefrontapp/src/styles/lib-requested-delivery-date.scss @@ -0,0 +1,2 @@ +@import '../styles-config'; +@import '@spartacus/requested-delivery-date'; diff --git a/projects/storefrontapp/tsconfig.app.prod.json b/projects/storefrontapp/tsconfig.app.prod.json index c604fd5b3dc..e0859d2d97d 100644 --- a/projects/storefrontapp/tsconfig.app.prod.json +++ b/projects/storefrontapp/tsconfig.app.prod.json @@ -255,6 +255,19 @@ "@spartacus/qualtrics/components": ["dist/qualtrics/components"], "@spartacus/qualtrics": ["dist/qualtrics"], "@spartacus/qualtrics/root": ["dist/qualtrics/root"], + "@spartacus/requested-delivery-date/assets": [ + "dist/requested-delivery-date/assets" + ], + "@spartacus/requested-delivery-date/core": [ + "dist/requested-delivery-date/core" + ], + "@spartacus/requested-delivery-date": ["dist/requested-delivery-date"], + "@spartacus/requested-delivery-date/occ": [ + "dist/requested-delivery-date/occ" + ], + "@spartacus/requested-delivery-date/root": [ + "dist/requested-delivery-date/root" + ], "@spartacus/smartedit/core": ["dist/smartedit/core"], "@spartacus/smartedit": ["dist/smartedit"], "@spartacus/smartedit/root": ["dist/smartedit/root"], diff --git a/projects/storefrontapp/tsconfig.server.json b/projects/storefrontapp/tsconfig.server.json index 5965f73caa8..6f403d19066 100644 --- a/projects/storefrontapp/tsconfig.server.json +++ b/projects/storefrontapp/tsconfig.server.json @@ -374,6 +374,21 @@ "@spartacus/qualtrics/root": [ "../../feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "../../feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "../../feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "../../feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "../../feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "../../feature-libs/smartedit/core/public_api" ], diff --git a/projects/storefrontapp/tsconfig.server.prod.json b/projects/storefrontapp/tsconfig.server.prod.json index fb2a5bbf0df..9b61f0ef35b 100644 --- a/projects/storefrontapp/tsconfig.server.prod.json +++ b/projects/storefrontapp/tsconfig.server.prod.json @@ -286,6 +286,21 @@ "@spartacus/qualtrics/components": ["../../dist/qualtrics/components"], "@spartacus/qualtrics": ["../../dist/qualtrics"], "@spartacus/qualtrics/root": ["../../dist/qualtrics/root"], + "@spartacus/requested-delivery-date/assets": [ + "../../dist/requested-delivery-date/assets" + ], + "@spartacus/requested-delivery-date/core": [ + "../../dist/requested-delivery-date/core" + ], + "@spartacus/requested-delivery-date": [ + "../../dist/requested-delivery-date" + ], + "@spartacus/requested-delivery-date/occ": [ + "../../dist/requested-delivery-date/occ" + ], + "@spartacus/requested-delivery-date/root": [ + "../../dist/requested-delivery-date/root" + ], "@spartacus/smartedit/core": ["../../dist/smartedit/core"], "@spartacus/smartedit": ["../../dist/smartedit"], "@spartacus/smartedit/root": ["../../dist/smartedit/root"], diff --git a/tools/schematics/testing.ts b/tools/schematics/testing.ts index 802446eacfd..76f198673a0 100644 --- a/tools/schematics/testing.ts +++ b/tools/schematics/testing.ts @@ -21,6 +21,7 @@ const featureLibsFolders: string[] = [ 'product', 'product-configurator', 'qualtrics', + 'requested-delivery-date', 'smartedit', 'storefinder', 'tracking', @@ -55,6 +56,7 @@ const commands = [ 'build s4om/schematics', 'build segment-refs/schematics', 'build qualtrics/schematics', + 'build requested-delivery-date/schematics', 'build smartedit/schematics', 'build storefinder/schematics', 'build tracking/schematics', @@ -201,6 +203,7 @@ async function executeCommand(command: Command): Promise { case 'build product/schematics': case 'build product-configurator/schematics': case 'build qualtrics/schematics': + case 'build requested-delivery-date/schematics': case 'build s4om/schematics': case 'build segment-refs/schematics': case 'build smartedit/schematics': diff --git a/tsconfig.compodoc.json b/tsconfig.compodoc.json index b43f2caf1a4..82f956d5202 100644 --- a/tsconfig.compodoc.json +++ b/tsconfig.compodoc.json @@ -428,6 +428,21 @@ "@spartacus/qualtrics/root": [ "feature-libs/qualtrics/root/public_api" ], + "@spartacus/requested-delivery-date/assets": [ + "feature-libs/requested-delivery-date/assets/public_api" + ], + "@spartacus/requested-delivery-date/core": [ + "feature-libs/requested-delivery-date/core/public_api" + ], + "@spartacus/requested-delivery-date": [ + "feature-libs/requested-delivery-date/public_api" + ], + "@spartacus/requested-delivery-date/occ": [ + "feature-libs/requested-delivery-date/occ/public_api" + ], + "@spartacus/requested-delivery-date/root": [ + "feature-libs/requested-delivery-date/root/public_api" + ], "@spartacus/smartedit/core": [ "feature-libs/smartedit/core/public_api" ], diff --git a/tsconfig.json b/tsconfig.json index 9cb8188087e..37eccea84ef 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,13 +9,8 @@ "moduleResolution": "node", "experimentalDecorators": true, "target": "ES2022", - "typeRoots": [ - "node_modules/@types" - ], - "lib": [ - "ES2022", - "dom" - ], + "typeRoots": ["node_modules/@types"], + "lib": ["ES2022", "dom"], "strictPropertyInitialization": false, "strict": true, "noUnusedLocals": true, @@ -24,33 +19,15 @@ "resolveJsonModule": true, "esModuleInterop": true, "paths": { - "@spartacus/schematics": [ - "projects/schematics/index" - ], - "@spartacus/setup": [ - "core-libs/setup/public_api" - ], - "@spartacus/setup/ssr": [ - "core-libs/setup/ssr/public_api" - ], - "@spartacus/asm/assets": [ - "feature-libs/asm/assets/public_api" - ], - "@spartacus/asm/components": [ - "feature-libs/asm/components/public_api" - ], - "@spartacus/asm/core": [ - "feature-libs/asm/core/public_api" - ], - "@spartacus/asm": [ - "feature-libs/asm/public_api" - ], - "@spartacus/asm/occ": [ - "feature-libs/asm/occ/public_api" - ], - "@spartacus/asm/root": [ - "feature-libs/asm/root/public_api" - ], + "@spartacus/schematics": ["projects/schematics/index"], + "@spartacus/setup": ["core-libs/setup/public_api"], + "@spartacus/setup/ssr": ["core-libs/setup/ssr/public_api"], + "@spartacus/asm/assets": ["feature-libs/asm/assets/public_api"], + "@spartacus/asm/components": ["feature-libs/asm/components/public_api"], + "@spartacus/asm/core": ["feature-libs/asm/core/public_api"], + "@spartacus/asm": ["feature-libs/asm/public_api"], + "@spartacus/asm/occ": ["feature-libs/asm/occ/public_api"], + "@spartacus/asm/root": ["feature-libs/asm/root/public_api"], "@spartacus/cart/base/assets": [ "feature-libs/cart/base/assets/public_api" ], @@ -63,18 +40,10 @@ "@spartacus/cart/base/components": [ "feature-libs/cart/base/components/public_api" ], - "@spartacus/cart/base/core": [ - "feature-libs/cart/base/core/public_api" - ], - "@spartacus/cart/base": [ - "feature-libs/cart/base/public_api" - ], - "@spartacus/cart/base/occ": [ - "feature-libs/cart/base/occ/public_api" - ], - "@spartacus/cart/base/root": [ - "feature-libs/cart/base/root/public_api" - ], + "@spartacus/cart/base/core": ["feature-libs/cart/base/core/public_api"], + "@spartacus/cart/base": ["feature-libs/cart/base/public_api"], + "@spartacus/cart/base/occ": ["feature-libs/cart/base/occ/public_api"], + "@spartacus/cart/base/root": ["feature-libs/cart/base/root/public_api"], "@spartacus/cart/import-export/assets": [ "feature-libs/cart/import-export/assets/public_api" ], @@ -90,9 +59,7 @@ "@spartacus/cart/import-export/root": [ "feature-libs/cart/import-export/root/public_api" ], - "@spartacus/cart": [ - "feature-libs/cart/public_api" - ], + "@spartacus/cart": ["feature-libs/cart/public_api"], "@spartacus/cart/quick-order/assets": [ "feature-libs/cart/quick-order/assets/public_api" ], @@ -117,9 +84,7 @@ "@spartacus/cart/saved-cart/core": [ "feature-libs/cart/saved-cart/core/public_api" ], - "@spartacus/cart/saved-cart": [ - "feature-libs/cart/saved-cart/public_api" - ], + "@spartacus/cart/saved-cart": ["feature-libs/cart/saved-cart/public_api"], "@spartacus/cart/saved-cart/occ": [ "feature-libs/cart/saved-cart/occ/public_api" ], @@ -138,9 +103,7 @@ "@spartacus/cart/wish-list/core": [ "feature-libs/cart/wish-list/core/public_api" ], - "@spartacus/cart/wish-list": [ - "feature-libs/cart/wish-list/public_api" - ], + "@spartacus/cart/wish-list": ["feature-libs/cart/wish-list/public_api"], "@spartacus/cart/wish-list/root": [ "feature-libs/cart/wish-list/root/public_api" ], @@ -153,9 +116,7 @@ "@spartacus/checkout/b2b/core": [ "feature-libs/checkout/b2b/core/public_api" ], - "@spartacus/checkout/b2b": [ - "feature-libs/checkout/b2b/public_api" - ], + "@spartacus/checkout/b2b": ["feature-libs/checkout/b2b/public_api"], "@spartacus/checkout/b2b/occ": [ "feature-libs/checkout/b2b/occ/public_api" ], @@ -171,18 +132,14 @@ "@spartacus/checkout/base/core": [ "feature-libs/checkout/base/core/public_api" ], - "@spartacus/checkout/base": [ - "feature-libs/checkout/base/public_api" - ], + "@spartacus/checkout/base": ["feature-libs/checkout/base/public_api"], "@spartacus/checkout/base/occ": [ "feature-libs/checkout/base/occ/public_api" ], "@spartacus/checkout/base/root": [ "feature-libs/checkout/base/root/public_api" ], - "@spartacus/checkout": [ - "feature-libs/checkout/public_api" - ], + "@spartacus/checkout": ["feature-libs/checkout/public_api"], "@spartacus/checkout/scheduled-replenishment/assets": [ "feature-libs/checkout/scheduled-replenishment/assets/public_api" ], @@ -213,24 +170,14 @@ "@spartacus/customer-ticketing/root": [ "feature-libs/customer-ticketing/root/public_api" ], - "@spartacus/order/assets": [ - "feature-libs/order/assets/public_api" - ], + "@spartacus/order/assets": ["feature-libs/order/assets/public_api"], "@spartacus/order/components": [ "feature-libs/order/components/public_api" ], - "@spartacus/order/core": [ - "feature-libs/order/core/public_api" - ], - "@spartacus/order": [ - "feature-libs/order/public_api" - ], - "@spartacus/order/occ": [ - "feature-libs/order/occ/public_api" - ], - "@spartacus/order/root": [ - "feature-libs/order/root/public_api" - ], + "@spartacus/order/core": ["feature-libs/order/core/public_api"], + "@spartacus/order": ["feature-libs/order/public_api"], + "@spartacus/order/occ": ["feature-libs/order/occ/public_api"], + "@spartacus/order/root": ["feature-libs/order/root/public_api"], "@spartacus/organization/account-summary/assets": [ "feature-libs/organization/account-summary/assets/public_api" ], @@ -267,9 +214,7 @@ "@spartacus/organization/administration/root": [ "feature-libs/organization/administration/root/public_api" ], - "@spartacus/organization": [ - "feature-libs/organization/public_api" - ], + "@spartacus/organization": ["feature-libs/organization/public_api"], "@spartacus/organization/order-approval/assets": [ "feature-libs/organization/order-approval/assets/public_api" ], @@ -324,9 +269,7 @@ "@spartacus/pickup-in-store/core": [ "feature-libs/pickup-in-store/core/public_api" ], - "@spartacus/pickup-in-store": [ - "feature-libs/pickup-in-store/public_api" - ], + "@spartacus/pickup-in-store": ["feature-libs/pickup-in-store/public_api"], "@spartacus/pickup-in-store/occ": [ "feature-libs/pickup-in-store/occ/public_api" ], @@ -405,9 +348,7 @@ "@spartacus/product/image-zoom/root": [ "feature-libs/product/image-zoom/root/public_api" ], - "@spartacus/product": [ - "feature-libs/product/public_api" - ], + "@spartacus/product": ["feature-libs/product/public_api"], "@spartacus/product/variants/assets": [ "feature-libs/product/variants/assets/public_api" ], @@ -426,21 +367,26 @@ "@spartacus/qualtrics/components": [ "feature-libs/qualtrics/components/public_api" ], - "@spartacus/qualtrics": [ - "feature-libs/qualtrics/public_api" + "@spartacus/qualtrics": ["feature-libs/qualtrics/public_api"], + "@spartacus/qualtrics/root": ["feature-libs/qualtrics/root/public_api"], + "@spartacus/requested-delivery-date/assets": [ + "feature-libs/requested-delivery-date/assets/public_api" ], - "@spartacus/qualtrics/root": [ - "feature-libs/qualtrics/root/public_api" + "@spartacus/requested-delivery-date/core": [ + "feature-libs/requested-delivery-date/core/public_api" ], - "@spartacus/smartedit/core": [ - "feature-libs/smartedit/core/public_api" + "@spartacus/requested-delivery-date": [ + "feature-libs/requested-delivery-date/public_api" ], - "@spartacus/smartedit": [ - "feature-libs/smartedit/public_api" + "@spartacus/requested-delivery-date/occ": [ + "feature-libs/requested-delivery-date/occ/public_api" ], - "@spartacus/smartedit/root": [ - "feature-libs/smartedit/root/public_api" + "@spartacus/requested-delivery-date/root": [ + "feature-libs/requested-delivery-date/root/public_api" ], + "@spartacus/smartedit/core": ["feature-libs/smartedit/core/public_api"], + "@spartacus/smartedit": ["feature-libs/smartedit/public_api"], + "@spartacus/smartedit/root": ["feature-libs/smartedit/root/public_api"], "@spartacus/storefinder/assets": [ "feature-libs/storefinder/assets/public_api" ], @@ -450,18 +396,12 @@ "@spartacus/storefinder/core": [ "feature-libs/storefinder/core/public_api" ], - "@spartacus/storefinder": [ - "feature-libs/storefinder/public_api" - ], - "@spartacus/storefinder/occ": [ - "feature-libs/storefinder/occ/public_api" - ], + "@spartacus/storefinder": ["feature-libs/storefinder/public_api"], + "@spartacus/storefinder/occ": ["feature-libs/storefinder/occ/public_api"], "@spartacus/storefinder/root": [ "feature-libs/storefinder/root/public_api" ], - "@spartacus/tracking": [ - "feature-libs/tracking/public_api" - ], + "@spartacus/tracking": ["feature-libs/tracking/public_api"], "@spartacus/tracking/personalization/core": [ "feature-libs/tracking/personalization/core/public_api" ], @@ -480,9 +420,7 @@ "@spartacus/tracking/tms/gtm": [ "feature-libs/tracking/tms/gtm/public_api" ], - "@spartacus/tracking/tms": [ - "feature-libs/tracking/tms/public_api" - ], + "@spartacus/tracking/tms": ["feature-libs/tracking/tms/public_api"], "@spartacus/user/account/assets": [ "feature-libs/user/account/assets/public_api" ], @@ -492,18 +430,14 @@ "@spartacus/user/account/core": [ "feature-libs/user/account/core/public_api" ], - "@spartacus/user/account": [ - "feature-libs/user/account/public_api" - ], + "@spartacus/user/account": ["feature-libs/user/account/public_api"], "@spartacus/user/account/occ": [ "feature-libs/user/account/occ/public_api" ], "@spartacus/user/account/root": [ "feature-libs/user/account/root/public_api" ], - "@spartacus/user": [ - "feature-libs/user/public_api" - ], + "@spartacus/user": ["feature-libs/user/public_api"], "@spartacus/user/profile/assets": [ "feature-libs/user/profile/assets/public_api" ], @@ -513,45 +447,33 @@ "@spartacus/user/profile/core": [ "feature-libs/user/profile/core/public_api" ], - "@spartacus/user/profile": [ - "feature-libs/user/profile/public_api" - ], + "@spartacus/user/profile": ["feature-libs/user/profile/public_api"], "@spartacus/user/profile/occ": [ "feature-libs/user/profile/occ/public_api" ], "@spartacus/user/profile/root": [ "feature-libs/user/profile/root/public_api" ], - "@spartacus/cdc/assets": [ - "integration-libs/cdc/assets/public_api" - ], + "@spartacus/cdc/assets": ["integration-libs/cdc/assets/public_api"], "@spartacus/cdc/components": [ "integration-libs/cdc/components/public_api" ], - "@spartacus/cdc/core": [ - "integration-libs/cdc/core/public_api" - ], - "@spartacus/cdc": [ - "integration-libs/cdc/public_api" - ], + "@spartacus/cdc/core": ["integration-libs/cdc/core/public_api"], + "@spartacus/cdc": ["integration-libs/cdc/public_api"], "@spartacus/cdc/organization/administration": [ "integration-libs/cdc/organization/administration/public_api" ], "@spartacus/cdc/organization/user-registration": [ "integration-libs/cdc/organization/user-registration/public_api" ], - "@spartacus/cdc/root": [ - "integration-libs/cdc/root/public_api" - ], + "@spartacus/cdc/root": ["integration-libs/cdc/root/public_api"], "@spartacus/cdc/user-account": [ "integration-libs/cdc/user-account/public_api" ], "@spartacus/cdc/user-profile": [ "integration-libs/cdc/user-profile/public_api" ], - "@spartacus/cds": [ - "integration-libs/cds/public_api" - ], + "@spartacus/cds": ["integration-libs/cds/public_api"], "@spartacus/digital-payments/assets": [ "integration-libs/digital-payments/assets/public_api" ], @@ -576,37 +498,20 @@ "@spartacus/epd-visualization/root": [ "integration-libs/epd-visualization/root/public_api" ], - "@spartacus/s4om/assets": [ - "integration-libs/s4om/assets/public_api" - ], - "@spartacus/s4om": [ - "integration-libs/s4om/public_api" - ], - "@spartacus/s4om/root": [ - "integration-libs/s4om/root/public_api" - ], - "@spartacus/segment-refs": [ - "integration-libs/segment-refs/public_api" - ], + "@spartacus/s4om/assets": ["integration-libs/s4om/assets/public_api"], + "@spartacus/s4om": ["integration-libs/s4om/public_api"], + "@spartacus/s4om/root": ["integration-libs/s4om/root/public_api"], + "@spartacus/segment-refs": ["integration-libs/segment-refs/public_api"], "@spartacus/segment-refs/root": [ "integration-libs/segment-refs/root/public_api" ], - "@spartacus/assets": [ - "projects/assets/src/public_api" - ], - "@spartacus/core": [ - "projects/core/public_api" - ], - "@spartacus/storefront": [ - "projects/storefrontlib/public_api" - ] + "@spartacus/assets": ["projects/assets/src/public_api"], + "@spartacus/core": ["projects/core/public_api"], + "@spartacus/storefront": ["projects/storefrontlib/public_api"] }, "useDefineForClassFields": false }, - "exclude": [ - "./dist", - "./projects/storefrontapp-e2e-cypress" - ], + "exclude": ["./dist", "./projects/storefrontapp-e2e-cypress"], "angularCompilerOptions": { "skipTemplateCodegen": true, "strictMetadataEmit": true, @@ -616,4 +521,4 @@ "strictTemplates": true, "strictInputAccessModifiers": true } -} \ No newline at end of file +}