@daffodil/product-composite 0.58.10 → 0.59.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/driver/in-memory/package.json +1 -10
  2. package/driver/magento/package.json +1 -10
  3. package/driver/magento/testing/package.json +1 -10
  4. package/driver/testing/package.json +1 -10
  5. package/esm2020/helpers/build-selection-payload.mjs +10 -0
  6. package/esm2020/helpers/public_api.mjs +2 -0
  7. package/esm2020/models/public_api.mjs +5 -0
  8. package/esm2020/models/selection-payload.type.mjs +2 -0
  9. package/esm2020/public_api.mjs +3 -4
  10. package/esm2020/routing/config/default.mjs +8 -0
  11. package/esm2020/routing/config/interface.mjs +2 -0
  12. package/esm2020/routing/config/public_api.mjs +3 -0
  13. package/esm2020/routing/config/token.mjs +22 -0
  14. package/esm2020/routing/daffodil-product-composite-routing.mjs +5 -0
  15. package/esm2020/routing/effects/product-page.effects.mjs +67 -0
  16. package/esm2020/routing/effects/public_api.mjs +2 -0
  17. package/esm2020/routing/index.mjs +2 -0
  18. package/esm2020/routing/module.mjs +43 -0
  19. package/esm2020/routing/public_api.mjs +4 -0
  20. package/esm2020/routing/services/query-param.service.mjs +28 -0
  21. package/esm2020/state/actions/composite-product.actions.mjs +1 -1
  22. package/esm2020/testing/factories/composite-product-item-option.factory.mjs +32 -0
  23. package/esm2020/testing/factories/composite-product-item.factory.mjs +45 -0
  24. package/esm2020/testing/factories/composite-product.factory.mjs +11 -103
  25. package/esm2020/testing/factories/public_api.mjs +3 -1
  26. package/fesm2015/daffodil-product-composite-routing.mjs +158 -0
  27. package/fesm2015/daffodil-product-composite-routing.mjs.map +1 -0
  28. package/fesm2015/daffodil-product-composite-state.mjs.map +1 -1
  29. package/fesm2015/daffodil-product-composite-testing.mjs +76 -103
  30. package/fesm2015/daffodil-product-composite-testing.mjs.map +1 -1
  31. package/fesm2015/daffodil-product-composite.mjs +11 -1
  32. package/fesm2015/daffodil-product-composite.mjs.map +1 -1
  33. package/fesm2020/daffodil-product-composite-routing.mjs +159 -0
  34. package/fesm2020/daffodil-product-composite-routing.mjs.map +1 -0
  35. package/fesm2020/daffodil-product-composite-state.mjs.map +1 -1
  36. package/fesm2020/daffodil-product-composite-testing.mjs +76 -103
  37. package/fesm2020/daffodil-product-composite-testing.mjs.map +1 -1
  38. package/fesm2020/daffodil-product-composite.mjs +11 -1
  39. package/fesm2020/daffodil-product-composite.mjs.map +1 -1
  40. package/helpers/build-selection-payload.d.ts +2 -0
  41. package/helpers/public_api.d.ts +1 -0
  42. package/models/public_api.d.ts +4 -0
  43. package/models/selection-payload.type.d.ts +5 -0
  44. package/package.json +1 -124
  45. package/public_api.d.ts +2 -3
  46. package/routing/config/default.d.ts +6 -0
  47. package/routing/config/interface.d.ts +20 -0
  48. package/routing/config/public_api.d.ts +3 -0
  49. package/routing/config/token.d.ts +10 -0
  50. package/routing/daffodil-product-composite-routing.d.ts +5 -0
  51. package/routing/effects/product-page.effects.d.ts +22 -0
  52. package/routing/effects/public_api.d.ts +1 -0
  53. package/routing/index.d.ts +1 -0
  54. package/routing/module.d.ts +10 -0
  55. package/routing/package.json +1 -0
  56. package/routing/public_api.d.ts +3 -0
  57. package/routing/services/query-param.service.d.ts +13 -0
  58. package/state/actions/composite-product.actions.d.ts +1 -1
  59. package/state/package.json +1 -10
  60. package/state/testing/package.json +1 -10
  61. package/testing/factories/composite-product-item-option.factory.d.ts +19 -0
  62. package/testing/factories/composite-product-item.factory.d.ts +25 -0
  63. package/testing/factories/composite-product.factory.d.ts +6 -29
  64. package/testing/factories/public_api.d.ts +2 -0
  65. package/testing/package.json +1 -10
