-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support for configurable products via Tacton CPQ integration (#329
) see https://github.com/intershop/intershop-pwa/blob/develop/docs/guides/tacton-product-configuration.md Co-authored-by: Silke Grueber <SGrueber@intershop.com> Co-authored-by: Susanne Schneider <s.schneider@intershop.de>
- Loading branch information
1 parent
2ae504e
commit 2a60f9d
Showing
108 changed files
with
3,745 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!-- | ||
kb_guide | ||
kb_pwa | ||
kb_everyone | ||
kb_sync_latest_only | ||
--> | ||
|
||
# Extended Product Configurations with Tacton | ||
|
||
We integrated [Tacton CPQ](https://www.tacton.com/solutions/tacton-cpq) for handling complex product configuration scenarios. | ||
|
||
The PWA uses the self-service API to interactively configure a product and submit a firm proposal to Tacton CPQ. | ||
|
||
## Setup | ||
|
||
First, activate the feature toggle `tacton`. | ||
You will also have to provide an endpoint and mapping configuration. | ||
This can be done by defining it in [Angular CLI environment](../concepts/configuration.md#angular-cli-environments) files: | ||
|
||
```typescript | ||
export const environment: Environment = { | ||
...ENVIRONMENT_DEFAULTS, | ||
|
||
tacton: { | ||
selfService: { | ||
endPoint: '<tacton-endpoint>', // without '/self-service-api' | ||
apiKey: '<self-service API key>' | ||
}, | ||
productMappings: { | ||
'<ICM-SKU>': '<tab-category>/<tacton-product-id>', | ||
... | ||
} | ||
}, | ||
}; | ||
``` | ||
|
||
This configuration can also be supplied via environment variable `TACTON` as stringified JSON: | ||
|
||
```text | ||
TACTON='{ "selfService": { "endPoint": "<tacton-endpoint>", "apiKey": "<self-service API key>" }, "productMappings": { "<ICM-SKU>": "<tab-category>/<tacton-product-id>", ... } }'; | ||
``` | ||
|
||
## Product Mappings | ||
|
||
Currently we only support product mappings via configuration. | ||
In the future we will consider supporting specific custom attributes configurable via ICM back office. | ||
|
||
## Workflow | ||
|
||
When encountering a configurable product, the PWA directs to the configuration page, where the product can be composed. | ||
The PWA supports committing and un-committing various parameters with available UI elements. | ||
When encountering configuration conflicts, the user is queried for accepting a given conflict resolution or discarding the last changes. | ||
Upon completing the last step, the user can submit the configuration. | ||
This creates a cart with required user attributes on the Tacton CPQ side and submits a Firm Proposal. | ||
|
||
## Further References | ||
|
||
- [Concept - Configuration](../concepts/configuration.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/app/extensions/tacton/directives/is-tacton-product.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { ChangeDetectorRef, Directive, Input, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core'; | ||
import { ReplaySubject, Subject } from 'rxjs'; | ||
import { map, switchMap, takeUntil } from 'rxjs/operators'; | ||
|
||
import { ProductView } from 'ish-core/models/product-view/product-view.model'; | ||
|
||
import { TactonFacade } from '../facades/tacton.facade'; | ||
|
||
@Directive({ | ||
selector: '[ishIsTactonProduct]', | ||
}) | ||
export class IsTactonProductDirective implements OnDestroy { | ||
private otherTemplateRef: TemplateRef<unknown>; | ||
private sku$ = new ReplaySubject<string>(1); | ||
private trigger$ = new Subject<void>(); | ||
|
||
private destroy$ = new Subject(); | ||
|
||
constructor( | ||
private templateRef: TemplateRef<unknown>, | ||
private viewContainer: ViewContainerRef, | ||
private cdRef: ChangeDetectorRef, | ||
tactonFacade: TactonFacade | ||
) { | ||
this.trigger$ | ||
.pipe( | ||
switchMap(() => tactonFacade.getTactonProductForSKU$(this.sku$).pipe(map(x => !!x))), | ||
takeUntil(this.destroy$) | ||
) | ||
.subscribe(exists => this.updateView(exists)); | ||
} | ||
|
||
@Input() set ishIsTactonProduct(product: ProductView) { | ||
this.sku$.next(product?.sku); | ||
this.trigger$.next(); | ||
} | ||
|
||
@Input() set ishIsTactonProductElse(otherTemplateRef: TemplateRef<unknown>) { | ||
this.otherTemplateRef = otherTemplateRef; | ||
this.trigger$.next(); | ||
} | ||
|
||
private updateView(exists: boolean) { | ||
this.viewContainer.clear(); | ||
if (exists) { | ||
this.viewContainer.createEmbeddedView(this.templateRef); | ||
} else if (this.otherTemplateRef) { | ||
this.viewContainer.createEmbeddedView(this.otherTemplateRef); | ||
} | ||
this.cdRef.markForCheck(); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.destroy$.next(); | ||
this.destroy$.complete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*/**/*.* |
22 changes: 22 additions & 0 deletions
22
src/app/extensions/tacton/exports/tacton-exports.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { FeatureToggleModule } from 'ish-core/feature-toggle.module'; | ||
import { LAZY_FEATURE_MODULE } from 'ish-core/utils/module-loader/module-loader.service'; | ||
|
||
import { IsTactonProductDirective } from '../directives/is-tacton-product.directive'; | ||
|
||
import { LazyTactonConfigureProductComponent } from './lazy-tacton-configure-product/lazy-tacton-configure-product.component'; | ||
|
||
@NgModule({ | ||
imports: [FeatureToggleModule], | ||
providers: [ | ||
{ | ||
provide: LAZY_FEATURE_MODULE, | ||
useValue: { feature: 'tacton', location: import('../store/tacton-store.module') }, | ||
multi: true, | ||
}, | ||
], | ||
declarations: [IsTactonProductDirective, LazyTactonConfigureProductComponent], | ||
exports: [IsTactonProductDirective, LazyTactonConfigureProductComponent], | ||
}) | ||
export class TactonExportsModule {} |
Oops, something went wrong.