@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
@@ -1,134 +1,107 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable } from '@angular/core';
3
- import { faker } from '@faker-js/faker/locale/en_US';
4
3
  import { DaffModelFactory } from '@daffodil/core/testing';
5
4
  import { DaffProductTypeEnum } from '@daffodil/product';
6
- import { DaffCompositeProductItemInputEnum } from '@daffodil/product-composite';
7
5
  import { MockProduct } from '@daffodil/product/testing';
6
+ import { faker } from '@faker-js/faker/locale/en_US';
7
+ import { DaffCompositeProductItemInputEnum } from '@daffodil/product-composite';
8
8
 
9
9
  /**
10
- * Mocked DaffCompositeProduct object.
11
- *
12
- * @deprecated import from @daffodil/product-composite/testing instead.
10
+ * Mocked DaffCompositeProductItemOption object.
13
11
  */
14
- class MockCompositeProduct extends MockProduct {
12
+ class MockCompositeProductItemOption extends MockProduct {
15
13
  constructor() {
16
14
  super(...arguments);
17
- this.type = DaffProductTypeEnum.Composite;
18
- this.items = [
19
- {
20
- id: faker.datatype.uuid(),
21
- url: `/${faker.internet.domainWord()}.html`,
22
- required: faker.datatype.boolean(),
23
- title: faker.commerce.productName(),
24
- input_type: DaffCompositeProductItemInputEnum.select,
25
- options: [
26
- {
27
- id: faker.datatype.uuid(),
28
- type: DaffProductTypeEnum.Simple,
29
- url: `/${faker.internet.domainWord()}.html`,
30
- name: faker.commerce.productMaterial(),
31
- price: faker.datatype.number({ min: 1, max: 100 }),
32
- images: [],
33
- thumbnail: null,
34
- discount: {
35
- amount: 0,
36
- percent: 0,
37
- },
38
- quantity: faker.datatype.number({ min: 1, max: 9 }),
39
- is_default: true,
40
- in_stock: true,
41
- related: [],
42
- upsell: [],
43
- },
44
- {
45
- id: faker.datatype.uuid(),
46
- type: DaffProductTypeEnum.Simple,
47
- url: `/${faker.internet.domainWord()}.html`,
48
- name: faker.commerce.productMaterial(),
49
- price: faker.datatype.number({ min: 1, max: 100 }),
50
- images: [],
51
- thumbnail: null,
52
- discount: {
53
- amount: 0,
54
- percent: 0,
55
- },
56
- quantity: faker.datatype.number({ min: 1, max: 9 }),
57
- is_default: false,
58
- in_stock: true,
59
- related: [],
60
- upsell: [],
61
- },
62
- ],
63
- },
64
- {
65
- id: faker.datatype.uuid(),
66
- url: `/${faker.internet.domainWord()}.html`,
67
- required: faker.datatype.boolean(),
68
- title: faker.commerce.productName(),
69
- input_type: DaffCompositeProductItemInputEnum.select,
70
- options: [
71
- {
72
- id: faker.datatype.uuid(),
73
- type: DaffProductTypeEnum.Simple,
74
- url: `/${faker.internet.domainWord()}.html`,
75
- name: faker.commerce.productMaterial(),
76
- price: faker.datatype.number({ min: 1, max: 100 }),
77
- images: [],
78
- thumbnail: null,
79
- discount: {
80
- amount: 0,
81
- percent: 0,
82
- },
83
- quantity: faker.datatype.number({ min: 1, max: 9 }),
84
- is_default: true,
85
- in_stock: true,
86
- related: [],
87
- upsell: [],
88
- },
89
- {
90
- id: faker.datatype.uuid(),
91
- type: DaffProductTypeEnum.Simple,
92
- url: `/${faker.internet.domainWord()}.html`,
93
- name: faker.commerce.productMaterial(),
94
- price: faker.datatype.number({ min: 1, max: 100 }),
95
- images: [],
96
- thumbnail: null,
97
- discount: {
98
- amount: 0,
99
- percent: 0,
100
- },
101
- quantity: faker.datatype.number({ min: 1, max: 9 }),
102
- is_default: false,
103
- in_stock: true,
104
- related: [],
105
- upsell: [],
106
- },
107
- ],
108
- },
15
+ this.quantity = faker.datatype.number({ min: 1, max: 9 });
16
+ this.is_default = faker.datatype.boolean();
17
+ }
18
+ }
19
+ /**
20
+ * Factory for creating DaffCompositeProductItemOptions.
21
+ */
22
+ class DaffCompositeProductItemOptionFactory extends DaffModelFactory {
23
+ constructor() {
24
+ super(MockCompositeProductItemOption);
25
+ }
26
+ }
27
+ /** @nocollapse */ DaffCompositeProductItemOptionFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductItemOptionFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
28
+ /** @nocollapse */ DaffCompositeProductItemOptionFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductItemOptionFactory, providedIn: 'root' });
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductItemOptionFactory, decorators: [{
30
+ type: Injectable,
31
+ args: [{
32
+ providedIn: 'root',
33
+ }]
34
+ }], ctorParameters: function () { return []; } });
35
+
36
+ /**
37
+ * Mocked DaffCompositeProductItem object.
38
+ */
39
+ class MockCompositeProductItem {
40
+ constructor(optionFactory) {
41
+ this.optionFactory = optionFactory;
42
+ this.id = faker.datatype.uuid();
43
+ this.url = `/${faker.internet.domainWord()}.html`;
44
+ this.required = faker.datatype.boolean();
45
+ this.title = faker.commerce.productName();
46
+ this.input_type = DaffCompositeProductItemInputEnum.select;
47
+ this.options = [
48
+ this.optionFactory.create({
49
+ is_default: true,
50
+ }),
51
+ this.optionFactory.create({
52
+ is_default: false,
53
+ }),
109
54
  ];
110
55
  }
111
56
  }
