@daffodil/product-composite 0.88.1 → 0.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/driver/in-memory/index.d.ts +15 -1
  2. package/driver/magento/index.d.ts +133 -1
  3. package/driver/magento/testing/index.d.ts +62 -1
  4. package/driver/testing/index.d.ts +15 -1
  5. package/fesm2022/daffodil-product-composite-driver-in-memory.mjs +4 -4
  6. package/fesm2022/daffodil-product-composite-driver-in-memory.mjs.map +1 -1
  7. package/fesm2022/daffodil-product-composite-driver-magento-testing.mjs +9 -9
  8. package/fesm2022/daffodil-product-composite-driver-magento-testing.mjs.map +1 -1
  9. package/fesm2022/daffodil-product-composite-driver-magento.mjs +10 -10
  10. package/fesm2022/daffodil-product-composite-driver-magento.mjs.map +1 -1
  11. package/fesm2022/daffodil-product-composite-driver-testing.mjs +4 -4
  12. package/fesm2022/daffodil-product-composite-driver-testing.mjs.map +1 -1
  13. package/fesm2022/daffodil-product-composite-routing.mjs +11 -12
  14. package/fesm2022/daffodil-product-composite-routing.mjs.map +1 -1
  15. package/fesm2022/daffodil-product-composite-state-testing.mjs +7 -7
  16. package/fesm2022/daffodil-product-composite-state-testing.mjs.map +1 -1
  17. package/fesm2022/daffodil-product-composite-state.mjs +7 -7
  18. package/fesm2022/daffodil-product-composite-state.mjs.map +1 -1
  19. package/fesm2022/daffodil-product-composite-testing.mjs +9 -9
  20. package/fesm2022/daffodil-product-composite-testing.mjs.map +1 -1
  21. package/fesm2022/daffodil-product-composite.mjs.map +1 -1
  22. package/index.d.ts +88 -1
  23. package/package.json +1 -1
  24. package/routing/index.d.ts +75 -1
  25. package/state/index.d.ts +321 -1
  26. package/state/testing/index.d.ts +32 -1
  27. package/testing/index.d.ts +64 -1
  28. package/driver/in-memory/in-memory.module.d.ts +0 -12
  29. package/driver/in-memory/public_api.d.ts +0 -1
  30. package/driver/magento/composite-product-driver.module.d.ts +0 -12
  31. package/driver/magento/fragments/bundled-product.d.ts +0 -2
  32. package/driver/magento/injection-tokens/fragments/item.token.d.ts +0 -2
  33. package/driver/magento/injection-tokens/fragments/option.token.d.ts +0 -2
  34. package/driver/magento/injection-tokens/public_api.d.ts +0 -4
  35. package/driver/magento/injection-tokens/transforms/item/extra.token.d.ts +0 -21
  36. package/driver/magento/injection-tokens/transforms/item/token.d.ts +0 -2
  37. package/driver/magento/injection-tokens/transforms/option/extra.token.d.ts +0 -21
  38. package/driver/magento/injection-tokens/transforms/option/token.d.ts +0 -2
  39. package/driver/magento/interfaces/item-extra-transform.type.d.ts +0 -3
  40. package/driver/magento/interfaces/item-transform.type.d.ts +0 -3
  41. package/driver/magento/interfaces/option-extra-transform.type.d.ts +0 -3
  42. package/driver/magento/interfaces/option-transform.type.d.ts +0 -3
  43. package/driver/magento/interfaces/public_api.d.ts +0 -4
  44. package/driver/magento/models/bundled-product.d.ts +0 -39
  45. package/driver/magento/models/public_api.d.ts +0 -1
  46. package/driver/magento/public_api.d.ts +0 -6
  47. package/driver/magento/testing/factories/bundle/bundle-item-option.factory.d.ts +0 -24
  48. package/driver/magento/testing/factories/bundle/bundle-item.factory.d.ts +0 -22
  49. package/driver/magento/testing/factories/bundle/bundle.factory.d.ts +0 -21
  50. package/driver/magento/testing/factories/public_api.d.ts +0 -3
  51. package/driver/magento/testing/public_api.d.ts +0 -1
  52. package/driver/magento/transforms/item-transformer.service.d.ts +0 -11
  53. package/driver/magento/transforms/option.d.ts +0 -3
  54. package/driver/magento/transforms/product-transformer.service.d.ts +0 -17
  55. package/driver/magento/transforms/public_api.d.ts +0 -3
  56. package/driver/testing/public_api.d.ts +0 -1
  57. package/driver/testing/testing.module.d.ts +0 -12
  58. package/helpers/build-selection-payload.d.ts +0 -2
  59. package/helpers/public_api.d.ts +0 -1
  60. package/models/composite-configuration-item.d.ts +0 -14
  61. package/models/composite-product-item.d.ts +0 -48
  62. package/models/composite-product.d.ts +0 -16
  63. package/models/public_api.d.ts +0 -4
  64. package/models/selection-payload.type.d.ts +0 -5
  65. package/public_api.d.ts +0 -2
  66. package/routing/config/default.d.ts +0 -8
  67. package/routing/config/interface.d.ts +0 -20
  68. package/routing/config/public_api.d.ts +0 -3
  69. package/routing/config/token.d.ts +0 -2
  70. package/routing/effects/product-page.effects.d.ts +0 -22
  71. package/routing/effects/public_api.d.ts +0 -1
  72. package/routing/module.d.ts +0 -10
  73. package/routing/public_api.d.ts +0 -3
  74. package/routing/services/query-param.service.d.ts +0 -13
  75. package/state/actions/composite-product.actions.d.ts +0 -24
  76. package/state/actions/public_api.d.ts +0 -1
  77. package/state/composite-product-state.module.d.ts +0 -10
  78. package/state/facades/composite-product/composite-product-facade.interface.d.ts +0 -73
  79. package/state/facades/composite-product/composite-product.facade.d.ts +0 -31
  80. package/state/facades/public_api.d.ts +0 -2
  81. package/state/helpers/ensure-items.d.ts +0 -7
  82. package/state/helpers/public_api.d.ts +0 -1
  83. package/state/public_api.d.ts +0 -6
  84. package/state/reducers/composite-product-entities/composite-product-entities-reducer-adapter.d.ts +0 -49
  85. package/state/reducers/composite-product-entities/composite-product-entities.reducer.d.ts +0 -14
  86. package/state/reducers/composite-product-entities/composite-product-entity.d.ts +0 -16
  87. package/state/reducers/composite-product-reducers-state.interface.d.ts +0 -14
  88. package/state/reducers/composite-product-reducers.d.ts +0 -6
  89. package/state/reducers/composite-product-store-feature-key.d.ts +0 -1
  90. package/state/reducers/ensure-items.meta-reducer.d.ts +0 -6
  91. package/state/reducers/injection-tokens/extra.token.d.ts +0 -3
  92. package/state/reducers/injection-tokens/public_api.d.ts +0 -1
  93. package/state/reducers/injection-tokens/reducers.token.d.ts +0 -3
  94. package/state/reducers/public_api.d.ts +0 -7
  95. package/state/selectors/all.selector.d.ts +0 -13
  96. package/state/selectors/composite-product/composite-product.selectors.d.ts +0 -38
  97. package/state/selectors/composite-product-entities/composite-product-entities.selectors.d.ts +0 -45
  98. package/state/selectors/feature.selector.d.ts +0 -12
  99. package/state/selectors/public_api.d.ts +0 -4
  100. package/state/testing/mock-composite-product-facade.d.ts +0 -23
  101. package/state/testing/product-testing.module.d.ts +0 -6
  102. package/state/testing/public_api.d.ts +0 -2
  103. package/testing/factories/composite-product-item-option.factory.d.ts +0 -19
  104. package/testing/factories/composite-product-item.factory.d.ts +0 -25
  105. package/testing/factories/composite-product.factory.d.ts +0 -23
  106. package/testing/factories/public_api.d.ts +0 -3
  107. package/testing/public_api.d.ts +0 -1
