@daffodil/cart 0.39.8 → 0.39.12

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 (147) hide show
  1. package/bundles/daffodil-cart-driver-in-memory.umd.js +4 -1
  2. package/bundles/daffodil-cart-driver-in-memory.umd.js.map +1 -1
  3. package/bundles/daffodil-cart-driver-in-memory.umd.min.js +1 -1
  4. package/bundles/daffodil-cart-driver-in-memory.umd.min.js.map +1 -1
  5. package/bundles/daffodil-cart-driver-magento-testing.umd.js +12 -2
  6. package/bundles/daffodil-cart-driver-magento-testing.umd.js.map +1 -1
  7. package/bundles/daffodil-cart-driver-magento-testing.umd.min.js +2 -2
  8. package/bundles/daffodil-cart-driver-magento-testing.umd.min.js.map +1 -1
  9. package/bundles/daffodil-cart-driver-magento.umd.js +119 -39
  10. package/bundles/daffodil-cart-driver-magento.umd.js.map +1 -1
  11. package/bundles/daffodil-cart-driver-magento.umd.min.js +1 -1
  12. package/bundles/daffodil-cart-driver-magento.umd.min.js.map +1 -1
  13. package/bundles/daffodil-cart-driver-testing.umd.js +6 -3
  14. package/bundles/daffodil-cart-driver-testing.umd.js.map +1 -1
  15. package/bundles/daffodil-cart-driver-testing.umd.min.js +1 -1
  16. package/bundles/daffodil-cart-driver-testing.umd.min.js.map +1 -1
  17. package/bundles/daffodil-cart-driver.umd.js.map +1 -1
  18. package/bundles/daffodil-cart-driver.umd.min.js.map +1 -1
  19. package/bundles/daffodil-cart-routing.umd.js +43 -0
  20. package/bundles/daffodil-cart-routing.umd.js.map +1 -1
  21. package/bundles/daffodil-cart-routing.umd.min.js +1 -1
  22. package/bundles/daffodil-cart-routing.umd.min.js.map +1 -1
  23. package/bundles/daffodil-cart-state-testing.umd.js +13 -2
  24. package/bundles/daffodil-cart-state-testing.umd.js.map +1 -1
  25. package/bundles/daffodil-cart-state-testing.umd.min.js +2 -2
  26. package/bundles/daffodil-cart-state-testing.umd.min.js.map +1 -1
  27. package/bundles/daffodil-cart-state.umd.js +169 -28
  28. package/bundles/daffodil-cart-state.umd.js.map +1 -1
  29. package/bundles/daffodil-cart-state.umd.min.js +1 -1
  30. package/bundles/daffodil-cart-state.umd.min.js.map +1 -1
  31. package/bundles/daffodil-cart-testing.umd.js +3 -3
  32. package/bundles/daffodil-cart-testing.umd.js.map +1 -1
  33. package/bundles/daffodil-cart-testing.umd.min.js +2 -2
  34. package/bundles/daffodil-cart-testing.umd.min.js.map +1 -1
  35. package/driver/daffodil-cart-driver.metadata.json +1 -1
  36. package/driver/in-memory/daffodil-cart-driver-in-memory.metadata.json +1 -1
  37. package/driver/in-memory/drivers/cart/cart.service.d.ts +3 -2
  38. package/driver/interfaces/cart-service.interface.d.ts +2 -1
  39. package/driver/magento/cart-item.service.d.ts +3 -1
  40. package/driver/magento/cart.service.d.ts +2 -1
  41. package/driver/magento/daffodil-cart-driver-magento.metadata.json +1 -1
  42. package/driver/magento/errors/transform.d.ts +13 -1
  43. package/driver/magento/injection-tokens/public_api.d.ts +1 -0
  44. package/driver/magento/injection-tokens/transforms/cart-item/token.d.ts +22 -0
  45. package/driver/magento/interfaces/cart-item-transform.type.d.ts +3 -0
  46. package/driver/magento/interfaces/public_api.d.ts +1 -0
  47. package/driver/magento/public_api.d.ts +1 -0
  48. package/driver/magento/testing/daffodil-cart-driver-magento-testing.metadata.json +1 -1
  49. package/driver/magento/testing/factories/public_api.d.ts +10 -10
  50. package/driver/magento/transforms/outputs/cart-coupon-response.service.d.ts +3 -0
  51. package/driver/magento/transforms/outputs/cart-item/cart-item-transformer.d.ts +7 -4
  52. package/driver/magento/transforms/outputs/cart.service.d.ts +3 -1
  53. package/driver/testing/daffodil-cart-driver-testing.metadata.json +1 -1
  54. package/driver/testing/drivers/cart/cart.service.d.ts +2 -1
  55. package/esm2015/driver/in-memory/drivers/cart/cart.service.js +5 -2
  56. package/esm2015/driver/interfaces/cart-service.interface.js +1 -1
  57. package/esm2015/driver/magento/cart-item.service.js +11 -8
  58. package/esm2015/driver/magento/cart.service.js +20 -7
  59. package/esm2015/driver/magento/errors/map.js +2 -2
  60. package/esm2015/driver/magento/errors/transform.js +15 -6
  61. package/esm2015/driver/magento/injection-tokens/public_api.js +2 -1
  62. package/esm2015/driver/magento/injection-tokens/transforms/cart-item/token.js +27 -0
  63. package/esm2015/driver/magento/interfaces/cart-item-transform.type.js +2 -0
  64. package/esm2015/driver/magento/interfaces/public_api.js +2 -0
  65. package/esm2015/driver/magento/public_api.js +2 -1
  66. package/esm2015/driver/magento/testing/factories/cart-address-input.factory.js +2 -2
  67. package/esm2015/driver/magento/testing/factories/cart-address.factory.js +2 -2
  68. package/esm2015/driver/magento/testing/factories/cart-coupon.factory.js +2 -2
  69. package/esm2015/driver/magento/testing/factories/cart-item/bundle-cart-item.factory.js +2 -2
  70. package/esm2015/driver/magento/testing/factories/cart-item/cart-item.factory.js +2 -2
  71. package/esm2015/driver/magento/testing/factories/cart-item/configurable-cart-item.factory.js +1 -1
  72. package/esm2015/driver/magento/testing/factories/cart-payment-method.factory.js +2 -2
  73. package/esm2015/driver/magento/testing/factories/cart-shipping-method.factory.js +2 -2
  74. package/esm2015/driver/magento/testing/factories/cart.factory.js +2 -2
  75. package/esm2015/driver/magento/testing/factories/public_api.js +11 -11
  76. package/esm2015/driver/magento/transforms/outputs/cart-coupon-response.service.js +15 -5
  77. package/esm2015/driver/magento/transforms/outputs/cart-item/bundle-cart-item-transformer.js +2 -2
  78. package/esm2015/driver/magento/transforms/outputs/cart-item/cart-item-transformer.js +9 -6
  79. package/esm2015/driver/magento/transforms/outputs/cart-item/configurable-cart-item-transformer.js +2 -2
  80. package/esm2015/driver/magento/transforms/outputs/cart-item/simple-cart-item-transformer.js +3 -3
  81. package/esm2015/driver/magento/transforms/outputs/cart.service.js +12 -7
  82. package/esm2015/driver/testing/drivers/cart/cart.service.js +5 -2
  83. package/esm2015/driver/testing/drivers/cart-order/cart-order.service.js +2 -2
  84. package/esm2015/routing/guards/in-stock-items/in-stock-items-guard-redirect.token.js +6 -0
  85. package/esm2015/routing/guards/in-stock-items/in-stock-items.guard.js +43 -0
  86. package/esm2015/routing/guards/public_api.js +3 -1
  87. package/esm2015/state/actions/cart-item.actions.js +30 -1
  88. package/esm2015/state/actions/cart.actions.js +29 -1
  89. package/esm2015/state/effects/cart-item.effects.js +17 -6
  90. package/esm2015/state/effects/cart-resolver.effects.js +24 -8
  91. package/esm2015/state/effects/cart.effects.js +13 -4
  92. package/esm2015/state/facades/cart/cart-facade.interface.js +1 -1
  93. package/esm2015/state/facades/cart/cart.facade.js +10 -2
  94. package/esm2015/state/models/stateful-cart-item.js +1 -1
  95. package/esm2015/state/reducers/cart/cart.reducer.js +7 -4
  96. package/esm2015/state/reducers/cart-item/cart-item.reducer.js +11 -1
  97. package/esm2015/state/reducers/cart-item-entities/cart-item-entities.reducer.js +11 -7
  98. package/esm2015/state/reducers/errors/error-state-helpers.js +3 -3
  99. package/esm2015/state/selectors/cart-item-entities/cart-item-entities.selectors.js +7 -1
  100. package/esm2015/state/testing/factories/stateful-cart-item.factory.js +2 -1
  101. package/esm2015/state/testing/factories/stateful-composite-cart-item.factory.js +5 -1
  102. package/esm2015/state/testing/factories/stateful-configurable-cart-item.factory.js +5 -1
  103. package/esm2015/state/testing/mock-cart-facade.js +7 -1
  104. package/esm2015/testing/factories/cart-address.factory.js +2 -2
  105. package/esm2015/testing/factories/cart-coupon.factory.js +2 -2
  106. package/esm2015/testing/factories/cart-item/cart-item.factory.js +3 -3
  107. package/esm2015/testing/factories/cart-item/composite-cart-item.factory.js +2 -2
  108. package/esm2015/testing/factories/cart-item/configurable-cart-item.factory.js +1 -1
  109. package/esm2015/testing/factories/cart-shipping-rate.factory.js +2 -2
  110. package/esm2015/testing/factories/cart.factory.js +2 -2
  111. package/fesm2015/daffodil-cart-driver-in-memory.js +4 -1
  112. package/fesm2015/daffodil-cart-driver-in-memory.js.map +1 -1
  113. package/fesm2015/daffodil-cart-driver-magento-testing.js +2 -2
  114. package/fesm2015/daffodil-cart-driver-magento-testing.js.map +1 -1
  115. package/fesm2015/daffodil-cart-driver-magento.js +108 -44
  116. package/fesm2015/daffodil-cart-driver-magento.js.map +1 -1
  117. package/fesm2015/daffodil-cart-driver-testing.js +5 -2
  118. package/fesm2015/daffodil-cart-driver-testing.js.map +1 -1
  119. package/fesm2015/daffodil-cart-driver.js.map +1 -1
  120. package/fesm2015/daffodil-cart-routing.js +40 -1
  121. package/fesm2015/daffodil-cart-routing.js.map +1 -1
  122. package/fesm2015/daffodil-cart-state-testing.js +15 -0
  123. package/fesm2015/daffodil-cart-state-testing.js.map +1 -1
  124. package/fesm2015/daffodil-cart-state.js +149 -28
  125. package/fesm2015/daffodil-cart-state.js.map +1 -1
  126. package/fesm2015/daffodil-cart-testing.js +2 -2
  127. package/fesm2015/daffodil-cart-testing.js.map +1 -1
  128. package/package.json +6 -6
  129. package/routing/daffodil-cart-routing.metadata.json +1 -1
  130. package/routing/guards/in-stock-items/in-stock-items-guard-redirect.token.d.ts +5 -0
  131. package/routing/guards/in-stock-items/in-stock-items.guard.d.ts +17 -0
  132. package/routing/guards/public_api.d.ts +2 -0
  133. package/state/actions/cart-item.actions.d.ts +26 -1
  134. package/state/actions/cart.actions.d.ts +31 -5
  135. package/state/daffodil-cart-state.metadata.json +1 -1
  136. package/state/effects/cart-item.effects.d.ts +5 -2
  137. package/state/effects/cart.effects.d.ts +2 -2
  138. package/state/facades/cart/cart-facade.interface.d.ts +19 -0
  139. package/state/facades/cart/cart.facade.d.ts +5 -0
  140. package/state/models/stateful-cart-item.d.ts +5 -0
  141. package/state/reducers/errors/error-state-helpers.d.ts +1 -1
  142. package/state/selectors/cart-item-entities/cart-item-entities.selectors.d.ts +13 -0
  143. package/state/testing/daffodil-cart-state-testing.metadata.json +1 -1
  144. package/state/testing/factories/stateful-cart-item.factory.d.ts +1 -0
  145. package/state/testing/factories/stateful-composite-cart-item.factory.d.ts +1 -0
  146. package/state/testing/factories/stateful-configurable-cart-item.factory.d.ts +1 -0
  147. package/state/testing/mock-cart-facade.d.ts +4 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ngrx/store'), require('@ngrx/entity'), require('@daffodil/core/state'), require('@angular/core'), require('@daffodil/cart'), require('@daffodil/core'), require('@daffodil/geography'), require('@ngrx/effects'), require('rxjs'), require('rxjs/operators'), require('@daffodil/cart/driver')) :
