@daffodil/cart 0.66.1 → 0.67.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 (534) hide show
  1. package/driver/in-memory/injection-tokens/extra-attributes-hook.token.d.ts +1 -1
  2. package/driver/magento/injection-tokens/transforms/cart/token.d.ts +1 -2
  3. package/driver/magento/injection-tokens/transforms/cart-item/token.d.ts +1 -2
  4. package/driver/magento/interfaces/cart-item-transform.type.d.ts +1 -1
  5. package/driver/magento/interfaces/cart-transform.type.d.ts +1 -1
  6. package/{esm2020 → esm2022}/driver/in-memory/backend/cart/cart.service.mjs +6 -6
  7. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-address/cart-address.service.mjs +6 -6
  8. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-billing-address/cart-billing-address.service.mjs +6 -6
  9. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-coupon/cart-coupon.service.mjs +6 -6
  10. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-items/cart-items.service.mjs +6 -6
  11. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-order/cart-order.service.mjs +4 -4
  12. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-payment/cart-payment.service.mjs +6 -6
  13. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-payment-methods/cart-payment-methods.service.mjs +4 -4
  14. package/esm2022/driver/in-memory/backend/cart-root.service.mjs +129 -0
  15. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-shipping-address/cart-shipping-address.service.mjs +6 -6
  16. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-shipping-information/cart-shipping-information.service.mjs +6 -6
  17. package/{esm2020 → esm2022}/driver/in-memory/backend/cart-shipping-methods/cart-shipping-methods.service.mjs +5 -5
  18. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart/cart.service.mjs +5 -5
  19. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-address/cart-address.service.mjs +5 -5
  20. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-billing-address/cart-billing-address.service.mjs +5 -5
  21. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-coupon/cart-coupon.service.mjs +5 -5
  22. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-driver.module.mjs +5 -5
  23. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-item/cart-item.service.mjs +5 -5
  24. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-order/cart-order.service.mjs +5 -5
  25. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-payment/cart-payment.service.mjs +5 -5
  26. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-payment-methods/cart-payment-methods.service.mjs +5 -5
  27. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-shipping-address/cart-shipping-address.service.mjs +5 -5
  28. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-shipping-information/cart-shipping-information.service.mjs +5 -5
  29. package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-shipping-methods/cart-shipping-methods.service.mjs +5 -5
  30. package/{esm2020 → esm2022}/driver/magento/cart-address.service.mjs +6 -6
  31. package/{esm2020 → esm2022}/driver/magento/cart-billing-address.service.mjs +6 -6
  32. package/{esm2020 → esm2022}/driver/magento/cart-coupon.service.mjs +6 -6
  33. package/{esm2020 → esm2022}/driver/magento/cart-driver.module.mjs +5 -5
  34. package/{esm2020 → esm2022}/driver/magento/cart-item.service.mjs +6 -6
  35. package/{esm2020 → esm2022}/driver/magento/cart-order.service.mjs +6 -6
  36. package/{esm2020 → esm2022}/driver/magento/cart-payment-methods.service.mjs +6 -6
  37. package/{esm2020 → esm2022}/driver/magento/cart-payment.service.mjs +6 -6
  38. package/{esm2020 → esm2022}/driver/magento/cart-shipping-address.service.mjs +6 -6
  39. package/{esm2020 → esm2022}/driver/magento/cart-shipping-information.service.mjs +6 -6
  40. package/{esm2020 → esm2022}/driver/magento/cart-shipping-methods.service.mjs +6 -6
  41. package/{esm2020 → esm2022}/driver/magento/cart.service.mjs +6 -6
  42. package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-address-input.factory.mjs +5 -5
  43. package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-address.factory.mjs +5 -5
  44. package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-coupon.factory.mjs +5 -5
  45. package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-item/bundle-cart-item.factory.mjs +5 -5
  46. package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-item/cart-item.factory.mjs +5 -5
  47. package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-item/configurable-cart-item.factory.mjs +5 -5
  48. package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-payment-method.factory.mjs +5 -5
  49. package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-shipping-method.factory.mjs +5 -5
  50. package/{esm2020 → esm2022}/driver/magento/testing/factories/cart.factory.mjs +5 -5
  51. package/{esm2020 → esm2022}/driver/magento/testing/factories/shipping-address.factory.mjs +5 -5
  52. package/{esm2020 → esm2022}/driver/magento/transforms/inputs/billing-address.service.mjs +5 -5
  53. package/{esm2020 → esm2022}/driver/magento/transforms/inputs/cart-address.service.mjs +4 -4
  54. package/{esm2020 → esm2022}/driver/magento/transforms/inputs/cart-item-update.service.mjs +4 -4
  55. package/{esm2020 → esm2022}/driver/magento/transforms/inputs/payment-method.service.mjs +4 -4
  56. package/{esm2020 → esm2022}/driver/magento/transforms/inputs/shipping-address.service.mjs +5 -5
  57. package/{esm2020 → esm2022}/driver/magento/transforms/inputs/shipping-method.service.mjs +4 -4
  58. package/{esm2020 → esm2022}/driver/magento/transforms/outputs/billing-address.service.mjs +5 -5
  59. package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-address.service.mjs +4 -4
  60. package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-coupon-response.service.mjs +6 -6
  61. package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-payment.service.mjs +4 -4
  62. package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-shipping-information.service.mjs +5 -5
  63. package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-shipping-rate.service.mjs +4 -4
  64. package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart.service.mjs +6 -6
  65. package/{esm2020 → esm2022}/driver/magento/transforms/outputs/shipping-address.service.mjs +5 -5
  66. package/{esm2020 → esm2022}/driver/services/resolve.service.mjs +6 -6
  67. package/{esm2020 → esm2022}/driver/testing/drivers/cart/cart.service.mjs +5 -5
  68. package/{esm2020 → esm2022}/driver/testing/drivers/cart-address/cart-address.service.mjs +5 -5
  69. package/{esm2020 → esm2022}/driver/testing/drivers/cart-billing-address/cart-billing-address.service.mjs +5 -5
  70. package/{esm2020 → esm2022}/driver/testing/drivers/cart-coupon/cart-coupon.service.mjs +5 -5
  71. package/{esm2020 → esm2022}/driver/testing/drivers/cart-driver.module.mjs +5 -5
  72. package/{esm2020 → esm2022}/driver/testing/drivers/cart-item/cart-item.service.mjs +5 -5
  73. package/{esm2020 → esm2022}/driver/testing/drivers/cart-order/cart-order.service.mjs +4 -4
  74. package/{esm2020 → esm2022}/driver/testing/drivers/cart-payment/cart-payment.service.mjs +5 -5
  75. package/{esm2020 → esm2022}/driver/testing/drivers/cart-payment-methods/cart-payment-methods.service.mjs +5 -5
  76. package/{esm2020 → esm2022}/driver/testing/drivers/cart-shipping-address/cart-shipping-address.service.mjs +5 -5
  77. package/{esm2020 → esm2022}/driver/testing/drivers/cart-shipping-information/cart-shipping-information.service.mjs +5 -5
  78. package/{esm2020 → esm2022}/driver/testing/drivers/cart-shipping-methods/cart-shipping-methods.service.mjs +5 -5
  79. package/{esm2020 → esm2022}/routing/cart-routing.module.mjs +15 -15
  80. package/esm2022/routing/guards/billing-address/billing-address.guard.mjs +40 -0
  81. package/esm2022/routing/guards/cart-items/cart-items.guard.mjs +41 -0
  82. package/{esm2020 → esm2022}/routing/guards/in-stock-items/in-stock-items.guard.mjs +6 -6
  83. package/{esm2020 → esm2022}/routing/guards/order-result/order-result.guard.mjs +7 -7
  84. package/esm2022/routing/guards/payment-method/payment-method.guard.mjs +40 -0
  85. package/{esm2020 → esm2022}/routing/guards/resolve-cart/resolve-cart.guard.mjs +6 -6
  86. package/{esm2020 → esm2022}/routing/guards/resolved-cart/resolved-cart.guard.mjs +6 -6
  87. package/{esm2020 → esm2022}/routing/guards/shipping-address/shipping-address.guard.mjs +7 -7
  88. package/esm2022/routing/guards/shipping-method/shipping-method.guard.mjs +40 -0
  89. package/{esm2020 → esm2022}/routing/resolvers/cart-resolver.service.mjs +7 -7
  90. package/esm2022/routing/resolvers/empty-cart-resolver.service.mjs +41 -0
  91. package/esm2022/state/cart-state.module.mjs +84 -0
  92. package/{esm2020 → esm2022}/state/effects/cart-address.effects.mjs +6 -6
  93. package/{esm2020 → esm2022}/state/effects/cart-billing-address.effects.mjs +6 -6
  94. package/{esm2020 → esm2022}/state/effects/cart-coupon.effects.mjs +6 -6
  95. package/{esm2020 → esm2022}/state/effects/cart-item.effects.mjs +6 -6
  96. package/{esm2020 → esm2022}/state/effects/cart-order.effects.mjs +6 -6
  97. package/{esm2020 → esm2022}/state/effects/cart-payment-methods.effects.mjs +6 -6
  98. package/{esm2020 → esm2022}/state/effects/cart-payment-processor.effects.mjs +6 -6
  99. package/{esm2020 → esm2022}/state/effects/cart-payment.effects.mjs +6 -6
  100. package/{esm2020 → esm2022}/state/effects/cart-resolver.effects.mjs +6 -6
  101. package/{esm2020 → esm2022}/state/effects/cart-shipping-address.effects.mjs +6 -6
  102. package/{esm2020 → esm2022}/state/effects/cart-shipping-information.effects.mjs +6 -6
  103. package/{esm2020 → esm2022}/state/effects/cart-shipping-methods.effects.mjs +6 -6
  104. package/{esm2020 → esm2022}/state/effects/cart.effects.mjs +6 -6
  105. package/{esm2020 → esm2022}/state/facades/cart/cart.facade.mjs +6 -6
  106. package/esm2022/state/reducers/cart-item-entities/set-state.meta-reducer.mjs +56 -0
  107. package/{esm2020 → esm2022}/state/testing/cart-testing.module.mjs +7 -7
  108. package/{esm2020 → esm2022}/state/testing/factories/stateful-cart-item.factory.mjs +5 -5
  109. package/{esm2020 → esm2022}/state/testing/factories/stateful-composite-cart-item.factory.mjs +5 -5
  110. package/{esm2020 → esm2022}/state/testing/factories/stateful-configurable-cart-item.factory.mjs +5 -5
  111. package/{esm2020 → esm2022}/state/testing/mock-cart-facade.mjs +4 -4
  112. package/{esm2020 → esm2022}/storage/cart-storage.service.mjs +5 -5
  113. package/{esm2020 → esm2022}/testing/factories/cart-address.factory.mjs +5 -5
  114. package/{esm2020 → esm2022}/testing/factories/cart-coupon.factory.mjs +5 -5
  115. package/{esm2020 → esm2022}/testing/factories/cart-item/cart-item.factory.mjs +5 -5
  116. package/{esm2020 → esm2022}/testing/factories/cart-item/composite-cart-item.factory.mjs +5 -5
  117. package/{esm2020 → esm2022}/testing/factories/cart-item/configurable-cart-item.factory.mjs +5 -5
  118. package/{esm2020 → esm2022}/testing/factories/cart-payment.factory.mjs +5 -5
  119. package/{esm2020 → esm2022}/testing/factories/cart-shipping-information.factory.mjs +5 -5
  120. package/{esm2020 → esm2022}/testing/factories/cart-shipping-rate.factory.mjs +5 -5
  121. package/{esm2020 → esm2022}/testing/factories/cart-total.factory.mjs +5 -5
  122. package/{esm2020 → esm2022}/testing/factories/cart.factory.mjs +5 -5
  123. package/{fesm2020 → fesm2022}/daffodil-cart-driver-in-memory.mjs +119 -119
  124. package/{fesm2020 → fesm2022}/daffodil-cart-driver-in-memory.mjs.map +1 -1
  125. package/{fesm2020 → fesm2022}/daffodil-cart-driver-magento-testing.mjs +40 -40
  126. package/{fesm2020 → fesm2022}/daffodil-cart-driver-magento-testing.mjs.map +1 -1
  127. package/{fesm2020 → fesm2022}/daffodil-cart-driver-magento.mjs +110 -110
  128. package/{fesm2020 → fesm2022}/daffodil-cart-driver-magento.mjs.map +1 -1
  129. package/{fesm2015 → fesm2022}/daffodil-cart-driver-testing.mjs +47 -47
  130. package/{fesm2020 → fesm2022}/daffodil-cart-driver-testing.mjs.map +1 -1
  131. package/{fesm2020 → fesm2022}/daffodil-cart-driver.mjs +5 -5
  132. package/{fesm2020 → fesm2022}/daffodil-cart-driver.mjs.map +1 -1
  133. package/{fesm2020 → fesm2022}/daffodil-cart-routing.mjs +69 -69
  134. package/fesm2022/daffodil-cart-routing.mjs.map +1 -0
  135. package/{fesm2015 → fesm2022}/daffodil-cart-state-testing.mjs +21 -21
  136. package/{fesm2020 → fesm2022}/daffodil-cart-state-testing.mjs.map +1 -1
  137. package/{fesm2020 → fesm2022}/daffodil-cart-state.mjs +118 -108
  138. package/{fesm2020 → fesm2022}/daffodil-cart-state.mjs.map +1 -1
  139. package/{fesm2015 → fesm2022}/daffodil-cart-testing.mjs +77 -77
  140. package/{fesm2020 → fesm2022}/daffodil-cart-testing.mjs.map +1 -1
  141. package/{fesm2020 → fesm2022}/daffodil-cart.mjs +4 -4
  142. package/{fesm2020 → fesm2022}/daffodil-cart.mjs.map +1 -1
  143. package/package.json +1 -1
  144. package/routing/guards/billing-address/billing-address.guard.d.ts +2 -2
  145. package/routing/guards/cart-items/cart-items.guard.d.ts +2 -2
  146. package/routing/guards/in-stock-items/in-stock-items.guard.d.ts +2 -2
  147. package/routing/guards/order-result/order-result.guard.d.ts +2 -2
  148. package/routing/guards/payment-method/payment-method.guard.d.ts +2 -2
  149. package/routing/guards/resolve-cart/resolve-cart.guard.d.ts +2 -2
  150. package/routing/guards/resolved-cart/resolved-cart.guard.d.ts +2 -2
  151. package/routing/guards/shipping-address/shipping-address.guard.d.ts +2 -2
  152. package/routing/guards/shipping-method/shipping-method.guard.d.ts +2 -2
  153. package/routing/resolvers/cart-resolver.service.d.ts +2 -2
  154. package/routing/resolvers/empty-cart-resolver.service.d.ts +2 -2
  155. package/state/actions/cart-address.actions.d.ts +1 -1
  156. package/state/actions/cart-billing-address.actions.d.ts +1 -1
  157. package/state/actions/cart-coupon.actions.d.ts +1 -1
  158. package/state/actions/cart-item.actions.d.ts +1 -1
  159. package/state/actions/cart-order.actions.d.ts +1 -1
  160. package/state/actions/cart-payment-methods.actions.d.ts +1 -1
  161. package/state/actions/cart-payment.actions.d.ts +1 -1
  162. package/state/actions/cart-shipping-address.actions.d.ts +1 -1
  163. package/state/actions/cart-shipping-information.actions.d.ts +1 -1
  164. package/state/actions/cart-shipping-methods.actions.d.ts +1 -1
  165. package/state/actions/cart.actions.d.ts +1 -1
  166. package/state/cart-retrieval/type.d.ts +1 -1
  167. package/state/reducers/action-types.type.d.ts +1 -1
  168. package/state/reducers/cart-item-entities/set-state.meta-reducer.d.ts +1 -1
  169. package/state/reducers/errors/cart-errors.type.d.ts +1 -1
  170. package/state/reducers/loading/cart-loading.type.d.ts +1 -1
  171. package/state/reducers/token/meta.token.d.ts +1 -1
  172. package/esm2020/driver/in-memory/backend/cart-root.service.mjs +0 -129
  173. package/esm2020/routing/guards/billing-address/billing-address.guard.mjs +0 -40
  174. package/esm2020/routing/guards/cart-items/cart-items.guard.mjs +0 -41
  175. package/esm2020/routing/guards/payment-method/payment-method.guard.mjs +0 -40
  176. package/esm2020/routing/guards/shipping-method/shipping-method.guard.mjs +0 -40
  177. package/esm2020/routing/resolvers/empty-cart-resolver.service.mjs +0 -41
  178. package/esm2020/state/cart-state.module.mjs +0 -84
  179. package/esm2020/state/reducers/cart-item-entities/set-state.meta-reducer.mjs +0 -46
  180. package/fesm2015/daffodil-cart-driver-in-memory.mjs +0 -1190
  181. package/fesm2015/daffodil-cart-driver-in-memory.mjs.map +0 -1
  182. package/fesm2015/daffodil-cart-driver-magento-testing.mjs +0 -332
  183. package/fesm2015/daffodil-cart-driver-magento-testing.mjs.map +0 -1
  184. package/fesm2015/daffodil-cart-driver-magento.mjs +0 -2306
  185. package/fesm2015/daffodil-cart-driver-magento.mjs.map +0 -1
  186. package/fesm2015/daffodil-cart-driver-testing.mjs.map +0 -1
  187. package/fesm2015/daffodil-cart-driver.mjs +0 -266
  188. package/fesm2015/daffodil-cart-driver.mjs.map +0 -1
  189. package/fesm2015/daffodil-cart-routing.mjs +0 -526
  190. package/fesm2015/daffodil-cart-routing.mjs.map +0 -1
  191. package/fesm2015/daffodil-cart-state-testing.mjs.map +0 -1
  192. package/fesm2015/daffodil-cart-state.mjs +0 -2777
  193. package/fesm2015/daffodil-cart-state.mjs.map +0 -1
  194. package/fesm2015/daffodil-cart-testing.mjs.map +0 -1
  195. package/fesm2015/daffodil-cart.mjs +0 -167
  196. package/fesm2015/daffodil-cart.mjs.map +0 -1
  197. package/fesm2020/daffodil-cart-driver-testing.mjs +0 -369
  198. package/fesm2020/daffodil-cart-routing.mjs.map +0 -1
  199. package/fesm2020/daffodil-cart-state-testing.mjs +0 -218
  200. package/fesm2020/daffodil-cart-testing.mjs +0 -365
  201. /package/{esm2020 → esm2022}/daffodil-cart.mjs +0 -0
  202. /package/{esm2020 → esm2022}/driver/daffodil-cart-driver.mjs +0 -0
  203. /package/{esm2020 → esm2022}/driver/errors/cart-not-found.mjs +0 -0
  204. /package/{esm2020 → esm2022}/driver/errors/codes.enum.mjs +0 -0
  205. /package/{esm2020 → esm2022}/driver/errors/expired-payment-token.mjs +0 -0
  206. /package/{esm2020 → esm2022}/driver/errors/invalid-api-response.mjs +0 -0
  207. /package/{esm2020 → esm2022}/driver/errors/invalid-country.mjs +0 -0
  208. /package/{esm2020 → esm2022}/driver/errors/invalid-coupon-code.mjs +0 -0
  209. /package/{esm2020 → esm2022}/driver/errors/invalid-email.mjs +0 -0
  210. /package/{esm2020 → esm2022}/driver/errors/invalid-region.mjs +0 -0
  211. /package/{esm2020 → esm2022}/driver/errors/item-exceeds-max-qty.mjs +0 -0
  212. /package/{esm2020 → esm2022}/driver/errors/map.mjs +0 -0
  213. /package/{esm2020 → esm2022}/driver/errors/product-not-found.mjs +0 -0
  214. /package/{esm2020 → esm2022}/driver/errors/product-out-of-stock.mjs +0 -0
  215. /package/{esm2020 → esm2022}/driver/errors/public_api.mjs +0 -0
  216. /package/{esm2020 → esm2022}/driver/errors/unauthorized-for-cart.mjs +0 -0
  217. /package/{esm2020 → esm2022}/driver/in-memory/backend/public_api.mjs +0 -0
  218. /package/{esm2020 → esm2022}/driver/in-memory/daffodil-cart-driver-in-memory.mjs +0 -0
  219. /package/{esm2020 → esm2022}/driver/in-memory/drivers/public_api.mjs +0 -0
  220. /package/{esm2020 → esm2022}/driver/in-memory/helpers/compute-cart-item-prices.mjs +0 -0
  221. /package/{esm2020 → esm2022}/driver/in-memory/helpers/compute-cart-totals.mjs +0 -0
  222. /package/{esm2020 → esm2022}/driver/in-memory/index.mjs +0 -0
  223. /package/{esm2020 → esm2022}/driver/in-memory/injection-tokens/extra-attributes-hook.token.mjs +0 -0
  224. /package/{esm2020 → esm2022}/driver/in-memory/injection-tokens/public_api.mjs +0 -0
  225. /package/{esm2020 → esm2022}/driver/in-memory/public_api.mjs +0 -0
  226. /package/{esm2020 → esm2022}/driver/index.mjs +0 -0
  227. /package/{esm2020 → esm2022}/driver/injection-tokens/free-payment-method.mjs +0 -0
  228. /package/{esm2020 → esm2022}/driver/injection-tokens/public_api.mjs +0 -0
  229. /package/{esm2020 → esm2022}/driver/interfaces/cart-address-service.interface.mjs +0 -0
  230. /package/{esm2020 → esm2022}/driver/interfaces/cart-billing-address-service.interface.mjs +0 -0
  231. /package/{esm2020 → esm2022}/driver/interfaces/cart-coupon-service.interface.mjs +0 -0
  232. /package/{esm2020 → esm2022}/driver/interfaces/cart-item-service.interface.mjs +0 -0
  233. /package/{esm2020 → esm2022}/driver/interfaces/cart-order-service.interface.mjs +0 -0
  234. /package/{esm2020 → esm2022}/driver/interfaces/cart-payment-methods-service.interface.mjs +0 -0
  235. /package/{esm2020 → esm2022}/driver/interfaces/cart-payment-service.interface.mjs +0 -0
  236. /package/{esm2020 → esm2022}/driver/interfaces/cart-service.interface.mjs +0 -0
  237. /package/{esm2020 → esm2022}/driver/interfaces/cart-shipping-address-service.interface.mjs +0 -0
  238. /package/{esm2020 → esm2022}/driver/interfaces/cart-shipping-information-service.interface.mjs +0 -0
  239. /package/{esm2020 → esm2022}/driver/interfaces/cart-shipping-methods-service.interface.mjs +0 -0
  240. /package/{esm2020 → esm2022}/driver/interfaces/public_api.mjs +0 -0
  241. /package/{esm2020 → esm2022}/driver/magento/daffodil-cart-driver-magento.mjs +0 -0
  242. /package/{esm2020 → esm2022}/driver/magento/errors/codes.mjs +0 -0
  243. /package/{esm2020 → esm2022}/driver/magento/errors/map.mjs +0 -0
  244. /package/{esm2020 → esm2022}/driver/magento/errors/transform.mjs +0 -0
  245. /package/{esm2020 → esm2022}/driver/magento/index.mjs +0 -0
  246. /package/{esm2020 → esm2022}/driver/magento/injection-tokens/cart-mutation-queue.token.mjs +0 -0
  247. /package/{esm2020 → esm2022}/driver/magento/injection-tokens/fragments/cart.mjs +0 -0
  248. /package/{esm2020 → esm2022}/driver/magento/injection-tokens/public_api.mjs +0 -0
  249. /package/{esm2020 → esm2022}/driver/magento/injection-tokens/transforms/cart/token.mjs +0 -0
  250. /package/{esm2020 → esm2022}/driver/magento/injection-tokens/transforms/cart-item/token.mjs +0 -0
  251. /package/{esm2020 → esm2022}/driver/magento/interfaces/cart-item-transform.type.mjs +0 -0
  252. /package/{esm2020 → esm2022}/driver/magento/interfaces/cart-transform.type.mjs +0 -0
  253. /package/{esm2020 → esm2022}/driver/magento/interfaces/public_api.mjs +0 -0
  254. /package/{esm2020 → esm2022}/driver/magento/models/public_api.mjs +0 -0
  255. /package/{esm2020 → esm2022}/driver/magento/models/requests/billing-address.mjs +0 -0
  256. /package/{esm2020 → esm2022}/driver/magento/models/requests/cart-address-base.mjs +0 -0
  257. /package/{esm2020 → esm2022}/driver/magento/models/requests/cart-address.mjs +0 -0
  258. /package/{esm2020 → esm2022}/driver/magento/models/requests/cart-item-update.mjs +0 -0
  259. /package/{esm2020 → esm2022}/driver/magento/models/requests/cart-item.mjs +0 -0
  260. /package/{esm2020 → esm2022}/driver/magento/models/requests/payment-method.mjs +0 -0
  261. /package/{esm2020 → esm2022}/driver/magento/models/requests/public_api.mjs +0 -0
  262. /package/{esm2020 → esm2022}/driver/magento/models/requests/shipping-address.mjs +0 -0
  263. /package/{esm2020 → esm2022}/driver/magento/models/requests/shipping-method.mjs +0 -0
  264. /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-address.mjs +0 -0
  265. /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-coupon.mjs +0 -0
  266. /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-item.mjs +0 -0
  267. /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-payment-method.mjs +0 -0
  268. /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-shipping-method.mjs +0 -0
  269. /package/{esm2020 → esm2022}/driver/magento/models/responses/cart.mjs +0 -0
  270. /package/{esm2020 → esm2022}/driver/magento/models/responses/public_api.mjs +0 -0
  271. /package/{esm2020 → esm2022}/driver/magento/models/responses/shipping-address.mjs +0 -0
  272. /package/{esm2020 → esm2022}/driver/magento/models/responses/user-error.enum.mjs +0 -0
  273. /package/{esm2020 → esm2022}/driver/magento/models/responses/user-error.type.mjs +0 -0
  274. /package/{esm2020 → esm2022}/driver/magento/public_api.mjs +0 -0
  275. /package/{esm2020 → esm2022}/driver/magento/queries/add-item/public_api.mjs +0 -0
  276. /package/{esm2020 → esm2022}/driver/magento/queries/add-item/query.mjs +0 -0
  277. /package/{esm2020 → esm2022}/driver/magento/queries/add-item/response.type.mjs +0 -0
  278. /package/{esm2020 → esm2022}/driver/magento/queries/add-item/variables.type.mjs +0 -0
  279. /package/{esm2020 → esm2022}/driver/magento/queries/apply-coupon/public_api.mjs +0 -0
  280. /package/{esm2020 → esm2022}/driver/magento/queries/apply-coupon/query.mjs +0 -0
  281. /package/{esm2020 → esm2022}/driver/magento/queries/apply-coupon/response.type.mjs +0 -0
  282. /package/{esm2020 → esm2022}/driver/magento/queries/apply-coupon/variables.type.mjs +0 -0
  283. /package/{esm2020 → esm2022}/driver/magento/queries/create-cart/public_api.mjs +0 -0
  284. /package/{esm2020 → esm2022}/driver/magento/queries/create-cart/query.mjs +0 -0
  285. /package/{esm2020 → esm2022}/driver/magento/queries/create-cart/response.type.mjs +0 -0
  286. /package/{esm2020 → esm2022}/driver/magento/queries/create-cart/variables.type.mjs +0 -0
  287. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/available-payment-method.mjs +0 -0
  288. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/available-shipping-method.mjs +0 -0
  289. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/cart-address.mjs +0 -0
  290. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/cart-coupon.mjs +0 -0
  291. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/cart-item.mjs +0 -0
  292. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/cart.mjs +0 -0
  293. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/prices.mjs +0 -0
  294. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/public_api.mjs +0 -0
  295. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/selected-payment-method.mjs +0 -0
  296. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/selected-shipping-method.mjs +0 -0
  297. /package/{esm2020 → esm2022}/driver/magento/queries/fragments/user-error.mjs +0 -0
  298. /package/{esm2020 → esm2022}/driver/magento/queries/get-billing-address/public_api.mjs +0 -0
  299. /package/{esm2020 → esm2022}/driver/magento/queries/get-billing-address/query.mjs +0 -0
  300. /package/{esm2020 → esm2022}/driver/magento/queries/get-billing-address/response.type.mjs +0 -0
  301. /package/{esm2020 → esm2022}/driver/magento/queries/get-billing-address/variables.type.mjs +0 -0
  302. /package/{esm2020 → esm2022}/driver/magento/queries/get-cart/public_api.mjs +0 -0
  303. /package/{esm2020 → esm2022}/driver/magento/queries/get-cart/query.mjs +0 -0
  304. /package/{esm2020 → esm2022}/driver/magento/queries/get-cart/response.type.mjs +0 -0
  305. /package/{esm2020 → esm2022}/driver/magento/queries/get-cart/variables.type.mjs +0 -0
  306. /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-payment-method/public_api.mjs +0 -0
  307. /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-payment-method/query.mjs +0 -0
  308. /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-payment-method/response.type.mjs +0 -0
  309. /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-payment-method/variables.type.mjs +0 -0
  310. /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-shipping-method/public_api.mjs +0 -0
  311. /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-shipping-method/query.mjs +0 -0
  312. /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-shipping-method/response.type.mjs +0 -0
  313. /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-shipping-method/variables.type.mjs +0 -0
  314. /package/{esm2020 → esm2022}/driver/magento/queries/get-shipping-address/public_api.mjs +0 -0
  315. /package/{esm2020 → esm2022}/driver/magento/queries/get-shipping-address/query.mjs +0 -0
  316. /package/{esm2020 → esm2022}/driver/magento/queries/get-shipping-address/response.type.mjs +0 -0
  317. /package/{esm2020 → esm2022}/driver/magento/queries/get-shipping-address/variables.type.mjs +0 -0
  318. /package/{esm2020 → esm2022}/driver/magento/queries/list-coupons/public_api.mjs +0 -0
  319. /package/{esm2020 → esm2022}/driver/magento/queries/list-coupons/query.mjs +0 -0
  320. /package/{esm2020 → esm2022}/driver/magento/queries/list-coupons/response.type.mjs +0 -0
  321. /package/{esm2020 → esm2022}/driver/magento/queries/list-coupons/variables.type.mjs +0 -0
  322. /package/{esm2020 → esm2022}/driver/magento/queries/list-items/public_api.mjs +0 -0
  323. /package/{esm2020 → esm2022}/driver/magento/queries/list-items/query.mjs +0 -0
  324. /package/{esm2020 → esm2022}/driver/magento/queries/list-items/response.type.mjs +0 -0
  325. /package/{esm2020 → esm2022}/driver/magento/queries/list-items/variables.type.mjs +0 -0
  326. /package/{esm2020 → esm2022}/driver/magento/queries/list-payment-methods/public_api.mjs +0 -0
  327. /package/{esm2020 → esm2022}/driver/magento/queries/list-payment-methods/query.mjs +0 -0
  328. /package/{esm2020 → esm2022}/driver/magento/queries/list-payment-methods/response.type.mjs +0 -0
  329. /package/{esm2020 → esm2022}/driver/magento/queries/list-payment-methods/variables.type.mjs +0 -0
  330. /package/{esm2020 → esm2022}/driver/magento/queries/list-shipping-methods/public_api.mjs +0 -0
  331. /package/{esm2020 → esm2022}/driver/magento/queries/list-shipping-methods/query.mjs +0 -0
  332. /package/{esm2020 → esm2022}/driver/magento/queries/list-shipping-methods/response.type.mjs +0 -0
  333. /package/{esm2020 → esm2022}/driver/magento/queries/list-shipping-methods/variables.type.mjs +0 -0
  334. /package/{esm2020 → esm2022}/driver/magento/queries/merge-carts/public_api.mjs +0 -0
  335. /package/{esm2020 → esm2022}/driver/magento/queries/merge-carts/query.mjs +0 -0
  336. /package/{esm2020 → esm2022}/driver/magento/queries/merge-carts/response.type.mjs +0 -0
  337. /package/{esm2020 → esm2022}/driver/magento/queries/merge-carts/variables.type.mjs +0 -0
  338. /package/{esm2020 → esm2022}/driver/magento/queries/place-order/public_api.mjs +0 -0
  339. /package/{esm2020 → esm2022}/driver/magento/queries/place-order/query.mjs +0 -0
  340. /package/{esm2020 → esm2022}/driver/magento/queries/place-order/response.type.mjs +0 -0
  341. /package/{esm2020 → esm2022}/driver/magento/queries/place-order/variables.type.mjs +0 -0
  342. /package/{esm2020 → esm2022}/driver/magento/queries/public_api.mjs +0 -0
  343. /package/{esm2020 → esm2022}/driver/magento/queries/remove-all-coupons/public_api.mjs +0 -0
  344. /package/{esm2020 → esm2022}/driver/magento/queries/remove-all-coupons/query.mjs +0 -0
  345. /package/{esm2020 → esm2022}/driver/magento/queries/remove-all-coupons/response.type.mjs +0 -0
  346. /package/{esm2020 → esm2022}/driver/magento/queries/remove-all-coupons/variables.type.mjs +0 -0
  347. /package/{esm2020 → esm2022}/driver/magento/queries/remove-item/public_api.mjs +0 -0
  348. /package/{esm2020 → esm2022}/driver/magento/queries/remove-item/query.mjs +0 -0
  349. /package/{esm2020 → esm2022}/driver/magento/queries/remove-item/response.type.mjs +0 -0
  350. /package/{esm2020 → esm2022}/driver/magento/queries/remove-item/variables.type.mjs +0 -0
  351. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method/public_api.mjs +0 -0
  352. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method/query.mjs +0 -0
  353. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method/response.type.mjs +0 -0
  354. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method/variables.type.mjs +0 -0
  355. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing/public_api.mjs +0 -0
  356. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing/query.mjs +0 -0
  357. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing/response.type.mjs +0 -0
  358. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing/variables.type.mjs +0 -0
  359. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing-and-email/public_api.mjs +0 -0
  360. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing-and-email/query.mjs +0 -0
  361. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing-and-email/response.type.mjs +0 -0
  362. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing-and-email/variables.type.mjs +0 -0
  363. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-shipping-method/public_api.mjs +0 -0
  364. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-shipping-method/query.mjs +0 -0
  365. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-shipping-method/response.type.mjs +0 -0
  366. /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-shipping-method/variables.type.mjs +0 -0
  367. /package/{esm2020 → esm2022}/driver/magento/queries/update-address/public_api.mjs +0 -0
  368. /package/{esm2020 → esm2022}/driver/magento/queries/update-address/query.mjs +0 -0
  369. /package/{esm2020 → esm2022}/driver/magento/queries/update-address/response.type.mjs +0 -0
  370. /package/{esm2020 → esm2022}/driver/magento/queries/update-address/variables.type.mjs +0 -0
  371. /package/{esm2020 → esm2022}/driver/magento/queries/update-address-with-email/public_api.mjs +0 -0
  372. /package/{esm2020 → esm2022}/driver/magento/queries/update-address-with-email/query.mjs +0 -0
  373. /package/{esm2020 → esm2022}/driver/magento/queries/update-address-with-email/response.type.mjs +0 -0
  374. /package/{esm2020 → esm2022}/driver/magento/queries/update-address-with-email/variables.type.mjs +0 -0
  375. /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address/public_api.mjs +0 -0
  376. /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address/query.mjs +0 -0
  377. /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address/response.type.mjs +0 -0
  378. /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address/variables.type.mjs +0 -0
  379. /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address-with-email/public_api.mjs +0 -0
  380. /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address-with-email/query.mjs +0 -0
  381. /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address-with-email/response.type.mjs +0 -0
  382. /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address-with-email/variables.type.mjs +0 -0
  383. /package/{esm2020 → esm2022}/driver/magento/queries/update-item/public_api.mjs +0 -0
  384. /package/{esm2020 → esm2022}/driver/magento/queries/update-item/query.mjs +0 -0
  385. /package/{esm2020 → esm2022}/driver/magento/queries/update-item/response.type.mjs +0 -0
  386. /package/{esm2020 → esm2022}/driver/magento/queries/update-item/variables.type.mjs +0 -0
  387. /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address/public_api.mjs +0 -0
  388. /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address/query.mjs +0 -0
  389. /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address/response.type.mjs +0 -0
  390. /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address/variables.type.mjs +0 -0
  391. /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address-with-email/public_api.mjs +0 -0
  392. /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address-with-email/query.mjs +0 -0
  393. /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address-with-email/response.type.mjs +0 -0
  394. /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address-with-email/variables.type.mjs +0 -0
  395. /package/{esm2020 → esm2022}/driver/magento/testing/daffodil-cart-driver-magento-testing.mjs +0 -0
  396. /package/{esm2020 → esm2022}/driver/magento/testing/factories/public_api.mjs +0 -0
  397. /package/{esm2020 → esm2022}/driver/magento/testing/index.mjs +0 -0
  398. /package/{esm2020 → esm2022}/driver/magento/testing/public_api.mjs +0 -0
  399. /package/{esm2020 → esm2022}/driver/magento/transforms/inputs/cart-item-input-transformers.mjs +0 -0
  400. /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-coupon.mjs +0 -0
  401. /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-item/bundle-cart-item-transformer.mjs +0 -0
  402. /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-item/cart-item-transformer.mjs +0 -0
  403. /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-item/configurable-cart-item-transformer.mjs +0 -0
  404. /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-item/simple-cart-item-transformer.mjs +0 -0
  405. /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-totals-transformer.mjs +0 -0
  406. /package/{esm2020 → esm2022}/driver/magento/transforms/public_api.mjs +0 -0
  407. /package/{esm2020 → esm2022}/driver/operators/handle-cart-not-found.mjs +0 -0
  408. /package/{esm2020 → esm2022}/driver/operators/public_api.mjs +0 -0
  409. /package/{esm2020 → esm2022}/driver/public_api.mjs +0 -0
  410. /package/{esm2020 → esm2022}/driver/services/public_api.mjs +0 -0
  411. /package/{esm2020 → esm2022}/driver/testing/daffodil-cart-driver-testing.mjs +0 -0
  412. /package/{esm2020 → esm2022}/driver/testing/drivers/public_api.mjs +0 -0
  413. /package/{esm2020 → esm2022}/driver/testing/index.mjs +0 -0
  414. /package/{esm2020 → esm2022}/driver/testing/public_api.mjs +0 -0
  415. /package/{esm2020 → esm2022}/errors/codes.enum.mjs +0 -0
  416. /package/{esm2020 → esm2022}/errors/map.mjs +0 -0
  417. /package/{esm2020 → esm2022}/errors/public_api.mjs +0 -0
  418. /package/{esm2020 → esm2022}/errors/resolution/cart-not-found-or-created-resolution.mjs +0 -0
  419. /package/{esm2020 → esm2022}/errors/resolution/cart-resolution.mjs +0 -0
  420. /package/{esm2020 → esm2022}/errors/resolution/cart-server-side-resolution.mjs +0 -0
  421. /package/{esm2020 → esm2022}/errors/resolution/cart-storage-resolution.mjs +0 -0
  422. /package/{esm2020 → esm2022}/errors/resolution/public_api.mjs +0 -0
  423. /package/{esm2020 → esm2022}/index.mjs +0 -0
  424. /package/{esm2020 → esm2022}/injection-tokens/payment-method-map.mjs +0 -0
  425. /package/{esm2020 → esm2022}/injection-tokens/public_api.mjs +0 -0
  426. /package/{esm2020 → esm2022}/models/cart-address.mjs +0 -0
  427. /package/{esm2020 → esm2022}/models/cart-coupon.mjs +0 -0
  428. /package/{esm2020 → esm2022}/models/cart-item-input.mjs +0 -0
  429. /package/{esm2020 → esm2022}/models/cart-item.mjs +0 -0
  430. /package/{esm2020 → esm2022}/models/cart-order-result.mjs +0 -0
  431. /package/{esm2020 → esm2022}/models/cart-payment.mjs +0 -0
  432. /package/{esm2020 → esm2022}/models/cart-shipping-info.mjs +0 -0
  433. /package/{esm2020 → esm2022}/models/cart-shipping-rate.mjs +0 -0
  434. /package/{esm2020 → esm2022}/models/cart-total.mjs +0 -0
  435. /package/{esm2020 → esm2022}/models/cart.mjs +0 -0
  436. /package/{esm2020 → esm2022}/models/composite-cart-item.mjs +0 -0
  437. /package/{esm2020 → esm2022}/models/configurable-cart-item.mjs +0 -0
  438. /package/{esm2020 → esm2022}/models/public_api.mjs +0 -0
  439. /package/{esm2020 → esm2022}/public_api.mjs +0 -0
  440. /package/{esm2020 → esm2022}/routing/config/config.mjs +0 -0
  441. /package/{esm2020 → esm2022}/routing/config/resolution/config.mjs +0 -0
  442. /package/{esm2020 → esm2022}/routing/daffodil-cart-routing.mjs +0 -0
  443. /package/{esm2020 → esm2022}/routing/guards/billing-address/billing-address-guard-redirect.token.mjs +0 -0
  444. /package/{esm2020 → esm2022}/routing/guards/cart-items/cart-items-guard-redirect.token.mjs +0 -0
  445. /package/{esm2020 → esm2022}/routing/guards/in-stock-items/in-stock-items-guard-redirect.token.mjs +0 -0
  446. /package/{esm2020 → esm2022}/routing/guards/order-result/order-result-guard-redirect.token.mjs +0 -0
  447. /package/{esm2020 → esm2022}/routing/guards/payment-method/payment-method-guard-redirect.token.mjs +0 -0
  448. /package/{esm2020 → esm2022}/routing/guards/public_api.mjs +0 -0
  449. /package/{esm2020 → esm2022}/routing/guards/resolve-cart/redirect.token.mjs +0 -0
  450. /package/{esm2020 → esm2022}/routing/guards/shipping-address/shipping-address-guard-redirect.token.mjs +0 -0
  451. /package/{esm2020 → esm2022}/routing/guards/shipping-method/shipping-method-guard-redirect.token.mjs +0 -0
  452. /package/{esm2020 → esm2022}/routing/index.mjs +0 -0
  453. /package/{esm2020 → esm2022}/routing/public_api.mjs +0 -0
  454. /package/{esm2020 → esm2022}/routing/resolvers/public_api.mjs +0 -0
  455. /package/{esm2020 → esm2022}/routing/resolvers/tokens/cart-resolver-redirect.token.mjs +0 -0
  456. /package/{esm2020 → esm2022}/routing/resolvers/tokens/empty-cart-resolver-redirect.token.mjs +0 -0
  457. /package/{esm2020 → esm2022}/state/actions/cart-address.actions.mjs +0 -0
  458. /package/{esm2020 → esm2022}/state/actions/cart-billing-address.actions.mjs +0 -0
  459. /package/{esm2020 → esm2022}/state/actions/cart-coupon.actions.mjs +0 -0
  460. /package/{esm2020 → esm2022}/state/actions/cart-item.actions.mjs +0 -0
  461. /package/{esm2020 → esm2022}/state/actions/cart-order.actions.mjs +0 -0
  462. /package/{esm2020 → esm2022}/state/actions/cart-payment-methods.actions.mjs +0 -0
  463. /package/{esm2020 → esm2022}/state/actions/cart-payment.actions.mjs +0 -0
  464. /package/{esm2020 → esm2022}/state/actions/cart-retrieval.mjs +0 -0
  465. /package/{esm2020 → esm2022}/state/actions/cart-shipping-address.actions.mjs +0 -0
  466. /package/{esm2020 → esm2022}/state/actions/cart-shipping-information.actions.mjs +0 -0
  467. /package/{esm2020 → esm2022}/state/actions/cart-shipping-methods.actions.mjs +0 -0
  468. /package/{esm2020 → esm2022}/state/actions/cart.actions.mjs +0 -0
  469. /package/{esm2020 → esm2022}/state/actions/public_api.mjs +0 -0
  470. /package/{esm2020 → esm2022}/state/cart-retrieval/get-response.mjs +0 -0
  471. /package/{esm2020 → esm2022}/state/cart-retrieval/public_api.mjs +0 -0
  472. /package/{esm2020 → esm2022}/state/cart-retrieval/token.mjs +0 -0
  473. /package/{esm2020 → esm2022}/state/cart-retrieval/type.mjs +0 -0
  474. /package/{esm2020 → esm2022}/state/daffodil-cart-state.mjs +0 -0
  475. /package/{esm2020 → esm2022}/state/facades/cart/cart-facade.interface.mjs +0 -0
  476. /package/{esm2020 → esm2022}/state/index.mjs +0 -0
  477. /package/{esm2020 → esm2022}/state/injection-tokens/cart-item-state-debounce-time.mjs +0 -0
  478. /package/{esm2020 → esm2022}/state/injection-tokens/error-matcher.token.mjs +0 -0
  479. /package/{esm2020 → esm2022}/state/injection-tokens/public_api.mjs +0 -0
  480. /package/{esm2020 → esm2022}/state/models/public_api.mjs +0 -0
  481. /package/{esm2020 → esm2022}/state/models/stateful-cart-item.mjs +0 -0
  482. /package/{esm2020 → esm2022}/state/models/stateful-cart.mjs +0 -0
  483. /package/{esm2020 → esm2022}/state/models/stateful-composite-cart-item.mjs +0 -0
  484. /package/{esm2020 → esm2022}/state/models/stateful-configurable-cart-item.mjs +0 -0
  485. /package/{esm2020 → esm2022}/state/public_api.mjs +0 -0
  486. /package/{esm2020 → esm2022}/state/reducers/action-types.type.mjs +0 -0
  487. /package/{esm2020 → esm2022}/state/reducers/cart/cart.reducer.mjs +0 -0
  488. /package/{esm2020 → esm2022}/state/reducers/cart/retrieval-actions.reducer.mjs +0 -0
  489. /package/{esm2020 → esm2022}/state/reducers/cart-billing-address/cart-billing-address.reducer.mjs +0 -0
  490. /package/{esm2020 → esm2022}/state/reducers/cart-coupon/cart-coupon.reducer.mjs +0 -0
  491. /package/{esm2020 → esm2022}/state/reducers/cart-initial-state.mjs +0 -0
  492. /package/{esm2020 → esm2022}/state/reducers/cart-item/cart-item.reducer.mjs +0 -0
  493. /package/{esm2020 → esm2022}/state/reducers/cart-item-entities/cart-item-entities-reducer-adapter.mjs +0 -0
  494. /package/{esm2020 → esm2022}/state/reducers/cart-item-entities/cart-item-entities.reducer.mjs +0 -0
  495. /package/{esm2020 → esm2022}/state/reducers/cart-item-entities/retrieval-actions.reducer.mjs +0 -0
  496. /package/{esm2020 → esm2022}/state/reducers/cart-operation-type.enum.mjs +0 -0
  497. /package/{esm2020 → esm2022}/state/reducers/cart-order/cart-order-initial-state.mjs +0 -0
  498. /package/{esm2020 → esm2022}/state/reducers/cart-order/cart-order-state.interface.mjs +0 -0
  499. /package/{esm2020 → esm2022}/state/reducers/cart-order/cart-order.reducer.mjs +0 -0
  500. /package/{esm2020 → esm2022}/state/reducers/cart-payment/cart-payment.reducer.mjs +0 -0
  501. /package/{esm2020 → esm2022}/state/reducers/cart-payment/payment.reducer.mjs +0 -0
  502. /package/{esm2020 → esm2022}/state/reducers/cart-payment-methods/cart-payment-methods.reducer.mjs +0 -0
  503. /package/{esm2020 → esm2022}/state/reducers/cart-reducers-state.interface.mjs +0 -0
  504. /package/{esm2020 → esm2022}/state/reducers/cart-reducers.mjs +0 -0
  505. /package/{esm2020 → esm2022}/state/reducers/cart-resolve/cart-resolve-state.enum.mjs +0 -0
  506. /package/{esm2020 → esm2022}/state/reducers/cart-resolve/cart-resolve.reducer.mjs +0 -0
  507. /package/{esm2020 → esm2022}/state/reducers/cart-shipping-address/cart-shipping-address.reducer.mjs +0 -0
  508. /package/{esm2020 → esm2022}/state/reducers/cart-shipping-information/cart-shipping-information.reducer.mjs +0 -0
  509. /package/{esm2020 → esm2022}/state/reducers/cart-shipping-methods/cart-shipping-methods.reducer.mjs +0 -0
  510. /package/{esm2020 → esm2022}/state/reducers/cart-state.interface.mjs +0 -0
  511. /package/{esm2020 → esm2022}/state/reducers/cart-store-feature-key.mjs +0 -0
  512. /package/{esm2020 → esm2022}/state/reducers/cart.reducer.mjs +0 -0
  513. /package/{esm2020 → esm2022}/state/reducers/errors/cart-errors.type.mjs +0 -0
  514. /package/{esm2020 → esm2022}/state/reducers/errors/error-state-helpers.mjs +0 -0
  515. /package/{esm2020 → esm2022}/state/reducers/loading/cart-loading.type.mjs +0 -0
  516. /package/{esm2020 → esm2022}/state/reducers/public_api.mjs +0 -0
  517. /package/{esm2020 → esm2022}/state/reducers/token/config.token.mjs +0 -0
  518. /package/{esm2020 → esm2022}/state/reducers/token/extra.token.mjs +0 -0
  519. /package/{esm2020 → esm2022}/state/reducers/token/meta.token.mjs +0 -0
  520. /package/{esm2020 → esm2022}/state/reducers/token/public_api.mjs +0 -0
  521. /package/{esm2020 → esm2022}/state/reducers/token/reducers.token.mjs +0 -0
  522. /package/{esm2020 → esm2022}/state/selectors/cart/cart.selector.mjs +0 -0
  523. /package/{esm2020 → esm2022}/state/selectors/cart-feature.selector.mjs +0 -0
  524. /package/{esm2020 → esm2022}/state/selectors/cart-item-entities/cart-item-entities.selectors.mjs +0 -0
  525. /package/{esm2020 → esm2022}/state/selectors/cart-order/cart-order.selector.mjs +0 -0
  526. /package/{esm2020 → esm2022}/state/selectors/cart.selector.mjs +0 -0
  527. /package/{esm2020 → esm2022}/state/selectors/public_api.mjs +0 -0
  528. /package/{esm2020 → esm2022}/state/testing/daffodil-cart-state-testing.mjs +0 -0
  529. /package/{esm2020 → esm2022}/state/testing/index.mjs +0 -0
  530. /package/{esm2020 → esm2022}/state/testing/public_api.mjs +0 -0
  531. /package/{esm2020 → esm2022}/testing/daffodil-cart-testing.mjs +0 -0
  532. /package/{esm2020 → esm2022}/testing/factories/public_api.mjs +0 -0
  533. /package/{esm2020 → esm2022}/testing/index.mjs +0 -0
  534. /package/{esm2020 → esm2022}/testing/public_api.mjs +0 -0