@@ -1 +1 @@
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;QAE1C,IAAI,QAAQ,EAAE;AACZ,YAAA,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;;AAGhC,QAAA,OAAO,SAAS;KACjB,EACD,EAAE,CACH;AACH;;AChBA;;AAEG;IACS;AAAZ,CAAA,UAAY,iCAAiC,EAAA;AAC3C,IAAA,iCAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,iCAAA,CAAA,OAAA,CAAA,GAAA,OAAe;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;QAE1C,IAAI,QAAQ,EAAE;AACZ,YAAA,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAChC;AAEA,QAAA,OAAO,SAAS;IAClB,CAAC,EACD,EAAE,CACH;AACH;;AChBA;;AAEG;IACS;AAAZ,CAAA,UAAY,iCAAiC,EAAA;AAC3C,IAAA,iCAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,iCAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACjB,CAAC,EAHW,iCAAiC,KAAjC,iCAAiC,GAAA,EAAA,CAAA,CAAA;;ACN7C;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1 +1,88 @@
1
- export * from './public_api';
1
+ import { ID, DaffIdentifiable } from '@daffodil/core';
2
+ import { DaffProduct } from '@daffodil/product';
3
+
4
+ /**
5
+ * An object to denote the configuration chosen for a particular {@link DaffCompositeProductItem}.
6
+ */
7
+ interface DaffCompositeConfigurationItem {
8
+ /**
9
+ * The quantity chosen for the configuration of the {@link DaffCompositeProductItem}.
10
+ */
11
+ qty?: number;
12
+ /**
13
+ * The value of the {@link DaffCompositeProductItemOption} chosen for the configuration of the {@link DaffCompositeProductItem}.
14
+ */
15
+ value?: ID;
16
+ }
17
+
18
+ /**
19
+ * An enum for whether a composite product item should be displayed as a radio or select input.
20
+ */
21
+ declare enum DaffCompositeProductItemInputEnum {
22
+ select = "select",
23
+ radio = "radio"
24
+ }
25
+ /**
26
+ * The composite product item describes one set of product options that the user can add to the composite product.
27
+ * 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.
28
+ * If the item is optional, the product can be added to the cart without an option having been chosen.
29
+ * 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
30
+ * item might be a phillips head and a flathead. The customer could choose to add either a phillips head or a flathead to the
31
+ * composite product, or neither if the item is optional.
32
+ */
33
+ interface DaffCompositeProductItem extends DaffIdentifiable {
34
+ /**
35
+ * Whether the item is required or optional.
36
+ */
37
+ required: boolean;
38
+ /**
39
+ * The title label for the item.
40
+ */
41
+ title: string;
42
+ /**
43
+ * Describes how the item should be displayed.
44
+ */
45
+ input_type: DaffCompositeProductItemInputEnum;
46
+ /**
47
+ * The options that may be chosen for the item.
48
+ */
49
+ options: DaffCompositeProductItemOption[];
50
+ }
51
+ /**
52
+ * The composite product item option is a DaffProduct that can be added to a composite product.
53
+ */
54
+ interface DaffCompositeProductItemOption extends DaffProduct {
55
+ /**
56
+ * Whether the option is the default option for its parent {@link DaffCompositeProductItem}.
57
+ */
58
+ is_default: boolean;
59
+ /**
60
+ * The quantity chosen for the option.
61
+ */
62
+ quantity: number;
63
+ }
64
+
65
+ /**
66
+ * A composite product is a group of products sold together. It includes one primary product and many accessory "items".
67
+ * The composite product items are additional products the customer might want to purchase with the primary product,
68
+ * and each item has a number of options from which the user can choose. Composite product items can be optional or required.
69
+ * For example, a toolbox bundle might have a primary product of the toolbox. The items could be a hammer and a screw driver,
70
+ * and the options for these items could be two different hammers and two different screwdrivers between which the customer could choose.
71
+ * All of these items could have different prices/discounts/etc which would cause the composite products to have ranged prices.
72
+ */
73
+ interface DaffCompositeProduct extends DaffProduct {
74
+ /**
75
+ * The available items for the composite product.
76
+ */
77
+ items: DaffCompositeProductItem[];
78
+ }
79
+
80
+ /**
81
+ * Denotes a particular configuration for a composite item.
82
+ */
83
+ type DaffProductCompositeSelectionPayload = Record<DaffCompositeProductItem['id'], DaffCompositeProductItemOption['id'][]>;
84
+
85
+ declare function daffProductCompositeBuildSelectionPayload(appliedOptions: Record<DaffCompositeProductItem['id'], DaffCompositeProductItemOption>): DaffProductCompositeSelectionPayload;
86
+
87
+ export { DaffCompositeProductItemInputEnum, daffProductCompositeBuildSelectionPayload };
88
+ export type { DaffCompositeConfigurationItem, DaffCompositeProduct, DaffCompositeProductItem, DaffCompositeProductItemOption, DaffProductCompositeSelectionPayload };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@daffodil/product-composite","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/product-composite"]}}},"version":"0.88.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":"^19.0.0","@angular/core":"^19.0.0","@daffodil/core":"0.88.1","@daffodil/product":"0.88.1","@ngrx/effects":"^19.0.0","@ngrx/entity":"^19.0.0","@ngrx/store":"^19.0.0","rxjs":"7.8.1"},"optionalDependencies":{"@apollo/client":"^3.12.6","@daffodil/driver":"0.88.1","@daffodil/product":"0.88.1","angular-in-memory-web-api":"^0.19.0","apollo-angular":"^10.0.3","@faker-js/faker":"^9.8.0"},"module":"fesm2022/daffodil-product-composite.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","default":"./fesm2022/daffodil-product-composite.mjs"},"./routing":{"types":"./routing/index.d.ts","default":"./fesm2022/daffodil-product-composite-routing.mjs"},"./state":{"types":"./state/index.d.ts","default":"./fesm2022/daffodil-product-composite-state.mjs"},"./testing":{"types":"./testing/index.d.ts","default":"./fesm2022/daffodil-product-composite-testing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","default":"./fesm2022/daffodil-product-composite-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","default":"./fesm2022/daffodil-product-composite-driver-magento.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","default":"./fesm2022/daffodil-product-composite-driver-testing.mjs"},"./state/testing":{"types":"./state/testing/index.d.ts","default":"./fesm2022/daffodil-product-composite-state-testing.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/index.d.ts","default":"./fesm2022/daffodil-product-composite-driver-magento-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
1
+ {"name":"@daffodil/product-composite","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/product-composite"]}}},"version":"0.89.0","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":"^20.0.0","@angular/core":"^20.0.0","@daffodil/core":"0.89.0","@daffodil/product":"0.89.0","@ngrx/effects":"^20.0.0","@ngrx/entity":"^20.0.0","@ngrx/store":"^20.0.0","rxjs":"7.8.1"},"optionalDependencies":{"@apollo/client":"^3.12.6","@daffodil/driver":"0.89.0","@daffodil/product":"0.89.0","angular-in-memory-web-api":"^0.20.0","apollo-angular":"^11.0.0","@faker-js/faker":"^9.8.0"},"module":"fesm2022/daffodil-product-composite.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","default":"./fesm2022/daffodil-product-composite.mjs"},"./routing":{"types":"./routing/index.d.ts","default":"./fesm2022/daffodil-product-composite-routing.mjs"},"./state":{"types":"./state/index.d.ts","default":"./fesm2022/daffodil-product-composite-state.mjs"},"./testing":{"types":"./testing/index.d.ts","default":"./fesm2022/daffodil-product-composite-testing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","default":"./fesm2022/daffodil-product-composite-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","default":"./fesm2022/daffodil-product-composite-driver-magento.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","default":"./fesm2022/daffodil-product-composite-driver-testing.mjs"},"./state/testing":{"types":"./state/testing/index.d.ts","default":"./fesm2022/daffodil-product-composite-state-testing.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/index.d.ts","default":"./fesm2022/daffodil-product-composite-driver-magento-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
@@ -1 +1,75 @@
1
- export * from './public_api';
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, ModuleWithProviders } from '@angular/core';
3
+ import { DaffBase64Service } from '@daffodil/core';
4
+ import { DaffCompositeProduct, DaffProductCompositeSelectionPayload } from '@daffodil/product-composite';
5
+ import * as i1 from '@ngrx/effects';
6
+ import { Actions } from '@ngrx/effects';
7
+ import { Observable, EMPTY } from 'rxjs';
8
+ import { DaffCompositeProductApplyOption } from '@daffodil/product-composite/state';
9
+
10
+ /**
11
+ * An interface for providing `@daffodil/product-composite/routing` with necessary config values.
12
+ */
13
+ interface DaffProductCompositeRoutingConfig {
14
+ /**
15
+ * The name of the query param for which a composite product page preselection can be defined.
16
+ * The value of this query param should be a {@link DaffProductCompositeSelectionPayload} after being base64 decoded and JSON parsed.
17
+ *
18
+ * Defaults to `composite_selection`.
19
+ */
20
+ compositeSelectionQueryParam?: string;
21
+ /**
22
+ * The function used to decode the value of the {@link DaffProductCompositeStateConfig#compositeSelectionQueryParam}
23
+ * into a {@link DaffProductCompositeSelectionPayload}.
24
+ *
25
+ * Defaults to `(queryParam: string) => JSON.parse(atob(queryParam))`.
26
+ */
27
+ compositeSelectionQueryParamDecode?: (queryParam: string, product: DaffCompositeProduct) => DaffProductCompositeSelectionPayload;
28
+ }
29
+
30
+ /**
31
+ * The default configuration for the {@link DaffProductCompositeRoutingConfig}.
32
+ */
33
+ declare const daffProductCompositeRoutingConfigDefaultFactory: (base64: DaffBase64Service) => DaffProductCompositeRoutingConfig;
34
+ declare const DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT: InjectionToken<DaffProductCompositeRoutingConfig>;
35
+
36
+ declare const DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG: i0.InjectionToken<DaffProductCompositeRoutingConfig>;
37
+ declare const provideDaffProductCompositeRoutingConfig: <R extends DaffProductCompositeRoutingConfig = DaffProductCompositeRoutingConfig>(config: Partial<R> | i0.InjectionToken<Partial<R>>) => i0.FactoryProvider;
38
+
39
+ declare class DaffProductCompositeQueryParamService {
40
+ private document;
41
+ private config;
42
+ constructor(document: any, config: DaffProductCompositeRoutingConfig);
43
+ /**
44
+ * Get the value of the configured composite selection query param.
45
+ */
46
+ get(): string;
47
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductCompositeQueryParamService, never>;
48
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductCompositeQueryParamService>;
49
+ }
50
+
51
+ /**
52
+ * Handles composite product specific actions for the product page.
53
+ */
54
+ declare class DaffProductCompositePageEffects<T extends DaffCompositeProduct = DaffCompositeProduct> {
55
+ private actions$;
56
+ private paramGetter;
57
+ private config;
58
+ constructor(actions$: Actions, paramGetter: DaffProductCompositeQueryParamService, config: DaffProductCompositeRoutingConfig);
59
+ /**
60
+ * Applies composite item options based on the value of the configured query param.
61
+ */
62
+ preselectCompositeOptions$: Observable<typeof EMPTY | DaffCompositeProductApplyOption<T>>;
63
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductCompositePageEffects<any>, never>;
64
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductCompositePageEffects<any>>;
65
+ }
66
+
67
+ declare class DaffProductCompositeRoutingModule {
68
+ static withConfig(config?: DaffProductCompositeRoutingConfig): ModuleWithProviders<DaffProductCompositeRoutingModule>;
69
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductCompositeRoutingModule, never>;
70
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffProductCompositeRoutingModule, never, [typeof i1.EffectsFeatureModule], never>;
71
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffProductCompositeRoutingModule>;
72
+ }
73
+
74
+ export { DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG, DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT, DaffProductCompositePageEffects, DaffProductCompositeRoutingModule, daffProductCompositeRoutingConfigDefaultFactory, provideDaffProductCompositeRoutingConfig };
75
+ export type { DaffProductCompositeRoutingConfig };
package/state/index.d.ts CHANGED
@@ -1 +1,321 @@
1
- export * from './public_api';
1
+ import * as _ngrx_store from '@ngrx/store';
2
+ import { Action, Store, ActionReducerMap, ActionReducer, MemoizedSelector } from '@ngrx/store';
3
+ import { DaffCompositeProduct, DaffCompositeProductItem, DaffCompositeProductItemOption, DaffCompositeConfigurationItem } from '@daffodil/product-composite';
4
+ import { Dictionary, EntityState } from '@ngrx/entity';
5
+ import { Observable } from 'rxjs';
6
+ import { DaffStoreFacade } from '@daffodil/core/state';
7
+ import { DaffPriceRange, DaffProduct } from '@daffodil/product';
8
+ import * as _daffodil_product_composite_state from '@daffodil/product-composite/state';
9
+ import { DaffProductStateRootSlice, DaffProductReducersState } from '@daffodil/product/state';
10
+ import * as i0 from '@angular/core';
11
+ import * as node_modules__ngrx_entity_src_models from 'node_modules/@ngrx/entity/src/models';
12
+
13
+ /**
14
+ * Action types for Composite Product Actions.
15
+ */
16
+ declare enum DaffCompositeProductActionTypes {
17
+ CompositeProductApplyOptionAction = "[@daffodil/product-composite] Composite Product Apply Option Action"
18
+ }
19
+ /**
20
+ * Applies a product option to a particular composite product.
21
+ *
22
+ * @param id - Id of the Composite Product
23
+ * @param itemId - Id of the product item.
24
+ * @param optionId - Id of the option of the product item that is chosen.
25
+ */
26
+ declare class DaffCompositeProductApplyOption<T extends DaffCompositeProduct = DaffCompositeProduct> implements Action {
27
+ id: T['id'];
28
+ itemId: DaffCompositeProductItem['id'];
29
+ optionId: DaffCompositeProductItemOption['id'];
30
+ qty?: number;
31
+ readonly type = DaffCompositeProductActionTypes.CompositeProductApplyOptionAction;
32
+ constructor(id: T['id'], itemId: DaffCompositeProductItem['id'], optionId: DaffCompositeProductItemOption['id'], qty?: number);
33
+ }
34
+ type DaffCompositeProductActions<T extends DaffCompositeProduct = DaffCompositeProduct> = DaffCompositeProductApplyOption<T>;
35
+
36
+ /**
37
+ * A facade for interacting with the composite product state.
38
+ * Exposes many parts of the state for easy access and allows dispatching of actions.
39
+ */
40
+ interface DaffCompositeProductFacadeInterface extends DaffStoreFacade<Action> {
41
+ /**
42
+ * Get a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.
43
+ *
44
+ * @param id an id for a composite product
45
+ * @param configuration a Dictionary of DaffCompositeConfigurationItems
46
+ */
47
+ getRequiredItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange>;
48
+ /**
49
+ * Get the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.
50
+ *
51
+ * @param id the id of the composite product.
52
+ * @param configuration a Dictionary of DaffCompositeConfigurationItems
53
+ */
54
+ getOptionalItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange>;
55
+ /**
56
+ * Get the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and
57
+ * excluding unselected, optional item prices.
58
+ *
59
+ * @param id the id of the composite product.
60
+ */
61
+ getPricesAsCurrentlyConfigured(id: DaffCompositeProduct['id']): Observable<DaffPriceRange>;
62
+ /**
63
+ * Returns the applied options for a composite product.
64
+ *
65
+ * @param id the id of the composite product.
66
+ */
67
+ getAppliedOptions(id: DaffCompositeProduct['id']): Observable<Dictionary<DaffCompositeProductItemOption>>;
68
+ /**
69
+ * Returns whether the item of a composite product is required.
70
+ *
71
+ * @param id the id of the composite product.
72
+ * @param item_id the id of the item_id.
73
+ */
74
+ isItemRequired(id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']): Observable<boolean>;
75
+ /**
76
+ * Returns whether a DaffPriceRange has a discount.
77
+ *
78
+ * @param priceRange a DaffPriceRange
79
+ */
80
+ hasDiscount(priceRange: DaffPriceRange): boolean;
81
+ /**
82
+ * Returns the discount amount of a composite product based on the current configuration of the selected item options in redux
83
+ * state and excluding unselected, optional item prices. Will return undefined if all required options are not chosen.
84
+ *
85
+ * @param id the id of the composite product.
86
+ */
87
+ getDiscountAmount(id: DaffCompositeProduct['id']): Observable<number>;
88
+ /**
89
+ * Returns the discount percent of a composite product based on the current configuration of the selected item options in redux
90
+ * state and excluding unselected, optional item prices. Will return undefined if all required options are not chosen.
91
+ * Note: This percent is computed client-side and should be treated as an estimate rather than an exact value.
92
+ *
93
+ * @param id the id of the composite product.
94
+ */
95
+ getDiscountPercent(id: DaffCompositeProduct['id']): Observable<number>;
96
+ /**
97
+ * Returns whether the min and max prices of a DaffPriceRange are different.
98
+ *
99
+ * @param priceRange a DaffPriceRange
100
+ */
101
+ hasPriceRange(priceRange: DaffPriceRange): boolean;
102
+ }
103
+
104
+ /**
105
+ * Describes how composite product configurations are stored in rxjs entity state.
106
+ */
107
+ interface DaffCompositeProductEntity {
108
+ /**
109
+ * The id of the composite product.
110
+ */
111
+ id: DaffProduct['id'];
112
+ /**
113
+ * A dictionary of the configurations set for a composite product.
114
+ */
115
+ items: Dictionary<DaffCompositeConfigurationItem>;
116
+ }
117
+
118
+ declare const DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY = "daffCompositeProduct";
119
+
120
+ /**
121
+ * Interface for the redux store of the composite product feature area.
122
+ */
123
+ interface DaffCompositeProductReducersState {
124
+ compositeProductOptions: EntityState<DaffCompositeProductEntity>;
125
+ }
126
+ interface DaffCompositeProductStateRootSlice<T extends DaffProduct = DaffProduct> extends DaffProductStateRootSlice<T> {
127
+ [DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY]: DaffCompositeProductReducersState;
128
+ }
129
+
130
+ /**
131
+ * A facade for interacting with the composite product state.
132
+ * Exposes many parts of the state for easy access and allows dispatching of actions.
133
+ *
134
+ * @inheritdoc
135
+ */
136
+ declare class DaffCompositeProductFacade<T extends DaffProduct = DaffProduct> implements DaffCompositeProductFacadeInterface {
137
+ private store;
138
+ constructor(store: Store<DaffCompositeProductStateRootSlice<T>>);
139
+ compositeProductSelectors: _daffodil_product_composite_state.DaffCompositeProductAllSelectors<T>;
140
+ hasDiscount: (priceRange: DaffPriceRange) => boolean;
141
+ hasPriceRange: (priceRange: DaffPriceRange) => boolean;
142
+ getRequiredItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange>;
143
+ getOptionalItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange>;
144
+ getPricesAsCurrentlyConfigured(id: T['id']): Observable<DaffPriceRange>;
145
+ getAppliedOptions(id: T['id']): Observable<Dictionary<DaffCompositeProductItemOption>>;
146
+ getDiscountAmount(id: T['id']): Observable<number>;
147
+ getDiscountPercent(id: T['id']): Observable<number>;
148
+ isItemRequired(id: T['id'], item_id: DaffCompositeProductItem['id']): Observable<boolean>;
149
+ dispatch(action: Action): void;
150
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductFacade<any>, never>;
151
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductFacade<any>>;
152
+ }
153
+
154
+ /**
155
+ * Returns state values from all composite product related reducers.
156
+ */
157
+ declare const daffCompositeProductReducers: ActionReducerMap<DaffCompositeProductReducersState>;
158
+
159
+ /**
160
+ * Composite Product Item Options Adapter for changing/overwriting entity state.
161
+ */
162
+ declare class DaffCompositeProductAppliedOptionsEntitiesAdapter<T extends EntityState<DaffCompositeProductEntity> = EntityState<DaffCompositeProductEntity>> {
163
+ /**
164
+ * @docs-private
165
+ */
166
+ private _adapter;
167
+ /**
168
+ * Gets the initial entity state.
169
+ */
170
+ getInitialState(): EntityState<DaffCompositeProductEntity>;
171
+ /**
172
+ * Get the entity selectors.
173
+ */
174
+ getSelectors(): node_modules__ngrx_entity_src_models.EntitySelectors<DaffCompositeProductEntity, EntityState<DaffCompositeProductEntity>>;
175
+ /**
176
+ * Upserts the given composite products into state.
177
+ */
178
+ upsertProducts(state: T, ...products: DaffCompositeProduct[]): T;
179
+ /**
180
+ * Apply the specified option for the given composite product item.
181
+ */
182
+ applyOption(state: T, productId: DaffCompositeProduct['id'], itemId: DaffCompositeProductItem['id'], optionId: DaffCompositeProductItemOption['id'], qty?: number): T;
183
+ /**
184
+ * @docs-private
185
+ */
186
+ private mapOptionsEntities;
187
+ /**
188
+ * @docs-private
189
+ */
190
+ private buildCompositeProductAppliedOptionsEntity;
191
+ /**
192
+ * Sets the default item option to the specified default option if it is in stock.
193
+ * Does not set a default option if a default is not specified.
194
+ * Does not set a default option but does set a default qty if the default is out of stock.
195
+ *
196
+ * @param item a DaffCompositeProductItem
197
+ * @docs-private
198
+ */
199
+ private getDefaultOption;
200
+ }
201
+ /**
202
+ * Gets the composite product entity adapter singleton.
203
+ */
204
+ declare const daffCompositeProductAppliedOptionsEntitiesAdapter: () => DaffCompositeProductAppliedOptionsEntitiesAdapter;
205
+
206
+ declare const DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS: i0.InjectionToken<ActionReducer<DaffCompositeProductReducersState, _ngrx_store.Action<string>>[]>;
207
+ declare const daffProductCompositeProvideExtraReducers: <R extends ActionReducer<DaffCompositeProductReducersState, _ngrx_store.Action<string>> = ActionReducer<DaffCompositeProductReducersState, _ngrx_store.Action<string>>>(...values: R[]) => Array<i0.ValueProvider>;
208
+
209
+ /**
210
+ * An interface describing selectors unique to the composite product, such as pricing and discounts.
211
+ */
212
+ interface DaffCompositeProductMemoizedSelectors<T extends DaffProduct = DaffProduct> {
213
+ /**
214
+ * Get a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.
215
+ */
216
+ selectCompositeProductRequiredItemPricesForConfiguration: (id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;
217
+ /**
218
+ * Get the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.
219
+ */
220
+ selectCompositeProductOptionalItemPricesForConfiguration: (id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;
221
+ /**
222
+ * Get the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and
223
+ * excluding unselected, optional item prices.
224
+ */
225
+ selectCompositeProductPricesAsCurrentlyConfigured: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;
226
+ /**
227
+ * Get the discount amount for a composite product. This value will be undefined if all required options are not chosen.
228
+ */
229
+ selectCompositeProductDiscountAmount: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;
230
+ /**
231
+ * Get the discount percent for a composite product. This value will be undefined if all required options are not chosen.
232
+ * Note: this percent is computed client-side and should be treated as an estimate rather than an exact value.
233
+ */
234
+ selectCompositeProductDiscountPercent: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;
235
+ }
236
+ /**
237
+ * A function that returns all selectors related to the composite product feature.
238
+ *
239
+ * Returns {@link DaffCompositeProductMemoizedSelectors}.
240
+ */
241
+ declare const getDaffCompositeProductPriceSelectors: <T extends DaffProduct = DaffProduct>() => DaffCompositeProductMemoizedSelectors<T>;
242
+
243
+ /**
244
+ * An interface for selectors related to the composite product applied options.
245
+ */
246
+ interface DaffCompositeProductEntitiesMemoizedSelectors<T extends DaffProduct = DaffProduct> {
247
+ /**
248
+ * The ngrx entities state for composite product applied options.
249
+ */
250
+ selectCompositeProductAppliedOptionsEntitiesState: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>>;
251
+ /**
252
+ * A selector for all composite product ids in state.
253
+ */
254
+ selectCompositeProductIds: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>['ids']>;
255
+ /**
256
+ * The ngrx entities for the composite product appllied options.
257
+ */
258
+ selectCompositeProductAppliedOptionsEntities: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>['entities']>;
259
+ /**
260
+ * The total number of composite products in state.
261
+ */
262
+ selectCompositeProductTotal: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;
263
+ /**
264
+ * Selects the applied options for a composite product.
265
+ *
266
+ * @param id the id of the composite product.
267
+ */
268
+ selectCompositeProductAppliedOptions: (id: T['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, Dictionary<DaffCompositeProductItemOption>>;
269
+ /**
270
+ * 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.
271
+ *
272
+ * @param id the id of the composite product.
273
+ * @param item_id the id of the composite product item.
274
+ */
275
+ selectIsCompositeProductItemRequired: (id: T['id'], item_id: DaffCompositeProductItem['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, boolean>;
276
+ }
277
+ /**
278
+ * A function that returns all selectors related to composite product applied option entities.
279
+ * Returns {@link DaffCompositeProductEntitiesMemoizedSelectors}.
280
+ */
281
+ declare const getDaffCompositeProductEntitiesSelectors: <T extends DaffProduct>() => DaffCompositeProductEntitiesMemoizedSelectors<T>;
282
+
283
+ /**
284
+ * An interface for all selectors in the composite product feature area.
285
+ */
286
+ interface DaffCompositeProductAllSelectors<T extends DaffProduct = DaffProduct> extends DaffCompositeProductEntitiesMemoizedSelectors<T>, DaffCompositeProductMemoizedSelectors<T> {
287
+ }
288
+ /**
289
+ * A function that returns all selectors in the composite product feature area.
290
+ * Returns {@link DaffCompositeProductAllSelectors}.
291
+ */
292
+ declare const getDaffCompositeProductSelectors: <T extends DaffProduct>() => DaffCompositeProductAllSelectors<T>;
293
+
294
+ /**
295
+ * An interface for the composite product feature state.
296
+ */
297
+ interface DaffCompositeProductFeatureMemoizedSelector {
298
+ selectCompositeProductState: MemoizedSelector<Record<string, any>, DaffCompositeProductReducersState>;
299
+ }
300
+ /**
301
+ * A function that returns a selector for the composite product feature state.
302
+ */
303
+ declare const getDaffCompositeProductFeatureSelector: () => DaffCompositeProductFeatureMemoizedSelector;
304
+
305
+ /**
306
+ * Maps a list of products, ensuring that the composite products have a list of items.
307
+ * If the incoming items is empty or nully, the items from state are intentionally used instead.
308
+ */
309
+ declare function daffProductCompositeEnsureItems<T extends DaffCompositeProduct = DaffCompositeProduct>(state: DaffProductReducersState<T>, products: T[]): T[];
310
+
311
+ /**
312
+ * A module that provides the default reducers and effects for composite product redux state.
313
+ */
314
+ declare class DaffCompositeProductStateModule {
315
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductStateModule, never>;
316
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCompositeProductStateModule, never, [typeof _ngrx_store.StoreFeatureModule], never>;
317
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffCompositeProductStateModule>;
318
+ }
319
+
320
+ export { DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY, DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS, DaffCompositeProductActionTypes, DaffCompositeProductAppliedOptionsEntitiesAdapter, DaffCompositeProductApplyOption, DaffCompositeProductFacade, DaffCompositeProductStateModule, daffCompositeProductAppliedOptionsEntitiesAdapter, daffCompositeProductReducers, daffProductCompositeEnsureItems, daffProductCompositeProvideExtraReducers, getDaffCompositeProductEntitiesSelectors, getDaffCompositeProductFeatureSelector, getDaffCompositeProductPriceSelectors, getDaffCompositeProductSelectors };
321
+ export type { DaffCompositeProductActions, DaffCompositeProductAllSelectors, DaffCompositeProductEntitiesMemoizedSelectors, DaffCompositeProductEntity, DaffCompositeProductFacadeInterface, DaffCompositeProductFeatureMemoizedSelector, DaffCompositeProductMemoizedSelectors, DaffCompositeProductReducersState, DaffCompositeProductStateRootSlice };
@@ -1 +1,32 @@
1
- export * from './public_api';
1
+ import { Dictionary } from '@ngrx/entity';
2
+ import { BehaviorSubject } from 'rxjs';
3
+ import { DaffPriceRange } from '@daffodil/product';
4
+ import { DaffCompositeProduct, DaffCompositeConfigurationItem, DaffCompositeProductItemOption, DaffCompositeProductItem } from '@daffodil/product-composite';
5
+ import { DaffCompositeProductFacadeInterface } from '@daffodil/product-composite/state';
6
+ import * as i0 from '@angular/core';
7
+
8
+ /**
9
+ * @inheritdoc
10
+ */
11
+ declare class MockDaffCompositeProductFacade implements DaffCompositeProductFacadeInterface {
12
+ getRequiredItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): BehaviorSubject<DaffPriceRange>;
13
+ getOptionalItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): BehaviorSubject<DaffPriceRange>;
14
+ getPricesAsCurrentlyConfigured(id: DaffCompositeProduct['id']): BehaviorSubject<DaffPriceRange>;
15
+ getAppliedOptions(id: DaffCompositeProduct['id']): BehaviorSubject<Dictionary<DaffCompositeProductItemOption>>;
16
+ getDiscountAmount(id: DaffCompositeProduct['id']): BehaviorSubject<number>;
17
+ getDiscountPercent(id: DaffCompositeProduct['id']): BehaviorSubject<number>;
18
+ isItemRequired(id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']): BehaviorSubject<boolean>;
19
+ dispatch(action: any): void;
20
+ hasDiscount(priceRange: DaffPriceRange): boolean;
21
+ hasPriceRange(priceRange: DaffPriceRange): boolean;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<MockDaffCompositeProductFacade, never>;
23
+ static ɵprov: i0.ɵɵInjectableDeclaration<MockDaffCompositeProductFacade>;
24
+ }
25
+
26
+ declare class DaffCompositeProductStateTestingModule {
27
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductStateTestingModule, never>;
28
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCompositeProductStateTestingModule, never, never, never>;
29
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffCompositeProductStateTestingModule>;
30
+ }
31
+
32
+ export { DaffCompositeProductStateTestingModule, MockDaffCompositeProductFacade };
@@ -1 +1,64 @@
1
- export * from './public_api';
1
+ import * as _daffodil_product_composite from '@daffodil/product-composite';
2
+ import { DaffCompositeProductItemOption, DaffCompositeProductItem, DaffCompositeProductItemInputEnum, DaffCompositeProduct } from '@daffodil/product-composite';
3
+ import { DaffModelFactory } from '@daffodil/core/testing';
4
+ import { DaffProductTypeEnum } from '@daffodil/product';
5
+ import { DaffProductImageFactory, MockProduct } from '@daffodil/product/testing';
6
+ import * as i0 from '@angular/core';
7
+
8
+ /**
9
+ * Mocked DaffCompositeProductItemOption object.
10
+ */
11
+ declare class MockCompositeProductItemOption extends MockProduct implements DaffCompositeProductItemOption {
12
+ quantity: number;
13
+ is_default: boolean;
14
+ }
15
+ /**
16
+ * Factory for creating DaffCompositeProductItemOptions.
17
+ */
18
+ declare class DaffCompositeProductItemOptionFactory extends DaffModelFactory<DaffCompositeProductItemOption> {
19
+ constructor(imageFactory: DaffProductImageFactory);
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductItemOptionFactory, never>;
21
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductItemOptionFactory>;
22
+ }
23
+
24
+ /**
25
+ * Mocked DaffCompositeProductItem object.
26
+ */
27
+ declare class MockCompositeProductItem implements DaffCompositeProductItem {
28
+ protected optionFactory: DaffCompositeProductItemOptionFactory;
29
+ id: string;
30
+ url: string;
31
+ required: boolean;
32
+ title: string;
33
+ input_type: DaffCompositeProductItemInputEnum;
34
+ options: _daffodil_product_composite.DaffCompositeProductItemOption[];
35
+ constructor(optionFactory: DaffCompositeProductItemOptionFactory);
36
+ }
37
+ /**
38
+ * Factory for creating DaffCompositeProductItems.
39
+ */
40
+ declare class DaffCompositeProductItemFactory extends DaffModelFactory<DaffCompositeProductItem> {
41
+ constructor(optionFactory: DaffCompositeProductItemOptionFactory);
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductItemFactory, never>;
43
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductItemFactory>;
44
+ }
45
+
46
+ /**
47
+ * Mocked DaffCompositeProduct object.
48
+ */
49
+ declare class MockCompositeProduct extends MockProduct implements DaffCompositeProduct {
50
+ protected itemFactory: DaffCompositeProductItemFactory;
51
+ type: DaffProductTypeEnum;
52
+ items: _daffodil_product_composite.DaffCompositeProductItem[];
53
+ constructor(itemFactory: DaffCompositeProductItemFactory, imageFactory: DaffProductImageFactory);
54
+ }
55
+ /**
56
+ * Factory for creating DaffCompositeProducts.
57
+ */
58
+ declare class DaffCompositeProductFactory extends DaffModelFactory<DaffCompositeProduct> {
59
+ constructor(itemFactory: DaffCompositeProductItemFactory, imageFactory: DaffProductImageFactory);
60
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductFactory, never>;
61
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductFactory>;
62
+ }
63
+
64
+ export { DaffCompositeProductFactory, DaffCompositeProductItemFactory, DaffCompositeProductItemOptionFactory, MockCompositeProduct, MockCompositeProductItem, MockCompositeProductItemOption };
@@ -1,12 +0,0 @@
1
- import { ModuleWithProviders } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- import * as i1 from "@angular/common";
4
- /**
5
- * Module for providing the composite product factory to the product kind factory.
6
- */
7
- export declare class DaffCompositeProductInMemoryDriverModule {
8
- static forRoot(): ModuleWithProviders<DaffCompositeProductInMemoryDriverModule>;
9
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductInMemoryDriverModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCompositeProductInMemoryDriverModule, never, [typeof i1.CommonModule], never>;
11
- static ɵinj: i0.ɵɵInjectorDeclaration<DaffCompositeProductInMemoryDriverModule>;
12
- }
@@ -1 +0,0 @@
1
- export { DaffCompositeProductInMemoryDriverModule } from './in-memory.module';