@daffodil/product 0.38.9 → 0.39.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 (257) hide show
  1. package/bundles/daffodil-product-driver-in-memory.umd.js +77 -160
  2. package/bundles/daffodil-product-driver-in-memory.umd.js.map +1 -1
  3. package/bundles/daffodil-product-driver-in-memory.umd.min.js +1 -1
  4. package/bundles/daffodil-product-driver-in-memory.umd.min.js.map +1 -1
  5. package/bundles/daffodil-product-driver-magento-testing.umd.js +12 -140
  6. package/bundles/daffodil-product-driver-magento-testing.umd.js.map +1 -1
  7. package/bundles/daffodil-product-driver-magento-testing.umd.min.js +1 -1
  8. package/bundles/daffodil-product-driver-magento-testing.umd.min.js.map +1 -1
  9. package/bundles/daffodil-product-driver-magento.umd.js +87 -676
  10. package/bundles/daffodil-product-driver-magento.umd.js.map +1 -1
  11. package/bundles/daffodil-product-driver-magento.umd.min.js +2 -2
  12. package/bundles/daffodil-product-driver-magento.umd.min.js.map +1 -1
  13. package/bundles/daffodil-product-driver-shopify.umd.js +14 -160
  14. package/bundles/daffodil-product-driver-shopify.umd.js.map +1 -1
  15. package/bundles/daffodil-product-driver-shopify.umd.min.js +1 -1
  16. package/bundles/daffodil-product-driver-shopify.umd.min.js.map +1 -1
  17. package/bundles/daffodil-product-driver-testing.umd.js +4 -62
  18. package/bundles/daffodil-product-driver-testing.umd.js.map +1 -1
  19. package/bundles/daffodil-product-driver-testing.umd.min.js +1 -1
  20. package/bundles/daffodil-product-driver-testing.umd.min.js.map +1 -1
  21. package/bundles/daffodil-product-driver.umd.js +12 -64
  22. package/bundles/daffodil-product-driver.umd.js.map +1 -1
  23. package/bundles/daffodil-product-routing.umd.js +4 -112
  24. package/bundles/daffodil-product-routing.umd.js.map +1 -1
  25. package/bundles/daffodil-product-routing.umd.min.js +1 -1
  26. package/bundles/daffodil-product-routing.umd.min.js.map +1 -1
  27. package/bundles/daffodil-product-state-testing.umd.js +15 -240
  28. package/bundles/daffodil-product-state-testing.umd.js.map +1 -1
  29. package/bundles/daffodil-product-state-testing.umd.min.js +1 -1
  30. package/bundles/daffodil-product-state-testing.umd.min.js.map +1 -1
  31. package/bundles/daffodil-product-state.umd.js +347 -2359
  32. package/bundles/daffodil-product-state.umd.js.map +1 -1
  33. package/bundles/daffodil-product-state.umd.min.js +1 -1
  34. package/bundles/daffodil-product-state.umd.min.js.map +1 -1
  35. package/bundles/daffodil-product-testing.umd.js +20 -230
  36. package/bundles/daffodil-product-testing.umd.js.map +1 -1
  37. package/bundles/daffodil-product-testing.umd.min.js +1 -1
  38. package/bundles/daffodil-product-testing.umd.min.js.map +1 -1
  39. package/bundles/daffodil-product.umd.js +21 -209
  40. package/bundles/daffodil-product.umd.js.map +1 -1
  41. package/bundles/daffodil-product.umd.min.js +1 -1
  42. package/bundles/daffodil-product.umd.min.js.map +1 -1
  43. package/driver/in-memory/backend/product.service.d.ts +3 -2
  44. package/driver/in-memory/daffodil-product-driver-in-memory.metadata.json +1 -1
  45. package/driver/in-memory/package.json +1 -1
  46. package/driver/magento/package.json +1 -1
  47. package/driver/magento/testing/package.json +1 -1
  48. package/driver/package.json +1 -1
  49. package/driver/shopify/package.json +1 -1
  50. package/driver/testing/package.json +1 -1
  51. package/esm2015/daffodil-product.js +2 -7
  52. package/esm2015/driver/daffodil-product-driver.js +2 -7
  53. package/esm2015/driver/in-memory/backend/product.service.js +62 -83
  54. package/esm2015/driver/in-memory/daffodil-product-driver-in-memory.js +2 -7
  55. package/esm2015/driver/in-memory/driver/product-driver.module.js +1 -9
  56. package/esm2015/driver/in-memory/driver/product.service.js +11 -53
  57. package/esm2015/driver/in-memory/index.js +2 -7
  58. package/esm2015/driver/in-memory/public_api.js +1 -6
  59. package/esm2015/driver/index.js +2 -7
  60. package/esm2015/driver/interfaces/product-service.interface.js +1 -39
  61. package/esm2015/driver/magento/config/default.js +2 -8
  62. package/esm2015/driver/magento/config/public_api.js +1 -6
  63. package/esm2015/driver/magento/daffodil-product-driver-magento.js +2 -7
  64. package/esm2015/driver/magento/index.js +2 -7
  65. package/esm2015/driver/magento/injection-tokens/fragments/product-preview.token.js +7 -22
  66. package/esm2015/driver/magento/injection-tokens/fragments/product.token.js +5 -20
  67. package/esm2015/driver/magento/injection-tokens/public_api.js +1 -6
  68. package/esm2015/driver/magento/injection-tokens/transforms/product-preview/preview-extra.token.js +6 -21
  69. package/esm2015/driver/magento/injection-tokens/transforms/product-preview/preview.token.js +4 -24
  70. package/esm2015/driver/magento/injection-tokens/transforms/product-response/response-extra.token.js +5 -20
  71. package/esm2015/driver/magento/injection-tokens/transforms/product-response/response.token.js +4 -25
  72. package/esm2015/driver/magento/interfaces/config.interface.js +3 -38
  73. package/esm2015/driver/magento/interfaces/product-preview-extra-transform.type.js +2 -6
  74. package/esm2015/driver/magento/interfaces/product-preview-transform.type.js +2 -6
  75. package/esm2015/driver/magento/interfaces/product-response-extra-transform.type.js +2 -6
  76. package/esm2015/driver/magento/interfaces/product-response-transform.type.js +2 -6
  77. package/esm2015/driver/magento/interfaces/public_api.js +6 -11
  78. package/esm2015/driver/magento/models/bundled-product.js +9 -65
  79. package/esm2015/driver/magento/models/configurable-product.js +2 -72
  80. package/esm2015/driver/magento/models/get-product-response.interface.js +2 -16
  81. package/esm2015/driver/magento/models/magento-product.js +7 -38
  82. package/esm2015/driver/magento/models/product-preview.interface.js +6 -40
  83. package/esm2015/driver/magento/models/public_api.js +4 -9
  84. package/esm2015/driver/magento/models/simple-product.js +2 -18
  85. package/esm2015/driver/magento/product-driver.module.js +3 -12
  86. package/esm2015/driver/magento/product.service.js +7 -78
  87. package/esm2015/driver/magento/public_api.js +7 -12
  88. package/esm2015/driver/magento/queries/fragments/bundled-product.js +2 -8
  89. package/esm2015/driver/magento/queries/fragments/configurable-product.js +1 -7
  90. package/esm2015/driver/magento/queries/fragments/product-preview.js +1 -7
  91. package/esm2015/driver/magento/queries/fragments/product.js +1 -7
  92. package/esm2015/driver/magento/queries/fragments/simple-product.js +1 -7
  93. package/esm2015/driver/magento/queries/get-all-products.js +3 -14
  94. package/esm2015/driver/magento/queries/get-product-by-url.js +3 -14
  95. package/esm2015/driver/magento/queries/get-product.js +3 -14
  96. package/esm2015/driver/magento/queries/public_api.js +4 -9
  97. package/esm2015/driver/magento/testing/daffodil-product-driver-magento-testing.js +2 -7
  98. package/esm2015/driver/magento/testing/factories/bundle/bundle.factory.js +4 -15
  99. package/esm2015/driver/magento/testing/factories/configurable/configurable.factory.js +3 -46
  100. package/esm2015/driver/magento/testing/factories/core/product-preview.factory.js +2 -29
  101. package/esm2015/driver/magento/testing/factories/core/product.factory.js +3 -46
  102. package/esm2015/driver/magento/testing/factories/public_api.js +6 -11
  103. package/esm2015/driver/magento/testing/factories/simple/simple.factory.js +3 -12
  104. package/esm2015/driver/magento/testing/index.js +2 -7
  105. package/esm2015/driver/magento/testing/public_api.js +2 -7
  106. package/esm2015/driver/magento/transforms/bundled-product-transformers.js +4 -25
  107. package/esm2015/driver/magento/transforms/configurable-product-transformers.js +4 -38
  108. package/esm2015/driver/magento/transforms/product-preview.js +5 -35
  109. package/esm2015/driver/magento/transforms/product-response.js +2 -23
  110. package/esm2015/driver/magento/transforms/product-transformers.js +5 -32
  111. package/esm2015/driver/magento/transforms/public_api.js +7 -12
  112. package/esm2015/driver/magento/transforms/simple-product-transformers.js +3 -31
  113. package/esm2015/driver/magento/transforms/truncate-url.js +2 -12
  114. package/esm2015/driver/models/public_api.js +2 -6
  115. package/esm2015/driver/models/response.interface.js +2 -28
  116. package/esm2015/driver/public_api.js +2 -7
  117. package/esm2015/driver/shopify/daffodil-product-driver-shopify.js +2 -7
  118. package/esm2015/driver/shopify/index.js +2 -7
  119. package/esm2015/driver/shopify/product-driver.module.js +2 -10
  120. package/esm2015/driver/shopify/product.service.js +12 -132
  121. package/esm2015/driver/shopify/public_api.js +1 -6
  122. package/esm2015/driver/testing/daffodil-product-driver-testing.js +2 -7
  123. package/esm2015/driver/testing/drivers/product-driver.module.js +2 -10
  124. package/esm2015/driver/testing/drivers/product.service.js +3 -39
  125. package/esm2015/driver/testing/index.js +2 -7
  126. package/esm2015/driver/testing/public_api.js +1 -6
  127. package/esm2015/helpers.js +7 -22
  128. package/esm2015/index.js +2 -7
  129. package/esm2015/injection-tokens/error-matcher.token.js +3 -12
  130. package/esm2015/injection-tokens/public_api.js +1 -6
  131. package/esm2015/models/composite-configuration-item.js +2 -25
  132. package/esm2015/models/composite-product-item.js +8 -62
  133. package/esm2015/models/composite-product.js +2 -25
  134. package/esm2015/models/configurable-product.js +2 -125
  135. package/esm2015/models/prices.js +2 -45
  136. package/esm2015/models/product-image.js +2 -18
  137. package/esm2015/models/product.js +8 -105
  138. package/esm2015/public_api.js +10 -15
  139. package/esm2015/routing/daffodil-product-routing.js +2 -7
  140. package/esm2015/routing/index.js +2 -7
  141. package/esm2015/routing/public_api.js +2 -7
  142. package/esm2015/routing/resolvers/product-page/product-page.resolver.js +2 -21
  143. package/esm2015/routing/resolvers/product-page-id/product-page-id.resolver.js +2 -33
  144. package/esm2015/routing/resolvers/product-page-url/product-page-url.resolver.js +2 -40
  145. package/esm2015/routing/resolvers/public_api.js +1 -6
  146. package/esm2015/state/actions/best-sellers.actions.js +9 -39
  147. package/esm2015/state/actions/composite-product.actions.js +9 -29
  148. package/esm2015/state/actions/configurable-product.actions.js +8 -56
  149. package/esm2015/state/actions/product-grid.actions.js +9 -39
  150. package/esm2015/state/actions/product-page.actions.js +10 -60
  151. package/esm2015/state/actions/product.actions.js +8 -39
  152. package/esm2015/state/actions/public_api.js +7 -12
  153. package/esm2015/state/daffodil-product-state.js +2 -7
  154. package/esm2015/state/effects/best-seller.effects.js +4 -52
  155. package/esm2015/state/effects/product-grid.effects.js +4 -52
  156. package/esm2015/state/effects/product-page.effects.js +6 -68
  157. package/esm2015/state/effects/product.effects.js +4 -52
  158. package/esm2015/state/effects/public_api.js +1 -6
  159. package/esm2015/state/facades/best-sellers/best-sellers.facade.js +4 -31
  160. package/esm2015/state/facades/composite-product/composite-product-facade.interface.js +2 -86
  161. package/esm2015/state/facades/composite-product/composite-product.facade.js +4 -61
  162. package/esm2015/state/facades/configurable-product/configurable-product-facade.interface.js +2 -108
  163. package/esm2015/state/facades/configurable-product/configurable-product.facade.js +4 -78
  164. package/esm2015/state/facades/product/product-facade.interface.js +2 -70
  165. package/esm2015/state/facades/product/product.facade.js +3 -58
  166. package/esm2015/state/facades/product-grid/product-grid-facade.interface.js +2 -23
  167. package/esm2015/state/facades/product-grid/product-grid.facade.js +3 -27
  168. package/esm2015/state/facades/product-page/facade.interface.js +2 -24
  169. package/esm2015/state/facades/product-page/facade.js +3 -32
  170. package/esm2015/state/facades/public_api.js +1 -6
  171. package/esm2015/state/index.js +2 -7
  172. package/esm2015/state/product-state.module.js +1 -6
  173. package/esm2015/state/public_api.js +6 -11
  174. package/esm2015/state/reducers/best-sellers/best-sellers-reducer-state.interface.js +2 -28
  175. package/esm2015/state/reducers/best-sellers/best-sellers.reducer.js +3 -24
  176. package/esm2015/state/reducers/composite-product-entities/composite-product-entities-reducer-adapter.js +5 -18
  177. package/esm2015/state/reducers/composite-product-entities/composite-product-entities.reducer.js +12 -46
  178. package/esm2015/state/reducers/composite-product-entities/composite-product-entity.js +2 -25
  179. package/esm2015/state/reducers/configurable-product-entities/configurable-product-entities-reducer-adapter.js +4 -17
  180. package/esm2015/state/reducers/configurable-product-entities/configurable-product-entities.reducer.js +11 -67
  181. package/esm2015/state/reducers/configurable-product-entities/configurable-product-entity.js +2 -40
  182. package/esm2015/state/reducers/injection-tokens/config.token.js +4 -13
  183. package/esm2015/state/reducers/injection-tokens/meta.token.js +5 -21
  184. package/esm2015/state/reducers/injection-tokens/public_api.js +1 -6
  185. package/esm2015/state/reducers/product/product-reducer-state.interface.js +2 -33
  186. package/esm2015/state/reducers/product/product.reducer.js +4 -11
  187. package/esm2015/state/reducers/product-entities/product-entities-reducer-adapter.js +4 -18
  188. package/esm2015/state/reducers/product-entities/product-entities.reducer.js +4 -11
  189. package/esm2015/state/reducers/product-grid/product-grid-reducer-state.interface.js +2 -29
  190. package/esm2015/state/reducers/product-grid/product-grid.reducer.js +4 -11
  191. package/esm2015/state/reducers/product-reducers-state.interface.js +1 -35
  192. package/esm2015/state/reducers/product-reducers.js +1 -7
  193. package/esm2015/state/reducers/product-store-feature-key.js +1 -7
  194. package/esm2015/state/reducers/public_api.js +3 -8
  195. package/esm2015/state/selectors/all-selectors.selectors.js +3 -19
  196. package/esm2015/state/selectors/best-sellers/best-sellers.selectors.js +12 -84
  197. package/esm2015/state/selectors/composite-product/composite-product.selectors.js +48 -254
  198. package/esm2015/state/selectors/composite-product-entities/composite-product-entities.selectors.js +16 -122
  199. package/esm2015/state/selectors/configurable-product/configurable-product.selectors.js +41 -387
  200. package/esm2015/state/selectors/configurable-product-entities/configurable-product-entities.selectors.js +12 -106
  201. package/esm2015/state/selectors/product/product.selectors.js +12 -80
  202. package/esm2015/state/selectors/product-entities/product-entities.selectors.js +16 -191
  203. package/esm2015/state/selectors/product-feature.selector.js +5 -29
  204. package/esm2015/state/selectors/product-grid/product-grid.selectors.js +10 -57
  205. package/esm2015/state/selectors/public_api.js +11 -16
  206. package/esm2015/state/testing/daffodil-product-state-testing.js +2 -7
  207. package/esm2015/state/testing/index.js +2 -7
  208. package/esm2015/state/testing/mock-best-sellers.facade.js +3 -18
  209. package/esm2015/state/testing/mock-composite-product-facade.js +4 -52
  210. package/esm2015/state/testing/mock-configurable-product-facade.js +4 -65
  211. package/esm2015/state/testing/mock-product-facade.js +3 -53
  212. package/esm2015/state/testing/mock-product-grid-facade.js +3 -19
  213. package/esm2015/state/testing/mock-product-page-facade.js +3 -19
  214. package/esm2015/state/testing/product-testing.module.js +1 -6
  215. package/esm2015/state/testing/public_api.js +1 -6
  216. package/esm2015/testing/daffodil-product-testing.js +2 -7
  217. package/esm2015/testing/factories/composite-product.factory.js +3 -14
  218. package/esm2015/testing/factories/configurable-product.factory.js +2 -45
  219. package/esm2015/testing/factories/default-product.factory.js +2 -53
  220. package/esm2015/testing/factories/extension.factory.js +3 -30
  221. package/esm2015/testing/factories/kind.factory.js +2 -23
  222. package/esm2015/testing/factories/product-image.factory.js +2 -16
  223. package/esm2015/testing/factories/public_api.js +7 -12
  224. package/esm2015/testing/helpers.js +2 -8
  225. package/esm2015/testing/index.js +2 -7
  226. package/esm2015/testing/injection-tokens/factories/extra.token.js +6 -22
  227. package/esm2015/testing/injection-tokens/factories/type.token.js +5 -21
  228. package/esm2015/testing/injection-tokens/public_api.js +1 -6
  229. package/esm2015/testing/public_api.js +4 -9
  230. package/esm2015/testing/testing.module.js +1 -6
  231. package/fesm2015/daffodil-product-driver-in-memory.js +73 -158
  232. package/fesm2015/daffodil-product-driver-in-memory.js.map +1 -1
  233. package/fesm2015/daffodil-product-driver-magento-testing.js +12 -165
  234. package/fesm2015/daffodil-product-driver-magento-testing.js.map +1 -1
  235. package/fesm2015/daffodil-product-driver-magento.js +81 -801
  236. package/fesm2015/daffodil-product-driver-magento.js.map +1 -1
  237. package/fesm2015/daffodil-product-driver-shopify.js +14 -156
  238. package/fesm2015/daffodil-product-driver-shopify.js.map +1 -1
  239. package/fesm2015/daffodil-product-driver-testing.js +5 -63
  240. package/fesm2015/daffodil-product-driver-testing.js.map +1 -1
  241. package/fesm2015/daffodil-product-driver.js +1 -59
  242. package/fesm2015/daffodil-product-driver.js.map +1 -1
  243. package/fesm2015/daffodil-product-routing.js +5 -113
  244. package/fesm2015/daffodil-product-routing.js.map +1 -1
  245. package/fesm2015/daffodil-product-state-testing.js +16 -241
  246. package/fesm2015/daffodil-product-state-testing.js.map +1 -1
  247. package/fesm2015/daffodil-product-state.js +294 -2412
  248. package/fesm2015/daffodil-product-state.js.map +1 -1
  249. package/fesm2015/daffodil-product-testing.js +20 -256
  250. package/fesm2015/daffodil-product-testing.js.map +1 -1
  251. package/fesm2015/daffodil-product.js +23 -454
  252. package/fesm2015/daffodil-product.js.map +1 -1
  253. package/package.json +3 -3
  254. package/routing/package.json +1 -1
  255. package/state/package.json +1 -1
  256. package/state/testing/package.json +1 -1
  257. package/testing/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../libs/product/state/src/actions/best-sellers.actions.ts","../../../libs/product/state/src/actions/composite-product.actions.ts","../../../libs/product/state/src/actions/configurable-product.actions.ts","../../../libs/product/state/src/actions/product-grid.actions.ts","../../../libs/product/state/src/actions/product.actions.ts","../../../libs/product/state/src/actions/product-page.actions.ts","../../../node_modules/tslib/tslib.es6.js","../../../libs/product/state/src/effects/best-seller.effects.ts","../../../libs/product/state/src/effects/product-grid.effects.ts","../../../libs/product/state/src/effects/product.effects.ts","../../../libs/product/state/src/reducers/product-entities/product-entities-reducer-adapter.ts","../../../libs/product/state/src/reducers/product-store-feature-key.ts","../../../libs/product/state/src/selectors/product-feature.selector.ts","../../../libs/product/state/src/selectors/product-entities/product-entities.selectors.ts","../../../libs/product/state/src/selectors/best-sellers/best-sellers.selectors.ts","../../../libs/product/state/src/reducers/composite-product-entities/composite-product-entities-reducer-adapter.ts","../../../libs/product/state/src/selectors/composite-product-entities/composite-product-entities.selectors.ts","../../../libs/product/state/src/selectors/composite-product/composite-product.selectors.ts","../../../libs/product/state/src/reducers/configurable-product-entities/configurable-product-entities-reducer-adapter.ts","../../../libs/product/state/src/selectors/configurable-product-entities/configurable-product-entities.selectors.ts","../../../libs/product/state/src/selectors/configurable-product/configurable-product.selectors.ts","../../../libs/product/state/src/selectors/product-grid/product-grid.selectors.ts","../../../libs/product/state/src/selectors/product/product.selectors.ts","../../../libs/product/state/src/selectors/all-selectors.selectors.ts","../../../libs/product/state/src/facades/best-sellers/best-sellers.facade.ts","../../../libs/product/state/src/facades/composite-product/composite-product.facade.ts","../../../libs/product/state/src/facades/configurable-product/configurable-product.facade.ts","../../../libs/product/state/src/facades/product/product.facade.ts","../../../libs/product/state/src/facades/product-page/facade.ts","../../../libs/product/state/src/facades/product-grid/product-grid.facade.ts","../../../libs/product/state/src/reducers/best-sellers/best-sellers.reducer.ts","../../../libs/product/state/src/reducers/composite-product-entities/composite-product-entities.reducer.ts","../../../libs/product/state/src/reducers/configurable-product-entities/configurable-product-entities.reducer.ts","../../../libs/product/state/src/reducers/product-entities/product-entities.reducer.ts","../../../libs/product/state/src/reducers/product-grid/product-grid.reducer.ts","../../../libs/product/state/src/reducers/product/product.reducer.ts","../../../libs/product/state/src/reducers/product-reducers.ts","../../../libs/product/state/src/reducers/injection-tokens/meta.token.ts","../../../libs/product/state/src/effects/product-page.effects.ts","../../../libs/product/state/src/reducers/injection-tokens/config.token.ts","../../../libs/product/state/src/product-state.module.ts"],"names":["DaffBestSellersActionTypes","BestSellersLoadAction","BestSellersLoadSuccessAction","BestSellersLoadFailureAction","BestSellersResetAction","this","type","payload","DaffCompositeProductActionTypes","CompositeProductApplyOptionAction","id","itemId","optionId","qty","DaffConfigurableProductActionTypes","ConfigurableProductApplyAttributeAction","ConfigurableProductRemoveAttributeAction","ConfigurableProductToggleAttributeAction","attributeId","attributeValue","DaffProductGridActionTypes","ProductGridLoadAction","ProductGridLoadSuccessAction","ProductGridLoadFailureAction","ProductGridResetAction","DaffProductActionTypes","ProductLoadAction","ProductLoadSuccessAction","ProductLoadFailureAction","DaffProductPageActionTypes","ProductPageLoadByUrlAction","ProductPageLoadAction","ProductPageLoadSuccessAction","ProductPageLoadFailureAction","UpdateQtyAction","__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","__metadata","metadataKey","metadataValue","metadata","create","__read","o","n","m","Symbol","iterator","e","call","ar","next","done","push","value","error","__spread","concat","actions$","driver","errorMatcher","_this","loadBestSellers$","pipe","ofType","switchMap","action","getBestSellers","map","resp","DaffBestSellersLoadSuccess","catchError","of","DaffBestSellersLoadFailure","Injectable","Actions","Inject","args","DaffProductDriver","DAFF_PRODUCT_ERROR_MATCHER","Effect","Observable","loadAll$","getAll","DaffProductGridLoadSuccess","DaffProductGridLoadFailure","load$","get","DaffProductLoadSuccess","DaffProductLoadFailure","cache","daffProductEntitiesAdapter","createEntityAdapter","DAFF_PRODUCT_STORE_FEATURE_KEY","getDaffProductFeatureSelector","selectProductState","createFeatureSelector","createProductEntitiesSelectors","adapterSelectors","getSelectors","selectProductEntitiesState","createSelector","state","products","selectProductIds","selectIds","selectProductEntities","selectEntities","selectAllProducts","selectAll","selectProductTotal","selectTotal","selectProduct","defaultMemoize","productId","memoized","selectProductPrice","product","price","selectProductDiscountAmount","_a","discount","amount","selectProductDiscountedPrice","discountAmount","daffSubtract","selectProductDiscountPercent","percent","selectProductHasDiscount","selectIsProductOutOfStock","in_stock","getDaffProductEntitiesSelectors","createBestSellersSelectors","selectBestSellersState","bestSellers","selectBestSellersLoadingState","loading","selectBestSellersIdsState","productIds","selectBestSellersProducts","ids","filter","indexOf","getDaffBestSellersSelectors","daffCompositeProductAppliedOptionsEntitiesAdapter","createCompositeProductAppliedOptionsEntitiesSelectors","selectCompositeProductAppliedOptionsEntitiesState","compositeProductOptions","selectCompositeProductIds","selectCompositeProductAppliedOptionsEntities","selectCompositeProductTotal","selectCompositeProductAppliedOptions","appliedOptions","DaffProductTypeEnum","Composite","items","reduce","acc","item","assign","entities","options","find","option","quantity","selectIsCompositeProductItemRequired","item_id","productItem","required","getDaffCompositeProductEntitiesSelectors","createCompositeProductSelectors","selectCompositeProductRequiredItemPricesForConfiguration","configuration","getAppliedOptionsForConfiguration","minPrice","getMinPricesForConfiguration","maxPrice","getMaxPricesForConfiguration","selectCompositeProductOptionalItemPricesForConfiguration","getMaxPricesForConfigurationIncludingOptionalItems","selectCompositeProductPricesAsCurrentlyConfigured","appliedOptionsEntities","projector","selectCompositeProductDiscountAmount","appliedConfigurationItem","_b","daffAdd","daffMultiply","selectCompositeProductDiscountPercent","prices","daffDivide","originalPrice","discountedPrice","getDaffCompositeProductSelectors","appliedOptionHasId","getDiscountedPrice","Math","min","apply","getMinimumRequiredCompositeItemDiscountedPrice","getOptionQty","getMinimumRequiredCompositeItemPrice","max","getMaximumRequiredCompositeItemDiscountedPrice","getMaximumRequiredCompositeItemPrice","appliedOptionHasQty","_c","undefined","appliedOption","daffConfigurableProductAppliedAttributesEntitiesAdapter","createConfigurableProductAppliedAttributesEntitiesSelectors","selectConfigurableProductAppliedAttributesEntitiesState","configurableProductAttributes","selectConfigurableProductIds","selectConfigurableProductAppliedAttributesEntities","selectConfigurableProductTotal","selectConfigurableProductAppliedAttributes","attributes","selectConfigurableProductAppliedAttributesAsDictionary","attribute","code","getDaffConfigurableProductEntitiesSelectors","createConfigurableProductSelectors","selectAllConfigurableProductVariants","Configurable","variants","selectMatchingConfigurableProductVariants","appliedAttributes","variant","isVariantAvailable","selectConfigurableProductPrices","selectConfigurableProductDiscountedPrices","selectConfigurableProductPercentDiscounts","selectConfigurableProductHasDiscount","selectConfigurableProductMinimumPrice","getMinimumPrice","selectConfigurableProductMaximumPrice","getMaximumPrice","selectConfigurableProductMinimumDiscountedPrice","selectConfigurableProductMaximumDiscountedPrice","selectConfigurableProductMinimumPercentDiscount","selectConfigurableProductMaximumPercentDiscount","isConfigurablePriceRanged","selectAllConfigurableProductAttributes","configurableAttributes","values","selectSelectableConfigurableProductAttributes","selectableAttributes","matchedVariants","matchingVariants","appliedAttribute","filteredVariants","slice","getSelectableAttributesFromVariants","forEach","selectedAttributes","attributeArray","variantValue","getDaffConfigurableProductSelectors","createProductGridSelectors","selectProductGridState","productGrid","selectProductGridLoadingState","getDaffProductGridSelectors","createProductPageSelectors","selectCurrentProductState","selectCurrentProductLoadingState","selectCurrentProductId","currentProductId","selectCurrentProduct","getDaffProductPageSelectors","getDaffProductSelectors","DaffBestSellersFacade","store","loading$","select","bestSellers$","prototype","dispatch","providedIn","Store","DaffCompositeProductFacade","selectors","hasDiscount","productPriceRangeHasDiscount","hasPriceRange","productPriceRangeHasPriceRange","getRequiredItemPricesForConfiguration","getOptionalItemPricesForConfiguration","getPricesAsCurrentlyConfigured","getAppliedOptions","getDiscountAmount","getDiscountPercent","isItemRequired","DaffConfigurableProductFacade","getAllAttributes","getAllVariants","getAppliedAttributes","getMinimumDiscountedPrice","getMaximumDiscountedPrice","getMinimumPercentDiscount","getMaximumPercentDiscount","isPriceRanged","getSelectableAttributes","getMatchingVariants","DaffProductFacade","getProduct","getPrice","isOutOfStock","DaffProductPageFacade","product$","DaffProductGridFacade","products$","initialState","errors","resetState","daffBestSellersReducer","getIds","Array","daffCompositeProductEntitiesReducer","getInitialState","adapter","upsertMany","mapOptionsEntities","upsertOne","defaultOptionIndex","findIndex","is_default","getDefaultOption","buildCompositeProductAppliedOptionsEntity","daffConfigurableProductEntitiesReducer","currentAttributes","attributeCode","index","mapEntities","applyAttribute","removeAttribute","buildConfigurableProductAppliedAttributesEntity","appliedAttributeCode","appliedAttributeValue","attributeIndex","daffProductEntitiesReducer","removeAll","daffProductGridReducer","initialState$1","daffProductReducer","initialState$2","daffProductReducers","DAFF_PRODUCT_META_REDUCERS","InjectionToken","factory","DaffProductPageLoadSuccess","DaffProductPageLoadFailure","loadByUrl$","getByUrl","DAFF_PRODUCT_STORE_CONFIG","metaReducers","inject","NgModule","imports","StoreModule","forFeature","EffectsModule","DaffProductGridEffects","DaffProductEffects","DaffProductPageEffects","DaffBestSellersEffects","_i","metaReducer","provide","useValue","multi"],"mappings":"61BAQYA,EAA0B,CACpCC,sBAAqB,4BACrBC,6BAA4B,oCAC5BC,6BAA4B,oCAC5BC,uBAAsB,gCAStB,WAFSC,KAAAC,KAAON,EAA2BC,6BAa3C,SAAmBM,GAAAF,KAAAE,QAAAA,EAFVF,KAAAC,KAAON,EAA2BE,oCAa3C,SAAmBK,GAAAF,KAAAE,QAAAA,EAFVF,KAAAC,KAAON,EAA2BG,oCAW3C,WAFSE,KAAAC,KAAON,EAA2BI,4BCrCjCI,EAA+B,CAC1CC,kCAAiC,+DAchC,SAAmBC,EAAoBC,EAA+CC,EAAuDC,GAA1HR,KAAAK,GAAAA,EAAoBL,KAAAM,OAAAA,EAA+CN,KAAAO,SAAAA,EAAuDP,KAA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B,IAAIrB,EAAOzE,SACpBsE,KACCK,EAAAA,KAAG,SAAEC,GAAS,OAAA,IAAI0R,EAA2B1R,MAC7CE,EAAAA,YAAU,SAAEhB,GAAqB,OAAAiB,EAAAA,GAAG,IAAIwR,EAA2BnS,EAAKD,aAAaL,aAM7FhE,KAAA0W,WAA8B1W,KAAKmE,SAASK,KAC1CC,EAAAA,OAAOjD,EAA2BC,4BAClCiD,EAAAA,WAAS,SAAEC,GACT,OAAAL,EAAKF,OAAOuS,SAAShS,EAAOzE,SACzBsE,KACCK,EAAAA,KAAG,SAAEC,GAAS,OAAA,IAAI0R,EAA2B1R,MAC7CE,EAAAA,YAAU,SAAEhB,GAAqB,OAAAiB,EAAAA,GAAG,IAAIwR,EAA2BnS,EAAKD,aAAaL,mCAlC9FmB,EAAAA,uDAvCCC,EAAAA,wCA4CGC,EAAAA,OAAMC,KAAA,CAACC,EAAAA,qDACTF,EAAAA,OAAMC,KAAA,CAACE,EAAAA,iCAUR1D,EAAA,CADC2D,EAAAA,yBACMC,EAAAA,0CAYP5D,EAAA,CADC2D,EAAAA,yBACWC,EAAAA,mDCvDDkR,GAA4B,IAAIN,EAAAA,eAC3C,4BACA,CACEC,QAAO,WAAQ,MAAA,CACbM,aAAcC,EAAAA,OAAOT,WCK3B,kCAXCU,EAAAA,SAAQzR,KAAA,CAAC,CACR0R,QAAS,CACPC,EAAAA,YAAYC,WAAW5Q,EAAgC8P,GAAqBQ,IAC5EO,EAAAA,cAAcD,WAAW,CACvBE,EACAC,EACAC,GACAC,syCHYJ,IAAAV,EAAA,GAAAW,EAAA,EAAAA,EAAAnV,UAAAC,OAAAkV,IAAAX,EAAAW,GAAAnV,UAAAmV,GAEA,OAAOX,EAAahS,KAAG,SAAC4S,GAAe,MAAA,CACrCC,QAASrB,GACTsB,SAAUF,EACVG,OAAO","sourcesContent":["import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * Action types for Best Seller Actions.\n */\nexport enum DaffBestSellersActionTypes {\n BestSellersLoadAction = '[BestSellers] Load Action',\n BestSellersLoadSuccessAction = '[BestSellers] Load Success Action',\n BestSellersLoadFailureAction = '[BestSellers] Load Failure Action',\n BestSellersResetAction = '[BestSellers] Reset Action'\n}\n\n/**\n * Triggers a request for best selling products.\n */\nexport class DaffBestSellersLoad implements Action {\n readonly type = DaffBestSellersActionTypes.BestSellersLoadAction;\n\n constructor() {}\n}\n\n/**\n * An action called when a request for best selling products succeeded.\n *\n * @param payload - An array of Products\n */\nexport class DaffBestSellersLoadSuccess<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffBestSellersActionTypes.BestSellersLoadSuccessAction;\n\n constructor(public payload: T[]) {}\n}\n\n/**\n * An action called when a request for best selling products failed.\n *\n * @param payload - An error message\n */\nexport class DaffBestSellersLoadFailure implements Action {\n readonly type = DaffBestSellersActionTypes.BestSellersLoadFailureAction;\n\n constructor(public payload: DaffStateError) {}\n}\n\n/**\n * Resets the state of the best sellers redux store to its initial state.\n */\nexport class DaffBestSellersReset implements Action {\n readonly type = DaffBestSellersActionTypes.BestSellersResetAction;\n\n constructor() {}\n}\n\nexport type DaffBestSellersActions<T extends DaffProduct = DaffProduct> =\n | DaffBestSellersLoad\n | DaffBestSellersLoadSuccess<T>\n | DaffBestSellersLoadFailure\n | DaffBestSellersReset;\n","import { Action } from '@ngrx/store';\n\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n} from '@daffodil/product';\n\n/**\n * Action types for Composite Product Actions.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport enum DaffCompositeProductActionTypes {\n\tCompositeProductApplyOptionAction = '[Composite Product] Composite Product Apply Option Action'\n}\n\n/**\n * Applies a product option to a particular composite product.\n *\n * @param id - Id of the Composite Product\n * @param itemId - Id of the product item.\n * @param optionId - Id of the option of the product item that is chosen.\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport class DaffCompositeProductApplyOption<T extends DaffCompositeProduct> implements Action {\n readonly type = DaffCompositeProductActionTypes.CompositeProductApplyOptionAction;\n\n constructor(public id: T['id'], public itemId: DaffCompositeProductItem['id'], public optionId: DaffCompositeProductItemOption['id'], public qty?: number) {}\n}\n\n/**\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport type DaffCompositeProductActions<T extends DaffCompositeProduct = DaffCompositeProduct> =\n\t| DaffCompositeProductApplyOption<T>;\n","import { Action } from '@ngrx/store';\n\nimport { DaffConfigurableProduct } from '@daffodil/product';\n\n/**\n * Action types for Configurable Product Actions.\n */\nexport enum DaffConfigurableProductActionTypes {\n\tConfigurableProductApplyAttributeAction = '[Configurable Product] Configurable Product Apply Attribute Action',\n\tConfigurableProductRemoveAttributeAction = '[Configurable Product] Configurable Product Remove Attribute Action',\n\tConfigurableProductToggleAttributeAction = '[Configurable Product] Configurable Product Toggle Attribute Action',\n}\n\n/**\n * Applies an attribute to a particular configurable product.\n *\n * @param id - Id of the Configurable Product\n * @param attributeId - Id of the attribute to be applied\n * @param attributeValue - Value of the attribute to be applied\n */\nexport class DaffConfigurableProductApplyAttribute<T extends DaffConfigurableProduct> implements Action {\n readonly type = DaffConfigurableProductActionTypes.ConfigurableProductApplyAttributeAction;\n\n constructor(public id: T['id'], public attributeId: string, public attributeValue: string) {}\n}\n\n/**\n * Removes an applied attribute from a particular configurable product.\n *\n * @param id - Id of the Configurable Product\n * @param attributeId - Id of the attribute to be removed\n */\nexport class DaffConfigurableProductRemoveAttribute<T extends DaffConfigurableProduct> implements Action {\n readonly type = DaffConfigurableProductActionTypes.ConfigurableProductRemoveAttributeAction;\n\n constructor(public id: T['id'], public attributeId: string) {}\n}\n\n/**\n * Toggles an attribute of a particular configurable product. If the attribute type of the configurable product already has\n * a different value than the one provided in the action, the attribute value in state will be overwritten by the value provided\n * in the action.\n *\n * @param id - Id of the Configurable Product\n * @param attributeId - Id of the attribute to be toggled\n * @param attributeValue - Value of the attribute to be toggled\n */\nexport class DaffConfigurableProductToggleAttribute<T extends DaffConfigurableProduct> implements Action {\n readonly type = DaffConfigurableProductActionTypes.ConfigurableProductToggleAttributeAction;\n\n constructor(public id: T['id'], public attributeId: string, public attributeValue: string) {}\n}\n\nexport type DaffConfigurableProductActions<T extends DaffConfigurableProduct = DaffConfigurableProduct> =\n | DaffConfigurableProductApplyAttribute<T>\n | DaffConfigurableProductRemoveAttribute<T>\n | DaffConfigurableProductToggleAttribute<T>;\n","import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * Action types for Product Grid Actions.\n */\nexport enum DaffProductGridActionTypes {\n ProductGridLoadAction = '[ProductGrid] Load Action',\n ProductGridLoadSuccessAction = '[ProductGrid] Load Success Action',\n ProductGridLoadFailureAction = '[ProductGrid] Load Failure Action',\n ProductGridResetAction = '[ProductGrid] Reset Action'\n}\n\n/**\n * Triggers a request for an array of products.\n */\nexport class DaffProductGridLoad implements Action {\n readonly type = DaffProductGridActionTypes.ProductGridLoadAction;\n\n constructor() {}\n}\n\n/**\n * An action called when a request for of an array of products succeeded.\n *\n * @param payload - An array of Products\n */\nexport class DaffProductGridLoadSuccess<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffProductGridActionTypes.ProductGridLoadSuccessAction;\n\n constructor(public payload: T[]) {}\n}\n\n/**\n * An action called when a request for an array of products failed.\n *\n * @param payload - An error message\n */\nexport class DaffProductGridLoadFailure implements Action {\n readonly type = DaffProductGridActionTypes.ProductGridLoadFailureAction;\n\n constructor(public payload: DaffStateError) {}\n}\n\n/**\n * Resets the state of the product grid redux store to its initial state.\n */\nexport class DaffProductGridReset implements Action {\n readonly type = DaffProductGridActionTypes.ProductGridResetAction;\n\n constructor() {}\n}\n\nexport type DaffProductGridActions<T extends DaffProduct = DaffProduct> =\n | DaffProductGridLoad\n | DaffProductGridLoadSuccess<T>\n | DaffProductGridLoadFailure\n | DaffProductGridReset;\n","import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\nimport { DaffProductDriverResponse } from '@daffodil/product/driver';\n\n/**\n * Action types for Product Actions.\n */\nexport enum DaffProductActionTypes {\n ProductLoadAction = '[Product] Load Action',\n ProductLoadSuccessAction = '[Product] Load Success Action',\n ProductLoadFailureAction = '[Product] Load Failure Action',\n}\n\n/**\n * Triggers a request for a Product.\n *\n * @param payload - Id of requested Product\n */\nexport class DaffProductLoad implements Action {\n readonly type = DaffProductActionTypes.ProductLoadAction;\n\n constructor(public payload: string) {}\n}\n\n/**\n * An action called when a request for a Product succeeded.\n *\n * @param payload - A Product\n */\nexport class DaffProductLoadSuccess<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffProductActionTypes.ProductLoadSuccessAction;\n\n constructor(public payload: DaffProductDriverResponse<T>) {}\n}\n\n/**\n * An action called when a request for a Product failed.\n *\n * @param payload - An error message\n */\nexport class DaffProductLoadFailure implements Action {\n readonly type = DaffProductActionTypes.ProductLoadFailureAction;\n\n constructor(public payload: DaffStateError) {}\n}\n\nexport type DaffProductActions<T extends DaffProduct = DaffProduct> =\n | DaffProductLoad\n | DaffProductLoadSuccess<T>\n | DaffProductLoadFailure;\n","import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\nimport { DaffProductDriverResponse } from '@daffodil/product/driver';\n\n/**\n * Action types for Product Page Actions.\n */\nexport enum DaffProductPageActionTypes {\n ProductPageLoadByUrlAction = '[Product Page] Load By URL Action',\n ProductPageLoadAction = '[Product Page] Load Action',\n ProductPageLoadSuccessAction = '[Product Page] Load Success Action',\n ProductPageLoadFailureAction = '[Product Page] Load Failure Action',\n UpdateQtyAction = '[Product Page] Update Qty Action'\n}\n\n/**\n * An action triggered to initialize a product page load.\n * This is intended to be used for loading a product page rather than only a product.\n *\n * @param payload - URL of the requested product\n */\nexport class DaffProductPageLoadByUrl<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffProductPageActionTypes.ProductPageLoadByUrlAction;\n\n constructor(public payload: T['url']) { }\n}\n\n/**\n * An action triggered to initialize a product page load.\n * This is intended to be used for loading a product page rather than only a product.\n *\n * @param payload - Id of the requested product\n */\nexport class DaffProductPageLoad implements Action {\n readonly type = DaffProductPageActionTypes.ProductPageLoadAction;\n\n constructor(public payload: string) { }\n}\n\n/**\n * An action triggered upon a successful product page request.\n *\n * @param payload - A DaffProduct\n */\nexport class DaffProductPageLoadSuccess<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffProductPageActionTypes.ProductPageLoadSuccessAction;\n\n constructor(public payload: DaffProductDriverResponse<T>) { }\n}\n\n/**\n * An action triggered upon a failed product page request.\n *\n * @param payload - an error message\n */\nexport class DaffProductPageLoadFailure implements Action {\n readonly type = DaffProductPageActionTypes.ProductPageLoadFailureAction;\n\n constructor(public payload: DaffStateError) { }\n}\n\n/**\n * Update the qty of the current product.\n *\n * @param payload - The qty of the product.\n */\nexport class DaffProductPageUpdateQty implements Action {\n readonly type = DaffProductPageActionTypes.UpdateQtyAction;\n\n constructor(public payload: number) {}\n}\n\nexport type DaffProductPageActions<T extends DaffProduct = DaffProduct> =\n | DaffProductPageLoadByUrl<T>\n | DaffProductPageLoad\n | DaffProductPageLoadSuccess<T>\n | DaffProductPageLoadFailure\n | DaffProductPageUpdateQty;\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || from);\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n Effect,\n ofType,\n} from '@ngrx/effects';\nimport {\n Observable ,\n of,\n} from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport {\n DaffProduct,\n DAFF_PRODUCT_ERROR_MATCHER,\n} from '@daffodil/product';\nimport {\n DaffProductDriver,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n DaffBestSellersActionTypes,\n DaffBestSellersLoad,\n DaffBestSellersLoadFailure,\n DaffBestSellersLoadSuccess,\n} from '../actions/public_api';\n\n/**\n * Effects for handling best seller actions and best seller service requests.\n *\n * @param action$ - Redux action object\n * @param driver - A product service driver\n */\n@Injectable()\nexport class DaffBestSellersEffects<T extends DaffProduct> {\n\n constructor(\n private actions$: Actions,\n @Inject(DaffProductDriver) private driver: DaffProductServiceInterface<T>,\n\t\t@Inject(DAFF_PRODUCT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n /**\n * Handles BestSellersLoadAction by making a service call for best selling products and returning a success or failure action\n * to the action stream.\n *\n * @returns An Observable of a BestSellersLoad action\n */\n @Effect()\n loadBestSellers$: Observable<any> = this.actions$.pipe(\n ofType(DaffBestSellersActionTypes.BestSellersLoadAction),\n switchMap((action: DaffBestSellersLoad) =>\n this.driver.getBestSellers()\n .pipe(\n map((resp) => new DaffBestSellersLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffBestSellersLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n Effect,\n ofType,\n} from '@ngrx/effects';\nimport {\n of,\n Observable,\n} from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport {\n DaffProduct,\n DAFF_PRODUCT_ERROR_MATCHER,\n} from '@daffodil/product';\nimport {\n DaffProductDriver,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridLoad,\n DaffProductGridLoadSuccess,\n DaffProductGridLoadFailure,\n} from '../actions/product-grid.actions';\n\n/**\n * Effects for handling product grid actions and for triggering corresponding service requests.\n *\n * @param action$ - Redux action object\n * @param driver - A product service driver\n */\n@Injectable()\nexport class DaffProductGridEffects<T extends DaffProduct> {\n\n constructor(\n private actions$: Actions,\n @Inject(DaffProductDriver) private driver: DaffProductServiceInterface<T>,\n\t\t@Inject(DAFF_PRODUCT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n /**\n * Handles ProductGridLoadAction by making a service call for products and returning a success or failure action\n * to the action stream.\n *\n * @returns An Observable of a DaffProductGridAction\n */\n @Effect()\n loadAll$: Observable<any> = this.actions$.pipe(\n ofType(DaffProductGridActionTypes.ProductGridLoadAction),\n switchMap((action: DaffProductGridLoad) =>\n this.driver.getAll()\n .pipe(\n map((resp) => new DaffProductGridLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffProductGridLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n Effect,\n ofType,\n} from '@ngrx/effects';\nimport {\n of,\n Observable,\n} from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport {\n DaffProduct,\n DAFF_PRODUCT_ERROR_MATCHER,\n} from '@daffodil/product';\nimport {\n DaffProductDriver,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n DaffProductActionTypes,\n DaffProductLoad,\n DaffProductLoadSuccess,\n DaffProductLoadFailure,\n} from '../actions/product.actions';\n\n/**\n * Effects for handling product actions and for triggering corresponding service requests.\n *\n * @param action$ - Redux action object\n * @param driver - A product service driver\n */\n@Injectable()\nexport class DaffProductEffects<T extends DaffProduct> {\n\n constructor(\n private actions$: Actions,\n @Inject(DaffProductDriver) private driver: DaffProductServiceInterface<T>,\n\t\t@Inject(DAFF_PRODUCT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n /**\n * Handles ProductLoadAction by making a service call for a product and returning a success or\n * failure action to the action stream.\n *\n * @returns An Observable of a ProductLoadAction\n */\n @Effect()\n load$: Observable<any> = this.actions$.pipe(\n ofType(DaffProductActionTypes.ProductLoadAction),\n switchMap((action: DaffProductLoad) =>\n this.driver.get(action.payload)\n .pipe(\n map((resp) => new DaffProductLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffProductLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n}\n","import {\n EntityAdapter,\n createEntityAdapter,\n} from '@ngrx/entity';\n\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * Product Adapter for changing/overwriting entity state.\n */\nexport const daffProductEntitiesAdapter = (() => {\n let cache;\n return <T extends DaffProduct>(): EntityAdapter<T> =>\n cache = cache || createEntityAdapter<T>();\n})();\n","export const DAFF_PRODUCT_STORE_FEATURE_KEY = 'daffProduct';\n","import {\n createFeatureSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductReducersState } from '../reducers/product-reducers-state.interface';\nimport { DAFF_PRODUCT_STORE_FEATURE_KEY } from '../reducers/product-store-feature-key';\n\n/**\n * An interface for the entire product feature state.\n */\nexport interface DaffProductFeatureMemoizedSelector<T extends DaffProduct = DaffProduct> {\n\tselectProductState: MemoizedSelector<Record<string, any>, DaffProductReducersState<T>>;\n}\n\n/**\n * A function that returns a selector for the entire product feature state.\n */\nexport const getDaffProductFeatureSelector = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffProductFeatureMemoizedSelector<T> => cache = cache\n ? cache\n : { selectProductState: createFeatureSelector<DaffProductReducersState<T>>(DAFF_PRODUCT_STORE_FEATURE_KEY) };\n})();\n","import { EntityState } from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport { daffSubtract } from '@daffodil/core';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { daffProductEntitiesAdapter } from '../../reducers/product-entities/product-entities-reducer-adapter';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to product entities and prices for simple products.\n */\nexport interface DaffProductEntitiesMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n\t/**\n\t * Selects the ngrx entities state for products.\n\t */\n\tselectProductEntitiesState: MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>>;\n\t/**\n\t * Selects all ids for products in state.\n\t */\n\tselectProductIds: MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>['ids']>;\n\t/**\n\t * Selects the ngrx entities for all products in state.\n\t */\n\tselectProductEntities: MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>['entities']>;\n\t/**\n\t * Selects all products in state as an array.\n\t */\n\tselectAllProducts: MemoizedSelector<DaffProductStateRootSlice<T>, T[]>;\n\t/**\n\t * Selects the total number of products in state.\n\t */\n\tselectProductTotal: MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects a product by id.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProduct: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, T>;\n\t/**\n\t * Selects the price of a product.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductPrice: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects the discount of a product as some amount of currency.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductDiscountAmount: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects the discounted price of a product.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductDiscountedPrice: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects the discount of a product as a percent of the original price.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductDiscountPercent: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects whether or not the product has a discount.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductHasDiscount: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, boolean>;\n\t/**\n\t * Selects whether or not a product is out of stock.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectIsProductOutOfStock: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, boolean>;\n}\n\nconst createProductEntitiesSelectors = <T extends DaffProduct>(): DaffProductEntitiesMemoizedSelectors<T> => {\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n const adapterSelectors = daffProductEntitiesAdapter<T>().getSelectors();\n /**\n * Product Entities State\n */\n const selectProductEntitiesState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.products,\n );\n\n /**\n * Adapters created with @ngrx/entity generate\n * commonly used selector functions including\n * getting all ids in the record set, a dictionary\n * of the records by id, an array of records and\n * the total number of records. This reduces boilerplate\n * in selecting records from the entity state.\n */\n const selectProductIds = createSelector(\n selectProductEntitiesState,\n adapterSelectors.selectIds,\n );\n\n const selectProductEntities = createSelector(\n selectProductEntitiesState,\n adapterSelectors.selectEntities,\n );\n\n const selectAllProducts = createSelector(\n selectProductEntitiesState,\n adapterSelectors.selectAll,\n );\n\n const selectProductTotal = createSelector(\n selectProductEntitiesState,\n adapterSelectors.selectTotal,\n );\n\n const selectProduct = defaultMemoize((productId: T['id']) => createSelector(\n selectProductEntities,\n products => products[productId],\n )).memoized;\n\n const selectProductPrice = defaultMemoize((productId: T['id']) => createSelector(\n selectProduct(productId),\n (product: T) => product?.price || null,\n )).memoized;\n\n const selectProductDiscountAmount = defaultMemoize((productId: T['id']) => createSelector(\n selectProduct(productId),\n (product: T) => product?.discount?.amount || 0,\n )).memoized;\n\n const selectProductDiscountedPrice = defaultMemoize((productId: T['id']) => createSelector(\n selectProductPrice(productId),\n selectProductDiscountAmount(productId),\n (price: number, discountAmount: number) => daffSubtract(price, discountAmount),\n )).memoized;\n\n const selectProductDiscountPercent = defaultMemoize((productId: T['id']) => createSelector(\n selectProduct(productId),\n (product: T) => product.discount?.percent || 0,\n )).memoized;\n\n const selectProductHasDiscount = defaultMemoize((productId: T['id']) => createSelector(\n selectProductDiscountAmount(productId),\n (discountAmount: number) => !!discountAmount,\n )).memoized;\n\n const selectIsProductOutOfStock = defaultMemoize((productId: T['id']) => createSelector(\n selectProduct(productId),\n (product: T) => product ? !product.in_stock : null,\n )).memoized;\n\n return {\n selectProductEntitiesState,\n selectProductIds,\n selectProductEntities,\n selectAllProducts,\n selectProductTotal,\n selectProduct,\n selectProductPrice,\n selectProductDiscountAmount,\n selectProductDiscountedPrice,\n selectProductDiscountPercent,\n selectProductHasDiscount,\n selectIsProductOutOfStock,\n };\n};\n\n/**\n * A function that returns all selectors related to product entities and simple product prices.\n */\nexport const getDaffProductEntitiesSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffProductEntitiesMemoizedSelectors<T> => cache = cache\n ? cache\n : createProductEntitiesSelectors<T>();\n})();\n","import {\n createSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffBestSellersReducerState } from '../../reducers/best-sellers/best-sellers-reducer-state.interface';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductEntitiesSelectors } from '../product-entities/product-entities.selectors';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for the available best sellers selectors.\n */\nexport interface DaffBestSellersMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n\t/**\n\t * Selector for best sellers feature state\n\t */\n\tselectBestSellersState: MemoizedSelector<DaffProductStateRootSlice<T>, DaffBestSellersReducerState>;\n\t/**\n\t * Selector for the loading state of best selling products.\n\t */\n\tselectBestSellersLoadingState: MemoizedSelector<DaffProductStateRootSlice<T>, boolean>;\n\t/**\n\t * Selector for the IDs of best selling products.\n\t */\n\tselectBestSellersIdsState: MemoizedSelector<DaffProductStateRootSlice<T>, T['id'][]>;\n\t/**\n\t * Selector for the best selling products.\n\t */\n\tselectBestSellersProducts: MemoizedSelector<DaffProductStateRootSlice<T>, T[]>;\n}\n\nconst createBestSellersSelectors = <T extends DaffProduct>(): DaffBestSellersMemoizedSelectors<T> => {\n const {\n selectAllProducts,\n } = getDaffProductEntitiesSelectors<T>();\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n\n const selectBestSellersState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.bestSellers,\n );\n\n const selectBestSellersLoadingState = createSelector(\n selectBestSellersState,\n (state: DaffBestSellersReducerState) => state.loading,\n );\n\n const selectBestSellersIdsState = createSelector(\n selectBestSellersState,\n (state: DaffBestSellersReducerState) => state.productIds,\n );\n\n const selectBestSellersProducts = createSelector(\n selectBestSellersIdsState,\n selectAllProducts,\n (ids: T['id'][], products: T[]) => products.filter(product => ids.indexOf(product.id) > -1),\n );\n\n return {\n selectBestSellersState,\n selectBestSellersLoadingState,\n selectBestSellersIdsState,\n selectBestSellersProducts,\n };\n};\n\n/**\n * A function that returns all selectors related to best sellers state.\n *\n * Returns {@link DaffBestSellersMemoizedSelectors}.\n */\nexport const getDaffBestSellersSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffBestSellersMemoizedSelectors<T> => cache = cache\n ? cache\n : createBestSellersSelectors<T>();\n})();\n","import {\n EntityAdapter,\n createEntityAdapter,\n} from '@ngrx/entity';\n\nimport { DaffCompositeProductEntity } from './composite-product-entity';\n\n/**\n * Composite Product Item Options Adapter for changing/overwriting entity state.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport const daffCompositeProductAppliedOptionsEntitiesAdapter = (() => {\n let cache;\n return (): EntityAdapter<DaffCompositeProductEntity> =>\n cache = cache || createEntityAdapter<DaffCompositeProductEntity>();\n})();\n","import {\n EntityState,\n Dictionary,\n} from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n DaffCompositeProduct,\n DaffCompositeProductItemOption,\n DaffCompositeProductItem,\n} from '@daffodil/product';\n\nimport { daffCompositeProductAppliedOptionsEntitiesAdapter } from '../../reducers/composite-product-entities/composite-product-entities-reducer-adapter';\nimport { DaffCompositeProductEntity } from '../../reducers/composite-product-entities/composite-product-entity';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductEntitiesSelectors } from '../product-entities/product-entities.selectors';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to the composite product applied options.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport interface DaffCompositeProductEntitiesMemoizedSelectors {\n\t/**\n\t * The ngrx entities state for composite product applied options.\n\t */\n\tselectCompositeProductAppliedOptionsEntitiesState: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffCompositeProductEntity>>;\n\t/**\n\t * A selector for all composite product ids in state.\n\t */\n\tselectCompositeProductIds: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffCompositeProductEntity>['ids']>;\n\t/**\n\t * The ngrx entities for the composite product appllied options.\n\t */\n\tselectCompositeProductAppliedOptionsEntities: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffCompositeProductEntity>['entities']>;\n\t/**\n\t * The total number of composite products in state.\n\t */\n\tselectCompositeProductTotal: MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the applied options for a composite product.\n\t *\n\t * @param id the id of the composite product.\n\t */\n\tselectCompositeProductAppliedOptions: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, Dictionary<DaffCompositeProductItemOption>>;\n\t/**\n\t * Selects whether the particular item of a composite product is required in order for the product to be valid, i.e. addable to the cart.\n\t *\n\t * @param id the id of the composite product.\n\t * @param item_id the id of the composite product item.\n\t */\n\tselectIsCompositeProductItemRequired: (id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']) => MemoizedSelector<DaffProductStateRootSlice, boolean>;\n}\n\nconst createCompositeProductAppliedOptionsEntitiesSelectors = <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors => {\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n const {\n selectProductEntities,\n selectProduct,\n } = getDaffProductEntitiesSelectors();\n const adapterSelectors = daffCompositeProductAppliedOptionsEntitiesAdapter().getSelectors();\n\n const selectCompositeProductAppliedOptionsEntitiesState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.compositeProductOptions,\n );\n\n const selectCompositeProductIds = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectIds,\n );\n\n const selectCompositeProductAppliedOptionsEntities = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectEntities,\n );\n\n const selectCompositeProductTotal = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectTotal,\n );\n\n const selectCompositeProductAppliedOptions = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntitiesState,\n (product: DaffCompositeProduct, appliedOptions) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n return product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: appliedOptions.entities[product.id].items[item.id].value ? {\n ...item.options.find(option => option.id === appliedOptions.entities[product.id].items[item.id].value),\n quantity: appliedOptions.entities[product.id].items[item.id].qty,\n } : null,\n }), {});\n },\n )).memoized;\n\n const selectIsCompositeProductItemRequired = defaultMemoize((id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']) => createSelector(\n selectProduct(id),\n (product: DaffCompositeProduct) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const productItem = product.items.find(item => item.id === item_id);\n\n return productItem ? productItem.required : null;\n },\n )).memoized;\n\n\n return {\n selectCompositeProductAppliedOptionsEntitiesState,\n selectCompositeProductIds,\n selectCompositeProductAppliedOptionsEntities,\n selectCompositeProductTotal,\n selectCompositeProductAppliedOptions,\n selectIsCompositeProductItemRequired,\n };\n};\n\n/**\n * A function that returns all selectors related to composite product applied option entities.\n * Returns {@link DaffCompositeProductEntitiesMemoizedSelectors}.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport const getDaffCompositeProductEntitiesSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors => cache = cache\n ? cache\n : createCompositeProductAppliedOptionsEntitiesSelectors<T>();\n})();\n","import { Dictionary } from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n daffAdd,\n daffDivide,\n daffMultiply,\n daffSubtract,\n} from '@daffodil/core';\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n DaffProductPrices,\n DaffPriceRange,\n DaffCompositeConfigurationItem,\n} from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffCompositeProductEntitiesSelectors } from '../composite-product-entities/composite-product-entities.selectors';\nimport { getDaffProductEntitiesSelectors } from '../product-entities/product-entities.selectors';\n\n/**\n * An interface describing selectors unique to the composite product, such as pricing and discounts.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport interface DaffCompositeProductMemoizedSelectors {\n\t/**\n\t * Get a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.\n\t */\n\tselectCompositeProductRequiredItemPricesForConfiguration: ( id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem> ) => MemoizedSelector<DaffProductStateRootSlice, DaffPriceRange>;\n\t/**\n\t * Get the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.\n\t */\n\tselectCompositeProductOptionalItemPricesForConfiguration: ( id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem> ) => MemoizedSelector<DaffProductStateRootSlice, DaffPriceRange>;\n\t/**\n\t * Get the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and\n\t * excluding unselected, optional item prices.\n\t */\n\tselectCompositeProductPricesAsCurrentlyConfigured: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffProductStateRootSlice, DaffPriceRange>;\n\t/**\n\t * Get the discount amount for a composite product. This value will be undefined if all required options are not chosen.\n\t */\n\tselectCompositeProductDiscountAmount: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Get the discount percent for a composite product. This value will be undefined if all required options are not chosen.\n\t * Note: this percent is computed client-side and should be treated as an estimate rather than an exact value.\n\t */\n\tselectCompositeProductDiscountPercent: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffProductStateRootSlice, number>;\n}\n\nconst createCompositeProductSelectors = (): DaffCompositeProductMemoizedSelectors => {\n\n const {\n selectProduct,\n } = getDaffProductEntitiesSelectors();\n\n const {\n selectCompositeProductAppliedOptionsEntities,\n } = getDaffCompositeProductEntitiesSelectors();\n\n const selectCompositeProductRequiredItemPricesForConfiguration = defaultMemoize((id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => createSelector(\n selectProduct(id),\n (product: DaffCompositeProduct) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const appliedOptions = configuration ? getAppliedOptionsForConfiguration(product, configuration) : {};\n return {\n minPrice: getMinPricesForConfiguration(product, appliedOptions),\n maxPrice: getMaxPricesForConfiguration(product, appliedOptions),\n };\n },\n )).memoized;\n\n const selectCompositeProductOptionalItemPricesForConfiguration = defaultMemoize((id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => createSelector(\n selectProduct(id),\n (product: DaffCompositeProduct) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const appliedOptions = configuration ? getAppliedOptionsForConfiguration(product, configuration) : {};\n return {\n minPrice: getMinPricesForConfiguration(product, appliedOptions),\n maxPrice: getMaxPricesForConfigurationIncludingOptionalItems(product, appliedOptions),\n };\n },\n )).memoized;\n\n const selectCompositeProductPricesAsCurrentlyConfigured = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: DaffCompositeProduct, appliedOptionsEntities) =>\n selectCompositeProductRequiredItemPricesForConfiguration(id, appliedOptionsEntities[id]?.items || null).projector(product),\n )).memoized;\n\n const selectCompositeProductDiscountAmount = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: DaffCompositeProduct, appliedOptionsEntities) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n const appliedConfigurationItem = appliedOptionsEntities[product.id].items;\n if(product.items.filter(item => item.required && appliedConfigurationItem[item.id].value === null).length > 0) {\n return undefined;\n }\n const appliedOptions = getAppliedOptionsForConfiguration(product, appliedConfigurationItem);\n\n return product.items.reduce((acc, item) =>\n appliedOptions[item.id]?.discount?.amount ? daffAdd(acc, daffMultiply(appliedOptions[item.id].discount.amount, appliedOptions[item.id].quantity)) : acc,\n product.discount.amount);\n },\n )).memoized;\n\n const selectCompositeProductDiscountPercent = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: DaffCompositeProduct, appliedOptionsEntities) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n const appliedOptions = appliedOptionsEntities[product.id].items;\n if(product.items.filter(item => item.required && appliedOptions[item.id].value === null).length > 0) {\n return undefined;\n }\n\n const prices = getMinPricesForConfiguration(\n product,\n getAppliedOptionsForConfiguration(product, appliedOptions),\n );\n\n return daffMultiply(\n daffDivide(\n daffSubtract(prices.originalPrice, prices.discountedPrice),\n prices.originalPrice,\n ),\n 100,\n );\n },\n )).memoized;\n\n return {\n selectCompositeProductRequiredItemPricesForConfiguration,\n selectCompositeProductOptionalItemPricesForConfiguration,\n selectCompositeProductPricesAsCurrentlyConfigured,\n selectCompositeProductDiscountAmount,\n selectCompositeProductDiscountPercent,\n };\n};\n\n/**\n * A function that returns all selectors related to the composite product feature.\n *\n * Returns {@link DaffCompositeProductMemoizedSelectors}.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport const getDaffCompositeProductSelectors = (() => {\n let cache;\n return (): DaffCompositeProductMemoizedSelectors => cache = cache\n ? cache\n : createCompositeProductSelectors();\n})();\n\n/**\n * The minimum price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMinimumRequiredCompositeItemPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.min(...item.options.map(option => option.price)), qty) : 0;\n}\n\n/**\n * The maximum price for an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMaximumRequiredCompositeItemPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.max(...item.options.map(option => option.price)), qty) : 0;\n}\n\n/**\n * The minimum discounted price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMinimumRequiredCompositeItemDiscountedPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.min(...item.options.map(getDiscountedPrice)), qty) : 0;\n}\n/**\n * The maximum discounted price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMaximumRequiredCompositeItemDiscountedPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.max(...item.options.map(getDiscountedPrice)), qty) : 0;\n}\n\n/**\n * Gets the minimum prices of a composite product for the configuration provided excluding unselected, optional item prices.\n *\n * @param product a DaffCompositeProduct\n * @param appliedOptions a Dictionary<DaffCompositeProductItemOption> that determines the current configuration of the composite product.\n */\nfunction getMinPricesForConfiguration(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n getMinimumRequiredCompositeItemDiscountedPrice(item, getOptionQty(appliedOptions[item.id])),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n getMinimumRequiredCompositeItemPrice(item, getOptionQty(appliedOptions[item.id])),\n ), product.price),\n };\n}\n\n/**\n * Gets the maximum prices of a composite product for the configuration provided excluding unselected, optional item prices.\n *\n * @param product a DaffCompositeProduct\n * @param appliedOptions a Dictionary<DaffCompositeProductItemOption> that determines the current configuration of the composite product.\n */\nfunction getMaxPricesForConfiguration(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n getMaximumRequiredCompositeItemDiscountedPrice(item, getOptionQty(appliedOptions[item.id])),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n getMaximumRequiredCompositeItemPrice(item, getOptionQty(appliedOptions[item.id])),\n ), product.price),\n };\n}\n\nfunction getDiscountedPrice(product: DaffProduct): number {\n return product.discount ? daffSubtract(product.price, product.discount.amount) : product.price;\n}\n\n/**\n * Gets the maximum prices of a composite product including optional item prices.\n *\n * @param product a DaffCompositeProduct\n */\nfunction getMaxPricesForConfigurationIncludingOptionalItems(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n appliedOptionHasQty(appliedOptions[item.id]) ?\n daffMultiply(Math.max(...item.options.map(getDiscountedPrice)), appliedOptions[item.id].quantity) :\n Math.max(...item.options.map(getDiscountedPrice)),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n appliedOptionHasQty(appliedOptions[item.id]) ?\n daffMultiply(Math.max(...item.options.map(option => option.price)), appliedOptions[item.id].quantity) :\n Math.max(...item.options.map(option => option.price)),\n ), product.price),\n };\n}\n\n/**\n * Takes a product and a set of option configurations and convert it into a dictionary of the full option objects.\n *\n * @param product a DaffCompositeProduct\n * @param configuration a Dictionary<DaffCompositeConfigurationItem> used to build the appliedOptions object.\n */\nfunction getAppliedOptionsForConfiguration(product: DaffCompositeProduct, configuration: Dictionary<DaffCompositeConfigurationItem>): Dictionary<DaffCompositeProductItemOption> {\n return product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: configuration[item.id] ? {\n ...item.options.find(option => option.id === configuration[item.id].value),\n quantity: (configuration[item.id].qty === null || configuration[item.id].qty === undefined) ? 1 : configuration[item.id].qty,\n } : null,\n }), {});\n}\n\nfunction appliedOptionHasId(appliedOption: DaffCompositeProductItemOption): boolean {\n return !!appliedOption?.id;\n}\n\nfunction getOptionQty(appliedOption: DaffCompositeProductItemOption): number {\n return appliedOptionHasQty(appliedOption) ? appliedOption.quantity : 1;\n}\n\nfunction appliedOptionHasQty(appliedOption: DaffCompositeProductItemOption): boolean {\n return appliedOption?.quantity !== null && appliedOption?.quantity !== undefined;\n}\n","import {\n EntityAdapter,\n createEntityAdapter,\n} from '@ngrx/entity';\n\nimport { DaffConfigurableProductEntity } from './configurable-product-entity';\n\n/**\n * Configurable Product Applied Attributes Adapter for changing/overwriting entity state.\n */\nexport const daffConfigurableProductAppliedAttributesEntitiesAdapter = (() => {\n let cache;\n return (): EntityAdapter<DaffConfigurableProductEntity> =>\n cache = cache || createEntityAdapter<DaffConfigurableProductEntity>();\n})();\n","import {\n EntityState,\n Dictionary,\n} from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { daffConfigurableProductAppliedAttributesEntitiesAdapter } from '../../reducers/configurable-product-entities/configurable-product-entities-reducer-adapter';\nimport {\n DaffConfigurableProductEntity,\n DaffConfigurableProductEntityAttribute,\n} from '../../reducers/configurable-product-entities/configurable-product-entity';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to the configurable product applied attributes.\n *\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\nexport interface DaffConfigurableProductEntitiesMemoizedSelectors {\n\t/**\n\t * Selects the configurable product applied attributes entities state.\n\t */\n\tselectConfigurableProductAppliedAttributesEntitiesState: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffConfigurableProductEntity>>;\n\t/**\n\t * Selects all ids for configurable products in state.\n\t */\n\tselectConfigurableProductIds: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffConfigurableProductEntity>['ids']>;\n\t/**\n\t * Selects the configurable product applied attributes as ngrx entities.\n\t */\n\tselectConfigurableProductAppliedAttributesEntities: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffConfigurableProductEntity>['entities']>;\n\t/**\n\t * Selects the total number of configurable products in state.\n\t */\n\tselectConfigurableProductTotal: MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the applied attributes of a configurable product.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductAppliedAttributes: (productId: DaffProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, DaffConfigurableProductEntityAttribute[]>;\n\t/**\n\t * Selects the applied attributes of a configurable product as a dictionary.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductAppliedAttributesAsDictionary: (productId: DaffProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, Dictionary<string>>;\n}\n\nconst createConfigurableProductAppliedAttributesEntitiesSelectors = <T extends DaffProduct>(): DaffConfigurableProductEntitiesMemoizedSelectors => {\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n const adapterSelectors = daffConfigurableProductAppliedAttributesEntitiesAdapter().getSelectors();\n\n const selectConfigurableProductAppliedAttributesEntitiesState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.configurableProductAttributes,\n );\n\n const selectConfigurableProductIds = createSelector(\n selectConfigurableProductAppliedAttributesEntitiesState,\n adapterSelectors.selectIds,\n );\n\n const selectConfigurableProductAppliedAttributesEntities = createSelector(\n selectConfigurableProductAppliedAttributesEntitiesState,\n adapterSelectors.selectEntities,\n );\n\n const selectConfigurableProductTotal = createSelector(\n selectConfigurableProductAppliedAttributesEntitiesState,\n adapterSelectors.selectTotal,\n );\n\n const selectConfigurableProductAppliedAttributes = defaultMemoize((productId: DaffProduct['id']) => createSelector(\n selectConfigurableProductAppliedAttributesEntitiesState,\n products => products.entities[productId].attributes,\n )).memoized;\n\n const selectConfigurableProductAppliedAttributesAsDictionary = defaultMemoize((productId: DaffProduct['id']) => createSelector(\n selectConfigurableProductAppliedAttributes(productId),\n (attributes: DaffConfigurableProductEntityAttribute[]) => attributes.reduce((acc, attribute) => ({\n ...acc,\n [attribute.code]: attribute.value,\n }), {}),\n )).memoized;\n\n return {\n selectConfigurableProductAppliedAttributesEntitiesState,\n selectConfigurableProductIds,\n selectConfigurableProductAppliedAttributesEntities,\n selectConfigurableProductTotal,\n selectConfigurableProductAppliedAttributes,\n selectConfigurableProductAppliedAttributesAsDictionary,\n };\n};\n\n/**\n * A function that returns all selectors related to configurable product applied attributes.\n * Returns {@link DaffConfigurableProductEntitiesMemoizedSelectors}.\n *\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\nexport const getDaffConfigurableProductEntitiesSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffConfigurableProductEntitiesMemoizedSelectors => cache = cache\n ? cache\n : createConfigurableProductAppliedAttributesEntitiesSelectors<T>();\n})();\n","import { Dictionary } from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport { daffSubtract } from '@daffodil/core';\nimport {\n DaffProductTypeEnum,\n DaffConfigurableProductVariant,\n DaffConfigurableProduct,\n DaffConfigurableProductAttribute,\n} from '@daffodil/product';\n\nimport { DaffConfigurableProductEntityAttribute } from '../../reducers/configurable-product-entities/configurable-product-entity';\nimport { DaffProductStateRootSlice } from '../../reducers/public_api';\nimport { getDaffConfigurableProductEntitiesSelectors } from '../configurable-product-entities/configurable-product-entities.selectors';\nimport { getDaffProductEntitiesSelectors } from '../product-entities/product-entities.selectors';\n\n/**\n * An interface describing all selectors unique to configurable products including ranged pricing, configurable attributes, and product variants.\n *\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\nexport interface DaffConfigurableProductMemoizedSelectors {\n\t/**\n\t * Selects all possible attributes of a configurable product.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectAllConfigurableProductAttributes: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, Dictionary<string[]>>;\n\t/**\n\t * Selects all variants of the configurable product.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectAllConfigurableProductVariants: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, DaffConfigurableProductVariant[]>;\n\t/**\n\t * Selects the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectMatchingConfigurableProductVariants: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, DaffConfigurableProductVariant[]>;\n\t/**\n\t * Selects all prices for the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductPrices: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number[]>;\n\t/**\n\t * Selects all discounted prices for the configurable product variant that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductDiscountedPrices: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number[]>;\n\t/**\n\t * Selects all percent discounts for the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductPercentDiscounts: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number[]>;\n\t/**\n\t * Selects whether or not any variants that match the currently applied attributes have a discount.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductHasDiscount: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, boolean>;\n\t/**\n\t * Selects the minimum possible price of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMinimumPrice: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the maximum possible price of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMaximumPrice: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the minimum possible discounted price of the configurable product variants that match the currently applied attributes.\n\t */\n\tselectConfigurableProductMinimumDiscountedPrice: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the maximum possible discounted price of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMaximumDiscountedPrice: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the minimum possible percent discount of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMinimumPercentDiscount: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the maximum possible percent discount of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMaximumPercentDiscount: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects whether or not the currently applied attributes result in more than one possible price.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tisConfigurablePriceRanged: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, boolean>;\n\t/**\n\t * Selects the available/selectable configurable product attributes derived from the order of currently applied attributes and the remaining variants\n\t * (determined by the currently applied attributes). An attribute might not be selectable if none of the matching variants have that particular attribute.\n\t */\n\tselectSelectableConfigurableProductAttributes: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, Dictionary<string[]>>;\n}\n\nconst createConfigurableProductSelectors = (): DaffConfigurableProductMemoizedSelectors => {\n\n const {\n selectConfigurableProductAppliedAttributes,\n } = getDaffConfigurableProductEntitiesSelectors();\n\n const {\n selectProduct,\n } = getDaffProductEntitiesSelectors();\n\n const selectAllConfigurableProductVariants = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectProduct(productId),\n (product: DaffConfigurableProduct) => {\n if(!product || product.type !== DaffProductTypeEnum.Configurable) {\n return [];\n }\n return product.variants;\n },\n )).memoized;\n\n const selectMatchingConfigurableProductVariants = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectProduct(productId),\n selectConfigurableProductAppliedAttributes(productId),\n (product: DaffConfigurableProduct, appliedAttributes) => {\n if(!product || product.type !== DaffProductTypeEnum.Configurable) {\n return [];\n }\n return product.variants.filter(variant => isVariantAvailable(appliedAttributes, variant));\n },\n )).memoized;\n\n const selectConfigurableProductPrices = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectMatchingConfigurableProductVariants(productId),\n (variants: DaffConfigurableProductVariant[]) => variants.map(variant => variant.price),\n )).memoized;\n\n const selectConfigurableProductDiscountedPrices = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectMatchingConfigurableProductVariants(productId),\n (variants: DaffConfigurableProductVariant[]) => variants.map(variant =>\n variant.discount ? daffSubtract(variant.price, variant.discount.amount) : variant.price,\n ),\n )).memoized;\n\n const selectConfigurableProductPercentDiscounts = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectMatchingConfigurableProductVariants(productId),\n (variants: DaffConfigurableProductVariant[]) => variants.map(variant => variant.discount?.percent),\n )).memoized;\n\n const selectConfigurableProductHasDiscount = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectMatchingConfigurableProductVariants(productId),\n (variants: DaffConfigurableProductVariant[]) => variants.reduce((acc, variant) =>\n acc || (variant.discount?.amount > 0), false,\n ),\n )).memoized;\n\n const selectConfigurableProductMinimumPrice = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductPrices(productId),\n getMinimumPrice,\n )).memoized;\n\n const selectConfigurableProductMaximumPrice = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductPrices(productId),\n getMaximumPrice,\n )).memoized;\n\n const selectConfigurableProductMinimumDiscountedPrice = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductDiscountedPrices(productId),\n getMinimumPrice,\n )).memoized;\n\n const selectConfigurableProductMaximumDiscountedPrice = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductDiscountedPrices(productId),\n getMaximumPrice,\n )).memoized;\n\n const selectConfigurableProductMinimumPercentDiscount = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductPercentDiscounts(productId),\n getMinimumPrice,\n )).memoized;\n\n const selectConfigurableProductMaximumPercentDiscount = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductPercentDiscounts(productId),\n getMaximumPrice,\n )).memoized;\n\n const isConfigurablePriceRanged = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductMinimumPrice(productId),\n selectConfigurableProductMaximumPrice(productId),\n (minPrice: number, maxPrice: number) => minPrice !== maxPrice,\n )).memoized;\n\n const selectAllConfigurableProductAttributes = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectProduct(productId),\n (product: DaffConfigurableProduct) => {\n if(product.type !== DaffProductTypeEnum.Configurable) {\n return {};\n }\n return product.configurableAttributes.reduce((acc, attribute) => ({\n ...acc,\n [attribute.code]: attribute.values.map(value => value.value),\n }), {});\n },\n )).memoized;\n\n const selectSelectableConfigurableProductAttributes = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectProduct(productId),\n selectConfigurableProductAppliedAttributes(productId),\n (product: DaffConfigurableProduct, appliedAttributes: DaffConfigurableProductEntityAttribute[]) => {\n if(product.type !== DaffProductTypeEnum.Configurable) {\n return {};\n }\n\n const selectableAttributes = initializeSelectableAttributes(product.configurableAttributes);\n\n // Set which values of applied attribute codes should be set as selectable based on the order that they were selected\n const matchedVariants = appliedAttributes.reduce((matchingVariants, appliedAttribute, i) => {\n const filteredVariants = matchingVariants.filter(variant => isVariantAvailable(appliedAttributes.slice(0, i), variant));\n\n selectableAttributes[appliedAttribute.code] = getSelectableAttributesFromVariants(selectableAttributes, filteredVariants, appliedAttribute.code);\n\n return filteredVariants;\n }, product.variants).filter(variant =>\n isVariantAvailable(appliedAttributes, variant),\n );\n\n // Set which values of the unapplied attribute codes should be set as selectable based on the matching variants of all\n // applied attributes.\n product.configurableAttributes.forEach(attribute => {\n if (!selectableAttributes[attribute.code].length) {\n selectableAttributes[attribute.code] = getSelectableAttributesFromVariants(selectableAttributes, matchedVariants, attribute.code);\n }\n });\n\n return selectableAttributes;\n },\n )).memoized;\n\n return {\n selectAllConfigurableProductAttributes,\n selectAllConfigurableProductVariants,\n selectConfigurableProductPrices,\n selectConfigurableProductDiscountedPrices,\n selectConfigurableProductPercentDiscounts,\n selectConfigurableProductHasDiscount,\n selectConfigurableProductMinimumPrice,\n selectConfigurableProductMaximumPrice,\n selectConfigurableProductMinimumDiscountedPrice,\n selectConfigurableProductMaximumDiscountedPrice,\n selectConfigurableProductMinimumPercentDiscount,\n selectConfigurableProductMaximumPercentDiscount,\n isConfigurablePriceRanged,\n selectMatchingConfigurableProductVariants,\n selectSelectableConfigurableProductAttributes,\n };\n};\n\nfunction getSelectableAttributesFromVariants(selectableAttributes: Dictionary<string[]>, variants: DaffConfigurableProductVariant[], code: string) {\n return variants.reduce((selectedAttributes, variant) =>\n isVariantAttributeMarkedAsSelectable(selectedAttributes, variant.appliedAttributes[code])\n ? selectedAttributes\n : [\n ...selectedAttributes,\n variant.appliedAttributes[code],\n ],\n selectableAttributes[code],\n );\n}\n\n/**\n * A function that returns all configurable product selectors.\n * Returns {@link DaffConfigurableProductMemoizedSelectors}.\n *\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\nexport const getDaffConfigurableProductSelectors = (() => {\n let cache;\n return (): DaffConfigurableProductMemoizedSelectors => cache = cache\n ? cache\n : createConfigurableProductSelectors();\n})();\n\nfunction isVariantAvailable(\n appliedAttributes: DaffConfigurableProductEntityAttribute[],\n variant: DaffConfigurableProductVariant,\n): boolean {\n return variant.in_stock &&\n\t\tappliedAttributes.reduce((acc, attribute) =>\n\t\t acc && attribute.value === variant.appliedAttributes[attribute.code],\n\t\ttrue,\n\t\t);\n}\n\nfunction getMinimumPrice(prices: number[]): number {\n return prices.reduce(\n (acc, price) => price < acc ? price : acc,\n prices[0],\n );\n}\n\nfunction getMaximumPrice(prices: number[]): number {\n return prices.reduce(\n (acc, price) => price > acc ? price : acc,\n prices[0],\n );\n}\n\nfunction initializeSelectableAttributes(attributes: DaffConfigurableProductAttribute[]): Dictionary<string[]> {\n return attributes.reduce((acc, attribute) => ({\n ...acc,\n [attribute.code]: [],\n }), {});\n}\n\nfunction isVariantAttributeMarkedAsSelectable(attributeArray: string[], variantValue: string) {\n return attributeArray.indexOf(variantValue) > -1;\n}\n","import {\n createSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductGridReducerState } from '../../reducers/product-grid/product-grid-reducer-state.interface';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to loading a grid of products.\n */\nexport interface DaffProductGridMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n\t/**\n\t * Selects the redux state for the product grid feature area. Returns {@link DaffProductGridReducerState}.\n\t */\n\tselectProductGridState: MemoizedSelector<DaffProductStateRootSlice<T>, DaffProductGridReducerState<T>>;\n\t/**\n\t * Selects whether any product grid requests are loading.\n\t */\n\tselectProductGridLoadingState: MemoizedSelector<DaffProductStateRootSlice<T>, boolean>;\n}\n\nconst createProductGridSelectors = <T extends DaffProduct>(): DaffProductGridMemoizedSelectors<T> => {\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n\n const selectProductGridState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.productGrid,\n );\n\n const selectProductGridLoadingState = createSelector(\n selectProductGridState,\n (state: DaffProductGridReducerState<T>) => state.loading,\n );\n\n return {\n selectProductGridState,\n selectProductGridLoadingState,\n };\n};\n\n/**\n * A function that returns all selectors related to loading a grid of products.\n * Returns {@link DaffProductGridMemoizedSelectors}.\n */\nexport const getDaffProductGridSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffProductGridMemoizedSelectors<T> => cache = cache\n ? cache\n : createProductGridSelectors<T>();\n})();\n","import {\n createSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { DaffProductReducerState } from '../../reducers/product/product-reducer-state.interface';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to the current product page.\n */\nexport interface DaffProductPageMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n\t/**\n\t * Selects the entire state object for the product page feature area.\n\t */\n\tselectCurrentProductState: MemoizedSelector<DaffProductStateRootSlice, DaffProductReducerState>;\n\t/**\n\t * Selects the loading state of the current product.\n\t */\n\tselectCurrentProductLoadingState: MemoizedSelector<DaffProductStateRootSlice, boolean>;\n\t/**\n\t * Selects the id of the current product.\n\t */\n\tselectCurrentProductId: MemoizedSelector<DaffProductStateRootSlice, T['id']>;\n /**\n * Selects the current product, which is the product loaded for a product page.\n */\n\tselectCurrentProduct: MemoizedSelector<DaffProductStateRootSlice, T>;\n}\n\nconst createProductPageSelectors = <T extends DaffProduct = DaffProduct>(): DaffProductPageMemoizedSelectors<T> => {\n\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n\n const selectCurrentProductState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.product,\n );\n\n const selectCurrentProductLoadingState = createSelector(\n selectCurrentProductState,\n (state: DaffProductReducerState) => state.loading,\n );\n\n const selectCurrentProductId = createSelector(\n selectCurrentProductState,\n (state: DaffProductReducerState) => state.currentProductId,\n );\n\n const selectCurrentProduct = createSelector(\n selectProductState,\n selectCurrentProductId,\n (state: DaffProductReducersState<T>, id: T['id']) => state.products.entities[id],\n );\n\n return {\n selectCurrentProductState,\n selectCurrentProductLoadingState,\n selectCurrentProductId,\n selectCurrentProduct,\n };\n};\n\n/**\n * A function that returns all selectors related to the product page.\n * Returns {@link DaffProductPageMemoizedSelectors}.\n */\nexport const getDaffProductPageSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffProductPageMemoizedSelectors<T> => cache = cache\n ? cache\n : createProductPageSelectors<T>();\n})();\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffBestSellersMemoizedSelectors,\n getDaffBestSellersSelectors,\n} from './best-sellers/best-sellers.selectors';\nimport {\n DaffCompositeProductEntitiesMemoizedSelectors,\n getDaffCompositeProductEntitiesSelectors,\n} from './composite-product-entities/composite-product-entities.selectors';\nimport {\n DaffCompositeProductMemoizedSelectors,\n getDaffCompositeProductSelectors,\n} from './composite-product/composite-product.selectors';\nimport {\n DaffConfigurableProductEntitiesMemoizedSelectors,\n getDaffConfigurableProductEntitiesSelectors,\n} from './configurable-product-entities/configurable-product-entities.selectors';\nimport {\n DaffConfigurableProductMemoizedSelectors,\n getDaffConfigurableProductSelectors,\n} from './configurable-product/configurable-product.selectors';\nimport {\n DaffProductEntitiesMemoizedSelectors,\n getDaffProductEntitiesSelectors,\n} from './product-entities/product-entities.selectors';\nimport {\n DaffProductFeatureMemoizedSelector,\n getDaffProductFeatureSelector,\n} from './product-feature.selector';\nimport {\n DaffProductGridMemoizedSelectors,\n getDaffProductGridSelectors,\n} from './product-grid/product-grid.selectors';\nimport {\n DaffProductPageMemoizedSelectors,\n getDaffProductPageSelectors,\n} from './product/product.selectors';\n\n/**\n * An interface for all selectors in the entire product feature area.\n */\nexport interface DaffProductAllSelectors<T extends DaffProduct = DaffProduct> extends\n\tDaffProductPageMemoizedSelectors<T>,\n\tDaffBestSellersMemoizedSelectors<T>,\n\tDaffProductEntitiesMemoizedSelectors<T>,\n\tDaffProductGridMemoizedSelectors<T>,\n\tDaffProductFeatureMemoizedSelector<T>,\n\tDaffConfigurableProductEntitiesMemoizedSelectors,\n\tDaffConfigurableProductMemoizedSelectors,\n\tDaffCompositeProductEntitiesMemoizedSelectors,\n\tDaffCompositeProductMemoizedSelectors { }\n\n/**\n * A function that returns all selectors in the entire product feature area.\n * Returns {@link DaffProductAllSelectors}.\n */\nexport const getDaffProductSelectors = <T extends DaffProduct = DaffProduct>(): DaffProductAllSelectors<T> => ({\n ...getDaffBestSellersSelectors<T>(),\n ...getDaffProductPageSelectors<T>(),\n ...getDaffProductGridSelectors<T>(),\n ...getDaffProductEntitiesSelectors<T>(),\n ...getDaffProductFeatureSelector<T>(),\n ...getDaffConfigurableProductEntitiesSelectors(),\n ...getDaffConfigurableProductSelectors(),\n ...getDaffCompositeProductEntitiesSelectors(),\n ...getDaffCompositeProductSelectors(),\n});\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffStoreFacade } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\n\n/**\n * A facade for accessing best sellers state from an application component.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffBestSellersFacade<T extends DaffProduct = DaffProduct> implements DaffStoreFacade<Action> {\n /**\n * The loading state for getting best selling products.\n */\n loading$: Observable<boolean>;\n /**\n * Best selling products.\n */\n bestSellers$: Observable<DaffProduct[]>;\n\n constructor(private store: Store<DaffProductStateRootSlice<T>>) {\n const {\n selectBestSellersProducts,\n selectBestSellersLoadingState,\n } = getDaffProductSelectors<T>();\n\n this.loading$ = this.store.pipe(select(selectBestSellersLoadingState));\n this.bestSellers$ = this.store.pipe(select(selectBestSellersProducts));\n }\n\n /**\n * Dispatches an action to the rxjs action stream.\n *\n * @param action\n */\n dispatch(action: Action) {\n this.store.dispatch(action);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffProduct,\n DaffPriceRange,\n DaffCompositeConfigurationItem,\n DaffCompositeProductItemOption,\n DaffCompositeProductItem,\n productPriceRangeHasDiscount,\n productPriceRangeHasPriceRange,\n} from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/public_api';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffCompositeProductFacadeInterface } from './composite-product-facade.interface';\n\n/**\n * A facade for interacting with the composite product state.\n * Exposes many parts of the state for easy access and allows dispatching of actions.\n *\n * @inheritdoc\n * @deprecated import from @daffodil/composite-product/state instead.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCompositeProductFacade<T extends DaffProduct = DaffProduct> implements DaffCompositeProductFacadeInterface {\n\n constructor(private store: Store<DaffProductStateRootSlice<T>>) {}\n\n\tselectors = getDaffProductSelectors<T>();\n\n\thasDiscount = productPriceRangeHasDiscount;\n\n\thasPriceRange = productPriceRangeHasPriceRange;\n\n\tgetRequiredItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductRequiredItemPricesForConfiguration(id, configuration)));\n\t}\n\n\tgetOptionalItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductOptionalItemPricesForConfiguration(id, configuration)));\n\t}\n\n\tgetPricesAsCurrentlyConfigured(id: T['id']): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductPricesAsCurrentlyConfigured(id)));\n\t}\n\n\tgetAppliedOptions(id: T['id']): Observable<Dictionary<DaffCompositeProductItemOption>> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductAppliedOptions(id)));\n\t}\n\n\tgetDiscountAmount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductDiscountAmount(id)));\n\t}\n\n\tgetDiscountPercent(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductDiscountPercent(id)));\n\t}\n\n\tisItemRequired(id: T['id'], item_id: DaffCompositeProductItem['id']) {\n\t return this.store.pipe(select(this.selectors.selectIsCompositeProductItemRequired(id, item_id)));\n\t}\n\n\tdispatch(action: Action) {\n\t this.store.dispatch(action);\n\t}\n}\n","import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffProduct,\n DaffConfigurableProductVariant,\n} from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffConfigurableProductFacadeInterface } from './configurable-product-facade.interface';\n\n/**\n * A facade for interacting with the configurable product state.\n * Exposes many parts of the state for easy access and allows dispatching of actions.\n *\n * @inheritdoc\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffConfigurableProductFacade<T extends DaffProduct = DaffProduct> implements DaffConfigurableProductFacadeInterface {\n\n\tselectors = getDaffProductSelectors<T>();\n\n\tconstructor(private store: Store<DaffProductStateRootSlice<T>>) {}\n\n\tgetAllAttributes(id: T['id']): Observable<Dictionary<string[]>> {\n\t return this.store.pipe(select(this.selectors.selectAllConfigurableProductAttributes(id)));\n\t}\n\n\tgetAllVariants(id: T['id']): Observable<DaffConfigurableProductVariant[]> {\n\t return this.store.pipe(select(this.selectors.selectAllConfigurableProductVariants(id)));\n\t}\n\n\tgetAppliedAttributes(id: T['id']): Observable<Dictionary<string>> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductAppliedAttributesAsDictionary(id)));\n\t}\n\n\tgetMinimumPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMinimumPrice(id)));\n\t}\n\n\tgetMaximumPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMaximumPrice(id)));\n\t}\n\n\tgetMinimumDiscountedPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMinimumDiscountedPrice(id)));\n\t}\n\n\tgetMaximumDiscountedPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMaximumDiscountedPrice(id)));\n\t}\n\n\tgetMinimumPercentDiscount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMinimumPercentDiscount(id)));\n\t}\n\n\tgetMaximumPercentDiscount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMaximumPercentDiscount(id)));\n\t}\n\n\tisPriceRanged(id: T['id']): Observable<boolean> {\n\t return this.store.pipe(select(this.selectors.isConfigurablePriceRanged(id)));\n\t}\n\n\thasDiscount(id: T['id']): Observable<boolean> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductHasDiscount(id)));\n\t}\n\n\tgetSelectableAttributes(id: T['id']): Observable<Dictionary<string[]>> {\n\t return this.store.pipe(select(this.selectors.selectSelectableConfigurableProductAttributes(id)));\n\t}\n\n\tgetMatchingVariants(id: T['id']): Observable<DaffConfigurableProductVariant[]> {\n\t return this.store.pipe(select(this.selectors.selectMatchingConfigurableProductVariants(id)));\n\t}\n\n\tdispatch(action: Action) {\n\t this.store.dispatch(action);\n\t}\n}\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffProductFacadeInterface } from './product-facade.interface';\n\n/**\n * A facade for getting state about a particular product.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductFacade<T extends DaffProduct = DaffProduct> implements DaffProductFacadeInterface<T> {\n loading$: Observable<boolean>;\n\n\tprivate selectors = getDaffProductSelectors<T>();\n\n\tconstructor(private store: Store<DaffProductStateRootSlice<T>>) {\n\t this.loading$ = this.store.pipe(select(this.selectors.selectCurrentProductLoadingState));\n\t}\n\n\tgetProduct(id: T['id']): Observable<T> {\n\t return this.store.pipe(select(this.selectors.selectProduct(id)));\n\t}\n\n\tgetPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectProductPrice(id)));\n\t}\n\n\thasDiscount(id: T['id']): Observable<boolean> {\n\t return this.store.pipe(select(this.selectors.selectProductHasDiscount(id)));\n\t}\n\n\tgetDiscountAmount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectProductDiscountAmount(id)));\n\t}\n\n\tgetDiscountedPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectProductDiscountedPrice(id)));\n\t}\n\n\tgetDiscountPercent(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectProductDiscountPercent(id)));\n\t}\n\n\tisOutOfStock(id: T['id']): Observable<boolean> {\n\t return this.store.pipe(select(this.selectors.selectIsProductOutOfStock(id)));\n\t}\n\n\tdispatch(action: Action) {\n\t this.store.dispatch(action);\n\t}\n}\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffProductPageFacadeInterface } from './facade.interface';\n\n/**\n * A facade for getting state about a particular product.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductPageFacade<T extends DaffProduct = DaffProduct> implements DaffProductPageFacadeInterface<T> {\n loading$: Observable<boolean>;\n product$: Observable<T>;\n\n\tprivate selectors = getDaffProductSelectors<T>();\n\n\tconstructor(private store: Store<DaffProductStateRootSlice<T>>) {\n\t this.loading$ = this.store.pipe(select(this.selectors.selectCurrentProductLoadingState));\n\t this.product$ = this.store.pipe(select(this.selectors.selectCurrentProduct));\n\t}\n\n\tdispatch(action: Action) {\n\t this.store.dispatch(action);\n\t}\n}\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffProductGridFacadeInterface } from './product-grid-facade.interface';\n\n/**\n * A facade for accessing state for a list of products from an application component.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductGridFacade<T extends DaffProduct = DaffProduct> implements DaffProductGridFacadeInterface<T> {\n loading$: Observable<boolean>;\n products$: Observable<T[]>;\n\n constructor(private store: Store<DaffProductStateRootSlice<T>>) {\n const {\n selectProductGridLoadingState,\n selectAllProducts,\n } = getDaffProductSelectors<T>();\n\n this.loading$ = this.store.pipe(select(selectProductGridLoadingState));\n this.products$ = this.store.pipe(select(selectAllProducts));\n }\n\n dispatch(action: Action) {\n this.store.dispatch(action);\n }\n}\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffBestSellersActionTypes,\n DaffBestSellersActions,\n} from '../../actions/best-sellers.actions';\nimport { DaffBestSellersReducerState } from './best-sellers-reducer-state.interface';\n\nexport const initialState: DaffBestSellersReducerState = {\n productIds: [],\n loading: false,\n errors: [],\n};\n\nexport const resetState: DaffBestSellersReducerState = Object.assign({}, initialState);\n\n/**\n * The default best sellers reducer provided by Daffodil.\n */\nexport function daffBestSellersReducer<T extends DaffProduct>(state = initialState, action: DaffBestSellersActions<T>): DaffBestSellersReducerState {\n switch (action.type) {\n case DaffBestSellersActionTypes.BestSellersLoadAction:\n return { ...state, loading: true };\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return { ...state, loading: false, productIds: getIds<T>(action.payload) };\n case DaffBestSellersActionTypes.BestSellersLoadFailureAction:\n return { ...state,\n loading: false,\n errors: state.errors.concat(new Array(action.payload)) };\n case DaffBestSellersActionTypes.BestSellersResetAction:\n return {\n ...resetState,\n };\n default:\n return state;\n }\n}\n\nfunction getIds<T extends DaffProduct>(products: T[]): T['id'][] {\n const ids: T['id'][] = new Array();\n\n products.forEach(product => {\n ids.push(product.id);\n });\n\n return ids;\n}\n","import { EntityState } from '@ngrx/entity';\n\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeConfigurationItem,\n DaffProduct,\n DaffProductTypeEnum,\n} from '@daffodil/product';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridActions,\n} from '../../actions/product-grid.actions';\nimport {\n DaffProductPageActions,\n DaffProductPageActionTypes,\n} from '../../actions/product-page.actions';\nimport {\n DaffProductActionTypes,\n DaffProductActions,\n DaffBestSellersActionTypes,\n DaffBestSellersActions,\n DaffCompositeProductActions,\n DaffCompositeProductActionTypes,\n} from '../../actions/public_api';\nimport { daffCompositeProductAppliedOptionsEntitiesAdapter } from './composite-product-entities-reducer-adapter';\nimport { DaffCompositeProductEntity } from './composite-product-entity';\n\n/**\n * Reducer function that catches actions and changes/overwrites composite product entities state.\n *\n * @param state current State of the redux store\n * @param action ProductGrid, BestSellers, Product, or Composite Product actions\n * @returns Product entities state\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport function daffCompositeProductEntitiesReducer<T extends DaffProduct, V extends DaffCompositeProduct>(\n state = daffCompositeProductAppliedOptionsEntitiesAdapter().getInitialState(),\n action: DaffProductGridActions<T> | DaffBestSellersActions<T> | DaffProductActions<T> | DaffProductPageActions<T> | DaffCompositeProductActions<V>): EntityState<DaffCompositeProductEntity> {\n const adapter = daffCompositeProductAppliedOptionsEntitiesAdapter();\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return adapter.upsertMany(\n mapOptionsEntities(<V[]><unknown>action.payload),\n state,\n );\n case DaffProductActionTypes.ProductLoadSuccessAction:\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return adapter.upsertMany(\n mapOptionsEntities(<V[]><unknown>action.payload.products),\n state,\n );\n case DaffCompositeProductActionTypes.CompositeProductApplyOptionAction:\n return adapter.upsertOne(\n {\n id: action.id,\n items: {\n ...state.entities[action.id].items,\n [action.itemId]: {\n value: action.optionId,\n qty: action.qty ? action.qty : 1,\n },\n },\n },\n state,\n );\n default:\n return state;\n }\n}\n\nfunction mapOptionsEntities(products: DaffCompositeProduct[]): DaffCompositeProductEntity[] {\n return products.filter(product => product.type === DaffProductTypeEnum.Composite)\n .map(product => buildCompositeProductAppliedOptionsEntity(product));\n}\n\nfunction buildCompositeProductAppliedOptionsEntity(product: DaffCompositeProduct): DaffCompositeProductEntity {\n return {\n id: product.id,\n items: product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: getDefaultOption(item),\n }), {}),\n };\n}\n\n/**\n * Sets the default item option to the specified default option if it is in stock.\n * Does not set a default option if a default is not specified.\n * Does not set a default option but does set a default qty if the default is out of stock.\n *\n * @param item a DaffCompositeProductItem\n */\nfunction getDefaultOption(item: DaffCompositeProductItem): DaffCompositeConfigurationItem {\n const defaultOptionIndex = item.options.findIndex(option => option.is_default);\n\n if(defaultOptionIndex > -1) {\n return {\n value: item.options[defaultOptionIndex].in_stock ? item.options[defaultOptionIndex].id : null,\n qty: item.options[defaultOptionIndex].quantity,\n };\n } else {\n return { value: null, qty: null };\n }\n}\n","import { EntityState } from '@ngrx/entity';\n\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n DaffConfigurableProduct,\n} from '@daffodil/product';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridActions,\n} from '../../actions/product-grid.actions';\nimport {\n DaffProductPageActions,\n DaffProductPageActionTypes,\n} from '../../actions/product-page.actions';\nimport {\n DaffProductActionTypes,\n DaffProductActions,\n DaffBestSellersActionTypes,\n DaffBestSellersActions,\n DaffConfigurableProductActions,\n DaffConfigurableProductActionTypes,\n} from '../../actions/public_api';\nimport { daffConfigurableProductAppliedAttributesEntitiesAdapter } from './configurable-product-entities-reducer-adapter';\nimport {\n DaffConfigurableProductEntity,\n DaffConfigurableProductEntityAttribute,\n} from './configurable-product-entity';\n\n/**\n * Reducer function that catches actions and changes/overwrites product entities state.\n *\n * @param state current State of the redux store\n * @param action ProductGrid, BestSellers, Product, or Configurable Product actions\n * @returns Product entities state\n */\nexport function daffConfigurableProductEntitiesReducer<T extends DaffProduct, V extends DaffConfigurableProduct>(\n state = daffConfigurableProductAppliedAttributesEntitiesAdapter().getInitialState(),\n action: DaffProductGridActions<T> | DaffBestSellersActions<T> | DaffProductActions<T> | DaffProductPageActions<T> | DaffConfigurableProductActions<V>): EntityState<DaffConfigurableProductEntity> {\n const adapter = daffConfigurableProductAppliedAttributesEntitiesAdapter();\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return adapter.upsertMany(\n mapEntities(<V[]><unknown>action.payload),\n state,\n );\n case DaffProductActionTypes.ProductLoadSuccessAction:\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return adapter.upsertMany(\n mapEntities(<V[]><unknown>action.payload.products),\n state,\n );\n case DaffConfigurableProductActionTypes.ConfigurableProductApplyAttributeAction:\n return adapter.upsertOne(\n {\n id: action.id,\n attributes: applyAttribute(state.entities[action.id].attributes, action.attributeId, action.attributeValue),\n },\n state,\n );\n case DaffConfigurableProductActionTypes.ConfigurableProductRemoveAttributeAction:\n return adapter.upsertOne(\n {\n id: action.id,\n attributes: removeAttribute(state.entities[action.id].attributes, action.attributeId),\n },\n state,\n );\n case DaffConfigurableProductActionTypes.ConfigurableProductToggleAttributeAction:\n return adapter.upsertOne(\n {\n id: action.id,\n attributes: isAttributeSelected(state.entities[action.id].attributes, action.attributeId, action.attributeValue) ?\n removeAttribute(state.entities[action.id].attributes, action.attributeId) :\n applyAttribute(state.entities[action.id].attributes, action.attributeId, action.attributeValue),\n },\n state,\n );\n default:\n return state;\n }\n}\n\nfunction mapEntities(products: DaffConfigurableProduct[]): DaffConfigurableProductEntity[] {\n return products.filter(product => product.type === DaffProductTypeEnum.Configurable)\n .map(product => buildConfigurableProductAppliedAttributesEntity(product));\n}\n\nfunction buildConfigurableProductAppliedAttributesEntity(product: DaffProduct): DaffConfigurableProductEntity {\n return {\n id: product.id,\n attributes: [],\n };\n}\n\nfunction applyAttribute(currentAttributes: DaffConfigurableProductEntityAttribute[], appliedAttributeCode: string, appliedAttributeValue: string): DaffConfigurableProductEntityAttribute[] {\n const attributeIndex = currentAttributes.findIndex(attribute => attribute.code === appliedAttributeCode);\n const retainedAttributes = attributeIndex > -1 ? currentAttributes.slice(0, attributeIndex) : currentAttributes;\n\n return [\n ...retainedAttributes,\n {\n code: appliedAttributeCode,\n value: appliedAttributeValue,\n },\n ];\n}\n\nfunction removeAttribute(currentAttributes: DaffConfigurableProductEntityAttribute[], appliedAttributeCode: string): DaffConfigurableProductEntityAttribute[] {\n const index = currentAttributes.findIndex(attribute => attribute.code === appliedAttributeCode);\n\n return index > -1 ? currentAttributes.slice(0, index) : currentAttributes;\n}\n\nfunction isAttributeSelected(currentAttributes: DaffConfigurableProductEntityAttribute[], attributeCode: string, attributeValue: string): boolean {\n const index = currentAttributes.findIndex(attribute => attribute.code === attributeCode);\n\n return index > -1 && currentAttributes[index].value === attributeValue;\n}\n","import { EntityState } from '@ngrx/entity';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridActions,\n DaffProductActionTypes,\n DaffProductActions,\n DaffBestSellersActionTypes,\n DaffBestSellersActions,\n DaffProductPageActions,\n DaffProductPageActionTypes,\n} from '../../actions/public_api';\nimport { daffProductEntitiesAdapter } from './product-entities-reducer-adapter';\n\n/**\n * Reducer function that catches actions and changes/overwrites product entities state.\n *\n * @param state current State of the redux store\n * @param action ProductGrid, BestSellers, or Product actions\n * @returns Product entities state\n */\nexport function daffProductEntitiesReducer<T extends DaffProduct>(\n state = daffProductEntitiesAdapter<T>().getInitialState(),\n action: DaffProductGridActions<T> | DaffBestSellersActions<T> | DaffProductActions<T> | DaffProductPageActions<T>): EntityState<T> {\n const adapter = daffProductEntitiesAdapter<T>();\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n return adapter.upsertMany(action.payload, state);\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return adapter.upsertMany(action.payload, state);\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n case DaffProductActionTypes.ProductLoadSuccessAction:\n return adapter.upsertMany(\n action.payload.products,\n state,\n );\n case DaffProductGridActionTypes.ProductGridResetAction:\n return adapter.removeAll(state);\n default:\n return state;\n }\n}\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridActions,\n} from '../../actions/public_api';\nimport { DaffProductGridReducerState } from './product-grid-reducer-state.interface';\n\n/**\n * Initial values of the product grid state.\n */\nexport const initialState: DaffProductGridReducerState<any> = {\n products: [],\n loading: false,\n errors: [],\n};\n\n/**\n * Reducer function that catches actions and changes/overwrites product grid state.\n *\n * @param state current State of the redux store\n * @param action a product grid action\n * @returns Product grid state\n */\nexport function daffProductGridReducer<T extends DaffProduct>(state = initialState, action: DaffProductGridActions<T>): DaffProductGridReducerState<T> {\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadAction:\n return { ...state, loading: true };\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n return { ...state, loading: false };\n case DaffProductGridActionTypes.ProductGridLoadFailureAction:\n return { ...state,\n loading: false,\n errors: state.errors.concat(new Array(action.payload)) };\n default:\n return state;\n }\n}\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffProductPageActions,\n DaffProductPageActionTypes,\n} from '../../actions/public_api';\nimport { DaffProductReducerState } from './product-reducer-state.interface';\n\n/**\n * Initial values of the product state.\n */\nexport const initialState: DaffProductReducerState = {\n currentProductId: null,\n qty: 1,\n loading: false,\n errors: [],\n};\n\n/**\n * Reducer function that catches actions and changes/overwrites product state.\n *\n * @param state current State of the redux store\n * @param action a product action\n * @returns product state\n */\nexport function daffProductReducer<T extends DaffProduct>(state = initialState, action: DaffProductPageActions<T>): DaffProductReducerState {\n switch (action.type) {\n case DaffProductPageActionTypes.ProductPageLoadAction:\n case DaffProductPageActionTypes.ProductPageLoadByUrlAction:\n return { ...state, loading: true, currentProductId: null };\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return { ...state, loading: false, currentProductId: action.payload.id };\n case DaffProductPageActionTypes.ProductPageLoadFailureAction:\n return { ...state,\n loading: false,\n errors: state.errors.concat(new Array(action.payload)) };\n case DaffProductPageActionTypes.UpdateQtyAction:\n return { ...state, qty: action.payload };\n default:\n return state;\n }\n}\n","import { daffBestSellersReducer } from './best-sellers/best-sellers.reducer';\nimport { daffCompositeProductEntitiesReducer } from './composite-product-entities/composite-product-entities.reducer';\nimport { daffConfigurableProductEntitiesReducer } from './configurable-product-entities/configurable-product-entities.reducer';\nimport { daffProductEntitiesReducer } from './product-entities/product-entities.reducer';\nimport { daffProductGridReducer } from './product-grid/product-grid.reducer';\nimport { daffProductReducer } from './product/product.reducer';\n\n/**\n * Returns state values from all product related reducers.\n */\nexport const daffProductReducers = {\n products: daffProductEntitiesReducer,\n productGrid: daffProductGridReducer,\n product: daffProductReducer,\n bestSellers: daffBestSellersReducer,\n configurableProductAttributes: daffConfigurableProductEntitiesReducer,\n compositeProductOptions: daffCompositeProductEntitiesReducer,\n};\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\nimport { MetaReducer } from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductReducersState } from '../product-reducers-state.interface';\n\n\n/**\n * A token to hold the injectable extra meta-reducers.\n *\n * Prefer using {@link daffProductProvideMetaReducers}.\n */\nexport const DAFF_PRODUCT_META_REDUCERS = new InjectionToken<MetaReducer<DaffProductReducersState>[]>(\n 'DAFF_PRODUCT_META_REDUCERS',\n { factory: () => []},\n);\n\n/**\n * Provides additional meta-reducers that run after the standard Daffodil cart meta-reducers.\n *\n * ```ts\n * providers: [\n * ...daffProductProvideMetaReducers(\n * myMetaReducer1,\n * myMetaReducer2\n * )\n * ]\n * ```\n */\nexport function daffProductProvideMetaReducers<T extends DaffProduct = DaffProduct>(\n ...metaReducers: MetaReducer<DaffProductReducersState<T>>[]\n): Provider[] {\n return metaReducers.map(metaReducer => ({\n provide: DAFF_PRODUCT_META_REDUCERS,\n useValue: metaReducer,\n multi: true,\n }));\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n Effect,\n ofType,\n} from '@ngrx/effects';\nimport {\n of,\n Observable,\n} from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport {\n DaffProduct,\n DAFF_PRODUCT_ERROR_MATCHER,\n} from '@daffodil/product';\nimport {\n DaffProductDriver,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n DaffProductPageActionTypes,\n DaffProductPageLoad,\n DaffProductPageLoadFailure,\n DaffProductPageLoadSuccess,\n DaffProductPageLoadByUrl,\n} from '../actions/product-page.actions';\n\n/**\n * Effects for handling product actions and for triggering corresponding service requests.\n *\n * @param action$ - Redux action object\n * @param driver - A product service driver\n */\n@Injectable()\nexport class DaffProductPageEffects<T extends DaffProduct> {\n\n constructor(\n private actions$: Actions,\n @Inject(DaffProductDriver) private driver: DaffProductServiceInterface<T>,\n\t\t@Inject(DAFF_PRODUCT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n /**\n * Handles ProductPageLoadAction by making a service call for a product and returning a success or\n * failure action to the action stream.\n *\n * @returns An Observable of a ProductLoadAction\n */\n @Effect()\n load$: Observable<any> = this.actions$.pipe(\n ofType(DaffProductPageActionTypes.ProductPageLoadAction),\n switchMap((action: DaffProductPageLoad) =>\n this.driver.get(action.payload)\n .pipe(\n map((resp) => new DaffProductPageLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffProductPageLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n\n @Effect()\n loadByUrl$: Observable<any> = this.actions$.pipe(\n ofType(DaffProductPageActionTypes.ProductPageLoadByUrlAction),\n switchMap((action: DaffProductPageLoadByUrl<T>) =>\n this.driver.getByUrl(action.payload)\n .pipe(\n map((resp) => new DaffProductPageLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffProductPageLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n}\n","import {\n inject,\n InjectionToken,\n} from '@angular/core';\nimport { StoreConfig } from '@ngrx/store';\n\n// workaround https://github.com/graycoreio/daffodil/issues/1667\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductReducersState } from '../product-reducers-state.interface';\nimport { DAFF_PRODUCT_META_REDUCERS } from './meta.token';\n\n/**\n * An internal token to hold the Daffodil product feature store config.\n *\n * @docs-private\n */\nexport const DAFF_PRODUCT_STORE_CONFIG = new InjectionToken<StoreConfig<DaffProductReducersState>>(\n 'DAFF_PRODUCT_STORE_CONFIG',\n {\n factory: () => ({\n metaReducers: inject(DAFF_PRODUCT_META_REDUCERS),\n }),\n },\n);\n","import { NgModule } from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\nimport { StoreModule } from '@ngrx/store';\n\nimport { DaffBestSellersEffects } from './effects/best-seller.effects';\nimport { DaffProductGridEffects } from './effects/product-grid.effects';\nimport { DaffProductPageEffects } from './effects/product-page.effects';\nimport { DaffProductEffects } from './effects/product.effects';\nimport { DAFF_PRODUCT_STORE_CONFIG } from './reducers/injection-tokens/config.token';\nimport { daffProductReducers } from './reducers/product-reducers';\nimport { DAFF_PRODUCT_STORE_FEATURE_KEY } from './reducers/public_api';\n\n/**\n * A module that provides the default reducers and effects for the product redux state.\n */\n@NgModule({\n imports: [\n StoreModule.forFeature(DAFF_PRODUCT_STORE_FEATURE_KEY, daffProductReducers, DAFF_PRODUCT_STORE_CONFIG),\n EffectsModule.forFeature([\n DaffProductGridEffects,\n DaffProductEffects,\n DaffProductPageEffects,\n DaffBestSellersEffects,\n ]),\n ],\n})\nexport class DaffProductStateModule { }\n"]}
1
+ {"version":3,"sources":["../../../libs/product/state/src/actions/best-sellers.actions.ts","../../../libs/product/state/src/actions/composite-product.actions.ts","../../../libs/product/state/src/actions/configurable-product.actions.ts","../../../libs/product/state/src/actions/product-grid.actions.ts","../../../libs/product/state/src/actions/product.actions.ts","../../../libs/product/state/src/actions/product-page.actions.ts","../../../node_modules/tslib/tslib.es6.js","../../../libs/product/state/src/effects/best-seller.effects.ts","../../../libs/product/state/src/effects/product-grid.effects.ts","../../../libs/product/state/src/effects/product.effects.ts","../../../libs/product/state/src/reducers/product-entities/product-entities-reducer-adapter.ts","../../../libs/product/state/src/reducers/product-store-feature-key.ts","../../../libs/product/state/src/selectors/product-feature.selector.ts","../../../libs/product/state/src/selectors/product-entities/product-entities.selectors.ts","../../../libs/product/state/src/selectors/best-sellers/best-sellers.selectors.ts","../../../libs/product/state/src/reducers/composite-product-entities/composite-product-entities-reducer-adapter.ts","../../../libs/product/state/src/selectors/composite-product-entities/composite-product-entities.selectors.ts","../../../libs/product/state/src/selectors/composite-product/composite-product.selectors.ts","../../../libs/product/state/src/reducers/configurable-product-entities/configurable-product-entities-reducer-adapter.ts","../../../libs/product/state/src/selectors/configurable-product-entities/configurable-product-entities.selectors.ts","../../../libs/product/state/src/selectors/configurable-product/configurable-product.selectors.ts","../../../libs/product/state/src/selectors/product-grid/product-grid.selectors.ts","../../../libs/product/state/src/selectors/product/product.selectors.ts","../../../libs/product/state/src/selectors/all-selectors.selectors.ts","../../../libs/product/state/src/facades/best-sellers/best-sellers.facade.ts","../../../libs/product/state/src/facades/composite-product/composite-product.facade.ts","../../../libs/product/state/src/facades/configurable-product/configurable-product.facade.ts","../../../libs/product/state/src/facades/product/product.facade.ts","../../../libs/product/state/src/facades/product-page/facade.ts","../../../libs/product/state/src/facades/product-grid/product-grid.facade.ts","../../../libs/product/state/src/reducers/best-sellers/best-sellers.reducer.ts","../../../libs/product/state/src/reducers/composite-product-entities/composite-product-entities.reducer.ts","../../../libs/product/state/src/reducers/configurable-product-entities/configurable-product-entities.reducer.ts","../../../libs/product/state/src/reducers/product-entities/product-entities.reducer.ts","../../../libs/product/state/src/reducers/product-grid/product-grid.reducer.ts","../../../libs/product/state/src/reducers/product/product.reducer.ts","../../../libs/product/state/src/reducers/product-reducers.ts","../../../libs/product/state/src/reducers/injection-tokens/meta.token.ts","../../../libs/product/state/src/effects/product-page.effects.ts","../../../libs/product/state/src/reducers/injection-tokens/config.token.ts","../../../libs/product/state/src/product-state.module.ts"],"names":["DaffBestSellersActionTypes","this","type","BestSellersLoadAction","payload","BestSellersLoadSuccessAction","BestSellersLoadFailureAction","BestSellersResetAction","DaffCompositeProductActionTypes","DaffConfigurableProductActionTypes","id","itemId","optionId","qty","CompositeProductApplyOptionAction","DaffProductGridActionTypes","attributeId","attributeValue","ConfigurableProductApplyAttributeAction","ConfigurableProductRemoveAttributeAction","ConfigurableProductToggleAttributeAction","DaffProductActionTypes","ProductGridLoadAction","ProductGridLoadSuccessAction","ProductGridLoadFailureAction","ProductGridResetAction","DaffProductPageActionTypes","ProductLoadAction","ProductLoadSuccessAction","ProductLoadFailureAction","ProductPageLoadByUrlAction","ProductPageLoadAction","ProductPageLoadSuccessAction","ProductPageLoadFailureAction","UpdateQtyAction","__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","__metadata","metadataKey","metadataValue","metadata","create","__read","o","n","m","Symbol","iterator","e","call","ar","next","done","push","value","error","__spread","concat","actions$","driver","errorMatcher","_this","loadBestSellers$","pipe","ofType","switchMap","action","getBestSellers","map","resp","DaffBestSellersLoadSuccess","catchError","of","DaffBestSellersLoadFailure","Injectable","Actions","Inject","args","DaffProductDriver","DAFF_PRODUCT_ERROR_MATCHER","Effect","Observable","loadAll$","getAll","DaffProductGridLoadSuccess","DaffProductGridLoadFailure","load$","get","DaffProductLoadSuccess","DaffProductLoadFailure","cache","daffProductEntitiesAdapter","createEntityAdapter","DAFF_PRODUCT_STORE_FEATURE_KEY","getDaffProductFeatureSelector","selectProductState","createFeatureSelector","createProductEntitiesSelectors","adapterSelectors","getSelectors","selectProductEntitiesState","createSelector","state","products","selectProductIds","selectIds","selectProductEntities","selectEntities","selectAllProducts","selectAll","selectProductTotal","selectTotal","selectProduct","defaultMemoize","productId","memoized","selectProductPrice","product","price","selectProductDiscountAmount","_a","discount","amount","selectProductDiscountedPrice","discountAmount","daffSubtract","selectProductDiscountPercent","percent","selectProductHasDiscount","selectIsProductOutOfStock","in_stock","getDaffProductEntitiesSelectors","createBestSellersSelectors","selectBestSellersState","bestSellers","selectBestSellersLoadingState","loading","selectBestSellersIdsState","productIds","selectBestSellersProducts","ids","filter","indexOf","getDaffBestSellersSelectors","daffCompositeProductAppliedOptionsEntitiesAdapter","createCompositeProductAppliedOptionsEntitiesSelectors","selectCompositeProductAppliedOptionsEntitiesState","compositeProductOptions","selectCompositeProductIds","selectCompositeProductAppliedOptionsEntities","selectCompositeProductTotal","selectCompositeProductAppliedOptions","appliedOptions","DaffProductTypeEnum","Composite","items","reduce","acc","item","assign","entities","options","find","option","quantity","selectIsCompositeProductItemRequired","item_id","productItem","required","getDaffCompositeProductEntitiesSelectors","createCompositeProductSelectors","selectCompositeProductRequiredItemPricesForConfiguration","configuration","getAppliedOptionsForConfiguration","minPrice","getMinPricesForConfiguration","maxPrice","getMaxPricesForConfiguration","selectCompositeProductOptionalItemPricesForConfiguration","getMaxPricesForConfigurationIncludingOptionalItems","selectCompositeProductPricesAsCurrentlyConfigured","appliedOptionsEntities","projector","selectCompositeProductDiscountAmount","appliedConfigurationItem","_b","daffAdd","daffMultiply","selectCompositeProductDiscountPercent","prices","daffDivide","originalPrice","discountedPrice","getDaffCompositeProductSelectors","appliedOptionHasId","getDiscountedPrice","Math","min","apply","getMinimumRequiredCompositeItemDiscountedPrice","getOptionQty","getMinimumRequiredCompositeItemPrice","max","getMaximumRequiredCompositeItemDiscountedPrice","getMaximumRequiredCompositeItemPrice","appliedOptionHasQty","_c","undefined","appliedOption","daffConfigurableProductAppliedAttributesEntitiesAdapter","createConfigurableProductAppliedAttributesEntitiesSelectors","selectConfigurableProductAppliedAttributesEntitiesState","configurableProductAttributes","selectConfigurableProductIds","selectConfigurableProductAppliedAttributesEntities","selectConfigurableProductTotal","selectConfigurableProductAppliedAttributes","attributes","selectConfigurableProductAppliedAttributesAsDictionary","attribute","code","getDaffConfigurableProductEntitiesSelectors","createConfigurableProductSelectors","selectAllConfigurableProductVariants","Configurable","variants","selectMatchingConfigurableProductVariants","appliedAttributes","variant","isVariantAvailable","selectConfigurableProductPrices","selectConfigurableProductDiscountedPrices","selectConfigurableProductPercentDiscounts","selectConfigurableProductHasDiscount","selectConfigurableProductMinimumPrice","getMinimumPrice","selectConfigurableProductMaximumPrice","getMaximumPrice","selectConfigurableProductMinimumDiscountedPrice","selectConfigurableProductMaximumDiscountedPrice","selectConfigurableProductMinimumPercentDiscount","selectConfigurableProductMaximumPercentDiscount","isConfigurablePriceRanged","selectAllConfigurableProductAttributes","configurableAttributes","values","selectSelectableConfigurableProductAttributes","selectableAttributes","matchedVariants","matchingVariants","appliedAttribute","filteredVariants","slice","getSelectableAttributesFromVariants","forEach","selectedAttributes","attributeArray","variantValue","getDaffConfigurableProductSelectors","createProductGridSelectors","selectProductGridState","productGrid","selectProductGridLoadingState","getDaffProductGridSelectors","createProductPageSelectors","selectCurrentProductState","selectCurrentProductLoadingState","selectCurrentProductId","currentProductId","selectCurrentProduct","getDaffProductPageSelectors","getDaffProductSelectors","DaffBestSellersFacade","store","loading$","select","bestSellers$","prototype","dispatch","providedIn","Store","DaffCompositeProductFacade","selectors","hasDiscount","productPriceRangeHasDiscount","hasPriceRange","productPriceRangeHasPriceRange","getRequiredItemPricesForConfiguration","getOptionalItemPricesForConfiguration","getPricesAsCurrentlyConfigured","getAppliedOptions","getDiscountAmount","getDiscountPercent","isItemRequired","DaffConfigurableProductFacade","getAllAttributes","getAllVariants","getAppliedAttributes","getMinimumDiscountedPrice","getMaximumDiscountedPrice","getMinimumPercentDiscount","getMaximumPercentDiscount","isPriceRanged","getSelectableAttributes","getMatchingVariants","DaffProductFacade","getProduct","getPrice","isOutOfStock","DaffProductPageFacade","product$","DaffProductGridFacade","products$","initialState","errors","resetState","daffBestSellersReducer","getIds","Array","daffCompositeProductEntitiesReducer","getInitialState","adapter","upsertMany","mapOptionsEntities","upsertOne","defaultOptionIndex","findIndex","is_default","getDefaultOption","buildCompositeProductAppliedOptionsEntity","daffConfigurableProductEntitiesReducer","currentAttributes","attributeCode","index","mapEntities","applyAttribute","removeAttribute","buildConfigurableProductAppliedAttributesEntity","appliedAttributeCode","appliedAttributeValue","attributeIndex","daffProductEntitiesReducer","removeAll","daffProductGridReducer","initialState$1","daffProductReducer","initialState$2","daffProductReducers","DAFF_PRODUCT_META_REDUCERS","InjectionToken","factory","DaffProductPageLoadSuccess","DaffProductPageLoadFailure","loadByUrl$","getByUrl","DAFF_PRODUCT_STORE_CONFIG","metaReducers","inject","NgModule","imports","StoreModule","forFeature","EffectsModule","DaffProductGridEffects","DaffProductEffects","DaffProductPageEffects","DaffBestSellersEffects","_i","metaReducer","provide","useValue","multi"],"mappings":"y1BAQA,IAAYA,GAAAA,EAAAA,EAAAA,6BAAAA,EAAAA,2BAA0B,KACpC,sBAAA,4BACAA,EAAA,6BAAA,oCACAA,EAAA,6BAAA,oCACAA,EAAA,uBAAA,mCASA,WAFSC,KAAAC,KAAOF,EAAAA,2BAA2BG,yBAa3C,SAAmBC,GAAAH,KAAAG,QAAAA,EAFVH,KAAAC,KAAOF,EAAAA,2BAA2BK,gCAa3C,SAAmBD,GAAAH,KAAAG,QAAAA,EAFVH,KAAAC,KAAOF,EAAAA,2BAA2BM,gCAW3C,WAFSL,KAAAC,KAAOF,EAAAA,2BAA2BO,yBCrCjCC,EAAAA,kCAAAA,EAAAA,gCAA+B,KAC1C,kCAAA,gECPWC,IDqBV,SAAmBC,EAAoBC,EAA+CC,EAAuDC,GAA1HZ,KAAAS,GAAAA,EAAoBT,KAAAU,OAAAA,EAA+CV,KAAAW,SAAAA,EAAuDX,KAAAY,IAAAA,EAFpIZ,KAAAC,KAAOM,EAAAA,gCAAgCM,oCCnBtCL,EAAAA,EAAAA,qCAAAA,EAAAA,mCAAkC,KAC7C,wCAAA,qEACAA,EAAA,yCAAA,sEACAA,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ACA,CACEC,QAAS,WAAM,MAAA,CACbM,aAAcC,EAAAA,OAAOT,WCK3B,kCAXCU,EAAAA,SAAQzR,KAAA,CAAC,CACR0R,QAAS,CACPC,EAAAA,YAAYC,WAAW5Q,EAAgC8P,GAAqBQ,IAC5EO,EAAAA,cAAcD,WAAW,CACvBE,EACAC,EACAC,GACAC,mmCHYJ,IAAAV,EAAA,GAAAW,EAAA,EAAAA,EAAAnV,UAAAC,OAAAkV,IAAAX,EAAAW,GAAAnV,UAAAmV,GAEA,OAAOX,EAAahS,KAAI,SAAA4S,GAAe,MAAA,CACrCC,QAASrB,GACTsB,SAAUF,EACVG,OAAO","sourcesContent":["import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * Action types for Best Seller Actions.\n */\nexport enum DaffBestSellersActionTypes {\n BestSellersLoadAction = '[BestSellers] Load Action',\n BestSellersLoadSuccessAction = '[BestSellers] Load Success Action',\n BestSellersLoadFailureAction = '[BestSellers] Load Failure Action',\n BestSellersResetAction = '[BestSellers] Reset Action'\n}\n\n/**\n * Triggers a request for best selling products.\n */\nexport class DaffBestSellersLoad implements Action {\n readonly type = DaffBestSellersActionTypes.BestSellersLoadAction;\n\n constructor() {}\n}\n\n/**\n * An action called when a request for best selling products succeeded.\n *\n * @param payload - An array of Products\n */\nexport class DaffBestSellersLoadSuccess<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffBestSellersActionTypes.BestSellersLoadSuccessAction;\n\n constructor(public payload: T[]) {}\n}\n\n/**\n * An action called when a request for best selling products failed.\n *\n * @param payload - An error message\n */\nexport class DaffBestSellersLoadFailure implements Action {\n readonly type = DaffBestSellersActionTypes.BestSellersLoadFailureAction;\n\n constructor(public payload: DaffStateError) {}\n}\n\n/**\n * Resets the state of the best sellers redux store to its initial state.\n */\nexport class DaffBestSellersReset implements Action {\n readonly type = DaffBestSellersActionTypes.BestSellersResetAction;\n\n constructor() {}\n}\n\nexport type DaffBestSellersActions<T extends DaffProduct = DaffProduct> =\n | DaffBestSellersLoad\n | DaffBestSellersLoadSuccess<T>\n | DaffBestSellersLoadFailure\n | DaffBestSellersReset;\n","import { Action } from '@ngrx/store';\n\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n} from '@daffodil/product';\n\n/**\n * Action types for Composite Product Actions.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport enum DaffCompositeProductActionTypes {\n\tCompositeProductApplyOptionAction = '[Composite Product] Composite Product Apply Option Action'\n}\n\n/**\n * Applies a product option to a particular composite product.\n *\n * @param id - Id of the Composite Product\n * @param itemId - Id of the product item.\n * @param optionId - Id of the option of the product item that is chosen.\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport class DaffCompositeProductApplyOption<T extends DaffCompositeProduct> implements Action {\n readonly type = DaffCompositeProductActionTypes.CompositeProductApplyOptionAction;\n\n constructor(public id: T['id'], public itemId: DaffCompositeProductItem['id'], public optionId: DaffCompositeProductItemOption['id'], public qty?: number) {}\n}\n\n/**\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport type DaffCompositeProductActions<T extends DaffCompositeProduct = DaffCompositeProduct> =\n\t| DaffCompositeProductApplyOption<T>;\n","import { Action } from '@ngrx/store';\n\nimport { DaffConfigurableProduct } from '@daffodil/product';\n\n/**\n * Action types for Configurable Product Actions.\n */\nexport enum DaffConfigurableProductActionTypes {\n\tConfigurableProductApplyAttributeAction = '[Configurable Product] Configurable Product Apply Attribute Action',\n\tConfigurableProductRemoveAttributeAction = '[Configurable Product] Configurable Product Remove Attribute Action',\n\tConfigurableProductToggleAttributeAction = '[Configurable Product] Configurable Product Toggle Attribute Action',\n}\n\n/**\n * Applies an attribute to a particular configurable product.\n *\n * @param id - Id of the Configurable Product\n * @param attributeId - Id of the attribute to be applied\n * @param attributeValue - Value of the attribute to be applied\n */\nexport class DaffConfigurableProductApplyAttribute<T extends DaffConfigurableProduct> implements Action {\n readonly type = DaffConfigurableProductActionTypes.ConfigurableProductApplyAttributeAction;\n\n constructor(public id: T['id'], public attributeId: string, public attributeValue: string) {}\n}\n\n/**\n * Removes an applied attribute from a particular configurable product.\n *\n * @param id - Id of the Configurable Product\n * @param attributeId - Id of the attribute to be removed\n */\nexport class DaffConfigurableProductRemoveAttribute<T extends DaffConfigurableProduct> implements Action {\n readonly type = DaffConfigurableProductActionTypes.ConfigurableProductRemoveAttributeAction;\n\n constructor(public id: T['id'], public attributeId: string) {}\n}\n\n/**\n * Toggles an attribute of a particular configurable product. If the attribute type of the configurable product already has\n * a different value than the one provided in the action, the attribute value in state will be overwritten by the value provided\n * in the action.\n *\n * @param id - Id of the Configurable Product\n * @param attributeId - Id of the attribute to be toggled\n * @param attributeValue - Value of the attribute to be toggled\n */\nexport class DaffConfigurableProductToggleAttribute<T extends DaffConfigurableProduct> implements Action {\n readonly type = DaffConfigurableProductActionTypes.ConfigurableProductToggleAttributeAction;\n\n constructor(public id: T['id'], public attributeId: string, public attributeValue: string) {}\n}\n\nexport type DaffConfigurableProductActions<T extends DaffConfigurableProduct = DaffConfigurableProduct> =\n | DaffConfigurableProductApplyAttribute<T>\n | DaffConfigurableProductRemoveAttribute<T>\n | DaffConfigurableProductToggleAttribute<T>;\n","import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * Action types for Product Grid Actions.\n */\nexport enum DaffProductGridActionTypes {\n ProductGridLoadAction = '[ProductGrid] Load Action',\n ProductGridLoadSuccessAction = '[ProductGrid] Load Success Action',\n ProductGridLoadFailureAction = '[ProductGrid] Load Failure Action',\n ProductGridResetAction = '[ProductGrid] Reset Action'\n}\n\n/**\n * Triggers a request for an array of products.\n */\nexport class DaffProductGridLoad implements Action {\n readonly type = DaffProductGridActionTypes.ProductGridLoadAction;\n\n constructor() {}\n}\n\n/**\n * An action called when a request for of an array of products succeeded.\n *\n * @param payload - An array of Products\n */\nexport class DaffProductGridLoadSuccess<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffProductGridActionTypes.ProductGridLoadSuccessAction;\n\n constructor(public payload: T[]) {}\n}\n\n/**\n * An action called when a request for an array of products failed.\n *\n * @param payload - An error message\n */\nexport class DaffProductGridLoadFailure implements Action {\n readonly type = DaffProductGridActionTypes.ProductGridLoadFailureAction;\n\n constructor(public payload: DaffStateError) {}\n}\n\n/**\n * Resets the state of the product grid redux store to its initial state.\n */\nexport class DaffProductGridReset implements Action {\n readonly type = DaffProductGridActionTypes.ProductGridResetAction;\n\n constructor() {}\n}\n\nexport type DaffProductGridActions<T extends DaffProduct = DaffProduct> =\n | DaffProductGridLoad\n | DaffProductGridLoadSuccess<T>\n | DaffProductGridLoadFailure\n | DaffProductGridReset;\n","import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\nimport { DaffProductDriverResponse } from '@daffodil/product/driver';\n\n/**\n * Action types for Product Actions.\n */\nexport enum DaffProductActionTypes {\n ProductLoadAction = '[Product] Load Action',\n ProductLoadSuccessAction = '[Product] Load Success Action',\n ProductLoadFailureAction = '[Product] Load Failure Action',\n}\n\n/**\n * Triggers a request for a Product.\n *\n * @param payload - Id of requested Product\n */\nexport class DaffProductLoad implements Action {\n readonly type = DaffProductActionTypes.ProductLoadAction;\n\n constructor(public payload: string) {}\n}\n\n/**\n * An action called when a request for a Product succeeded.\n *\n * @param payload - A Product\n */\nexport class DaffProductLoadSuccess<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffProductActionTypes.ProductLoadSuccessAction;\n\n constructor(public payload: DaffProductDriverResponse<T>) {}\n}\n\n/**\n * An action called when a request for a Product failed.\n *\n * @param payload - An error message\n */\nexport class DaffProductLoadFailure implements Action {\n readonly type = DaffProductActionTypes.ProductLoadFailureAction;\n\n constructor(public payload: DaffStateError) {}\n}\n\nexport type DaffProductActions<T extends DaffProduct = DaffProduct> =\n | DaffProductLoad\n | DaffProductLoadSuccess<T>\n | DaffProductLoadFailure;\n","import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\nimport { DaffProductDriverResponse } from '@daffodil/product/driver';\n\n/**\n * Action types for Product Page Actions.\n */\nexport enum DaffProductPageActionTypes {\n ProductPageLoadByUrlAction = '[Product Page] Load By URL Action',\n ProductPageLoadAction = '[Product Page] Load Action',\n ProductPageLoadSuccessAction = '[Product Page] Load Success Action',\n ProductPageLoadFailureAction = '[Product Page] Load Failure Action',\n UpdateQtyAction = '[Product Page] Update Qty Action'\n}\n\n/**\n * An action triggered to initialize a product page load.\n * This is intended to be used for loading a product page rather than only a product.\n *\n * @param payload - URL of the requested product\n */\nexport class DaffProductPageLoadByUrl<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffProductPageActionTypes.ProductPageLoadByUrlAction;\n\n constructor(public payload: T['url']) { }\n}\n\n/**\n * An action triggered to initialize a product page load.\n * This is intended to be used for loading a product page rather than only a product.\n *\n * @param payload - Id of the requested product\n */\nexport class DaffProductPageLoad implements Action {\n readonly type = DaffProductPageActionTypes.ProductPageLoadAction;\n\n constructor(public payload: string) { }\n}\n\n/**\n * An action triggered upon a successful product page request.\n *\n * @param payload - A DaffProduct\n */\nexport class DaffProductPageLoadSuccess<T extends DaffProduct = DaffProduct> implements Action {\n readonly type = DaffProductPageActionTypes.ProductPageLoadSuccessAction;\n\n constructor(public payload: DaffProductDriverResponse<T>) { }\n}\n\n/**\n * An action triggered upon a failed product page request.\n *\n * @param payload - an error message\n */\nexport class DaffProductPageLoadFailure implements Action {\n readonly type = DaffProductPageActionTypes.ProductPageLoadFailureAction;\n\n constructor(public payload: DaffStateError) { }\n}\n\n/**\n * Update the qty of the current product.\n *\n * @param payload - The qty of the product.\n */\nexport class DaffProductPageUpdateQty implements Action {\n readonly type = DaffProductPageActionTypes.UpdateQtyAction;\n\n constructor(public payload: number) {}\n}\n\nexport type DaffProductPageActions<T extends DaffProduct = DaffProduct> =\n | DaffProductPageLoadByUrl<T>\n | DaffProductPageLoad\n | DaffProductPageLoadSuccess<T>\n | DaffProductPageLoadFailure\n | DaffProductPageUpdateQty;\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n Effect,\n ofType,\n} from '@ngrx/effects';\nimport {\n Observable ,\n of,\n} from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport {\n DaffProduct,\n DAFF_PRODUCT_ERROR_MATCHER,\n} from '@daffodil/product';\nimport {\n DaffProductDriver,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n DaffBestSellersActionTypes,\n DaffBestSellersLoad,\n DaffBestSellersLoadFailure,\n DaffBestSellersLoadSuccess,\n} from '../actions/public_api';\n\n/**\n * Effects for handling best seller actions and best seller service requests.\n *\n * @param action$ - Redux action object\n * @param driver - A product service driver\n */\n@Injectable()\nexport class DaffBestSellersEffects<T extends DaffProduct> {\n\n constructor(\n private actions$: Actions,\n @Inject(DaffProductDriver) private driver: DaffProductServiceInterface<T>,\n\t\t@Inject(DAFF_PRODUCT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n /**\n * Handles BestSellersLoadAction by making a service call for best selling products and returning a success or failure action\n * to the action stream.\n *\n * @returns An Observable of a BestSellersLoad action\n */\n @Effect()\n loadBestSellers$: Observable<any> = this.actions$.pipe(\n ofType(DaffBestSellersActionTypes.BestSellersLoadAction),\n switchMap((action: DaffBestSellersLoad) =>\n this.driver.getBestSellers()\n .pipe(\n map((resp) => new DaffBestSellersLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffBestSellersLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n Effect,\n ofType,\n} from '@ngrx/effects';\nimport {\n of,\n Observable,\n} from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport {\n DaffProduct,\n DAFF_PRODUCT_ERROR_MATCHER,\n} from '@daffodil/product';\nimport {\n DaffProductDriver,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridLoad,\n DaffProductGridLoadSuccess,\n DaffProductGridLoadFailure,\n} from '../actions/product-grid.actions';\n\n/**\n * Effects for handling product grid actions and for triggering corresponding service requests.\n *\n * @param action$ - Redux action object\n * @param driver - A product service driver\n */\n@Injectable()\nexport class DaffProductGridEffects<T extends DaffProduct> {\n\n constructor(\n private actions$: Actions,\n @Inject(DaffProductDriver) private driver: DaffProductServiceInterface<T>,\n\t\t@Inject(DAFF_PRODUCT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n /**\n * Handles ProductGridLoadAction by making a service call for products and returning a success or failure action\n * to the action stream.\n *\n * @returns An Observable of a DaffProductGridAction\n */\n @Effect()\n loadAll$: Observable<any> = this.actions$.pipe(\n ofType(DaffProductGridActionTypes.ProductGridLoadAction),\n switchMap((action: DaffProductGridLoad) =>\n this.driver.getAll()\n .pipe(\n map((resp) => new DaffProductGridLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffProductGridLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n Effect,\n ofType,\n} from '@ngrx/effects';\nimport {\n of,\n Observable,\n} from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport {\n DaffProduct,\n DAFF_PRODUCT_ERROR_MATCHER,\n} from '@daffodil/product';\nimport {\n DaffProductDriver,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n DaffProductActionTypes,\n DaffProductLoad,\n DaffProductLoadSuccess,\n DaffProductLoadFailure,\n} from '../actions/product.actions';\n\n/**\n * Effects for handling product actions and for triggering corresponding service requests.\n *\n * @param action$ - Redux action object\n * @param driver - A product service driver\n */\n@Injectable()\nexport class DaffProductEffects<T extends DaffProduct> {\n\n constructor(\n private actions$: Actions,\n @Inject(DaffProductDriver) private driver: DaffProductServiceInterface<T>,\n\t\t@Inject(DAFF_PRODUCT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n /**\n * Handles ProductLoadAction by making a service call for a product and returning a success or\n * failure action to the action stream.\n *\n * @returns An Observable of a ProductLoadAction\n */\n @Effect()\n load$: Observable<any> = this.actions$.pipe(\n ofType(DaffProductActionTypes.ProductLoadAction),\n switchMap((action: DaffProductLoad) =>\n this.driver.get(action.payload)\n .pipe(\n map((resp) => new DaffProductLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffProductLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n}\n","import {\n EntityAdapter,\n createEntityAdapter,\n} from '@ngrx/entity';\n\nimport { DaffProduct } from '@daffodil/product';\n\n/**\n * Product Adapter for changing/overwriting entity state.\n */\nexport const daffProductEntitiesAdapter = (() => {\n let cache;\n return <T extends DaffProduct>(): EntityAdapter<T> =>\n cache = cache || createEntityAdapter<T>();\n})();\n","export const DAFF_PRODUCT_STORE_FEATURE_KEY = 'daffProduct';\n","import {\n createFeatureSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductReducersState } from '../reducers/product-reducers-state.interface';\nimport { DAFF_PRODUCT_STORE_FEATURE_KEY } from '../reducers/product-store-feature-key';\n\n/**\n * An interface for the entire product feature state.\n */\nexport interface DaffProductFeatureMemoizedSelector<T extends DaffProduct = DaffProduct> {\n\tselectProductState: MemoizedSelector<Record<string, any>, DaffProductReducersState<T>>;\n}\n\n/**\n * A function that returns a selector for the entire product feature state.\n */\nexport const getDaffProductFeatureSelector = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffProductFeatureMemoizedSelector<T> => cache = cache\n ? cache\n : { selectProductState: createFeatureSelector<DaffProductReducersState<T>>(DAFF_PRODUCT_STORE_FEATURE_KEY) };\n})();\n","import { EntityState } from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport { daffSubtract } from '@daffodil/core';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { daffProductEntitiesAdapter } from '../../reducers/product-entities/product-entities-reducer-adapter';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to product entities and prices for simple products.\n */\nexport interface DaffProductEntitiesMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n\t/**\n\t * Selects the ngrx entities state for products.\n\t */\n\tselectProductEntitiesState: MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>>;\n\t/**\n\t * Selects all ids for products in state.\n\t */\n\tselectProductIds: MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>['ids']>;\n\t/**\n\t * Selects the ngrx entities for all products in state.\n\t */\n\tselectProductEntities: MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>['entities']>;\n\t/**\n\t * Selects all products in state as an array.\n\t */\n\tselectAllProducts: MemoizedSelector<DaffProductStateRootSlice<T>, T[]>;\n\t/**\n\t * Selects the total number of products in state.\n\t */\n\tselectProductTotal: MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects a product by id.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProduct: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, T>;\n\t/**\n\t * Selects the price of a product.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductPrice: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects the discount of a product as some amount of currency.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductDiscountAmount: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects the discounted price of a product.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductDiscountedPrice: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects the discount of a product as a percent of the original price.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductDiscountPercent: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, number>;\n\t/**\n\t * Selects whether or not the product has a discount.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectProductHasDiscount: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, boolean>;\n\t/**\n\t * Selects whether or not a product is out of stock.\n\t *\n\t * @param productId the id of the product.\n\t */\n\tselectIsProductOutOfStock: (productId: T['id']) => MemoizedSelector<DaffProductStateRootSlice<T>, boolean>;\n}\n\nconst createProductEntitiesSelectors = <T extends DaffProduct>(): DaffProductEntitiesMemoizedSelectors<T> => {\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n const adapterSelectors = daffProductEntitiesAdapter<T>().getSelectors();\n /**\n * Product Entities State\n */\n const selectProductEntitiesState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.products,\n );\n\n /**\n * Adapters created with @ngrx/entity generate\n * commonly used selector functions including\n * getting all ids in the record set, a dictionary\n * of the records by id, an array of records and\n * the total number of records. This reduces boilerplate\n * in selecting records from the entity state.\n */\n const selectProductIds = createSelector(\n selectProductEntitiesState,\n adapterSelectors.selectIds,\n );\n\n const selectProductEntities = createSelector(\n selectProductEntitiesState,\n adapterSelectors.selectEntities,\n );\n\n const selectAllProducts = createSelector(\n selectProductEntitiesState,\n adapterSelectors.selectAll,\n );\n\n const selectProductTotal = createSelector(\n selectProductEntitiesState,\n adapterSelectors.selectTotal,\n );\n\n const selectProduct = defaultMemoize((productId: T['id']) => createSelector(\n selectProductEntities,\n products => products[productId],\n )).memoized;\n\n const selectProductPrice = defaultMemoize((productId: T['id']) => createSelector(\n selectProduct(productId),\n (product: T) => product?.price || null,\n )).memoized;\n\n const selectProductDiscountAmount = defaultMemoize((productId: T['id']) => createSelector(\n selectProduct(productId),\n (product: T) => product?.discount?.amount || 0,\n )).memoized;\n\n const selectProductDiscountedPrice = defaultMemoize((productId: T['id']) => createSelector(\n selectProductPrice(productId),\n selectProductDiscountAmount(productId),\n (price: number, discountAmount: number) => daffSubtract(price, discountAmount),\n )).memoized;\n\n const selectProductDiscountPercent = defaultMemoize((productId: T['id']) => createSelector(\n selectProduct(productId),\n (product: T) => product.discount?.percent || 0,\n )).memoized;\n\n const selectProductHasDiscount = defaultMemoize((productId: T['id']) => createSelector(\n selectProductDiscountAmount(productId),\n (discountAmount: number) => !!discountAmount,\n )).memoized;\n\n const selectIsProductOutOfStock = defaultMemoize((productId: T['id']) => createSelector(\n selectProduct(productId),\n (product: T) => product ? !product.in_stock : null,\n )).memoized;\n\n return {\n selectProductEntitiesState,\n selectProductIds,\n selectProductEntities,\n selectAllProducts,\n selectProductTotal,\n selectProduct,\n selectProductPrice,\n selectProductDiscountAmount,\n selectProductDiscountedPrice,\n selectProductDiscountPercent,\n selectProductHasDiscount,\n selectIsProductOutOfStock,\n };\n};\n\n/**\n * A function that returns all selectors related to product entities and simple product prices.\n */\nexport const getDaffProductEntitiesSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffProductEntitiesMemoizedSelectors<T> => cache = cache\n ? cache\n : createProductEntitiesSelectors<T>();\n})();\n","import {\n createSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffBestSellersReducerState } from '../../reducers/best-sellers/best-sellers-reducer-state.interface';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductEntitiesSelectors } from '../product-entities/product-entities.selectors';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for the available best sellers selectors.\n */\nexport interface DaffBestSellersMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n\t/**\n\t * Selector for best sellers feature state\n\t */\n\tselectBestSellersState: MemoizedSelector<DaffProductStateRootSlice<T>, DaffBestSellersReducerState>;\n\t/**\n\t * Selector for the loading state of best selling products.\n\t */\n\tselectBestSellersLoadingState: MemoizedSelector<DaffProductStateRootSlice<T>, boolean>;\n\t/**\n\t * Selector for the IDs of best selling products.\n\t */\n\tselectBestSellersIdsState: MemoizedSelector<DaffProductStateRootSlice<T>, T['id'][]>;\n\t/**\n\t * Selector for the best selling products.\n\t */\n\tselectBestSellersProducts: MemoizedSelector<DaffProductStateRootSlice<T>, T[]>;\n}\n\nconst createBestSellersSelectors = <T extends DaffProduct>(): DaffBestSellersMemoizedSelectors<T> => {\n const {\n selectAllProducts,\n } = getDaffProductEntitiesSelectors<T>();\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n\n const selectBestSellersState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.bestSellers,\n );\n\n const selectBestSellersLoadingState = createSelector(\n selectBestSellersState,\n (state: DaffBestSellersReducerState) => state.loading,\n );\n\n const selectBestSellersIdsState = createSelector(\n selectBestSellersState,\n (state: DaffBestSellersReducerState) => state.productIds,\n );\n\n const selectBestSellersProducts = createSelector(\n selectBestSellersIdsState,\n selectAllProducts,\n (ids: T['id'][], products: T[]) => products.filter(product => ids.indexOf(product.id) > -1),\n );\n\n return {\n selectBestSellersState,\n selectBestSellersLoadingState,\n selectBestSellersIdsState,\n selectBestSellersProducts,\n };\n};\n\n/**\n * A function that returns all selectors related to best sellers state.\n *\n * Returns {@link DaffBestSellersMemoizedSelectors}.\n */\nexport const getDaffBestSellersSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffBestSellersMemoizedSelectors<T> => cache = cache\n ? cache\n : createBestSellersSelectors<T>();\n})();\n","import {\n EntityAdapter,\n createEntityAdapter,\n} from '@ngrx/entity';\n\nimport { DaffCompositeProductEntity } from './composite-product-entity';\n\n/**\n * Composite Product Item Options Adapter for changing/overwriting entity state.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport const daffCompositeProductAppliedOptionsEntitiesAdapter = (() => {\n let cache;\n return (): EntityAdapter<DaffCompositeProductEntity> =>\n cache = cache || createEntityAdapter<DaffCompositeProductEntity>();\n})();\n","import {\n EntityState,\n Dictionary,\n} from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n DaffCompositeProduct,\n DaffCompositeProductItemOption,\n DaffCompositeProductItem,\n} from '@daffodil/product';\n\nimport { daffCompositeProductAppliedOptionsEntitiesAdapter } from '../../reducers/composite-product-entities/composite-product-entities-reducer-adapter';\nimport { DaffCompositeProductEntity } from '../../reducers/composite-product-entities/composite-product-entity';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductEntitiesSelectors } from '../product-entities/product-entities.selectors';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to the composite product applied options.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport interface DaffCompositeProductEntitiesMemoizedSelectors {\n\t/**\n\t * The ngrx entities state for composite product applied options.\n\t */\n\tselectCompositeProductAppliedOptionsEntitiesState: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffCompositeProductEntity>>;\n\t/**\n\t * A selector for all composite product ids in state.\n\t */\n\tselectCompositeProductIds: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffCompositeProductEntity>['ids']>;\n\t/**\n\t * The ngrx entities for the composite product appllied options.\n\t */\n\tselectCompositeProductAppliedOptionsEntities: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffCompositeProductEntity>['entities']>;\n\t/**\n\t * The total number of composite products in state.\n\t */\n\tselectCompositeProductTotal: MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the applied options for a composite product.\n\t *\n\t * @param id the id of the composite product.\n\t */\n\tselectCompositeProductAppliedOptions: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, Dictionary<DaffCompositeProductItemOption>>;\n\t/**\n\t * Selects whether the particular item of a composite product is required in order for the product to be valid, i.e. addable to the cart.\n\t *\n\t * @param id the id of the composite product.\n\t * @param item_id the id of the composite product item.\n\t */\n\tselectIsCompositeProductItemRequired: (id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']) => MemoizedSelector<DaffProductStateRootSlice, boolean>;\n}\n\nconst createCompositeProductAppliedOptionsEntitiesSelectors = <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors => {\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n const {\n selectProductEntities,\n selectProduct,\n } = getDaffProductEntitiesSelectors();\n const adapterSelectors = daffCompositeProductAppliedOptionsEntitiesAdapter().getSelectors();\n\n const selectCompositeProductAppliedOptionsEntitiesState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.compositeProductOptions,\n );\n\n const selectCompositeProductIds = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectIds,\n );\n\n const selectCompositeProductAppliedOptionsEntities = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectEntities,\n );\n\n const selectCompositeProductTotal = createSelector(\n selectCompositeProductAppliedOptionsEntitiesState,\n adapterSelectors.selectTotal,\n );\n\n const selectCompositeProductAppliedOptions = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntitiesState,\n (product: DaffCompositeProduct, appliedOptions) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n return product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: appliedOptions.entities[product.id].items[item.id].value ? {\n ...item.options.find(option => option.id === appliedOptions.entities[product.id].items[item.id].value),\n quantity: appliedOptions.entities[product.id].items[item.id].qty,\n } : null,\n }), {});\n },\n )).memoized;\n\n const selectIsCompositeProductItemRequired = defaultMemoize((id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']) => createSelector(\n selectProduct(id),\n (product: DaffCompositeProduct) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const productItem = product.items.find(item => item.id === item_id);\n\n return productItem ? productItem.required : null;\n },\n )).memoized;\n\n\n return {\n selectCompositeProductAppliedOptionsEntitiesState,\n selectCompositeProductIds,\n selectCompositeProductAppliedOptionsEntities,\n selectCompositeProductTotal,\n selectCompositeProductAppliedOptions,\n selectIsCompositeProductItemRequired,\n };\n};\n\n/**\n * A function that returns all selectors related to composite product applied option entities.\n * Returns {@link DaffCompositeProductEntitiesMemoizedSelectors}.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport const getDaffCompositeProductEntitiesSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors => cache = cache\n ? cache\n : createCompositeProductAppliedOptionsEntitiesSelectors<T>();\n})();\n","import { Dictionary } from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n daffAdd,\n daffDivide,\n daffMultiply,\n daffSubtract,\n} from '@daffodil/core';\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n DaffProductPrices,\n DaffPriceRange,\n DaffCompositeConfigurationItem,\n} from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffCompositeProductEntitiesSelectors } from '../composite-product-entities/composite-product-entities.selectors';\nimport { getDaffProductEntitiesSelectors } from '../product-entities/product-entities.selectors';\n\n/**\n * An interface describing selectors unique to the composite product, such as pricing and discounts.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport interface DaffCompositeProductMemoizedSelectors {\n\t/**\n\t * Get a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.\n\t */\n\tselectCompositeProductRequiredItemPricesForConfiguration: ( id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem> ) => MemoizedSelector<DaffProductStateRootSlice, DaffPriceRange>;\n\t/**\n\t * Get the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.\n\t */\n\tselectCompositeProductOptionalItemPricesForConfiguration: ( id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem> ) => MemoizedSelector<DaffProductStateRootSlice, DaffPriceRange>;\n\t/**\n\t * Get the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and\n\t * excluding unselected, optional item prices.\n\t */\n\tselectCompositeProductPricesAsCurrentlyConfigured: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffProductStateRootSlice, DaffPriceRange>;\n\t/**\n\t * Get the discount amount for a composite product. This value will be undefined if all required options are not chosen.\n\t */\n\tselectCompositeProductDiscountAmount: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Get the discount percent for a composite product. This value will be undefined if all required options are not chosen.\n\t * Note: this percent is computed client-side and should be treated as an estimate rather than an exact value.\n\t */\n\tselectCompositeProductDiscountPercent: ( id: DaffCompositeProduct['id'] ) => MemoizedSelector<DaffProductStateRootSlice, number>;\n}\n\nconst createCompositeProductSelectors = (): DaffCompositeProductMemoizedSelectors => {\n\n const {\n selectProduct,\n } = getDaffProductEntitiesSelectors();\n\n const {\n selectCompositeProductAppliedOptionsEntities,\n } = getDaffCompositeProductEntitiesSelectors();\n\n const selectCompositeProductRequiredItemPricesForConfiguration = defaultMemoize((id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => createSelector(\n selectProduct(id),\n (product: DaffCompositeProduct) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const appliedOptions = configuration ? getAppliedOptionsForConfiguration(product, configuration) : {};\n return {\n minPrice: getMinPricesForConfiguration(product, appliedOptions),\n maxPrice: getMaxPricesForConfiguration(product, appliedOptions),\n };\n },\n )).memoized;\n\n const selectCompositeProductOptionalItemPricesForConfiguration = defaultMemoize((id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => createSelector(\n selectProduct(id),\n (product: DaffCompositeProduct) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n\n const appliedOptions = configuration ? getAppliedOptionsForConfiguration(product, configuration) : {};\n return {\n minPrice: getMinPricesForConfiguration(product, appliedOptions),\n maxPrice: getMaxPricesForConfigurationIncludingOptionalItems(product, appliedOptions),\n };\n },\n )).memoized;\n\n const selectCompositeProductPricesAsCurrentlyConfigured = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: DaffCompositeProduct, appliedOptionsEntities) =>\n selectCompositeProductRequiredItemPricesForConfiguration(id, appliedOptionsEntities[id]?.items || null).projector(product),\n )).memoized;\n\n const selectCompositeProductDiscountAmount = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: DaffCompositeProduct, appliedOptionsEntities) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n const appliedConfigurationItem = appliedOptionsEntities[product.id].items;\n if(product.items.filter(item => item.required && appliedConfigurationItem[item.id].value === null).length > 0) {\n return undefined;\n }\n const appliedOptions = getAppliedOptionsForConfiguration(product, appliedConfigurationItem);\n\n return product.items.reduce((acc, item) =>\n appliedOptions[item.id]?.discount?.amount ? daffAdd(acc, daffMultiply(appliedOptions[item.id].discount.amount, appliedOptions[item.id].quantity)) : acc,\n product.discount.amount);\n },\n )).memoized;\n\n const selectCompositeProductDiscountPercent = defaultMemoize((id: DaffCompositeProduct['id']) => createSelector(\n selectProduct(id),\n selectCompositeProductAppliedOptionsEntities,\n (product: DaffCompositeProduct, appliedOptionsEntities) => {\n if(product.type !== DaffProductTypeEnum.Composite) {\n return undefined;\n }\n const appliedOptions = appliedOptionsEntities[product.id].items;\n if(product.items.filter(item => item.required && appliedOptions[item.id].value === null).length > 0) {\n return undefined;\n }\n\n const prices = getMinPricesForConfiguration(\n product,\n getAppliedOptionsForConfiguration(product, appliedOptions),\n );\n\n return daffMultiply(\n daffDivide(\n daffSubtract(prices.originalPrice, prices.discountedPrice),\n prices.originalPrice,\n ),\n 100,\n );\n },\n )).memoized;\n\n return {\n selectCompositeProductRequiredItemPricesForConfiguration,\n selectCompositeProductOptionalItemPricesForConfiguration,\n selectCompositeProductPricesAsCurrentlyConfigured,\n selectCompositeProductDiscountAmount,\n selectCompositeProductDiscountPercent,\n };\n};\n\n/**\n * A function that returns all selectors related to the composite product feature.\n *\n * Returns {@link DaffCompositeProductMemoizedSelectors}.\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport const getDaffCompositeProductSelectors = (() => {\n let cache;\n return (): DaffCompositeProductMemoizedSelectors => cache = cache\n ? cache\n : createCompositeProductSelectors();\n})();\n\n/**\n * The minimum price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMinimumRequiredCompositeItemPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.min(...item.options.map(option => option.price)), qty) : 0;\n}\n\n/**\n * The maximum price for an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMaximumRequiredCompositeItemPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.max(...item.options.map(option => option.price)), qty) : 0;\n}\n\n/**\n * The minimum discounted price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMinimumRequiredCompositeItemDiscountedPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.min(...item.options.map(getDiscountedPrice)), qty) : 0;\n}\n/**\n * The maximum discounted price of an item is zero if the item is optional.\n *\n * @param item DaffCompositeProductItem\n */\nfunction getMaximumRequiredCompositeItemDiscountedPrice(item: DaffCompositeProductItem, qty: number): number {\n return item.required ? daffMultiply(Math.max(...item.options.map(getDiscountedPrice)), qty) : 0;\n}\n\n/**\n * Gets the minimum prices of a composite product for the configuration provided excluding unselected, optional item prices.\n *\n * @param product a DaffCompositeProduct\n * @param appliedOptions a Dictionary<DaffCompositeProductItemOption> that determines the current configuration of the composite product.\n */\nfunction getMinPricesForConfiguration(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n getMinimumRequiredCompositeItemDiscountedPrice(item, getOptionQty(appliedOptions[item.id])),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n getMinimumRequiredCompositeItemPrice(item, getOptionQty(appliedOptions[item.id])),\n ), product.price),\n };\n}\n\n/**\n * Gets the maximum prices of a composite product for the configuration provided excluding unselected, optional item prices.\n *\n * @param product a DaffCompositeProduct\n * @param appliedOptions a Dictionary<DaffCompositeProductItemOption> that determines the current configuration of the composite product.\n */\nfunction getMaxPricesForConfiguration(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n getMaximumRequiredCompositeItemDiscountedPrice(item, getOptionQty(appliedOptions[item.id])),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n getMaximumRequiredCompositeItemPrice(item, getOptionQty(appliedOptions[item.id])),\n ), product.price),\n };\n}\n\nfunction getDiscountedPrice(product: DaffProduct): number {\n return product.discount ? daffSubtract(product.price, product.discount.amount) : product.price;\n}\n\n/**\n * Gets the maximum prices of a composite product including optional item prices.\n *\n * @param product a DaffCompositeProduct\n */\nfunction getMaxPricesForConfigurationIncludingOptionalItems(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {\n return {\n discountedPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(getDiscountedPrice(appliedOptions[item.id]), appliedOptions[item.id].quantity) :\n appliedOptionHasQty(appliedOptions[item.id]) ?\n daffMultiply(Math.max(...item.options.map(getDiscountedPrice)), appliedOptions[item.id].quantity) :\n Math.max(...item.options.map(getDiscountedPrice)),\n ), getDiscountedPrice(product)),\n discount: { amount: null, percent: null },\n originalPrice: product.items.reduce((acc, item) => daffAdd(\n acc,\n appliedOptionHasId(appliedOptions[item.id]) ?\n daffMultiply(appliedOptions[item.id].price, appliedOptions[item.id].quantity) :\n appliedOptionHasQty(appliedOptions[item.id]) ?\n daffMultiply(Math.max(...item.options.map(option => option.price)), appliedOptions[item.id].quantity) :\n Math.max(...item.options.map(option => option.price)),\n ), product.price),\n };\n}\n\n/**\n * Takes a product and a set of option configurations and convert it into a dictionary of the full option objects.\n *\n * @param product a DaffCompositeProduct\n * @param configuration a Dictionary<DaffCompositeConfigurationItem> used to build the appliedOptions object.\n */\nfunction getAppliedOptionsForConfiguration(product: DaffCompositeProduct, configuration: Dictionary<DaffCompositeConfigurationItem>): Dictionary<DaffCompositeProductItemOption> {\n return product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: configuration[item.id] ? {\n ...item.options.find(option => option.id === configuration[item.id].value),\n quantity: (configuration[item.id].qty === null || configuration[item.id].qty === undefined) ? 1 : configuration[item.id].qty,\n } : null,\n }), {});\n}\n\nfunction appliedOptionHasId(appliedOption: DaffCompositeProductItemOption): boolean {\n return !!appliedOption?.id;\n}\n\nfunction getOptionQty(appliedOption: DaffCompositeProductItemOption): number {\n return appliedOptionHasQty(appliedOption) ? appliedOption.quantity : 1;\n}\n\nfunction appliedOptionHasQty(appliedOption: DaffCompositeProductItemOption): boolean {\n return appliedOption?.quantity !== null && appliedOption?.quantity !== undefined;\n}\n","import {\n EntityAdapter,\n createEntityAdapter,\n} from '@ngrx/entity';\n\nimport { DaffConfigurableProductEntity } from './configurable-product-entity';\n\n/**\n * Configurable Product Applied Attributes Adapter for changing/overwriting entity state.\n */\nexport const daffConfigurableProductAppliedAttributesEntitiesAdapter = (() => {\n let cache;\n return (): EntityAdapter<DaffConfigurableProductEntity> =>\n cache = cache || createEntityAdapter<DaffConfigurableProductEntity>();\n})();\n","import {\n EntityState,\n Dictionary,\n} from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { daffConfigurableProductAppliedAttributesEntitiesAdapter } from '../../reducers/configurable-product-entities/configurable-product-entities-reducer-adapter';\nimport {\n DaffConfigurableProductEntity,\n DaffConfigurableProductEntityAttribute,\n} from '../../reducers/configurable-product-entities/configurable-product-entity';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to the configurable product applied attributes.\n *\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\nexport interface DaffConfigurableProductEntitiesMemoizedSelectors {\n\t/**\n\t * Selects the configurable product applied attributes entities state.\n\t */\n\tselectConfigurableProductAppliedAttributesEntitiesState: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffConfigurableProductEntity>>;\n\t/**\n\t * Selects all ids for configurable products in state.\n\t */\n\tselectConfigurableProductIds: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffConfigurableProductEntity>['ids']>;\n\t/**\n\t * Selects the configurable product applied attributes as ngrx entities.\n\t */\n\tselectConfigurableProductAppliedAttributesEntities: MemoizedSelector<DaffProductStateRootSlice, EntityState<DaffConfigurableProductEntity>['entities']>;\n\t/**\n\t * Selects the total number of configurable products in state.\n\t */\n\tselectConfigurableProductTotal: MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the applied attributes of a configurable product.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductAppliedAttributes: (productId: DaffProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, DaffConfigurableProductEntityAttribute[]>;\n\t/**\n\t * Selects the applied attributes of a configurable product as a dictionary.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductAppliedAttributesAsDictionary: (productId: DaffProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, Dictionary<string>>;\n}\n\nconst createConfigurableProductAppliedAttributesEntitiesSelectors = <T extends DaffProduct>(): DaffConfigurableProductEntitiesMemoizedSelectors => {\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n const adapterSelectors = daffConfigurableProductAppliedAttributesEntitiesAdapter().getSelectors();\n\n const selectConfigurableProductAppliedAttributesEntitiesState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.configurableProductAttributes,\n );\n\n const selectConfigurableProductIds = createSelector(\n selectConfigurableProductAppliedAttributesEntitiesState,\n adapterSelectors.selectIds,\n );\n\n const selectConfigurableProductAppliedAttributesEntities = createSelector(\n selectConfigurableProductAppliedAttributesEntitiesState,\n adapterSelectors.selectEntities,\n );\n\n const selectConfigurableProductTotal = createSelector(\n selectConfigurableProductAppliedAttributesEntitiesState,\n adapterSelectors.selectTotal,\n );\n\n const selectConfigurableProductAppliedAttributes = defaultMemoize((productId: DaffProduct['id']) => createSelector(\n selectConfigurableProductAppliedAttributesEntitiesState,\n products => products.entities[productId].attributes,\n )).memoized;\n\n const selectConfigurableProductAppliedAttributesAsDictionary = defaultMemoize((productId: DaffProduct['id']) => createSelector(\n selectConfigurableProductAppliedAttributes(productId),\n (attributes: DaffConfigurableProductEntityAttribute[]) => attributes.reduce((acc, attribute) => ({\n ...acc,\n [attribute.code]: attribute.value,\n }), {}),\n )).memoized;\n\n return {\n selectConfigurableProductAppliedAttributesEntitiesState,\n selectConfigurableProductIds,\n selectConfigurableProductAppliedAttributesEntities,\n selectConfigurableProductTotal,\n selectConfigurableProductAppliedAttributes,\n selectConfigurableProductAppliedAttributesAsDictionary,\n };\n};\n\n/**\n * A function that returns all selectors related to configurable product applied attributes.\n * Returns {@link DaffConfigurableProductEntitiesMemoizedSelectors}.\n *\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\nexport const getDaffConfigurableProductEntitiesSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffConfigurableProductEntitiesMemoizedSelectors => cache = cache\n ? cache\n : createConfigurableProductAppliedAttributesEntitiesSelectors<T>();\n})();\n","import { Dictionary } from '@ngrx/entity';\nimport {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport { daffSubtract } from '@daffodil/core';\nimport {\n DaffProductTypeEnum,\n DaffConfigurableProductVariant,\n DaffConfigurableProduct,\n DaffConfigurableProductAttribute,\n} from '@daffodil/product';\n\nimport { DaffConfigurableProductEntityAttribute } from '../../reducers/configurable-product-entities/configurable-product-entity';\nimport { DaffProductStateRootSlice } from '../../reducers/public_api';\nimport { getDaffConfigurableProductEntitiesSelectors } from '../configurable-product-entities/configurable-product-entities.selectors';\nimport { getDaffProductEntitiesSelectors } from '../product-entities/product-entities.selectors';\n\n/**\n * An interface describing all selectors unique to configurable products including ranged pricing, configurable attributes, and product variants.\n *\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\nexport interface DaffConfigurableProductMemoizedSelectors {\n\t/**\n\t * Selects all possible attributes of a configurable product.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectAllConfigurableProductAttributes: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, Dictionary<string[]>>;\n\t/**\n\t * Selects all variants of the configurable product.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectAllConfigurableProductVariants: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, DaffConfigurableProductVariant[]>;\n\t/**\n\t * Selects the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectMatchingConfigurableProductVariants: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, DaffConfigurableProductVariant[]>;\n\t/**\n\t * Selects all prices for the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductPrices: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number[]>;\n\t/**\n\t * Selects all discounted prices for the configurable product variant that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductDiscountedPrices: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number[]>;\n\t/**\n\t * Selects all percent discounts for the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductPercentDiscounts: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number[]>;\n\t/**\n\t * Selects whether or not any variants that match the currently applied attributes have a discount.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductHasDiscount: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, boolean>;\n\t/**\n\t * Selects the minimum possible price of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMinimumPrice: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the maximum possible price of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMaximumPrice: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the minimum possible discounted price of the configurable product variants that match the currently applied attributes.\n\t */\n\tselectConfigurableProductMinimumDiscountedPrice: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the maximum possible discounted price of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMaximumDiscountedPrice: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the minimum possible percent discount of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMinimumPercentDiscount: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects the maximum possible percent discount of the configurable product variants that match the currently applied attributes.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tselectConfigurableProductMaximumPercentDiscount: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, number>;\n\t/**\n\t * Selects whether or not the currently applied attributes result in more than one possible price.\n\t *\n\t * @param productId the id of the configurable product.\n\t */\n\tisConfigurablePriceRanged: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, boolean>;\n\t/**\n\t * Selects the available/selectable configurable product attributes derived from the order of currently applied attributes and the remaining variants\n\t * (determined by the currently applied attributes). An attribute might not be selectable if none of the matching variants have that particular attribute.\n\t */\n\tselectSelectableConfigurableProductAttributes: (productId: DaffConfigurableProduct['id']) => MemoizedSelector<DaffProductStateRootSlice, Dictionary<string[]>>;\n}\n\nconst createConfigurableProductSelectors = (): DaffConfigurableProductMemoizedSelectors => {\n\n const {\n selectConfigurableProductAppliedAttributes,\n } = getDaffConfigurableProductEntitiesSelectors();\n\n const {\n selectProduct,\n } = getDaffProductEntitiesSelectors();\n\n const selectAllConfigurableProductVariants = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectProduct(productId),\n (product: DaffConfigurableProduct) => {\n if(!product || product.type !== DaffProductTypeEnum.Configurable) {\n return [];\n }\n return product.variants;\n },\n )).memoized;\n\n const selectMatchingConfigurableProductVariants = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectProduct(productId),\n selectConfigurableProductAppliedAttributes(productId),\n (product: DaffConfigurableProduct, appliedAttributes) => {\n if(!product || product.type !== DaffProductTypeEnum.Configurable) {\n return [];\n }\n return product.variants.filter(variant => isVariantAvailable(appliedAttributes, variant));\n },\n )).memoized;\n\n const selectConfigurableProductPrices = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectMatchingConfigurableProductVariants(productId),\n (variants: DaffConfigurableProductVariant[]) => variants.map(variant => variant.price),\n )).memoized;\n\n const selectConfigurableProductDiscountedPrices = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectMatchingConfigurableProductVariants(productId),\n (variants: DaffConfigurableProductVariant[]) => variants.map(variant =>\n variant.discount ? daffSubtract(variant.price, variant.discount.amount) : variant.price,\n ),\n )).memoized;\n\n const selectConfigurableProductPercentDiscounts = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectMatchingConfigurableProductVariants(productId),\n (variants: DaffConfigurableProductVariant[]) => variants.map(variant => variant.discount?.percent),\n )).memoized;\n\n const selectConfigurableProductHasDiscount = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectMatchingConfigurableProductVariants(productId),\n (variants: DaffConfigurableProductVariant[]) => variants.reduce((acc, variant) =>\n acc || (variant.discount?.amount > 0), false,\n ),\n )).memoized;\n\n const selectConfigurableProductMinimumPrice = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductPrices(productId),\n getMinimumPrice,\n )).memoized;\n\n const selectConfigurableProductMaximumPrice = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductPrices(productId),\n getMaximumPrice,\n )).memoized;\n\n const selectConfigurableProductMinimumDiscountedPrice = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductDiscountedPrices(productId),\n getMinimumPrice,\n )).memoized;\n\n const selectConfigurableProductMaximumDiscountedPrice = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductDiscountedPrices(productId),\n getMaximumPrice,\n )).memoized;\n\n const selectConfigurableProductMinimumPercentDiscount = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductPercentDiscounts(productId),\n getMinimumPrice,\n )).memoized;\n\n const selectConfigurableProductMaximumPercentDiscount = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductPercentDiscounts(productId),\n getMaximumPrice,\n )).memoized;\n\n const isConfigurablePriceRanged = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectConfigurableProductMinimumPrice(productId),\n selectConfigurableProductMaximumPrice(productId),\n (minPrice: number, maxPrice: number) => minPrice !== maxPrice,\n )).memoized;\n\n const selectAllConfigurableProductAttributes = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectProduct(productId),\n (product: DaffConfigurableProduct) => {\n if(product.type !== DaffProductTypeEnum.Configurable) {\n return {};\n }\n return product.configurableAttributes.reduce((acc, attribute) => ({\n ...acc,\n [attribute.code]: attribute.values.map(value => value.value),\n }), {});\n },\n )).memoized;\n\n const selectSelectableConfigurableProductAttributes = defaultMemoize((productId: DaffConfigurableProduct['id']) => createSelector(\n selectProduct(productId),\n selectConfigurableProductAppliedAttributes(productId),\n (product: DaffConfigurableProduct, appliedAttributes: DaffConfigurableProductEntityAttribute[]) => {\n if(product.type !== DaffProductTypeEnum.Configurable) {\n return {};\n }\n\n const selectableAttributes = initializeSelectableAttributes(product.configurableAttributes);\n\n // Set which values of applied attribute codes should be set as selectable based on the order that they were selected\n const matchedVariants = appliedAttributes.reduce((matchingVariants, appliedAttribute, i) => {\n const filteredVariants = matchingVariants.filter(variant => isVariantAvailable(appliedAttributes.slice(0, i), variant));\n\n selectableAttributes[appliedAttribute.code] = getSelectableAttributesFromVariants(selectableAttributes, filteredVariants, appliedAttribute.code);\n\n return filteredVariants;\n }, product.variants).filter(variant =>\n isVariantAvailable(appliedAttributes, variant),\n );\n\n // Set which values of the unapplied attribute codes should be set as selectable based on the matching variants of all\n // applied attributes.\n product.configurableAttributes.forEach(attribute => {\n if (!selectableAttributes[attribute.code].length) {\n selectableAttributes[attribute.code] = getSelectableAttributesFromVariants(selectableAttributes, matchedVariants, attribute.code);\n }\n });\n\n return selectableAttributes;\n },\n )).memoized;\n\n return {\n selectAllConfigurableProductAttributes,\n selectAllConfigurableProductVariants,\n selectConfigurableProductPrices,\n selectConfigurableProductDiscountedPrices,\n selectConfigurableProductPercentDiscounts,\n selectConfigurableProductHasDiscount,\n selectConfigurableProductMinimumPrice,\n selectConfigurableProductMaximumPrice,\n selectConfigurableProductMinimumDiscountedPrice,\n selectConfigurableProductMaximumDiscountedPrice,\n selectConfigurableProductMinimumPercentDiscount,\n selectConfigurableProductMaximumPercentDiscount,\n isConfigurablePriceRanged,\n selectMatchingConfigurableProductVariants,\n selectSelectableConfigurableProductAttributes,\n };\n};\n\nfunction getSelectableAttributesFromVariants(selectableAttributes: Dictionary<string[]>, variants: DaffConfigurableProductVariant[], code: string) {\n return variants.reduce((selectedAttributes, variant) =>\n isVariantAttributeMarkedAsSelectable(selectedAttributes, variant.appliedAttributes[code])\n ? selectedAttributes\n : [\n ...selectedAttributes,\n variant.appliedAttributes[code],\n ],\n selectableAttributes[code],\n );\n}\n\n/**\n * A function that returns all configurable product selectors.\n * Returns {@link DaffConfigurableProductMemoizedSelectors}.\n *\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\nexport const getDaffConfigurableProductSelectors = (() => {\n let cache;\n return (): DaffConfigurableProductMemoizedSelectors => cache = cache\n ? cache\n : createConfigurableProductSelectors();\n})();\n\nfunction isVariantAvailable(\n appliedAttributes: DaffConfigurableProductEntityAttribute[],\n variant: DaffConfigurableProductVariant,\n): boolean {\n return variant.in_stock &&\n\t\tappliedAttributes.reduce((acc, attribute) =>\n\t\t acc && attribute.value === variant.appliedAttributes[attribute.code],\n\t\ttrue,\n\t\t);\n}\n\nfunction getMinimumPrice(prices: number[]): number {\n return prices.reduce(\n (acc, price) => price < acc ? price : acc,\n prices[0],\n );\n}\n\nfunction getMaximumPrice(prices: number[]): number {\n return prices.reduce(\n (acc, price) => price > acc ? price : acc,\n prices[0],\n );\n}\n\nfunction initializeSelectableAttributes(attributes: DaffConfigurableProductAttribute[]): Dictionary<string[]> {\n return attributes.reduce((acc, attribute) => ({\n ...acc,\n [attribute.code]: [],\n }), {});\n}\n\nfunction isVariantAttributeMarkedAsSelectable(attributeArray: string[], variantValue: string) {\n return attributeArray.indexOf(variantValue) > -1;\n}\n","import {\n createSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductGridReducerState } from '../../reducers/product-grid/product-grid-reducer-state.interface';\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to loading a grid of products.\n */\nexport interface DaffProductGridMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n\t/**\n\t * Selects the redux state for the product grid feature area. Returns {@link DaffProductGridReducerState}.\n\t */\n\tselectProductGridState: MemoizedSelector<DaffProductStateRootSlice<T>, DaffProductGridReducerState<T>>;\n\t/**\n\t * Selects whether any product grid requests are loading.\n\t */\n\tselectProductGridLoadingState: MemoizedSelector<DaffProductStateRootSlice<T>, boolean>;\n}\n\nconst createProductGridSelectors = <T extends DaffProduct>(): DaffProductGridMemoizedSelectors<T> => {\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n\n const selectProductGridState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.productGrid,\n );\n\n const selectProductGridLoadingState = createSelector(\n selectProductGridState,\n (state: DaffProductGridReducerState<T>) => state.loading,\n );\n\n return {\n selectProductGridState,\n selectProductGridLoadingState,\n };\n};\n\n/**\n * A function that returns all selectors related to loading a grid of products.\n * Returns {@link DaffProductGridMemoizedSelectors}.\n */\nexport const getDaffProductGridSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffProductGridMemoizedSelectors<T> => cache = cache\n ? cache\n : createProductGridSelectors<T>();\n})();\n","import {\n createSelector,\n MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffProductReducersState,\n DaffProductStateRootSlice,\n} from '../../reducers/product-reducers-state.interface';\nimport { DaffProductReducerState } from '../../reducers/product/product-reducer-state.interface';\nimport { getDaffProductFeatureSelector } from '../product-feature.selector';\n\n/**\n * An interface for selectors related to the current product page.\n */\nexport interface DaffProductPageMemoizedSelectors<T extends DaffProduct = DaffProduct> {\n\t/**\n\t * Selects the entire state object for the product page feature area.\n\t */\n\tselectCurrentProductState: MemoizedSelector<DaffProductStateRootSlice, DaffProductReducerState>;\n\t/**\n\t * Selects the loading state of the current product.\n\t */\n\tselectCurrentProductLoadingState: MemoizedSelector<DaffProductStateRootSlice, boolean>;\n\t/**\n\t * Selects the id of the current product.\n\t */\n\tselectCurrentProductId: MemoizedSelector<DaffProductStateRootSlice, T['id']>;\n /**\n * Selects the current product, which is the product loaded for a product page.\n */\n\tselectCurrentProduct: MemoizedSelector<DaffProductStateRootSlice, T>;\n}\n\nconst createProductPageSelectors = <T extends DaffProduct = DaffProduct>(): DaffProductPageMemoizedSelectors<T> => {\n\n const {\n selectProductState,\n } = getDaffProductFeatureSelector<T>();\n\n const selectCurrentProductState = createSelector(\n selectProductState,\n (state: DaffProductReducersState<T>) => state.product,\n );\n\n const selectCurrentProductLoadingState = createSelector(\n selectCurrentProductState,\n (state: DaffProductReducerState) => state.loading,\n );\n\n const selectCurrentProductId = createSelector(\n selectCurrentProductState,\n (state: DaffProductReducerState) => state.currentProductId,\n );\n\n const selectCurrentProduct = createSelector(\n selectProductState,\n selectCurrentProductId,\n (state: DaffProductReducersState<T>, id: T['id']) => state.products.entities[id],\n );\n\n return {\n selectCurrentProductState,\n selectCurrentProductLoadingState,\n selectCurrentProductId,\n selectCurrentProduct,\n };\n};\n\n/**\n * A function that returns all selectors related to the product page.\n * Returns {@link DaffProductPageMemoizedSelectors}.\n */\nexport const getDaffProductPageSelectors = (() => {\n let cache;\n return <T extends DaffProduct>(): DaffProductPageMemoizedSelectors<T> => cache = cache\n ? cache\n : createProductPageSelectors<T>();\n})();\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffBestSellersMemoizedSelectors,\n getDaffBestSellersSelectors,\n} from './best-sellers/best-sellers.selectors';\nimport {\n DaffCompositeProductEntitiesMemoizedSelectors,\n getDaffCompositeProductEntitiesSelectors,\n} from './composite-product-entities/composite-product-entities.selectors';\nimport {\n DaffCompositeProductMemoizedSelectors,\n getDaffCompositeProductSelectors,\n} from './composite-product/composite-product.selectors';\nimport {\n DaffConfigurableProductEntitiesMemoizedSelectors,\n getDaffConfigurableProductEntitiesSelectors,\n} from './configurable-product-entities/configurable-product-entities.selectors';\nimport {\n DaffConfigurableProductMemoizedSelectors,\n getDaffConfigurableProductSelectors,\n} from './configurable-product/configurable-product.selectors';\nimport {\n DaffProductEntitiesMemoizedSelectors,\n getDaffProductEntitiesSelectors,\n} from './product-entities/product-entities.selectors';\nimport {\n DaffProductFeatureMemoizedSelector,\n getDaffProductFeatureSelector,\n} from './product-feature.selector';\nimport {\n DaffProductGridMemoizedSelectors,\n getDaffProductGridSelectors,\n} from './product-grid/product-grid.selectors';\nimport {\n DaffProductPageMemoizedSelectors,\n getDaffProductPageSelectors,\n} from './product/product.selectors';\n\n/**\n * An interface for all selectors in the entire product feature area.\n */\nexport interface DaffProductAllSelectors<T extends DaffProduct = DaffProduct> extends\n\tDaffProductPageMemoizedSelectors<T>,\n\tDaffBestSellersMemoizedSelectors<T>,\n\tDaffProductEntitiesMemoizedSelectors<T>,\n\tDaffProductGridMemoizedSelectors<T>,\n\tDaffProductFeatureMemoizedSelector<T>,\n\tDaffConfigurableProductEntitiesMemoizedSelectors,\n\tDaffConfigurableProductMemoizedSelectors,\n\tDaffCompositeProductEntitiesMemoizedSelectors,\n\tDaffCompositeProductMemoizedSelectors { }\n\n/**\n * A function that returns all selectors in the entire product feature area.\n * Returns {@link DaffProductAllSelectors}.\n */\nexport const getDaffProductSelectors = <T extends DaffProduct = DaffProduct>(): DaffProductAllSelectors<T> => ({\n ...getDaffBestSellersSelectors<T>(),\n ...getDaffProductPageSelectors<T>(),\n ...getDaffProductGridSelectors<T>(),\n ...getDaffProductEntitiesSelectors<T>(),\n ...getDaffProductFeatureSelector<T>(),\n ...getDaffConfigurableProductEntitiesSelectors(),\n ...getDaffConfigurableProductSelectors(),\n ...getDaffCompositeProductEntitiesSelectors(),\n ...getDaffCompositeProductSelectors(),\n});\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffStoreFacade } from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\n\n/**\n * A facade for accessing best sellers state from an application component.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffBestSellersFacade<T extends DaffProduct = DaffProduct> implements DaffStoreFacade<Action> {\n /**\n * The loading state for getting best selling products.\n */\n loading$: Observable<boolean>;\n /**\n * Best selling products.\n */\n bestSellers$: Observable<DaffProduct[]>;\n\n constructor(private store: Store<DaffProductStateRootSlice<T>>) {\n const {\n selectBestSellersProducts,\n selectBestSellersLoadingState,\n } = getDaffProductSelectors<T>();\n\n this.loading$ = this.store.pipe(select(selectBestSellersLoadingState));\n this.bestSellers$ = this.store.pipe(select(selectBestSellersProducts));\n }\n\n /**\n * Dispatches an action to the rxjs action stream.\n *\n * @param action\n */\n dispatch(action: Action) {\n this.store.dispatch(action);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffProduct,\n DaffPriceRange,\n DaffCompositeConfigurationItem,\n DaffCompositeProductItemOption,\n DaffCompositeProductItem,\n productPriceRangeHasDiscount,\n productPriceRangeHasPriceRange,\n} from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/public_api';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffCompositeProductFacadeInterface } from './composite-product-facade.interface';\n\n/**\n * A facade for interacting with the composite product state.\n * Exposes many parts of the state for easy access and allows dispatching of actions.\n *\n * @inheritdoc\n * @deprecated import from @daffodil/composite-product/state instead.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCompositeProductFacade<T extends DaffProduct = DaffProduct> implements DaffCompositeProductFacadeInterface {\n\n constructor(private store: Store<DaffProductStateRootSlice<T>>) {}\n\n\tselectors = getDaffProductSelectors<T>();\n\n\thasDiscount = productPriceRangeHasDiscount;\n\n\thasPriceRange = productPriceRangeHasPriceRange;\n\n\tgetRequiredItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductRequiredItemPricesForConfiguration(id, configuration)));\n\t}\n\n\tgetOptionalItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductOptionalItemPricesForConfiguration(id, configuration)));\n\t}\n\n\tgetPricesAsCurrentlyConfigured(id: T['id']): Observable<DaffPriceRange> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductPricesAsCurrentlyConfigured(id)));\n\t}\n\n\tgetAppliedOptions(id: T['id']): Observable<Dictionary<DaffCompositeProductItemOption>> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductAppliedOptions(id)));\n\t}\n\n\tgetDiscountAmount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductDiscountAmount(id)));\n\t}\n\n\tgetDiscountPercent(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectCompositeProductDiscountPercent(id)));\n\t}\n\n\tisItemRequired(id: T['id'], item_id: DaffCompositeProductItem['id']) {\n\t return this.store.pipe(select(this.selectors.selectIsCompositeProductItemRequired(id, item_id)));\n\t}\n\n\tdispatch(action: Action) {\n\t this.store.dispatch(action);\n\t}\n}\n","import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffProduct,\n DaffConfigurableProductVariant,\n} from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffConfigurableProductFacadeInterface } from './configurable-product-facade.interface';\n\n/**\n * A facade for interacting with the configurable product state.\n * Exposes many parts of the state for easy access and allows dispatching of actions.\n *\n * @inheritdoc\n * @deprecated import from @daffodil/configurable-product/state instead.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffConfigurableProductFacade<T extends DaffProduct = DaffProduct> implements DaffConfigurableProductFacadeInterface {\n\n\tselectors = getDaffProductSelectors<T>();\n\n\tconstructor(private store: Store<DaffProductStateRootSlice<T>>) {}\n\n\tgetAllAttributes(id: T['id']): Observable<Dictionary<string[]>> {\n\t return this.store.pipe(select(this.selectors.selectAllConfigurableProductAttributes(id)));\n\t}\n\n\tgetAllVariants(id: T['id']): Observable<DaffConfigurableProductVariant[]> {\n\t return this.store.pipe(select(this.selectors.selectAllConfigurableProductVariants(id)));\n\t}\n\n\tgetAppliedAttributes(id: T['id']): Observable<Dictionary<string>> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductAppliedAttributesAsDictionary(id)));\n\t}\n\n\tgetMinimumPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMinimumPrice(id)));\n\t}\n\n\tgetMaximumPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMaximumPrice(id)));\n\t}\n\n\tgetMinimumDiscountedPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMinimumDiscountedPrice(id)));\n\t}\n\n\tgetMaximumDiscountedPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMaximumDiscountedPrice(id)));\n\t}\n\n\tgetMinimumPercentDiscount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMinimumPercentDiscount(id)));\n\t}\n\n\tgetMaximumPercentDiscount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductMaximumPercentDiscount(id)));\n\t}\n\n\tisPriceRanged(id: T['id']): Observable<boolean> {\n\t return this.store.pipe(select(this.selectors.isConfigurablePriceRanged(id)));\n\t}\n\n\thasDiscount(id: T['id']): Observable<boolean> {\n\t return this.store.pipe(select(this.selectors.selectConfigurableProductHasDiscount(id)));\n\t}\n\n\tgetSelectableAttributes(id: T['id']): Observable<Dictionary<string[]>> {\n\t return this.store.pipe(select(this.selectors.selectSelectableConfigurableProductAttributes(id)));\n\t}\n\n\tgetMatchingVariants(id: T['id']): Observable<DaffConfigurableProductVariant[]> {\n\t return this.store.pipe(select(this.selectors.selectMatchingConfigurableProductVariants(id)));\n\t}\n\n\tdispatch(action: Action) {\n\t this.store.dispatch(action);\n\t}\n}\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffProductFacadeInterface } from './product-facade.interface';\n\n/**\n * A facade for getting state about a particular product.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductFacade<T extends DaffProduct = DaffProduct> implements DaffProductFacadeInterface<T> {\n loading$: Observable<boolean>;\n\n\tprivate selectors = getDaffProductSelectors<T>();\n\n\tconstructor(private store: Store<DaffProductStateRootSlice<T>>) {\n\t this.loading$ = this.store.pipe(select(this.selectors.selectCurrentProductLoadingState));\n\t}\n\n\tgetProduct(id: T['id']): Observable<T> {\n\t return this.store.pipe(select(this.selectors.selectProduct(id)));\n\t}\n\n\tgetPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectProductPrice(id)));\n\t}\n\n\thasDiscount(id: T['id']): Observable<boolean> {\n\t return this.store.pipe(select(this.selectors.selectProductHasDiscount(id)));\n\t}\n\n\tgetDiscountAmount(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectProductDiscountAmount(id)));\n\t}\n\n\tgetDiscountedPrice(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectProductDiscountedPrice(id)));\n\t}\n\n\tgetDiscountPercent(id: T['id']): Observable<number> {\n\t return this.store.pipe(select(this.selectors.selectProductDiscountPercent(id)));\n\t}\n\n\tisOutOfStock(id: T['id']): Observable<boolean> {\n\t return this.store.pipe(select(this.selectors.selectIsProductOutOfStock(id)));\n\t}\n\n\tdispatch(action: Action) {\n\t this.store.dispatch(action);\n\t}\n}\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffProductPageFacadeInterface } from './facade.interface';\n\n/**\n * A facade for getting state about a particular product.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductPageFacade<T extends DaffProduct = DaffProduct> implements DaffProductPageFacadeInterface<T> {\n loading$: Observable<boolean>;\n product$: Observable<T>;\n\n\tprivate selectors = getDaffProductSelectors<T>();\n\n\tconstructor(private store: Store<DaffProductStateRootSlice<T>>) {\n\t this.loading$ = this.store.pipe(select(this.selectors.selectCurrentProductLoadingState));\n\t this.product$ = this.store.pipe(select(this.selectors.selectCurrentProduct));\n\t}\n\n\tdispatch(action: Action) {\n\t this.store.dispatch(action);\n\t}\n}\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductStateRootSlice } from '../../reducers/product-reducers-state.interface';\nimport { getDaffProductSelectors } from '../../selectors/public_api';\nimport { DaffProductGridFacadeInterface } from './product-grid-facade.interface';\n\n/**\n * A facade for accessing state for a list of products from an application component.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffProductGridFacade<T extends DaffProduct = DaffProduct> implements DaffProductGridFacadeInterface<T> {\n loading$: Observable<boolean>;\n products$: Observable<T[]>;\n\n constructor(private store: Store<DaffProductStateRootSlice<T>>) {\n const {\n selectProductGridLoadingState,\n selectAllProducts,\n } = getDaffProductSelectors<T>();\n\n this.loading$ = this.store.pipe(select(selectProductGridLoadingState));\n this.products$ = this.store.pipe(select(selectAllProducts));\n }\n\n dispatch(action: Action) {\n this.store.dispatch(action);\n }\n}\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffBestSellersActionTypes,\n DaffBestSellersActions,\n} from '../../actions/best-sellers.actions';\nimport { DaffBestSellersReducerState } from './best-sellers-reducer-state.interface';\n\nexport const initialState: DaffBestSellersReducerState = {\n productIds: [],\n loading: false,\n errors: [],\n};\n\nexport const resetState: DaffBestSellersReducerState = Object.assign({}, initialState);\n\n/**\n * The default best sellers reducer provided by Daffodil.\n */\nexport function daffBestSellersReducer<T extends DaffProduct>(state = initialState, action: DaffBestSellersActions<T>): DaffBestSellersReducerState {\n switch (action.type) {\n case DaffBestSellersActionTypes.BestSellersLoadAction:\n return { ...state, loading: true };\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return { ...state, loading: false, productIds: getIds<T>(action.payload) };\n case DaffBestSellersActionTypes.BestSellersLoadFailureAction:\n return { ...state,\n loading: false,\n errors: state.errors.concat(new Array(action.payload)) };\n case DaffBestSellersActionTypes.BestSellersResetAction:\n return {\n ...resetState,\n };\n default:\n return state;\n }\n}\n\nfunction getIds<T extends DaffProduct>(products: T[]): T['id'][] {\n const ids: T['id'][] = new Array();\n\n products.forEach(product => {\n ids.push(product.id);\n });\n\n return ids;\n}\n","import { EntityState } from '@ngrx/entity';\n\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeConfigurationItem,\n DaffProduct,\n DaffProductTypeEnum,\n} from '@daffodil/product';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridActions,\n} from '../../actions/product-grid.actions';\nimport {\n DaffProductPageActions,\n DaffProductPageActionTypes,\n} from '../../actions/product-page.actions';\nimport {\n DaffProductActionTypes,\n DaffProductActions,\n DaffBestSellersActionTypes,\n DaffBestSellersActions,\n DaffCompositeProductActions,\n DaffCompositeProductActionTypes,\n} from '../../actions/public_api';\nimport { daffCompositeProductAppliedOptionsEntitiesAdapter } from './composite-product-entities-reducer-adapter';\nimport { DaffCompositeProductEntity } from './composite-product-entity';\n\n/**\n * Reducer function that catches actions and changes/overwrites composite product entities state.\n *\n * @param state current State of the redux store\n * @param action ProductGrid, BestSellers, Product, or Composite Product actions\n * @returns Product entities state\n *\n * @deprecated import from @daffodil/composite-product/state instead.\n */\nexport function daffCompositeProductEntitiesReducer<T extends DaffProduct, V extends DaffCompositeProduct>(\n state = daffCompositeProductAppliedOptionsEntitiesAdapter().getInitialState(),\n action: DaffProductGridActions<T> | DaffBestSellersActions<T> | DaffProductActions<T> | DaffProductPageActions<T> | DaffCompositeProductActions<V>): EntityState<DaffCompositeProductEntity> {\n const adapter = daffCompositeProductAppliedOptionsEntitiesAdapter();\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return adapter.upsertMany(\n mapOptionsEntities(<V[]><unknown>action.payload),\n state,\n );\n case DaffProductActionTypes.ProductLoadSuccessAction:\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return adapter.upsertMany(\n mapOptionsEntities(<V[]><unknown>action.payload.products),\n state,\n );\n case DaffCompositeProductActionTypes.CompositeProductApplyOptionAction:\n return adapter.upsertOne(\n {\n id: action.id,\n items: {\n ...state.entities[action.id].items,\n [action.itemId]: {\n value: action.optionId,\n qty: action.qty ? action.qty : 1,\n },\n },\n },\n state,\n );\n default:\n return state;\n }\n}\n\nfunction mapOptionsEntities(products: DaffCompositeProduct[]): DaffCompositeProductEntity[] {\n return products.filter(product => product.type === DaffProductTypeEnum.Composite)\n .map(product => buildCompositeProductAppliedOptionsEntity(product));\n}\n\nfunction buildCompositeProductAppliedOptionsEntity(product: DaffCompositeProduct): DaffCompositeProductEntity {\n return {\n id: product.id,\n items: product.items.reduce((acc, item) => ({\n ...acc,\n [item.id]: getDefaultOption(item),\n }), {}),\n };\n}\n\n/**\n * Sets the default item option to the specified default option if it is in stock.\n * Does not set a default option if a default is not specified.\n * Does not set a default option but does set a default qty if the default is out of stock.\n *\n * @param item a DaffCompositeProductItem\n */\nfunction getDefaultOption(item: DaffCompositeProductItem): DaffCompositeConfigurationItem {\n const defaultOptionIndex = item.options.findIndex(option => option.is_default);\n\n if(defaultOptionIndex > -1) {\n return {\n value: item.options[defaultOptionIndex].in_stock ? item.options[defaultOptionIndex].id : null,\n qty: item.options[defaultOptionIndex].quantity,\n };\n } else {\n return { value: null, qty: null };\n }\n}\n","import { EntityState } from '@ngrx/entity';\n\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n DaffConfigurableProduct,\n} from '@daffodil/product';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridActions,\n} from '../../actions/product-grid.actions';\nimport {\n DaffProductPageActions,\n DaffProductPageActionTypes,\n} from '../../actions/product-page.actions';\nimport {\n DaffProductActionTypes,\n DaffProductActions,\n DaffBestSellersActionTypes,\n DaffBestSellersActions,\n DaffConfigurableProductActions,\n DaffConfigurableProductActionTypes,\n} from '../../actions/public_api';\nimport { daffConfigurableProductAppliedAttributesEntitiesAdapter } from './configurable-product-entities-reducer-adapter';\nimport {\n DaffConfigurableProductEntity,\n DaffConfigurableProductEntityAttribute,\n} from './configurable-product-entity';\n\n/**\n * Reducer function that catches actions and changes/overwrites product entities state.\n *\n * @param state current State of the redux store\n * @param action ProductGrid, BestSellers, Product, or Configurable Product actions\n * @returns Product entities state\n */\nexport function daffConfigurableProductEntitiesReducer<T extends DaffProduct, V extends DaffConfigurableProduct>(\n state = daffConfigurableProductAppliedAttributesEntitiesAdapter().getInitialState(),\n action: DaffProductGridActions<T> | DaffBestSellersActions<T> | DaffProductActions<T> | DaffProductPageActions<T> | DaffConfigurableProductActions<V>): EntityState<DaffConfigurableProductEntity> {\n const adapter = daffConfigurableProductAppliedAttributesEntitiesAdapter();\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return adapter.upsertMany(\n mapEntities(<V[]><unknown>action.payload),\n state,\n );\n case DaffProductActionTypes.ProductLoadSuccessAction:\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return adapter.upsertMany(\n mapEntities(<V[]><unknown>action.payload.products),\n state,\n );\n case DaffConfigurableProductActionTypes.ConfigurableProductApplyAttributeAction:\n return adapter.upsertOne(\n {\n id: action.id,\n attributes: applyAttribute(state.entities[action.id].attributes, action.attributeId, action.attributeValue),\n },\n state,\n );\n case DaffConfigurableProductActionTypes.ConfigurableProductRemoveAttributeAction:\n return adapter.upsertOne(\n {\n id: action.id,\n attributes: removeAttribute(state.entities[action.id].attributes, action.attributeId),\n },\n state,\n );\n case DaffConfigurableProductActionTypes.ConfigurableProductToggleAttributeAction:\n return adapter.upsertOne(\n {\n id: action.id,\n attributes: isAttributeSelected(state.entities[action.id].attributes, action.attributeId, action.attributeValue) ?\n removeAttribute(state.entities[action.id].attributes, action.attributeId) :\n applyAttribute(state.entities[action.id].attributes, action.attributeId, action.attributeValue),\n },\n state,\n );\n default:\n return state;\n }\n}\n\nfunction mapEntities(products: DaffConfigurableProduct[]): DaffConfigurableProductEntity[] {\n return products.filter(product => product.type === DaffProductTypeEnum.Configurable)\n .map(product => buildConfigurableProductAppliedAttributesEntity(product));\n}\n\nfunction buildConfigurableProductAppliedAttributesEntity(product: DaffProduct): DaffConfigurableProductEntity {\n return {\n id: product.id,\n attributes: [],\n };\n}\n\nfunction applyAttribute(currentAttributes: DaffConfigurableProductEntityAttribute[], appliedAttributeCode: string, appliedAttributeValue: string): DaffConfigurableProductEntityAttribute[] {\n const attributeIndex = currentAttributes.findIndex(attribute => attribute.code === appliedAttributeCode);\n const retainedAttributes = attributeIndex > -1 ? currentAttributes.slice(0, attributeIndex) : currentAttributes;\n\n return [\n ...retainedAttributes,\n {\n code: appliedAttributeCode,\n value: appliedAttributeValue,\n },\n ];\n}\n\nfunction removeAttribute(currentAttributes: DaffConfigurableProductEntityAttribute[], appliedAttributeCode: string): DaffConfigurableProductEntityAttribute[] {\n const index = currentAttributes.findIndex(attribute => attribute.code === appliedAttributeCode);\n\n return index > -1 ? currentAttributes.slice(0, index) : currentAttributes;\n}\n\nfunction isAttributeSelected(currentAttributes: DaffConfigurableProductEntityAttribute[], attributeCode: string, attributeValue: string): boolean {\n const index = currentAttributes.findIndex(attribute => attribute.code === attributeCode);\n\n return index > -1 && currentAttributes[index].value === attributeValue;\n}\n","import { EntityState } from '@ngrx/entity';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridActions,\n DaffProductActionTypes,\n DaffProductActions,\n DaffBestSellersActionTypes,\n DaffBestSellersActions,\n DaffProductPageActions,\n DaffProductPageActionTypes,\n} from '../../actions/public_api';\nimport { daffProductEntitiesAdapter } from './product-entities-reducer-adapter';\n\n/**\n * Reducer function that catches actions and changes/overwrites product entities state.\n *\n * @param state current State of the redux store\n * @param action ProductGrid, BestSellers, or Product actions\n * @returns Product entities state\n */\nexport function daffProductEntitiesReducer<T extends DaffProduct>(\n state = daffProductEntitiesAdapter<T>().getInitialState(),\n action: DaffProductGridActions<T> | DaffBestSellersActions<T> | DaffProductActions<T> | DaffProductPageActions<T>): EntityState<T> {\n const adapter = daffProductEntitiesAdapter<T>();\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n return adapter.upsertMany(action.payload, state);\n case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:\n return adapter.upsertMany(action.payload, state);\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n case DaffProductActionTypes.ProductLoadSuccessAction:\n return adapter.upsertMany(\n action.payload.products,\n state,\n );\n case DaffProductGridActionTypes.ProductGridResetAction:\n return adapter.removeAll(state);\n default:\n return state;\n }\n}\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffProductGridActionTypes,\n DaffProductGridActions,\n} from '../../actions/public_api';\nimport { DaffProductGridReducerState } from './product-grid-reducer-state.interface';\n\n/**\n * Initial values of the product grid state.\n */\nexport const initialState: DaffProductGridReducerState<any> = {\n products: [],\n loading: false,\n errors: [],\n};\n\n/**\n * Reducer function that catches actions and changes/overwrites product grid state.\n *\n * @param state current State of the redux store\n * @param action a product grid action\n * @returns Product grid state\n */\nexport function daffProductGridReducer<T extends DaffProduct>(state = initialState, action: DaffProductGridActions<T>): DaffProductGridReducerState<T> {\n switch (action.type) {\n case DaffProductGridActionTypes.ProductGridLoadAction:\n return { ...state, loading: true };\n case DaffProductGridActionTypes.ProductGridLoadSuccessAction:\n return { ...state, loading: false };\n case DaffProductGridActionTypes.ProductGridLoadFailureAction:\n return { ...state,\n loading: false,\n errors: state.errors.concat(new Array(action.payload)) };\n default:\n return state;\n }\n}\n","import { DaffProduct } from '@daffodil/product';\n\nimport {\n DaffProductPageActions,\n DaffProductPageActionTypes,\n} from '../../actions/public_api';\nimport { DaffProductReducerState } from './product-reducer-state.interface';\n\n/**\n * Initial values of the product state.\n */\nexport const initialState: DaffProductReducerState = {\n currentProductId: null,\n qty: 1,\n loading: false,\n errors: [],\n};\n\n/**\n * Reducer function that catches actions and changes/overwrites product state.\n *\n * @param state current State of the redux store\n * @param action a product action\n * @returns product state\n */\nexport function daffProductReducer<T extends DaffProduct>(state = initialState, action: DaffProductPageActions<T>): DaffProductReducerState {\n switch (action.type) {\n case DaffProductPageActionTypes.ProductPageLoadAction:\n case DaffProductPageActionTypes.ProductPageLoadByUrlAction:\n return { ...state, loading: true, currentProductId: null };\n case DaffProductPageActionTypes.ProductPageLoadSuccessAction:\n return { ...state, loading: false, currentProductId: action.payload.id };\n case DaffProductPageActionTypes.ProductPageLoadFailureAction:\n return { ...state,\n loading: false,\n errors: state.errors.concat(new Array(action.payload)) };\n case DaffProductPageActionTypes.UpdateQtyAction:\n return { ...state, qty: action.payload };\n default:\n return state;\n }\n}\n","import { daffBestSellersReducer } from './best-sellers/best-sellers.reducer';\nimport { daffCompositeProductEntitiesReducer } from './composite-product-entities/composite-product-entities.reducer';\nimport { daffConfigurableProductEntitiesReducer } from './configurable-product-entities/configurable-product-entities.reducer';\nimport { daffProductEntitiesReducer } from './product-entities/product-entities.reducer';\nimport { daffProductGridReducer } from './product-grid/product-grid.reducer';\nimport { daffProductReducer } from './product/product.reducer';\n\n/**\n * Returns state values from all product related reducers.\n */\nexport const daffProductReducers = {\n products: daffProductEntitiesReducer,\n productGrid: daffProductGridReducer,\n product: daffProductReducer,\n bestSellers: daffBestSellersReducer,\n configurableProductAttributes: daffConfigurableProductEntitiesReducer,\n compositeProductOptions: daffCompositeProductEntitiesReducer,\n};\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\nimport { MetaReducer } from '@ngrx/store';\n\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductReducersState } from '../product-reducers-state.interface';\n\n\n/**\n * A token to hold the injectable extra meta-reducers.\n *\n * Prefer using {@link daffProductProvideMetaReducers}.\n */\nexport const DAFF_PRODUCT_META_REDUCERS = new InjectionToken<MetaReducer<DaffProductReducersState>[]>(\n 'DAFF_PRODUCT_META_REDUCERS',\n { factory: () => []},\n);\n\n/**\n * Provides additional meta-reducers that run after the standard Daffodil cart meta-reducers.\n *\n * ```ts\n * providers: [\n * ...daffProductProvideMetaReducers(\n * myMetaReducer1,\n * myMetaReducer2\n * )\n * ]\n * ```\n */\nexport function daffProductProvideMetaReducers<T extends DaffProduct = DaffProduct>(\n ...metaReducers: MetaReducer<DaffProductReducersState<T>>[]\n): Provider[] {\n return metaReducers.map(metaReducer => ({\n provide: DAFF_PRODUCT_META_REDUCERS,\n useValue: metaReducer,\n multi: true,\n }));\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n Effect,\n ofType,\n} from '@ngrx/effects';\nimport {\n of,\n Observable,\n} from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport {\n DaffProduct,\n DAFF_PRODUCT_ERROR_MATCHER,\n} from '@daffodil/product';\nimport {\n DaffProductDriver,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n DaffProductPageActionTypes,\n DaffProductPageLoad,\n DaffProductPageLoadFailure,\n DaffProductPageLoadSuccess,\n DaffProductPageLoadByUrl,\n} from '../actions/product-page.actions';\n\n/**\n * Effects for handling product actions and for triggering corresponding service requests.\n *\n * @param action$ - Redux action object\n * @param driver - A product service driver\n */\n@Injectable()\nexport class DaffProductPageEffects<T extends DaffProduct> {\n\n constructor(\n private actions$: Actions,\n @Inject(DaffProductDriver) private driver: DaffProductServiceInterface<T>,\n\t\t@Inject(DAFF_PRODUCT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n /**\n * Handles ProductPageLoadAction by making a service call for a product and returning a success or\n * failure action to the action stream.\n *\n * @returns An Observable of a ProductLoadAction\n */\n @Effect()\n load$: Observable<any> = this.actions$.pipe(\n ofType(DaffProductPageActionTypes.ProductPageLoadAction),\n switchMap((action: DaffProductPageLoad) =>\n this.driver.get(action.payload)\n .pipe(\n map((resp) => new DaffProductPageLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffProductPageLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n\n @Effect()\n loadByUrl$: Observable<any> = this.actions$.pipe(\n ofType(DaffProductPageActionTypes.ProductPageLoadByUrlAction),\n switchMap((action: DaffProductPageLoadByUrl<T>) =>\n this.driver.getByUrl(action.payload)\n .pipe(\n map((resp) => new DaffProductPageLoadSuccess(resp)),\n catchError((error: DaffError) => of(new DaffProductPageLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n );\n}\n","import {\n inject,\n InjectionToken,\n} from '@angular/core';\nimport { StoreConfig } from '@ngrx/store';\n\n// workaround https://github.com/graycoreio/daffodil/issues/1667\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductReducersState } from '../product-reducers-state.interface';\nimport { DAFF_PRODUCT_META_REDUCERS } from './meta.token';\n\n/**\n * An internal token to hold the Daffodil product feature store config.\n *\n * @docs-private\n */\nexport const DAFF_PRODUCT_STORE_CONFIG = new InjectionToken<StoreConfig<DaffProductReducersState>>(\n 'DAFF_PRODUCT_STORE_CONFIG',\n {\n factory: () => ({\n metaReducers: inject(DAFF_PRODUCT_META_REDUCERS),\n }),\n },\n);\n","import { NgModule } from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\nimport { StoreModule } from '@ngrx/store';\n\nimport { DaffBestSellersEffects } from './effects/best-seller.effects';\nimport { DaffProductGridEffects } from './effects/product-grid.effects';\nimport { DaffProductPageEffects } from './effects/product-page.effects';\nimport { DaffProductEffects } from './effects/product.effects';\nimport { DAFF_PRODUCT_STORE_CONFIG } from './reducers/injection-tokens/config.token';\nimport { daffProductReducers } from './reducers/product-reducers';\nimport { DAFF_PRODUCT_STORE_FEATURE_KEY } from './reducers/public_api';\n\n/**\n * A module that provides the default reducers and effects for the product redux state.\n */\n@NgModule({\n imports: [\n StoreModule.forFeature(DAFF_PRODUCT_STORE_FEATURE_KEY, daffProductReducers, DAFF_PRODUCT_STORE_CONFIG),\n EffectsModule.forFeature([\n DaffProductGridEffects,\n DaffProductEffects,\n DaffProductPageEffects,\n DaffBestSellersEffects,\n ]),\n ],\n})\nexport class DaffProductStateModule { }\n"]}