57
+ /**
58
+ * Factory for creating DaffCompositeProductItems.
59
+ */
60
+ class DaffCompositeProductItemFactory extends DaffModelFactory {
61
+ constructor(optionFactory) {
62
+ super(MockCompositeProductItem, optionFactory);
63
+ }
64
+ }
65
+ /** @nocollapse */ DaffCompositeProductItemFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductItemFactory, deps: [{ token: DaffCompositeProductItemOptionFactory }], target: i0.ɵɵFactoryTarget.Injectable });
66
+ /** @nocollapse */ DaffCompositeProductItemFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductItemFactory, providedIn: 'root' });
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductItemFactory, decorators: [{
68
+ type: Injectable,
69
+ args: [{
70
+ providedIn: 'root',
71
+ }]
72
+ }], ctorParameters: function () { return [{ type: DaffCompositeProductItemOptionFactory }]; } });
73
+
74
+ /**
75
+ * Mocked DaffCompositeProduct object.
76
+ */
77
+ class MockCompositeProduct extends MockProduct {
78
+ constructor(itemFactory) {
79
+ super();
80
+ this.itemFactory = itemFactory;
81
+ this.type = DaffProductTypeEnum.Composite;
82
+ this.items = this.itemFactory.createMany(2);
83
+ }
84
+ }
112
85
  /**
113
86
  * Factory for creating DaffCompositeProducts.
114
87
  */
115
88
  class DaffCompositeProductFactory extends DaffModelFactory {
116
- constructor() {
117
- super(MockCompositeProduct);
89
+ constructor(itemFactory) {
90
+ super(MockCompositeProduct, itemFactory);
118
91
  }
119
92
  }
120
- /** @nocollapse */ DaffCompositeProductFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
93
+ /** @nocollapse */ DaffCompositeProductFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductFactory, deps: [{ token: DaffCompositeProductItemFactory }], target: i0.ɵɵFactoryTarget.Injectable });
121
94
  /** @nocollapse */ DaffCompositeProductFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductFactory, providedIn: 'root' });
122
95
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffCompositeProductFactory, decorators: [{
123
96
  type: Injectable,
124
97
  args: [{
125
98
  providedIn: 'root',
126
99
  }]
127
- }], ctorParameters: function () { return []; } });
100
+ }], ctorParameters: function () { return [{ type: DaffCompositeProductItemFactory }]; } });
128
101
 
129
102
  /**
130
103
  * Generated bundle index. Do not edit.
131
104
  */
132
105
 
