@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
@@ -2,480 +2,49 @@ import { InjectionToken } from '@angular/core';
2
2
  import { daffTransformErrorToStateError } from '@daffodil/core/state';
3
3
 
4
4
  /**
5
- * @fileoverview added by tsickle
6
- * Generated from: models/composite-configuration-item.ts
7
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
8
- */
9
- /**
10
- * An object to denote the configuration chosen for a particular {\@link DaffCompositeProductItem}.
11
- *
12
- * @deprecated import from \@daffodil/composite-product instead.
13
- * @record
14
- */
15
- function DaffCompositeConfigurationItem() { }
16
- if (false) {
17
- /**
18
- * The quantity chosen for the configuration of the {\@link DaffCompositeProductItem}.
19
- * @type {?|undefined}
20
- */
21
- DaffCompositeConfigurationItem.prototype.qty;
22
- /**
23
- * The value of the {\@link DaffCompositeProductItemOption} chosen for the configuration of the {\@link DaffCompositeProductItem}.
24
- * @type {?|undefined}
25
- */
26
- DaffCompositeConfigurationItem.prototype.value;
27
- }
28
-
29
- /**
30
- * @fileoverview added by tsickle
31
- * Generated from: models/composite-product.ts
32
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
33
- */
34
- /**
35
- * A composite product is a group of products sold together. It includes one primary product and many accessory "items".
36
- * The composite product items are additional products the customer might want to purchase with the primary product,
37
- * and each item has a number of options from which the user can choose. Composite product items can be optional or required.
38
- * For example, a toolbox bundle might have a primary product of the toolbox. The items could be a hammer and a screw driver,
39
- * and the options for these items could be two different hammers and two different screwdrivers between which the customer could choose.
40
- * All of these items could have different prices/discounts/etc which would cause the composite products to have ranged prices.
41
- *
42
- * @deprecated import from \@daffodil/composite-product instead.
43
- * @record
44
- */
45
- function DaffCompositeProduct() { }
46
- if (false) {
47
- /**
48
- * The available items for the composite product.
49
- * @type {?}
50
- */
51
- DaffCompositeProduct.prototype.items;
52
- }
53
-
54
- /**
55
- * @fileoverview added by tsickle
56
- * Generated from: models/composite-product-item.ts
57
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
58
- */
59
- /** @enum {string} */
60
- const DaffCompositeProductItemInputEnum = {
61
- select: "select",
62
- radio: "radio",
63
- };
64
- /**
65
- * The composite product item describes one set of product options that the user can add to the composite product.
66
- * A composite product item can be required or optional. If it is required, an option _must_ be chosen in order to add the product to the cart.
67
- * If the item is optional, the product can be added to the cart without an option having been chosen.
68
- * For example, if a composite product is a toolbox bundle, a composite product item might be a screw driver, and the options contained in that
69
- * item might be a phillips head and a flathead. The customer could choose to add either a phillips head or a flathead to the
70
- * composite product, or neither if the item is optional.
71
- *
72
- * @deprecated import from \@daffodil/composite-product instead.
73
- * @record
74
- */
75
- function DaffCompositeProductItem() { }
76
- if (false) {
77
- /**
78
- * Whether the item is required or optional.
79
- * @type {?}
80
- */
81
- DaffCompositeProductItem.prototype.required;
82
- /**
83
- * The title label for the item.
84
- * @type {?}
85
- */
86
- DaffCompositeProductItem.prototype.title;
87
- /**
88
- * Describes how the item should be displayed.
89
- * @type {?}
90
- */
91
- DaffCompositeProductItem.prototype.input_type;
92
- /**
93
- * The options that may be chosen for the item.
94
- * @type {?}
95
- */
96
- DaffCompositeProductItem.prototype.options;
97
- }
98
- /**
99
- * The composite product item option is a DaffProduct that can be added to a composite product.
5
+ * An enum for whether a composite product item should be displayed as a radio or select input.
100
6
  *
101
- * @deprecated import from \@daffodil/composite-product instead.
102
- * @record
7
+ * @deprecated import from @daffodil/composite-product instead.
103
8
  */
104
- function DaffCompositeProductItemOption() { }
105
- if (false) {
106
- /**
107
- * Whether the option is the default option for its parent {\@link DaffCompositeProductItem}.
108
- * @type {?}
109
- */
110
- DaffCompositeProductItemOption.prototype.is_default;
111
- /**
112
- * The quantity chosen for the option.
113
- * @type {?}
114
- */
115
- DaffCompositeProductItemOption.prototype.quantity;
116
- }
9
+ var DaffCompositeProductItemInputEnum;
10
+ (function (DaffCompositeProductItemInputEnum) {
11
+ DaffCompositeProductItemInputEnum["select"] = "select";
12
+ DaffCompositeProductItemInputEnum["radio"] = "radio";
13
+ })(DaffCompositeProductItemInputEnum || (DaffCompositeProductItemInputEnum = {}));
117
14
 