3
- typeof define === 'function' && define.amd ? define('@daffodil/cart/state', ['exports', '@ngrx/store', '@ngrx/entity', '@daffodil/core/state', '@angular/core', '@daffodil/cart', '@daffodil/core', '@daffodil/geography', '@ngrx/effects', 'rxjs', 'rxjs/operators', '@daffodil/cart/driver'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.daffodil = global.daffodil || {}, global.daffodil.cart = global.daffodil.cart || {}, global.daffodil.cart.state = {}), global.i1, global.entity, global.state, global.ng.core, global.daffodil.cart, global.core, global.geography, global.effects, global.rxjs, global.rxjs.operators, global.daffodil.cart.driver));
5
- }(this, (function (exports, i1, entity, state, i0, i2, core, geography, effects, rxjs, operators, driver) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ngrx/store'), require('@ngrx/entity'), require('@daffodil/core/state'), require('@daffodil/cart/driver'), require('@angular/core'), require('@daffodil/cart'), require('@daffodil/core'), require('@daffodil/geography'), require('@ngrx/effects'), require('rxjs'), require('rxjs/operators')) :
3
+ typeof define === 'function' && define.amd ? define('@daffodil/cart/state', ['exports', '@ngrx/store', '@ngrx/entity', '@daffodil/core/state', '@daffodil/cart/driver', '@angular/core', '@daffodil/cart', '@daffodil/core', '@daffodil/geography', '@ngrx/effects', 'rxjs', 'rxjs/operators'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.daffodil = global.daffodil || {}, global.daffodil.cart = global.daffodil.cart || {}, global.daffodil.cart.state = {}), global.i1, global.entity, global.state, global.daffodil.cart.driver, global.ng.core, global.daffodil.cart, global.core, global.geography, global.effects, global.rxjs, global.rxjs.operators));
5
+ }(this, (function (exports, i1, entity, state, driver, i0, i2, core, geography, effects, rxjs, operators) { 'use strict';
6
6
 
7
7
  /**
8
8
  * An enum for the cart action types.
@@ -11,6 +11,7 @@
11
11
  DaffCartActionTypes["CartStorageFailureAction"] = "[DaffCart] Cart Storage Failure Action";
12
12
  DaffCartActionTypes["CartLoadAction"] = "[DaffCart] Cart Load Action";
13
13
  DaffCartActionTypes["CartLoadSuccessAction"] = "[DaffCart] Cart Load Success Action";
14
+ DaffCartActionTypes["CartLoadPartialSuccessAction"] = "[DaffCart] Cart Load Partial Success Action";
14
15
  DaffCartActionTypes["CartLoadFailureAction"] = "[DaffCart] Cart Load Failure Action";
15
16
  DaffCartActionTypes["CartCreateAction"] = "[DaffCart] Cart Create Action";
16
17
  DaffCartActionTypes["CartCreateSuccessAction"] = "[DaffCart] Cart Create Success Action";
@@ -23,6 +24,7 @@
23
24
  DaffCartActionTypes["CartClearFailureAction"] = "[DaffCart] Cart Reset Failure Action";
24
25
  DaffCartActionTypes["ResolveCartAction"] = "[DaffCart] Resolve Cart Action";
25
26
  DaffCartActionTypes["ResolveCartSuccessAction"] = "[DaffCart] Resolve Cart Success Action";
27
+ DaffCartActionTypes["ResolveCartPartialSuccessAction"] = "[DaffCart] Resolve Cart Partial Success Action";
26
28
  DaffCartActionTypes["ResolveCartServerSideAction"] = "[DaffCart] Resolve Cart Server Side Action";
27
29
  DaffCartActionTypes["ResolveCartFailureAction"] = "[DaffCart] Resolve Cart Failure Action";
28
30
  })(exports.DaffCartActionTypes || (exports.DaffCartActionTypes = {}));
@@ -55,6 +57,20 @@
55
57
  }
56
58
  return DaffCartLoadSuccess;
57
59
  }());
60
+ /**
61
+ * An action that indicates a user's cart is loaded but recoverable errors occurred.
62
+ * There should be enough data to render the cart
63
+ * but the user should probably be shown error messages as well.
64
+ * A common example is some cart items being out of stock.
65
+ */
66
+ var DaffCartLoadPartialSuccess = /** @class */ (function () {
67
+ function DaffCartLoadPartialSuccess(payload, errors) {
68
+ this.payload = payload;
69
+ this.errors = errors;
70
+ this.type = exports.DaffCartActionTypes.CartLoadPartialSuccessAction;
71
+ }
72
+ return DaffCartLoadPartialSuccess;
73
+ }());
58
74
  /**
59
75
  * Indicates the failed load of the cart.
60
76
  */
@@ -167,6 +183,20 @@
167
183
  }
168
184
  return DaffResolveCartSuccess;
169
185
  }());