133
- export { DaffCompositeProductFactory, MockCompositeProduct };
106
+ export { DaffCompositeProductFactory, DaffCompositeProductItemFactory, DaffCompositeProductItemOptionFactory, MockCompositeProduct, MockCompositeProductItem, MockCompositeProductItemOption };
134
107
  //# sourceMappingURL=daffodil-product-composite-testing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-product-composite-testing.mjs","sources":["../../../libs/product-composite/testing/src/factories/composite-product.factory.ts","../../../libs/product-composite/testing/src/daffodil-product-composite-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProductTypeEnum } from '@daffodil/product';\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItemInputEnum,\n} from '@daffodil/product-composite';\nimport { MockProduct } from '@daffodil/product/testing';\n\n/**\n * Mocked DaffCompositeProduct object.\n *\n * @deprecated import from @daffodil/product-composite/testing instead.\n */\nexport class MockCompositeProduct extends MockProduct implements DaffCompositeProduct {\n type = DaffProductTypeEnum.Composite;\n items = [\n\t {\n\t id: faker.datatype.uuid(),\n\t url: `/${faker.internet.domainWord()}.html`,\n\t required: faker.datatype.boolean(),\n\t title: faker.commerce.productName(),\n\t input_type: DaffCompositeProductItemInputEnum.select,\n\t options: [\n\t {\n\t id: faker.datatype.uuid(),\n\t type: DaffProductTypeEnum.Simple,\n\t url: `/${faker.internet.domainWord()}.html`,\n\t name: faker.commerce.productMaterial(),\n\t price: faker.datatype.number({ min: 1, max: 100 }),\n\t images: [],\n\t thumbnail: null,\n\t discount: {\n\t amount: 0,\n\t percent: 0,\n\t },\n\t quantity: faker.datatype.number({ min: 1, max: 9 }),\n\t is_default: true,\n\t in_stock: true,\n\t related: [],\n\t upsell: [],\n\t },\n\t {\n\t id: faker.datatype.uuid(),\n\t type: DaffProductTypeEnum.Simple,\n\t url: `/${faker.internet.domainWord()}.html`,\n\t name: faker.commerce.productMaterial(),\n\t price: faker.datatype.number({ min: 1, max: 100 }),\n\t images: [],\n\t thumbnail: null,\n\t discount: {\n\t amount: 0,\n\t percent: 0,\n\t },\n\t quantity: faker.datatype.number({ min: 1, max: 9 }),\n\t is_default: false,\n\t in_stock: true,\n\t related: [],\n\t upsell: [],\n\t },\n\t ],\n\t },\n\t {\n\t id: faker.datatype.uuid(),\n\t url: `/${faker.internet.domainWord()}.html`,\n\t required: faker.datatype.boolean(),\n\t title: faker.commerce.productName(),\n\t input_type: DaffCompositeProductItemInputEnum.select,\n\t options: [\n\t {\n\t id: faker.datatype.uuid(),\n\t type: DaffProductTypeEnum.Simple,\n\t url: `/${faker.internet.domainWord()}.html`,\n\t name: faker.commerce.productMaterial(),\n\t price: faker.datatype.number({ min: 1, max: 100 }),\n\t images: [],\n\t thumbnail: null,\n\t discount: {\n\t amount: 0,\n\t percent: 0,\n\t },\n\t quantity: faker.datatype.number({ min: 1, max: 9 }),\n\t is_default: true,\n\t in_stock: true,\n\t related: [],\n\t upsell: [],\n\t },\n\t {\n\t id: faker.datatype.uuid(),\n\t type: DaffProductTypeEnum.Simple,\n\t url: `/${faker.internet.domainWord()}.html`,\n\t name: faker.commerce.productMaterial(),\n\t price: faker.datatype.number({ min: 1, max: 100 }),\n\t images: [],\n\t thumbnail: null,\n\t discount: {\n\t amount: 0,\n\t percent: 0,\n\t },\n\t quantity: faker.datatype.number({ min: 1, max: 9 }),\n\t is_default: false,\n\t in_stock: true,\n\t related: [],\n\t upsell: [],\n\t },\n\t ],\n\t },\n ];\n}\n\n/**\n * Factory for creating DaffCompositeProducts.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCompositeProductFactory extends DaffModelFactory<DaffCompositeProduct>{\n constructor(){\n super(MockCompositeProduct);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAWA;;;;AAIG;AACG,MAAO,oBAAqB,SAAQ,WAAW,CAAA;AAArD,IAAA,WAAA,GAAA;;AACE,QAAA,IAAA,CAAA,IAAI,GAAG,mBAAmB,CAAC,SAAS,CAAC;AACrC,QAAA,IAAA,CAAA,KAAK,GAAG;AACP,YAAA;AACE,gBAAA,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE;gBACzB,GAAG,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAO,KAAA,CAAA;AAC3C,gBAAA,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE;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A;AACF,aAAA;SACD,CAAC;KACH;AAAA,CAAA;AAED;;AAEG;AAIG,MAAO,2BAA4B,SAAQ,gBAAsC,CAAA;AACrF,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,oBAAoB,CAAC,CAAC;KAC7B;;2IAHU,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,mBAAA,2BAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cAF1B,MAAM,EAAA,CAAA,CAAA;2FAEP,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAHvC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACrHD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-product-composite-testing.mjs","sources":["../../../libs/product-composite/testing/src/factories/composite-product-item-option.factory.ts","../../../libs/product-composite/testing/src/factories/composite-product-item.factory.ts","../../../libs/product-composite/testing/src/factories/composite-product.factory.ts","../../../libs/product-composite/testing/src/daffodil-product-composite-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffCompositeProductItemOption } from '@daffodil/product-composite';\nimport { MockProduct } from '@daffodil/product/testing';\n\n/**\n * Mocked DaffCompositeProductItemOption object.\n */\nexport class MockCompositeProductItemOption extends MockProduct implements DaffCompositeProductItemOption {\n quantity = faker.datatype.number({ min: 1, max: 9 });\n is_default = faker.datatype.boolean();\n}\n\n/**\n * Factory for creating DaffCompositeProductItemOptions.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCompositeProductItemOptionFactory extends DaffModelFactory<DaffCompositeProductItemOption>{\n constructor() {\n super(MockCompositeProductItemOption);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n DaffCompositeProductItem,\n DaffCompositeProductItemInputEnum,\n} from '@daffodil/product-composite';\n\nimport { DaffCompositeProductItemOptionFactory } from './composite-product-item-option.factory';\n\n/**\n * Mocked DaffCompositeProductItem object.\n */\nexport class MockCompositeProductItem implements DaffCompositeProductItem {\n id = faker.datatype.uuid();\n url = `/${faker.internet.domainWord()}.html`;\n required = faker.datatype.boolean();\n title = faker.commerce.productName();\n input_type = DaffCompositeProductItemInputEnum.select;\n options = [\n this.optionFactory.create({\n is_default: true,\n }),\n this.optionFactory.create({\n is_default: false,\n }),\n ];\n\n constructor(\n protected optionFactory: DaffCompositeProductItemOptionFactory,\n ) {}\n}\n\n/**\n * Factory for creating DaffCompositeProductItems.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCompositeProductItemFactory extends DaffModelFactory<DaffCompositeProductItem>{\n constructor(\n optionFactory: DaffCompositeProductItemOptionFactory,\n ) {\n super(MockCompositeProductItem, optionFactory);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { DaffProductTypeEnum } from '@daffodil/product';\nimport { DaffCompositeProduct } from '@daffodil/product-composite';\nimport { MockProduct } from '@daffodil/product/testing';\n\nimport { DaffCompositeProductItemFactory } from './composite-product-item.factory';\n\n/**\n * Mocked DaffCompositeProduct object.\n */\nexport class MockCompositeProduct extends MockProduct implements DaffCompositeProduct {\n type = DaffProductTypeEnum.Composite;\n items = this.itemFactory.createMany(2);\n\n constructor(\n protected itemFactory: DaffCompositeProductItemFactory,\n ) {\n super();\n }\n}\n\n/**\n * Factory for creating DaffCompositeProducts.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCompositeProductFactory extends DaffModelFactory<DaffCompositeProduct>{\n constructor(\n itemFactory: DaffCompositeProductItemFactory,\n ) {\n super(MockCompositeProduct, itemFactory);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.DaffCompositeProductItemOptionFactory","i1.DaffCompositeProductItemFactory"],"mappings":";;;;;;;;AAOA;;AAEG;AACG,MAAO,8BAA+B,SAAQ,WAAW,CAAA;AAA/D,IAAA,WAAA,GAAA;;AACE,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AACrD,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;KACvC;AAAA,CAAA;AAED;;AAEG;AAIG,MAAO,qCAAsC,SAAQ,gBAAgD,CAAA;AACzG,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,8BAA8B,CAAC,CAAC;KACvC;;qJAHU,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArC,mBAAA,qCAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qCAAqC,cAFpC,MAAM,EAAA,CAAA,CAAA;2FAEP,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAHjD,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACTD;;AAEG;MACU,wBAAwB,CAAA;AAenC,IAAA,WAAA,CACY,aAAoD,EAAA;QAApD,IAAa,CAAA,aAAA,GAAb,aAAa,CAAuC;AAfhE,QAAA,IAAA,CAAA,EAAE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iBAAA,CAAA;;;AC7BD;;AAEG;AACG,MAAO,oBAAqB,SAAQ,WAAW,CAAA;AAInD,IAAA,WAAA,CACY,WAA4C,EAAA;AAEtD,QAAA,KAAK,EAAE,CAAC;QAFE,IAAW,CAAA,WAAA,GAAX,WAAW,CAAiC;AAJxD,QAAA,IAAA,CAAA,IAAI,GAAG,mBAAmB,CAAC,SAAS,CAAC;QACrC,IAAK,CAAA,KAAA,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KAMtC;AACF,CAAA;AAED;;AAEG;AAIG,MAAO,2BAA4B,SAAQ,gBAAsC,CAAA;AACrF,IAAA,WAAA,CACE,WAA4C,EAAA;AAE5C,QAAA,KAAK,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;KAC1C;;2IALU,2BAA2B,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAC,+BAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,mBAAA,2BAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cAF1B,MAAM,EAAA,CAAA,CAAA;2FAEP,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAHvC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;AC7BD;;AAEG;;;;"}