118
15
  /**
119
- * @fileoverview added by tsickle
120
- * Generated from: models/configurable-product.ts
121
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
122
- */
123
- /**
124
- * A configurable product is a product with configurable attributes. The price of a configurable product may change based on
125
- * the attributes chosen, so a configurable product can have a price range. An example of a configurable product is a T-shirt.
126
- * @record
127
- */
128
- function DaffConfigurableProduct() { }
129
- if (false) {
130
- /**
131
- * The configurable attributes available.
132
- * @type {?}
133
- */
134
- DaffConfigurableProduct.prototype.configurableAttributes;
135
- /**
136
- * The possible different variants of the product.
137
- * @type {?}
138
- */
139
- DaffConfigurableProduct.prototype.variants;
140
- }
141
- /**
142
- * An attribute of the configurable product that the customer must choose to add the configurable product to the cart.
143
- * An example of an attribute would be size for clothing.
144
- * @record
145
- */
146
- function DaffConfigurableProductAttribute() { }
147
- if (false) {
148
- /**
149
- * The identifier for the attribute type.
150
- * @type {?}
151
- */
152
- DaffConfigurableProductAttribute.prototype.code;
153
- /**
154
- * A label for the attribute type.
155
- * @type {?}
156
- */
157
- DaffConfigurableProductAttribute.prototype.label;
158
- /**
159
- * The possible attribute options that a customer can choose.
160
- * @type {?}
161
- */
162
- DaffConfigurableProductAttribute.prototype.values;
163
- }
164
- /**
165
- * A variant is one version of the configurable product with all attributes chosen. Variants exist because not all versions of every configuration of
166
- * the product might be in stock. For example, a shirt might have a medium, red shirt and a small,
167
- * green shirt in stock, but no small, red shirts. In this case there would be two variants (mediumRed, smallGreen) rather than the maximum 4 variants
168
- * (smallRed, mediumRed, smallGreen, mediumGreen). This ensures the customer can't add a configurable product to the cart that is not
169
- * in stock. However, variants don't usually need to be considered by the frontend dev, because daffodil abstacts away the concept of variants into
170
- * an "available attributes" selector.
171
- * @record
172
- */
173
- function DaffConfigurableProductVariant() { }
174
- if (false) {
175
- /**
176
- * The attributes applied to the product to form the product variant.
177
- * @type {?}
178
- */
179
- DaffConfigurableProductVariant.prototype.appliedAttributes;
180
- /**
181
- * The price of the variant.
182
- * @type {?}
183
- */
184
- DaffConfigurableProductVariant.prototype.price;
185
- /**
186
- * The total discount for the variant.
187
- * @type {?}
188
- */
189
- DaffConfigurableProductVariant.prototype.discount;
190
- /**
191
- * An image of the product variant.
192
- * @type {?|undefined}
193
- */
194
- DaffConfigurableProductVariant.prototype.image;
195
- /**
196
- * Whether or not the variant is in stock.
197
- * @type {?}
198
- */
199
- DaffConfigurableProductVariant.prototype.in_stock;
200
- }
201
- /**
202
- * The applied attributes for a particular product variant.
203
- * @record
204
- */
205
- function DaffProductVariantAttributesDictionary() { }
206
- /**
207
- * The configurable option of a configurable product attribute. For example, this could be "blue" for the attribute "color" for a T-shirt.
208
- * @record
209
- */
210
- function DaffConfigurableProductOptionValue() { }
211
- if (false) {
212
- /**
213
- * The attribute option value.
214
- * @type {?}
215
- */
216
- DaffConfigurableProductOptionValue.prototype.value;
217
- /**
218
- * The attribute option label.
219
- * @type {?}
220
- */
221
- DaffConfigurableProductOptionValue.prototype.label;
222
- /**
223
- * An option for displaying a hex color. Can be used for product color attributes.
224
- * @type {?|undefined}
225
- */
226
- DaffConfigurableProductOptionValue.prototype.swatch;
227
- }
228
- /**
229
- * An optional field for the hex color code for DaffConfigurableProductOptionValues that need it.
230
- * @record
16
+ * The possible product types.
231
17
  */
232
- function DaffSwatchOption() { }
233
- if (false) {
234
- /**
235
- * A hex color value.
236
- * @type {?}
237
- */
238
- DaffSwatchOption.prototype.value;
239
- /** @type {?|undefined} */
240
- DaffSwatchOption.prototype.thumbnail;
241
- }
18
+ var DaffProductTypeEnum;
19
+ (function (DaffProductTypeEnum) {
20
+ DaffProductTypeEnum["Simple"] = "simple";
21
+ DaffProductTypeEnum["Composite"] = "composite";
22
+ DaffProductTypeEnum["Configurable"] = "configurable";
23
+ })(DaffProductTypeEnum || (DaffProductTypeEnum = {}));
242
24
 