@@ -1,2777 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Inject, PLATFORM_ID, inject, NgModule } from '@angular/core';
3
- import * as i1$1 from '@ngrx/store';
4
- import { createFeatureSelector, createSelector, defaultMemoize, select, combineReducers, StoreModule } from '@ngrx/store';
5
- import * as i2 from '@daffodil/cart';
6
- import { DaffCartItemInputType, DaffCartTotalTypeEnum, DaffCartResolutionError, DaffCartStorageResolutionError, DaffCartServerSideResolutionError, DaffCartPaymentMethodIdMap } from '@daffodil/cart';
7
- import { daffComparePersonalAddresses } from '@daffodil/geography';
8
- import { createEntityAdapter } from '@ngrx/entity';
9
- import { daffComposeReducers, daffTransformErrorToStateError, daffIdentityReducer } from '@daffodil/core/state';
10
- import * as i4 from '@daffodil/cart/driver';
11
- import { DaffCartDriverErrorCodes, DaffCartAddressDriver, DaffCartBillingAddressDriver, DaffCartCouponDriver, daffCartDriverHandleCartNotFound, DaffCartItemDriver, DaffCartOrderDriver, DaffCartPaymentMethodsDriver, DaffCartPaymentDriver, DaffCartShippingAddressDriver, DaffCartShippingInformationDriver, DaffCartShippingMethodsDriver, DaffCartDriver } from '@daffodil/cart/driver';
12
- import { daffAdd, catchAndArrayifyErrors, DAFF_STORAGE_SERVICE_ERROR_CODE, DaffInheritableError, DAFF_SERVER_STORAGE_SERVICE_ERROR_CODE } from '@daffodil/core';
13
- import * as i1 from '@ngrx/effects';
14
- import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
15
- import { DaffPaymentGenerateTokenFailure, DAFF_PAYMENT_PROCESSOR_COLLECTION, DAFF_PAYMENT_ERROR_MATCHER, DaffPaymentStateReducerAdapter, daffPaymentInitialState, daffPaymentProvideExtraReducers } from '@daffodil/payment/state';
16
- import { defer, of, combineLatest, iif, EMPTY } from 'rxjs';
17
- import { switchMap, map, concatMap, mergeMap, debounceTime, take, tap } from 'rxjs/operators';
18
- import { isPlatformBrowser } from '@angular/common';
19
-
20
- /**
21
- * An enum for the cart action types.
22
- */
23
- var DaffCartActionTypes;
24
- (function (DaffCartActionTypes) {
25
- DaffCartActionTypes["CartStorageFailureAction"] = "[DaffCart] Cart Storage Failure Action";
26
- DaffCartActionTypes["CartLoadAction"] = "[DaffCart] Cart Load Action";
27
- DaffCartActionTypes["CartLoadSuccessAction"] = "[DaffCart] Cart Load Success Action";
28
- DaffCartActionTypes["CartLoadPartialSuccessAction"] = "[DaffCart] Cart Load Partial Success Action";
29
- DaffCartActionTypes["CartLoadFailureAction"] = "[DaffCart] Cart Load Failure Action";
30
- DaffCartActionTypes["CartCreateAction"] = "[DaffCart] Cart Create Action";
31
- DaffCartActionTypes["CartCreateSuccessAction"] = "[DaffCart] Cart Create Success Action";
32
- DaffCartActionTypes["CartCreateFailureAction"] = "[DaffCart] Cart Create Failure Action";
33
- DaffCartActionTypes["AddToCartAction"] = "[DaffCart] Cart Add To Cart Action";
34
- DaffCartActionTypes["AddToCartSuccessAction"] = "[DaffCart] Cart Add to Cart Success Action";
35
- DaffCartActionTypes["AddToCartFailureAction"] = "[DaffCart] Cart Add to Cart Failure Action";
36
- DaffCartActionTypes["CartClearAction"] = "[DaffCart] Cart Reset Action";
37
- DaffCartActionTypes["CartClearSuccessAction"] = "[DaffCart] Cart Reset Success Action";
38
- DaffCartActionTypes["CartClearFailureAction"] = "[DaffCart] Cart Reset Failure Action";
39
- DaffCartActionTypes["ResolveCartAction"] = "[DaffCart] Resolve Cart Action";
40
- DaffCartActionTypes["ResolveCartSuccessAction"] = "[DaffCart] Resolve Cart Success Action";
41
- DaffCartActionTypes["ResolveCartPartialSuccessAction"] = "[DaffCart] Resolve Cart Partial Success Action";
42
- DaffCartActionTypes["ResolveCartServerSideAction"] = "[DaffCart] Resolve Cart Server Side Action";
43
- DaffCartActionTypes["ResolveCartFailureAction"] = "[DaffCart] Resolve Cart Failure Action";
44
- })(DaffCartActionTypes || (DaffCartActionTypes = {}));
45
- /**
46
- * Indicates that an error occured while either reading or writing the cart ID to or from storage.
47
- */
48
- class DaffCartStorageFailure {
49
- constructor(payload) {
50
- this.payload = payload;
51
- this.type = DaffCartActionTypes.CartStorageFailureAction;
52
- }
53
- }
54
- /**
55
- * Triggers the load of the cart.
56
- */
57
- class DaffCartLoad {
58
- constructor() {
59
- this.type = DaffCartActionTypes.CartLoadAction;
60
- }
61
- }
62
- /**
63
- * Indicates the successful load of the cart.
64
- */
65
- class DaffCartLoadSuccess {
66
- constructor(payload) {
67
- this.payload = payload;
68
- this.type = DaffCartActionTypes.CartLoadSuccessAction;
69
- }
70
- }
71
- /**
72
- * An action that indicates a user's cart is loaded but recoverable errors occurred.
73
- * There should be enough data to render the cart
74
- * but the user should probably be shown error messages as well.
75
- * A common example is some cart items being out of stock.
76
- */
77
- class DaffCartLoadPartialSuccess {
78
- constructor(payload, errors) {
79
- this.payload = payload;
80
- this.errors = errors;
81
- this.type = DaffCartActionTypes.CartLoadPartialSuccessAction;
82
- }
83
- }
84
- /**
85
- * Indicates the failed load of the cart.
86
- */
87
- class DaffCartLoadFailure {
88
- constructor(payload) {
89
- this.payload = payload;
90
- this.type = DaffCartActionTypes.CartLoadFailureAction;
91
- }
92
- }
93
- /**
94
- * Triggers the creation of a new cart.
95
- */
96
- class DaffCartCreate {
97
- constructor() {
98
- this.type = DaffCartActionTypes.CartCreateAction;
99
- }
100
- }
101
- /**
102
- * Indicates the successful creation of a new cart.
103
- */
104
- class DaffCartCreateSuccess {
105
- constructor(payload) {
106
- this.payload = payload;
107
- this.type = DaffCartActionTypes.CartCreateSuccessAction;
108
- }
109
- }
110
- /**
111
- * Indicates the failed creation of a new cart.
112
- */
113
- class DaffCartCreateFailure {
114
- constructor(payload) {
115
- this.payload = payload;
116
- this.type = DaffCartActionTypes.CartCreateFailureAction;
117
- }
118
- }
119
- // TODO: deprecate
120
- class DaffAddToCart {
121
- constructor(payload) {
122
- this.payload = payload;
123
- this.type = DaffCartActionTypes.AddToCartAction;
124
- }
125
- }
126
- // TODO: deprecate
127
- class DaffAddToCartSuccess {
128
- constructor(payload) {
129
- this.payload = payload;
130
- this.type = DaffCartActionTypes.AddToCartSuccessAction;
131
- }
132
- }
133
- // TODO: deprecate
134
- class DaffAddToCartFailure {
135
- constructor(payload) {
136
- this.payload = payload;
137
- this.type = DaffCartActionTypes.AddToCartFailureAction;
138
- }
139
- }
140
- /**
141
- * Triggers the removal of all items from the cart.
142
- */
143
- class DaffCartClear {
144
- constructor() {
145
- this.type = DaffCartActionTypes.CartClearAction;
146
- }
147
- }
148
- /**
149
- * Indicates the successful removal of all items from the cart.
150
- */
151
- class DaffCartClearSuccess {
152
- constructor(payload) {
153
- this.payload = payload;
154
- this.type = DaffCartActionTypes.CartClearSuccessAction;
155
- }
156
- }
157
- /**
158
- * Indicates the failed removal of all items from the cart.
159
- */
160
- class DaffCartClearFailure {
161
- constructor(payload) {
162
- this.payload = payload;
163
- this.type = DaffCartActionTypes.CartClearFailureAction;
164
- }
165
- }
166
- /**
167
- * Triggers cart resolution.
168
- * Will attempt to load a cart if it exists and create a cart otherwise.
169
- */
170
- class DaffResolveCart {
171
- constructor() {
172
- this.type = DaffCartActionTypes.ResolveCartAction;
173
- }
174
- }
175
- /**
176
- * An action that indicates a user's cart is resolved successfully.
177
- */
178
- class DaffResolveCartSuccess {
179
- constructor(payload) {
180
- this.payload = payload;
181
- this.type = DaffCartActionTypes.ResolveCartSuccessAction;
182
- }
183
- }
184
- /**
185
- * An action that indicates a user's cart is resolved but recoverable errors occurred.
186
- * There should be enough data to render the cart
187
- * but the user should probably be shown error messages as well.
188
- * A common example is some cart items being out of stock.
189
- */
190
- class DaffResolveCartPartialSuccess {
191
- constructor(payload, errors) {
192
- this.payload = payload;
193
- this.errors = errors;
194
- this.type = DaffCartActionTypes.ResolveCartPartialSuccessAction;
195
- }
196
- }
197
- /**
198
- * An action that indicates that a cart failed to resolve.
199
- */
200
- class DaffResolveCartFailure {
201
- constructor(payload) {
202
- this.payload = payload;
203
- this.type = DaffCartActionTypes.ResolveCartFailureAction;
204
- }
205
- }
206
- /**
207
- * An action indicating that the cart resolution terminated as a result
208
- * of an attempted resolution on the server.
209
- */
210
- class DaffResolveCartServerSide {
211
- constructor(payload) {
212
- this.payload = payload;
213
- this.type = DaffCartActionTypes.ResolveCartServerSideAction;
214
- }
215
- }
216
-
217
- /**
218
- * An enum for the cart item action types.
219
- */
220
- var DaffCartItemActionTypes;
221
- (function (DaffCartItemActionTypes) {
222
- DaffCartItemActionTypes["CartItemListAction"] = "[DaffCart] Cart Items List Action";
223
- DaffCartItemActionTypes["CartItemListSuccessAction"] = "[DaffCart] Cart Items List Success Action";
224
- DaffCartItemActionTypes["CartItemListFailureAction"] = "[DaffCart] Cart Items List Failure Action";
225
- DaffCartItemActionTypes["CartItemLoadAction"] = "[DaffCart] Cart Item Load Action";
226
- DaffCartItemActionTypes["CartItemLoadSuccessAction"] = "[DaffCart] Cart Item Load Success Action";
227
- DaffCartItemActionTypes["CartItemLoadFailureAction"] = "[DaffCart] Cart Item Load Failure Action";
228
- DaffCartItemActionTypes["CartItemUpdateAction"] = "[DaffCart] Cart Item Update Action";
229
- DaffCartItemActionTypes["CartItemUpdateSuccessAction"] = "[DaffCart] Cart Item Update Success Action";
230
- DaffCartItemActionTypes["CartItemUpdateFailureAction"] = "[DaffCart] Cart Item Update Failure Action";
231
- DaffCartItemActionTypes["CartItemAddAction"] = "[DaffCart] Cart Item Add Action";
232
- DaffCartItemActionTypes["CartItemAddSuccessAction"] = "[DaffCart] Cart Item Add Success Action";
233
- DaffCartItemActionTypes["CartItemAddFailureAction"] = "[DaffCart] Cart Item Add Failure Action";
234
- DaffCartItemActionTypes["CartItemDeleteAction"] = "[DaffCart] Cart Item Remove Action";
235
- DaffCartItemActionTypes["CartItemDeleteSuccessAction"] = "[DaffCart] Cart Item Remove Success Action";
236
- DaffCartItemActionTypes["CartItemDeleteFailureAction"] = "[DaffCart] Cart Item Remove Failure Action";
237
- DaffCartItemActionTypes["CartItemDeleteOutOfStockAction"] = "[DaffCart] Cart Item Delete Out Of Stock Action";
238
- DaffCartItemActionTypes["CartItemDeleteOutOfStockSuccessAction"] = "[DaffCart] Cart Item Delete Out Of Stock Success Action";
239
- DaffCartItemActionTypes["CartItemDeleteOutOfStockFailureAction"] = "[DaffCart] Cart Item Delete Out Of Stock Failure Action";
240
- DaffCartItemActionTypes["CartItemStateResetAction"] = "[DaffCart] Cart Item State Reset Action";
241
- })(DaffCartItemActionTypes || (DaffCartItemActionTypes = {}));
242
- /**
243
- * Triggers the load of the cart's items.
244
- */
245
- class DaffCartItemList {
246
- constructor() {
247
- this.type = DaffCartItemActionTypes.CartItemListAction;
248
- }
249
- }
250
- /**
251
- * Indicates the successful load of the cart's items.
252
- */
253
- class DaffCartItemListSuccess {
254
- constructor(payload) {
255
- this.payload = payload;
256
- this.type = DaffCartItemActionTypes.CartItemListSuccessAction;
257
- }
258
- }
259
- /**
260
- * Indicates the failed load of the cart's items.
261
- */
262
- class DaffCartItemListFailure {
263
- constructor(payload) {
264
- this.payload = payload;
265
- this.type = DaffCartItemActionTypes.CartItemListFailureAction;
266
- }
267
- }
268
- /**
269
- * Triggers the load of a specific cart item.
270
- */
271
- class DaffCartItemLoad {
272
- constructor(itemId) {
273
- this.itemId = itemId;
274
- this.type = DaffCartItemActionTypes.CartItemLoadAction;
275
- }
276
- }
277
- /**
278
- * Indicates the successful load of a specific cart item.
279
- */
280
- class DaffCartItemLoadSuccess {
281
- constructor(payload) {
282
- this.payload = payload;
283
- this.type = DaffCartItemActionTypes.CartItemLoadSuccessAction;
284
- }
285
- }
286
- /**
287
- * Indicates the failed load of a specific cart item.
288
- */
289
- class DaffCartItemLoadFailure {
290
- constructor(payload, itemId) {
291
- this.payload = payload;
292
- this.itemId = itemId;
293
- this.type = DaffCartItemActionTypes.CartItemLoadFailureAction;
294
- }
295
- }
296
- /**
297
- * Triggers the update of a specific cart item.
298
- */
299
- class DaffCartItemUpdate {
300
- constructor(itemId, changes) {
301
- this.itemId = itemId;
302
- this.changes = changes;
303
- this.type = DaffCartItemActionTypes.CartItemUpdateAction;
304
- }
305
- }
306
- /**
307
- * Indicates the successful update of a specific cart item.
308
- */
309
- class DaffCartItemUpdateSuccess {
310
- constructor(payload, itemId) {
311
- this.payload = payload;
312
- this.itemId = itemId;
313
- this.type = DaffCartItemActionTypes.CartItemUpdateSuccessAction;
314
- }
315
- }
316
- /**
317
- * Indicates the failed update of a specific cart item.
318
- */
319
- class DaffCartItemUpdateFailure {
320
- constructor(payload, itemId) {
321
- this.payload = payload;
322
- this.itemId = itemId;
323
- this.type = DaffCartItemActionTypes.CartItemUpdateFailureAction;
324
- }
325
- }
326
- /**
327
- * Triggers the addition of a product to the cart.
328
- */
329
- class DaffCartItemAdd {
330
- constructor(input) {
331
- this.input = input;
332
- this.type = DaffCartItemActionTypes.CartItemAddAction;
333
- }
334
- }
335
- /**
336
- * Indicates the successful addition of a product to the cart.
337
- */
338
- class DaffCartItemAddSuccess {
339
- constructor(payload) {
340
- this.payload = payload;
341
- this.type = DaffCartItemActionTypes.CartItemAddSuccessAction;
342
- }
343
- }
344
- /**
345
- * Indicates the failed addition of a product to the cart.
346
- */
347
- class DaffCartItemAddFailure {
348
- constructor(payload) {
349
- this.payload = payload;
350
- this.type = DaffCartItemActionTypes.CartItemAddFailureAction;
351
- }
352
- }
353
- /**
354
- * Triggers the deletion of a specific cart item.
355
- */
356
- class DaffCartItemDelete {
357
- constructor(itemId) {
358
- this.itemId = itemId;
359
- this.type = DaffCartItemActionTypes.CartItemDeleteAction;
360
- }
361
- }
362
- /**
363
- * Indicates the successful deletion of a specific cart item.
364
- */
365
- class DaffCartItemDeleteSuccess {
366
- constructor(payload) {
367
- this.payload = payload;
368
- this.type = DaffCartItemActionTypes.CartItemDeleteSuccessAction;
369
- }
370
- }
371
- /**
372
- * Indicates the failed deletion of a specific cart item.
373
- */
374
- class DaffCartItemDeleteFailure {
375
- constructor(payload, itemId) {
376
- this.payload = payload;
377
- this.itemId = itemId;
378
- this.type = DaffCartItemActionTypes.CartItemDeleteFailureAction;
379
- }
380
- }
381
- /**
382
- * Triggers the deletion of all out of stock cart items.
383
- */
384
- class DaffCartItemDeleteOutOfStock {
385
- constructor() {
386
- this.type = DaffCartItemActionTypes.CartItemDeleteOutOfStockAction;
387
- }
388
- }
389
- /**
390
- * Indicates the successful deletion of all out of stock cart items.
391
- */
392
- class DaffCartItemDeleteOutOfStockSuccess {
393
- constructor(payload) {
394
- this.payload = payload;
395
- this.type = DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction;
396
- }
397
- }
398
- /**
399
- * Indicates the failed deletion of all out of stock cart items.
400
- */
401
- class DaffCartItemDeleteOutOfStockFailure {
402
- constructor(payload) {
403
- this.payload = payload;
404
- this.type = DaffCartItemActionTypes.CartItemDeleteOutOfStockFailureAction;
405
- }
406
- }
407
- /**
408
- * Resets cart item "new" or "updated" states to default.
409
- */
410
- class DaffCartItemStateReset {
411
- constructor() {
412
- this.type = DaffCartItemActionTypes.CartItemStateResetAction;
413
- }
414
- }
415
-
416
- /**
417
- * An enum for the cart billing address action types.
418
- */
419
- var DaffCartBillingAddressActionTypes;
420
- (function (DaffCartBillingAddressActionTypes) {
421
- DaffCartBillingAddressActionTypes["CartBillingAddressLoadAction"] = "[DaffCart] Billing Address Load Action";
422
- DaffCartBillingAddressActionTypes["CartBillingAddressLoadSuccessAction"] = "[DaffCart] Billing Address Load Success Action";
423
- DaffCartBillingAddressActionTypes["CartBillingAddressLoadFailureAction"] = "[DaffCart] Billing Address Load Failure Action";
424
- DaffCartBillingAddressActionTypes["CartBillingAddressUpdateAction"] = "[DaffCart] Billing Address Update Action";
425
- DaffCartBillingAddressActionTypes["CartBillingAddressUpdateSuccessAction"] = "[DaffCart] Billing Address Update Success Action";
426
- DaffCartBillingAddressActionTypes["CartBillingAddressUpdateFailureAction"] = "[DaffCart] Billing Address Update Failure Action";
427
- })(DaffCartBillingAddressActionTypes || (DaffCartBillingAddressActionTypes = {}));
428
- /**
429
- * Triggers the load of the cart's billing address.
430
- */
431
- class DaffCartBillingAddressLoad {
432
- constructor() {
433
- this.type = DaffCartBillingAddressActionTypes.CartBillingAddressLoadAction;
434
- }
435
- }
436
- /**
437
- * Indicates the successful load of the cart's billing address.
438
- */
439
- class DaffCartBillingAddressLoadSuccess {
440
- constructor(payload) {
441
- this.payload = payload;
442
- this.type = DaffCartBillingAddressActionTypes.CartBillingAddressLoadSuccessAction;
443
- }
444
- }
445
- /**
446
- * Indicates the failed load of the cart's billing address.
447
- */
448
- class DaffCartBillingAddressLoadFailure {
449
- constructor(payload) {
450
- this.payload = payload;
451
- this.type = DaffCartBillingAddressActionTypes.CartBillingAddressLoadFailureAction;
452
- }
453
- }
454
- /**
455
- * Triggers the update of the cart's billing address.
456
- */
457
- class DaffCartBillingAddressUpdate {
458
- constructor(payload) {
459
- this.payload = payload;
460
- this.type = DaffCartBillingAddressActionTypes.CartBillingAddressUpdateAction;
461
- }
462
- }
463
- /**
464
- * Indicates the successful update of the cart's billing address.
465
- */
466
- class DaffCartBillingAddressUpdateSuccess {
467
- constructor(payload) {
468
- this.payload = payload;
469
- this.type = DaffCartBillingAddressActionTypes.CartBillingAddressUpdateSuccessAction;
470
- }
471
- }
472
- /**
473
- * Indicates the failed update of the cart's billing address.
474
- */
475
- class DaffCartBillingAddressUpdateFailure {
476
- constructor(payload) {
477
- this.payload = payload;
478
- this.type = DaffCartBillingAddressActionTypes.CartBillingAddressUpdateFailureAction;
479
- }
480
- }
481
-
482
- /**
483
- * An enum for the cart shipping address action types.
484
- */
485
- var DaffCartShippingAddressActionTypes;
486
- (function (DaffCartShippingAddressActionTypes) {
487
- DaffCartShippingAddressActionTypes["CartShippingAddressLoadAction"] = "[DaffCart] Shipping Address Load Action";
488
- DaffCartShippingAddressActionTypes["CartShippingAddressLoadSuccessAction"] = "[DaffCart] Shipping Address Load Success Action";
489
- DaffCartShippingAddressActionTypes["CartShippingAddressLoadFailureAction"] = "[DaffCart] Shipping Address Load Failure Action";
490
- DaffCartShippingAddressActionTypes["CartShippingAddressUpdateAction"] = "[DaffCart] Shipping Address Update Action";
491
- DaffCartShippingAddressActionTypes["CartShippingAddressUpdateSuccessAction"] = "[DaffCart] Shipping Address Update Success Action";
492
- DaffCartShippingAddressActionTypes["CartShippingAddressUpdateFailureAction"] = "[DaffCart] Shipping Address Update Failure Action";
493
- })(DaffCartShippingAddressActionTypes || (DaffCartShippingAddressActionTypes = {}));
494
- /**
495
- * Triggers the load of the cart's shipping address.
496
- */
497
- class DaffCartShippingAddressLoad {
498
- constructor() {
499
- this.type = DaffCartShippingAddressActionTypes.CartShippingAddressLoadAction;
500
- }
501
- }
502
- /**
503
- * Indicates the successful load of the cart's shipping address.
504
- */
505
- class DaffCartShippingAddressLoadSuccess {
506
- constructor(payload) {
507
- this.payload = payload;
508
- this.type = DaffCartShippingAddressActionTypes.CartShippingAddressLoadSuccessAction;
509
- }
510
- }
511
- /**
512
- * Indicates the failed load of the cart's shipping address.
513
- */
514
- class DaffCartShippingAddressLoadFailure {
515
- constructor(payload) {
516
- this.payload = payload;
517
- this.type = DaffCartShippingAddressActionTypes.CartShippingAddressLoadFailureAction;
518
- }
519
- }
520
- /**
521
- * Triggers the update of the cart's shipping address.
522
- */
523
- class DaffCartShippingAddressUpdate {
524
- constructor(payload) {
525
- this.payload = payload;
526
- this.type = DaffCartShippingAddressActionTypes.CartShippingAddressUpdateAction;
527
- }
528
- }
529
- /**
530
- * Indicates the successful update of the cart's shipping address.
531
- */
532
- class DaffCartShippingAddressUpdateSuccess {
533
- constructor(payload) {
534
- this.payload = payload;
535
- this.type = DaffCartShippingAddressActionTypes.CartShippingAddressUpdateSuccessAction;
536
- }
537
- }
538
- /**
539
- * Indicates the failed update of the cart's shipping address.
540
- */
541
- class DaffCartShippingAddressUpdateFailure {
542
- constructor(payload) {
543
- this.payload = payload;
544
- this.type = DaffCartShippingAddressActionTypes.CartShippingAddressUpdateFailureAction;
545
- }
546
- }
547
-
548
- /**
549
- * An enum for the cart address action types.
550
- */
551
- var DaffCartAddressActionTypes;
552
- (function (DaffCartAddressActionTypes) {
553
- DaffCartAddressActionTypes["CartAddressUpdateAction"] = "[DaffCart] Cart Address Update Action";
554
- DaffCartAddressActionTypes["CartAddressUpdateSuccessAction"] = "[DaffCart] Cart Address Update Success Action";
555
- DaffCartAddressActionTypes["CartAddressUpdateFailureAction"] = "[DaffCart] Cart Address Update Failure Action";
556
- })(DaffCartAddressActionTypes || (DaffCartAddressActionTypes = {}));
557
- /**
558
- * Triggers the update of both the shipping and billing address of the cart.
559
- */
560
- class DaffCartAddressUpdate {
561
- constructor(payload) {
562
- this.payload = payload;
563
- this.type = DaffCartAddressActionTypes.CartAddressUpdateAction;
564
- }
565
- }
566
- /**
567
- * Indicates the successful update of both the shipping and billing address of the cart.
568
- */
569
- class DaffCartAddressUpdateSuccess {
570
- constructor(payload) {
571
- this.payload = payload;
572
- this.type = DaffCartAddressActionTypes.CartAddressUpdateSuccessAction;
573
- }
574
- }
575
- /**
576
- * Indicates the failed update of either the shipping or billing address of the cart.
577
- */
578
- class DaffCartAddressUpdateFailure {
579
- constructor(payload) {
580
- this.payload = payload;
581
- this.type = DaffCartAddressActionTypes.CartAddressUpdateFailureAction;
582
- }
583
- }
584
-
585
- /**
586
- * An enum for the cart shipping information action types.
587
- */
588
- var DaffCartShippingInformationActionTypes;
589
- (function (DaffCartShippingInformationActionTypes) {
590
- DaffCartShippingInformationActionTypes["CartShippingInformationLoadAction"] = "[DaffCart] Shipping Information Load Action";
591
- DaffCartShippingInformationActionTypes["CartShippingInformationLoadSuccessAction"] = "[DaffCart] Shipping Information Load Success Action";
592
- DaffCartShippingInformationActionTypes["CartShippingInformationLoadFailureAction"] = "[DaffCart] Shipping Information Load Failure Action";
593
- DaffCartShippingInformationActionTypes["CartShippingInformationUpdateAction"] = "[DaffCart] Shipping Information Update Action";
594
- DaffCartShippingInformationActionTypes["CartShippingInformationUpdateSuccessAction"] = "[DaffCart] Shipping Information Update Success Action";
595
- DaffCartShippingInformationActionTypes["CartShippingInformationUpdateFailureAction"] = "[DaffCart] Shipping Information Update Failure Action";
596
- DaffCartShippingInformationActionTypes["CartShippingInformationDeleteAction"] = "[DaffCart] Shipping Information Remove Action";
597
- DaffCartShippingInformationActionTypes["CartShippingInformationDeleteSuccessAction"] = "[DaffCart] Shipping Information Remove Success Action";
598
- DaffCartShippingInformationActionTypes["CartShippingInformationDeleteFailureAction"] = "[DaffCart] Shipping Information Remove Failure Action";
599
- })(DaffCartShippingInformationActionTypes || (DaffCartShippingInformationActionTypes = {}));
600
- /**
601
- * Triggers the load of the cart's shipping information.
602
- */
603
- class DaffCartShippingInformationLoad {
604
- constructor() {
605
- this.type = DaffCartShippingInformationActionTypes.CartShippingInformationLoadAction;
606
- }
607
- }
608
- /**
609
- * Indicates the successful load of the cart's shipping information.
610
- */
611
- class DaffCartShippingInformationLoadSuccess {
612
- constructor(payload) {
613
- this.payload = payload;
614
- this.type = DaffCartShippingInformationActionTypes.CartShippingInformationLoadSuccessAction;
615
- }
616
- }
617
- /**
618
- * Indicates the failed load of the cart's shipping information.
619
- */
620
- class DaffCartShippingInformationLoadFailure {
621
- constructor(payload) {
622
- this.payload = payload;
623
- this.type = DaffCartShippingInformationActionTypes.CartShippingInformationLoadFailureAction;
624
- }
625
- }
626
- /**
627
- * Triggers the update of the cart's shipping information.
628
- */
629
- class DaffCartShippingInformationUpdate {
630
- constructor(payload) {
631
- this.payload = payload;
632
- this.type = DaffCartShippingInformationActionTypes.CartShippingInformationUpdateAction;
633
- }
634
- }
635
- /**
636
- * Indicates the successful update of the cart's shipping information.
637
- */
638
- class DaffCartShippingInformationUpdateSuccess {
639
- constructor(payload) {
640
- this.payload = payload;
641
- this.type = DaffCartShippingInformationActionTypes.CartShippingInformationUpdateSuccessAction;
642
- }
643
- }
644
- /**
645
- * Indicates the failed update of the cart's shipping information.
646
- */
647
- class DaffCartShippingInformationUpdateFailure {
648
- constructor(payload) {
649
- this.payload = payload;
650
- this.type = DaffCartShippingInformationActionTypes.CartShippingInformationUpdateFailureAction;
651
- }
652
- }
653
- /**
654
- * Triggers the deletion of the cart's shipping information.
655
- */
656
- class DaffCartShippingInformationDelete {
657
- constructor(id) {
658
- this.id = id;
659
- this.type = DaffCartShippingInformationActionTypes.CartShippingInformationDeleteAction;
660
- }
661
- }
662
- class DaffCartShippingInformationDeleteSuccess {
663
- constructor(payload) {
664
- this.payload = payload;
665
- this.type = DaffCartShippingInformationActionTypes.CartShippingInformationDeleteSuccessAction;
666
- }
667
- }
668
- class DaffCartShippingInformationDeleteFailure {
669
- constructor(payload) {
670
- this.payload = payload;
671
- this.type = DaffCartShippingInformationActionTypes.CartShippingInformationDeleteFailureAction;
672
- }
673
- }
674
-
675
- /**
676
- * An enum for the cart shipping methods action types.
677
- */
678
- var DaffCartShippingMethodsActionTypes;
679
- (function (DaffCartShippingMethodsActionTypes) {
680
- DaffCartShippingMethodsActionTypes["CartShippingMethodsLoadAction"] = "[DaffCart] Shipping Methods Load Action";
681
- DaffCartShippingMethodsActionTypes["CartShippingMethodsLoadSuccessAction"] = "[DaffCart] Shipping Methods Load Success Action";
682
- DaffCartShippingMethodsActionTypes["CartShippingMethodsLoadFailureAction"] = "[DaffCart] Shipping Methods Load Failure Action";
683
- })(DaffCartShippingMethodsActionTypes || (DaffCartShippingMethodsActionTypes = {}));
684
- /**
685
- * Triggers the load of the cart's available shipping methods.
686
- */
687
- class DaffCartShippingMethodsLoad {
688
- constructor() {
689
- this.type = DaffCartShippingMethodsActionTypes.CartShippingMethodsLoadAction;
690
- }
691
- }
692
- class DaffCartShippingMethodsLoadSuccess {
693
- constructor(payload) {
694
- this.payload = payload;
695
- this.type = DaffCartShippingMethodsActionTypes.CartShippingMethodsLoadSuccessAction;
696
- }
697
- }
698
- class DaffCartShippingMethodsLoadFailure {
699
- constructor(payload) {
700
- this.payload = payload;
701
- this.type = DaffCartShippingMethodsActionTypes.CartShippingMethodsLoadFailureAction;
702
- }
703
- }
704
-
705
- /**
706
- * An enum for the cart payment action types.
707
- */
708
- var DaffCartPaymentActionTypes;
709
- (function (DaffCartPaymentActionTypes) {
710
- DaffCartPaymentActionTypes["CartPaymentLoadAction"] = "[DaffCart] Payment Load Action";
711
- DaffCartPaymentActionTypes["CartPaymentLoadSuccessAction"] = "[DaffCart] Payment Load Success Action";
712
- DaffCartPaymentActionTypes["CartPaymentLoadFailureAction"] = "[DaffCart] Payment Load Failure Action";
713
- DaffCartPaymentActionTypes["CartPaymentUpdateAction"] = "[DaffCart] Payment Update Action";
714
- DaffCartPaymentActionTypes["CartPaymentUpdateSuccessAction"] = "[DaffCart] Payment Update Success Action";
715
- DaffCartPaymentActionTypes["CartPaymentUpdateFailureAction"] = "[DaffCart] Payment Update Failure Action";
716
- DaffCartPaymentActionTypes["CartPaymentUpdateWithBillingAction"] = "[DaffCart] Payment Update With Billing Action";
717
- DaffCartPaymentActionTypes["CartPaymentUpdateWithBillingSuccessAction"] = "[DaffCart] Payment Update With Billing Success Action";
718
- DaffCartPaymentActionTypes["CartPaymentUpdateWithBillingFailureAction"] = "[DaffCart] Payment Update With Billing Failure Action";
719
- DaffCartPaymentActionTypes["CartPaymentRemoveAction"] = "[DaffCart] Payment Remove Action";
720
- DaffCartPaymentActionTypes["CartPaymentRemoveSuccessAction"] = "[DaffCart] Payment Remove Success Action";
721
- DaffCartPaymentActionTypes["CartPaymentRemoveFailureAction"] = "[DaffCart] Payment Remove Failure Action";
722
- DaffCartPaymentActionTypes["CartPaymentMethodAddAction"] = "[DaffCart] Payment Method Add Action";
723
- })(DaffCartPaymentActionTypes || (DaffCartPaymentActionTypes = {}));
724
- /**
725
- * Triggers the load of the cart's selected payment method.
726
- */
727
- class DaffCartPaymentLoad {
728
- constructor() {
729
- this.type = DaffCartPaymentActionTypes.CartPaymentLoadAction;
730
- }
731
- }
732
- /**
733
- * Indicates the successful load of the cart's selected payment method.
734
- */
735
- class DaffCartPaymentLoadSuccess {
736
- constructor(payload) {
737
- this.payload = payload;
738
- this.type = DaffCartPaymentActionTypes.CartPaymentLoadSuccessAction;
739
- }
740
- }
741
- /**
742
- * Indicates the failed load of the cart's selected payment method.
743
- */
744
- class DaffCartPaymentLoadFailure {
745
- constructor(payload) {
746
- this.payload = payload;
747
- this.type = DaffCartPaymentActionTypes.CartPaymentLoadFailureAction;
748
- }
749
- }
750
- /**
751
- * Triggers the update of the cart's selected payment method.
752
- */
753
- class DaffCartPaymentUpdate {
754
- constructor(payload) {
755
- this.payload = payload;
756
- this.type = DaffCartPaymentActionTypes.CartPaymentUpdateAction;
757
- }
758
- }
759
- /**
760
- * Indicates the successful update of the cart's selected payment method.
761
- */
762
- class DaffCartPaymentUpdateSuccess {
763
- constructor(payload) {
764
- this.payload = payload;
765
- this.type = DaffCartPaymentActionTypes.CartPaymentUpdateSuccessAction;
766
- }
767
- }
768
- /**
769
- * Indicates the failed update of the cart's selected payment method.
770
- */
771
- class DaffCartPaymentUpdateFailure {
772
- constructor(payload) {
773
- this.payload = payload;
774
- this.type = DaffCartPaymentActionTypes.CartPaymentUpdateFailureAction;
775
- }
776
- }
777
- /**
778
- * Triggers an update of the cart's selected payment method and billing address.
779
- *
780
- * @param payment The payment method.
781
- * @param address The billing address.
782
- */
783
- class DaffCartPaymentUpdateWithBilling {
784
- constructor(payment, address) {
785
- this.payment = payment;
786
- this.address = address;
787
- this.type = DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingAction;
788
- }
789
- }
790
- /**
791
- * Indicates the success of an update of the cart's selected payment method and billing address.
792
- *
793
- * @param payload The updated cart.
794
- */
795
- class DaffCartPaymentUpdateWithBillingSuccess {
796
- constructor(payload) {
797
- this.payload = payload;
798
- this.type = DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingSuccessAction;
799
- }
800
- }
801
- /**
802
- * Indicates the failure of an update of the cart's selected payment method and billing address.
803
- *
804
- * @param payload The error message.
805
- */
806
- class DaffCartPaymentUpdateWithBillingFailure {
807
- constructor(payload) {
808
- this.payload = payload;
809
- this.type = DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingFailureAction;
810
- }
811
- }
812
- /**
813
- * Triggers the removal of the cart's selected payment method.
814
- */
815
- class DaffCartPaymentRemove {
816
- constructor() {
817
- this.type = DaffCartPaymentActionTypes.CartPaymentRemoveAction;
818
- }
819
- }
820
- /**
821
- * Indicates the successful removal of the cart's selected payment method.
822
- */
823
- class DaffCartPaymentRemoveSuccess {
824
- constructor() {
825
- this.type = DaffCartPaymentActionTypes.CartPaymentRemoveSuccessAction;
826
- }
827
- }
828
- /**
829
- * Indicates the failed removal of the cart's selected payment method.
830
- */
831
- class DaffCartPaymentRemoveFailure {
832
- constructor(payload) {
833
- this.payload = payload;
834
- this.type = DaffCartPaymentActionTypes.CartPaymentRemoveFailureAction;
835
- }
836
- }
837
- /**
838
- * This action is temporary until custom reducers can be injected by the @daffodil/paymentSource modules. Right now,
839
- * the payment modules need a way to update cart state with a payment token.
840
- *
841
- * todo: remove when possible.
842
- */
843
- class DaffCartPaymentMethodAdd {
844
- constructor(payload) {
845
- this.payload = payload;
846
- this.type = DaffCartPaymentActionTypes.CartPaymentMethodAddAction;
847
- }
848
- }
849
-
850
- /**
851
- * An enum for the cart payment methods action types.
852
- */
853
- var DaffCartPaymentMethodsActionTypes;
854
- (function (DaffCartPaymentMethodsActionTypes) {
855
- DaffCartPaymentMethodsActionTypes["CartPaymentMethodsLoadAction"] = "[DaffCart] Payment Methods Load Action";
856
- DaffCartPaymentMethodsActionTypes["CartPaymentMethodsLoadSuccessAction"] = "[DaffCart] Payment Methods Load Success Action";
857
- DaffCartPaymentMethodsActionTypes["CartPaymentMethodsLoadFailureAction"] = "[DaffCart] Payment Methods Load Failure Action";
858
- })(DaffCartPaymentMethodsActionTypes || (DaffCartPaymentMethodsActionTypes = {}));
859
- /**
860
- * Triggers the load of the cart's available payment methods.
861
- */
862
- class DaffCartPaymentMethodsLoad {
863
- constructor() {
864
- this.type = DaffCartPaymentMethodsActionTypes.CartPaymentMethodsLoadAction;
865
- }
866
- }
867
- /**
868
- * Indicates the successful load of the cart's available payment methods.
869
- */
870
- class DaffCartPaymentMethodsLoadSuccess {
871
- constructor(payload) {
872
- this.payload = payload;
873
- this.type = DaffCartPaymentMethodsActionTypes.CartPaymentMethodsLoadSuccessAction;
874
- }
875
- }
876
- /**
877
- * Indicates the failed load of the cart's available payment methods.
878
- */
879
- class DaffCartPaymentMethodsLoadFailure {
880
- constructor(payload) {
881
- this.payload = payload;
882
- this.type = DaffCartPaymentMethodsActionTypes.CartPaymentMethodsLoadFailureAction;
883
- }
884
- }
885
-
886
- /**
887
- * An enum for the cart order action types.
888
- */
889
- var DaffCartOrderActionTypes;
890
- (function (DaffCartOrderActionTypes) {
891
- DaffCartOrderActionTypes["CartPlaceOrderAction"] = "[DaffCart] Cart Place Order Action";
892
- DaffCartOrderActionTypes["CartPlaceOrderSuccessAction"] = "[DaffCart] Cart Place Order Success Action";
893
- DaffCartOrderActionTypes["CartPlaceOrderFailureAction"] = "[DaffCart] Cart Place Order Failure Action";
894
- })(DaffCartOrderActionTypes || (DaffCartOrderActionTypes = {}));
895
- /**
896
- * Triggers the order placement for a cart.
897
- */
898
- class DaffCartPlaceOrder {
899
- constructor(payload) {
900
- this.payload = payload;
901
- this.type = DaffCartOrderActionTypes.CartPlaceOrderAction;
902
- }
903
- }
904
- /**
905
- * Indicates the successful order placement for a cart.
906
- */
907
- class DaffCartPlaceOrderSuccess {
908
- constructor(payload) {
909
- this.payload = payload;
910
- this.type = DaffCartOrderActionTypes.CartPlaceOrderSuccessAction;
911
- }
912
- }
913
- /**
914
- * Indicates the failed order placement for a cart.
915
- */
916
- class DaffCartPlaceOrderFailure {
917
- constructor(payload) {
918
- this.payload = payload;
919
- this.type = DaffCartOrderActionTypes.CartPlaceOrderFailureAction;
920
- }
921
- }
922
-
923
- /**
924
- * An enum for the cart coupon action types.
925
- */
926
- var DaffCartCouponActionTypes;
927
- (function (DaffCartCouponActionTypes) {
928
- DaffCartCouponActionTypes["CartCouponApplyAction"] = "[DaffCart] Cart Coupon Apply Action";
929
- DaffCartCouponActionTypes["CartCouponApplySuccessAction"] = "[DaffCart] Cart Coupon Apply Success Action";
930
- DaffCartCouponActionTypes["CartCouponApplyFailureAction"] = "[DaffCart] Cart Coupon Apply Failure Action";
931
- DaffCartCouponActionTypes["CartCouponListAction"] = "[DaffCart] Cart Coupon List Action";
932
- DaffCartCouponActionTypes["CartCouponListSuccessAction"] = "[DaffCart] Cart Coupon List Success Action";
933
- DaffCartCouponActionTypes["CartCouponListFailureAction"] = "[DaffCart] Cart Coupon List Failure Action";
934
- DaffCartCouponActionTypes["CartCouponRemoveAction"] = "[DaffCart] Cart Coupon Remove Action";
935
- DaffCartCouponActionTypes["CartCouponRemoveSuccessAction"] = "[DaffCart] Cart Coupon Remove Success Action";
936
- DaffCartCouponActionTypes["CartCouponRemoveFailureAction"] = "[DaffCart] Cart Coupon Remove Failure Action";
937
- DaffCartCouponActionTypes["CartCouponRemoveAllAction"] = "[DaffCart] Cart Coupon Remove All Action";
938
- DaffCartCouponActionTypes["CartCouponRemoveAllSuccessAction"] = "[DaffCart] Cart Coupon Remove All Success Action";
939
- DaffCartCouponActionTypes["CartCouponRemoveAllFailureAction"] = "[DaffCart] Cart Coupon Remove All Failure Action";
940
- DaffCartCouponActionTypes["CartCouponClearErrorsAction"] = "[DaffCart] Cart Coupon Clear Errors Action";
941
- })(DaffCartCouponActionTypes || (DaffCartCouponActionTypes = {}));
942
- /**
943
- * Triggers the application of a cart coupon.
944
- */
945
- class DaffCartCouponApply {
946
- constructor(payload) {
947
- this.payload = payload;
948
- this.type = DaffCartCouponActionTypes.CartCouponApplyAction;
949
- }
950
- }
951
- /**
952
- * Indicates the successful application of a cart coupon.
953
- */
954
- class DaffCartCouponApplySuccess {
955
- constructor(payload) {
956
- this.payload = payload;
957
- this.type = DaffCartCouponActionTypes.CartCouponApplySuccessAction;
958
- }
959
- }
960
- /**
961
- * Indicates the failed application of a cart coupon.
962
- */
963
- class DaffCartCouponApplyFailure {
964
- constructor(payload) {
965
- this.payload = payload;
966
- this.type = DaffCartCouponActionTypes.CartCouponApplyFailureAction;
967
- }
968
- }
969
- /**
970
- * Triggers the load of the cart's coupons.
971
- */
972
- class DaffCartCouponList {
973
- constructor() {
974
- this.type = DaffCartCouponActionTypes.CartCouponListAction;
975
- }
976
- }
977
- /**
978
- * Indicates the successful load of the cart's coupons.
979
- */
980
- class DaffCartCouponListSuccess {
981
- constructor(payload) {
982
- this.payload = payload;
983
- this.type = DaffCartCouponActionTypes.CartCouponListSuccessAction;
984
- }
985
- }
986
- /**
987
- * Indicates the failed load of the cart's coupons.
988
- */
989
- class DaffCartCouponListFailure {
990
- constructor(payload) {
991
- this.payload = payload;
992
- this.type = DaffCartCouponActionTypes.CartCouponListFailureAction;
993
- }
994
- }
995
- /**
996
- * Triggers the removal of a cart coupon.
997
- */
998
- class DaffCartCouponRemove {
999
- constructor(payload) {
1000
- this.payload = payload;
1001
- this.type = DaffCartCouponActionTypes.CartCouponRemoveAction;
1002
- }
1003
- }
1004
- /**
1005
- * Indicates the successful removal of a cart coupon.
1006
- */
1007
- class DaffCartCouponRemoveSuccess {
1008
- constructor(payload) {
1009
- this.payload = payload;
1010
- this.type = DaffCartCouponActionTypes.CartCouponRemoveSuccessAction;
1011
- }
1012
- }
1013
- /**
1014
- * Indicates the failed removal of a cart coupon.
1015
- */
1016
- class DaffCartCouponRemoveFailure {
1017
- constructor(payload) {
1018
- this.payload = payload;
1019
- this.type = DaffCartCouponActionTypes.CartCouponRemoveFailureAction;
1020
- }
1021
- }
1022
- /**
1023
- * Triggers the removal of all of the cart's coupons.
1024
- */
1025
- class DaffCartCouponRemoveAll {
1026
- constructor() {
1027
- this.type = DaffCartCouponActionTypes.CartCouponRemoveAllAction;
1028
- }
1029
- }
1030
- /**
1031
- * Indicates the successful removal of all of the cart's coupons.
1032
- */
1033
- class DaffCartCouponRemoveAllSuccess {
1034
- constructor(payload) {
1035
- this.payload = payload;
1036
- this.type = DaffCartCouponActionTypes.CartCouponRemoveAllSuccessAction;
1037
- }
1038
- }
1039
- /**
1040
- * Indicates the failed removal of all of the cart's coupons.
1041
- */
1042
- class DaffCartCouponRemoveAllFailure {
1043
- constructor(payload) {
1044
- this.payload = payload;
1045
- this.type = DaffCartCouponActionTypes.CartCouponRemoveAllFailureAction;
1046
- }
1047
- }
1048
- /**
1049
- * Removes the errors in cart coupon state.
1050
- */
1051
- class DaffCartCouponClearErrors {
1052
- constructor() {
1053
- this.type = DaffCartCouponActionTypes.CartCouponClearErrorsAction;
1054
- }
1055
- }
1056
-
1057
- /**
1058
- * A list of the Daffodil cart actions that are cart retrieval actions, in injection form.
1059
- */
1060
- const daffCartRetrivalActions = [
1061
- {
1062
- type: DaffCartItemActionTypes.CartItemAddSuccessAction,
1063
- },
1064
- {
1065
- type: DaffCartItemActionTypes.CartItemUpdateSuccessAction,
1066
- },
1067
- {
1068
- type: DaffCartItemActionTypes.CartItemDeleteSuccessAction,
1069
- },
1070
- {
1071
- type: DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction,
1072
- },
1073
- {
1074
- type: DaffCartActionTypes.CartLoadSuccessAction,
1075
- },
1076
- {
1077
- type: DaffCartActionTypes.ResolveCartSuccessAction,
1078
- },
1079
- {
1080
- type: DaffCartActionTypes.CartLoadPartialSuccessAction,
1081
- },
1082
- {
1083
- type: DaffCartActionTypes.ResolveCartPartialSuccessAction,
1084
- },
1085
- {
1086
- type: DaffCartActionTypes.CartClearSuccessAction,
1087
- },
1088
- {
1089
- type: DaffCartAddressActionTypes.CartAddressUpdateSuccessAction,
1090
- },
1091
- {
1092
- type: DaffCartBillingAddressActionTypes.CartBillingAddressUpdateSuccessAction,
1093
- },
1094
- {
1095
- type: DaffCartCouponActionTypes.CartCouponApplySuccessAction,
1096
- },
1097
- {
1098
- type: DaffCartCouponActionTypes.CartCouponRemoveSuccessAction,
1099
- },
1100
- {
1101
- type: DaffCartCouponActionTypes.CartCouponRemoveAllSuccessAction,
1102
- },
1103
- {
1104
- type: DaffCartPaymentActionTypes.CartPaymentUpdateSuccessAction,
1105
- },
1106
- {
1107
- type: DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingSuccessAction,
1108
- },
1109
- {
1110
- type: DaffCartShippingAddressActionTypes.CartShippingAddressUpdateSuccessAction,
1111
- },
1112
- {
1113
- type: DaffCartShippingInformationActionTypes.CartShippingInformationUpdateSuccessAction,
1114
- },
1115
- {
1116
- type: DaffCartShippingInformationActionTypes.CartShippingInformationDeleteSuccessAction,
1117
- },
1118
- ];
1119
-
1120
- /**
1121
- * A token to hold {@link DaffCartRetrievalActionInjection}s.
1122
- */
1123
- const DAFF_CART_RETRIEVAL_ACTIONS = new InjectionToken('DAFF_CART_RETRIEVAL_ACTIONS', { factory: () => [] });
1124
- /**
1125
- * A provider function for {@link DAFF_CART_RETRIEVAL_ACTIONS}.
1126
- */
1127
- const daffCartProvideRetrievalActions = (...actions) => actions.map((action) => ({
1128
- provide: DAFF_CART_RETRIEVAL_ACTIONS,
1129
- useValue: action,
1130
- multi: true,
1131
- }));
1132
-
1133
- /**
1134
- * Gets the cart from the passed action if it is a recognized retrieval action and applies the transformation if needed.
1135
- * If the action is not recognized as a retrieval action, returns `null`.
1136
- */
1137
- function daffCartRetrievalGetResponse(action, retrievalActions) {
1138
- var _a;
1139
- const actionInjection = retrievalActions.find(({ type }) => type === action.type);
1140
- if (actionInjection) {
1141
- return ((_a = actionInjection.transform) === null || _a === void 0 ? void 0 : _a.call(actionInjection, action)) || action.payload;
1142
- }
1143
- return null;
1144
- }
1145
-
1146
- /**
1147
- * Cart Item Entities Adapter for changing/overwriting entity state.
1148
- */
1149
- const daffCartItemEntitiesAdapter = (() => {
1150
- let cache;
1151
- return () => cache = cache || createEntityAdapter({ selectId: item => item.id });
1152
- })();
1153
-
1154
- var DaffCartItemStateEnum;
1155
- (function (DaffCartItemStateEnum) {
1156
- DaffCartItemStateEnum["New"] = "new";
1157
- DaffCartItemStateEnum["Updated"] = "updated";
1158
- DaffCartItemStateEnum["Mutating"] = "mutating";
1159
- DaffCartItemStateEnum["Error"] = "error";
1160
- DaffCartItemStateEnum["Default"] = "default";
1161
- })(DaffCartItemStateEnum || (DaffCartItemStateEnum = {}));
1162
-
1163
- /**
1164
- * Reducer function that catches actions and changes/overwrites product entities state.
1165
- *
1166
- * @param state current State of the redux store
1167
- * @param action CartItemGrid, BestSellers, or CartItem actions
1168
- * @returns CartItem entities state
1169
- */
1170
- function daffCartItemEntitiesReducer(state = daffCartItemEntitiesAdapter().getInitialState(), action) {
1171
- var _a, _b;
1172
- const adapter = daffCartItemEntitiesAdapter();
1173
- switch (action.type) {
1174
- case DaffCartItemActionTypes.CartItemListSuccessAction:
1175
- return adapter.setAll(action.payload.map(item => (Object.assign(Object.assign({}, item), { daffState: getDaffState(state.entities[item.id]) || DaffCartItemStateEnum.Default, daffErrors: [] }))), state);
1176
- case DaffCartItemActionTypes.CartItemLoadSuccessAction:
1177
- return adapter.upsertOne(Object.assign(Object.assign({}, action.payload), { daffState: getDaffState(state.entities[action.payload.id]) || DaffCartItemStateEnum.Default, daffErrors: [] }), state);
1178
- case DaffCartItemActionTypes.CartItemDeleteFailureAction:
1179
- case DaffCartItemActionTypes.CartItemLoadFailureAction:
1180
- case DaffCartItemActionTypes.CartItemUpdateFailureAction:
1181
- return adapter.upsertOne(Object.assign(Object.assign({}, state.entities[action.itemId]), { daffState: DaffCartItemStateEnum.Error, daffErrors: ((_b = (_a = state.entities[action.itemId]) === null || _a === void 0 ? void 0 : _a.daffErrors) === null || _b === void 0 ? void 0 : _b.concat(action.payload)) || action.payload }), state);
1182
- case DaffCartItemActionTypes.CartItemStateResetAction:
1183
- return adapter.setAll(Object.keys(state.entities).map(key => (Object.assign(Object.assign({}, state.entities[key]), { daffState: DaffCartItemStateEnum.Default }))), state);
1184
- case DaffCartItemActionTypes.CartItemUpdateAction:
1185
- case DaffCartItemActionTypes.CartItemDeleteAction:
1186
- return adapter.upsertOne(Object.assign(Object.assign({}, state.entities[action.itemId]), { daffState: DaffCartItemStateEnum.Mutating }), state);
1187
- case DaffCartActionTypes.CartCreateSuccessAction:
1188
- return adapter.removeAll(state);
1189
- default:
1190
- return state;
1191
- }
1192
- }
1193
- function getDaffState(item) {
1194
- return item === null || item === void 0 ? void 0 : item.daffState;
1195
- }
1196
-
1197
- const daffCartOrderInitialState = {
1198
- cartOrderResult: {
1199
- id: null,
1200
- orderId: null,
1201
- cartId: null,
1202
- },
1203
- loading: "Stable" /* DaffState.Complete */,
1204
- errors: [],
1205
- };
1206
-
1207
- function daffCartOrderReducer(state = daffCartOrderInitialState, action) {
1208
- switch (action.type) {
1209
- case DaffCartOrderActionTypes.CartPlaceOrderAction:
1210
- return Object.assign(Object.assign({}, state), { loading: "Mutating" /* DaffState.Mutating */ });
1211
- case DaffCartOrderActionTypes.CartPlaceOrderSuccessAction:
1212
- return Object.assign(Object.assign({}, state), { errors: [], loading: "Stable" /* DaffState.Complete */, cartOrderResult: action.payload });
1213
- case DaffCartOrderActionTypes.CartPlaceOrderFailureAction:
1214
- return Object.assign(Object.assign({}, state), { loading: "Stable" /* DaffState.Complete */, errors: action.payload });
1215
- case DaffCartActionTypes.CartClearSuccessAction:
1216
- case DaffCartActionTypes.CartCreateSuccessAction:
1217
- case DaffCartActionTypes.AddToCartSuccessAction:
1218
- case DaffCartBillingAddressActionTypes.CartBillingAddressUpdateSuccessAction:
1219
- case DaffCartShippingAddressActionTypes.CartShippingAddressUpdateSuccessAction:
1220
- case DaffCartAddressActionTypes.CartAddressUpdateSuccessAction:
1221
- case DaffCartCouponActionTypes.CartCouponApplySuccessAction:
1222
- case DaffCartCouponActionTypes.CartCouponRemoveSuccessAction:
1223
- case DaffCartCouponActionTypes.CartCouponRemoveAllSuccessAction:
1224
- case DaffCartItemActionTypes.CartItemUpdateSuccessAction:
1225
- case DaffCartItemActionTypes.CartItemAddSuccessAction:
1226
- case DaffCartItemActionTypes.CartItemDeleteSuccessAction:
1227
- case DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction:
1228
- case DaffCartPaymentActionTypes.CartPaymentRemoveSuccessAction:
1229
- case DaffCartPaymentActionTypes.CartPaymentUpdateSuccessAction:
1230
- case DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingSuccessAction:
1231
- case DaffCartShippingInformationActionTypes.CartShippingInformationUpdateSuccessAction:
1232
- case DaffCartShippingInformationActionTypes.CartShippingInformationDeleteSuccessAction:
1233
- return Object.assign(Object.assign({}, state), { errors: [] });
1234
- default:
1235
- return state;
1236
- }
1237
- }
1238
-
1239
- /**
1240
- * The particular segment of DaffCart that an operation applies to.
1241
- * Errors and loading are tracked separately for each type of cart operation.
1242
- */
1243
- // TODO: think of a better name
1244
- var DaffCartOperationType;
1245
- (function (DaffCartOperationType) {
1246
- DaffCartOperationType["Cart"] = "Cart";
1247
- DaffCartOperationType["Item"] = "Item";
1248
- DaffCartOperationType["BillingAddress"] = "Billing Address";
1249
- DaffCartOperationType["ShippingAddress"] = "Shipping Address";
1250
- DaffCartOperationType["Payment"] = "Payment";
1251
- DaffCartOperationType["PaymentMethods"] = "Payment Methods";
1252
- DaffCartOperationType["ShippingInformation"] = "Shipping Information";
1253
- DaffCartOperationType["ShippingMethods"] = "Shipping Methods";
1254
- DaffCartOperationType["Coupon"] = "Coupon";
1255
- })(DaffCartOperationType || (DaffCartOperationType = {}));
1256
-
1257
- var DaffCartResolveState;
1258
- (function (DaffCartResolveState) {
1259
- DaffCartResolveState["Default"] = "default";
1260
- DaffCartResolveState["Resolving"] = "resolving";
1261
- DaffCartResolveState["Succeeded"] = "succeeded";
1262
- DaffCartResolveState["Failed"] = "failed";
1263
- DaffCartResolveState["ServerSide"] = "server";
1264
- })(DaffCartResolveState || (DaffCartResolveState = {}));
1265
-
1266
- const daffCartReducerInitialState = Object.freeze({
1267
- cart: {
1268
- id: null,
1269
- subtotal: null,
1270
- grand_total: null,
1271
- coupons: [],
1272
- items: [],
1273
- billing_address: null,
1274
- shipping_address: null,
1275
- payment: null,
1276
- totals: [],
1277
- shipping_information: null,
1278
- available_shipping_methods: [],
1279
- available_payment_methods: [],
1280
- },
1281
- loading: {
1282
- // TODO: replace const casts with const type in TS5
1283
- [DaffCartOperationType.Cart]: "Stable" /* DaffState.Stable */,
1284
- [DaffCartOperationType.Item]: "Stable" /* DaffState.Stable */,
1285
- [DaffCartOperationType.ShippingAddress]: "Stable" /* DaffState.Stable */,
1286
- [DaffCartOperationType.BillingAddress]: "Stable" /* DaffState.Stable */,
1287
- [DaffCartOperationType.ShippingInformation]: "Stable" /* DaffState.Stable */,
1288
- [DaffCartOperationType.ShippingMethods]: "Stable" /* DaffState.Stable */,
1289
- [DaffCartOperationType.Payment]: "Stable" /* DaffState.Stable */,
1290
- [DaffCartOperationType.PaymentMethods]: "Stable" /* DaffState.Stable */,
1291
- [DaffCartOperationType.Coupon]: "Stable" /* DaffState.Stable */,
1292
- },
1293
- errors: {
1294
- [DaffCartOperationType.Cart]: [],
1295
- [DaffCartOperationType.Item]: [],
1296
- [DaffCartOperationType.ShippingAddress]: [],
1297
- [DaffCartOperationType.BillingAddress]: [],
1298
- [DaffCartOperationType.ShippingInformation]: [],
1299
- [DaffCartOperationType.ShippingMethods]: [],
1300
- [DaffCartOperationType.Payment]: [],
1301
- [DaffCartOperationType.PaymentMethods]: [],
1302
- [DaffCartOperationType.Coupon]: [],
1303
- },
1304
- resolved: DaffCartResolveState.Default,
1305
- });
1306
-
1307
- const initializeErrorAdder = (errorSpace) => (errors, ...errorsToAdd) => ({
1308
- errors: Object.assign(Object.assign({}, errors), { [errorSpace]: errors[errorSpace].concat(errorsToAdd) }),
1309
- });
1310
- const initializeErrorResetter = (errorSpace) => (errors) => ({
1311
- errors: Object.assign(Object.assign({}, errors), { [errorSpace]: [] }),
1312
- });
1313
-
1314
- const initializeLoadingSetter = (loadingSpace) => (loadingObj, loading) => ({
1315
- loading: Object.assign(Object.assign({}, loadingObj), { [loadingSpace]: loading }),
1316
- });
1317
-
1318
- const addError$8 = initializeErrorAdder(DaffCartOperationType.Cart);
1319
- const resetErrors$8 = initializeErrorResetter(DaffCartOperationType.Cart);
1320
- const setLoading$8 = initializeLoadingSetter(DaffCartOperationType.Cart);
1321
- function cartReducer(state = daffCartReducerInitialState, action) {
1322
- switch (action.type) {
1323
- case DaffCartActionTypes.ResolveCartAction:
1324
- case DaffCartActionTypes.CartLoadAction:
1325
- return Object.assign(Object.assign({}, state), setLoading$8(state.loading, "Resolving" /* DaffState.Resolving */));
1326
- case DaffCartActionTypes.CartClearAction:
1327
- case DaffCartActionTypes.AddToCartAction:
1328
- case DaffCartActionTypes.CartCreateAction:
1329
- return Object.assign(Object.assign({}, state), setLoading$8(state.loading, "Mutating" /* DaffState.Mutating */));
1330
- case DaffCartActionTypes.CartLoadSuccessAction:
1331
- case DaffCartActionTypes.CartClearSuccessAction:
1332
- case DaffCartActionTypes.AddToCartSuccessAction:
1333
- case DaffCartActionTypes.ResolveCartSuccessAction:
1334
- return Object.assign(Object.assign(Object.assign({}, state), resetErrors$8(state.errors)), setLoading$8(state.loading, "Stable" /* DaffState.Stable */));
1335
- case DaffCartActionTypes.CartCreateSuccessAction:
1336
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$8(state.errors)), { cart: Object.assign(Object.assign({}, daffCartReducerInitialState.cart), action.payload) }), setLoading$8(state.loading, "Stable" /* DaffState.Stable */));
1337
- case DaffCartActionTypes.CartClearFailureAction:
1338
- case DaffCartActionTypes.AddToCartFailureAction:
1339
- case DaffCartActionTypes.CartCreateFailureAction:
1340
- case DaffCartActionTypes.CartStorageFailureAction:
1341
- case DaffCartActionTypes.CartLoadFailureAction:
1342
- case DaffCartActionTypes.ResolveCartFailureAction:
1343
- return Object.assign(Object.assign(Object.assign({}, state), addError$8(state.errors, ...action.payload)), setLoading$8(state.loading, "Stable" /* DaffState.Stable */));
1344
- case DaffCartActionTypes.ResolveCartPartialSuccessAction:
1345
- case DaffCartActionTypes.CartLoadPartialSuccessAction:
1346
- return Object.assign(Object.assign(Object.assign({}, state), addError$8(state.errors, ...action.errors)), setLoading$8(state.loading, "Stable" /* DaffState.Stable */));
1347
- default:
1348
- return state;
1349
- }
1350
- }
1351
-
1352
- const addError$7 = initializeErrorAdder(DaffCartOperationType.BillingAddress);
1353
- const resetErrors$7 = initializeErrorResetter(DaffCartOperationType.BillingAddress);
1354
- const setLoading$7 = initializeLoadingSetter(DaffCartOperationType.BillingAddress);
1355
- function cartBillingAddressReducer(state = daffCartReducerInitialState, action) {
1356
- switch (action.type) {
1357
- case DaffCartBillingAddressActionTypes.CartBillingAddressLoadAction:
1358
- return Object.assign(Object.assign({}, state), setLoading$7(state.loading, "Resolving" /* DaffState.Resolving */));
1359
- case DaffCartBillingAddressActionTypes.CartBillingAddressUpdateAction:
1360
- case DaffCartAddressActionTypes.CartAddressUpdateAction:
1361
- return Object.assign(Object.assign({}, state), setLoading$7(state.loading, "Mutating" /* DaffState.Mutating */));
1362
- case DaffCartBillingAddressActionTypes.CartBillingAddressLoadSuccessAction:
1363
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$7(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), { billing_address: action.payload }) }), setLoading$7(state.loading, "Stable" /* DaffState.Complete */));
1364
- case DaffCartBillingAddressActionTypes.CartBillingAddressUpdateSuccessAction:
1365
- case DaffCartAddressActionTypes.CartAddressUpdateSuccessAction:
1366
- return Object.assign(Object.assign(Object.assign({}, state), resetErrors$7(state.errors)), setLoading$7(state.loading, "Stable" /* DaffState.Complete */));
1367
- case DaffCartBillingAddressActionTypes.CartBillingAddressLoadFailureAction:
1368
- case DaffCartBillingAddressActionTypes.CartBillingAddressUpdateFailureAction:
1369
- case DaffCartAddressActionTypes.CartAddressUpdateFailureAction:
1370
- return Object.assign(Object.assign(Object.assign({}, state), addError$7(state.errors, ...action.payload)), setLoading$7(state.loading, "Stable" /* DaffState.Complete */));
1371
- default:
1372
- return state;
1373
- }
1374
- }
1375
-
1376
- const addError$6 = initializeErrorAdder(DaffCartOperationType.Coupon);
1377
- const resetErrors$6 = initializeErrorResetter(DaffCartOperationType.Coupon);
1378
- const setLoading$6 = initializeLoadingSetter(DaffCartOperationType.Coupon);
1379
- function cartCouponReducer(state = daffCartReducerInitialState, action) {
1380
- switch (action.type) {
1381
- case DaffCartCouponActionTypes.CartCouponListAction:
1382
- return Object.assign(Object.assign({}, state), setLoading$6(state.loading, "Resolving" /* DaffState.Resolving */));
1383
- case DaffCartCouponActionTypes.CartCouponApplyAction:
1384
- case DaffCartCouponActionTypes.CartCouponRemoveAction:
1385
- case DaffCartCouponActionTypes.CartCouponRemoveAllAction:
1386
- return Object.assign(Object.assign({}, state), setLoading$6(state.loading, "Mutating" /* DaffState.Mutating */));
1387
- case DaffCartCouponActionTypes.CartCouponApplySuccessAction:
1388
- case DaffCartCouponActionTypes.CartCouponRemoveSuccessAction:
1389
- case DaffCartCouponActionTypes.CartCouponRemoveAllSuccessAction:
1390
- return Object.assign(Object.assign(Object.assign({}, state), resetErrors$6(state.errors)), setLoading$6(state.loading, "Stable" /* DaffState.Complete */));
1391
- case DaffCartCouponActionTypes.CartCouponClearErrorsAction:
1392
- return Object.assign(Object.assign({}, state), resetErrors$6(state.errors));
1393
- case DaffCartCouponActionTypes.CartCouponListSuccessAction:
1394
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$6(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), { coupons: action.payload }) }), setLoading$6(state.loading, "Stable" /* DaffState.Complete */));
1395
- case DaffCartCouponActionTypes.CartCouponApplyFailureAction:
1396
- case DaffCartCouponActionTypes.CartCouponListFailureAction:
1397
- case DaffCartCouponActionTypes.CartCouponRemoveAllFailureAction:
1398
- case DaffCartCouponActionTypes.CartCouponRemoveFailureAction:
1399
- return Object.assign(Object.assign(Object.assign({}, state), addError$6(state.errors, ...action.payload)), setLoading$6(state.loading, "Stable" /* DaffState.Complete */));
1400
- default:
1401
- return state;
1402
- }
1403
- }
1404
-
1405
- const addError$5 = initializeErrorAdder(DaffCartOperationType.Item);
1406
- const resetErrors$5 = initializeErrorResetter(DaffCartOperationType.Item);
1407
- const setLoading$5 = initializeLoadingSetter(DaffCartOperationType.Item);
1408
- function cartItemReducer(state = daffCartReducerInitialState, action) {
1409
- switch (action.type) {
1410
- case DaffCartItemActionTypes.CartItemListAction:
1411
- case DaffCartItemActionTypes.CartItemLoadAction:
1412
- return Object.assign(Object.assign({}, state), setLoading$5(state.loading, "Resolving" /* DaffState.Resolving */));
1413
- case DaffCartItemActionTypes.CartItemUpdateAction:
1414
- case DaffCartItemActionTypes.CartItemDeleteAction:
1415
- case DaffCartItemActionTypes.CartItemDeleteOutOfStockAction:
1416
- return Object.assign(Object.assign({}, state), setLoading$5(state.loading, "Mutating" /* DaffState.Mutating */));
1417
- case DaffCartItemActionTypes.CartItemAddAction:
1418
- return Object.assign(Object.assign({}, state), setLoading$5(state.loading, "Adding" /* DaffState.Adding */));
1419
- case DaffCartItemActionTypes.CartItemListSuccessAction:
1420
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$5(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), { items: action.payload }) }), setLoading$5(state.loading, "Stable" /* DaffState.Complete */));
1421
- case DaffCartItemActionTypes.CartItemLoadSuccessAction:
1422
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$5(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), { items: state.cart.items.map(item => item.id === action.payload.id
1423
- ? action.payload
1424
- : item) }) }), setLoading$5(state.loading, "Stable" /* DaffState.Complete */));
1425
- case DaffCartItemActionTypes.CartItemUpdateSuccessAction:
1426
- case DaffCartItemActionTypes.CartItemAddSuccessAction:
1427
- case DaffCartItemActionTypes.CartItemDeleteSuccessAction:
1428
- return Object.assign(Object.assign(Object.assign({}, state), resetErrors$5(state.errors)), setLoading$5(state.loading, "Stable" /* DaffState.Complete */));
1429
- case DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction:
1430
- return Object.assign(Object.assign(Object.assign({}, state), { errors: Object.assign(Object.assign({}, state.errors), { [DaffCartOperationType.Item]: [],
1431
- // out of stock errors can be in the main cart, remove them here
1432
- [DaffCartOperationType.Cart]: state.errors[DaffCartOperationType.Cart].filter(({ code }) => code !== DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK) }) }), setLoading$5(state.loading, "Stable" /* DaffState.Complete */));
1433
- case DaffCartItemActionTypes.CartItemListFailureAction:
1434
- case DaffCartItemActionTypes.CartItemLoadFailureAction:
1435
- case DaffCartItemActionTypes.CartItemAddFailureAction:
1436
- case DaffCartItemActionTypes.CartItemDeleteOutOfStockFailureAction:
1437
- return Object.assign(Object.assign(Object.assign({}, state), addError$5(state.errors, ...action.payload)), setLoading$5(state.loading, "Stable" /* DaffState.Complete */));
1438
- case DaffCartItemActionTypes.CartItemUpdateFailureAction:
1439
- case DaffCartItemActionTypes.CartItemDeleteFailureAction:
1440
- return Object.assign(Object.assign({}, state), setLoading$5(state.loading, "Stable" /* DaffState.Complete */));
1441
- default:
1442
- return state;
1443
- }
1444
- }
1445
-
1446
- const addError$4 = initializeErrorAdder(DaffCartOperationType.Payment);
1447
- const resetErrors$4 = initializeErrorResetter(DaffCartOperationType.Payment);
1448
- const setLoading$4 = initializeLoadingSetter(DaffCartOperationType.Payment);
1449
- function cartPaymentReducer(state = daffCartReducerInitialState, action) {
1450
- switch (action.type) {
1451
- case DaffCartPaymentActionTypes.CartPaymentLoadAction:
1452
- return Object.assign(Object.assign({}, state), setLoading$4(state.loading, "Resolving" /* DaffState.Resolving */));
1453
- case DaffCartPaymentActionTypes.CartPaymentUpdateAction:
1454
- case DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingAction:
1455
- case DaffCartPaymentActionTypes.CartPaymentRemoveAction:
1456
- return Object.assign(Object.assign({}, state), setLoading$4(state.loading, "Mutating" /* DaffState.Mutating */));
1457
- case DaffCartPaymentActionTypes.CartPaymentLoadSuccessAction:
1458
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$4(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), { payment: action.payload }) }), setLoading$4(state.loading, "Stable" /* DaffState.Complete */));
1459
- case DaffCartPaymentActionTypes.CartPaymentRemoveSuccessAction:
1460
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$4(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), { payment: null }) }), setLoading$4(state.loading, "Stable" /* DaffState.Complete */));
1461
- case DaffCartPaymentActionTypes.CartPaymentUpdateSuccessAction:
1462
- case DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingSuccessAction:
1463
- return Object.assign(Object.assign(Object.assign({}, state), resetErrors$4(state.errors)), setLoading$4(state.loading, "Stable" /* DaffState.Complete */));
1464
- case DaffCartPaymentActionTypes.CartPaymentLoadFailureAction:
1465
- case DaffCartPaymentActionTypes.CartPaymentUpdateFailureAction:
1466
- case DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingFailureAction:
1467
- case DaffCartPaymentActionTypes.CartPaymentRemoveFailureAction:
1468
- return Object.assign(Object.assign(Object.assign({}, state), addError$4(state.errors, ...action.payload)), setLoading$4(state.loading, "Stable" /* DaffState.Complete */));
1469
- /**
1470
- * This reducer is temporary until custom reducers can be injected by the @daffodil/paymentSource modules. Right now,
1471
- * the payment modules need a way to update cart state with a payment token.
1472
- *
1473
- * todo: remove when possible.
1474
- */
1475
- case DaffCartPaymentActionTypes.CartPaymentMethodAddAction:
1476
- return Object.assign(Object.assign({}, state), { cart: Object.assign(Object.assign({}, state.cart), { payment: Object.assign({}, action.payload) }) });
1477
- default:
1478
- return state;
1479
- }
1480
- }
1481
-
1482
- const addError$3 = initializeErrorAdder(DaffCartOperationType.PaymentMethods);
1483
- const resetErrors$3 = initializeErrorResetter(DaffCartOperationType.PaymentMethods);
1484
- const setLoading$3 = initializeLoadingSetter(DaffCartOperationType.PaymentMethods);
1485
- function cartPaymentMethodsReducer(state = daffCartReducerInitialState, action) {
1486
- switch (action.type) {
1487
- case DaffCartPaymentMethodsActionTypes.CartPaymentMethodsLoadAction:
1488
- return Object.assign(Object.assign({}, state), setLoading$3(state.loading, "Resolving" /* DaffState.Resolving */));
1489
- case DaffCartPaymentMethodsActionTypes.CartPaymentMethodsLoadSuccessAction:
1490
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$3(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), { available_payment_methods: action.payload }) }), setLoading$3(state.loading, "Stable" /* DaffState.Complete */));
1491
- case DaffCartPaymentMethodsActionTypes.CartPaymentMethodsLoadFailureAction:
1492
- return Object.assign(Object.assign(Object.assign({}, state), addError$3(state.errors, ...action.payload)), setLoading$3(state.loading, "Stable" /* DaffState.Complete */));
1493
- default:
1494
- return state;
1495
- }
1496
- }
1497
-
1498
- function cartResolveReducer(state = daffCartReducerInitialState, action) {
1499
- switch (action.type) {
1500
- case DaffCartActionTypes.ResolveCartAction:
1501
- return Object.assign(Object.assign({}, state), { resolved: DaffCartResolveState.Resolving });
1502
- case DaffCartActionTypes.ResolveCartServerSideAction:
1503
- return Object.assign(Object.assign({}, state), { resolved: DaffCartResolveState.ServerSide });
1504
- case DaffCartActionTypes.ResolveCartSuccessAction:
1505
- case DaffCartActionTypes.CartLoadSuccessAction:
1506
- case DaffCartActionTypes.CartCreateSuccessAction:
1507
- return Object.assign(Object.assign({}, state), { resolved: DaffCartResolveState.Succeeded });
1508
- case DaffCartActionTypes.ResolveCartFailureAction:
1509
- return Object.assign(Object.assign({}, state), { resolved: DaffCartResolveState.Failed });
1510
- default:
1511
- return state;
1512
- }
1513
- }
1514
-
1515
- const addError$2 = initializeErrorAdder(DaffCartOperationType.ShippingAddress);
1516
- const resetErrors$2 = initializeErrorResetter(DaffCartOperationType.ShippingAddress);
1517
- const setLoading$2 = initializeLoadingSetter(DaffCartOperationType.ShippingAddress);
1518
- function cartShippingAddressReducer(state = daffCartReducerInitialState, action) {
1519
- switch (action.type) {
1520
- case DaffCartShippingAddressActionTypes.CartShippingAddressLoadAction:
1521
- return Object.assign(Object.assign({}, state), setLoading$2(state.loading, "Resolving" /* DaffState.Resolving */));
1522
- case DaffCartShippingAddressActionTypes.CartShippingAddressUpdateAction:
1523
- case DaffCartAddressActionTypes.CartAddressUpdateAction:
1524
- return Object.assign(Object.assign({}, state), setLoading$2(state.loading, "Mutating" /* DaffState.Mutating */));
1525
- case DaffCartShippingAddressActionTypes.CartShippingAddressLoadSuccessAction:
1526
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$2(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), { shipping_address: action.payload }) }), setLoading$2(state.loading, "Stable" /* DaffState.Complete */));
1527
- case DaffCartShippingAddressActionTypes.CartShippingAddressUpdateSuccessAction:
1528
- case DaffCartAddressActionTypes.CartAddressUpdateSuccessAction:
1529
- return Object.assign(Object.assign(Object.assign({}, state), resetErrors$2(state.errors)), setLoading$2(state.loading, "Stable" /* DaffState.Complete */));
1530
- case DaffCartShippingAddressActionTypes.CartShippingAddressLoadFailureAction:
1531
- case DaffCartShippingAddressActionTypes.CartShippingAddressUpdateFailureAction:
1532
- case DaffCartAddressActionTypes.CartAddressUpdateFailureAction:
1533
- return Object.assign(Object.assign(Object.assign({}, state), addError$2(state.errors, ...action.payload)), setLoading$2(state.loading, "Stable" /* DaffState.Complete */));
1534
- default:
1535
- return state;
1536
- }
1537
- }
1538
-
1539
- const addError$1 = initializeErrorAdder(DaffCartOperationType.ShippingInformation);
1540
- const resetErrors$1 = initializeErrorResetter(DaffCartOperationType.ShippingInformation);
1541
- const setLoading$1 = initializeLoadingSetter(DaffCartOperationType.ShippingInformation);
1542
- function cartShippingInformationReducer(state = daffCartReducerInitialState, action) {
1543
- switch (action.type) {
1544
- case DaffCartShippingInformationActionTypes.CartShippingInformationLoadAction:
1545
- return Object.assign(Object.assign({}, state), setLoading$1(state.loading, "Resolving" /* DaffState.Resolving */));
1546
- case DaffCartShippingInformationActionTypes.CartShippingInformationUpdateAction:
1547
- case DaffCartShippingInformationActionTypes.CartShippingInformationDeleteAction:
1548
- return Object.assign(Object.assign({}, state), setLoading$1(state.loading, "Mutating" /* DaffState.Mutating */));
1549
- case DaffCartShippingInformationActionTypes.CartShippingInformationLoadSuccessAction:
1550
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$1(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), {
1551
- // TODO: remove workaround
1552
- shipping_information: Object.assign(Object.assign({}, action.payload), { address_id: null }) }) }), setLoading$1(state.loading, "Stable" /* DaffState.Complete */));
1553
- case DaffCartShippingInformationActionTypes.CartShippingInformationUpdateSuccessAction:
1554
- case DaffCartShippingInformationActionTypes.CartShippingInformationDeleteSuccessAction:
1555
- return Object.assign(Object.assign(Object.assign({}, state), resetErrors$1(state.errors)), setLoading$1(state.loading, "Stable" /* DaffState.Complete */));
1556
- case DaffCartShippingInformationActionTypes.CartShippingInformationLoadFailureAction:
1557
- case DaffCartShippingInformationActionTypes.CartShippingInformationUpdateFailureAction:
1558
- case DaffCartShippingInformationActionTypes.CartShippingInformationDeleteFailureAction:
1559
- return Object.assign(Object.assign(Object.assign({}, state), addError$1(state.errors, ...action.payload)), setLoading$1(state.loading, "Stable" /* DaffState.Complete */));
1560
- default:
1561
- return state;
1562
- }
1563
- }
1564
-
1565
- const addError = initializeErrorAdder(DaffCartOperationType.ShippingMethods);
1566
- const resetErrors = initializeErrorResetter(DaffCartOperationType.ShippingMethods);
1567
- const setLoading = initializeLoadingSetter(DaffCartOperationType.ShippingMethods);
1568
- function cartShippingMethodsReducer(state = daffCartReducerInitialState, action) {
1569
- switch (action.type) {
1570
- case DaffCartShippingMethodsActionTypes.CartShippingMethodsLoadAction:
1571
- return Object.assign(Object.assign({}, state), setLoading(state.loading, "Resolving" /* DaffState.Resolving */));
1572
- case DaffCartShippingMethodsActionTypes.CartShippingMethodsLoadSuccessAction:
1573
- return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), { available_shipping_methods: action.payload }) }), setLoading(state.loading, "Stable" /* DaffState.Complete */));
1574
- case DaffCartShippingMethodsActionTypes.CartShippingMethodsLoadFailureAction:
1575
- return Object.assign(Object.assign(Object.assign({}, state), addError(state.errors, ...action.payload)), setLoading(state.loading, "Stable" /* DaffState.Complete */));
1576
- default:
1577
- return state;
1578
- }
1579
- }
1580
-
1581
- const composedReducers = daffComposeReducers([
1582
- cartReducer,
1583
- cartItemReducer,
1584
- cartBillingAddressReducer,
1585
- cartShippingAddressReducer,
1586
- cartShippingMethodsReducer,
1587
- cartShippingInformationReducer,
1588
- cartPaymentReducer,
1589
- cartPaymentMethodsReducer,
1590
- cartCouponReducer,
1591
- cartResolveReducer,
1592
- ]);
1593
- /**
1594
- * Calls each of the individual cart reducers in turn,
1595
- * passing the returned state into the next.
1596
- */
1597
- function daffCartReducer(state = daffCartReducerInitialState, action) {
1598
- return composedReducers(state, action);
1599
- }
1600
-
1601
- const daffCartReducers = {
1602
- cart: daffCartReducer,
1603
- cartItems: daffCartItemEntitiesReducer,
1604
- order: daffCartOrderReducer,
1605
- };
1606
-
1607
- const DAFF_CART_STORE_FEATURE_KEY = 'daffCart';
1608
-
1609
- /**
1610
- * Reducer function factory that updates cart item entities according to a list of passed cart retrieval actions.
1611
- * See {@link DaffCartRetrievalActionInjection}.
1612
- */
1613
- function daffCartItemEntitiesRetrievalActionsReducerFactory(retrievalActions) {
1614
- return (state = daffCartItemEntitiesAdapter().getInitialState(), action) => {
1615
- const adapter = daffCartItemEntitiesAdapter();
1616
- const cart = daffCartRetrievalGetResponse(action, retrievalActions);
1617
- return (cart === null || cart === void 0 ? void 0 : cart.items)
1618
- ? adapter.setAll(cart.items.map((item) => {
1619
- var _a;
1620
- return (Object.assign(Object.assign({}, item), { daffState: item.daffState || ((_a = state.entities[item.id]) === null || _a === void 0 ? void 0 : _a.daffState) || DaffCartItemStateEnum.Default }));
1621
- }), state)
1622
- : state;
1623
- };
1624
- }
1625
-
1626
- /**
1627
- * Reducer function factory that updates cart state according to a list of passed cart retrieval actions.
1628
- * See {@link DaffCartRetrievalActionInjection}.
1629
- */
1630
- function daffCartRetrievalActionsReducerFactory(retrievalActions) {
1631
- return (state = daffCartReducerInitialState, action) => {
1632
- const cart = daffCartRetrievalGetResponse(action, retrievalActions);
1633
- return cart
1634
- ? Object.assign(Object.assign({}, state), { cart: Object.assign(Object.assign({}, state.cart), cart) }) : state;
1635
- };
1636
- }
1637
-
1638
- /**
1639
- * A token to hold the injectable extra reducers.
1640
- *
1641
- * Prefer using {@link daffCartProvideExtraReducers}.
1642
- */
1643
- const DAFF_CART_EXTRA_REDUCERS = new InjectionToken('DAFF_CART_EXTRA_REDUCERS', { factory: () => [] });
1644
- /**
1645
- * Provides additional reducers that run after the standard Daffodil cart reducers.
1646
- *
1647
- * ```ts
1648
- * providers: [
1649
- * ...daffCartProvideExtraReducers(
1650
- * myReducer1,
1651
- * myReducer2
1652
- * )
1653
- * ]
1654
- * ```
1655
- */
1656
- function daffCartProvideExtraReducers(...reducers) {
1657
- return reducers.map(reducer => ({
1658
- provide: DAFF_CART_EXTRA_REDUCERS,
1659
- useValue: reducer,
1660
- multi: true,
1661
- }));
1662
- }
1663
-
1664
- /**
1665
- * A token to hold the injectable extra meta-reducers.
1666
- *
1667
- * Prefer using {@link daffCartProvideMetaReducers}.
1668
- */
1669
- const DAFF_CART_META_REDUCERS = new InjectionToken('DAFF_CART_META_REDUCERS', { factory: () => [] });
1670
- /**
1671
- * Provides additional meta-reducers that run after the standard Daffodil cart meta-reducers.
1672
- *
1673
- * ```ts
1674
- * providers: [
1675
- * ...daffCartProvideMetaReducers(
1676
- * myMetaReducer1,
1677
- * myMetaReducer2
1678
- * )
1679
- * ]
1680
- * ```
1681
- */
1682
- function daffCartProvideMetaReducers(...metaReducers) {
1683
- return metaReducers.map(metaReducer => ({
1684
- provide: DAFF_CART_META_REDUCERS,
1685
- useValue: metaReducer,
1686
- multi: true,
1687
- }));
1688
- }
1689
-
1690
- const getDaffCartFeatureSelector = (() => {
1691
- let cache;
1692
- return () => cache = cache
1693
- ? cache
1694
- : {
1695
- selectCartFeatureState: createFeatureSelector(DAFF_CART_STORE_FEATURE_KEY),
1696
- };
1697
- })();
1698
-
1699
- const createCartItemEntitiesSelectors = () => {
1700
- const { selectCartFeatureState, } = getDaffCartFeatureSelector();
1701
- const adapterSelectors = daffCartItemEntitiesAdapter().getSelectors();
1702
- /**
1703
- * CartItem Entities State
1704
- */
1705
- const selectCartItemEntitiesState = createSelector(selectCartFeatureState, (state) => state.cartItems);
1706
- /**
1707
- * Adapters created with @ngrx/entity generate
1708
- * commonly used selector functions including
1709
- * getting all ids in the record set, a dictionary
1710
- * of the records by id, an array of records and
1711
- * the total number of records. This reduces boilerplate
1712
- * in selecting records from the entity state.
1713
- */
1714
- /**
1715
- * Selector for product IDs.
1716
- */
1717
- const selectCartItemIds = createSelector(selectCartItemEntitiesState, adapterSelectors.selectIds);
1718
- /**
1719
- * Selector for all product entities (see ngrx/entity).
1720
- */
1721
- const selectCartItemEntities = createSelector(selectCartItemEntitiesState, adapterSelectors.selectEntities);
1722
- /**
1723
- * Selector for all products on state.
1724
- */
1725
- const selectAllCartItems = createSelector(selectCartItemEntitiesState, adapterSelectors.selectAll);
1726
- /**
1727
- * Selector for the total number of products.
1728
- */
1729
- const selectCartItemTotal = createSelector(selectCartItemEntitiesState, adapterSelectors.selectTotal);
1730
- const selectCartItem = defaultMemoize((itemId) => createSelector(selectCartItemEntities, cartItems => cartItems[itemId])).memoized;
1731
- /**
1732
- * Selector for the total number of cart items that takes into account the qty on each cart item.
1733
- */
1734
- const selectTotalNumberOfCartItems = createSelector(selectAllCartItems, (cartItems) => cartItems.reduce((acc, cartItem) => acc + cartItem.qty, 0));
1735
- const selectCartItemConfiguredAttributes = defaultMemoize((itemId) => createSelector(selectCartItem(itemId), (cartItem) => {
1736
- if (cartItem.type !== DaffCartItemInputType.Configurable) {
1737
- return null;
1738
- }
1739
- return cartItem.attributes;
1740
- })).memoized;
1741
- const selectCartItemCompositeOptions = defaultMemoize((itemId) => createSelector(selectCartItem(itemId), (cartItem) => {
1742
- if (cartItem.type !== DaffCartItemInputType.Composite) {
1743
- return null;
1744
- }
1745
- return cartItem.options;
1746
- })).memoized;
1747
- const selectIsCartItemOutOfStock = defaultMemoize((itemId) => createSelector(selectCartItem(itemId), (cartItem) => cartItem ? !cartItem.in_stock : null)).memoized;
1748
- const selectOutOfStockCartItems = createSelector(selectAllCartItems, items => items.filter(item => !item.in_stock));
1749
- const selectInStockCartItems = createSelector(selectAllCartItems, items => items.filter(item => item.in_stock));
1750
- const selectCartItemMutating = createSelector(selectAllCartItems, (cartItems) => cartItems === null || cartItems === void 0 ? void 0 : cartItems.reduce((acc, item) => acc || item.daffState === DaffCartItemStateEnum.Mutating, false));
1751
- const selectCartItemState = defaultMemoize((itemId) => createSelector(selectCartItem(itemId), (cartItem) => (cartItem === null || cartItem === void 0 ? void 0 : cartItem.daffState) || null)).memoized;
1752
- const selectCartItemQuantity = defaultMemoize((itemId) => createSelector(selectCartItem(itemId), (cartItem) => (cartItem === null || cartItem === void 0 ? void 0 : cartItem.qty) || 0)).memoized;
1753
- const selectCartItemRowTotal = defaultMemoize((itemId) => createSelector(selectCartItem(itemId), (cartItem) => (cartItem === null || cartItem === void 0 ? void 0 : cartItem.row_total) || 0)).memoized;
1754
- const selectCartItemPrice = defaultMemoize((itemId) => createSelector(selectCartItem(itemId), (cartItem) => (cartItem === null || cartItem === void 0 ? void 0 : cartItem.price) || 0)).memoized;
1755
- const selectCartItemDiscounts = defaultMemoize((itemId) => createSelector(selectCartItem(itemId), (cartItem) => (cartItem === null || cartItem === void 0 ? void 0 : cartItem.discounts) || [])).memoized;
1756
- const selectCartItemTotalDiscount = defaultMemoize((itemId) => createSelector(selectCartItemDiscounts(itemId), (discounts) => (discounts === null || discounts === void 0 ? void 0 : discounts.reduce((acc, { amount }) => daffAdd(acc, amount), 0)) || 0)).memoized;
1757
- const selectCartItemErrors = defaultMemoize((itemId) => createSelector(selectCartItem(itemId), (cartItem) => (cartItem === null || cartItem === void 0 ? void 0 : cartItem.daffErrors) || [])).memoized;
1758
- return {
1759
- selectCartItemEntitiesState,
1760
- selectCartItemIds,
1761
- selectCartItemEntities,
1762
- selectAllCartItems,
1763
- selectCartItemTotal,
1764
- selectCartItem,
1765
- selectTotalNumberOfCartItems,
1766
- selectCartItemConfiguredAttributes,
1767
- selectCartItemCompositeOptions,
1768
- selectIsCartItemOutOfStock,
1769
- selectInStockCartItems,
1770
- selectOutOfStockCartItems,
1771
- selectCartItemMutating,
1772
- selectCartItemState,
1773
- selectCartItemPrice,
1774
- selectCartItemRowTotal,
1775
- selectCartItemQuantity,
1776
- selectCartItemDiscounts,
1777
- selectCartItemTotalDiscount,
1778
- selectCartItemErrors,
1779
- };
1780
- };
1781
- const getDaffCartItemEntitiesSelectors = (() => {
1782
- let cache;
1783
- return () => cache = cache
1784
- ? cache
1785
- : createCartItemEntitiesSelectors();
1786
- })();
1787
-
1788
- const createCartSelectors$1 = () => {
1789
- const selectCartFeatureState = getDaffCartFeatureSelector().selectCartFeatureState;
1790
- const { selectCartItemMutating } = getDaffCartItemEntitiesSelectors();
1791
- const selectCartState = createSelector(selectCartFeatureState, (state) => state.cart);
1792
- const selectCartValue = createSelector(selectCartState, (state) => state.cart);
1793
- const selectCartResolved = createSelector(selectCartState, (state) => state.resolved);
1794
- const selectCartLoadingObject = createSelector(selectCartState, state => state.loading);
1795
- const selectCartLoading = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Cart] !== "Stable" /* DaffState.Complete */);
1796
- const selectCartResolving = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Cart] === "Resolving" /* DaffState.Resolving */);
1797
- const selectCartMutating = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Cart] === "Mutating" /* DaffState.Mutating */);
1798
- const selectBillingAddressLoading = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.BillingAddress] !== "Stable" /* DaffState.Complete */);
1799
- const selectBillingAddressResolving = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.BillingAddress] === "Resolving" /* DaffState.Resolving */);
1800
- const selectBillingAddressMutating = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.BillingAddress] === "Mutating" /* DaffState.Mutating */);
1801
- const selectShippingAddressLoading = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.ShippingAddress] !== "Stable" /* DaffState.Complete */);
1802
- const selectShippingAddressResolving = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.ShippingAddress] === "Resolving" /* DaffState.Resolving */);
1803
- const selectShippingAddressMutating = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.ShippingAddress] === "Mutating" /* DaffState.Mutating */);
1804
- const selectShippingInformationLoading = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.ShippingInformation] !== "Stable" /* DaffState.Complete */);
1805
- const selectShippingInformationResolving = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.ShippingInformation] === "Resolving" /* DaffState.Resolving */);
1806
- const selectShippingInformationMutating = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.ShippingInformation] === "Mutating" /* DaffState.Mutating */);
1807
- const selectShippingMethodsLoading = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.ShippingMethods] !== "Stable" /* DaffState.Complete */);
1808
- const selectShippingMethodsResolving = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.ShippingMethods] === "Resolving" /* DaffState.Resolving */);
1809
- const selectPaymentLoading = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Payment] !== "Stable" /* DaffState.Complete */);
1810
- const selectPaymentResolving = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Payment] === "Resolving" /* DaffState.Resolving */);
1811
- const selectPaymentMutating = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Payment] === "Mutating" /* DaffState.Mutating */);
1812
- const selectPaymentMethodsLoading = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.PaymentMethods] !== "Stable" /* DaffState.Complete */);
1813
- const selectPaymentMethodsResolving = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.PaymentMethods] === "Resolving" /* DaffState.Resolving */);
1814
- const selectItemLoading = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Item] !== "Stable" /* DaffState.Complete */);
1815
- const selectItemAdding = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Item] === "Adding" /* DaffState.Adding */);
1816
- const selectItemResolving = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Item] === "Resolving" /* DaffState.Resolving */);
1817
- const selectCouponLoading = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Coupon] !== "Stable" /* DaffState.Complete */);
1818
- const selectCouponResolving = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Coupon] === "Resolving" /* DaffState.Resolving */);
1819
- const selectCouponMutating = createSelector(selectCartLoadingObject, loadingObject => loadingObject[DaffCartOperationType.Coupon] === "Mutating" /* DaffState.Mutating */);
1820
- const selectCartFeatureLoading = createSelector(selectCartLoadingObject, loadingObject => [
1821
- selectCartLoading,
1822
- selectBillingAddressLoading,
1823
- selectShippingAddressLoading,
1824
- selectShippingInformationLoading,
1825
- selectShippingMethodsLoading,
1826
- selectPaymentLoading,
1827
- selectPaymentMethodsLoading,
1828
- selectCouponLoading,
1829
- selectItemLoading,
1830
- ].map(selector => selector.projector(loadingObject)).reduce((acc, loading) => acc || loading, false));
1831
- const selectCartFeatureResolving = createSelector(selectCartLoadingObject, loadingObject => [
1832
- selectCartResolving,
1833
- selectBillingAddressResolving,
1834
- selectShippingAddressResolving,
1835
- selectShippingInformationResolving,
1836
- selectShippingMethodsResolving,
1837
- selectPaymentResolving,
1838
- selectPaymentMethodsResolving,
1839
- selectCouponResolving,
1840
- selectItemResolving,
1841
- ].map(selector => selector.projector(loadingObject)).reduce((acc, resolving) => acc || resolving, false));
1842
- const selectCartFeatureMutating = createSelector(selectCartLoadingObject, selectCartItemMutating, (loadingObject, cartItemMutating) => [
1843
- selectCartMutating,
1844
- selectBillingAddressMutating,
1845
- selectShippingAddressMutating,
1846
- selectShippingInformationMutating,
1847
- selectPaymentMutating,
1848
- selectCouponMutating,
1849
- selectItemAdding,
1850
- ].map(selector => selector.projector(loadingObject)).reduce((acc, mutating) => acc || mutating, false) || cartItemMutating);
1851
- const selectCartErrorsObject = createSelector(selectCartState, (state) => state.errors);
1852
- const selectCartErrors = createSelector(selectCartErrorsObject, (state) => state[DaffCartOperationType.Cart]);
1853
- const selectBillingAddressErrors = createSelector(selectCartErrorsObject, (state) => state[DaffCartOperationType.BillingAddress]);
1854
- const selectShippingAddressErrors = createSelector(selectCartErrorsObject, (state) => state[DaffCartOperationType.ShippingAddress]);
1855
- const selectShippingInformationErrors = createSelector(selectCartErrorsObject, (state) => state[DaffCartOperationType.ShippingInformation]);
1856
- const selectShippingMethodsErrors = createSelector(selectCartErrorsObject, (state) => state[DaffCartOperationType.ShippingMethods]);
1857
- const selectPaymentErrors = createSelector(selectCartErrorsObject, (state) => state[DaffCartOperationType.Payment]);
1858
- const selectPaymentMethodsErrors = createSelector(selectCartErrorsObject, (state) => state[DaffCartOperationType.PaymentMethods]);
1859
- const selectItemErrors = createSelector(selectCartErrorsObject, (state) => state[DaffCartOperationType.Item]);
1860
- const selectCouponErrors = createSelector(selectCartErrorsObject, (state) => state[DaffCartOperationType.Coupon]);
1861
- const selectCartId = createSelector(selectCartValue, (state) => state.id);
1862
- /**
1863
- * @deprecated use selectCartSubtotalExcludingTax selector instead.
1864
- */
1865
- const selectCartSubtotal = createSelector(selectCartValue, (state) => {
1866
- const subtotalObject = state.totals[DaffCartTotalTypeEnum.subtotalExcludingTax];
1867
- return subtotalObject ? subtotalObject.value : null;
1868
- });
1869
- const selectCartGrandTotal = createSelector(selectCartValue, (state) => {
1870
- const grandTotalObject = state.totals[DaffCartTotalTypeEnum.grandTotal];
1871
- return grandTotalObject ? grandTotalObject.value : null;
1872
- });
1873
- const selectCartSubtotalExcludingTax = createSelector(selectCartValue, (state) => {
1874
- const subtotalExcludingTaxObject = state.totals[DaffCartTotalTypeEnum.subtotalExcludingTax];
1875
- return subtotalExcludingTaxObject ? subtotalExcludingTaxObject.value : null;
1876
- });
1877
- const selectCartSubtotalIncludingTax = createSelector(selectCartValue, (state) => {
1878
- const subtotalIncludingTaxObject = state.totals[DaffCartTotalTypeEnum.subtotalIncludingTax];
1879
- return subtotalIncludingTaxObject ? subtotalIncludingTaxObject.value : null;
1880
- });
1881
- const selectCartSubtotalWithDiscountExcludingTax = createSelector(selectCartValue, (state) => {
1882
- const subtotalWithDiscountExcludingTaxObject = state.totals[DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax];
1883
- return subtotalWithDiscountExcludingTaxObject ? subtotalWithDiscountExcludingTaxObject.value : null;
1884
- });
1885
- const selectCartSubtotalWithDiscountIncludingTax = createSelector(selectCartValue, (state) => {
1886
- const subtotalWithDiscountIncludingTaxObject = state.totals[DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax];
1887
- return subtotalWithDiscountIncludingTaxObject ? subtotalWithDiscountIncludingTaxObject.value : null;
1888
- });
1889
- const selectCartTotalTax = createSelector(selectCartValue, (state) => {
1890
- const taxObject = state.totals[DaffCartTotalTypeEnum.tax];
1891
- return taxObject ? taxObject.value : null;
1892
- });
1893
- const selectCartDiscountTotals = createSelector(selectCartValue, (state) => {
1894
- const discount = state.totals[DaffCartTotalTypeEnum.discount];
1895
- return discount ? [discount] : [];
1896
- });
1897
- const selectCartShippingTotal = createSelector(selectCartValue, (state) => {
1898
- const shippingTotalObject = state.totals[DaffCartTotalTypeEnum.shipping];
1899
- return shippingTotalObject ? shippingTotalObject.value : null;
1900
- });
1901
- const selectCartCoupons = createSelector(selectCartValue, (state) => state.coupons);
1902
- const selectCartItems = createSelector(selectCartValue, (state) => state.items);
1903
- const selectCartHasOutOfStockItems = createSelector(selectCartValue, (state) => state.items.reduce((acc, item) => (acc || !item.in_stock), false));
1904
- const selectCartBillingAddress = createSelector(selectCartValue, (state) => state.billing_address);
1905
- const selectCartShippingAddress = createSelector(selectCartValue, (state) => state.shipping_address);
1906
- const selectCartPayment = createSelector(selectCartValue, (state) => state.payment);
1907
- const selectCartTotals = createSelector(selectCartValue, (state) => state.totals);
1908
- const selectCartShippingInformation = createSelector(selectCartValue, (state) => state.shipping_information);
1909
- const selectCartAvailableShippingMethods = createSelector(selectCartValue, (state) => state.available_shipping_methods);
1910
- const selectCartAvailablePaymentMethods = createSelector(selectCartValue, (state) => state.available_payment_methods);
1911
- const selectIsCartEmpty = createSelector(selectCartValue, cart => !cart || !cart.items || cart.items.length === 0);
1912
- const selectIsBillingSameAsShipping = createSelector(selectCartShippingAddress, selectCartBillingAddress, (shippingAddress, billingAddress) => (shippingAddress === null || shippingAddress === void 0 ? void 0 : shippingAddress.id) || (billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.id)
1913
- ? (shippingAddress === null || shippingAddress === void 0 ? void 0 : shippingAddress.id) === (billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.id)
1914
- : daffComparePersonalAddresses(shippingAddress, billingAddress));
1915
- const selectHasBillingAddress = createSelector(selectCartBillingAddress, billingAddress => !!billingAddress);
1916
- const selectHasShippingAddress = createSelector(selectCartShippingAddress, shippingAddress => !!shippingAddress);
1917
- const selectHasShippingMethod = createSelector(selectCartShippingInformation, shippingMethod => !!shippingMethod);
1918
- const selectHasPaymentMethod = createSelector(selectCartPayment, paymentMethod => !!paymentMethod && paymentMethod.method !== '');
1919
- const selectCanPlaceOrder = createSelector(selectIsCartEmpty, selectHasBillingAddress, selectHasShippingAddress, selectHasShippingMethod, selectHasPaymentMethod, (isCartEmpty, hasBillingAddress, hasShippingAddress, hasShippingMethod, hasPaymentMethod) => !isCartEmpty
1920
- && hasBillingAddress
1921
- && hasShippingAddress
1922
- && hasShippingMethod
1923
- && hasPaymentMethod);
1924
- return {
1925
- selectCartState,
1926
- selectCartValue,
1927
- selectCartResolved,
1928
- selectCartLoadingObject,
1929
- selectCartFeatureLoading,
1930
- selectCartFeatureResolving,
1931
- selectCartFeatureMutating,
1932
- selectCartLoading,
1933
- selectCartResolving,
1934
- selectCartMutating,
1935
- selectBillingAddressLoading,
1936
- selectBillingAddressResolving,
1937
- selectBillingAddressMutating,
1938
- selectShippingAddressLoading,
1939
- selectShippingAddressResolving,
1940
- selectShippingAddressMutating,
1941
- selectShippingInformationLoading,
1942
- selectShippingInformationResolving,
1943
- selectShippingInformationMutating,
1944
- selectShippingMethodsLoading,
1945
- selectShippingMethodsResolving,
1946
- selectPaymentLoading,
1947
- selectPaymentResolving,
1948
- selectPaymentMutating,
1949
- selectPaymentMethodsLoading,
1950
- selectPaymentMethodsResolving,
1951
- selectCouponLoading,
1952
- selectCouponResolving,
1953
- selectCouponMutating,
1954
- selectItemLoading,
1955
- selectItemAdding,
1956
- selectItemResolving,
1957
- selectCartErrorsObject,
1958
- selectCartErrors,
1959
- selectBillingAddressErrors,
1960
- selectShippingAddressErrors,
1961
- selectShippingInformationErrors,
1962
- selectShippingMethodsErrors,
1963
- selectPaymentErrors,
1964
- selectPaymentMethodsErrors,
1965
- selectItemErrors,
1966
- selectCouponErrors,
1967
- selectCartId,
1968
- selectCartSubtotal,
1969
- selectCartGrandTotal,
1970
- selectCartSubtotalExcludingTax,
1971
- selectCartSubtotalIncludingTax,
1972
- selectCartSubtotalWithDiscountExcludingTax,
1973
- selectCartSubtotalWithDiscountIncludingTax,
1974
- selectCartDiscountTotals,
1975
- selectCartTotalTax,
1976
- selectCartShippingTotal,
1977
- selectCartCoupons,
1978
- selectCartItems,
1979
- selectCartHasOutOfStockItems,
1980
- selectCartBillingAddress,
1981
- selectCartShippingAddress,
1982
- selectCartPayment,
1983
- selectCartTotals,
1984
- selectCartShippingInformation,
1985
- selectCartAvailableShippingMethods,
1986
- selectCartAvailablePaymentMethods,
1987
- selectIsCartEmpty,
1988
- selectIsBillingSameAsShipping,
1989
- selectHasBillingAddress,
1990
- selectHasShippingAddress,
1991
- selectHasShippingMethod,
1992
- selectHasPaymentMethod,
1993
- selectCanPlaceOrder,
1994
- };
1995
- };
1996
- const getCartSelectors = (() => {
1997
- let cache;
1998
- return () => cache = cache
1999
- ? cache
2000
- : createCartSelectors$1();
2001
- })();
2002
-
2003
- const createCartOrderSelectors = () => {
2004
- const selectCartFeatureState = getDaffCartFeatureSelector().selectCartFeatureState;
2005
- const selectCartOrderState = createSelector(selectCartFeatureState, (state) => state.order);
2006
- const selectCartOrderValue = createSelector(selectCartOrderState, (state) => state.cartOrderResult);
2007
- const selectCartOrderId = createSelector(selectCartOrderValue, (state) => state.orderId);
2008
- const selectCartOrderCartId = createSelector(selectCartOrderValue, (state) => state.cartId);
2009
- const selectCartOrderLoading = createSelector(selectCartOrderState, (state) => state.loading !== "Stable" /* DaffState.Complete */);
2010
- const selectCartOrderMutating = createSelector(selectCartOrderState, (state) => state.loading === "Mutating" /* DaffState.Mutating */);
2011
- const selectCartOrderErrors = createSelector(selectCartOrderState, (state) => state.errors);
2012
- const selectHasOrderResult = createSelector(selectCartOrderValue, orderResult => !!(orderResult && orderResult.orderId && orderResult.cartId));
2013
- return {
2014
- selectCartOrderState,
2015
- selectCartOrderLoading,
2016
- selectCartOrderMutating,
2017
- selectCartOrderErrors,
2018
- selectCartOrderValue,
2019
- selectCartOrderId,
2020
- selectCartOrderCartId,
2021
- selectHasOrderResult,
2022
- };
2023
- };
2024
- const getCartOrderSelectors = (() => {
2025
- let cache;
2026
- return () => cache = cache
2027
- ? cache
2028
- : createCartOrderSelectors();
2029
- })();
2030
-
2031
- const createCartSelectors = () => (Object.assign(Object.assign(Object.assign(Object.assign({}, getDaffCartFeatureSelector()), getCartOrderSelectors()), getCartSelectors()), getDaffCartItemEntitiesSelectors()));
2032
- const getDaffCartSelectors = (() => {
2033
- let cache;
2034
- return () => cache = cache
2035
- ? cache
2036
- : createCartSelectors();
2037
- })();
2038
-
2039
- /**
2040
- * An injection token for setting how long (in ms) a cart item remains in a temporary state before
2041
- * reverting back to a default state. These temporary states are set after mutating or adding a cart item.
2042
- * Daffodil has a timer that resets the state of all cart items after this debounce time, but the timer will
2043
- * reset if a new item addition or mutation occurs. The default is 4000.
2044
- */
2045
- const DaffCartItemStateDebounceTime = new InjectionToken('DaffCartItemStateDebounceTime');
2046
-
2047
- /**
2048
- * Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
2049
- * Can be used to further refine Daffodil errors into more specific app errors.
2050
- */
2051
- const DAFF_CART_ERROR_MATCHER = new InjectionToken('DAFF_CART_ERROR_MATCHER', { factory: () => daffTransformErrorToStateError });
2052
-
2053
- class DaffCartAddressEffects {
2054
- constructor(actions$, errorMatcher, driver, storage) {
2055
- this.actions$ = actions$;
2056
- this.errorMatcher = errorMatcher;
2057
- this.driver = driver;
2058
- this.storage = storage;
2059
- this.update$ = createEffect(() => this.actions$.pipe(ofType(DaffCartAddressActionTypes.CartAddressUpdateAction), switchMap((action) => defer(() => of(this.storage.getCartId())).pipe(switchMap(cartId => this.driver.update(cartId, action.payload)), map((resp) => new DaffCartAddressUpdateSuccess(resp)), catchAndArrayifyErrors(error => of(error.find((err) => err.code === DAFF_STORAGE_SERVICE_ERROR_CODE)
2060
- ? new DaffCartStorageFailure(error.map(this.errorMatcher))
2061
- : new DaffCartAddressUpdateFailure(error.map(this.errorMatcher))))))));
2062
- }
2063
- }
2064
- /** @nocollapse */ DaffCartAddressEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartAddressEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartAddressDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2065
- /** @nocollapse */ DaffCartAddressEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartAddressEffects });
2066
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartAddressEffects, decorators: [{
2067
- type: Injectable
2068
- }], ctorParameters: function () {
2069
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2070
- type: Inject,
2071
- args: [DAFF_CART_ERROR_MATCHER]
2072
- }] }, { type: undefined, decorators: [{
2073
- type: Inject,
2074
- args: [DaffCartAddressDriver]
2075
- }] }, { type: i2.DaffCartStorageService }];
2076
- } });
2077
-
2078
- class DaffCartBillingAddressEffects {
2079
- constructor(actions$, errorMatcher, driver, storage) {
2080
- this.actions$ = actions$;
2081
- this.errorMatcher = errorMatcher;
2082
- this.driver = driver;
2083
- this.storage = storage;
2084
- this.get$ = createEffect(() => this.actions$.pipe(ofType(DaffCartBillingAddressActionTypes.CartBillingAddressLoadAction), switchMap((action) => this.driver.get(this.storage.getCartId()).pipe(map((resp) => new DaffCartBillingAddressLoadSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartBillingAddressLoadFailure(error.map(this.errorMatcher))))))));
2085
- this.update$ = createEffect(() => this.actions$.pipe(ofType(DaffCartBillingAddressActionTypes.CartBillingAddressUpdateAction), switchMap((action) => this.driver.update(this.storage.getCartId(), action.payload).pipe(map((resp) => new DaffCartBillingAddressUpdateSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartBillingAddressUpdateFailure(error.map(this.errorMatcher))))))));
2086
- }
2087
- }
2088
- /** @nocollapse */ DaffCartBillingAddressEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartBillingAddressEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartBillingAddressDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2089
- /** @nocollapse */ DaffCartBillingAddressEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartBillingAddressEffects });
2090
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartBillingAddressEffects, decorators: [{
2091
- type: Injectable
2092
- }], ctorParameters: function () {
2093
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2094
- type: Inject,
2095
- args: [DAFF_CART_ERROR_MATCHER]
2096
- }] }, { type: undefined, decorators: [{
2097
- type: Inject,
2098
- args: [DaffCartBillingAddressDriver]
2099
- }] }, { type: i2.DaffCartStorageService }];
2100
- } });
2101
-
2102
- class DaffCartCouponEffects {
2103
- constructor(actions$, errorMatcher, driver, storage) {
2104
- this.actions$ = actions$;
2105
- this.errorMatcher = errorMatcher;
2106
- this.driver = driver;
2107
- this.storage = storage;
2108
- this.apply$ = createEffect(() => this.actions$.pipe(ofType(DaffCartCouponActionTypes.CartCouponApplyAction), switchMap((action) => defer(() => of(this.storage.getCartId())).pipe(switchMap(cartId => this.driver.apply(cartId, action.payload)), map(resp => new DaffCartCouponApplySuccess(resp)), catchAndArrayifyErrors(error => of(error.find((err) => err.code === DAFF_STORAGE_SERVICE_ERROR_CODE)
2109
- ? new DaffCartStorageFailure(error.map(this.errorMatcher))
2110
- : new DaffCartCouponApplyFailure(error.map(this.errorMatcher))))))));
2111
- this.list$ = createEffect(() => this.actions$.pipe(ofType(DaffCartCouponActionTypes.CartCouponListAction), switchMap((action) => defer(() => of(this.storage.getCartId())).pipe(switchMap(cartId => this.driver.list(cartId)), map(resp => new DaffCartCouponListSuccess(resp)), catchAndArrayifyErrors(error => of(error.find((err) => err.code === DAFF_STORAGE_SERVICE_ERROR_CODE)
2112
- ? new DaffCartStorageFailure(error.map(this.errorMatcher))
2113
- : new DaffCartCouponListFailure(error.map(this.errorMatcher))))))));
2114
- this.remove$ = createEffect(() => this.actions$.pipe(ofType(DaffCartCouponActionTypes.CartCouponRemoveAction), switchMap((action) => defer(() => of(this.storage.getCartId())).pipe(switchMap(cartId => this.driver.remove(cartId, action.payload)), map(resp => new DaffCartCouponRemoveSuccess(resp)), catchAndArrayifyErrors(error => of(error.find((err) => err.code === DAFF_STORAGE_SERVICE_ERROR_CODE)
2115
- ? new DaffCartStorageFailure(error.map(this.errorMatcher))
2116
- : new DaffCartCouponRemoveFailure(error.map(this.errorMatcher))))))));
2117
- this.removeAll$ = createEffect(() => this.actions$.pipe(ofType(DaffCartCouponActionTypes.CartCouponRemoveAllAction), switchMap((action) => defer(() => of(this.storage.getCartId())).pipe(switchMap(cartId => this.driver.removeAll(cartId)), map(resp => new DaffCartCouponRemoveAllSuccess(resp)), catchAndArrayifyErrors(error => of(error.find((err) => err.code === DAFF_STORAGE_SERVICE_ERROR_CODE)
2118
- ? new DaffCartStorageFailure(error.map(this.errorMatcher))
2119
- : new DaffCartCouponRemoveAllFailure(error.map(this.errorMatcher))))))));
2120
- }
2121
- }
2122
- /** @nocollapse */ DaffCartCouponEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartCouponEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartCouponDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2123
- /** @nocollapse */ DaffCartCouponEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartCouponEffects });
2124
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartCouponEffects, decorators: [{
2125
- type: Injectable
2126
- }], ctorParameters: function () {
2127
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2128
- type: Inject,
2129
- args: [DAFF_CART_ERROR_MATCHER]
2130
- }] }, { type: undefined, decorators: [{
2131
- type: Inject,
2132
- args: [DaffCartCouponDriver]
2133
- }] }, { type: i2.DaffCartStorageService }];
2134
- } });
2135
-
2136
- class DaffCartItemEffects {
2137
- constructor(actions$, errorMatcher, driver, storage, cartItemStateDebounceTime, store, cartResolver) {
2138
- this.actions$ = actions$;
2139
- this.errorMatcher = errorMatcher;
2140
- this.driver = driver;
2141
- this.storage = storage;
2142
- this.cartItemStateDebounceTime = cartItemStateDebounceTime;
2143
- this.store = store;
2144
- this.cartResolver = cartResolver;
2145
- this.list$ = createEffect(() => this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemListAction), switchMap((action) => this.driver.list(this.storage.getCartId()).pipe(map((resp) => new DaffCartItemListSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartItemListFailure(error.map(this.errorMatcher))))))));
2146
- this.get$ = createEffect(() => this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemLoadAction), switchMap((action) => this.driver.get(this.storage.getCartId(), action.itemId).pipe(map((resp) => new DaffCartItemLoadSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartItemLoadFailure(error.map(this.errorMatcher), action.itemId)))))));
2147
- this.add$ = createEffect(() => this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemAddAction), concatMap((action) => combineLatest([
2148
- of(action),
2149
- this.cartResolver.getCartIdOrFail(),
2150
- ])), mergeMap(([action, id]) => this.addCartItem$(id, action.input)), daffCartDriverHandleCartNotFound(this.storage), catchAndArrayifyErrors(error => of(new DaffCartItemAddFailure(error.map(this.errorMatcher))))));
2151
- this.update$ = createEffect(() => this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemUpdateAction), mergeMap((action) => this.driver.update(this.storage.getCartId(), action.itemId, action.changes).pipe(map((resp) => new DaffCartItemUpdateSuccess(resp, action.itemId)), catchAndArrayifyErrors(error => of(new DaffCartItemUpdateFailure(error.map(this.errorMatcher), action.itemId)))))));
2152
- this.resetCartItemStateAfterChange$ = createEffect(() => this.actions$.pipe(ofType(
2153
- // these actions will reset the debounce interval
2154
- DaffCartItemActionTypes.CartItemAddSuccessAction, DaffCartItemActionTypes.CartItemUpdateSuccessAction, DaffCartItemActionTypes.CartItemUpdateAction), debounceTime(this.cartItemStateDebounceTime), ofType(
2155
- // these actions will cause the cart item state reset
2156
- DaffCartItemActionTypes.CartItemAddSuccessAction, DaffCartItemActionTypes.CartItemUpdateSuccessAction), map(() => new DaffCartItemStateReset())));
2157
- this.delete$ = createEffect(() => this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemDeleteAction), mergeMap((action) => this.driver.delete(this.storage.getCartId(), action.itemId).pipe(map((resp) => new DaffCartItemDeleteSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartItemDeleteFailure(error.map(this.errorMatcher), action.itemId)))))));
2158
- this.removeOutOfStock$ = createEffect(() => this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemDeleteOutOfStockAction), switchMap((action) => this.store.pipe(select(getDaffCartSelectors().selectOutOfStockCartItems), take(1))), switchMap(items => items.length > 0
2159
- ? combineLatest(items.map(item => this.driver.delete(this.storage.getCartId(), item.id))).pipe(map(partialCarts => Object.assign({}, ...partialCarts)))
2160
- : this.store.pipe(select(getDaffCartSelectors().selectCartValue), take(1))), map(cart => new DaffCartItemDeleteOutOfStockSuccess(cart)), catchAndArrayifyErrors(error => of(new DaffCartItemDeleteOutOfStockFailure(error.map(this.errorMatcher))))));
2161
- }
2162
- addCartItem$(cartId, input) {
2163
- return this.driver.add(cartId, input).pipe(map((resp) => new DaffCartItemAddSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartItemAddFailure(error.map(this.errorMatcher)))));
2164
- }
2165
- }
2166
- /** @nocollapse */ DaffCartItemEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartItemEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartItemDriver }, { token: i2.DaffCartStorageService }, { token: DaffCartItemStateDebounceTime }, { token: i1$1.Store }, { token: i4.DaffCartDriverResolveService }], target: i0.ɵɵFactoryTarget.Injectable });
2167
- /** @nocollapse */ DaffCartItemEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartItemEffects });
2168
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartItemEffects, decorators: [{
2169
- type: Injectable
2170
- }], ctorParameters: function () {
2171
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2172
- type: Inject,
2173
- args: [DAFF_CART_ERROR_MATCHER]
2174
- }] }, { type: undefined, decorators: [{
2175
- type: Inject,
2176
- args: [DaffCartItemDriver]
2177
- }] }, { type: i2.DaffCartStorageService }, { type: undefined, decorators: [{
2178
- type: Inject,
2179
- args: [DaffCartItemStateDebounceTime]
2180
- }] }, { type: i1$1.Store }, { type: i4.DaffCartDriverResolveService }];
2181
- } });
2182
-
2183
- class DaffCartOrderEffects {
2184
- constructor(actions$, errorMatcher, driver, storage) {
2185
- this.actions$ = actions$;
2186
- this.errorMatcher = errorMatcher;
2187
- this.driver = driver;
2188
- this.storage = storage;
2189
- this.placeOrder$ = createEffect(() => this.actions$.pipe(ofType(DaffCartOrderActionTypes.CartPlaceOrderAction), switchMap((action) => defer(() => of(this.storage.getCartId())).pipe(switchMap(cartId => this.driver.placeOrder(cartId, action.payload)), map((resp) => new DaffCartPlaceOrderSuccess(resp)), catchAndArrayifyErrors(error => of(error.find((err) => err.code === DAFF_STORAGE_SERVICE_ERROR_CODE)
2190
- ? new DaffCartStorageFailure(error.map(this.errorMatcher))
2191
- : new DaffCartPlaceOrderFailure(error.map(this.errorMatcher))))))));
2192
- this.resetCart$ = createEffect(() => this.actions$.pipe(ofType(DaffCartOrderActionTypes.CartPlaceOrderSuccessAction), map(() => new DaffCartCreate())));
2193
- }
2194
- }
2195
- /** @nocollapse */ DaffCartOrderEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartOrderEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartOrderDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2196
- /** @nocollapse */ DaffCartOrderEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartOrderEffects });
2197
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartOrderEffects, decorators: [{
2198
- type: Injectable
2199
- }], ctorParameters: function () {
2200
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2201
- type: Inject,
2202
- args: [DAFF_CART_ERROR_MATCHER]
2203
- }] }, { type: undefined, decorators: [{
2204
- type: Inject,
2205
- args: [DaffCartOrderDriver]
2206
- }] }, { type: i2.DaffCartStorageService }];
2207
- } });
2208
-
2209
- class DaffCartPaymentMethodsEffects {
2210
- constructor(actions$, errorMatcher, driver, storage) {
2211
- this.actions$ = actions$;
2212
- this.errorMatcher = errorMatcher;
2213
- this.driver = driver;
2214
- this.storage = storage;
2215
- this.list$ = createEffect(() => this.actions$.pipe(ofType(DaffCartPaymentMethodsActionTypes.CartPaymentMethodsLoadAction), switchMap((action) => this.driver.list(this.storage.getCartId()).pipe(map((resp) => new DaffCartPaymentMethodsLoadSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartPaymentMethodsLoadFailure(error.map(this.errorMatcher))))))));
2216
- }
2217
- }
2218
- /** @nocollapse */ DaffCartPaymentMethodsEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartPaymentMethodsEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartPaymentMethodsDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2219
- /** @nocollapse */ DaffCartPaymentMethodsEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartPaymentMethodsEffects });
2220
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartPaymentMethodsEffects, decorators: [{
2221
- type: Injectable
2222
- }], ctorParameters: function () {
2223
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2224
- type: Inject,
2225
- args: [DAFF_CART_ERROR_MATCHER]
2226
- }] }, { type: undefined, decorators: [{
2227
- type: Inject,
2228
- args: [DaffCartPaymentMethodsDriver]
2229
- }] }, { type: i2.DaffCartStorageService }];
2230
- } });
2231
-
2232
- class DaffCartPaymentProcessorEffects {
2233
- constructor(actions$, processors, errorMatcher, paymentErrorMatcher, driver, storage, injector) {
2234
- this.actions$ = actions$;
2235
- this.processors = processors;
2236
- this.errorMatcher = errorMatcher;
2237
- this.paymentErrorMatcher = paymentErrorMatcher;
2238
- this.driver = driver;
2239
- this.storage = storage;
2240
- this.injector = injector;
2241
- this.update$ = createEffect(() => this.actions$.pipe(ofType(...Object.values(this.processors).map(({ action }) => action)), switchMap((action) =>
2242
- // create a new inner observable to prevent the effects obs
2243
- // from completing on outer catch error
2244
- defer(() => this.injector.get(this.processors[action.request.kind].driver).generateToken(action.request).pipe(map(e => [e, action]), switchMap(([response, act]) => this.driver.update(this.storage.getCartId(), {
2245
- method: response.method,
2246
- payment_info: response.data,
2247
- }, act.address).pipe(map((resp) => new DaffCartPaymentUpdateSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartPaymentUpdateFailure(error.map(this.errorMatcher)))))), catchAndArrayifyErrors(error => of(new DaffPaymentGenerateTokenFailure(this.paymentErrorMatcher(error[0])))))))));
2248
- }
2249
- }
2250
- /** @nocollapse */ DaffCartPaymentProcessorEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartPaymentProcessorEffects, deps: [{ token: i1.Actions }, { token: DAFF_PAYMENT_PROCESSOR_COLLECTION }, { token: DAFF_CART_ERROR_MATCHER }, { token: DAFF_PAYMENT_ERROR_MATCHER }, { token: DaffCartPaymentDriver }, { token: i2.DaffCartStorageService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
2251
- /** @nocollapse */ DaffCartPaymentProcessorEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartPaymentProcessorEffects });
2252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartPaymentProcessorEffects, decorators: [{
2253
- type: Injectable
2254
- }], ctorParameters: function () {
2255
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2256
- type: Inject,
2257
- args: [DAFF_PAYMENT_PROCESSOR_COLLECTION]
2258
- }] }, { type: undefined, decorators: [{
2259
- type: Inject,
2260
- args: [DAFF_CART_ERROR_MATCHER]
2261
- }] }, { type: undefined, decorators: [{
2262
- type: Inject,
2263
- args: [DAFF_PAYMENT_ERROR_MATCHER]
2264
- }] }, { type: undefined, decorators: [{
2265
- type: Inject,
2266
- args: [DaffCartPaymentDriver]
2267
- }] }, { type: i2.DaffCartStorageService }, { type: i0.Injector }];
2268
- } });
2269
-
2270
- class DaffCartPaymentEffects {
2271
- constructor(actions$, errorMatcher, driver, storage) {
2272
- this.actions$ = actions$;
2273
- this.errorMatcher = errorMatcher;
2274
- this.driver = driver;
2275
- this.storage = storage;
2276
- this.get$ = createEffect(() => this.actions$.pipe(ofType(DaffCartPaymentActionTypes.CartPaymentLoadAction), switchMap((action) => this.driver.get(this.storage.getCartId()).pipe(map((resp) => new DaffCartPaymentLoadSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartPaymentLoadFailure(error.map(this.errorMatcher))))))));
2277
- this.update$ = createEffect(() => this.actions$.pipe(ofType(DaffCartPaymentActionTypes.CartPaymentUpdateAction), switchMap((action) => this.driver.update(this.storage.getCartId(), action.payload).pipe(map((resp) => new DaffCartPaymentUpdateSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartPaymentUpdateFailure(error.map(this.errorMatcher))))))));
2278
- this.updateWithBilling$ = createEffect(() => this.actions$.pipe(ofType(DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingAction), switchMap((action) => this.driver.updateWithBilling(this.storage.getCartId(), action.payment, action.address).pipe(map(resp => new DaffCartPaymentUpdateWithBillingSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartPaymentUpdateWithBillingFailure(error.map(this.errorMatcher))))))));
2279
- this.remove$ = createEffect(() => this.actions$.pipe(ofType(DaffCartPaymentActionTypes.CartPaymentRemoveAction), switchMap((action) => this.driver.remove(this.storage.getCartId()).pipe(map(() => new DaffCartPaymentRemoveSuccess()), catchAndArrayifyErrors(error => of(new DaffCartPaymentRemoveFailure(error.map(this.errorMatcher))))))));
2280
- }
2281
- }
2282
- /** @nocollapse */ DaffCartPaymentEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartPaymentEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartPaymentDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2283
- /** @nocollapse */ DaffCartPaymentEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartPaymentEffects });
2284
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartPaymentEffects, decorators: [{
2285
- type: Injectable
2286
- }], ctorParameters: function () {
2287
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2288
- type: Inject,
2289
- args: [DAFF_CART_ERROR_MATCHER]
2290
- }] }, { type: undefined, decorators: [{
2291
- type: Inject,
2292
- args: [DaffCartPaymentDriver]
2293
- }] }, { type: i2.DaffCartStorageService }];
2294
- } });
2295
-
2296
- /**
2297
- * An effect for resolving a guest cart for a customer.
2298
- * It will:
2299
- * 1. Check storage for an id, and retrieve the cart if it exists.
2300
- * 2. If a cart doesn't exist, it will attempt to create a new cart exactly once.
2301
- * 3. If the cart resolution fails, it will bailout.
2302
- */
2303
- class DaffCartResolverEffects {
2304
- constructor(actions$, errorMatcher, cartStorage, cartResolver, platformId) {
2305
- this.actions$ = actions$;
2306
- this.errorMatcher = errorMatcher;
2307
- this.cartStorage = cartStorage;
2308
- this.cartResolver = cartResolver;
2309
- this.platformId = platformId;
2310
- this.onResolveCart = createEffect(() => () => this.actions$.pipe(ofType(DaffCartActionTypes.ResolveCartAction, DaffCartActionTypes.ResolveCartSuccessAction), switchMap(action => iif(
2311
- // if something else resolves the cart during an outstanding resolve
2312
- () => action.type === DaffCartActionTypes.ResolveCartSuccessAction,
2313
- // then just cancel the outstanding operation
2314
- EMPTY, this.cartResolver.getCartOrFail().pipe(map(({ response, errors }) => errors.length > 0
2315
- ? new DaffResolveCartPartialSuccess(response, errors.map(this.errorMatcher))
2316
- : new DaffResolveCartSuccess(response)), daffCartDriverHandleCartNotFound(this.cartStorage), catchAndArrayifyErrors((error) => {
2317
- switch (true) {
2318
- case !!error.find((err) => err.code === DAFF_SERVER_STORAGE_SERVICE_ERROR_CODE):
2319
- return of(new DaffResolveCartServerSide([
2320
- this.errorMatcher(new DaffCartServerSideResolutionError(error[0].message)),
2321
- ]));
2322
- case !!error.find((err) => err.code === DAFF_STORAGE_SERVICE_ERROR_CODE):
2323
- return of(new DaffResolveCartFailure([
2324
- this.errorMatcher(new DaffCartStorageResolutionError(error[0].message)),
2325
- ]));
2326
- default:
2327
- return of(new DaffResolveCartFailure(error.map((err) =>
2328
- // I wish there was a better way to check this
2329
- this.errorMatcher(err instanceof DaffInheritableError || !!err.code
2330
- ? err
2331
- : new DaffCartResolutionError(err.message)))));
2332
- }
2333
- }))))));
2334
- }
2335
- ngrxOnInitEffects() {
2336
- return isPlatformBrowser(this.platformId) && this.cartStorage.getCartId() ? new DaffResolveCart() : { type: '' };
2337
- }
2338
- }
2339
- /** @nocollapse */ DaffCartResolverEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartResolverEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: i2.DaffCartStorageService }, { token: i4.DaffCartDriverResolveService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
2340
- /** @nocollapse */ DaffCartResolverEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartResolverEffects });
2341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartResolverEffects, decorators: [{
2342
- type: Injectable
2343
- }], ctorParameters: function () {
2344
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2345
- type: Inject,
2346
- args: [DAFF_CART_ERROR_MATCHER]
2347
- }] }, { type: i2.DaffCartStorageService }, { type: i4.DaffCartDriverResolveService }, { type: undefined, decorators: [{
2348
- type: Inject,
2349
- args: [PLATFORM_ID]
2350
- }] }];
2351
- } });
2352
-
2353
- class DaffCartShippingAddressEffects {
2354
- constructor(actions$, errorMatcher, driver, storage) {
2355
- this.actions$ = actions$;
2356
- this.errorMatcher = errorMatcher;
2357
- this.driver = driver;
2358
- this.storage = storage;
2359
- this.get$ = createEffect(() => this.actions$.pipe(ofType(DaffCartShippingAddressActionTypes.CartShippingAddressLoadAction), switchMap((action) => this.driver.get(this.storage.getCartId()).pipe(map((resp) => new DaffCartShippingAddressLoadSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartShippingAddressLoadFailure(error.map(this.errorMatcher))))))));
2360
- this.update$ = createEffect(() => this.actions$.pipe(ofType(DaffCartShippingAddressActionTypes.CartShippingAddressUpdateAction), switchMap((action) => this.driver.update(this.storage.getCartId(), action.payload).pipe(map((resp) => new DaffCartShippingAddressUpdateSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartShippingAddressUpdateFailure(error.map(this.errorMatcher))))))));
2361
- }
2362
- }
2363
- /** @nocollapse */ DaffCartShippingAddressEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartShippingAddressEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartShippingAddressDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2364
- /** @nocollapse */ DaffCartShippingAddressEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartShippingAddressEffects });
2365
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartShippingAddressEffects, decorators: [{
2366
- type: Injectable
2367
- }], ctorParameters: function () {
2368
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2369
- type: Inject,
2370
- args: [DAFF_CART_ERROR_MATCHER]
2371
- }] }, { type: undefined, decorators: [{
2372
- type: Inject,
2373
- args: [DaffCartShippingAddressDriver]
2374
- }] }, { type: i2.DaffCartStorageService }];
2375
- } });
2376
-
2377
- class DaffCartShippingInformationEffects {
2378
- constructor(actions$, errorMatcher, driver, storage) {
2379
- this.actions$ = actions$;
2380
- this.errorMatcher = errorMatcher;
2381
- this.driver = driver;
2382
- this.storage = storage;
2383
- this.get$ = createEffect(() => this.actions$.pipe(ofType(DaffCartShippingInformationActionTypes.CartShippingInformationLoadAction), switchMap((action) => this.driver.get(this.storage.getCartId()).pipe(map((resp) => new DaffCartShippingInformationLoadSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartShippingInformationLoadFailure(error.map(this.errorMatcher))))))));
2384
- this.update$ = createEffect(() => this.actions$.pipe(ofType(DaffCartShippingInformationActionTypes.CartShippingInformationUpdateAction), switchMap((action) => this.driver.update(this.storage.getCartId(), action.payload).pipe(map((resp) => new DaffCartShippingInformationUpdateSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartShippingInformationUpdateFailure(error.map(this.errorMatcher))))))));
2385
- this.delete$ = createEffect(() => this.actions$.pipe(ofType(DaffCartShippingInformationActionTypes.CartShippingInformationDeleteAction), switchMap((action) => this.driver.delete(this.storage.getCartId()).pipe(map((resp) => new DaffCartShippingInformationDeleteSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartShippingInformationDeleteFailure(error.map(this.errorMatcher))))))));
2386
- }
2387
- }
2388
- /** @nocollapse */ DaffCartShippingInformationEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartShippingInformationEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartShippingInformationDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2389
- /** @nocollapse */ DaffCartShippingInformationEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartShippingInformationEffects });
2390
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartShippingInformationEffects, decorators: [{
2391
- type: Injectable
2392
- }], ctorParameters: function () {
2393
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2394
- type: Inject,
2395
- args: [DAFF_CART_ERROR_MATCHER]
2396
- }] }, { type: undefined, decorators: [{
2397
- type: Inject,
2398
- args: [DaffCartShippingInformationDriver]
2399
- }] }, { type: i2.DaffCartStorageService }];
2400
- } });
2401
-
2402
- class DaffCartShippingMethodsEffects {
2403
- constructor(actions$, errorMatcher, driver, storage) {
2404
- this.actions$ = actions$;
2405
- this.errorMatcher = errorMatcher;
2406
- this.driver = driver;
2407
- this.storage = storage;
2408
- this.list$ = createEffect(() => this.actions$.pipe(ofType(DaffCartShippingMethodsActionTypes.CartShippingMethodsLoadAction), switchMap((action) => this.driver.list(this.storage.getCartId()).pipe(map((resp) => new DaffCartShippingMethodsLoadSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartShippingMethodsLoadFailure(error.map(this.errorMatcher))))))));
2409
- }
2410
- }
2411
- /** @nocollapse */ DaffCartShippingMethodsEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartShippingMethodsEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartShippingMethodsDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2412
- /** @nocollapse */ DaffCartShippingMethodsEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartShippingMethodsEffects });
2413
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartShippingMethodsEffects, decorators: [{
2414
- type: Injectable
2415
- }], ctorParameters: function () {
2416
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2417
- type: Inject,
2418
- args: [DAFF_CART_ERROR_MATCHER]
2419
- }] }, { type: undefined, decorators: [{
2420
- type: Inject,
2421
- args: [DaffCartShippingMethodsDriver]
2422
- }] }, { type: i2.DaffCartStorageService }];
2423
- } });
2424
-
2425
- class DaffCartEffects {
2426
- constructor(actions$, errorMatcher, driver, storage) {
2427
- this.actions$ = actions$;
2428
- this.errorMatcher = errorMatcher;
2429
- this.driver = driver;
2430
- this.storage = storage;
2431
- this.create$ = createEffect(() => this.actions$.pipe(ofType(DaffCartActionTypes.CartCreateAction), switchMap((action) => this.driver.create().pipe(map((resp) => new DaffCartCreateSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffCartCreateFailure(error.map(this.errorMatcher))))))));
2432
- this.storeId$ = createEffect(() => this.actions$.pipe(ofType(DaffCartActionTypes.CartCreateSuccessAction, DaffCartActionTypes.ResolveCartSuccessAction), switchMap((action) => of(null).pipe(tap(() => {
2433
- this.storage.setCartId(action.payload.id);
2434
- }), switchMap(() => EMPTY), catchAndArrayifyErrors(error => of(new DaffCartStorageFailure(error.map(this.errorMatcher))))))));
2435
- this.get$ = createEffect(() => this.actions$.pipe(ofType(DaffCartActionTypes.CartLoadAction), switchMap((action) => defer(() => of(this.storage.getCartId())).pipe(switchMap(cartId => this.driver.get(cartId)), map(({ response, errors }) => {
2436
- if (errors.length === 0) {
2437
- return new DaffCartLoadSuccess(response);
2438
- }
2439
- const hasOnlyRecoverableErrors = errors.reduce((acc, error) => acc && error.recoverable, true);
2440
- if (hasOnlyRecoverableErrors) {
2441
- return new DaffCartLoadPartialSuccess(response, errors.map(this.errorMatcher));
2442
- }
2443
- return new DaffCartLoadFailure(errors.map(this.errorMatcher));
2444
- }), catchAndArrayifyErrors(error => of(error.find((err) => err.code === DAFF_STORAGE_SERVICE_ERROR_CODE)
2445
- ? new DaffCartStorageFailure(error.map(this.errorMatcher))
2446
- : new DaffCartLoadFailure(error.map(this.errorMatcher))))))));
2447
- this.addToCart$ = createEffect(() => this.actions$.pipe(ofType(DaffCartActionTypes.AddToCartAction), switchMap((action) => this.driver.addToCart(action.payload.productId, action.payload.qty).pipe(map((resp) => new DaffAddToCartSuccess(resp)), catchAndArrayifyErrors(error => of(new DaffAddToCartFailure(error.map(this.errorMatcher))))))));
2448
- this.clear$ = createEffect(() => this.actions$.pipe(ofType(DaffCartActionTypes.CartClearAction), switchMap((action) => defer(() => of(this.storage.getCartId())).pipe(switchMap(cartId => this.driver.clear(cartId)), map((resp) => new DaffCartClearSuccess(resp)), catchAndArrayifyErrors(error => of(error.find((err) => err.code === DAFF_STORAGE_SERVICE_ERROR_CODE)
2449
- ? new DaffCartStorageFailure(error.map(this.errorMatcher))
2450
- : new DaffCartClearFailure(error.map(this.errorMatcher))))))));
2451
- }
2452
- }
2453
- /** @nocollapse */ DaffCartEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartEffects, deps: [{ token: i1.Actions }, { token: DAFF_CART_ERROR_MATCHER }, { token: DaffCartDriver }, { token: i2.DaffCartStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
2454
- /** @nocollapse */ DaffCartEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartEffects });
2455
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartEffects, decorators: [{
2456
- type: Injectable
2457
- }], ctorParameters: function () {
2458
- return [{ type: i1.Actions }, { type: undefined, decorators: [{
2459
- type: Inject,
2460
- args: [DAFF_CART_ERROR_MATCHER]
2461
- }] }, { type: undefined, decorators: [{
2462
- type: Inject,
2463
- args: [DaffCartDriver]
2464
- }] }, { type: i2.DaffCartStorageService }];
2465
- } });
2466
-
2467
- const daffCartPaymentReducer = (state = daffPaymentInitialState, action) => {
2468
- const adapter = new DaffPaymentStateReducerAdapter();
2469
- switch (action.type) {
2470
- case DaffCartPaymentActionTypes.CartPaymentUpdateSuccessAction:
2471
- case DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingSuccessAction:
2472
- return adapter.tokenGenerated(state);
2473
- case DaffCartPaymentActionTypes.CartPaymentUpdateFailureAction:
2474
- case DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingFailureAction:
2475
- return adapter.storeError(action.payload, state);
2476
- default:
2477
- return state;
2478
- }
2479
- };
2480
-
2481
- /**
2482
- * A meta reducer for determining and setting the correct `daffState` values on cart items.
2483
- */
2484
- function daffCartSetItemStateMetaReducer(reducer) {
2485
- return (state, action) => {
2486
- switch (action.type) {
2487
- case DaffCartItemActionTypes.CartItemAddSuccessAction:
2488
- action.payload.items = updateAddedCartItemState(state.cartItems.entities, action.payload.items.map((item) => (Object.assign(Object.assign({}, item), { daffErrors: [] }))));
2489
- return reducer(state, action);
2490
- case DaffCartItemActionTypes.CartItemUpdateSuccessAction:
2491
- action.payload.items = updateMutatedCartItemState(action.payload.items.map((item) => item.id === action.itemId
2492
- ? Object.assign(Object.assign({}, item), { daffErrors: [] }) : item), state.cartItems.entities, action.itemId);
2493
- return reducer(state, action);
2494
- default:
2495
- return reducer(state, action);
2496
- }
2497
- };
2498
- }
2499
- function updateAddedCartItemState(oldCartItems, newCartItems) {
2500
- return newCartItems.map(newItem => {
2501
- const oldItem = oldCartItems[newItem.id];
2502
- switch (true) {
2503
- case !oldItem:
2504
- return Object.assign(Object.assign({}, newItem), { daffState: DaffCartItemStateEnum.New, daffErrors: [] });
2505
- case (oldItem === null || oldItem === void 0 ? void 0 : oldItem.qty) !== newItem.qty:
2506
- return Object.assign(Object.assign({}, newItem), { daffState: DaffCartItemStateEnum.Updated, daffErrors: [] });
2507
- default:
2508
- return newItem;
2509
- }
2510
- });
2511
- }
2512
- function updateMutatedCartItemState(responseItems, stateItems, itemId) {
2513
- return responseItems.map(item => {
2514
- var _a;
2515
- return item.id === itemId ? Object.assign(Object.assign({}, item), { daffState: DaffCartItemStateEnum.Updated, daffErrors: [] }) : Object.assign(Object.assign({}, item), { daffState: ((_a = stateItems[item.id]) === null || _a === void 0 ? void 0 : _a.daffState) || DaffCartItemStateEnum.Default });
2516
- });
2517
- }
2518
-
2519
- /**
2520
- * An internal token to hold the Daffodil cart feature store config.
2521
- *
2522
- * @docs-private
2523
- */
2524
- const DAFF_CART_STORE_CONFIG = new InjectionToken('DAFF_CART_STORE_CONFIG', {
2525
- providedIn: 'any',
2526
- factory: () => ({
2527
- metaReducers: [
2528
- daffCartSetItemStateMetaReducer,
2529
- ...inject(DAFF_CART_META_REDUCERS),
2530
- ],
2531
- }),
2532
- });
2533
-
2534
- /**
2535
- * An internal token to hold the Daffodil cart reducers.
2536
- * Includes the extra and standard reducers.
2537
- *
2538
- * @docs-private
2539
- */
2540
- const DAFF_CART_REDUCERS = new InjectionToken('DAFF_CART_REDUCERS', {
2541
- factory: () => {
2542
- const retrievalActions = inject(DAFF_CART_RETRIEVAL_ACTIONS);
2543
- return daffComposeReducers([
2544
- // daffodil reducers should run first, don't change this
2545
- // TODO: enforce this somehow (meta-reducers?)
2546
- combineReducers(daffCartReducers),
2547
- //
2548
- combineReducers({
2549
- cart: daffCartRetrievalActionsReducerFactory(retrievalActions),
2550
- cartItems: daffCartItemEntitiesRetrievalActionsReducerFactory(retrievalActions),
2551
- order: daffIdentityReducer,
2552
- }),
2553
- ...inject(DAFF_CART_EXTRA_REDUCERS),
2554
- ]);
2555
- },
2556
- });
2557
-
2558
- class DaffCartStateModule {
2559
- }
2560
- /** @nocollapse */ DaffCartStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2561
- /** @nocollapse */ DaffCartStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DaffCartStateModule, imports: [i1$1.StoreFeatureModule, i1.EffectsFeatureModule] });
2562
- /** @nocollapse */ DaffCartStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartStateModule, providers: [
2563
- { provide: DaffCartItemStateDebounceTime, useValue: 4000 },
2564
- ...daffPaymentProvideExtraReducers(combineReducers({
2565
- payment: daffCartPaymentReducer,
2566
- })),
2567
- daffCartProvideRetrievalActions(...daffCartRetrivalActions),
2568
- ], imports: [StoreModule.forFeature(DAFF_CART_STORE_FEATURE_KEY, DAFF_CART_REDUCERS, DAFF_CART_STORE_CONFIG),
2569
- EffectsModule.forFeature([
2570
- DaffCartEffects,
2571
- DaffCartItemEffects,
2572
- DaffCartBillingAddressEffects,
2573
- DaffCartShippingAddressEffects,
2574
- DaffCartAddressEffects,
2575
- DaffCartShippingInformationEffects,
2576
- DaffCartShippingMethodsEffects,
2577
- DaffCartPaymentEffects,
2578
- DaffCartPaymentProcessorEffects,
2579
- DaffCartPaymentMethodsEffects,
2580
- DaffCartOrderEffects,
2581
- DaffCartCouponEffects,
2582
- DaffCartResolverEffects,
2583
- ])] });
2584
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartStateModule, decorators: [{
2585
- type: NgModule,
2586
- args: [{
2587
- imports: [
2588
- StoreModule.forFeature(DAFF_CART_STORE_FEATURE_KEY, DAFF_CART_REDUCERS, DAFF_CART_STORE_CONFIG),
2589
- EffectsModule.forFeature([
2590
- DaffCartEffects,
2591
- DaffCartItemEffects,
2592
- DaffCartBillingAddressEffects,
2593
- DaffCartShippingAddressEffects,
2594
- DaffCartAddressEffects,
2595
- DaffCartShippingInformationEffects,
2596
- DaffCartShippingMethodsEffects,
2597
- DaffCartPaymentEffects,
2598
- DaffCartPaymentProcessorEffects,
2599
- DaffCartPaymentMethodsEffects,
2600
- DaffCartOrderEffects,
2601
- DaffCartCouponEffects,
2602
- DaffCartResolverEffects,
2603
- ]),
2604
- ],
2605
- providers: [
2606
- { provide: DaffCartItemStateDebounceTime, useValue: 4000 },
2607
- ...daffPaymentProvideExtraReducers(combineReducers({
2608
- payment: daffCartPaymentReducer,
2609
- })),
2610
- daffCartProvideRetrievalActions(...daffCartRetrivalActions),
2611
- ],
2612
- }]
2613
- }] });
2614
-
2615
- /**
2616
- * @inheritdoc
2617
- */
2618
- class DaffCartFacade {
2619
- constructor(store,
2620
- // typing this as `Record<string, any>` or `object` fails the build
2621
- // because Angular explicitly types this as `Object`
2622
- // eslint-disable-next-line @typescript-eslint/ban-types
2623
- paymentMethodMap) {
2624
- this.store = store;
2625
- this.paymentMethodMap = paymentMethodMap;
2626
- const { selectCartValue, selectCartResolved, selectCartLoadingObject, selectCartFeatureLoading, selectCartFeatureResolving, selectCartFeatureMutating, selectCartLoading, selectCartResolving, selectCartMutating, selectBillingAddressLoading, selectBillingAddressResolving, selectBillingAddressMutating, selectShippingAddressLoading, selectShippingAddressResolving, selectShippingAddressMutating, selectShippingInformationLoading, selectShippingInformationResolving, selectShippingInformationMutating, selectShippingMethodsLoading, selectShippingMethodsResolving, selectPaymentLoading, selectPaymentResolving, selectPaymentMutating, selectPaymentMethodsLoading, selectPaymentMethodsResolving, selectCouponLoading, selectCouponResolving, selectCouponMutating, selectItemLoading, selectItemAdding, selectItemResolving, selectCartItemMutating, selectCartErrorsObject, selectCartErrors, selectItemErrors, selectBillingAddressErrors, selectShippingAddressErrors, selectShippingInformationErrors, selectShippingMethodsErrors, selectPaymentErrors, selectPaymentMethodsErrors, selectCouponErrors, selectCartId, selectCartSubtotal, selectCartGrandTotal, selectCartSubtotalExcludingTax, selectCartSubtotalIncludingTax, selectCartSubtotalWithDiscountExcludingTax, selectCartSubtotalWithDiscountIncludingTax, selectCartDiscountTotals, selectCartTotalTax, selectCartShippingTotal, selectCartCoupons, selectCartItems, selectAllCartItems, selectCartHasOutOfStockItems, selectOutOfStockCartItems, selectInStockCartItems, selectCartItemEntities, selectTotalNumberOfCartItems, selectCartItemConfiguredAttributes, selectCartItemCompositeOptions, selectCartBillingAddress, selectCartShippingAddress, selectCartPayment, selectCartTotals, selectCartShippingInformation, selectCartAvailableShippingMethods, selectCartAvailablePaymentMethods, selectIsCartEmpty, selectIsBillingSameAsShipping, selectCartOrderLoading, selectCartOrderErrors, selectCartOrderValue, selectCartOrderId, selectCartOrderCartId, selectHasOrderResult, selectIsCartItemOutOfStock, selectCartItemState, selectHasBillingAddress, selectHasShippingAddress, selectHasShippingMethod, selectHasPaymentMethod, selectCanPlaceOrder, selectCartItemPrice, selectCartItemRowTotal, selectCartItemQuantity, selectCartItemDiscounts, selectCartItemTotalDiscount, selectCartItemErrors, } = getDaffCartSelectors();
2627
- this._selectCartItemConfiguredAttributes = selectCartItemConfiguredAttributes;
2628
- this._selectCartItemCompositeOptions = selectCartItemCompositeOptions;
2629
- this._selectIsCartItemOutOfStock = selectIsCartItemOutOfStock;
2630
- this._selectCartItemState = selectCartItemState;
2631
- this._selectCartItemPrice = selectCartItemPrice;
2632
- this._selectCartItemQuantity = selectCartItemQuantity;
2633
- this._selectCartItemRowTotal = selectCartItemRowTotal;
2634
- this._selectCartItemDiscounts = selectCartItemDiscounts;
2635
- this._selectCartItemTotalDiscount = selectCartItemTotalDiscount;
2636
- this._selectCartItemErrors = selectCartItemErrors;
2637
- this.cart$ = this.store.pipe(select(selectCartValue));
2638
- this.resolved$ = this.store.pipe(select(selectCartResolved));
2639
- this.loadingObject$ = this.store.pipe(select(selectCartLoadingObject));
2640
- this.featureLoading$ = this.store.pipe(select(selectCartFeatureLoading));
2641
- this.featureResolving$ = this.store.pipe(select(selectCartFeatureResolving));
2642
- this.featureMutating$ = this.store.pipe(select(selectCartFeatureMutating));
2643
- this.loading$ = this.store.pipe(select(selectCartLoading));
2644
- this.resolving$ = this.store.pipe(select(selectCartResolving));
2645
- this.mutating$ = this.store.pipe(select(selectCartMutating));
2646
- this.billingAddressLoading$ = this.store.pipe(select(selectBillingAddressLoading));
2647
- this.billingAddressResolving$ = this.store.pipe(select(selectBillingAddressResolving));
2648
- this.billingAddressMutating$ = this.store.pipe(select(selectBillingAddressMutating));
2649
- this.shippingAddressLoading$ = this.store.pipe(select(selectShippingAddressLoading));
2650
- this.shippingAddressResolving$ = this.store.pipe(select(selectShippingAddressResolving));
2651
- this.shippingAddressMutating$ = this.store.pipe(select(selectShippingAddressMutating));
2652
- this.shippingInformationLoading$ = this.store.pipe(select(selectShippingInformationLoading));
2653
- this.shippingInformationResolving$ = this.store.pipe(select(selectShippingInformationResolving));
2654
- this.shippingInformationMutating$ = this.store.pipe(select(selectShippingInformationMutating));
2655
- this.shippingMethodsLoading$ = this.store.pipe(select(selectShippingMethodsLoading));
2656
- this.shippingMethodsResolving$ = this.store.pipe(select(selectShippingMethodsResolving));
2657
- this.paymentLoading$ = this.store.pipe(select(selectPaymentLoading));
2658
- this.paymentResolving$ = this.store.pipe(select(selectPaymentResolving));
2659
- this.paymentMutating$ = this.store.pipe(select(selectPaymentMutating));
2660
- this.paymentMethodsLoading$ = this.store.pipe(select(selectPaymentMethodsLoading));
2661
- this.paymentMethodsResolving$ = this.store.pipe(select(selectPaymentMethodsResolving));
2662
- this.couponLoading$ = this.store.pipe(select(selectCouponLoading));
2663
- this.couponResolving$ = this.store.pipe(select(selectCouponResolving));
2664
- this.couponMutating$ = this.store.pipe(select(selectCouponMutating));
2665
- this.itemLoading$ = this.store.pipe(select(selectItemLoading));
2666
- this.itemAdding$ = this.store.pipe(select(selectItemAdding));
2667
- this.itemResolving$ = this.store.pipe(select(selectItemResolving));
2668
- this.itemMutating$ = this.store.pipe(select(selectCartItemMutating));
2669
- this.errors$ = this.store.pipe(select(selectCartErrorsObject));
2670
- this.cartErrors$ = this.store.pipe(select(selectCartErrors));
2671
- this.itemErrors$ = this.store.pipe(select(selectItemErrors));
2672
- this.billingAddressErrors$ = this.store.pipe(select(selectBillingAddressErrors));
2673
- this.shippingAddressErrors$ = this.store.pipe(select(selectShippingAddressErrors));
2674
- this.shippingInformationErrors$ = this.store.pipe(select(selectShippingInformationErrors));
2675
- this.shippingMethodsErrors$ = this.store.pipe(select(selectShippingMethodsErrors));
2676
- this.paymentErrors$ = this.store.pipe(select(selectPaymentErrors));
2677
- this.paymentMethodsErrors$ = this.store.pipe(select(selectPaymentMethodsErrors));
2678
- this.couponErrors$ = this.store.pipe(select(selectCouponErrors));
2679
- this.id$ = this.store.pipe(select(selectCartId));
2680
- this.subtotal$ = this.store.pipe(select(selectCartSubtotal));
2681
- this.grandTotal$ = this.store.pipe(select(selectCartGrandTotal));
2682
- this.subtotalExcludingTax$ = this.store.pipe(select(selectCartSubtotalExcludingTax));
2683
- this.subtotalIncludingTax$ = this.store.pipe(select(selectCartSubtotalIncludingTax));
2684
- this.subtotalWithDiscountExcludingTax$ = this.store.pipe(select(selectCartSubtotalWithDiscountExcludingTax));
2685
- this.subtotalWithDiscountIncludingTax$ = this.store.pipe(select(selectCartSubtotalWithDiscountIncludingTax));
2686
- this.discountTotals$ = this.store.pipe(select(selectCartDiscountTotals));
2687
- this.totalTax$ = this.store.pipe(select(selectCartTotalTax));
2688
- this.shippingTotal$ = this.store.pipe(select(selectCartShippingTotal));
2689
- this.coupons$ = this.store.pipe(select(selectCartCoupons));
2690
- this.items$ = this.store.pipe(select(selectCartItems));
2691
- this.itemEntities$ = this.store.pipe(select(selectAllCartItems));
2692
- this.totalItems$ = this.store.pipe(select(selectTotalNumberOfCartItems));
2693
- this.hasOutOfStockItems$ = this.store.pipe(select(selectCartHasOutOfStockItems));
2694
- this.outOfStockItems$ = this.store.pipe(select(selectOutOfStockCartItems));
2695
- this.inStockItems$ = this.store.pipe(select(selectInStockCartItems));
2696
- this.itemDictionary$ = this.store.pipe(select(selectCartItemEntities));
2697
- this.billingAddress$ = this.store.pipe(select(selectCartBillingAddress));
2698
- this.shippingAddress$ = this.store.pipe(select(selectCartShippingAddress));
2699
- this.payment$ = this.store.pipe(select(selectCartPayment));
2700
- this.totals$ = this.store.pipe(select(selectCartTotals));
2701
- this.shippingInformation$ = this.store.pipe(select(selectCartShippingInformation));
2702
- this.availableShippingMethods$ = this.store.pipe(select(selectCartAvailableShippingMethods));
2703
- this.availablePaymentMethods$ = this.store.pipe(select(selectCartAvailablePaymentMethods));
2704
- this.paymentId$ = this.payment$.pipe(map(payment => payment && payment.method
2705
- ? this.paymentMethodMap[payment.method]
2706
- : null));
2707
- this.isCartEmpty$ = this.store.pipe(select(selectIsCartEmpty));
2708
- this.isBillingSameAsShipping$ = this.store.pipe(select(selectIsBillingSameAsShipping));
2709
- this.hasBillingAddress$ = this.store.pipe(select(selectHasBillingAddress));
2710
- this.hasShippingAddress$ = this.store.pipe(select(selectHasShippingAddress));
2711
- this.hasShippingMethod$ = this.store.pipe(select(selectHasShippingMethod));
2712
- this.hasPaymentMethod$ = this.store.pipe(select(selectHasPaymentMethod));
2713
- this.canPlaceOrder$ = this.store.pipe(select(selectCanPlaceOrder));
2714
- this.orderResultLoading$ = this.store.pipe(select(selectCartOrderLoading));
2715
- this.orderResultErrors$ = this.store.pipe(select(selectCartOrderErrors));
2716
- this.orderResult$ = this.store.pipe(select(selectCartOrderValue));
2717
- this.orderResultId$ = this.store.pipe(select(selectCartOrderId));
2718
- this.orderResultCartId$ = this.store.pipe(select(selectCartOrderCartId));
2719
- this.hasOrderResult$ = this.store.pipe(select(selectHasOrderResult));
2720
- }
2721
- getConfiguredCartItemAttributes(itemId) {
2722
- return this.store.pipe(select(this._selectCartItemConfiguredAttributes(itemId)));
2723
- }
2724
- ;
2725
- getCompositeCartItemOptions(itemId) {
2726
- return this.store.pipe(select(this._selectCartItemCompositeOptions(itemId)));
2727
- }
2728
- ;
2729
- isCartItemOutOfStock(itemId) {
2730
- return this.store.pipe(select(this._selectIsCartItemOutOfStock(itemId)));
2731
- }
2732
- getCartItemState(itemId) {
2733
- return this.store.pipe(select(this._selectCartItemState(itemId)));
2734
- }
2735
- getCartItemPrice(itemId) {
2736
- return this.store.pipe(select(this._selectCartItemPrice(itemId)));
2737
- }
2738
- getCartItemQuantity(itemId) {
2739
- return this.store.pipe(select(this._selectCartItemQuantity(itemId)));
2740
- }
2741
- getCartItemRowTotal(itemId) {
2742
- return this.store.pipe(select(this._selectCartItemRowTotal(itemId)));
2743
- }
2744
- getCartItemDiscounts(itemId) {
2745
- return this.store.pipe(select(this._selectCartItemDiscounts(itemId)));
2746
- }
2747
- getCartItemTotalDiscount(itemId) {
2748
- return this.store.pipe(select(this._selectCartItemTotalDiscount(itemId)));
2749
- }
2750
- getCartItemErrors(itemId) {
2751
- return this.store.pipe(select(this._selectCartItemErrors(itemId)));
2752
- }
2753
- ;
2754
- dispatch(action) {
2755
- this.store.dispatch(action);
2756
- }
2757
- }
2758
- /** @nocollapse */ DaffCartFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartFacade, deps: [{ token: i1$1.Store }, { token: DaffCartPaymentMethodIdMap }], target: i0.ɵɵFactoryTarget.Injectable });
2759
- /** @nocollapse */ DaffCartFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartFacade, providedIn: 'root' });
2760
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartFacade, decorators: [{
2761
- type: Injectable,
2762
- args: [{
2763
- providedIn: 'root',
2764
- }]
2765
- }], ctorParameters: function () {
2766
- return [{ type: i1$1.Store }, { type: Object, decorators: [{
2767
- type: Inject,
2768
- args: [DaffCartPaymentMethodIdMap]
2769
- }] }];
2770
- } });
2771
-
2772
- /**
2773
- * Generated bundle index. Do not edit.
2774
- */
2775
-
2776
- export { DAFF_CART_ERROR_MATCHER, DAFF_CART_EXTRA_REDUCERS, DAFF_CART_META_REDUCERS, DAFF_CART_RETRIEVAL_ACTIONS, DAFF_CART_STORE_FEATURE_KEY, DaffAddToCart, DaffAddToCartFailure, DaffAddToCartSuccess, DaffCartActionTypes, DaffCartAddressActionTypes, DaffCartAddressUpdate, DaffCartAddressUpdateFailure, DaffCartAddressUpdateSuccess, DaffCartBillingAddressActionTypes, DaffCartBillingAddressLoad, DaffCartBillingAddressLoadFailure, DaffCartBillingAddressLoadSuccess, DaffCartBillingAddressUpdate, DaffCartBillingAddressUpdateFailure, DaffCartBillingAddressUpdateSuccess, DaffCartClear, DaffCartClearFailure, DaffCartClearSuccess, DaffCartCouponActionTypes, DaffCartCouponApply, DaffCartCouponApplyFailure, DaffCartCouponApplySuccess, DaffCartCouponClearErrors, DaffCartCouponList, DaffCartCouponListFailure, DaffCartCouponListSuccess, DaffCartCouponRemove, DaffCartCouponRemoveAll, DaffCartCouponRemoveAllFailure, DaffCartCouponRemoveAllSuccess, DaffCartCouponRemoveFailure, DaffCartCouponRemoveSuccess, DaffCartCreate, DaffCartCreateFailure, DaffCartCreateSuccess, DaffCartFacade, DaffCartItemActionTypes, DaffCartItemAdd, DaffCartItemAddFailure, DaffCartItemAddSuccess, DaffCartItemDelete, DaffCartItemDeleteFailure, DaffCartItemDeleteOutOfStock, DaffCartItemDeleteOutOfStockFailure, DaffCartItemDeleteOutOfStockSuccess, DaffCartItemDeleteSuccess, DaffCartItemList, DaffCartItemListFailure, DaffCartItemListSuccess, DaffCartItemLoad, DaffCartItemLoadFailure, DaffCartItemLoadSuccess, DaffCartItemStateDebounceTime, DaffCartItemStateEnum, DaffCartItemStateReset, DaffCartItemUpdate, DaffCartItemUpdateFailure, DaffCartItemUpdateSuccess, DaffCartLoad, DaffCartLoadFailure, DaffCartLoadPartialSuccess, DaffCartLoadSuccess, DaffCartOperationType, DaffCartOrderActionTypes, DaffCartPaymentActionTypes, DaffCartPaymentLoad, DaffCartPaymentLoadFailure, DaffCartPaymentLoadSuccess, DaffCartPaymentMethodAdd, DaffCartPaymentMethodsActionTypes, DaffCartPaymentMethodsLoad, DaffCartPaymentMethodsLoadFailure, DaffCartPaymentMethodsLoadSuccess, DaffCartPaymentRemove, DaffCartPaymentRemoveFailure, DaffCartPaymentRemoveSuccess, DaffCartPaymentUpdate, DaffCartPaymentUpdateFailure, DaffCartPaymentUpdateSuccess, DaffCartPaymentUpdateWithBilling, DaffCartPaymentUpdateWithBillingFailure, DaffCartPaymentUpdateWithBillingSuccess, DaffCartPlaceOrder, DaffCartPlaceOrderFailure, DaffCartPlaceOrderSuccess, DaffCartResolveState, DaffCartShippingAddressActionTypes, DaffCartShippingAddressLoad, DaffCartShippingAddressLoadFailure, DaffCartShippingAddressLoadSuccess, DaffCartShippingAddressUpdate, DaffCartShippingAddressUpdateFailure, DaffCartShippingAddressUpdateSuccess, DaffCartShippingInformationActionTypes, DaffCartShippingInformationDelete, DaffCartShippingInformationDeleteFailure, DaffCartShippingInformationDeleteSuccess, DaffCartShippingInformationLoad, DaffCartShippingInformationLoadFailure, DaffCartShippingInformationLoadSuccess, DaffCartShippingInformationUpdate, DaffCartShippingInformationUpdateFailure, DaffCartShippingInformationUpdateSuccess, DaffCartShippingMethodsActionTypes, DaffCartShippingMethodsLoad, DaffCartShippingMethodsLoadFailure, DaffCartShippingMethodsLoadSuccess, DaffCartStateModule, DaffCartStorageFailure, DaffResolveCart, DaffResolveCartFailure, DaffResolveCartPartialSuccess, DaffResolveCartServerSide, DaffResolveCartSuccess, daffCartItemEntitiesAdapter, daffCartItemEntitiesRetrievalActionsReducerFactory, daffCartOrderInitialState, daffCartOrderReducer, daffCartProvideExtraReducers, daffCartProvideMetaReducers, daffCartProvideRetrievalActions, daffCartReducer, daffCartReducerInitialState, daffCartReducers, daffCartRetrievalActionsReducerFactory, daffCartRetrievalGetResponse, daffCartRetrivalActions, getDaffCartSelectors, initializeLoadingSetter };
2777
- //# sourceMappingURL=daffodil-cart-state.mjs.map