@@ -1,3 +1,13 @@
1
+ function daffProductCompositeBuildSelectionPayload(appliedOptions) {
2
+ return Object.keys(appliedOptions).reduce((selection, itemId) => {
3
+ const optionId = appliedOptions[itemId].id;
4
+ if (optionId) {
5
+ selection[itemId] = [optionId];
6
+ }
7
+ return selection;
8
+ }, {});
9
+ }
10
+
1
11
  /**
2
12
  * An enum for whether a composite product item should be displayed as a radio or select input.
3
13
  */
@@ -11,5 +21,5 @@ var DaffCompositeProductItemInputEnum;
11
21
  * Generated bundle index. Do not edit.
12
22
  */
13
23
 
14
- export { DaffCompositeProductItemInputEnum };
24
+ export { DaffCompositeProductItemInputEnum, daffProductCompositeBuildSelectionPayload };
15
25
  //# sourceMappingURL=daffodil-product-composite.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-product-composite.mjs","sources":["../../../libs/product-composite/src/models/composite-product-item.ts","../../../libs/product-composite/src/daffodil-product-composite.ts"],"sourcesContent":["import { DaffIdentifiable } from '@daffodil/core';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * An enum for whether a composite product item should be displayed as a radio or select input.\n */\nexport enum DaffCompositeProductItemInputEnum {\n select = 'select',\n radio = 'radio'\n}\n\n/**\n * The composite product item describes one set of product options that the user can add to the composite product.\n * A composite product item can be required or optional. If it is required, an option _must_ be chosen in order to add the product to the cart.\n * If the item is optional, the product can be added to the cart without an option having been chosen.\n * For example, if a composite product is a toolbox bundle, a composite product item might be a screw driver, and the options contained in that\n * item might be a phillips head and a flathead. The customer could choose to add either a phillips head or a flathead to the\n * composite product, or neither if the item is optional.\n */\nexport interface DaffCompositeProductItem extends DaffIdentifiable {\n /**\n * Whether the item is required or optional.\n */\n required: boolean;\n /**\n * The title label for the item.\n */\n title: string;\n /**\n * Describes how the item should be displayed.\n */\n input_type: DaffCompositeProductItemInputEnum;\n /**\n * The options that may be chosen for the item.\n */\n options: DaffCompositeProductItemOption[];\n}\n\n/**\n * The composite product item option is a DaffProduct that can be added to a composite product.\n */\nexport interface DaffCompositeProductItemOption extends DaffProduct {\n /**\n * Whether the option is the default option for its parent {@link DaffCompositeProductItem}.\n */\n is_default: boolean;\n /**\n * The quantity chosen for the option.\n */\n quantity: number;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAGA;;AAEG;IACS,kCAGX;AAHD,CAAA,UAAY,iCAAiC,EAAA;AAC3C,IAAA,iCAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,iCAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EAHW,iCAAiC,KAAjC,iCAAiC,GAG5C,EAAA,CAAA,CAAA;;ACTD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-product-composite.mjs","sources":["../../../libs/product-composite/src/helpers/build-selection-payload.ts","../../../libs/product-composite/src/models/composite-product-item.ts","../../../libs/product-composite/src/daffodil-product-composite.ts"],"sourcesContent":["import {\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n DaffProductCompositeSelectionPayload,\n} from '../models/public_api';\n\nexport function daffProductCompositeBuildSelectionPayload(appliedOptions: Record<DaffCompositeProductItem['id'], DaffCompositeProductItemOption>): DaffProductCompositeSelectionPayload {\n return Object.keys(appliedOptions).reduce<DaffProductCompositeSelectionPayload>(\n (selection, itemId) => {\n const optionId = appliedOptions[itemId].id;\n\n if (optionId) {\n selection[itemId] = [optionId];\n }\n\n return selection;\n },\n {},\n );\n}\n","import { DaffIdentifiable } from '@daffodil/core';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * An enum for whether a composite product item should be displayed as a radio or select input.\n */\nexport enum DaffCompositeProductItemInputEnum {\n select = 'select',\n radio = 'radio'\n}\n\n/**\n * The composite product item describes one set of product options that the user can add to the composite product.\n * A composite product item can be required or optional. If it is required, an option _must_ be chosen in order to add the product to the cart.\n * If the item is optional, the product can be added to the cart without an option having been chosen.\n * For example, if a composite product is a toolbox bundle, a composite product item might be a screw driver, and the options contained in that\n * item might be a phillips head and a flathead. The customer could choose to add either a phillips head or a flathead to the\n * composite product, or neither if the item is optional.\n */\nexport interface DaffCompositeProductItem extends DaffIdentifiable {\n /**\n * Whether the item is required or optional.\n */\n required: boolean;\n /**\n * The title label for the item.\n */\n title: string;\n /**\n * Describes how the item should be displayed.\n */\n input_type: DaffCompositeProductItemInputEnum;\n /**\n * The options that may be chosen for the item.\n */\n options: DaffCompositeProductItemOption[];\n}\n\n/**\n * The composite product item option is a DaffProduct that can be added to a composite product.\n */\nexport interface DaffCompositeProductItemOption extends DaffProduct {\n /**\n * Whether the option is the default option for its parent {@link DaffCompositeProductItem}.\n */\n is_default: boolean;\n /**\n * The quantity chosen for the option.\n */\n quantity: number;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAMM,SAAU,yCAAyC,CAAC,cAAsF,EAAA;AAC9I,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,MAAM,CACvC,CAAC,SAAS,EAAE,MAAM,KAAI;QACpB,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AAE3C,QAAA,IAAI,QAAQ,EAAE;AACZ,YAAA,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAChC,SAAA;AAED,QAAA,OAAO,SAAS,CAAC;KAClB,EACD,EAAE,CACH,CAAC;AACJ;;AChBA;;AAEG;IACS,kCAGX;AAHD,CAAA,UAAY,iCAAiC,EAAA;AAC3C,IAAA,iCAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,iCAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EAHW,iCAAiC,KAAjC,iCAAiC,GAG5C,EAAA,CAAA,CAAA;;ACTD;;AAEG;;;;"}