243
- /**
244
- * @fileoverview added by tsickle
245
- * Generated from: models/prices.ts
246
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
247
- */
248
- /**
249
- * A model for product prices that holds discounts, discounted price, and original price for the associated product.
250
- * @record
251
- */
252
- function DaffProductPrices() { }
253
- if (false) {
254
- /**
255
- * The discounted price of the product.
256
- * @type {?}
257
- */
258
- DaffProductPrices.prototype.discountedPrice;
259
- /**
260
- * The discount of the product.
261
- * @type {?}
262
- */
263
- DaffProductPrices.prototype.discount;
264
- /**
265
- * The price of the product before discounts.
266
- * @type {?}
267
- */
268
- DaffProductPrices.prototype.originalPrice;
269
- }
270
- /**
271
- * A ranged price for products that could have more than one possible price, depending on the configurations.
272
- * @record
273
- */
274
- function DaffPriceRange() { }
275
- if (false) {
276
- /**
277
- * The maximum prices of the product. Includes discounts, the maximum discounted price, and the maximum original price.
278
- * @type {?}
279
- */
280
- DaffPriceRange.prototype.maxPrice;
281
- /**
282
- * The minimum prices of the product. Includes discounts, the minimum discounted price, and the minimum original price.
283
- * @type {?}
284
- */
285
- DaffPriceRange.prototype.minPrice;
286
- }
287
-
288
- /**
289
- * @fileoverview added by tsickle
290
- * Generated from: models/product.ts
291
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
292
- */
293
- /** @enum {string} */
294
- const DaffProductTypeEnum = {
295
- Simple: "simple",
296
- Composite: "composite",
297
- Configurable: "configurable",
298
- };
299
- /**
300
- * An interface for a product usable by the \@daffodil/product library.
301
- * @record
302
- */
303
- function DaffProduct() { }
304
- if (false) {
305
- /**
306
- * The type of product.
307
- * @type {?}
308
- */
309
- DaffProduct.prototype.type;
310
- /**
311
- * The product name.
312
- * @type {?}
313
- */
314
- DaffProduct.prototype.name;
315
- /**
316
- * A smaller image to concisely visualize the product.
317
- * @type {?}
318
- */
319
- DaffProduct.prototype.thumbnail;
320
- /**
321
- * An array of images for the product.
322
- * @type {?}
323
- */
324
- DaffProduct.prototype.images;
325
- /**
326
- * A list of related products.
327
- * @type {?|undefined}
328
- */
329
- DaffProduct.prototype.related;
330
- /**
331
- * A list of upsell productss.
332
- * @type {?|undefined}
333
- */
334
- DaffProduct.prototype.upsell;
335
- /**
336
- * The price of the product.
337
- * @type {?|undefined}
338
- */
339
- DaffProduct.prototype.price;
340
- /**
341
- * The total discounts associated with this product.
342
- * @type {?|undefined}
343
- */
344
- DaffProduct.prototype.discount;
345
- /**
346
- * Whether or not the product is in stock.
347
- * @type {?|undefined}
348
- */
349
- DaffProduct.prototype.in_stock;
350
- /**
351
- * The product brand.
352
- * @type {?|undefined}
353
- */
354
- DaffProduct.prototype.brand;
355
- /**
356
- * Describes the product.
357
- * @type {?|undefined}
358
- */
359
- DaffProduct.prototype.description;
360
- /**
361
- * A shorter description of the product.
362
- * @type {?|undefined}
363
- */
364
- DaffProduct.prototype.short_description;
365
- /**
366
- * A title for the product to display in the browser tab title.
367
- * @type {?|undefined}
368
- */
369
- DaffProduct.prototype.meta_title;
370
- /**
371
- * A description of the product for usage in search engine results.
372
- * @type {?|undefined}
373
- */
374
- DaffProduct.prototype.meta_description;
375
- }
376
- /**
377
- * The discount for a product.
378
- * @record
379
- */
380
- function DaffProductDiscount() { }
381
- if (false) {
382
- /**
383
- * The discount represented as some amount of currency.
384
- * @type {?}
385
- */
386
- DaffProductDiscount.prototype.amount;
387
- /**
388
- * The discount represented as a percent of the original product price.
389
- * @type {?}
390
- */
391
- DaffProductDiscount.prototype.percent;
392
- }
393
-
394
- /**
395
- * @fileoverview added by tsickle
396
- * Generated from: models/product-image.ts
397
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
398
- */
399
- /**
400
- * Interface for an image on a DaffProduct.
401
- * @record
402
- */
403
- function DaffProductImage() { }
404
- if (false) {
405
- /**
406
- * A label describing the image.
407
- * @type {?}
408
- */
409
- DaffProductImage.prototype.label;
410
- }
411
-
412
- /**
413
- * @fileoverview added by tsickle
414
- * Generated from: helpers.ts
415
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
416
- */
417
25
  /**
418
26
  * Returns whether a DaffPriceRange has a discount.
419
27
  *
420
- * \@param priceRange a DaffPriceRange
421
- * @type {?}
28
+ * @param priceRange a DaffPriceRange
422
29
  */
423
- const productPriceRangeHasDiscount = (/**
424
- * @param {?} priceRange
425
- * @return {?}
426
- */
427
- (priceRange) => priceRange.minPrice.originalPrice !== priceRange.minPrice.discountedPrice ||
428
- priceRange.maxPrice.originalPrice !== priceRange.maxPrice.discountedPrice);
30
+ const productPriceRangeHasDiscount = (priceRange) => priceRange.minPrice.originalPrice !== priceRange.minPrice.discountedPrice ||
31
+ priceRange.maxPrice.originalPrice !== priceRange.maxPrice.discountedPrice;
429
32
  /**
430
33
  * Returns whether the min and max prices of a DaffPriceRange are different.
431
34
  *
432
- * \@param priceRange a DaffPriceRange
433
- * @type {?}
434
- */
435
- const productPriceRangeHasPriceRange = (/**
436
- * @param {?} priceRange
437
- * @return {?}
35
+ * @param priceRange a DaffPriceRange
438
36
  */
439
- (priceRange) => priceRange.minPrice.originalPrice !== priceRange.maxPrice.originalPrice ||
440
- priceRange.minPrice.discountedPrice !== priceRange.maxPrice.discountedPrice);
37
+ const productPriceRangeHasPriceRange = (priceRange) => priceRange.minPrice.originalPrice !== priceRange.maxPrice.originalPrice ||
38
+ priceRange.minPrice.discountedPrice !== priceRange.maxPrice.discountedPrice;
441
39
 