186
+ /**
187
+ * An action that indicates a user's cart is resolved but recoverable errors occurred.
188
+ * There should be enough data to render the cart
189
+ * but the user should probably be shown error messages as well.
190
+ * A common example is some cart items being out of stock.
191
+ */
192
+ var DaffResolveCartPartialSuccess = /** @class */ (function () {
193
+ function DaffResolveCartPartialSuccess(payload, errors) {
194
+ this.payload = payload;
195
+ this.errors = errors;
196
+ this.type = exports.DaffCartActionTypes.ResolveCartPartialSuccessAction;
197
+ }
198
+ return DaffResolveCartPartialSuccess;
199
+ }());
170
200
  /**
171
201
  * An action that indicates that a cart failed to resolve.
172
202
  */
@@ -208,6 +238,9 @@
208
238
  DaffCartItemActionTypes["CartItemDeleteAction"] = "[DaffCart] Cart Item Remove Action";
209
239
  DaffCartItemActionTypes["CartItemDeleteSuccessAction"] = "[DaffCart] Cart Item Remove Success Action";
210
240
  DaffCartItemActionTypes["CartItemDeleteFailureAction"] = "[DaffCart] Cart Item Remove Failure Action";
241
+ DaffCartItemActionTypes["CartItemDeleteOutOfStockAction"] = "[DaffCart] Cart Item Delete Out Of Stock Action";
242
+ DaffCartItemActionTypes["CartItemDeleteOutOfStockSuccessAction"] = "[DaffCart] Cart Item Delete Out Of Stock Success Action";
243
+ DaffCartItemActionTypes["CartItemDeleteOutOfStockFailureAction"] = "[DaffCart] Cart Item Delete Out Of Stock Failure Action";
211
244
  DaffCartItemActionTypes["CartItemStateResetAction"] = "[DaffCart] Cart Item State Reset Action";
212
245
  })(exports.DaffCartItemActionTypes || (exports.DaffCartItemActionTypes = {}));
213
246
  /**
@@ -364,6 +397,35 @@
364
397
  }
365
398
  return DaffCartItemDeleteFailure;
366
399
  }());
400
+ /**
401
+ * Triggers the deletion of all out of stock cart items.
402
+ */
403
+ var DaffCartItemDeleteOutOfStock = /** @class */ (function () {
404
+ function DaffCartItemDeleteOutOfStock() {
405
+ this.type = exports.DaffCartItemActionTypes.CartItemDeleteOutOfStockAction;
406
+ }
407
+ return DaffCartItemDeleteOutOfStock;
408
+ }());
409
+ /**
410
+ * Indicates the successful deletion of all out of stock cart items.
411
+ */
412
+ var DaffCartItemDeleteOutOfStockSuccess = /** @class */ (function () {
413
+ function DaffCartItemDeleteOutOfStockSuccess(payload) {
414
+ this.payload = payload;
415
+ this.type = exports.DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction;
416
+ }
417
+ return DaffCartItemDeleteOutOfStockSuccess;
418
+ }());
419
+ /**
420
+ * Indicates the failed deletion of all out of stock cart items.
421
+ */
422
+ var DaffCartItemDeleteOutOfStockFailure = /** @class */ (function () {
423
+ function DaffCartItemDeleteOutOfStockFailure(payload) {
424
+ this.payload = payload;
425
+ this.type = exports.DaffCartItemActionTypes.CartItemDeleteOutOfStockFailureAction;
426
+ }
427
+ return DaffCartItemDeleteOutOfStockFailure;
428
+ }());
367
429
  /**
368
430
  * Resets cart item "new" or "updated" states to default.
369
431
  */
@@ -1091,12 +1153,13 @@
1091
1153
  */
1092
1154
  function daffCartItemEntitiesReducer(state, action) {
1093
1155
  if (state === void 0) { state = daffCartItemEntitiesAdapter().getInitialState(); }
1156
+ var _a, _b;
1094
1157
  var adapter = daffCartItemEntitiesAdapter();
1095
1158
  switch (action.type) {
1096
1159
  case exports.DaffCartItemActionTypes.CartItemListSuccessAction:
1097
- return adapter.setAll(action.payload.map(function (item) { return (Object.assign(Object.assign({}, item), { daffState: getDaffState(state.entities[item.id]) || exports.DaffCartItemStateEnum.Default })); }), state);
1160
+ return adapter.setAll(action.payload.map(function (item) { return (Object.assign(Object.assign({}, item), { daffState: getDaffState(state.entities[item.id]) || exports.DaffCartItemStateEnum.Default, errors: [] })); }), state);
1098
1161
  case exports.DaffCartItemActionTypes.CartItemLoadSuccessAction:
1099
- return adapter.upsertOne(Object.assign(Object.assign({}, action.payload), { daffState: getDaffState(state.entities[action.payload.id]) || exports.DaffCartItemStateEnum.Default }), state);
1162
+ return adapter.upsertOne(Object.assign(Object.assign({}, action.payload), { daffState: getDaffState(state.entities[action.payload.id]) || exports.DaffCartItemStateEnum.Default, errors: [] }), state);
1100
1163
  case exports.DaffCartItemActionTypes.CartItemAddSuccessAction:
1101
1164
  return adapter.setAll(updateAddedCartItemState(state.entities, action.payload.items), state);
1102
1165
  case exports.DaffCartItemActionTypes.CartItemUpdateSuccessAction:
@@ -1104,10 +1167,13 @@
1104
1167
  case exports.DaffCartItemActionTypes.CartItemDeleteFailureAction:
1105
1168
  case exports.DaffCartItemActionTypes.CartItemLoadFailureAction:
1106
1169
  case exports.DaffCartItemActionTypes.CartItemUpdateFailureAction:
1107
- return adapter.upsertOne(Object.assign(Object.assign({}, state.entities[action.itemId]), { daffState: exports.DaffCartItemStateEnum.Error }), state);
1170
+ return adapter.upsertOne(Object.assign(Object.assign({}, state.entities[action.itemId]), { daffState: exports.DaffCartItemStateEnum.Error, errors: ((_b = (_a = state.entities[action.itemId]) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b.concat(action.payload)) || [action.payload] }), state);
1108
1171
  case exports.DaffCartItemActionTypes.CartItemDeleteSuccessAction:
1172
+ case exports.DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction:
1109
1173
  case exports.DaffCartActionTypes.CartLoadSuccessAction:
1110
1174
  case exports.DaffCartActionTypes.ResolveCartSuccessAction:
1175
+ case exports.DaffCartActionTypes.CartLoadPartialSuccessAction:
1176
+ case exports.DaffCartActionTypes.ResolveCartPartialSuccessAction:
1111
1177
  case exports.DaffCartActionTypes.CartClearSuccessAction:
1112
1178
  return adapter.setAll(action.payload.items.map(function (item) { return (Object.assign(Object.assign({}, item), { daffState: getDaffState(state.entities[item.id]) || exports.DaffCartItemStateEnum.Default })); }), state);
1113
1179
  case exports.DaffCartItemActionTypes.CartItemStateResetAction:
@@ -1129,16 +1195,16 @@
1129
1195
  var oldItem = oldCartItems[newItem.id];
1130
1196
  switch (true) {
1131
1197
  case !oldItem:
1132
- return Object.assign(Object.assign({}, newItem), { daffState: exports.DaffCartItemStateEnum.New });
1198
+ return Object.assign(Object.assign({}, newItem), { daffState: exports.DaffCartItemStateEnum.New, errors: [] });
1133
1199
  case (oldItem === null || oldItem === void 0 ? void 0 : oldItem.qty) !== newItem.qty:
1134
- return Object.assign(Object.assign({}, newItem), { daffState: exports.DaffCartItemStateEnum.Updated });
1200
+ return Object.assign(Object.assign({}, newItem), { daffState: exports.DaffCartItemStateEnum.Updated, errors: [] });
1135
1201
  default:
1136
1202
  return newItem;
1137
1203
  }
1138
1204
  });
1139
1205
  }