@@ -0,0 +1,159 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, Injectable, Inject, NgModule } from '@angular/core';
3
+ import { DaffBase64ServiceToken } from '@daffodil/core';
4
+ import * as i1 from '@ngrx/effects';
5
+ import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
6
+ import { EMPTY, of } from 'rxjs';
7
+ import { switchMap } from 'rxjs/operators';
8
+ import { DaffProductTypeEnum } from '@daffodil/product';
9
+ import { DaffCompositeProductApplyOption } from '@daffodil/product-composite/state';
10
+ import { DaffProductPageActionTypes } from '@daffodil/product/state';
11
+ import { DOCUMENT } from '@angular/common';
12
+
13
+ /**
14
+ * The default configuration for the {@link DaffProductCompositeRoutingConfig}.
15
+ */
16
+ const daffProductCompositeRoutingConfigDefaultFactory = (base64) => ({
17
+ compositeSelectionQueryParam: 'composite_selection',
18
+ compositeSelectionQueryParamDecode: (queryParam) => JSON.parse(base64.decode(queryParam)),
19
+ });
20
+
21
+ /**
22
+ * The token used to provide @daffodil/product-composite/routing config data.
23
+ */
24
+ const DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG = new InjectionToken('DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG', {
25
+ factory: () => daffProductCompositeRoutingConfigDefaultFactory(inject(DaffBase64ServiceToken)),
26
+ });
27
+ /**
28
+ * Provides the {@link DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG} token.
29
+ */
30
+ function daffProductCompositeRoutingProvideConfig(config) {
31
+ return {
32
+ provide: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,
33
+ useFactory: () => ({
34
+ ...daffProductCompositeRoutingConfigDefaultFactory(inject(DaffBase64ServiceToken)),
35
+ ...config,
36
+ }),
37
+ };
38
+ }
39
+
40
+ class DaffProductCompositeQueryParamService {
41
+ constructor(document, config) {
42
+ this.document = document;
43
+ this.config = config;
44
+ }
45
+ /**
46
+ * Get the value of the configured composite selection query param.
47
+ */
48
+ get() {
49
+ return (new URL(this.document.location.toString())).searchParams.get(this.config.compositeSelectionQueryParam);
50
+ }
51
+ }
52
+ /** @nocollapse */ DaffProductCompositeQueryParamService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositeQueryParamService, deps: [{ token: DOCUMENT }, { token: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
53
+ /** @nocollapse */ DaffProductCompositeQueryParamService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositeQueryParamService });
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositeQueryParamService, decorators: [{
55
+ type: Injectable
56
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
57
+ type: Inject,
58
+ args: [DOCUMENT]
59
+ }] }, { type: undefined, decorators: [{
60
+ type: Inject,
61
+ args: [DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG]
62
+ }] }]; } });
63
+
64
+ /**
65
+ * Builds the apply actions from the list of selected options.
66
+ */
67
+ function buildApplyActions(product, itemId, selectedOptions) {
68
+ const selectionItem = product.items.find(({ id }) => id === itemId);
69
+ return selectionItem
70
+ ? selectedOptions.map(selectionOptionId => {
71
+ // use the quantity of the referenced option
72
+ const qty = selectionItem?.options.find(({ id }) => id === selectionOptionId)?.quantity;
73
+ return new DaffCompositeProductApplyOption(product.id, itemId, selectionOptionId, qty);
74
+ })
75
+ : [];
76
+ }
77
+ /**
78
+ * Handles composite product specific actions for the product page.
79
+ */
80
+ class DaffProductCompositePageEffects {
81
+ constructor(actions$, paramGetter, config) {
82
+ this.actions$ = actions$;
83
+ this.paramGetter = paramGetter;
84
+ this.config = config;
85
+ /**
86
+ * Applies composite item options based on the value of the configured query param.
87
+ */
88
+ this.preselectCompositeOptions$ = createEffect(() => this.actions$.pipe(ofType(DaffProductPageActionTypes.ProductPageLoadSuccessAction), switchMap((action) => {
89
+ const queryParam = this.paramGetter.get();
90
+ // get the product corresponding to the current product page
91
+ const product = action.payload.products.filter(({ id }) => id === action.payload.id)[0];
92
+ // if we don't have a query param set or if the product isn't composite,
93
+ // we have nothing to do
94
+ if (!queryParam || product?.type !== DaffProductTypeEnum.Composite) {
95
+ return EMPTY;
96
+ }
97
+ let selection;
98
+ try {
99
+ selection = this.config.compositeSelectionQueryParamDecode(queryParam, product);
100
+ }
101
+ catch (error) {
102
+ return EMPTY;
103
+ }
104
+ const applyActions = Object.keys(selection).reduce((actions, itemId) => actions.concat(buildApplyActions(product, itemId, selection[itemId])), []);
105
+ // dispatch each of the apply actions into the action stream
106
+ return of(...applyActions);
107
+ })));
108
+ }
109
+ }
110
+ /** @nocollapse */ DaffProductCompositePageEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositePageEffects, deps: [{ token: i1.Actions }, { token: DaffProductCompositeQueryParamService }, { token: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
111
+ /** @nocollapse */ DaffProductCompositePageEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositePageEffects });
112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositePageEffects, decorators: [{
113
+ type: Injectable
114
+ }], ctorParameters: function () { return [{ type: i1.Actions }, { type: DaffProductCompositeQueryParamService }, { type: undefined, decorators: [{
115
+ type: Inject,
116
+ args: [DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG]
117
+ }] }]; } });
118
+
119
+ class DaffProductCompositeRoutingModule {
120
+ static withConfig(config) {
121
+ return {
122
+ ngModule: DaffProductCompositeRoutingModule,
123
+ providers: [
124
+ {
125
+ provide: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,
126
+ useFactory: () => ({
127
+ ...daffProductCompositeRoutingConfigDefaultFactory(inject(DaffBase64ServiceToken)),
128
+ ...config || {},
129
+ }),
130
+ },
131
+ ],
132
+ };
133
+ }
134
+ }
135
+ /** @nocollapse */ DaffProductCompositeRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositeRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
136
+ /** @nocollapse */ DaffProductCompositeRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositeRoutingModule, imports: [i1.EffectsFeatureModule] });
137
+ /** @nocollapse */ DaffProductCompositeRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositeRoutingModule, providers: [
138
+ DaffProductCompositeQueryParamService,
139
+ ], imports: [[
140
+ EffectsModule.forFeature([DaffProductCompositePageEffects]),
141
+ ]] });
142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffProductCompositeRoutingModule, decorators: [{
143
+ type: NgModule,
144
+ args: [{
145
+ imports: [
146
+ EffectsModule.forFeature([DaffProductCompositePageEffects]),
147
+ ],
148
+ providers: [
149
+ DaffProductCompositeQueryParamService,
150
+ ],
151
+ }]
152
+ }] });
153
+
154
+ /**
155
+ * Generated bundle index. Do not edit.
156
+ */
157
+
158
+ export { DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG, DaffProductCompositePageEffects, DaffProductCompositeRoutingModule, daffProductCompositeRoutingConfigDefaultFactory, daffProductCompositeRoutingProvideConfig };
159
+ //# sourceMappingURL=daffodil-product-composite-routing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-product-composite-routing.mjs","sources":["../../../libs/product-composite/routing/src/config/default.ts","../../../libs/product-composite/routing/src/config/token.ts","../../../libs/product-composite/routing/src/services/query-param.service.ts","../../../libs/product-composite/routing/src/effects/product-page.effects.ts","../../../libs/product-composite/routing/src/module.ts","../../../libs/product-composite/routing/src/daffodil-product-composite-routing.ts"],"sourcesContent":["import { DaffBase64Service } from '@daffodil/core';\n\nimport { DaffProductCompositeRoutingConfig } from './interface';\n\n/**\n * The default configuration for the {@link DaffProductCompositeRoutingConfig}.\n */\nexport const daffProductCompositeRoutingConfigDefaultFactory = (base64: DaffBase64Service): DaffProductCompositeRoutingConfig => ({\n compositeSelectionQueryParam: 'composite_selection',\n compositeSelectionQueryParamDecode: (queryParam: string) => JSON.parse(base64.decode(queryParam)),\n});\n","import {\n FactoryProvider,\n inject,\n InjectionToken,\n} from '@angular/core';\n\nimport { DaffBase64ServiceToken } from '@daffodil/core';\n\nimport { daffProductCompositeRoutingConfigDefaultFactory } from './default';\nimport { DaffProductCompositeRoutingConfig } from './interface';\n\n/**\n * The token used to provide @daffodil/product-composite/routing config data.\n */\nexport const DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG = new InjectionToken<DaffProductCompositeRoutingConfig>('DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG', {\n factory: () => daffProductCompositeRoutingConfigDefaultFactory(inject(DaffBase64ServiceToken)),\n});\n\n/**\n * Provides the {@link DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG} token.\n */\nexport function daffProductCompositeRoutingProvideConfig(config: Partial<DaffProductCompositeRoutingConfig>): FactoryProvider {\n return {\n provide: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n useFactory: () => ({\n ...daffProductCompositeRoutingConfigDefaultFactory(inject(DaffBase64ServiceToken)),\n ...config,\n }),\n };\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n Inject,\n Injectable,\n} from '@angular/core';\n\nimport {\n DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n DaffProductCompositeRoutingConfig,\n} from '../config/public_api';\n\n@Injectable()\nexport class DaffProductCompositeQueryParamService {\n\n constructor(\n @Inject(DOCUMENT) private document: any,\n @Inject(DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG) private config: DaffProductCompositeRoutingConfig) {\n }\n\n /**\n * Get the value of the configured composite selection query param.\n */\n public get(): string {\n return (\n new URL((<any>this.document).location.toString())\n ).searchParams.get(this.config.compositeSelectionQueryParam);\n }\n}\n","import {\n DOCUMENT,\n Location,\n} from '@angular/common';\nimport {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport {\n Actions,\n Effect,\n createEffect,\n ofType,\n} from '@ngrx/effects';\nimport {\n EMPTY,\n Observable,\n of,\n} from 'rxjs';\nimport {\n map,\n switchMap,\n} from 'rxjs/operators';\n\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n} from '@daffodil/product';\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n DaffProductCompositeSelectionPayload,\n} from '@daffodil/product-composite';\nimport { DaffCompositeProductApplyOption } from '@daffodil/product-composite/state';\nimport {\n DaffProductPageActionTypes,\n DaffProductPageLoadSuccess,\n} from '@daffodil/product/state';\n\nimport {\n DaffProductCompositeRoutingConfig,\n DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n} from '../config/public_api';\nimport { DaffProductCompositeQueryParamService } from '../services/query-param.service';\n\n/**\n * Builds the apply actions from the list of selected options.\n */\nfunction buildApplyActions<T extends DaffCompositeProduct = DaffCompositeProduct>(product: DaffCompositeProduct, itemId: DaffCompositeProductItem['id'], selectedOptions: DaffCompositeProductItemOption['id'][]): DaffCompositeProductApplyOption<T>[] {\n const selectionItem = product.items.find(({ id }) => id === itemId);\n\n return selectionItem\n ? selectedOptions.map(selectionOptionId => {\n // use the quantity of the referenced option\n const qty = selectionItem?.options.find(({ id }) => id === selectionOptionId)?.quantity;\n\n return new DaffCompositeProductApplyOption(product.id, itemId, selectionOptionId, qty);\n })\n : [];\n}\n\n/**\n * Handles composite product specific actions for the product page.\n */\n@Injectable()\nexport class DaffProductCompositePageEffects<T extends DaffCompositeProduct = DaffCompositeProduct> {\n constructor(\n private actions$: Actions,\n private paramGetter: DaffProductCompositeQueryParamService,\n @Inject(DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG) private config: DaffProductCompositeRoutingConfig,\n ) {}\n\n /**\n * Applies composite item options based on the value of the configured query param.\n */\n preselectCompositeOptions$: Observable<typeof EMPTY | DaffCompositeProductApplyOption<T>> = createEffect(() => this.actions$.pipe(\n ofType(DaffProductPageActionTypes.ProductPageLoadSuccessAction),\n switchMap((action: DaffProductPageLoadSuccess<T>) => {\n const queryParam = this.paramGetter.get();\n\n // get the product corresponding to the current product page\n const product: DaffCompositeProduct = action.payload.products.filter(({ id }) => id === action.payload.id)[0];\n\n // if we don't have a query param set or if the product isn't composite,\n // we have nothing to do\n if (!queryParam || product?.type !== DaffProductTypeEnum.Composite) {\n return EMPTY;\n }\n\n let selection: DaffProductCompositeSelectionPayload;\n\n try {\n selection = this.config.compositeSelectionQueryParamDecode(queryParam, product);\n } catch (error) {\n return EMPTY;\n }\n\n const applyActions = Object.keys(selection).reduce<DaffCompositeProductApplyOption<T>[]>(\n (actions, itemId) => actions.concat(buildApplyActions(product, itemId, selection[itemId])),\n [],\n );\n\n // dispatch each of the apply actions into the action stream\n return of(...applyActions);\n }),\n ));\n}\n","import {\n inject,\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\n\nimport { DaffBase64ServiceToken } from '@daffodil/core';\n\nimport {\n DaffProductCompositeRoutingConfig,\n daffProductCompositeRoutingConfigDefaultFactory,\n DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n} from './config/public_api';\nimport { DaffProductCompositePageEffects } from './effects/public_api';\nimport { DaffProductCompositeQueryParamService } from './services/query-param.service';\n\n@NgModule({\n imports: [\n EffectsModule.forFeature([DaffProductCompositePageEffects]),\n ],\n providers: [\n DaffProductCompositeQueryParamService,\n ],\n})\nexport class DaffProductCompositeRoutingModule {\n static withConfig(config?: DaffProductCompositeRoutingConfig): ModuleWithProviders<DaffProductCompositeRoutingModule> {\n return {\n ngModule: DaffProductCompositeRoutingModule,\n providers: [\n {\n provide: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n useFactory: () => ({\n ...daffProductCompositeRoutingConfigDefaultFactory(inject(DaffBase64ServiceToken)),\n ...config || {},\n }),\n },\n ],\n };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pC,iCAAiC,CAAA;IAC5C,OAAO,UAAU,CAAC,MAA0C,EAAA;QAC1D,OAAO;AACL,YAAA,QAAQ,EAAE,iCAAiC;AAC3C,YAAA,SAAS,EAAE;AACT,gBAAA;AACE,oBAAA,OAAO,EAAE,qCAAqC;AAC9C,oBAAA,UAAU,EAAE,OAAO;AACjB,wBAAA,GAAG,+CAA+C,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;wBAClF,GAAG,MAAM,IAAI,EAAE;qBAChB,CAAC;AACH,iBAAA;AACF,aAAA;SACF,CAAC;KACH;;iJAdU,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kJAAjC,iCAAiC,EAAA,OAAA,EAAA,CAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,CAAA,CAAA;AAAjC,mBAAA,iCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,EAJjC,SAAA,EAAA;QACT,qCAAqC;KACtC,EALQ,OAAA,EAAA,CAAA;AACP,YAAA,aAAa,CAAC,UAAU,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAC5D,SAAA,CAAA,EAAA,CAAA,CAAA;2FAKU,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAR7C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;AACP,wBAAA,aAAa,CAAC,UAAU,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAC5D,qBAAA;AACD,oBAAA,SAAS,EAAE;wBACT,qCAAqC;AACtC,qBAAA;AACF,iBAAA,CAAA;;;ACxBD;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-product-composite-state.mjs","sources":["../../../libs/product-composite/state/src/actions/composite-product.actions.ts","../../../libs/product-composite/state/src/reducers/composite-product-entities/composite-product-entities-reducer-adapter.ts","../../../libs/product-composite/state/src/reducers/composite-product-store-feature-key.ts","../../../libs/product-composite/state/src/selectors/feature.selector.ts","../../../libs/product-composite/state/src/selectors/composite-product-entities/composite-product-entities.selectors.ts","../../../libs/product-composite/state/src/selectors/composite-product/composite-product.selectors.ts","../../../libs/product-composite/state/src/selectors/all.selector.ts","../../../libs/product-composite/state/src/facades/composite-product/composite-product.facade.ts","../../../libs/product-composite/state/src/reducers/composite-product-entities/composite-product-entities.reducer.ts","../../../libs/product-composite/state/src/reducers/composite-product-reducers.ts","../../../libs/product-composite/state/src/reducers/injection-tokens/extra.token.ts","../../../libs/product-composite/state/src/helpers/ensure-items.ts","../../../libs/product-composite/state/src/reducers/ensure-items.meta-reducer.ts","../../../libs/product-composite/state/src/reducers/injection-tokens/reducers.token.ts","../../../libs/product-composite/state/src/composite-product-state.module.ts","../../../libs/product-composite/state/src/daffodil-product-composite-state.ts"],"sourcesContent":["import { Action } from '@ngrx/store';\n\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n} from '@daffodil/product-composite';\n\n/**\n * Action types for Composite Product Actions.\n */\nexport enum DaffCompositeProductActionTypes {\n CompositeProductApplyOptionAction = '[Composite Product] Composite Product Apply Option Action'\n}\n\n/**\n * Applies a product option to a particular composite product.\n *\n * @param id - Id of the Composite Product\n * @param itemId - Id of the product item.\n * @param optionId - Id of the option of the product item that is chosen.\n */\nexport class DaffCompositeProductApplyOption<T extends DaffCompositeProduct> implements Action {\n readonly type = DaffCompositeProductActionTypes.CompositeProductApplyOptionAction;\n\n constructor(public id: T['id'], public itemId: DaffCompositeProductItem['id'], public optionId: DaffCompositeProductItemOption['id'], public qty?: number) {}\n}\n\nexport type DaffCompositeProductActions<T extends DaffCompositeProduct = DaffCompositeProduct> =\n\t| DaffCompositeProductApplyOption<T>;\n","import {\n createEntityAdapter,\n EntityState,\n} from '@ngrx/entity';\nimport { defaultMemoize } from '@ngrx/store';\n\nimport { DaffProductTypeEnum } from '@daffodil/product';\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeConfigurationItem,\n DaffCompositeProductItemOption,\n} from '@daffodil/product-composite';\n\nimport { DaffCompositeProductEntity } from './composite-product-entity';\n\n/**\n * Composite Product Item Options Adapter for changing/overwriting entity state.\n */\nexport class DaffCompositeProductAppliedOptionsEntitiesAdapter<T extends EntityState<DaffCompositeProductEntity> = EntityState<DaffCompositeProductEntity>> {\n /**\n * @docs-private\n */\n private _adapter = createEntityAdapter<DaffCompositeProductEntity>();\n\n /**\n * Gets the initial entity state.\n */\n getInitialState() {\n return this._adapter.getInitialState();\n }\n\n /**\n * Get the entity selectors.\n */\n getSelectors() {\n return this._adapter.getSelectors();\n }\n\n /**\n * Upserts the given composite products into state.\n */\n upsertProducts(state: T, ...products: DaffCompositeProduct[]): T {\n return this._adapter.upsertMany(\n this.mapOptionsEntities(products),\n state,\n );\n };\n\n /**\n * Apply the specified option for the given composite product item.\n */\n applyOption(state: T, productId: DaffCompositeProduct['id'], itemId: DaffCompositeProductItem['id'], optionId: DaffCompositeProductItemOption['id'], qty?: number) {\n return this._adapter.upsertOne(\n {\n id: productId,\n items: {\n ...state.entities[productId].items,\n [itemId]: {\n value: optionId,\n qty: qty ?? 1,\n },\n },\n },\n state,\n );\n }\n\n /**\n * @docs-private\n */\n private mapOptionsEntities(products: DaffCompositeProduct[]): DaffCompositeProductEntity[] {\n return products.filter(product => product.type === DaffProductTypeEnum.Composite)\n .map(product => this.buildCompositeProductAppliedOptionsEntity(product));\n }\n\n /**\n * @docs-private\n */\n private buildCompositeProductAppliedOptionsEntity(product: DaffCompositeProduct): DaffCompositeProductEntity {\n return {\n id: product.id,\n items: product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: this.getDefaultOption(item),\n }), {}),\n };\n }\n\n /**\n * Sets the default item option to the specified default option if it is in stock.\n * Does not set a default option if a default is not specified.\n * Does not set a default option but does set a default qty if the default is out of stock.\n *\n * @param item a DaffCompositeProductItem\n * @docs-private\n */\n private getDefaultOption(item: DaffCompositeProductItem): DaffCompositeConfigurationItem {\n const defaultOptionIndex = item.options.findIndex(option => option.is_default);\n\n if(defaultOptionIndex > -1) {\n return {\n value: item.options[defaultOptionIndex].in_stock ? item.options[defaultOptionIndex].id : null,\n qty: item.options[defaultOptionIndex].quantity,\n };\n } else {\n return { value: null, qty: null };\n }\n }\n}\n\n/**\n * Gets the composite product entity adapter singleton.\n */\nexport const daffCompositeProductAppliedOptionsEntitiesAdapter: () => DaffCompositeProductAppliedOptionsEntitiesAdapter = defaultMemoize(() => new DaffCompositeProductAppliedOptionsEntitiesAdapter()).memoized;\n","export const DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY = 'daffCompositeProduct';\n","import {\n createFeatureSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffCompositeProductReducersState } from '../reducers/composite-product-reducers-state.interface';\nimport { DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY } from '../reducers/composite-product-store-feature-key';\n\n/**\n * An interface for the composite product feature state.\n */\nexport interface DaffCompositeProductFeatureMemoizedSelector {\n selectCompositeProductState: MemoizedSelector<Record<string, any>, DaffCompositeProductReducersState>;\n}\n\n/**\n * A function that returns a selector for the composite product feature state.\n */\nexport const getDaffCompositeProductFeatureSelector = (() => {\n let cache;\n return (): DaffCompositeProductFeatureMemoizedSelector => cache = cache\n ? cache\n : { selectCompositeProductState: createFeatureSelector<DaffCompositeProductReducersState>(DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY) };\n})();\n","import {\n EntityState,\n Dictionary,\n} from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n} from '@daffodil/product';\nimport {\n DaffCompositeProductItemOption,\n DaffCompositeProductItem,\n DaffCompositeProduct,\n} from '@daffodil/product-composite';\nimport { getDaffProductEntitiesSelectors } from '@daffodil/product/state';\n\nimport { daffCompositeProductAppliedOptionsEntitiesAdapter } from '../../reducers/composite-product-entities/composite-product-entities-reducer-adapter';\nimport { DaffCompositeProductEntity } from '../../reducers/composite-product-entities/composite-product-entity';\nimport {\n DaffCompositeProductReducersState,\n DaffCompositeProductStateRootSlice,\n} from '../../reducers/composite-product-reducers-state.interface';\nimport { getDaffCompositeProductFeatureSelector } from '../feature.selector';\n\n/**\n * An interface for selectors related to the composite product applied options.\n */\nexport interface DaffCompositeProductEntitiesMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n /**\n * The ngrx entities state for composite product applied options.\n */\n selectCompositeProductAppliedOptionsEntitiesState: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>>;\n /**\n * A selector for all composite product ids in state.\n */\n selectCompositeProductIds: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>['ids']>;\n /**\n * The ngrx entities for the composite product appllied options.\n */\n selectCompositeProductAppliedOptionsEntities: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>['entities']>;\n /**\n * The total number of composite products in state.\n */\n selectCompositeProductTotal: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;\n /**\n * Selects the applied options for a composite product.\n *\n * @param id the id of the composite product.\n */\n selectCompositeProductAppliedOptions: (id: T['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, Dictionary<DaffCompositeProductItemOption>>;\n /**\n * Selects whether the particular item of a composite product is required in order for the product to be valid, i.e. addable to the cart.\n *\n * @param id the id of the composite product.\n * @param item_id the id of the composite product item.\n */\n selectIsCompositeProductItemRequired: (id: T['id'], item_id: DaffCompositeProductItem['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, boolean>;\n}\n\nconst createCompositeProductAppliedOptionsEntitiesSelectors = <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors<T> => {\n const {\n selectCompositeProductState,\n } = getDaffCompositeProductFeatureSelector();\n const {\n selectProduct,\n } = getDaffProductEntitiesSelectors<T>();\n const adapterSelectors = daffCompositeProductAppliedOptionsEntitiesAdapter().getSelectors();\n\n const selectCompositeProductAppliedOptionsEntitiesState = createSelector(\n selectCompositeProductState,\n (state: DaffCompositeProductReducersState) => state.compositeProductOptions,\n );\n\n const selectCompositeProductIds = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectIds,\n );\n\n const selectCompositeProductAppliedOptionsEntities = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectEntities,\n );\n\n const selectCompositeProductTotal = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectTotal,\n );\n\n const selectCompositeProductAppliedOptions = defaultMemoize((id: T['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntitiesState,\n (product: T, appliedOptions) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n return (<DaffCompositeProduct><any>product).items.reduce((acc, item) => ({\n ...acc,\n [item.id]: appliedOptions.entities[product.id].items[item.id].value ? {\n ...item.options.find(option => option.id === appliedOptions.entities[product.id].items[item.id].value),\n quantity: appliedOptions.entities[product.id].items[item.id].qty,\n } : null,\n }), {});\n },\n )).memoized;\n\n const selectIsCompositeProductItemRequired = defaultMemoize((id: T['id'], item_id: DaffCompositeProductItem['id']) => createSelector(\n selectProduct(id),\n (product: T) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const productItem = (<DaffCompositeProduct><any>product).items.find(item => item.id === item_id);\n\n return productItem ? productItem.required : null;\n },\n )).memoized;\n\n\n return {\n selectCompositeProductAppliedOptionsEntitiesState,\n selectCompositeProductIds,\n selectCompositeProductAppliedOptionsEntities,\n selectCompositeProductTotal,\n selectCompositeProductAppliedOptions,\n selectIsCompositeProductItemRequired,\n };\n};\n\n/**\n * A function that returns all selectors related to composite product applied option entities.\n * Returns {@link DaffCompositeProductEntitiesMemoizedSelectors}.\n */\nexport const getDaffCompositeProductEntitiesSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors<T> => cache = cache\n ? cache\n : createCompositeProductAppliedOptionsEntitiesSelectors<T>();\n})();\n","import {\n Dictionary,\n EntityState,\n} from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n daffAdd,\n daffDivide,\n daffMultiply,\n daffSubtract,\n} from '@daffodil/core';\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n DaffProductPrices,\n DaffPriceRange,\n} from '@daffodil/product';\nimport {\n DaffCompositeProduct,\n DaffCompositeConfigurationItem,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n} from '@daffodil/product-composite';\nimport { getDaffProductEntitiesSelectors } from '@daffodil/product/state';\n\nimport { DaffCompositeProductStateRootSlice } from '../../reducers/composite-product-reducers-state.interface';\nimport { DaffCompositeProductEntity } from '../../reducers/public_api';\nimport { getDaffCompositeProductEntitiesSelectors } from '../composite-product-entities/composite-product-entities.selectors';\n\n/**\n * An interface describing selectors unique to the composite product, such as pricing and discounts.\n */\nexport interface DaffCompositeProductMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n /**\n * Get a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.\n */\n selectCompositeProductRequiredItemPricesForConfiguration: ( id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem> ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;\n /**\n * Get the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.\n */\n selectCompositeProductOptionalItemPricesForConfiguration: ( id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem> ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;\n /**\n * Get the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and\n * excluding unselected, optional item prices.\n */\n selectCompositeProductPricesAsCurrentlyConfigured: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;\n /**\n * Get the discount amount for a composite product. This value will be undefined if all required options are not chosen.\n */\n selectCompositeProductDiscountAmount: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;\n /**\n * Get the discount percent for a composite product. This value will be undefined if all required options are not chosen.\n * Note: this percent is computed client-side and should be treated as an estimate rather than an exact value.\n */\n selectCompositeProductDiscountPercent: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;\n}\n\nconst createCompositeProductSelectors = <T extends DaffProduct>(): DaffCompositeProductMemoizedSelectors<T> => {\n\n const {\n selectProduct,\n } = getDaffProductEntitiesSelectors<T>();\n\n const {\n selectCompositeProductAppliedOptionsEntities,\n } = getDaffCompositeProductEntitiesSelectors();\n\n const selectCompositeProductRequiredItemPricesForConfiguration = defaultMemoize((id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => createSelector(\n selectProduct(id),\n (product: T) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const appliedOptions = configuration ? getAppliedOptionsForConfiguration(<DaffCompositeProduct><any>product, configuration) : {};\n return {\n minPrice: getMinPricesForConfiguration(<DaffCompositeProduct><any>product, appliedOptions),\n maxPrice: getMaxPricesForConfiguration(<DaffCompositeProduct><any>product, appliedOptions),\n };\n },\n )).memoized;\n\n const selectCompositeProductOptionalItemPricesForConfiguration = defaultMemoize((id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => createSelector(\n selectProduct(id),\n (product: T) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const appliedOptions = configuration ? getAppliedOptionsForConfiguration(<DaffCompositeProduct><any>product, configuration) : {};\n return {\n minPrice: getMinPricesForConfiguration(<DaffCompositeProduct><any>product, appliedOptions),\n maxPrice: getMaxPricesForConfigurationIncludingOptionalItems(<DaffCompositeProduct><any>product, appliedOptions),\n };\n },\n )).memoized;\n\n const selectCompositeProductPricesAsCurrentlyConfigured = defaultMemoize((id: T['id']) => createSelector<DaffCompositeProductStateRootSlice<T>, [T, EntityState<DaffCompositeProductEntity>['entities']], DaffPriceRange>(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: T, appliedOptionsEntities) =>\n selectCompositeProductRequiredItemPricesForConfiguration(id, appliedOptionsEntities[id]?.items || null).projector(product),\n )).memoized;\n\n const selectCompositeProductDiscountAmount = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector<DaffCompositeProductStateRootSlice<T>, [T, EntityState<DaffCompositeProductEntity>['entities']], number>(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: T, appliedOptionsEntities) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n const appliedConfigurationItem = appliedOptionsEntities[product.id].items;\n if((<DaffCompositeProduct><any>product).items.filter(item => item.required && appliedConfigurationItem[item.id].value === null).length > 0) {\n return undefined;\n }\n const appliedOptions = getAppliedOptionsForConfiguration((<DaffCompositeProduct><any>product), appliedConfigurationItem);\n\n return (<DaffCompositeProduct><any>product).items.reduce((acc, item) =>\n appliedOptions[item.id]?.discount?.amount ? daffAdd(acc, daffMultiply(appliedOptions[item.id].discount.amount, appliedOptions[item.id].quantity)) : acc,\n product.discount.amount);\n },\n )).memoized;\n\n const selectCompositeProductDiscountPercent = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector<DaffCompositeProductStateRootSlice<T>, [T, EntityState<DaffCompositeProductEntity>['entities']], number>(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: T, appliedOptionsEntities) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n const appliedOptions = appliedOptionsEntities[product.id].items;\n if((<DaffCompositeProduct><any>product).items.filter(item => item.required && appliedOptions[item.id].value === null).length > 0) {\n return undefined;\n }\n\n const prices = getMinPricesForConfiguration(\n (<DaffCompositeProduct><any>product),\n getAppliedOptionsForConfiguration((<DaffCompositeProduct><any>product), appliedOptions),\n );\n\n return daffMultiply(\n daffDivide(\n daffSubtract(prices.originalPrice, prices.discountedPrice),\n prices.originalPrice,\n ),\n 100,\n );\n },\n )).memoized;\n\n return {\n selectCompositeProductRequiredItemPricesForConfiguration,\n selectCompositeProductOptionalItemPricesForConfiguration,\n selectCompositeProductPricesAsCurrentlyConfigured,\n selectCompositeProductDiscountAmount,\n selectCompositeProductDiscountPercent,\n };\n};\n\n/**\n * A function that returns all selectors related to the composite product feature.\n *\n * Returns {@link DaffCompositeProductMemoizedSelectors}.\n */\nexport const getDaffCompositeProductPriceSelectors = (() => {\n let cache;\n return <T extends DaffProduct = DaffProduct>(): DaffCompositeProductMemoizedSelectors<T> => cache = cache\n ? cache\n : createCompositeProductSelectors<T>();\n})();\n\n/**\n * The minimum price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMinimumRequiredCompositeItemPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.min(...item.options.map(option => option.price)), qty) : 0;\n}\n\n/**\n * The maximum price for an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMaximumRequiredCompositeItemPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.max(...item.options.map(option => option.price)), qty) : 0;\n}\n\n/**\n * The minimum discounted price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMinimumRequiredCompositeItemDiscountedPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.min(...item.options.map(getDiscountedPrice)), qty) : 0;\n}\n/**\n * The maximum discounted price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMaximumRequiredCompositeItemDiscountedPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.max(...item.options.map(getDiscountedPrice)), qty) : 0;\n}\n\n/**\n * Gets the minimum prices of a composite product for the configuration provided excluding unselected, optional item prices.\n *\n * @param product a DaffCompositeProduct\n * @param appliedOptions a Dictionary<DaffCompositeProductItemOption> that determines the current configuration of the composite product.\n */\nfunction getMinPricesForConfiguration(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n getMinimumRequiredCompositeItemDiscountedPrice(item, getOptionQty(appliedOptions[item.id])),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n getMinimumRequiredCompositeItemPrice(item, getOptionQty(appliedOptions[item.id])),\n ), product.price),\n };\n}\n\n/**\n * Gets the maximum prices of a composite product for the configuration provided excluding unselected, optional item prices.\n *\n * @param product a DaffCompositeProduct\n * @param appliedOptions a Dictionary<DaffCompositeProductItemOption> that determines the current configuration of the composite product.\n */\nfunction getMaxPricesForConfiguration(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n getMaximumRequiredCompositeItemDiscountedPrice(item, getOptionQty(appliedOptions[item.id])),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n getMaximumRequiredCompositeItemPrice(item, getOptionQty(appliedOptions[item.id])),\n ), product.price),\n };\n}\n\nfunction getDiscountedPrice(product: DaffProduct): number {\n return product.discount ? daffSubtract(product.price, product.discount.amount) : product.price;\n}\n\n/**\n * Gets the maximum prices of a composite product including optional item prices.\n *\n * @param product a DaffCompositeProduct\n */\nfunction getMaxPricesForConfigurationIncludingOptionalItems(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n appliedOptionHasQty(appliedOptions[item.id]) ?\n daffMultiply(Math.max(...item.options.map(getDiscountedPrice)), appliedOptions[item.id].quantity) :\n Math.max(...item.options.map(getDiscountedPrice)),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n appliedOptionHasQty(appliedOptions[item.id]) ?\n daffMultiply(Math.max(...item.options.map(option => option.price)), appliedOptions[item.id].quantity) :\n Math.max(...item.options.map(option => option.price)),\n ), product.price),\n };\n}\n\n/**\n * Takes a product and a set of option configurations and convert it into a dictionary of the full option objects.\n *\n * @param product a DaffCompositeProduct\n * @param configuration a Dictionary<DaffCompositeConfigurationItem> used to build the appliedOptions object.\n */\nfunction getAppliedOptionsForConfiguration(product: DaffCompositeProduct, configuration: Dictionary<DaffCompositeConfigurationItem>): Dictionary<DaffCompositeProductItemOption> {\n return product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: configuration[item.id] ? {\n ...item.options.find(option => option.id === configuration[item.id].value),\n quantity: (configuration[item.id].qty === null || configuration[item.id].qty === undefined) ? 1 : configuration[item.id].qty,\n } : null,\n }), {});\n}\n\nfunction appliedOptionHasId(appliedOption: DaffCompositeProductItemOption): boolean {\n return !!appliedOption?.id;\n}\n\nfunction getOptionQty(appliedOption: DaffCompositeProductItemOption): number {\n return appliedOptionHasQty(appliedOption) ? appliedOption.quantity : 1;\n}\n\nfunction appliedOptionHasQty(appliedOption: DaffCompositeProductItemOption): boolean {\n return appliedOption?.quantity !== null && appliedOption?.quantity !== undefined;\n}\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffCompositeProductEntitiesMemoizedSelectors,\n getDaffCompositeProductEntitiesSelectors,\n} from './composite-product-entities/composite-product-entities.selectors';\nimport {\n DaffCompositeProductMemoizedSelectors,\n getDaffCompositeProductPriceSelectors,\n} from './composite-product/composite-product.selectors';\n\n/**\n * An interface for all selectors in the composite product feature area.\n */\nexport interface DaffCompositeProductAllSelectors<T extends DaffProduct = DaffProduct> extends\n DaffCompositeProductEntitiesMemoizedSelectors<T>,\n DaffCompositeProductMemoizedSelectors<T> { }\n\n/**\n * A function that returns all selectors in the composite product feature area.\n * Returns {@link DaffCompositeProductAllSelectors}.\n */\nexport const getDaffCompositeProductSelectors = <T extends DaffProduct>(): DaffCompositeProductAllSelectors<T> => ({\n ...getDaffCompositeProductEntitiesSelectors<T>(),\n ...getDaffCompositeProductPriceSelectors<T>(),\n});\n","import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffProduct,\n DaffPriceRange,\n productPriceRangeHasDiscount,\n productPriceRangeHasPriceRange,\n} from '@daffodil/product';\nimport {\n DaffCompositeConfigurationItem,\n DaffCompositeProductItemOption,\n DaffCompositeProductItem,\n} from '@daffodil/product-composite';\n\nimport { DaffCompositeProductStateRootSlice } from '../../reducers/composite-product-reducers-state.interface';\nimport { getDaffCompositeProductSelectors } from '../../selectors/public_api';\nimport { DaffCompositeProductFacadeInterface } from './composite-product-facade.interface';\n\n/**\n * A facade for interacting with the composite product state.\n * Exposes many parts of the state for easy access and allows dispatching of actions.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCompositeProductFacade<T extends DaffProduct = DaffProduct> implements DaffCompositeProductFacadeInterface {\n\n constructor(private store: Store<DaffCompositeProductStateRootSlice<T>>) {}\n\n compositeProductSelectors = getDaffCompositeProductSelectors<T>();\n\n hasDiscount = productPriceRangeHasDiscount;\n\n hasPriceRange = productPriceRangeHasPriceRange;\n\n getRequiredItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductRequiredItemPricesForConfiguration(id, configuration)));\n }\n\n getOptionalItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductOptionalItemPricesForConfiguration(id, configuration)));\n }\n\n getPricesAsCurrentlyConfigured(id: T['id']): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductPricesAsCurrentlyConfigured(id)));\n }\n\n getAppliedOptions(id: T['id']): Observable<Dictionary<DaffCompositeProductItemOption>> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductAppliedOptions(id)));\n }\n\n getDiscountAmount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductDiscountAmount(id)));\n }\n\n getDiscountPercent(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductDiscountPercent(id)));\n }\n\n isItemRequired(id: T['id'], item_id: DaffCompositeProductItem['id']) {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectIsCompositeProductItemRequired(id, item_id)));\n }\n\n dispatch(action: Action) {\n\t this.store.dispatch(action);\n }\n}\n","import { EntityState } from '@ngrx/entity';\n\nimport { DaffProduct } from '@daffodil/product';\nimport { DaffCompositeProduct } from '@daffodil/product-composite';\nimport {\n DaffProductPageActions,\n DaffProductPageActionTypes,\n DaffProductGridActionTypes,\n DaffProductGridActions,\n DaffBestSellersActions,\n DaffProductActions,\n DaffBestSellersActionTypes,\n DaffProductActionTypes,\n} from '@daffodil/product/state';\n\nimport {\n DaffCompositeProductActions,\n DaffCompositeProductActionTypes,\n} from '../../actions/public_api';\nimport { daffCompositeProductAppliedOptionsEntitiesAdapter } from './composite-product-entities-reducer-adapter';\nimport { DaffCompositeProductEntity } from './composite-product-entity';\n\n/**\n * Reducer function that catches actions and changes/overwrites composite product entities state.\n *\n * @param state current State of the redux store\n * @param action ProductGrid, BestSellers, Product, or Composite Product actions\n * @returns Product entities state\n */\nexport function daffCompositeProductEntitiesReducer<T extends DaffProduct, V extends DaffCompositeProduct>(\n state = daffCompositeProductAppliedOptionsEntitiesAdapter().getInitialState(),\n action: DaffProductGridActions<T> | DaffBestSellersActions<T> | DaffProductActions<T> | DaffProductPageActions<T> | DaffCompositeProductActions<V>): EntityState<DaffCompositeProductEntity> {\n const adapter = daffCompositeProductAppliedOptionsEntitiesAdapter();\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return adapter.upsertProducts(state, ...(<V[]><unknown>action.payload));\n\n case DaffProductActionTypes.ProductLoadSuccessAction:\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return adapter.upsertProducts(state, ...(<V[]><unknown>action.payload.products));\n\n case DaffCompositeProductActionTypes.CompositeProductApplyOptionAction:\n return adapter.applyOption(state, action.id, action.itemId, action.optionId, action.qty);\n\n default:\n return state;\n }\n}\n","import { ActionReducerMap } from '@ngrx/store';\n\nimport { daffCompositeProductEntitiesReducer } from './composite-product-entities/composite-product-entities.reducer';\nimport { DaffCompositeProductReducersState } from './composite-product-reducers-state.interface';\n\n/**\n * Returns state values from all composite product related reducers.\n */\nexport const daffCompositeProductReducers: ActionReducerMap<DaffCompositeProductReducersState> = {\n compositeProductOptions: daffCompositeProductEntitiesReducer,\n};\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\nimport { ActionReducer } from '@ngrx/store';\n\nimport { DaffCompositeProductReducersState } from '../composite-product-reducers-state.interface';\n\n/**\n * A token to hold the injectable extra reducers.\n *\n * Prefer using {@link daffProductCompositeProvideExtraReducers}.\n */\nexport const DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS = new InjectionToken<ActionReducer<DaffCompositeProductReducersState>[]>(\n 'DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS',\n { factory: () => []},\n);\n\n/**\n * Provides additional reducers that run after the standard Daffodil cart reducers.\n *\n * ```ts\n * providers: [\n * ...daffProductCompositeProvideExtraReducers(\n * myReducer1,\n * myReducer2\n * )\n * ]\n * ```\n */\nexport function daffProductCompositeProvideExtraReducers(\n ...reducers: ActionReducer<Partial<DaffCompositeProductReducersState>>[]\n): Provider[] {\n return reducers.map(reducer => ({\n provide: DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS,\n useValue: reducer,\n multi: true,\n }));\n}\n","import { DaffProductTypeEnum } from '@daffodil/product';\nimport { DaffCompositeProduct } from '@daffodil/product-composite';\nimport { DaffProductReducersState } from '@daffodil/product/state';\n\n/**\n * Maps a list of products, ensuring that the composite products have a list of items.\n * If the incoming items is empty or nully, the items from state are intentionally used instead.\n */\nexport function daffProductCompositeEnsureItems<T extends DaffCompositeProduct = DaffCompositeProduct>(state: DaffProductReducersState<T>, products: T[]): T[] {\n return products.map((product) =>\n product.type === DaffProductTypeEnum.Composite\n ? {\n ...product,\n items: product.items.length > 0\n ? product.items\n : state.products.entities[product.id]?.items ?? [],\n }\n : product,\n );\n}\n","import { ActionReducer } from '@ngrx/store';\n\nimport { DaffProductTypeEnum } from '@daffodil/product';\nimport { DaffCompositeProduct } from '@daffodil/product-composite';\nimport {\n DaffProductActionTypes,\n DaffProductActions,\n DaffProductLoadSuccess,\n DaffProductPageActionTypes,\n DaffProductPageActions,\n DaffProductPageLoadSuccess,\n DaffProductReducersState,\n} from '@daffodil/product/state';\n\nimport { daffProductCompositeEnsureItems } from '../helpers/public_api';\n\ntype Reducer = ActionReducer<DaffProductReducersState<DaffCompositeProduct>, DaffProductActions<DaffCompositeProduct> | DaffProductPageActions<DaffCompositeProduct>>;\n\nexport function daffProductCompositeEnsureItemsMetaReducer(reducer: Reducer): Reducer {\n return (state, action) => {\n switch (action.type) {\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return reducer(state, new DaffProductPageLoadSuccess({\n ...action.payload,\n products: daffProductCompositeEnsureItems(state, action.payload.products),\n }));\n\n case DaffProductActionTypes.ProductLoadSuccessAction:\n return reducer(state, new DaffProductLoadSuccess({\n ...action.payload,\n products: daffProductCompositeEnsureItems(state, action.payload.products),\n }));\n\n default:\n return reducer(state, action);\n }\n };\n}\n","import {\n inject,\n InjectionToken,\n} from '@angular/core';\nimport {\n ActionReducer,\n combineReducers,\n} from '@ngrx/store';\n\nimport { daffComposeReducers } from '@daffodil/core/state';\n\nimport { daffCompositeProductReducers } from '../composite-product-reducers';\nimport { DaffCompositeProductReducersState } from '../composite-product-reducers-state.interface';\nimport { DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS } from './extra.token';\n\n/**\n * An internal token to hold the Daffodil composite product reducers.\n * Includes the extra and standard reducers.\n *\n * @docs-private\n */\nexport const DAFF_PRODUCT_COMPOSITE_REDUCERS = new InjectionToken<ActionReducer<DaffCompositeProductReducersState>>(\n 'DAFF_PRODUCT_COMPOSITE_REDUCERS',\n {\n factory: () => daffComposeReducers([\n combineReducers(daffCompositeProductReducers),\n ...inject(DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS),\n ]),\n },\n);\n","import { NgModule } from '@angular/core';\nimport { StoreModule } from '@ngrx/store';\n\nimport { daffProductProvideMetaReducers } from '@daffodil/product/state';\n\nimport { daffProductCompositeEnsureItemsMetaReducer } from './reducers/ensure-items.meta-reducer';\nimport { DAFF_PRODUCT_COMPOSITE_REDUCERS } from './reducers/injection-tokens/reducers.token';\nimport { DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY } from './reducers/public_api';\n\n/**\n * A module that provides the default reducers and effects for composite product redux state.\n */\n@NgModule({\n imports: [\n StoreModule.forFeature(DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY, DAFF_PRODUCT_COMPOSITE_REDUCERS),\n ],\n providers: [\n ...daffProductProvideMetaReducers(daffProductCompositeEnsureItemsMetaReducer),\n ],\n})\nexport class DaffCompositeProductStateModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAQA;;AAEG;IACS,gCAEX;AAFD,CAAA,UAAY,+BAA+B,EAAA;AACzC,IAAA,+BAAA,CAAA,mCAAA,CAAA,GAAA,2DAA+F,CAAA;AACjG,CAAC,EAFW,+BAA+B,KAA/B,+BAA+B,GAE1C,EAAA,CAAA,CAAA,CAAA;AAED;;;;;;AAMG;MACU,+BAA+B,CAAA;AAG1C,IAAA,WAAA,CAAmB,EAAW,EAAS,MAAsC,EAAS,QAA8C,EAAS,GAAY,EAAA;QAAtI,IAAE,CAAA,EAAA,GAAF,EAAE,CAAS;QAAS,IAAM,CAAA,MAAA,GAAN,MAAM,CAAgC;QAAS,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAsC;QAAS,IAAG,CAAA,GAAA,GAAH,GAAG,CAAS;AAFhJ,QAAA,IAAA,CAAA,IAAI,GAAG,+BAA+B,CAAC,iCAAiC,CAAC;KAE2E;AAC9J;;ACVD;;AAEG;MACU,iDAAiD,CAAA;AAA9D,IAAA,WAAA,GAAA;AACE;;AAEG;QACK,IAAQ,CAAA,QAAA,GAAG,mBAAmB,EAA8B,CAAC;KAsFtE;AApFC;;AAEG;IACH,eAAe,GAAA;AACb,QAAA,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B,EAJ/B,SAAA,EAAA;QACT,GAAG,8BAA8B,CAAC,0CAA0C,CAAC;KAC9E,EALQ,OAAA,EAAA,CAAA;AACP,YAAA,WAAW,CAAC,UAAU,CAAC,wCAAwC,EAAE,+BAA+B,CAAC;AAClG,SAAA,CAAA,EAAA,CAAA,CAAA;2FAKU,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAR3C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;AACP,wBAAA,WAAW,CAAC,UAAU,CAAC,wCAAwC,EAAE,+BAA+B,CAAC;AAClG,qBAAA;AACD,oBAAA,SAAS,EAAE;wBACT,GAAG,8BAA8B,CAAC,0CAA0C,CAAC;AAC9E,qBAAA;AACF,iBAAA,CAAA;;;ACnBD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-product-composite-state.mjs","sources":["../../../libs/product-composite/state/src/actions/composite-product.actions.ts","../../../libs/product-composite/state/src/reducers/composite-product-entities/composite-product-entities-reducer-adapter.ts","../../../libs/product-composite/state/src/reducers/composite-product-store-feature-key.ts","../../../libs/product-composite/state/src/selectors/feature.selector.ts","../../../libs/product-composite/state/src/selectors/composite-product-entities/composite-product-entities.selectors.ts","../../../libs/product-composite/state/src/selectors/composite-product/composite-product.selectors.ts","../../../libs/product-composite/state/src/selectors/all.selector.ts","../../../libs/product-composite/state/src/facades/composite-product/composite-product.facade.ts","../../../libs/product-composite/state/src/reducers/composite-product-entities/composite-product-entities.reducer.ts","../../../libs/product-composite/state/src/reducers/composite-product-reducers.ts","../../../libs/product-composite/state/src/reducers/injection-tokens/extra.token.ts","../../../libs/product-composite/state/src/helpers/ensure-items.ts","../../../libs/product-composite/state/src/reducers/ensure-items.meta-reducer.ts","../../../libs/product-composite/state/src/reducers/injection-tokens/reducers.token.ts","../../../libs/product-composite/state/src/composite-product-state.module.ts","../../../libs/product-composite/state/src/daffodil-product-composite-state.ts"],"sourcesContent":["import { Action } from '@ngrx/store';\n\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n} from '@daffodil/product-composite';\n\n/**\n * Action types for Composite Product Actions.\n */\nexport enum DaffCompositeProductActionTypes {\n CompositeProductApplyOptionAction = '[Composite Product] Composite Product Apply Option Action'\n}\n\n/**\n * Applies a product option to a particular composite product.\n *\n * @param id - Id of the Composite Product\n * @param itemId - Id of the product item.\n * @param optionId - Id of the option of the product item that is chosen.\n */\nexport class DaffCompositeProductApplyOption<T extends DaffCompositeProduct = DaffCompositeProduct> implements Action {\n readonly type = DaffCompositeProductActionTypes.CompositeProductApplyOptionAction;\n\n constructor(public id: T['id'], public itemId: DaffCompositeProductItem['id'], public optionId: DaffCompositeProductItemOption['id'], public qty?: number) {}\n}\n\nexport type DaffCompositeProductActions<T extends DaffCompositeProduct = DaffCompositeProduct> =\n\t| DaffCompositeProductApplyOption<T>;\n","import {\n createEntityAdapter,\n EntityState,\n} from '@ngrx/entity';\nimport { defaultMemoize } from '@ngrx/store';\n\nimport { DaffProductTypeEnum } from '@daffodil/product';\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeConfigurationItem,\n DaffCompositeProductItemOption,\n} from '@daffodil/product-composite';\n\nimport { DaffCompositeProductEntity } from './composite-product-entity';\n\n/**\n * Composite Product Item Options Adapter for changing/overwriting entity state.\n */\nexport class DaffCompositeProductAppliedOptionsEntitiesAdapter<T extends EntityState<DaffCompositeProductEntity> = EntityState<DaffCompositeProductEntity>> {\n /**\n * @docs-private\n */\n private _adapter = createEntityAdapter<DaffCompositeProductEntity>();\n\n /**\n * Gets the initial entity state.\n */\n getInitialState() {\n return this._adapter.getInitialState();\n }\n\n /**\n * Get the entity selectors.\n */\n getSelectors() {\n return this._adapter.getSelectors();\n }\n\n /**\n * Upserts the given composite products into state.\n */\n upsertProducts(state: T, ...products: DaffCompositeProduct[]): T {\n return this._adapter.upsertMany(\n this.mapOptionsEntities(products),\n state,\n );\n };\n\n /**\n * Apply the specified option for the given composite product item.\n */\n applyOption(state: T, productId: DaffCompositeProduct['id'], itemId: DaffCompositeProductItem['id'], optionId: DaffCompositeProductItemOption['id'], qty?: number) {\n return this._adapter.upsertOne(\n {\n id: productId,\n items: {\n ...state.entities[productId].items,\n [itemId]: {\n value: optionId,\n qty: qty ?? 1,\n },\n },\n },\n state,\n );\n }\n\n /**\n * @docs-private\n */\n private mapOptionsEntities(products: DaffCompositeProduct[]): DaffCompositeProductEntity[] {\n return products.filter(product => product.type === DaffProductTypeEnum.Composite)\n .map(product => this.buildCompositeProductAppliedOptionsEntity(product));\n }\n\n /**\n * @docs-private\n */\n private buildCompositeProductAppliedOptionsEntity(product: DaffCompositeProduct): DaffCompositeProductEntity {\n return {\n id: product.id,\n items: product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: this.getDefaultOption(item),\n }), {}),\n };\n }\n\n /**\n * Sets the default item option to the specified default option if it is in stock.\n * Does not set a default option if a default is not specified.\n * Does not set a default option but does set a default qty if the default is out of stock.\n *\n * @param item a DaffCompositeProductItem\n * @docs-private\n */\n private getDefaultOption(item: DaffCompositeProductItem): DaffCompositeConfigurationItem {\n const defaultOptionIndex = item.options.findIndex(option => option.is_default);\n\n if(defaultOptionIndex > -1) {\n return {\n value: item.options[defaultOptionIndex].in_stock ? item.options[defaultOptionIndex].id : null,\n qty: item.options[defaultOptionIndex].quantity,\n };\n } else {\n return { value: null, qty: null };\n }\n }\n}\n\n/**\n * Gets the composite product entity adapter singleton.\n */\nexport const daffCompositeProductAppliedOptionsEntitiesAdapter: () => DaffCompositeProductAppliedOptionsEntitiesAdapter = defaultMemoize(() => new DaffCompositeProductAppliedOptionsEntitiesAdapter()).memoized;\n","export const DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY = 'daffCompositeProduct';\n","import {\n createFeatureSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffCompositeProductReducersState } from '../reducers/composite-product-reducers-state.interface';\nimport { DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY } from '../reducers/composite-product-store-feature-key';\n\n/**\n * An interface for the composite product feature state.\n */\nexport interface DaffCompositeProductFeatureMemoizedSelector {\n selectCompositeProductState: MemoizedSelector<Record<string, any>, DaffCompositeProductReducersState>;\n}\n\n/**\n * A function that returns a selector for the composite product feature state.\n */\nexport const getDaffCompositeProductFeatureSelector = (() => {\n let cache;\n return (): DaffCompositeProductFeatureMemoizedSelector => cache = cache\n ? cache\n : { selectCompositeProductState: createFeatureSelector<DaffCompositeProductReducersState>(DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY) };\n})();\n","import {\n EntityState,\n Dictionary,\n} from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n} from '@daffodil/product';\nimport {\n DaffCompositeProductItemOption,\n DaffCompositeProductItem,\n DaffCompositeProduct,\n} from '@daffodil/product-composite';\nimport { getDaffProductEntitiesSelectors } from '@daffodil/product/state';\n\nimport { daffCompositeProductAppliedOptionsEntitiesAdapter } from '../../reducers/composite-product-entities/composite-product-entities-reducer-adapter';\nimport { DaffCompositeProductEntity } from '../../reducers/composite-product-entities/composite-product-entity';\nimport {\n DaffCompositeProductReducersState,\n DaffCompositeProductStateRootSlice,\n} from '../../reducers/composite-product-reducers-state.interface';\nimport { getDaffCompositeProductFeatureSelector } from '../feature.selector';\n\n/**\n * An interface for selectors related to the composite product applied options.\n */\nexport interface DaffCompositeProductEntitiesMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n /**\n * The ngrx entities state for composite product applied options.\n */\n selectCompositeProductAppliedOptionsEntitiesState: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>>;\n /**\n * A selector for all composite product ids in state.\n */\n selectCompositeProductIds: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>['ids']>;\n /**\n * The ngrx entities for the composite product appllied options.\n */\n selectCompositeProductAppliedOptionsEntities: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>['entities']>;\n /**\n * The total number of composite products in state.\n */\n selectCompositeProductTotal: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;\n /**\n * Selects the applied options for a composite product.\n *\n * @param id the id of the composite product.\n */\n selectCompositeProductAppliedOptions: (id: T['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, Dictionary<DaffCompositeProductItemOption>>;\n /**\n * Selects whether the particular item of a composite product is required in order for the product to be valid, i.e. addable to the cart.\n *\n * @param id the id of the composite product.\n * @param item_id the id of the composite product item.\n */\n selectIsCompositeProductItemRequired: (id: T['id'], item_id: DaffCompositeProductItem['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, boolean>;\n}\n\nconst createCompositeProductAppliedOptionsEntitiesSelectors = <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors<T> => {\n const {\n selectCompositeProductState,\n } = getDaffCompositeProductFeatureSelector();\n const {\n selectProduct,\n } = getDaffProductEntitiesSelectors<T>();\n const adapterSelectors = daffCompositeProductAppliedOptionsEntitiesAdapter().getSelectors();\n\n const selectCompositeProductAppliedOptionsEntitiesState = createSelector(\n selectCompositeProductState,\n (state: DaffCompositeProductReducersState) => state.compositeProductOptions,\n );\n\n const selectCompositeProductIds = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectIds,\n );\n\n const selectCompositeProductAppliedOptionsEntities = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectEntities,\n );\n\n const selectCompositeProductTotal = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectTotal,\n );\n\n const selectCompositeProductAppliedOptions = defaultMemoize((id: T['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntitiesState,\n (product: T, appliedOptions) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n return (<DaffCompositeProduct><any>product).items.reduce((acc, item) => ({\n ...acc,\n [item.id]: appliedOptions.entities[product.id].items[item.id].value ? {\n ...item.options.find(option => option.id === appliedOptions.entities[product.id].items[item.id].value),\n quantity: appliedOptions.entities[product.id].items[item.id].qty,\n } : null,\n }), {});\n },\n )).memoized;\n\n const selectIsCompositeProductItemRequired = defaultMemoize((id: T['id'], item_id: DaffCompositeProductItem['id']) => createSelector(\n selectProduct(id),\n (product: T) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const productItem = (<DaffCompositeProduct><any>product).items.find(item => item.id === item_id);\n\n return productItem ? productItem.required : null;\n },\n )).memoized;\n\n\n return {\n selectCompositeProductAppliedOptionsEntitiesState,\n selectCompositeProductIds,\n selectCompositeProductAppliedOptionsEntities,\n selectCompositeProductTotal,\n selectCompositeProductAppliedOptions,\n selectIsCompositeProductItemRequired,\n };\n};\n\n/**\n * A function that returns all selectors related to composite product applied option entities.\n * Returns {@link DaffCompositeProductEntitiesMemoizedSelectors}.\n */\nexport const getDaffCompositeProductEntitiesSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors<T> => cache = cache\n ? cache\n : createCompositeProductAppliedOptionsEntitiesSelectors<T>();\n})();\n","import {\n Dictionary,\n EntityState,\n} from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n daffAdd,\n daffDivide,\n daffMultiply,\n daffSubtract,\n} from '@daffodil/core';\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n DaffProductPrices,\n DaffPriceRange,\n} from '@daffodil/product';\nimport {\n DaffCompositeProduct,\n DaffCompositeConfigurationItem,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n} from '@daffodil/product-composite';\nimport { getDaffProductEntitiesSelectors } from '@daffodil/product/state';\n\nimport { DaffCompositeProductStateRootSlice } from '../../reducers/composite-product-reducers-state.interface';\nimport { DaffCompositeProductEntity } from '../../reducers/public_api';\nimport { getDaffCompositeProductEntitiesSelectors } from '../composite-product-entities/composite-product-entities.selectors';\n\n/**\n * An interface describing selectors unique to the composite product, such as pricing and discounts.\n */\nexport interface DaffCompositeProductMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n /**\n * Get a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.\n */\n selectCompositeProductRequiredItemPricesForConfiguration: ( id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem> ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;\n /**\n * Get the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.\n */\n selectCompositeProductOptionalItemPricesForConfiguration: ( id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem> ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;\n /**\n * Get the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and\n * excluding unselected, optional item prices.\n */\n selectCompositeProductPricesAsCurrentlyConfigured: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;\n /**\n * Get the discount amount for a composite product. This value will be undefined if all required options are not chosen.\n */\n selectCompositeProductDiscountAmount: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;\n /**\n * Get the discount percent for a composite product. This value will be undefined if all required options are not chosen.\n * Note: this percent is computed client-side and should be treated as an estimate rather than an exact value.\n */\n selectCompositeProductDiscountPercent: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;\n}\n\nconst createCompositeProductSelectors = <T extends DaffProduct>(): DaffCompositeProductMemoizedSelectors<T> => {\n\n const {\n selectProduct,\n } = getDaffProductEntitiesSelectors<T>();\n\n const {\n selectCompositeProductAppliedOptionsEntities,\n } = getDaffCompositeProductEntitiesSelectors();\n\n const selectCompositeProductRequiredItemPricesForConfiguration = defaultMemoize((id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => createSelector(\n selectProduct(id),\n (product: T) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const appliedOptions = configuration ? getAppliedOptionsForConfiguration(<DaffCompositeProduct><any>product, configuration) : {};\n return {\n minPrice: getMinPricesForConfiguration(<DaffCompositeProduct><any>product, appliedOptions),\n maxPrice: getMaxPricesForConfiguration(<DaffCompositeProduct><any>product, appliedOptions),\n };\n },\n )).memoized;\n\n const selectCompositeProductOptionalItemPricesForConfiguration = defaultMemoize((id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => createSelector(\n selectProduct(id),\n (product: T) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const appliedOptions = configuration ? getAppliedOptionsForConfiguration(<DaffCompositeProduct><any>product, configuration) : {};\n return {\n minPrice: getMinPricesForConfiguration(<DaffCompositeProduct><any>product, appliedOptions),\n maxPrice: getMaxPricesForConfigurationIncludingOptionalItems(<DaffCompositeProduct><any>product, appliedOptions),\n };\n },\n )).memoized;\n\n const selectCompositeProductPricesAsCurrentlyConfigured = defaultMemoize((id: T['id']) => createSelector<DaffCompositeProductStateRootSlice<T>, [T, EntityState<DaffCompositeProductEntity>['entities']], DaffPriceRange>(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: T, appliedOptionsEntities) =>\n selectCompositeProductRequiredItemPricesForConfiguration(id, appliedOptionsEntities[id]?.items || null).projector(product),\n )).memoized;\n\n const selectCompositeProductDiscountAmount = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector<DaffCompositeProductStateRootSlice<T>, [T, EntityState<DaffCompositeProductEntity>['entities']], number>(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: T, appliedOptionsEntities) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n const appliedConfigurationItem = appliedOptionsEntities[product.id].items;\n if((<DaffCompositeProduct><any>product).items.filter(item => item.required && appliedConfigurationItem[item.id].value === null).length > 0) {\n return undefined;\n }\n const appliedOptions = getAppliedOptionsForConfiguration((<DaffCompositeProduct><any>product), appliedConfigurationItem);\n\n return (<DaffCompositeProduct><any>product).items.reduce((acc, item) =>\n appliedOptions[item.id]?.discount?.amount ? daffAdd(acc, daffMultiply(appliedOptions[item.id].discount.amount, appliedOptions[item.id].quantity)) : acc,\n product.discount.amount);\n },\n )).memoized;\n\n const selectCompositeProductDiscountPercent = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector<DaffCompositeProductStateRootSlice<T>, [T, EntityState<DaffCompositeProductEntity>['entities']], number>(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: T, appliedOptionsEntities) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n const appliedOptions = appliedOptionsEntities[product.id].items;\n if((<DaffCompositeProduct><any>product).items.filter(item => item.required && appliedOptions[item.id].value === null).length > 0) {\n return undefined;\n }\n\n const prices = getMinPricesForConfiguration(\n (<DaffCompositeProduct><any>product),\n getAppliedOptionsForConfiguration((<DaffCompositeProduct><any>product), appliedOptions),\n );\n\n return daffMultiply(\n daffDivide(\n daffSubtract(prices.originalPrice, prices.discountedPrice),\n prices.originalPrice,\n ),\n 100,\n );\n },\n )).memoized;\n\n return {\n selectCompositeProductRequiredItemPricesForConfiguration,\n selectCompositeProductOptionalItemPricesForConfiguration,\n selectCompositeProductPricesAsCurrentlyConfigured,\n selectCompositeProductDiscountAmount,\n selectCompositeProductDiscountPercent,\n };\n};\n\n/**\n * A function that returns all selectors related to the composite product feature.\n *\n * Returns {@link DaffCompositeProductMemoizedSelectors}.\n */\nexport const getDaffCompositeProductPriceSelectors = (() => {\n let cache;\n return <T extends DaffProduct = DaffProduct>(): DaffCompositeProductMemoizedSelectors<T> => cache = cache\n ? cache\n : createCompositeProductSelectors<T>();\n})();\n\n/**\n * The minimum price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMinimumRequiredCompositeItemPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.min(...item.options.map(option => option.price)), qty) : 0;\n}\n\n/**\n * The maximum price for an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMaximumRequiredCompositeItemPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.max(...item.options.map(option => option.price)), qty) : 0;\n}\n\n/**\n * The minimum discounted price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMinimumRequiredCompositeItemDiscountedPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.min(...item.options.map(getDiscountedPrice)), qty) : 0;\n}\n/**\n * The maximum discounted price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMaximumRequiredCompositeItemDiscountedPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.max(...item.options.map(getDiscountedPrice)), qty) : 0;\n}\n\n/**\n * Gets the minimum prices of a composite product for the configuration provided excluding unselected, optional item prices.\n *\n * @param product a DaffCompositeProduct\n * @param appliedOptions a Dictionary<DaffCompositeProductItemOption> that determines the current configuration of the composite product.\n */\nfunction getMinPricesForConfiguration(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n getMinimumRequiredCompositeItemDiscountedPrice(item, getOptionQty(appliedOptions[item.id])),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n getMinimumRequiredCompositeItemPrice(item, getOptionQty(appliedOptions[item.id])),\n ), product.price),\n };\n}\n\n/**\n * Gets the maximum prices of a composite product for the configuration provided excluding unselected, optional item prices.\n *\n * @param product a DaffCompositeProduct\n * @param appliedOptions a Dictionary<DaffCompositeProductItemOption> that determines the current configuration of the composite product.\n */\nfunction getMaxPricesForConfiguration(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n getMaximumRequiredCompositeItemDiscountedPrice(item, getOptionQty(appliedOptions[item.id])),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n getMaximumRequiredCompositeItemPrice(item, getOptionQty(appliedOptions[item.id])),\n ), product.price),\n };\n}\n\nfunction getDiscountedPrice(product: DaffProduct): number {\n return product.discount ? daffSubtract(product.price, product.discount.amount) : product.price;\n}\n\n/**\n * Gets the maximum prices of a composite product including optional item prices.\n *\n * @param product a DaffCompositeProduct\n */\nfunction getMaxPricesForConfigurationIncludingOptionalItems(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n appliedOptionHasQty(appliedOptions[item.id]) ?\n daffMultiply(Math.max(...item.options.map(getDiscountedPrice)), appliedOptions[item.id].quantity) :\n Math.max(...item.options.map(getDiscountedPrice)),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n appliedOptionHasQty(appliedOptions[item.id]) ?\n daffMultiply(Math.max(...item.options.map(option => option.price)), appliedOptions[item.id].quantity) :\n Math.max(...item.options.map(option => option.price)),\n ), product.price),\n };\n}\n\n/**\n * Takes a product and a set of option configurations and convert it into a dictionary of the full option objects.\n *\n * @param product a DaffCompositeProduct\n * @param configuration a Dictionary<DaffCompositeConfigurationItem> used to build the appliedOptions object.\n */\nfunction getAppliedOptionsForConfiguration(product: DaffCompositeProduct, configuration: Dictionary<DaffCompositeConfigurationItem>): Dictionary<DaffCompositeProductItemOption> {\n return product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: configuration[item.id] ? {\n ...item.options.find(option => option.id === configuration[item.id].value),\n quantity: (configuration[item.id].qty === null || configuration[item.id].qty === undefined) ? 1 : configuration[item.id].qty,\n } : null,\n }), {});\n}\n\nfunction appliedOptionHasId(appliedOption: DaffCompositeProductItemOption): boolean {\n return !!appliedOption?.id;\n}\n\nfunction getOptionQty(appliedOption: DaffCompositeProductItemOption): number {\n return appliedOptionHasQty(appliedOption) ? appliedOption.quantity : 1;\n}\n\nfunction appliedOptionHasQty(appliedOption: DaffCompositeProductItemOption): boolean {\n return appliedOption?.quantity !== null && appliedOption?.quantity !== undefined;\n}\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffCompositeProductEntitiesMemoizedSelectors,\n getDaffCompositeProductEntitiesSelectors,\n} from './composite-product-entities/composite-product-entities.selectors';\nimport {\n DaffCompositeProductMemoizedSelectors,\n getDaffCompositeProductPriceSelectors,\n} from './composite-product/composite-product.selectors';\n\n/**\n * An interface for all selectors in the composite product feature area.\n */\nexport interface DaffCompositeProductAllSelectors<T extends DaffProduct = DaffProduct> extends\n DaffCompositeProductEntitiesMemoizedSelectors<T>,\n DaffCompositeProductMemoizedSelectors<T> { }\n\n/**\n * A function that returns all selectors in the composite product feature area.\n * Returns {@link DaffCompositeProductAllSelectors}.\n */\nexport const getDaffCompositeProductSelectors = <T extends DaffProduct>(): DaffCompositeProductAllSelectors<T> => ({\n ...getDaffCompositeProductEntitiesSelectors<T>(),\n ...getDaffCompositeProductPriceSelectors<T>(),\n});\n","import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffProduct,\n DaffPriceRange,\n productPriceRangeHasDiscount,\n productPriceRangeHasPriceRange,\n} from '@daffodil/product';\nimport {\n DaffCompositeConfigurationItem,\n DaffCompositeProductItemOption,\n DaffCompositeProductItem,\n} from '@daffodil/product-composite';\n\nimport { DaffCompositeProductStateRootSlice } from '../../reducers/composite-product-reducers-state.interface';\nimport { getDaffCompositeProductSelectors } from '../../selectors/public_api';\nimport { DaffCompositeProductFacadeInterface } from './composite-product-facade.interface';\n\n/**\n * A facade for interacting with the composite product state.\n * Exposes many parts of the state for easy access and allows dispatching of actions.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCompositeProductFacade<T extends DaffProduct = DaffProduct> implements DaffCompositeProductFacadeInterface {\n\n constructor(private store: Store<DaffCompositeProductStateRootSlice<T>>) {}\n\n compositeProductSelectors = getDaffCompositeProductSelectors<T>();\n\n hasDiscount = productPriceRangeHasDiscount;\n\n hasPriceRange = productPriceRangeHasPriceRange;\n\n getRequiredItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductRequiredItemPricesForConfiguration(id, configuration)));\n }\n\n getOptionalItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductOptionalItemPricesForConfiguration(id, configuration)));\n }\n\n getPricesAsCurrentlyConfigured(id: T['id']): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductPricesAsCurrentlyConfigured(id)));\n }\n\n getAppliedOptions(id: T['id']): Observable<Dictionary<DaffCompositeProductItemOption>> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductAppliedOptions(id)));\n }\n\n getDiscountAmount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductDiscountAmount(id)));\n }\n\n getDiscountPercent(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectCompositeProductDiscountPercent(id)));\n }\n\n isItemRequired(id: T['id'], item_id: DaffCompositeProductItem['id']) {\n\t return this.store.pipe(select(this.compositeProductSelectors.selectIsCompositeProductItemRequired(id, item_id)));\n }\n\n dispatch(action: Action) {\n\t this.store.dispatch(action);\n }\n}\n","import { EntityState } from '@ngrx/entity';\n\nimport { DaffProduct } from '@daffodil/product';\nimport { DaffCompositeProduct } from '@daffodil/product-composite';\nimport {\n DaffProductPageActions,\n DaffProductPageActionTypes,\n DaffProductGridActionTypes,\n DaffProductGridActions,\n DaffBestSellersActions,\n DaffProductActions,\n DaffBestSellersActionTypes,\n DaffProductActionTypes,\n} from '@daffodil/product/state';\n\nimport {\n DaffCompositeProductActions,\n DaffCompositeProductActionTypes,\n} from '../../actions/public_api';\nimport { daffCompositeProductAppliedOptionsEntitiesAdapter } from './composite-product-entities-reducer-adapter';\nimport { DaffCompositeProductEntity } from './composite-product-entity';\n\n/**\n * Reducer function that catches actions and changes/overwrites composite product entities state.\n *\n * @param state current State of the redux store\n * @param action ProductGrid, BestSellers, Product, or Composite Product actions\n * @returns Product entities state\n */\nexport function daffCompositeProductEntitiesReducer<T extends DaffProduct, V extends DaffCompositeProduct>(\n state = daffCompositeProductAppliedOptionsEntitiesAdapter().getInitialState(),\n action: DaffProductGridActions<T> | DaffBestSellersActions<T> | DaffProductActions<T> | DaffProductPageActions<T> | DaffCompositeProductActions<V>): EntityState<DaffCompositeProductEntity> {\n const adapter = daffCompositeProductAppliedOptionsEntitiesAdapter();\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return adapter.upsertProducts(state, ...(<V[]><unknown>action.payload));\n\n case DaffProductActionTypes.ProductLoadSuccessAction:\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return adapter.upsertProducts(state, ...(<V[]><unknown>action.payload.products));\n\n case DaffCompositeProductActionTypes.CompositeProductApplyOptionAction:\n return adapter.applyOption(state, action.id, action.itemId, action.optionId, action.qty);\n\n default:\n return state;\n }\n}\n","import { ActionReducerMap } from '@ngrx/store';\n\nimport { daffCompositeProductEntitiesReducer } from './composite-product-entities/composite-product-entities.reducer';\nimport { DaffCompositeProductReducersState } from './composite-product-reducers-state.interface';\n\n/**\n * Returns state values from all composite product related reducers.\n */\nexport const daffCompositeProductReducers: ActionReducerMap<DaffCompositeProductReducersState> = {\n compositeProductOptions: daffCompositeProductEntitiesReducer,\n};\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\nimport { ActionReducer } from '@ngrx/store';\n\nimport { DaffCompositeProductReducersState } from '../composite-product-reducers-state.interface';\n\n/**\n * A token to hold the injectable extra reducers.\n *\n * Prefer using {@link daffProductCompositeProvideExtraReducers}.\n */\nexport const DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS = new InjectionToken<ActionReducer<DaffCompositeProductReducersState>[]>(\n 'DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS',\n { factory: () => []},\n);\n\n/**\n * Provides additional reducers that run after the standard Daffodil cart reducers.\n *\n * ```ts\n * providers: [\n * ...daffProductCompositeProvideExtraReducers(\n * myReducer1,\n * myReducer2\n * )\n * ]\n * ```\n */\nexport function daffProductCompositeProvideExtraReducers(\n ...reducers: ActionReducer<Partial<DaffCompositeProductReducersState>>[]\n): Provider[] {\n return reducers.map(reducer => ({\n provide: DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS,\n useValue: reducer,\n multi: true,\n }));\n}\n","import { DaffProductTypeEnum } from '@daffodil/product';\nimport { DaffCompositeProduct } from '@daffodil/product-composite';\nimport { DaffProductReducersState } from '@daffodil/product/state';\n\n/**\n * Maps a list of products, ensuring that the composite products have a list of items.\n * If the incoming items is empty or nully, the items from state are intentionally used instead.\n */\nexport function daffProductCompositeEnsureItems<T extends DaffCompositeProduct = DaffCompositeProduct>(state: DaffProductReducersState<T>, products: T[]): T[] {\n return products.map((product) =>\n product.type === DaffProductTypeEnum.Composite\n ? {\n ...product,\n items: product.items.length > 0\n ? product.items\n : state.products.entities[product.id]?.items ?? [],\n }\n : product,\n );\n}\n","import { ActionReducer } from '@ngrx/store';\n\nimport { DaffProductTypeEnum } from '@daffodil/product';\nimport { DaffCompositeProduct } from '@daffodil/product-composite';\nimport {\n DaffProductActionTypes,\n DaffProductActions,\n DaffProductLoadSuccess,\n DaffProductPageActionTypes,\n DaffProductPageActions,\n DaffProductPageLoadSuccess,\n DaffProductReducersState,\n} from '@daffodil/product/state';\n\nimport { daffProductCompositeEnsureItems } from '../helpers/public_api';\n\ntype Reducer = ActionReducer<DaffProductReducersState<DaffCompositeProduct>, DaffProductActions<DaffCompositeProduct> | DaffProductPageActions<DaffCompositeProduct>>;\n\nexport function daffProductCompositeEnsureItemsMetaReducer(reducer: Reducer): Reducer {\n return (state, action) => {\n switch (action.type) {\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return reducer(state, new DaffProductPageLoadSuccess({\n ...action.payload,\n products: daffProductCompositeEnsureItems(state, action.payload.products),\n }));\n\n case DaffProductActionTypes.ProductLoadSuccessAction:\n return reducer(state, new DaffProductLoadSuccess({\n ...action.payload,\n products: daffProductCompositeEnsureItems(state, action.payload.products),\n }));\n\n default:\n return reducer(state, action);\n }\n };\n}\n","import {\n inject,\n InjectionToken,\n} from '@angular/core';\nimport {\n ActionReducer,\n combineReducers,\n} from '@ngrx/store';\n\nimport { daffComposeReducers } from '@daffodil/core/state';\n\nimport { daffCompositeProductReducers } from '../composite-product-reducers';\nimport { DaffCompositeProductReducersState } from '../composite-product-reducers-state.interface';\nimport { DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS } from './extra.token';\n\n/**\n * An internal token to hold the Daffodil composite product reducers.\n * Includes the extra and standard reducers.\n *\n * @docs-private\n */\nexport const DAFF_PRODUCT_COMPOSITE_REDUCERS = new InjectionToken<ActionReducer<DaffCompositeProductReducersState>>(\n 'DAFF_PRODUCT_COMPOSITE_REDUCERS',\n {\n factory: () => daffComposeReducers([\n combineReducers(daffCompositeProductReducers),\n ...inject(DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS),\n ]),\n },\n);\n","import { NgModule } from '@angular/core';\nimport { StoreModule } from '@ngrx/store';\n\nimport { daffProductProvideMetaReducers } from '@daffodil/product/state';\n\nimport { daffProductCompositeEnsureItemsMetaReducer } from './reducers/ensure-items.meta-reducer';\nimport { DAFF_PRODUCT_COMPOSITE_REDUCERS } from './reducers/injection-tokens/reducers.token';\nimport { DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY } from './reducers/public_api';\n\n/**\n * A module that provides the default reducers and effects for composite product redux state.\n */\n@NgModule({\n imports: [\n StoreModule.forFeature(DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY, DAFF_PRODUCT_COMPOSITE_REDUCERS),\n ],\n providers: [\n ...daffProductProvideMetaReducers(daffProductCompositeEnsureItemsMetaReducer),\n ],\n})\nexport class DaffCompositeProductStateModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAQA;;AAEG;IACS,gCAEX;AAFD,CAAA,UAAY,+BAA+B,EAAA;AACzC,IAAA,+BAAA,CAAA,mCAAA,CAAA,GAAA,2DAA+F,CAAA;AACjG,CAAC,EAFW,+BAA+B,KAA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