@@ -0,0 +1,2 @@
1
+ import { DaffCompositeProductItem, DaffCompositeProductItemOption, DaffProductCompositeSelectionPayload } from '../models/public_api';
2
+ export declare function daffProductCompositeBuildSelectionPayload(appliedOptions: Record<DaffCompositeProductItem['id'], DaffCompositeProductItemOption>): DaffProductCompositeSelectionPayload;
@@ -0,0 +1 @@
1
+ export { daffProductCompositeBuildSelectionPayload } from './build-selection-payload';
@@ -0,0 +1,4 @@
1
+ export * from './composite-configuration-item';
2
+ export * from './composite-product';
3
+ export * from './composite-product-item';
4
+ export * from './selection-payload.type';
@@ -0,0 +1,5 @@
1
+ import { DaffCompositeProductItem, DaffCompositeProductItemOption } from './composite-product-item';
2
+ /**
3
+ * Denotes a particular configuration for a composite item.
4
+ */
5
+ export declare type DaffProductCompositeSelectionPayload = Record<DaffCompositeProductItem['id'], DaffCompositeProductItemOption['id'][]>;
package/package.json CHANGED
@@ -1,124 +1 @@
1
- {
2
- "name": "@daffodil/product-composite",
3
- "nx": {
4
- "targets": {
5
- "build": {
6
- "outputs": [
7
- "{workspaceRoot}/dist/product-composite"
8
- ]
9
- }
10
- }
11
- },
12
- "version": "0.58.10",
13
- "description": "Interfaces built for daffodil/state",
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/graycoreio/daffodil"
17
- },
18
- "author": "Graycore LLC",
19
- "license": "MIT",
20
- "bugs": {
21
- "url": "https://github.com/graycoreio/daffodil/issues"
22
- },
23
- "publishConfig": {
24
- "directory": "../../dist/product-composite"
25
- },
26
- "homepage": "https://github.com/graycoreio/daffodil",
27
- "peerDependencies": {
28
- "@angular/common": "^13.0.0",
29
- "@angular/core": "^13.0.0",
30
- "@daffodil/core": "0.58.10",
31
- "@daffodil/product": "0.58.10",
32
- "@ngrx/effects": "^13.0.0",
33
- "@ngrx/entity": "^13.0.0",
34
- "@ngrx/store": "^13.0.0",
35
- "rxjs": "7.5.5"
36
- },
37
- "optionalDependencies": {
38
- "@apollo/client": "^3.0.0",
39
- "@daffodil/driver": "0.58.10",
40
- "@daffodil/product": "0.58.10",
41
- "angular-in-memory-web-api": "^0.13.0",
42
- "apollo-angular": "^3.0.1",
43
- "@faker-js/faker": "^7.6.0"
44
- },
45
- "module": "fesm2015/daffodil-product-composite.mjs",
46
- "es2020": "fesm2020/daffodil-product-composite.mjs",
47
- "esm2020": "esm2020/daffodil-product-composite.mjs",
48
- "fesm2020": "fesm2020/daffodil-product-composite.mjs",
49
- "fesm2015": "fesm2015/daffodil-product-composite.mjs",
50
- "typings": "daffodil-product-composite.d.ts",
51
- "exports": {
52
- "./package.json": {
53
- "default": "./package.json"
54
- },
55
- ".": {
56
- "types": "./daffodil-product-composite.d.ts",
57
- "esm2020": "./esm2020/daffodil-product-composite.mjs",
58
- "es2020": "./fesm2020/daffodil-product-composite.mjs",
59
- "es2015": "./fesm2015/daffodil-product-composite.mjs",
60
- "node": "./fesm2015/daffodil-product-composite.mjs",
61
- "default": "./fesm2020/daffodil-product-composite.mjs"
62
- },
63
- "./driver/in-memory": {
64
- "types": "./driver/in-memory/daffodil-product-composite-driver-in-memory.d.ts",
65
- "esm2020": "./esm2020/driver/in-memory/daffodil-product-composite-driver-in-memory.mjs",
66
- "es2020": "./fesm2020/daffodil-product-composite-driver-in-memory.mjs",
67
- "es2015": "./fesm2015/daffodil-product-composite-driver-in-memory.mjs",
68
- "node": "./fesm2015/daffodil-product-composite-driver-in-memory.mjs",
69
- "default": "./fesm2020/daffodil-product-composite-driver-in-memory.mjs"
70
- },
71
- "./driver/magento": {
72
- "types": "./driver/magento/daffodil-product-composite-driver-magento.d.ts",
73
- "esm2020": "./esm2020/driver/magento/daffodil-product-composite-driver-magento.mjs",
74
- "es2020": "./fesm2020/daffodil-product-composite-driver-magento.mjs",
75
- "es2015": "./fesm2015/daffodil-product-composite-driver-magento.mjs",
76
- "node": "./fesm2015/daffodil-product-composite-driver-magento.mjs",
77
- "default": "./fesm2020/daffodil-product-composite-driver-magento.mjs"
78
- },
79
- "./driver/magento/testing": {
80
- "types": "./driver/magento/testing/daffodil-product-composite-driver-magento-testing.d.ts",
81
- "esm2020": "./esm2020/driver/magento/testing/daffodil-product-composite-driver-magento-testing.mjs",
82
- "es2020": "./fesm2020/daffodil-product-composite-driver-magento-testing.mjs",
83
- "es2015": "./fesm2015/daffodil-product-composite-driver-magento-testing.mjs",
84
- "node": "./fesm2015/daffodil-product-composite-driver-magento-testing.mjs",
85
- "default": "./fesm2020/daffodil-product-composite-driver-magento-testing.mjs"
86
- },
87
- "./driver/testing": {
88
- "types": "./driver/testing/daffodil-product-composite-driver-testing.d.ts",
89
- "esm2020": "./esm2020/driver/testing/daffodil-product-composite-driver-testing.mjs",
90
- "es2020": "./fesm2020/daffodil-product-composite-driver-testing.mjs",
91
- "es2015": "./fesm2015/daffodil-product-composite-driver-testing.mjs",
92
- "node": "./fesm2015/daffodil-product-composite-driver-testing.mjs",
93
- "default": "./fesm2020/daffodil-product-composite-driver-testing.mjs"
94
- },
95
- "./state": {
96
- "types": "./state/daffodil-product-composite-state.d.ts",
97
- "esm2020": "./esm2020/state/daffodil-product-composite-state.mjs",
98
- "es2020": "./fesm2020/daffodil-product-composite-state.mjs",
99
- "es2015": "./fesm2015/daffodil-product-composite-state.mjs",
100
- "node": "./fesm2015/daffodil-product-composite-state.mjs",
101
- "default": "./fesm2020/daffodil-product-composite-state.mjs"
102
- },
103
- "./state/testing": {
104
- "types": "./state/testing/daffodil-product-composite-state-testing.d.ts",
105
- "esm2020": "./esm2020/state/testing/daffodil-product-composite-state-testing.mjs",
106
- "es2020": "./fesm2020/daffodil-product-composite-state-testing.mjs",
107
- "es2015": "./fesm2015/daffodil-product-composite-state-testing.mjs",
108
- "node": "./fesm2015/daffodil-product-composite-state-testing.mjs",
109
- "default": "./fesm2020/daffodil-product-composite-state-testing.mjs"
110
- },
111
- "./testing": {
112
- "types": "./testing/daffodil-product-composite-testing.d.ts",
113
- "esm2020": "./esm2020/testing/daffodil-product-composite-testing.mjs",
114
- "es2020": "./fesm2020/daffodil-product-composite-testing.mjs",
115
- "es2015": "./fesm2015/daffodil-product-composite-testing.mjs",
116
- "node": "./fesm2015/daffodil-product-composite-testing.mjs",
117
- "default": "./fesm2020/daffodil-product-composite-testing.mjs"
118
- }
119
- },
120
- "sideEffects": false,
121
- "dependencies": {
122
- "tslib": "^2.3.0"
123
- }
124
- }
1
+ {"name":"@daffodil/product-composite","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/product-composite"]}}},"version":"0.59.1","description":"Interfaces built for daffodil/state","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"publishConfig":{"directory":"../../dist/product-composite"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^13.0.0","@angular/core":"^13.0.0","@daffodil/core":"0.59.1","@daffodil/product":"0.59.1","@ngrx/effects":"^13.0.0","@ngrx/entity":"^13.0.0","@ngrx/store":"^13.0.0","rxjs":"7.5.5"},"optionalDependencies":{"@apollo/client":"^3.0.0","@daffodil/driver":"0.59.1","@daffodil/product":"0.59.1","angular-in-memory-web-api":"^0.13.0","apollo-angular":"^3.0.1","@faker-js/faker":"^7.6.0"},"module":"fesm2015/daffodil-product-composite.mjs","es2020":"fesm2020/daffodil-product-composite.mjs","esm2020":"esm2020/daffodil-product-composite.mjs","fesm2020":"fesm2020/daffodil-product-composite.mjs","fesm2015":"fesm2015/daffodil-product-composite.mjs","typings":"daffodil-product-composite.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./daffodil-product-composite.d.ts","esm2020":"./esm2020/daffodil-product-composite.mjs","es2020":"./fesm2020/daffodil-product-composite.mjs","es2015":"./fesm2015/daffodil-product-composite.mjs","node":"./fesm2015/daffodil-product-composite.mjs","default":"./fesm2020/daffodil-product-composite.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/daffodil-product-composite-driver-in-memory.d.ts","esm2020":"./esm2020/driver/in-memory/daffodil-product-composite-driver-in-memory.mjs","es2020":"./fesm2020/daffodil-product-composite-driver-in-memory.mjs","es2015":"./fesm2015/daffodil-product-composite-driver-in-memory.mjs","node":"./fesm2015/daffodil-product-composite-driver-in-memory.mjs","default":"./fesm2020/daffodil-product-composite-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/daffodil-product-composite-driver-magento.d.ts","esm2020":"./esm2020/driver/magento/daffodil-product-composite-driver-magento.mjs","es2020":"./fesm2020/daffodil-product-composite-driver-magento.mjs","es2015":"./fesm2015/daffodil-product-composite-driver-magento.mjs","node":"./fesm2015/daffodil-product-composite-driver-magento.mjs","default":"./fesm2020/daffodil-product-composite-driver-magento.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/daffodil-product-composite-driver-magento-testing.d.ts","esm2020":"./esm2020/driver/magento/testing/daffodil-product-composite-driver-magento-testing.mjs","es2020":"./fesm2020/daffodil-product-composite-driver-magento-testing.mjs","es2015":"./fesm2015/daffodil-product-composite-driver-magento-testing.mjs","node":"./fesm2015/daffodil-product-composite-driver-magento-testing.mjs","default":"./fesm2020/daffodil-product-composite-driver-magento-testing.mjs"},"./driver/testing":{"types":"./driver/testing/daffodil-product-composite-driver-testing.d.ts","esm2020":"./esm2020/driver/testing/daffodil-product-composite-driver-testing.mjs","es2020":"./fesm2020/daffodil-product-composite-driver-testing.mjs","es2015":"./fesm2015/daffodil-product-composite-driver-testing.mjs","node":"./fesm2015/daffodil-product-composite-driver-testing.mjs","default":"./fesm2020/daffodil-product-composite-driver-testing.mjs"},"./routing":{"types":"./routing/daffodil-product-composite-routing.d.ts","esm2020":"./esm2020/routing/daffodil-product-composite-routing.mjs","es2020":"./fesm2020/daffodil-product-composite-routing.mjs","es2015":"./fesm2015/daffodil-product-composite-routing.mjs","node":"./fesm2015/daffodil-product-composite-routing.mjs","default":"./fesm2020/daffodil-product-composite-routing.mjs"},"./state":{"types":"./state/daffodil-product-composite-state.d.ts","esm2020":"./esm2020/state/daffodil-product-composite-state.mjs","es2020":"./fesm2020/daffodil-product-composite-state.mjs","es2015":"./fesm2015/daffodil-product-composite-state.mjs","node":"./fesm2015/daffodil-product-composite-state.mjs","default":"./fesm2020/daffodil-product-composite-state.mjs"},"./state/testing":{"types":"./state/testing/daffodil-product-composite-state-testing.d.ts","esm2020":"./esm2020/state/testing/daffodil-product-composite-state-testing.mjs","es2020":"./fesm2020/daffodil-product-composite-state-testing.mjs","es2015":"./fesm2015/daffodil-product-composite-state-testing.mjs","node":"./fesm2015/daffodil-product-composite-state-testing.mjs","default":"./fesm2020/daffodil-product-composite-state-testing.mjs"},"./testing":{"types":"./testing/daffodil-product-composite-testing.d.ts","esm2020":"./esm2020/testing/daffodil-product-composite-testing.mjs","es2020":"./fesm2020/daffodil-product-composite-testing.mjs","es2015":"./fesm2015/daffodil-product-composite-testing.mjs","node":"./fesm2015/daffodil-product-composite-testing.mjs","default":"./fesm2020/daffodil-product-composite-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
package/public_api.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './models/composite-configuration-item';
2
- export * from './models/composite-product';
3
- export * from './models/composite-product-item';
1
+ export * from './helpers/public_api';
2
+ export * from './models/public_api';
@@ -0,0 +1,6 @@
1
+ import { DaffBase64Service } from '@daffodil/core';
2
+ import { DaffProductCompositeRoutingConfig } from './interface';
3
+ /**
4
+ * The default configuration for the {@link DaffProductCompositeRoutingConfig}.
5
+ */
6
+ export declare const daffProductCompositeRoutingConfigDefaultFactory: (base64: DaffBase64Service) => DaffProductCompositeRoutingConfig;
@@ -0,0 +1,20 @@
1
+ import { DaffCompositeProduct, DaffProductCompositeSelectionPayload } from '@daffodil/product-composite';
2
+ /**
3
+ * An interface for providing `@daffodil/product-composite/routing` with necessary config values.
4
+ */
5
+ export interface DaffProductCompositeRoutingConfig {
6
+ /**
7
+ * The name of the query param for which a composite product page preselection can be defined.
8
+ * The value of this query param should be a {@link DaffProductCompositeSelectionPayload} after being base64 decoded and JSON parsed.
9
+ *
10
+ * Defaults to `composite_selection`.
11
+ */
12
+ compositeSelectionQueryParam?: string;
13
+ /**
14
+ * The function used to decode the value of the {@link DaffProductCompositeStateConfig#compositeSelectionQueryParam}
15
+ * into a {@link DaffProductCompositeSelectionPayload}.
16
+ *
17
+ * Defaults to `(queryParam: string) => JSON.parse(atob(queryParam))`.
18
+ */
19
+ compositeSelectionQueryParamDecode?: (queryParam: string, product: DaffCompositeProduct) => DaffProductCompositeSelectionPayload;
20
+ }
@@ -0,0 +1,3 @@
1
+ export { daffProductCompositeRoutingConfigDefaultFactory } from './default';
2
+ export { DaffProductCompositeRoutingConfig } from './interface';
3
+ export { DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG, daffProductCompositeRoutingProvideConfig, } from './token';
@@ -0,0 +1,10 @@
1
+ import { FactoryProvider, InjectionToken } from '@angular/core';
2
+ import { DaffProductCompositeRoutingConfig } from './interface';
3
+ /**
4
+ * The token used to provide @daffodil/product-composite/routing config data.
5
+ */
6
+ export declare const DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG: InjectionToken<DaffProductCompositeRoutingConfig>;
7
+ /**
8
+ * Provides the {@link DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG} token.
9
+ */
10
+ export declare function daffProductCompositeRoutingProvideConfig(config: Partial<DaffProductCompositeRoutingConfig>): FactoryProvider;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@daffodil/product-composite/routing" />
5
+ export * from './index';
@@ -0,0 +1,22 @@
1
+ import { Actions } from '@ngrx/effects';
2
+ import { EMPTY, Observable } from 'rxjs';
3
+ import { DaffCompositeProduct } from '@daffodil/product-composite';
4
+ import { DaffCompositeProductApplyOption } from '@daffodil/product-composite/state';
5
+ import { DaffProductCompositeRoutingConfig } from '../config/public_api';
6
+ import { DaffProductCompositeQueryParamService } from '../services/query-param.service';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * Handles composite product specific actions for the product page.
10
+ */
11
+ export declare class DaffProductCompositePageEffects<T extends DaffCompositeProduct = DaffCompositeProduct> {
12
+ private actions$;
13
+ private paramGetter;
14
+ private config;
15
+ constructor(actions$: Actions, paramGetter: DaffProductCompositeQueryParamService, config: DaffProductCompositeRoutingConfig);
16
+ /**
17
+ * Applies composite item options based on the value of the configured query param.
18
+ */
19
+ preselectCompositeOptions$: Observable<typeof EMPTY | DaffCompositeProductApplyOption<T>>;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductCompositePageEffects<any>, never>;
21
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductCompositePageEffects<any>>;
22
+ }
@@ -0,0 +1 @@
1
+ export { DaffProductCompositePageEffects } from './product-page.effects';
@@ -0,0 +1 @@
1
+ export * from './public_api';
@@ -0,0 +1,10 @@
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import { DaffProductCompositeRoutingConfig } from './config/public_api';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@ngrx/effects";
5
+ export declare class DaffProductCompositeRoutingModule {
6
+ static withConfig(config?: DaffProductCompositeRoutingConfig): ModuleWithProviders<DaffProductCompositeRoutingModule>;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductCompositeRoutingModule, never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffProductCompositeRoutingModule, never, [typeof i1.EffectsFeatureModule], never>;
9
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffProductCompositeRoutingModule>;
10
+ }
@@ -0,0 +1 @@
1
+ {"name":"@daffodil/product-composite/routing","module":"../fesm2015/daffodil-product-composite-routing.mjs","es2020":"../fesm2020/daffodil-product-composite-routing.mjs","esm2020":"../esm2020/routing/daffodil-product-composite-routing.mjs","fesm2020":"../fesm2020/daffodil-product-composite-routing.mjs","fesm2015":"../fesm2015/daffodil-product-composite-routing.mjs","typings":"daffodil-product-composite-routing.d.ts","sideEffects":false,"version":"0.59.1"}
@@ -0,0 +1,3 @@
1
+ export * from './config/public_api';
2
+ export * from './effects/public_api';
3
+ export * from './module';
@@ -0,0 +1,13 @@
1
+ import { DaffProductCompositeRoutingConfig } from '../config/public_api';
2
+ import * as i0 from "@angular/core";
3
+ export declare class DaffProductCompositeQueryParamService {
4
+ private document;
5
+ private config;
6
+ constructor(document: any, config: DaffProductCompositeRoutingConfig);
7
+ /**
8
+ * Get the value of the configured composite selection query param.
9
+ */
10
+ get(): string;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductCompositeQueryParamService, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductCompositeQueryParamService>;
13
+ }
@@ -13,7 +13,7 @@ export declare enum DaffCompositeProductActionTypes {
13
13
  * @param itemId - Id of the product item.
14
14
  * @param optionId - Id of the option of the product item that is chosen.
15
15
  */
16
- export declare class DaffCompositeProductApplyOption<T extends DaffCompositeProduct> implements Action {
16
+ export declare class DaffCompositeProductApplyOption<T extends DaffCompositeProduct = DaffCompositeProduct> implements Action {
17
17
  id: T['id'];
18
18
  itemId: DaffCompositeProductItem['id'];
19
19
  optionId: DaffCompositeProductItemOption['id'];