1140
1206
  function updateMutatedCartItemState(responseItems, stateItems, itemId) {
1141
- return responseItems.map(function (item) { return item.id === itemId ? Object.assign(Object.assign({}, item), { daffState: exports.DaffCartItemStateEnum.Updated }) : Object.assign(Object.assign({}, item), { daffState: getDaffState(stateItems[item.id]) || exports.DaffCartItemStateEnum.Default }); });
1207
+ return responseItems.map(function (item) { return item.id === itemId ? Object.assign(Object.assign({}, item), { daffState: exports.DaffCartItemStateEnum.Updated, errors: [] }) : Object.assign(Object.assign({}, item), { daffState: getDaffState(stateItems[item.id]) || exports.DaffCartItemStateEnum.Default }); });
1142
1208
  }
1143
1209
 
1144
1210
  /*! *****************************************************************************
@@ -1550,10 +1616,14 @@
1550
1616
  resolved: exports.DaffCartResolveState.Default,
1551
1617
  });
1552
1618
 
1553
- var initializeErrorAdder = function (errorSpace) { return function (errors, error) {
1619
+ var initializeErrorAdder = function (errorSpace) { return function (errors) {
1554
1620
  var _a;
1621
+ var errorsToAdd = [];
1622
+ for (var _i = 1; _i < arguments.length; _i++) {
1623
+ errorsToAdd[_i - 1] = arguments[_i];
1624
+ }
1555
1625
  return ({
1556
- errors: Object.assign(Object.assign({}, errors), (_a = {}, _a[errorSpace] = errors[errorSpace].concat(new Array(error)), _a)),
1626
+ errors: Object.assign(Object.assign({}, errors), (_a = {}, _a[errorSpace] = errors[errorSpace].concat(errorsToAdd), _a)),
1557
1627
  });
1558
1628
  }; };
1559
1629
  var initializeErrorResetter = function (errorSpace) { return function (errors) {
@@ -1629,11 +1699,16 @@
1629
1699
  var resetErrors$2 = initializeErrorResetter(exports.DaffCartOperationType.Item);
1630
1700
  var setLoading$2 = initializeLoadingSetter(exports.DaffCartOperationType.Item);
1631
1701
  function cartItemReducer(state, action) {
1702
+ var _a;
1632
1703
  if (state === void 0) { state = initialState; }
1633
1704
  switch (action.type) {
1634
1705
  case exports.DaffCartItemActionTypes.CartItemListAction:
1635
1706
  case exports.DaffCartItemActionTypes.CartItemLoadAction:
1636
1707
  return Object.assign(Object.assign({}, state), setLoading$2(state.loading, "Resolving" /* Resolving */));
1708
+ case exports.DaffCartItemActionTypes.CartItemUpdateAction:
1709
+ case exports.DaffCartItemActionTypes.CartItemDeleteAction:
1710
+ case exports.DaffCartItemActionTypes.CartItemDeleteOutOfStockAction:
1711
+ return Object.assign(Object.assign({}, state), setLoading$2(state.loading, "Mutating" /* Mutating */));
1637
1712
  case exports.DaffCartItemActionTypes.CartItemAddAction:
1638
1713
  return Object.assign(Object.assign({}, state), setLoading$2(state.loading, "Adding" /* Adding */));
1639
1714
  case exports.DaffCartItemActionTypes.CartItemListSuccessAction:
@@ -1646,11 +1721,19 @@
1646
1721
  case exports.DaffCartItemActionTypes.CartItemAddSuccessAction:
1647
1722
  case exports.DaffCartItemActionTypes.CartItemDeleteSuccessAction:
1648
1723
  return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$2(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), action.payload) }), setLoading$2(state.loading, "Stable" /* Complete */));
1724
+ case exports.DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction:
1725
+ return Object.assign(Object.assign(Object.assign({}, state), { errors: Object.assign(Object.assign({}, state.errors), (_a = {}, _a[exports.DaffCartOperationType.Item] = [],
1726
+ // out of stock errors can be in the main cart, remove them here
1727
+ _a[exports.DaffCartOperationType.Cart] = state.errors[exports.DaffCartOperationType.Cart].filter(function (_a) {
1728
+ var code = _a.code;
1729
+ return code !== driver.DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK;
1730
+ }), _a)), cart: Object.assign(Object.assign({}, state.cart), action.payload) }), setLoading$2(state.loading, "Stable" /* Complete */));
1649
1731
  case exports.DaffCartItemActionTypes.CartItemListFailureAction:
1650
1732
  case exports.DaffCartItemActionTypes.CartItemLoadFailureAction:
1651
1733
  case exports.DaffCartItemActionTypes.CartItemUpdateFailureAction:
1652
1734
  case exports.DaffCartItemActionTypes.CartItemAddFailureAction:
1653
1735
  case exports.DaffCartItemActionTypes.CartItemDeleteFailureAction:
1736
+ case exports.DaffCartItemActionTypes.CartItemDeleteOutOfStockFailureAction:
1654
1737
  return Object.assign(Object.assign(Object.assign({}, state), addError$2(state.errors, action.payload)), setLoading$2(state.loading, "Stable" /* Complete */));
1655
1738
  default:
1656
1739
  return state;
@@ -1816,19 +1899,22 @@
1816
1899
  case exports.DaffCartActionTypes.CartLoadSuccessAction:
1817
1900
  case exports.DaffCartActionTypes.CartClearSuccessAction:
1818
1901
  case exports.DaffCartActionTypes.AddToCartSuccessAction:
1819
- case exports.DaffCartActionTypes.CartCreateSuccessAction:
1820
1902
  case exports.DaffCartActionTypes.ResolveCartSuccessAction:
1821
1903
  return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$8(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), action.payload) }), setLoading$8(state.loading, "Stable" /* Complete */));
1822
1904
  case exports.DaffCartActionTypes.CartCreateSuccessAction:
1823
1905
  return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$8(state.errors)), { cart: Object.assign(Object.assign({}, initialState.cart), action.payload) }), setLoading$8(state.loading, "Stable" /* Complete */));
1824
- case exports.DaffCartActionTypes.CartLoadFailureAction:
1825
1906
  case exports.DaffCartActionTypes.CartClearFailureAction:
1826
1907
  case exports.DaffCartActionTypes.AddToCartFailureAction:
1827
1908
  case exports.DaffCartActionTypes.CartCreateFailureAction:
1828
1909
  case exports.DaffCartActionTypes.CartStorageFailureAction:
1829
- case exports.DaffCartActionTypes.ResolveCartFailureAction:
1830
1910
  case exports.DaffCartActionTypes.ResolveCartServerSideAction:
1831
1911
  return Object.assign(Object.assign(Object.assign({}, state), addError$8(state.errors, action.payload)), setLoading$8(state.loading, "Stable" /* Complete */));
1912
+ case exports.DaffCartActionTypes.CartLoadFailureAction:
1913
+ case exports.DaffCartActionTypes.ResolveCartFailureAction:
1914
+ return Object.assign(Object.assign(Object.assign({}, state), addError$8.apply(void 0, __spread([state.errors], action.payload))), setLoading$8(state.loading, "Stable" /* Stable */));
1915
+ case exports.DaffCartActionTypes.ResolveCartPartialSuccessAction:
1916
+ case exports.DaffCartActionTypes.CartLoadPartialSuccessAction:
1917
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, state), { cart: Object.assign(Object.assign({}, state.cart), action.payload) }), addError$8.apply(void 0, __spread([state.errors], action.errors))), setLoading$8(state.loading, "Stable" /* Stable */));
1832
1918
  default:
1833
1919
  return state;
1834
1920
  }
@@ -1952,6 +2038,8 @@
1952
2038
  return cartItem.options;
1953
2039
  }); }).memoized;
1954
2040
  var selectIsCartItemOutOfStock = i1.defaultMemoize(function (itemId) { return i1.createSelector(selectCartItem(itemId), function (cartItem) { return cartItem ? !cartItem.in_stock : null; }); }).memoized;
2041
+ var selectOutOfStockCartItems = i1.createSelector(selectAllCartItems, function (items) { return items.filter(function (item) { return !item.in_stock; }); });
2042
+ var selectInStockCartItems = i1.createSelector(selectAllCartItems, function (items) { return items.filter(function (item) { return item.in_stock; }); });
1955
2043
  var selectCartItemMutating = i1.createSelector(selectAllCartItems, function (cartItems) { return cartItems === null || cartItems === void 0 ? void 0 : cartItems.reduce(function (acc, item) { return acc || item.daffState === exports.DaffCartItemStateEnum.Mutating; }, false); });
1956
2044
  var selectCartItemState = i1.defaultMemoize(function (itemId) { return i1.createSelector(selectCartItem(itemId), function (cartItem) { return (cartItem === null || cartItem === void 0 ? void 0 : cartItem.daffState) || null; }); }).memoized;
1957
2045
  var selectCartItemQuantity = i1.defaultMemoize(function (itemId) { return i1.createSelector(selectCartItem(itemId), function (cartItem) { return (cartItem === null || cartItem === void 0 ? void 0 : cartItem.qty) || 0; }); }).memoized;
@@ -1962,6 +2050,7 @@
1962
2050
  var amount = _a.amount;
1963
2051
  return core.daffAdd(acc, amount);
1964
2052
  }, 0)) || 0; }); }).memoized;
2053
+ var selectCartItemErrors = i1.defaultMemoize(function (itemId) { return i1.createSelector(selectCartItem(itemId), function (cartItem) { return (cartItem === null || cartItem === void 0 ? void 0 : cartItem.errors) || []; }); }).memoized;
1965
2054
  return {
1966
2055
  selectCartItemEntitiesState: selectCartItemEntitiesState,
1967
2056
  selectCartItemIds: selectCartItemIds,
@@ -1973,6 +2062,8 @@
1973
2062
  selectCartItemConfiguredAttributes: selectCartItemConfiguredAttributes,
1974
2063
  selectCartItemCompositeOptions: selectCartItemCompositeOptions,
1975
2064
  selectIsCartItemOutOfStock: selectIsCartItemOutOfStock,
2065
+ selectInStockCartItems: selectInStockCartItems,
2066
+ selectOutOfStockCartItems: selectOutOfStockCartItems,
1976
2067
  selectCartItemMutating: selectCartItemMutating,
1977
2068
  selectCartItemState: selectCartItemState,
1978
2069
  selectCartItemPrice: selectCartItemPrice,
@@ -1980,6 +2071,7 @@
1980
2071
  selectCartItemQuantity: selectCartItemQuantity,
1981
2072
  selectCartItemDiscounts: selectCartItemDiscounts,
1982
2073
  selectCartItemTotalDiscount: selectCartItemTotalDiscount,
2074
+ selectCartItemErrors: selectCartItemErrors,
1983
2075
  };
1984
2076
  };
1985
2077
  var ɵ0$2 = createCartItemEntitiesSelectors;
@@ -2363,13 +2455,14 @@
2363
2455
  ], DaffCartCouponEffects.prototype, "removeAll$", void 0);
2364
2456
 
2365
2457
  var DaffCartItemEffects = /** @class */ (function () {
2366
- function DaffCartItemEffects(actions$, errorMatcher, driver, storage, cartItemStateDebounceTime) {
2458
+ function DaffCartItemEffects(actions$, errorMatcher, driver, storage, cartItemStateDebounceTime, store) {
2367
2459
  var _this = this;
2368
2460
  this.actions$ = actions$;
2369
2461
  this.errorMatcher = errorMatcher;
2370
2462
  this.driver = driver;
2371
2463
  this.storage = storage;
2372
2464
  this.cartItemStateDebounceTime = cartItemStateDebounceTime;
2465
+ this.store = store;
2373
2466
  this.list$ = this.actions$.pipe(effects.ofType(exports.DaffCartItemActionTypes.CartItemListAction), operators.switchMap(function (action) { return _this.driver.list(_this.storage.getCartId()).pipe(operators.map(function (resp) { return new DaffCartItemListSuccess(resp); }), operators.catchError(function (error) { return rxjs.of(new DaffCartItemListFailure(_this.errorMatcher(error))); })); }));
2374
2467
  this.get$ = this.actions$.pipe(effects.ofType(exports.DaffCartItemActionTypes.CartItemLoadAction), operators.switchMap(function (action) { return _this.driver.get(_this.storage.getCartId(), action.itemId).pipe(operators.map(function (resp) { return new DaffCartItemLoadSuccess(resp); }), operators.catchError(function (error) { return rxjs.of(new DaffCartItemLoadFailure(_this.errorMatcher(error), action.itemId)); })); }));
2375
2468
  this.add$ = this.actions$.pipe(effects.ofType(exports.DaffCartItemActionTypes.CartItemAddAction), operators.switchMap(function (action) { return _this.driver.add(_this.storage.getCartId(), action.input).pipe(operators.map(function (resp) { return new DaffCartItemAddSuccess(resp); }), operators.catchError(function (error) { return rxjs.of(new DaffCartItemAddFailure(_this.errorMatcher(error))); })); }));
@@ -2380,6 +2473,9 @@
2380
2473
  // these actions will cause the cart item state reset
2381
2474
  exports.DaffCartItemActionTypes.CartItemAddSuccessAction, exports.DaffCartItemActionTypes.CartItemUpdateSuccessAction), operators.mapTo(new DaffCartItemStateReset()));
2382
2475
  this.delete$ = this.actions$.pipe(effects.ofType(exports.DaffCartItemActionTypes.CartItemDeleteAction), operators.mergeMap(function (action) { return _this.driver.delete(_this.storage.getCartId(), action.itemId).pipe(operators.map(function (resp) { return new DaffCartItemDeleteSuccess(resp); }), operators.catchError(function (error) { return rxjs.of(new DaffCartItemDeleteFailure(_this.errorMatcher(error), action.itemId)); })); }));
2476
+ this.removeOutOfStock$ = this.actions$.pipe(effects.ofType(exports.DaffCartItemActionTypes.CartItemDeleteOutOfStockAction), operators.switchMap(function (action) { return _this.store.pipe(i1.select(getDaffCartSelectors().selectOutOfStockCartItems), operators.take(1)); }), operators.switchMap(function (items) { return items.length > 0
2477
+ ? rxjs.combineLatest(items.map(function (item) { return _this.driver.delete(_this.storage.getCartId(), item.id); })).pipe(operators.map(function (partialCarts) { return Object.assign.apply(Object, __spread([{}], partialCarts)); }))
2478
+ : _this.store.pipe(i1.select(getDaffCartSelectors().selectCartValue), operators.take(1)); }), operators.map(function (cart) { return new DaffCartItemDeleteOutOfStockSuccess(cart); }), operators.catchError(function (error) { return rxjs.of(new DaffCartItemDeleteOutOfStockFailure(_this.errorMatcher(error))); }));
2383
2479
  }
2384
2480
  return DaffCartItemEffects;
2385
2481
  }());
@@ -2392,7 +2488,8 @@
2392
2488
  { type: undefined, decorators: [{ type: i0.Inject, args: [i2.DAFF_CART_ERROR_MATCHER,] }] },
2393
2489
  { type: undefined, decorators: [{ type: i0.Inject, args: [driver.DaffCartItemDriver,] }] },
2394
2490
  { type: i2.DaffCartStorageService },
2395
- { type: Number, decorators: [{ type: i0.Inject, args: [DaffCartItemStateDebounceTime,] }] }
2491
+ { type: Number, decorators: [{ type: i0.Inject, args: [DaffCartItemStateDebounceTime,] }] },
2492
+ { type: i1.Store }
2396
2493
  ]; };