442
40
  /**
443
- * @fileoverview added by tsickle
444
- * Generated from: injection-tokens/error-matcher.token.ts
445
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
446
- */
447
- /**
448
- * Transforms {\@link DaffError}s into {\@link DaffStateError}s before they are serialized into state.
41
+ * Transforms {@link DaffError}s into {@link DaffStateError}s before they are serialized into state.
449
42
  * Can be used to further refine Daffodil errors into more specific app errors.
450
- * @type {?}
451
- */
452
- const DAFF_PRODUCT_ERROR_MATCHER = new InjectionToken('DAFF_PRODUCT_ERROR_MATCHER', { factory: (/**
453
- * @return {?}
454
- */
455
- () => daffTransformErrorToStateError) });
456
-
457
- /**
458
- * @fileoverview added by tsickle
459
- * Generated from: injection-tokens/public_api.ts
460
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
461
- */
462
-
463
- /**
464
- * @fileoverview added by tsickle
465
- * Generated from: public_api.ts
466
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
467
- */
468
-
469
- /**
470
- * @fileoverview added by tsickle
471
- * Generated from: index.ts
472
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
473
43
  */
44
+ const DAFF_PRODUCT_ERROR_MATCHER = new InjectionToken('DAFF_PRODUCT_ERROR_MATCHER', { factory: () => daffTransformErrorToStateError });
474
45
 
475
46
  /**
476
- * @fileoverview added by tsickle
477
- * Generated from: daffodil-product.ts
478
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
47
+ * Generated bundle index. Do not edit.
479
48
  */
480
49
 
