From 5e8fece1f97fe297e597509ee14d05f0fbee5465 Mon Sep 17 00:00:00 2001 From: Michal Dydo Date: Tue, 13 Apr 2021 07:58:31 +0200 Subject: [PATCH] GH-11818 fix for quick-order feature lib --- .../cart/quick-order/components/list/index.ts | 2 -- .../list/quick-order-list.component.html | 1 - .../list/quick-order-list.component.spec.ts | 22 -------------- .../list/quick-order-list.module.ts | 22 -------------- .../cart/quick-order/components/public_api.ts | 2 +- .../quick-order-components.module.ts | 3 +- .../quick-order/components/wrapper/index.ts | 2 ++ .../quick-order-wrapper.component.html | 1 + .../quick-order-wrapper.component.spec.ts | 22 ++++++++++++++ .../quick-order-wrapper.component.ts} | 6 ++-- .../wrapper/quick-order-wrapper.module.ts | 21 ++++++++++++++ .../features/quick-order-feature.module.ts | 29 +++++++++++++++++++ .../spartacus/spartacus-features.module.ts | 6 ++-- .../src/environments/environment.ts | 6 ++-- 14 files changed, 89 insertions(+), 56 deletions(-) delete mode 100644 feature-libs/cart/quick-order/components/list/index.ts delete mode 100644 feature-libs/cart/quick-order/components/list/quick-order-list.component.html delete mode 100644 feature-libs/cart/quick-order/components/list/quick-order-list.component.spec.ts delete mode 100644 feature-libs/cart/quick-order/components/list/quick-order-list.module.ts create mode 100644 feature-libs/cart/quick-order/components/wrapper/index.ts create mode 100644 feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.html create mode 100644 feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.spec.ts rename feature-libs/cart/quick-order/components/{list/quick-order-list.component.ts => wrapper/quick-order-wrapper.component.ts} (51%) create mode 100644 feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.module.ts create mode 100644 projects/storefrontapp/src/app/spartacus/features/quick-order-feature.module.ts diff --git a/feature-libs/cart/quick-order/components/list/index.ts b/feature-libs/cart/quick-order/components/list/index.ts deleted file mode 100644 index ab6d3e47c9c..00000000000 --- a/feature-libs/cart/quick-order/components/list/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './quick-order-list.component'; -export * from './quick-order-list.module'; diff --git a/feature-libs/cart/quick-order/components/list/quick-order-list.component.html b/feature-libs/cart/quick-order/components/list/quick-order-list.component.html deleted file mode 100644 index 8a6aa524927..00000000000 --- a/feature-libs/cart/quick-order/components/list/quick-order-list.component.html +++ /dev/null @@ -1 +0,0 @@ -Quick Order List Component diff --git a/feature-libs/cart/quick-order/components/list/quick-order-list.component.spec.ts b/feature-libs/cart/quick-order/components/list/quick-order-list.component.spec.ts deleted file mode 100644 index f3053750578..00000000000 --- a/feature-libs/cart/quick-order/components/list/quick-order-list.component.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { QuickOrderListComponent } from './quick-order-list.component'; - -describe('QuickOrderListComponent', () => { - let component: QuickOrderListComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [QuickOrderListComponent], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(QuickOrderListComponent); - component = fixture.componentInstance; - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/feature-libs/cart/quick-order/components/list/quick-order-list.module.ts b/feature-libs/cart/quick-order/components/list/quick-order-list.module.ts deleted file mode 100644 index 713723486a6..00000000000 --- a/feature-libs/cart/quick-order/components/list/quick-order-list.module.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { AuthGuard, CmsConfig, provideDefaultConfig } from '@spartacus/core'; -import { QuickOrderListComponent } from './quick-order-list.component'; - -@NgModule({ - imports: [CommonModule], - providers: [ - provideDefaultConfig({ - cmsComponents: { - AccountQuickOrderComponent: { - component: QuickOrderListComponent, - guards: [AuthGuard], - }, - }, - }), - ], - declarations: [QuickOrderListComponent], - exports: [QuickOrderListComponent], - entryComponents: [QuickOrderListComponent], -}) -export class QuickOrderListModule {} diff --git a/feature-libs/cart/quick-order/components/public_api.ts b/feature-libs/cart/quick-order/components/public_api.ts index ed026cac389..711e1fcad69 100644 --- a/feature-libs/cart/quick-order/components/public_api.ts +++ b/feature-libs/cart/quick-order/components/public_api.ts @@ -1,2 +1,2 @@ -export * from './list/index'; +export * from './wrapper/index'; export * from './quick-order-components.module'; diff --git a/feature-libs/cart/quick-order/components/quick-order-components.module.ts b/feature-libs/cart/quick-order/components/quick-order-components.module.ts index d9dc2cb2a18..95cc76b090c 100644 --- a/feature-libs/cart/quick-order/components/quick-order-components.module.ts +++ b/feature-libs/cart/quick-order/components/quick-order-components.module.ts @@ -1,7 +1,8 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; +import { QuickOrderWrapperModule } from './wrapper/quick-order-wrapper.module'; @NgModule({ - imports: [RouterModule], + imports: [RouterModule, QuickOrderWrapperModule], }) export class QuickOrderComponentsModule {} diff --git a/feature-libs/cart/quick-order/components/wrapper/index.ts b/feature-libs/cart/quick-order/components/wrapper/index.ts new file mode 100644 index 00000000000..0f2415d4f82 --- /dev/null +++ b/feature-libs/cart/quick-order/components/wrapper/index.ts @@ -0,0 +1,2 @@ +export * from './quick-order-wrapper.component'; +export * from './quick-order-wrapper.module'; diff --git a/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.html b/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.html new file mode 100644 index 00000000000..84613311b9d --- /dev/null +++ b/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.html @@ -0,0 +1 @@ +Quick Order Wrapper Component diff --git a/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.spec.ts b/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.spec.ts new file mode 100644 index 00000000000..487d94da703 --- /dev/null +++ b/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { QuickOrderComponent } from './quick-order-wrapper.component'; + +describe('QuickOrderComponent', () => { + let component: QuickOrderComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [QuickOrderComponent], + }).compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(QuickOrderComponent); + component = fixture.componentInstance; + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/feature-libs/cart/quick-order/components/list/quick-order-list.component.ts b/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.ts similarity index 51% rename from feature-libs/cart/quick-order/components/list/quick-order-list.component.ts rename to feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.ts index 2b7caa19c56..ba968d4871e 100644 --- a/feature-libs/cart/quick-order/components/list/quick-order-list.component.ts +++ b/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.component.ts @@ -1,8 +1,8 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; @Component({ - selector: 'cx-quick-order-list', - templateUrl: './quick-order-list.component.html', + selector: 'cx-quick-order-wrapper', + templateUrl: './quick-order-wrapper.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) -export class QuickOrderListComponent {} +export class QuickOrderComponent {} diff --git a/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.module.ts b/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.module.ts new file mode 100644 index 00000000000..c1a47fc1f12 --- /dev/null +++ b/feature-libs/cart/quick-order/components/wrapper/quick-order-wrapper.module.ts @@ -0,0 +1,21 @@ +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { CmsConfig, provideDefaultConfig } from '@spartacus/core'; +import { QuickOrderComponent } from './quick-order-wrapper.component'; + +@NgModule({ + imports: [CommonModule], + providers: [ + provideDefaultConfig({ + cmsComponents: { + QuickOrderComponent: { + component: QuickOrderComponent, + }, + }, + }), + ], + declarations: [QuickOrderComponent], + exports: [QuickOrderComponent], + entryComponents: [QuickOrderComponent], +}) +export class QuickOrderWrapperModule {} diff --git a/projects/storefrontapp/src/app/spartacus/features/quick-order-feature.module.ts b/projects/storefrontapp/src/app/spartacus/features/quick-order-feature.module.ts new file mode 100644 index 00000000000..9738aba1776 --- /dev/null +++ b/projects/storefrontapp/src/app/spartacus/features/quick-order-feature.module.ts @@ -0,0 +1,29 @@ +import { NgModule } from '@angular/core'; +import { + quickOrderTranslationChunksConfig, + quickOrderTranslations, +} from '@spartacus/cart/quick-order/assets'; +import { QuickOrderRootModule } from '@spartacus/cart/quick-order/root'; +import { provideConfig } from '@spartacus/core'; + +@NgModule({ + imports: [QuickOrderRootModule], + providers: [ + provideConfig({ + featureModules: { + cartQuickOrder: { + module: () => + import('@spartacus/cart/quick-order').then( + (m) => m.QuickOrderModule + ), + }, + }, + i18n: { + resources: quickOrderTranslations, + chunks: quickOrderTranslationChunksConfig, + fallbackLang: 'en', + }, + }), + ], +}) +export class QuickOrderFeatureModule {} diff --git a/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts b/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts index a456d9df09c..9717c159581 100644 --- a/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts +++ b/projects/storefrontapp/src/app/spartacus/spartacus-features.module.ts @@ -76,6 +76,7 @@ import { CdcFeatureModule } from './features/cdc-feature.module'; import { CdsFeatureModule } from './features/cds-feature.module'; import { OrderApprovalFeatureModule } from './features/order-approval-feature.module'; import { QualtricsFeatureModule } from './features/qualtrics-feature.module'; +import { QuickOrderFeatureModule } from './features/quick-order-feature.module'; import { SavedCartFeatureModule } from './features/saved-cart-feature.module'; import { SmartEditFeatureModule } from './features/smartedit-feature.module'; import { StorefinderFeatureModule } from './features/storefinder-feature.module'; @@ -88,9 +89,10 @@ const featureModules = []; if (environment.b2b) { featureModules.push( AdministrationFeatureModule, + BulkPricingFeatureModule, OrderApprovalFeatureModule, - SavedCartFeatureModule, - BulkPricingFeatureModule + QuickOrderFeatureModule, + SavedCartFeatureModule ); } if (environment.cdc) { diff --git a/projects/storefrontapp/src/environments/environment.ts b/projects/storefrontapp/src/environments/environment.ts index 92ec400f2dc..effd7c3b694 100644 --- a/projects/storefrontapp/src/environments/environment.ts +++ b/projects/storefrontapp/src/environments/environment.ts @@ -15,9 +15,11 @@ import { Environment } from './models/environment.model'; export const environment: Environment = { production: false, - occBaseUrl: buildProcess.env.CX_BASE_URL, + occBaseUrl: 'https://spartacus-dev4.eastus.cloudapp.azure.com:9002/', + // occBaseUrl: buildProcess.env.CX_BASE_URL, occApiPrefix: '/occ/v2/', cds: buildProcess.env.CX_CDS ?? false, - b2b: buildProcess.env.CX_B2B ?? false, + // b2b: buildProcess.env.CX_B2B ?? false, + b2b: true, cdc: buildProcess.env.CX_CDC ?? false, };