2397
2494
  __decorate([
2398
2495
  effects.Effect(),
@@ -2418,6 +2515,10 @@
2418
2515
  effects.Effect(),
2419
2516
  __metadata("design:type", Object)
2420
2517
  ], DaffCartItemEffects.prototype, "delete$", void 0);
2518
+ __decorate([
2519
+ effects.Effect(),
2520
+ __metadata("design:type", Object)
2521
+ ], DaffCartItemEffects.prototype, "removeOutOfStock$", void 0);
2421
2522
 
2422
2523
  var DaffCartOrderEffects = /** @class */ (function () {
2423
2524
  function DaffCartOrderEffects(actions$, errorMatcher, driver, storage) {
@@ -2536,19 +2637,36 @@
2536
2637
  this.onResolveCart = function () { return _this.actions$.pipe(effects.ofType(exports.DaffCartActionTypes.ResolveCartAction), operators.switchMap(function () { return rxjs.of(null).pipe(operators.map(function () { return _this.cartStorage.getCartId(); }), operators.switchMap(function (cartId) { return cartId ? rxjs.of({ id: cartId }) : _this.driver.create(); }), operators.switchMap(function (_a) {
2537
2638
  var id = _a.id;
2538
2639
  return _this.driver.get(id);
2539
- }), operators.map(function (resp) { return new DaffResolveCartSuccess(resp); }), operators.catchError(function (error) {
2640
+ }), operators.switchMap(function (_a) {
2641
+ var response = _a.response, errors = _a.errors;
2642
+ if (errors.length === 0) {
2643
+ return rxjs.of(new DaffResolveCartSuccess(response));
2644
+ }
2645
+ var hasOnlyRecoverableErrors = errors.reduce(function (acc, error) { return acc && error.recoverable; }, true);
2646
+ if (hasOnlyRecoverableErrors) {
2647
+ return rxjs.of(new DaffResolveCartPartialSuccess(response, errors.map(function (error) { return _this.errorMatcher(error); })));
2648
+ }
2649
+ if (errors.filter(function (error) { return error instanceof driver.DaffCartNotFoundError; }).length > 0) {
2650
+ return _this.driver.create().pipe(operators.switchMap(function (_a) {
2651
+ var id = _a.id;
2652
+ return _this.driver.get(id);
2653
+ }), operators.map(function (resp) { return new DaffResolveCartSuccess(resp.response); }), operators.catchError(function (innerError) { return rxjs.of(new DaffResolveCartFailure([_this.errorMatcher(new i2.DaffCartNotFoundOrCreatedResolutionError(innerError.message))])); }));
2654
+ }
2655
+ // there are no special case errors, DaffResolveCartFailure will suffice
2656
+ // just map the errors
2657
+ return rxjs.of(new DaffResolveCartFailure(errors.map(function (error) { return _this.errorMatcher(
2658
+ // I wish there was a better way to check this
2659
+ error instanceof core.DaffInheritableError || !!error.code
2660
+ ? error
2661
+ : new i2.DaffCartResolutionError(error.message)); })));
2662
+ }), operators.catchError(function (error) {
2540
2663
  switch (true) {
2541
2664
  case error instanceof core.DaffServerSideStorageError:
2542
2665
  return rxjs.of(new DaffResolveCartServerSide(_this.errorMatcher(new i2.DaffCartServerSideResolutionError(error.message))));
2543
2666
  case error instanceof core.DaffStorageServiceError:
2544
- return rxjs.of(new DaffResolveCartFailure(_this.errorMatcher(new i2.DaffCartStorageResolutionError(error.message))));
2545
- case error instanceof driver.DaffCartNotFoundError:
2546
- return _this.driver.create().pipe(operators.switchMap(function (_a) {
2547
- var id = _a.id;
2548
- return _this.driver.get(id);
2549
- }), operators.map(function (resp) { return new DaffResolveCartSuccess(resp); }), operators.catchError(function (innerError) { return rxjs.of(new DaffResolveCartFailure(_this.errorMatcher(new i2.DaffCartNotFoundOrCreatedResolutionError(innerError.message)))); }));
2667
+ return rxjs.of(new DaffResolveCartFailure([_this.errorMatcher(new i2.DaffCartStorageResolutionError(error.message))]));
2550
2668
  default:
2551
- return rxjs.of(new DaffResolveCartFailure(_this.errorMatcher(new i2.DaffCartResolutionError(error.message))));
2669
+ return rxjs.of(new DaffResolveCartFailure([_this.errorMatcher(new i2.DaffCartResolutionError(error.message))]));
2552
2670
  }
2553
2671
  })); })); };
2554
2672
  }
@@ -2676,9 +2794,19 @@
2676
2794
  this.storeId$ = this.actions$.pipe(effects.ofType(exports.DaffCartActionTypes.CartCreateSuccessAction, exports.DaffCartActionTypes.ResolveCartSuccessAction), operators.switchMap(function (action) { return rxjs.of(null).pipe(operators.tap(function () {
2677
2795
  _this.storage.setCartId(action.payload.id);
2678
2796
  }), operators.switchMapTo(rxjs.EMPTY), operators.catchError(function (error) { return rxjs.of(new DaffCartStorageFailure(_this.errorMatcher(error))); })); }));
2679
- this.get$ = this.actions$.pipe(effects.ofType(exports.DaffCartActionTypes.CartLoadAction), operators.switchMap(function (action) { return rxjs.of(null).pipe(operators.map(function () { return _this.storage.getCartId(); }), operators.switchMap(function (cartId) { return _this.driver.get(cartId); }), operators.map(function (resp) { return new DaffCartLoadSuccess(resp); }), operators.catchError(function (error) { return rxjs.of(error instanceof core.DaffStorageServiceError
2797
+ this.get$ = this.actions$.pipe(effects.ofType(exports.DaffCartActionTypes.CartLoadAction), operators.switchMap(function (action) { return rxjs.of(null).pipe(operators.map(function () { return _this.storage.getCartId(); }), operators.switchMap(function (cartId) { return _this.driver.get(cartId); }), operators.map(function (_a) {
2798
+ var response = _a.response, errors = _a.errors;
2799
+ if (errors.length === 0) {
2800
+ return new DaffCartLoadSuccess(response);
2801
+ }
2802
+ var hasOnlyRecoverableErrors = errors.reduce(function (acc, error) { return acc && error.recoverable; }, true);
2803
+ if (hasOnlyRecoverableErrors) {
2804
+ return new DaffCartLoadPartialSuccess(response, errors.map(function (error) { return _this.errorMatcher(error); }));
2805
+ }
2806
+ return new DaffCartLoadFailure(errors.map(function (error) { return _this.errorMatcher(error); }));
2807
+ }), operators.catchError(function (error) { return rxjs.of(error instanceof core.DaffStorageServiceError
2680
2808
  ? new DaffCartStorageFailure(_this.errorMatcher(error))
2681
- : new DaffCartLoadFailure(_this.errorMatcher(error))); })); }));
2809
+ : new DaffCartLoadFailure([_this.errorMatcher(error)])); })); }));
2682
2810
  this.addToCart$ = this.actions$.pipe(effects.ofType(exports.DaffCartActionTypes.AddToCartAction), operators.switchMap(function (action) { return _this.driver.addToCart(action.payload.productId, action.payload.qty).pipe(operators.map(function (resp) { return new DaffAddToCartSuccess(resp); }), operators.catchError(function (error) { return rxjs.of(new DaffAddToCartFailure(_this.errorMatcher(error))); })); }));
2683
2811
  this.clear$ = this.actions$.pipe(effects.ofType(exports.DaffCartActionTypes.CartClearAction), operators.switchMap(function (action) { return rxjs.of(null).pipe(operators.map(function () { return _this.storage.getCartId(); }), operators.switchMap(function (cartId) { return _this.driver.clear(cartId); }), operators.map(function (resp) { return new DaffCartClearSuccess(resp); }), operators.catchError(function (error) { return rxjs.of(error instanceof core.DaffStorageServiceError
2684
2812
  ? new DaffCartStorageFailure(_this.errorMatcher(error))
@@ -2771,7 +2899,7 @@
2771
2899
  var _this = this;
2772
2900
  this.store = store;
2773
2901
  this.paymentMethodMap = paymentMethodMap;
2774
- var _a = getDaffCartSelectors(), selectCartValue = _a.selectCartValue, selectCartResolved = _a.selectCartResolved, selectCartLoadingObject = _a.selectCartLoadingObject, selectCartFeatureLoading = _a.selectCartFeatureLoading, selectCartFeatureResolving = _a.selectCartFeatureResolving, selectCartFeatureMutating = _a.selectCartFeatureMutating, selectCartLoading = _a.selectCartLoading, selectCartResolving = _a.selectCartResolving, selectCartMutating = _a.selectCartMutating, selectBillingAddressLoading = _a.selectBillingAddressLoading, selectBillingAddressResolving = _a.selectBillingAddressResolving, selectBillingAddressMutating = _a.selectBillingAddressMutating, selectShippingAddressLoading = _a.selectShippingAddressLoading, selectShippingAddressResolving = _a.selectShippingAddressResolving, selectShippingAddressMutating = _a.selectShippingAddressMutating, selectShippingInformationLoading = _a.selectShippingInformationLoading, selectShippingInformationResolving = _a.selectShippingInformationResolving, selectShippingInformationMutating = _a.selectShippingInformationMutating, selectShippingMethodsLoading = _a.selectShippingMethodsLoading, selectShippingMethodsResolving = _a.selectShippingMethodsResolving, selectPaymentLoading = _a.selectPaymentLoading, selectPaymentResolving = _a.selectPaymentResolving, selectPaymentMutating = _a.selectPaymentMutating, selectPaymentMethodsLoading = _a.selectPaymentMethodsLoading, selectPaymentMethodsResolving = _a.selectPaymentMethodsResolving, selectCouponLoading = _a.selectCouponLoading, selectCouponResolving = _a.selectCouponResolving, selectCouponMutating = _a.selectCouponMutating, selectItemLoading = _a.selectItemLoading, selectItemAdding = _a.selectItemAdding, selectItemResolving = _a.selectItemResolving, selectCartItemMutating = _a.selectCartItemMutating, selectCartErrorsObject = _a.selectCartErrorsObject, selectCartErrors = _a.selectCartErrors, selectItemErrors = _a.selectItemErrors, selectBillingAddressErrors = _a.selectBillingAddressErrors, selectShippingAddressErrors = _a.selectShippingAddressErrors, selectShippingInformationErrors = _a.selectShippingInformationErrors, selectShippingMethodsErrors = _a.selectShippingMethodsErrors, selectPaymentErrors = _a.selectPaymentErrors, selectPaymentMethodsErrors = _a.selectPaymentMethodsErrors, selectCouponErrors = _a.selectCouponErrors, selectCartId = _a.selectCartId, selectCartSubtotal = _a.selectCartSubtotal, selectCartGrandTotal = _a.selectCartGrandTotal, selectCartSubtotalExcludingTax = _a.selectCartSubtotalExcludingTax, selectCartSubtotalIncludingTax = _a.selectCartSubtotalIncludingTax, selectCartSubtotalWithDiscountExcludingTax = _a.selectCartSubtotalWithDiscountExcludingTax, selectCartSubtotalWithDiscountIncludingTax = _a.selectCartSubtotalWithDiscountIncludingTax, selectCartDiscountTotals = _a.selectCartDiscountTotals, selectCartTotalTax = _a.selectCartTotalTax, selectCartShippingTotal = _a.selectCartShippingTotal, selectCartCoupons = _a.selectCartCoupons, selectCartItems = _a.selectCartItems, selectCartHasOutOfStockItems = _a.selectCartHasOutOfStockItems, selectCartItemEntities = _a.selectCartItemEntities, selectTotalNumberOfCartItems = _a.selectTotalNumberOfCartItems, selectCartItemConfiguredAttributes = _a.selectCartItemConfiguredAttributes, selectCartItemCompositeOptions = _a.selectCartItemCompositeOptions, selectCartBillingAddress = _a.selectCartBillingAddress, selectCartShippingAddress = _a.selectCartShippingAddress, selectCartPayment = _a.selectCartPayment, selectCartTotals = _a.selectCartTotals, selectCartShippingInformation = _a.selectCartShippingInformation, selectCartAvailableShippingMethods = _a.selectCartAvailableShippingMethods, selectCartAvailablePaymentMethods = _a.selectCartAvailablePaymentMethods, selectIsCartEmpty = _a.selectIsCartEmpty, selectIsBillingSameAsShipping = _a.selectIsBillingSameAsShipping, selectCartOrderLoading = _a.selectCartOrderLoading, selectCartOrderErrors = _a.selectCartOrderErrors, selectCartOrderValue = _a.selectCartOrderValue, selectCartOrderId = _a.selectCartOrderId, selectCartOrderCartId = _a.selectCartOrderCartId, selectHasOrderResult = _a.selectHasOrderResult, selectIsCartItemOutOfStock = _a.selectIsCartItemOutOfStock, selectCartItemState = _a.selectCartItemState, selectHasBillingAddress = _a.selectHasBillingAddress, selectHasShippingAddress = _a.selectHasShippingAddress, selectHasShippingMethod = _a.selectHasShippingMethod, selectHasPaymentMethod = _a.selectHasPaymentMethod, selectCanPlaceOrder = _a.selectCanPlaceOrder, selectCartItemPrice = _a.selectCartItemPrice, selectCartItemRowTotal = _a.selectCartItemRowTotal, selectCartItemQuantity = _a.selectCartItemQuantity, selectCartItemDiscounts = _a.selectCartItemDiscounts, selectCartItemTotalDiscount = _a.selectCartItemTotalDiscount;
2902
+ var _a = getDaffCartSelectors(), selectCartValue = _a.selectCartValue, selectCartResolved = _a.selectCartResolved, selectCartLoadingObject = _a.selectCartLoadingObject, selectCartFeatureLoading = _a.selectCartFeatureLoading, selectCartFeatureResolving = _a.selectCartFeatureResolving, selectCartFeatureMutating = _a.selectCartFeatureMutating, selectCartLoading = _a.selectCartLoading, selectCartResolving = _a.selectCartResolving, selectCartMutating = _a.selectCartMutating, selectBillingAddressLoading = _a.selectBillingAddressLoading, selectBillingAddressResolving = _a.selectBillingAddressResolving, selectBillingAddressMutating = _a.selectBillingAddressMutating, selectShippingAddressLoading = _a.selectShippingAddressLoading, selectShippingAddressResolving = _a.selectShippingAddressResolving, selectShippingAddressMutating = _a.selectShippingAddressMutating, selectShippingInformationLoading = _a.selectShippingInformationLoading, selectShippingInformationResolving = _a.selectShippingInformationResolving, selectShippingInformationMutating = _a.selectShippingInformationMutating, selectShippingMethodsLoading = _a.selectShippingMethodsLoading, selectShippingMethodsResolving = _a.selectShippingMethodsResolving, selectPaymentLoading = _a.selectPaymentLoading, selectPaymentResolving = _a.selectPaymentResolving, selectPaymentMutating = _a.selectPaymentMutating, selectPaymentMethodsLoading = _a.selectPaymentMethodsLoading, selectPaymentMethodsResolving = _a.selectPaymentMethodsResolving, selectCouponLoading = _a.selectCouponLoading, selectCouponResolving = _a.selectCouponResolving, selectCouponMutating = _a.selectCouponMutating, selectItemLoading = _a.selectItemLoading, selectItemAdding = _a.selectItemAdding, selectItemResolving = _a.selectItemResolving, selectCartItemMutating = _a.selectCartItemMutating, selectCartErrorsObject = _a.selectCartErrorsObject, selectCartErrors = _a.selectCartErrors, selectItemErrors = _a.selectItemErrors, selectBillingAddressErrors = _a.selectBillingAddressErrors, selectShippingAddressErrors = _a.selectShippingAddressErrors, selectShippingInformationErrors = _a.selectShippingInformationErrors, selectShippingMethodsErrors = _a.selectShippingMethodsErrors, selectPaymentErrors = _a.selectPaymentErrors, selectPaymentMethodsErrors = _a.selectPaymentMethodsErrors, selectCouponErrors = _a.selectCouponErrors, selectCartId = _a.selectCartId, selectCartSubtotal = _a.selectCartSubtotal, selectCartGrandTotal = _a.selectCartGrandTotal, selectCartSubtotalExcludingTax = _a.selectCartSubtotalExcludingTax, selectCartSubtotalIncludingTax = _a.selectCartSubtotalIncludingTax, selectCartSubtotalWithDiscountExcludingTax = _a.selectCartSubtotalWithDiscountExcludingTax, selectCartSubtotalWithDiscountIncludingTax = _a.selectCartSubtotalWithDiscountIncludingTax, selectCartDiscountTotals = _a.selectCartDiscountTotals, selectCartTotalTax = _a.selectCartTotalTax, selectCartShippingTotal = _a.selectCartShippingTotal, selectCartCoupons = _a.selectCartCoupons, selectCartItems = _a.selectCartItems, selectAllCartItems = _a.selectAllCartItems, selectCartHasOutOfStockItems = _a.selectCartHasOutOfStockItems, selectOutOfStockCartItems = _a.selectOutOfStockCartItems, selectInStockCartItems = _a.selectInStockCartItems, selectCartItemEntities = _a.selectCartItemEntities, selectTotalNumberOfCartItems = _a.selectTotalNumberOfCartItems, selectCartItemConfiguredAttributes = _a.selectCartItemConfiguredAttributes, selectCartItemCompositeOptions = _a.selectCartItemCompositeOptions, selectCartBillingAddress = _a.selectCartBillingAddress, selectCartShippingAddress = _a.selectCartShippingAddress, selectCartPayment = _a.selectCartPayment, selectCartTotals = _a.selectCartTotals, selectCartShippingInformation = _a.selectCartShippingInformation, selectCartAvailableShippingMethods = _a.selectCartAvailableShippingMethods, selectCartAvailablePaymentMethods = _a.selectCartAvailablePaymentMethods, selectIsCartEmpty = _a.selectIsCartEmpty, selectIsBillingSameAsShipping = _a.selectIsBillingSameAsShipping, selectCartOrderLoading = _a.selectCartOrderLoading, selectCartOrderErrors = _a.selectCartOrderErrors, selectCartOrderValue = _a.selectCartOrderValue, selectCartOrderId = _a.selectCartOrderId, selectCartOrderCartId = _a.selectCartOrderCartId, selectHasOrderResult = _a.selectHasOrderResult, selectIsCartItemOutOfStock = _a.selectIsCartItemOutOfStock, selectCartItemState = _a.selectCartItemState, selectHasBillingAddress = _a.selectHasBillingAddress, selectHasShippingAddress = _a.selectHasShippingAddress, selectHasShippingMethod = _a.selectHasShippingMethod, selectHasPaymentMethod = _a.selectHasPaymentMethod, selectCanPlaceOrder = _a.selectCanPlaceOrder, selectCartItemPrice = _a.selectCartItemPrice, selectCartItemRowTotal = _a.selectCartItemRowTotal, selectCartItemQuantity = _a.selectCartItemQuantity, selectCartItemDiscounts = _a.selectCartItemDiscounts, selectCartItemTotalDiscount = _a.selectCartItemTotalDiscount, selectCartItemErrors = _a.selectCartItemErrors;
2775
2903
  this._selectCartItemConfiguredAttributes = selectCartItemConfiguredAttributes;
2776
2904
  this._selectCartItemCompositeOptions = selectCartItemCompositeOptions;
2777
2905
  this._selectIsCartItemOutOfStock = selectIsCartItemOutOfStock;
@@ -2781,6 +2909,7 @@
2781
2909
  this._selectCartItemRowTotal = selectCartItemRowTotal;
2782
2910
  this._selectCartItemDiscounts = selectCartItemDiscounts;
2783
2911
  this._selectCartItemTotalDiscount = selectCartItemTotalDiscount;
2912
+ this._selectCartItemErrors = selectCartItemErrors;
2784
2913
  this.cart$ = this.store.pipe(i1.select(selectCartValue));
2785
2914
  this.resolved$ = this.store.pipe(i1.select(selectCartResolved));
2786
2915
  this.loadingObject$ = this.store.pipe(i1.select(selectCartLoadingObject));
@@ -2835,8 +2964,11 @@
2835
2964
  this.shippingTotal$ = this.store.pipe(i1.select(selectCartShippingTotal));
2836
2965
  this.coupons$ = this.store.pipe(i1.select(selectCartCoupons));
2837
2966
  this.items$ = this.store.pipe(i1.select(selectCartItems));
2967
+ this.itemEntities$ = this.store.pipe(i1.select(selectAllCartItems));
2838
2968
  this.totalItems$ = this.store.pipe(i1.select(selectTotalNumberOfCartItems));
2839
2969
  this.hasOutOfStockItems$ = this.store.pipe(i1.select(selectCartHasOutOfStockItems));
2970
+ this.outOfStockItems$ = this.store.pipe(i1.select(selectOutOfStockCartItems));
2971
+ this.inStockItems$ = this.store.pipe(i1.select(selectInStockCartItems));
2840
2972
  this.itemDictionary$ = this.store.pipe(i1.select(selectCartItemEntities));
2841
2973
  this.billingAddress$ = this.store.pipe(i1.select(selectCartBillingAddress));
2842
2974
  this.shippingAddress$ = this.store.pipe(i1.select(selectCartShippingAddress));
@@ -2891,6 +3023,10 @@
2891
3023
  DaffCartFacade.prototype.getCartItemTotalDiscount = function (itemId) {
2892
3024
  return this.store.pipe(i1.select(this._selectCartItemTotalDiscount(itemId)));
2893
3025
  };
3026
+ DaffCartFacade.prototype.getCartItemErrors = function (itemId) {
3027
+ return this.store.pipe(i1.select(this._selectCartItemErrors(itemId)));
3028
+ };
3029
+ ;
2894
3030
  DaffCartFacade.prototype.dispatch = function (action) {
2895
3031
  this.store.dispatch(action);
2896
3032
  };
@@ -2951,6 +3087,9 @@
2951
3087
  exports.DaffCartItemAddSuccess = DaffCartItemAddSuccess;
2952
3088
  exports.DaffCartItemDelete = DaffCartItemDelete;
2953
3089
  exports.DaffCartItemDeleteFailure = DaffCartItemDeleteFailure;
3090
+ exports.DaffCartItemDeleteOutOfStock = DaffCartItemDeleteOutOfStock;
3091
+ exports.DaffCartItemDeleteOutOfStockFailure = DaffCartItemDeleteOutOfStockFailure;
3092
+ exports.DaffCartItemDeleteOutOfStockSuccess = DaffCartItemDeleteOutOfStockSuccess;
2954
3093
  exports.DaffCartItemDeleteSuccess = DaffCartItemDeleteSuccess;
2955
3094
  exports.DaffCartItemList = DaffCartItemList;
2956
3095
  exports.DaffCartItemListFailure = DaffCartItemListFailure;
@@ -2965,6 +3104,7 @@
2965
3104
  exports.DaffCartItemUpdateSuccess = DaffCartItemUpdateSuccess;
2966
3105
  exports.DaffCartLoad = DaffCartLoad;
2967
3106
  exports.DaffCartLoadFailure = DaffCartLoadFailure;
3107
+ exports.DaffCartLoadPartialSuccess = DaffCartLoadPartialSuccess;
2968
3108
  exports.DaffCartLoadSuccess = DaffCartLoadSuccess;
2969
3109
  exports.DaffCartPaymentLoad = DaffCartPaymentLoad;
2970
3110
  exports.DaffCartPaymentLoadFailure = DaffCartPaymentLoadFailure;
@@ -3007,6 +3147,7 @@
3007
3147
  exports.DaffCartStorageFailure = DaffCartStorageFailure;
3008
3148
  exports.DaffResolveCart = DaffResolveCart;
3009
3149
  exports.DaffResolveCartFailure = DaffResolveCartFailure;
3150
+ exports.DaffResolveCartPartialSuccess = DaffResolveCartPartialSuccess;
3010
3151
  exports.DaffResolveCartServerSide = DaffResolveCartServerSide;
3011
3152
  exports.DaffResolveCartSuccess = DaffResolveCartSuccess;
3012
3153
  exports.daffCartOrderInitialState = daffCartOrderInitialState;