481
50
  export { DAFF_PRODUCT_ERROR_MATCHER, DaffCompositeProductItemInputEnum, DaffProductTypeEnum, productPriceRangeHasDiscount, productPriceRangeHasPriceRange };
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-product.js","sources":["../../../libs/product/src/models/composite-configuration-item.ts","../../../libs/product/src/models/composite-product.ts","../../../libs/product/src/models/composite-product-item.ts","../../../libs/product/src/models/configurable-product.ts","../../../libs/product/src/models/prices.ts","../../../libs/product/src/models/product.ts","../../../libs/product/src/models/product-image.ts","../../../libs/product/src/helpers.ts","../../../libs/product/src/injection-tokens/error-matcher.token.ts"],"sourcesContent":["import { ID } from '@daffodil/core';\n\n/**\n * An object to denote the configuration chosen for a particular {@link DaffCompositeProductItem}.\n *\n * @deprecated import from @daffodil/composite-product instead.\n */\nexport interface DaffCompositeConfigurationItem {\n\t/**\n\t * The quantity chosen for the configuration of the {@link DaffCompositeProductItem}.\n\t */\n\tqty?: number;\n\t/**\n\t * The value of the {@link DaffCompositeProductItemOption} chosen for the configuration of the {@link DaffCompositeProductItem}.\n\t */\n\tvalue?: ID;\n}\n","import { DaffCompositeProductItem } from './composite-product-item';\nimport { DaffProduct } from './product';\n\n/**\n * A composite product is a group of products sold together. It includes one primary product and many accessory \"items\".\n * The composite product items are additional products the customer might want to purchase with the primary product,\n * and each item has a number of options from which the user can choose. Composite product items can be optional or required.\n * For example, a toolbox bundle might have a primary product of the toolbox. The items could be a hammer and a screw driver,\n * and the options for these items could be two different hammers and two different screwdrivers between which the customer could choose.\n * All of these items could have different prices/discounts/etc which would cause the composite products to have ranged prices.\n *\n * @deprecated import from @daffodil/composite-product instead.\n */\nexport interface DaffCompositeProduct extends DaffProduct {\n\t/**\n\t * The available items for the composite product.\n\t */\n\titems: DaffCompositeProductItem[];\n}\n","import { DaffIdentifiable } from '@daffodil/core';\n\nimport { DaffProduct } from './product';\n\n/**\n * An enum for whether a composite product item should be displayed as a radio or select input.\n *\n * @deprecated import from @daffodil/composite-product instead.\n */\nexport enum DaffCompositeProductItemInputEnum {\n\tselect = 'select',\n\tradio = 'radio'\n}\n\n/**\n * The composite product item describes one set of product options that the user can add to the composite product.\n * A composite product item can be required or optional. If it is required, an option _must_ be chosen in order to add the product to the cart.\n * If the item is optional, the product can be added to the cart without an option having been chosen.\n * For example, if a composite product is a toolbox bundle, a composite product item might be a screw driver, and the options contained in that\n * item might be a phillips head and a flathead. The customer could choose to add either a phillips head or a flathead to the\n * composite product, or neither if the item is optional.\n *\n * @deprecated import from @daffodil/composite-product instead.\n */\nexport interface DaffCompositeProductItem extends DaffIdentifiable {\n\t/**\n\t * Whether the item is required or optional.\n\t */\n\trequired: boolean;\n\t/**\n\t * The title label for the item.\n\t */\n\ttitle: string;\n\t/**\n\t * Describes how the item should be displayed.\n\t */\n\tinput_type: DaffCompositeProductItemInputEnum;\n\t/**\n\t * The options that may be chosen for the item.\n\t */\n\toptions: DaffCompositeProductItemOption[];\n}\n\n/**\n * The composite product item option is a DaffProduct that can be added to a composite product.\n *\n * @deprecated import from @daffodil/composite-product instead.\n */\nexport interface DaffCompositeProductItemOption extends DaffProduct {\n\t/**\n\t * Whether the option is the default option for its parent {@link DaffCompositeProductItem}.\n\t */\n\tis_default: boolean;\n\t/**\n\t * The quantity chosen for the option.\n\t */\n\tquantity: number;\n}\n","import {\n DaffOrderable,\n DaffIdentifiable,\n} from '@daffodil/core';\n\nimport {\n DaffProduct,\n DaffProductDiscount,\n} from './product';\nimport { DaffProductImage } from './product-image';\n\n/**\n * A configurable product is a product with configurable attributes. The price of a configurable product may change based on\n * the attributes chosen, so a configurable product can have a price range. An example of a configurable product is a T-shirt.\n */\nexport interface DaffConfigurableProduct extends DaffProduct {\n\t/**\n\t * The configurable attributes available.\n\t */\n\tconfigurableAttributes: DaffConfigurableProductAttribute[];\n\t/**\n\t * The possible different variants of the product.\n\t */\n\tvariants: DaffConfigurableProductVariant[];\n}\n\n/**\n * An attribute of the configurable product that the customer must choose to add the configurable product to the cart.\n * An example of an attribute would be size for clothing.\n */\nexport interface DaffConfigurableProductAttribute extends DaffOrderable {\n\t/**\n\t * The identifier for the attribute type.\n\t */\n\tcode:\tstring;\n\t/**\n\t * A label for the attribute type.\n\t */\n\tlabel: string;\n\t/**\n\t * The possible attribute options that a customer can choose.\n\t */\n\tvalues:\tDaffConfigurableProductOptionValue[];\n}\n\n/**\n * A variant is one version of the configurable product with all attributes chosen. Variants exist because not all versions of every configuration of\n * the product might be in stock. For example, a shirt might have a medium, red shirt and a small,\n * green shirt in stock, but no small, red shirts. In this case there would be two variants (mediumRed, smallGreen) rather than the maximum 4 variants\n * (smallRed, mediumRed, smallGreen, mediumGreen). This ensures the customer can't add a configurable product to the cart that is not\n * in stock. However, variants don't usually need to be considered by the frontend dev, because daffodil abstacts away the concept of variants into\n * an \"available attributes\" selector.\n */\nexport interface DaffConfigurableProductVariant extends DaffIdentifiable {\n\t/**\n\t * The attributes applied to the product to form the product variant.\n\t */\n\tappliedAttributes: DaffProductVariantAttributesDictionary;\n\t/**\n\t * The price of the variant.\n\t */\n\tprice: number;\n\t/**\n\t * The total discount for the variant.\n\t */\n\tdiscount: DaffProductDiscount;\n\t/**\n\t * An image of the product variant.\n\t */\n\timage?: DaffProductImage;\n\t/**\n\t * Whether or not the variant is in stock.\n\t */\n\tin_stock: boolean;\n}\n\n/**\n * The applied attributes for a particular product variant.\n */\nexport interface DaffProductVariantAttributesDictionary {\n\t[x: string]: DaffConfigurableProductOptionValue['value'];\n}\n\n/**\n * The configurable option of a configurable product attribute. For example, this could be \"blue\" for the attribute \"color\" for a T-shirt.\n */\nexport interface DaffConfigurableProductOptionValue {\n\t/**\n\t * The attribute option value.\n\t */\n\tvalue: string;\n\t/**\n\t * The attribute option label.\n\t */\n\tlabel: string;\n\t/**\n\t * An option for displaying a hex color. Can be used for product color attributes.\n\t */\n\tswatch?: DaffSwatchOption;\n}\n\n/**\n * An optional field for the hex color code for DaffConfigurableProductOptionValues that need it.\n */\nexport interface DaffSwatchOption {\n\t/**\n\t * A hex color value.\n\t */\n\tvalue: string;\n\tthumbnail?: string;\n}\n","import { DaffProductDiscount } from './product';\n\n/**\n * A model for product prices that holds discounts, discounted price, and original price for the associated product.\n */\nexport interface DaffProductPrices {\n\t/**\n\t * The discounted price of the product.\n\t */\n\tdiscountedPrice: number;\n\t/**\n\t * The discount of the product.\n\t */\n\tdiscount: DaffProductDiscount;\n\t/**\n\t * The price of the product before discounts.\n\t */\n\toriginalPrice: number;\n}\n\n/**\n * A ranged price for products that could have more than one possible price, depending on the configurations.\n */\nexport interface DaffPriceRange {\n\t/**\n\t * The maximum prices of the product. Includes discounts, the maximum discounted price, and the maximum original price.\n\t */\n\tmaxPrice: DaffProductPrices;\n\t/**\n\t * The minimum prices of the product. Includes discounts, the minimum discounted price, and the minimum original price.\n\t */\n\tminPrice: DaffProductPrices;\n}\n","import {\n DaffIdentifiable,\n DaffLocatable,\n DaffCanonicallyLocatable,\n} from '@daffodil/core';\n\nimport { DaffProductImage } from './product-image';\n\n/**\n * The possible product types.\n */\nexport enum DaffProductTypeEnum {\n\tSimple = 'simple',\n\tComposite = 'composite',\n\tConfigurable = 'configurable'\n}\n\n/**\n * An interface for a product usable by the @daffodil/product library.\n */\nexport interface DaffProduct extends DaffLocatable, DaffIdentifiable, Partial<DaffCanonicallyLocatable> {\n\t/**\n\t * The type of product.\n\t */\n type: DaffProductTypeEnum;\n /**\n * The product name.\n */\n name: string;\n /**\n * A smaller image to concisely visualize the product.\n */\n thumbnail: DaffProductImage;\n /**\n * An array of images for the product.\n */\n images: DaffProductImage[];\n /**\n * A list of related products.\n */\n related?: DaffProduct[];\n /**\n * A list of upsell productss.\n */\n upsell?: DaffProduct[];\n\n // TODO: move to subtypes\n /**\n * The price of the product.\n */\n\tprice?: number;\n\t/**\n\t * The total discounts associated with this product.\n\t */\n discount?: DaffProductDiscount;\n /**\n * Whether or not the product is in stock.\n */\n in_stock?: boolean;\n\n // TODO: move to meta object\n\t/**\n\t * The product brand.\n\t */\n brand?: string;\n\t/**\n\t * Describes the product.\n\t */\n description?: string;\n\t/**\n\t * A shorter description of the product.\n\t */\n\tshort_description?: string;\n\t/**\n\t * A title for the product to display in the browser tab title.\n\t */\n\tmeta_title?: string;\n\t/**\n\t * A description of the product for usage in search engine results.\n\t */\n\tmeta_description?: string;\n}\n\n/**\n * The discount for a product.\n */\nexport interface DaffProductDiscount {\n\t/**\n\t * The discount represented as some amount of currency.\n\t */\n\tamount: number;\n\t/**\n\t * The discount represented as a percent of the original product price.\n\t */\n\tpercent: number;\n}\n","import {\n DaffIdentifiable,\n DaffLocatable,\n} from '@daffodil/core';\n\n/**\n * Interface for an image on a DaffProduct.\n */\nexport interface DaffProductImage extends DaffLocatable, DaffIdentifiable {\n\t/**\n\t * A label describing the image.\n\t */\n label: string;\n}\n","import { DaffPriceRange } from './models/prices';\n\n/**\n * Returns whether a DaffPriceRange has a discount.\n *\n * @param priceRange a DaffPriceRange\n */\nexport const productPriceRangeHasDiscount = (priceRange: DaffPriceRange): boolean => priceRange.minPrice.originalPrice !== priceRange.minPrice.discountedPrice ||\n\t\tpriceRange.maxPrice.originalPrice !== priceRange.maxPrice.discountedPrice;\n\n/**\n * Returns whether the min and max prices of a DaffPriceRange are different.\n *\n * @param priceRange a DaffPriceRange\n */\nexport const productPriceRangeHasPriceRange = (priceRange: DaffPriceRange): boolean => priceRange.minPrice.originalPrice !== priceRange.maxPrice.originalPrice ||\n\t\tpriceRange.minPrice.discountedPrice !== priceRange.maxPrice.discountedPrice;\n","import { InjectionToken } from '@angular/core';\n\nimport { daffTransformErrorToStateError } from '@daffodil/core/state';\n\n/**\n * Transforms {@link DaffError}s into {@link DaffStateError}s before they are serialized into state.\n * Can be used to further refine Daffodil errors into more specific app errors.\n */\nexport const DAFF_PRODUCT_ERROR_MATCHER = new InjectionToken<typeof daffTransformErrorToStateError>(\n 'DAFF_PRODUCT_ERROR_MATCHER',\n { factory: () => daffTransformErrorToStateError },\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;6CAgBC;;;;;;IALA,6CAAa;;;;;IAIb,+CAAW;;;;;;;;;;;;;;;;;;;mCCGX;;;;;;IADA,qCAAkC;;;;;;;;;MCRvB,iCAAiC;IAC5C,MAAM,UAAW;IACjB,KAAK,SAAU;EACf;;;;;;;;;;;;uCA6BA;;;;;;IAbA,4CAAkB;;;;;IAIlB,yCAAc;;;;;IAId,8CAA8C;;;;;IAI9C,2CAA0C;;;;;;;;6CAiB1C;;;;;;IALA,oDAAoB;;;;;IAIpB,kDAAiB;;;;;;;;;;;;;sCChCjB;;;;;;IALA,yDAA2D;;;;;IAI3D,2CAA2C;;;;;;;+CAoB3C;;;;;;IATA,gDAAa;;;;;IAIb,iDAAc;;;;;IAId,kDAA6C;;;;;;;;;;;6CAgC7C;;;;;;IAjBA,2DAA0D;;;;;IAI1D,+CAAc;;;;;IAId,kDAA8B;;;;;IAI9B,+CAAyB;;;;;IAIzB,kDAAkB;;;;;;qDAQlB;;;;;iDAkBA;;;;;;IATA,mDAAc;;;;;IAId,mDAAc;;;;;IAId,oDAA0B;;;;;;+BAY1B;;;;;;IAFA,iCAAc;;IACd,qCAAmB;;;;;;;;;;;;gCC3FnB;;;;;;IATA,4CAAwB;;;;;IAIxB,qCAA8B;;;;;IAI9B,0CAAsB;;;;;;6BAetB;;;;;;IALA,kCAA4B;;;;;IAI5B,kCAA4B;;;;;;;;;MCpBjB,mBAAmB;IAC9B,MAAM,UAAW;IACjB,SAAS,aAAc;IACvB,YAAY,gBAAiB;EAC7B;;;;;0BAkEA;;;;;;IAzDC,2BAA0B;;;;;IAI1B,2BAAa;;;;;IAIb,gCAA4B;;;;;IAI5B,6BAA2B;;;;;IAI3B,8BAAwB;;;;;IAIxB,6BAAuB;;;;;IAMxB,4BAAe;;;;;IAId,+BAA+B;;;;;IAI/B,+BAAmB;;;;;IAMnB,4BAAe;;;;;IAIf,kCAAqB;;;;;IAItB,wCAA2B;;;;;IAI3B,iCAAoB;;;;;IAIpB,uCAA0B;;;;;;kCAe1B;;;;;;IALA,qCAAe;;;;;IAIf,sCAAgB;;;;;;;;;;;;+BCjFhB;;;;;;IADC,iCAAc;;;;;;;;;;;;;;MCLH,4BAA4B;;;;AAAG,CAAC,UAA0B,KAAc,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,eAAe;IAC5J,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,eAAe;;;;;;;MAO9D,8BAA8B;;;;AAAG,CAAC,UAA0B,KAAc,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,aAAa;IAC5J,UAAU,CAAC,QAAQ,CAAC,eAAe,KAAK,UAAU,CAAC,QAAQ,CAAC,eAAe;;;;;;;;;;;;MCRhE,0BAA0B,GAAG,IAAI,cAAc,CAC1D,4BAA4B,EAC5B,EAAE,OAAO;;;IAAE,MAAM,8BAA8B,CAAA,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"daffodil-product.js","sources":["../../../libs/product/src/models/composite-product-item.ts","../../../libs/product/src/models/product.ts","../../../libs/product/src/helpers.ts","../../../libs/product/src/injection-tokens/error-matcher.token.ts","../../../libs/product/src/daffodil-product.ts"],"sourcesContent":["import { DaffIdentifiable } from '@daffodil/core';\n\nimport { DaffProduct } from './product';\n\n/**\n * An enum for whether a composite product item should be displayed as a radio or select input.\n *\n * @deprecated import from @daffodil/composite-product instead.\n */\nexport enum DaffCompositeProductItemInputEnum {\n\tselect = 'select',\n\tradio = 'radio'\n}\n\n/**\n * The composite product item describes one set of product options that the user can add to the composite product.\n * A composite product item can be required or optional. If it is required, an option _must_ be chosen in order to add the product to the cart.\n * If the item is optional, the product can be added to the cart without an option having been chosen.\n * For example, if a composite product is a toolbox bundle, a composite product item might be a screw driver, and the options contained in that\n * item might be a phillips head and a flathead. The customer could choose to add either a phillips head or a flathead to the\n * composite product, or neither if the item is optional.\n *\n * @deprecated import from @daffodil/composite-product instead.\n */\nexport interface DaffCompositeProductItem extends DaffIdentifiable {\n\t/**\n\t * Whether the item is required or optional.\n\t */\n\trequired: boolean;\n\t/**\n\t * The title label for the item.\n\t */\n\ttitle: string;\n\t/**\n\t * Describes how the item should be displayed.\n\t */\n\tinput_type: DaffCompositeProductItemInputEnum;\n\t/**\n\t * The options that may be chosen for the item.\n\t */\n\toptions: DaffCompositeProductItemOption[];\n}\n\n/**\n * The composite product item option is a DaffProduct that can be added to a composite product.\n *\n * @deprecated import from @daffodil/composite-product instead.\n */\nexport interface DaffCompositeProductItemOption extends DaffProduct {\n\t/**\n\t * Whether the option is the default option for its parent {@link DaffCompositeProductItem}.\n\t */\n\tis_default: boolean;\n\t/**\n\t * The quantity chosen for the option.\n\t */\n\tquantity: number;\n}\n","import {\n DaffIdentifiable,\n DaffLocatable,\n DaffCanonicallyLocatable,\n} from '@daffodil/core';\n\nimport { DaffProductImage } from './product-image';\n\n/**\n * The possible product types.\n */\nexport enum DaffProductTypeEnum {\n\tSimple = 'simple',\n\tComposite = 'composite',\n\tConfigurable = 'configurable'\n}\n\n/**\n * An interface for a product usable by the @daffodil/product library.\n */\nexport interface DaffProduct extends DaffLocatable, DaffIdentifiable, Partial<DaffCanonicallyLocatable> {\n\t/**\n\t * The type of product.\n\t */\n type: DaffProductTypeEnum;\n /**\n * The product name.\n */\n name: string;\n /**\n * A smaller image to concisely visualize the product.\n */\n thumbnail: DaffProductImage;\n /**\n * An array of images for the product.\n */\n images: DaffProductImage[];\n /**\n * A list of related products.\n */\n related?: DaffProduct[];\n /**\n * A list of upsell productss.\n */\n upsell?: DaffProduct[];\n\n // TODO: move to subtypes\n /**\n * The price of the product.\n */\n\tprice?: number;\n\t/**\n\t * The total discounts associated with this product.\n\t */\n discount?: DaffProductDiscount;\n /**\n * Whether or not the product is in stock.\n */\n in_stock?: boolean;\n\n // TODO: move to meta object\n\t/**\n\t * The product brand.\n\t */\n brand?: string;\n\t/**\n\t * Describes the product.\n\t */\n description?: string;\n\t/**\n\t * A shorter description of the product.\n\t */\n\tshort_description?: string;\n\t/**\n\t * A title for the product to display in the browser tab title.\n\t */\n\tmeta_title?: string;\n\t/**\n\t * A description of the product for usage in search engine results.\n\t */\n\tmeta_description?: string;\n}\n\n/**\n * The discount for a product.\n */\nexport interface DaffProductDiscount {\n\t/**\n\t * The discount represented as some amount of currency.\n\t */\n\tamount: number;\n\t/**\n\t * The discount represented as a percent of the original product price.\n\t */\n\tpercent: number;\n}\n","import { DaffPriceRange } from './models/prices';\n\n/**\n * Returns whether a DaffPriceRange has a discount.\n *\n * @param priceRange a DaffPriceRange\n */\nexport const productPriceRangeHasDiscount = (priceRange: DaffPriceRange): boolean => priceRange.minPrice.originalPrice !== priceRange.minPrice.discountedPrice ||\n\t\tpriceRange.maxPrice.originalPrice !== priceRange.maxPrice.discountedPrice;\n\n/**\n * Returns whether the min and max prices of a DaffPriceRange are different.\n *\n * @param priceRange a DaffPriceRange\n */\nexport const productPriceRangeHasPriceRange = (priceRange: DaffPriceRange): boolean => priceRange.minPrice.originalPrice !== priceRange.maxPrice.originalPrice ||\n\t\tpriceRange.minPrice.discountedPrice !== priceRange.maxPrice.discountedPrice;\n","import { InjectionToken } from '@angular/core';\n\nimport { daffTransformErrorToStateError } from '@daffodil/core/state';\n\n/**\n * Transforms {@link DaffError}s into {@link DaffStateError}s before they are serialized into state.\n * Can be used to further refine Daffodil errors into more specific app errors.\n */\nexport const DAFF_PRODUCT_ERROR_MATCHER = new InjectionToken<typeof daffTransformErrorToStateError>(\n 'DAFF_PRODUCT_ERROR_MATCHER',\n { factory: () => daffTransformErrorToStateError },\n);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIA;;;;;IAKY;AAAZ,WAAY,iCAAiC;IAC5C,sDAAiB,CAAA;IACjB,oDAAe,CAAA;AAChB,CAAC,EAHW,iCAAiC,KAAjC,iCAAiC;;ACD7C;;;IAGY;AAAZ,WAAY,mBAAmB;IAC9B,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;IACvB,oDAA6B,CAAA;AAC9B,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB;;ACT/B;;;;;MAKa,4BAA4B,GAAG,CAAC,UAA0B,KAAc,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,eAAe;IAC5J,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,gBAAgB;AAE5E;;;;;MAKa,8BAA8B,GAAG,CAAC,UAA0B,KAAc,UAAU,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU,CAAC,QAAQ,CAAC,aAAa;IAC5J,UAAU,CAAC,QAAQ,CAAC,eAAe,KAAK,UAAU,CAAC,QAAQ,CAAC;;ACZ9D;;;;MAIa,0BAA0B,GAAG,IAAI,cAAc,CAC1D,4BAA4B,EAC5B,EAAE,OAAO,EAAE,MAAM,8BAA8B,EAAE;;ACVnD;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daffodil/product",
3
- "version": "0.38.9",
3
+ "version": "0.39.0",
4
4
  "description": "Interfaces built for daffodil/state",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "peerDependencies": {
19
19
  "@angular/common": "^11.0.0",
20
20
  "@angular/core": "^11.0.0",
21
- "@daffodil/core": "0.38.9",
21
+ "@daffodil/core": "0.39.0",
22
22
  "@ngrx/effects": "^11.0.0",
23
23
  "@ngrx/entity": "^11.0.0",
24
24
  "@ngrx/store": "^11.0.0",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "optionalDependencies": {
28
28
  "@apollo/client": "^3.0.0",
29
- "@daffodil/driver": "0.38.9",
29
+ "@daffodil/driver": "0.39.0",
30
30
  "angular-in-memory-web-api": "^0.11.0",
31
31
  "apollo-angular": "^2.4.0",
32
32
  "faker": "^5.5.3"
@@ -8,4 +8,4 @@
8
8
  "typings": "daffodil-product-routing.d.ts",
9
9
  "metadata": "daffodil-product-routing.metadata.json",
10
10
  "sideEffects": false
11
- }
11
+ }
@@ -8,4 +8,4 @@
8
8
  "typings": "daffodil-product-state.d.ts",
9
9
  "metadata": "daffodil-product-state.metadata.json",
10
10
  "sideEffects": false
11
- }
11
+ }
@@ -8,4 +8,4 @@
8
8
  "typings": "daffodil-product-state-testing.d.ts",
9
9
  "metadata": "daffodil-product-state-testing.metadata.json",
10
10
  "sideEffects": false
11
- }
11
+ }
@@ -8,4 +8,4 @@
8
8
  "typings": "daffodil-product-testing.d.ts",
9
9
  "metadata": "daffodil-product-testing.metadata.json",
10
10
  "sideEffects": false
11
- }
11
+ }