merchi_cart 0.0.4-c → 0.0.4-e

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 (196) hide show
  1. package/lib/Cart.js +20 -25
  2. package/lib/CartAlert.js +14 -12
  3. package/lib/CartHeader.js +9 -9
  4. package/lib/CartProvider.js +157 -226
  5. package/lib/CartTotals.js +44 -44
  6. package/lib/MerchiSDK/constants/auto_assign_production_on_actions.js +1 -1
  7. package/lib/MerchiSDK/constants/call_to_actions.js +1 -1
  8. package/lib/MerchiSDK/constants/discount_types.js +1 -1
  9. package/lib/MerchiSDK/constants/domain_types.js +1 -1
  10. package/lib/MerchiSDK/constants/errors.js +1 -1
  11. package/lib/MerchiSDK/constants/event_types.js +1 -1
  12. package/lib/MerchiSDK/constants/field_types.js +1 -1
  13. package/lib/MerchiSDK/constants/input_types.js +1 -1
  14. package/lib/MerchiSDK/constants/inventory_statuses.js +1 -1
  15. package/lib/MerchiSDK/constants/invoice_types.js +1 -1
  16. package/lib/MerchiSDK/constants/item_types.js +1 -1
  17. package/lib/MerchiSDK/constants/job/drafting_status.js +1 -1
  18. package/lib/MerchiSDK/constants/job/payment_status.js +1 -1
  19. package/lib/MerchiSDK/constants/job/production_status.js +1 -1
  20. package/lib/MerchiSDK/constants/job/shipment_status.js +1 -1
  21. package/lib/MerchiSDK/constants/job/supply_chain_request_status.js +1 -1
  22. package/lib/MerchiSDK/constants/job_priorities.js +1 -1
  23. package/lib/MerchiSDK/constants/job_status.js +5 -5
  24. package/lib/MerchiSDK/constants/job_types.js +1 -1
  25. package/lib/MerchiSDK/constants/notification_sections.js +1 -1
  26. package/lib/MerchiSDK/constants/notification_types.js +1 -1
  27. package/lib/MerchiSDK/constants/notification_urgencies.js +1 -1
  28. package/lib/MerchiSDK/constants/payment_types.js +1 -1
  29. package/lib/MerchiSDK/constants/platform.js +5 -5
  30. package/lib/MerchiSDK/constants/product_types.js +1 -1
  31. package/lib/MerchiSDK/constants/rights.js +1 -1
  32. package/lib/MerchiSDK/constants/robots_meta_directives.js +1 -1
  33. package/lib/MerchiSDK/constants/roles.js +8 -14
  34. package/lib/MerchiSDK/constants/shipment_companies.js +1 -1
  35. package/lib/MerchiSDK/constants/shipment_services.js +1 -1
  36. package/lib/MerchiSDK/constants/system_roles.js +1 -1
  37. package/lib/MerchiSDK/constants/theme_foundations.js +1 -1
  38. package/lib/MerchiSDK/constants/theme_status.js +1 -1
  39. package/lib/MerchiSDK/constants/user_types.js +1 -1
  40. package/lib/MerchiSDK/constants/white_label_accessibilities.js +1 -1
  41. package/lib/MerchiSDK/cookie.js +3 -3
  42. package/lib/MerchiSDK/entities/address.js +22 -43
  43. package/lib/MerchiSDK/entities/assignment.js +28 -49
  44. package/lib/MerchiSDK/entities/automatic_payment_relationship.js +11 -32
  45. package/lib/MerchiSDK/entities/backup.js +6 -27
  46. package/lib/MerchiSDK/entities/bank.js +17 -38
  47. package/lib/MerchiSDK/entities/cart.js +31 -64
  48. package/lib/MerchiSDK/entities/cart_item.js +30 -51
  49. package/lib/MerchiSDK/entities/cart_shipment_group.js +9 -30
  50. package/lib/MerchiSDK/entities/cart_shipment_quote.js +13 -34
  51. package/lib/MerchiSDK/entities/category.js +14 -35
  52. package/lib/MerchiSDK/entities/company.js +88 -109
  53. package/lib/MerchiSDK/entities/company_invitation.js +13 -34
  54. package/lib/MerchiSDK/entities/component.js +33 -54
  55. package/lib/MerchiSDK/entities/component_tag.js +7 -28
  56. package/lib/MerchiSDK/entities/component_version.js +12 -33
  57. package/lib/MerchiSDK/entities/country_tax.js +21 -45
  58. package/lib/MerchiSDK/entities/discount.js +13 -34
  59. package/lib/MerchiSDK/entities/discount_group.js +11 -32
  60. package/lib/MerchiSDK/entities/domain.js +80 -101
  61. package/lib/MerchiSDK/entities/domain_invitation.js +14 -35
  62. package/lib/MerchiSDK/entities/domain_tag.js +15 -36
  63. package/lib/MerchiSDK/entities/draft.js +32 -65
  64. package/lib/MerchiSDK/entities/draft_comment.js +19 -40
  65. package/lib/MerchiSDK/entities/draft_template.js +15 -36
  66. package/lib/MerchiSDK/entities/email_address.js +10 -31
  67. package/lib/MerchiSDK/entities/email_counter.js +8 -29
  68. package/lib/MerchiSDK/entities/enrolled_domain.js +20 -44
  69. package/lib/MerchiSDK/entities/exchange_rate.js +9 -30
  70. package/lib/MerchiSDK/entities/file.js +59 -80
  71. package/lib/MerchiSDK/entities/internal_tag.js +17 -38
  72. package/lib/MerchiSDK/entities/inventory.js +19 -42
  73. package/lib/MerchiSDK/entities/inventory_unit_variation.js +12 -33
  74. package/lib/MerchiSDK/entities/invoice.js +57 -78
  75. package/lib/MerchiSDK/entities/item.js +18 -39
  76. package/lib/MerchiSDK/entities/job.js +117 -140
  77. package/lib/MerchiSDK/entities/job_comment.js +18 -39
  78. package/lib/MerchiSDK/entities/matching_inventory.js +11 -32
  79. package/lib/MerchiSDK/entities/menu.js +12 -33
  80. package/lib/MerchiSDK/entities/menu_item.js +12 -33
  81. package/lib/MerchiSDK/entities/notification.js +32 -53
  82. package/lib/MerchiSDK/entities/page.js +13 -34
  83. package/lib/MerchiSDK/entities/payment.js +25 -46
  84. package/lib/MerchiSDK/entities/payment_device.js +12 -33
  85. package/lib/MerchiSDK/entities/phone_number.js +14 -35
  86. package/lib/MerchiSDK/entities/product.js +153 -188
  87. package/lib/MerchiSDK/entities/production_comment.js +18 -39
  88. package/lib/MerchiSDK/entities/quote.js +70 -106
  89. package/lib/MerchiSDK/entities/quote_item.js +28 -49
  90. package/lib/MerchiSDK/entities/seo_domain_page.js +13 -34
  91. package/lib/MerchiSDK/entities/session.js +11 -32
  92. package/lib/MerchiSDK/entities/shipment.js +62 -83
  93. package/lib/MerchiSDK/entities/shipment_item.js +7 -28
  94. package/lib/MerchiSDK/entities/shipment_item_fulfillment.js +7 -28
  95. package/lib/MerchiSDK/entities/shipment_method.js +21 -42
  96. package/lib/MerchiSDK/entities/shipment_method_variation.js +15 -36
  97. package/lib/MerchiSDK/entities/short_url.js +14 -35
  98. package/lib/MerchiSDK/entities/subscription_plan.js +26 -47
  99. package/lib/MerchiSDK/entities/supply_domain.js +11 -32
  100. package/lib/MerchiSDK/entities/system_role.js +7 -28
  101. package/lib/MerchiSDK/entities/theme.js +89 -110
  102. package/lib/MerchiSDK/entities/theme_css_setting.js +10 -31
  103. package/lib/MerchiSDK/entities/user.js +151 -213
  104. package/lib/MerchiSDK/entities/user_company.js +11 -32
  105. package/lib/MerchiSDK/entities/variation.js +21 -42
  106. package/lib/MerchiSDK/entities/variation_field.js +61 -94
  107. package/lib/MerchiSDK/entities/variation_fields_option.js +40 -61
  108. package/lib/MerchiSDK/entities/variation_option.js +20 -41
  109. package/lib/MerchiSDK/entities/variations_group.js +15 -36
  110. package/lib/MerchiSDK/entity.js +534 -624
  111. package/lib/MerchiSDK/merchi.js +42 -53
  112. package/lib/MerchiSDK/request.js +47 -75
  113. package/lib/MerchiSDK/test_util.js +6 -10
  114. package/lib/MerchiSDK/toasts.js +12 -13
  115. package/lib/MerchiSDK/util/float.js +7 -19
  116. package/lib/MerchiSDK/util/query_string.js +4 -4
  117. package/lib/MerchiSDK/util/validation.js +2 -3
  118. package/lib/MerchiSDK/uuid.js +2 -2
  119. package/lib/buttons/Button.js +15 -15
  120. package/lib/buttons/ButtonBack.js +22 -25
  121. package/lib/buttons/ButtonClearCart.js +8 -9
  122. package/lib/buttons/ButtonInvoiceDownload.js +26 -61
  123. package/lib/buttons/ButtonNext.js +20 -25
  124. package/lib/buttons/ButtonNextDynamic.js +16 -18
  125. package/lib/buttons/ButtonPay.js +17 -13
  126. package/lib/buttons/ButtonShipmentTabNext.js +12 -13
  127. package/lib/buttons/index.js +13 -13
  128. package/lib/components/Alert.js +14 -12
  129. package/lib/components/CartBody.js +10 -8
  130. package/lib/components/CartClient.js +22 -17
  131. package/lib/components/CartFooter.js +9 -7
  132. package/lib/components/CartItemRow.js +58 -48
  133. package/lib/components/CartPaymentSettingsInvalid.js +3 -4
  134. package/lib/components/CartShipment.js +18 -13
  135. package/lib/components/CartTabContent.js +9 -7
  136. package/lib/components/CartTabPanel.js +15 -13
  137. package/lib/components/CartTableContainer.js +9 -7
  138. package/lib/components/Collapse.js +14 -22
  139. package/lib/components/LoadingTemplate.js +10 -7
  140. package/lib/components/NoCartItems.js +9 -9
  141. package/lib/components/ShipmentGroupCard.js +69 -52
  142. package/lib/components/Table.js +7 -4
  143. package/lib/components/Title.js +11 -9
  144. package/lib/components/containers.js +12 -11
  145. package/lib/components/index.js +30 -31
  146. package/lib/forms/FormNewCustomer.js +48 -76
  147. package/lib/forms/FormReturningCustomer.js +38 -58
  148. package/lib/forms/FormShipmentAddressAndNotes.js +42 -47
  149. package/lib/forms/FormSquarePayment.js +8 -9
  150. package/lib/forms/FormStripePayment.js +8 -9
  151. package/lib/forms/InputAcceptUserTermsAndConditions.js +12 -11
  152. package/lib/forms/InputError.js +11 -9
  153. package/lib/forms/InputSelect.js +34 -36
  154. package/lib/forms/InputText.js +38 -42
  155. package/lib/forms/InputsAddress.js +59 -69
  156. package/lib/index.js +6 -6
  157. package/lib/panels/PanelCartItems.js +14 -17
  158. package/lib/panels/PanelCartShipment.js +10 -13
  159. package/lib/panels/PanelClearCart.js +8 -7
  160. package/lib/panels/PanelClientCheckout.js +18 -17
  161. package/lib/panels/PanelEditCartItem.js +17 -22
  162. package/lib/panels/PanelPaymentSuccess.js +18 -16
  163. package/lib/panels/index.js +13 -13
  164. package/lib/slices/sliceCart.js +53 -56
  165. package/lib/slices/sliceCartAlert.js +11 -15
  166. package/lib/slices/sliceCartItem.js +11 -10
  167. package/lib/slices/sliceCartPayment.js +15 -16
  168. package/lib/slices/sliceCartShipment.js +23 -26
  169. package/lib/slices/sliceFormReturningCustomer.js +7 -7
  170. package/lib/slices/sliceNewCustomerForm.js +6 -6
  171. package/lib/square/SquareCard.js +16 -18
  172. package/lib/square/actions.js +24 -46
  173. package/lib/square/slices/reducersSquare.js +6 -6
  174. package/lib/square/slices/sliceSquareAlerts.js +10 -16
  175. package/lib/square/slices/sliceSquareForm.js +10 -9
  176. package/lib/store.js +359 -565
  177. package/lib/stripe/StripeCardFields.js +43 -44
  178. package/lib/stripe/StripeCardForm.js +51 -109
  179. package/lib/stripe/StripePaymentButtons.js +35 -46
  180. package/lib/stripe/actions.js +75 -196
  181. package/lib/stripe/slices/sliceStripeAlerts.js +10 -16
  182. package/lib/stripe/slices/sliceStripeCardForm.js +6 -6
  183. package/lib/stripe/slices/sliceStripeForm.js +18 -17
  184. package/lib/stripe/utils.js +1 -1
  185. package/lib/tabs/CartNav.js +15 -24
  186. package/lib/tabs/NavTab.js +20 -19
  187. package/lib/utilities/address.js +32 -30
  188. package/lib/utilities/cart.js +33 -50
  189. package/lib/utilities/cookie.js +46 -129
  190. package/lib/utilities/currency.js +29 -25
  191. package/lib/utilities/helpers.js +41 -60
  192. package/lib/utilities/invoice.js +45 -114
  193. package/lib/utilities/product.js +5 -3
  194. package/lib/utilities/user.js +24 -62
  195. package/lib/utilities/variations.js +16 -14
  196. package/package.json +1 -1
@@ -5,38 +5,38 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "PanelCartItems", {
7
7
  enumerable: true,
8
- get: function get() {
9
- return _PanelCartItems["default"];
8
+ get: function () {
9
+ return _PanelCartItems.default;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "PanelCartShipment", {
13
13
  enumerable: true,
14
- get: function get() {
15
- return _PanelCartShipment["default"];
14
+ get: function () {
15
+ return _PanelCartShipment.default;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "PanelClearCart", {
19
19
  enumerable: true,
20
- get: function get() {
21
- return _PanelClearCart["default"];
20
+ get: function () {
21
+ return _PanelClearCart.default;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "PanelClientCheckout", {
25
25
  enumerable: true,
26
- get: function get() {
27
- return _PanelClientCheckout["default"];
26
+ get: function () {
27
+ return _PanelClientCheckout.default;
28
28
  }
29
29
  });
30
30
  Object.defineProperty(exports, "PanelEditCartItem", {
31
31
  enumerable: true,
32
- get: function get() {
33
- return _PanelEditCartItem["default"];
32
+ get: function () {
33
+ return _PanelEditCartItem.default;
34
34
  }
35
35
  });
36
36
  Object.defineProperty(exports, "PanelPaymentSuccess", {
37
37
  enumerable: true,
38
- get: function get() {
39
- return _PanelPaymentSuccess["default"];
38
+ get: function () {
39
+ return _PanelPaymentSuccess.default;
40
40
  }
41
41
  });
42
42
  var _PanelCartItems = _interopRequireDefault(require("./PanelCartItems"));
@@ -45,4 +45,4 @@ var _PanelClearCart = _interopRequireDefault(require("./PanelClearCart"));
45
45
  var _PanelClientCheckout = _interopRequireDefault(require("./PanelClientCheckout"));
46
46
  var _PanelEditCartItem = _interopRequireDefault(require("./PanelEditCartItem"));
47
47
  var _PanelPaymentSuccess = _interopRequireDefault(require("./PanelPaymentSuccess"));
48
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
48
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -7,67 +7,61 @@ exports.cartItemsNeedShipment = cartItemsNeedShipment;
7
7
  exports.tabIdShipment = exports.tabIdPaymentSuccess = exports.tabIdItems = exports.tabIdItem = exports.tabIdClearCart = exports.tabIdCheckout = exports.sliceCart = void 0;
8
8
  var _toolkit = require("@reduxjs/toolkit");
9
9
  var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
10
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
15
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
- var tabIdClearCart = exports.tabIdClearCart = -2;
17
- var tabIdItem = exports.tabIdItem = -1;
18
- var tabIdItems = exports.tabIdItems = 0;
19
- var tabIdShipment = exports.tabIdShipment = 1;
20
- var tabIdCheckout = exports.tabIdCheckout = 2;
21
- var tabIdPaymentSuccess = exports.tabIdPaymentSuccess = 3;
22
- var tabItems = {
10
+ const tabIdClearCart = exports.tabIdClearCart = -2;
11
+ const tabIdItem = exports.tabIdItem = -1;
12
+ const tabIdItems = exports.tabIdItems = 0;
13
+ const tabIdShipment = exports.tabIdShipment = 1;
14
+ const tabIdCheckout = exports.tabIdCheckout = 2;
15
+ const tabIdPaymentSuccess = exports.tabIdPaymentSuccess = 3;
16
+ const tabItems = {
23
17
  disabled: false,
24
18
  icon: _freeSolidSvgIcons.faShoppingCart,
25
19
  tabId: tabIdItems,
26
20
  name: 'Items'
27
21
  };
28
- var tabShipment = {
22
+ const tabShipment = {
29
23
  disabled: true,
30
24
  icon: _freeSolidSvgIcons.faMapMarkerAlt,
31
25
  tabId: tabIdShipment,
32
26
  name: 'Address'
33
27
  };
34
- var tabCheckout = {
28
+ const tabCheckout = {
35
29
  disabled: true,
36
30
  icon: _freeSolidSvgIcons.faCreditCard,
37
31
  tabId: tabIdCheckout,
38
32
  name: 'Checkout'
39
33
  };
40
- var tabCheckoutSuccess = {
34
+ const tabCheckoutSuccess = {
41
35
  disabled: true,
42
36
  icon: _freeSolidSvgIcons.faCheckCircle,
43
37
  tabId: tabIdPaymentSuccess,
44
38
  name: 'Success'
45
39
  };
46
- var initTabs = [tabItems, tabCheckout, tabCheckoutSuccess];
47
- var tabsWithShipment = [tabItems, tabShipment, tabCheckout, tabCheckoutSuccess];
40
+ const initTabs = [tabItems, tabCheckout, tabCheckoutSuccess];
41
+ const tabsWithShipment = [tabItems, tabShipment, tabCheckout, tabCheckoutSuccess];
48
42
  function setDisableTab(tab, disabled) {
49
- return _objectSpread(_objectSpread({}, tab), {}, {
50
- disabled: disabled
51
- });
43
+ return {
44
+ ...tab,
45
+ disabled
46
+ };
52
47
  }
53
48
  function cartHasShippmentGroupsAndAllHaveSelectedGroups(cart) {
54
- var shipmentGroups = cart.shipmentGroups ? cart.shipmentGroups : [];
55
- var haveSelectedQuotes = shipmentGroups.map(function (g) {
56
- return Boolean(g.selectedQuote);
57
- });
49
+ const shipmentGroups = cart.shipmentGroups ? cart.shipmentGroups : [];
50
+ const haveSelectedQuotes = shipmentGroups.map(g => Boolean(g.selectedQuote));
58
51
  return shipmentGroups.length && !haveSelectedQuotes.includes(false);
59
52
  }
60
53
  function cartItemsNeedShipment(cart) {
61
- var _cart$cartItems = cart.cartItems,
62
- cartItems = _cart$cartItems === void 0 ? [] : _cart$cartItems;
63
- for (var i = 0; i < cartItems.length; i++) {
54
+ const {
55
+ cartItems = []
56
+ } = cart;
57
+ for (let i = 0; i < cartItems.length; i++) {
64
58
  if (cartItems[i].product && cartItems[i].product.needsShipping) {
65
59
  return true;
66
60
  }
67
61
  }
68
62
  return false;
69
63
  }
70
- var sliceCart = exports.sliceCart = (0, _toolkit.createSlice)({
64
+ const sliceCart = exports.sliceCart = (0, _toolkit.createSlice)({
71
65
  initialState: {
72
66
  activeTab: 0,
73
67
  cart: {},
@@ -83,19 +77,19 @@ var sliceCart = exports.sliceCart = (0, _toolkit.createSlice)({
83
77
  },
84
78
  name: 'stateCart',
85
79
  reducers: {
86
- cartSettingsInvalid: function cartSettingsInvalid(state) {
80
+ cartSettingsInvalid: state => {
87
81
  state.cartSettingsInvalid = true;
88
82
  state.fetchingCart = false;
89
83
  },
90
- deleteCartItem: function deleteCartItem(state, action) {
84
+ deleteCartItem: (state, action) => {
91
85
  state.deletingCartItemIndex = action.payload;
92
86
  },
93
- deleteCartItemError: function deleteCartItemError(state) {
87
+ deleteCartItemError: state => {
94
88
  state.deletingCartItemIndex = undefined;
95
89
  },
96
- deleteCartItemSuccess: function deleteCartItemSuccess(state, action) {
97
- var cart = action.payload;
98
- var needsShipping = cartItemsNeedShipment(cart);
90
+ deleteCartItemSuccess: (state, action) => {
91
+ const cart = action.payload;
92
+ const needsShipping = cartItemsNeedShipment(cart);
99
93
  state.deletingCartItemIndex = undefined;
100
94
  state.cart = cart;
101
95
  state.needsShipping = needsShipping;
@@ -115,19 +109,21 @@ var sliceCart = exports.sliceCart = (0, _toolkit.createSlice)({
115
109
  }
116
110
  }
117
111
  },
118
- fetchCart: function fetchCart(state) {
112
+ fetchCart: state => {
119
113
  state.fetchingCart = true;
120
114
  },
121
- fetchCartError: function fetchCartError(state) {
115
+ fetchCartError: state => {
122
116
  state.fetchingCart = false;
123
117
  },
124
- fetchCartSuccess: function fetchCartSuccess(state, action) {
125
- var cart = action.payload;
126
- var needsShipping = cartItemsNeedShipment(_objectSpread({}, cart));
118
+ fetchCartSuccess: (state, action) => {
119
+ const cart = action.payload;
120
+ const needsShipping = cartItemsNeedShipment({
121
+ ...cart
122
+ });
127
123
  state.cart = cart;
128
124
  state.needsShipping = needsShipping;
129
125
  if (needsShipping) {
130
- var initShipment = [].concat(tabsWithShipment);
126
+ const initShipment = [...tabsWithShipment];
131
127
  if (cart.cartItems.length) {
132
128
  initShipment[1] = setDisableTab(tabShipment, false);
133
129
  if (cartHasShippmentGroupsAndAllHaveSelectedGroups(cart)) {
@@ -141,42 +137,43 @@ var sliceCart = exports.sliceCart = (0, _toolkit.createSlice)({
141
137
  state.activeTab = 0;
142
138
  state.fetchingCart = false;
143
139
  },
144
- fetchTheme: function fetchTheme(state) {
140
+ fetchTheme: state => {
145
141
  state.loading = true;
146
142
  },
147
- fetchThemeError: function fetchThemeError(state) {
143
+ fetchThemeError: state => {
148
144
  state.loading = false;
149
145
  },
150
- fetchThemeSuccess: function fetchThemeSuccess(state) {
146
+ fetchThemeSuccess: state => {
151
147
  state.loading = false;
152
148
  },
153
- setActiveTab: function setActiveTab(state, action) {
149
+ setActiveTab: (state, action) => {
154
150
  state.activeTab = action.payload;
155
151
  },
156
- setActiveTabAndEditDisabled: function setActiveTabAndEditDisabled(state, action) {
157
- var _action$payload = action.payload,
158
- tabId = _action$payload.tabId,
159
- tabIndexToSet = _action$payload.tabIndexToSet,
160
- disabled = _action$payload.disabled;
152
+ setActiveTabAndEditDisabled: (state, action) => {
153
+ const {
154
+ tabId,
155
+ tabIndexToSet,
156
+ disabled
157
+ } = action.payload;
161
158
  state.activeTab = tabId;
162
159
  state.tabs[tabIndexToSet].disabled = disabled;
163
160
  },
164
- setCart: function setCart(state, action) {
161
+ setCart: (state, action) => {
165
162
  state.cart = action.payload;
166
163
  },
167
- setCartShipmentGroups: function setCartShipmentGroups(state, action) {
164
+ setCartShipmentGroups: (state, action) => {
168
165
  state.cart.shipmentGroups = action.payload;
169
166
  },
170
- setCartClient: function setCartClient(state, action) {
167
+ setCartClient: (state, action) => {
171
168
  state.cart.client = action.payload;
172
169
  },
173
- setDomainId: function setDomainId(state, action) {
170
+ setDomainId: (state, action) => {
174
171
  state.domainId = action.payload;
175
172
  },
176
- toggleCartOpen: function toggleCartOpen(state) {
173
+ toggleCartOpen: state => {
177
174
  state.modalCartOpen = !state.modalCartOpen;
178
175
  },
179
- toggleClearCart: function toggleClearCart(state) {
176
+ toggleClearCart: state => {
180
177
  state.modalClearCartOpen = !state.modalClearCartOpen;
181
178
  }
182
179
  }
@@ -6,13 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.sliceCartAlert = void 0;
7
7
  var _toolkit = require("@reduxjs/toolkit");
8
8
  var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
9
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
- var sliceCartAlert = exports.sliceCartAlert = (0, _toolkit.createSlice)({
9
+ const sliceCartAlert = exports.sliceCartAlert = (0, _toolkit.createSlice)({
16
10
  initialState: {
17
11
  alert: {
18
12
  icon: _freeSolidSvgIcons.faInfoCircle,
@@ -24,25 +18,27 @@ var sliceCartAlert = exports.sliceCartAlert = (0, _toolkit.createSlice)({
24
18
  },
25
19
  name: 'stateCartAlert',
26
20
  reducers: {
27
- closeAlert: function closeAlert(state) {
21
+ closeAlert: state => {
28
22
  state.alert.show = false;
29
23
  },
30
- setAlert: function setAlert(state, action) {
24
+ setAlert: (state, action) => {
31
25
  state.alert = action.payload;
32
26
  },
33
- showAlertDanger: function showAlertDanger(state, action) {
34
- state.alert = _objectSpread(_objectSpread({}, action.payload), {}, {
27
+ showAlertDanger: (state, action) => {
28
+ state.alert = {
29
+ ...action.payload,
35
30
  icon: _freeSolidSvgIcons.faExclamationTriangle,
36
31
  show: true,
37
32
  type: 'danger'
38
- });
33
+ };
39
34
  },
40
- showAlertSuccess: function showAlertSuccess(state, action) {
41
- state.alert = _objectSpread(_objectSpread({}, action.payload), {}, {
35
+ showAlertSuccess: (state, action) => {
36
+ state.alert = {
37
+ ...action.payload,
42
38
  icon: _freeSolidSvgIcons.faCheckCircle,
43
39
  show: true,
44
40
  type: 'success'
45
- });
41
+ };
46
42
  }
47
43
  }
48
44
  });
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = void 0;
6
+ exports.default = void 0;
7
7
  var _toolkit = require("@reduxjs/toolkit");
8
- var sliceCartItem = (0, _toolkit.createSlice)({
8
+ const sliceCartItem = (0, _toolkit.createSlice)({
9
9
  initialState: {
10
10
  cartItem: {},
11
11
  fetchingPrice: false,
@@ -14,22 +14,23 @@ var sliceCartItem = (0, _toolkit.createSlice)({
14
14
  },
15
15
  name: 'stateCartItem',
16
16
  reducers: {
17
- patchCartItem: function patchCartItem(state) {
17
+ patchCartItem: state => {
18
18
  state.savingCartItem = true;
19
19
  },
20
- patchCartItemError: function patchCartItemError(state) {
20
+ patchCartItemError: state => {
21
21
  state.savingCartItem = false;
22
22
  },
23
- patchCartItemSuccess: function patchCartItemSuccess(state) {
23
+ patchCartItemSuccess: state => {
24
24
  state.savingCartItem = false;
25
25
  },
26
- setCartItem: function setCartItem(state, action) {
27
- var _action$payload = action.payload,
28
- cartItem = _action$payload.cartItem,
29
- index = _action$payload.index;
26
+ setCartItem: (state, action) => {
27
+ const {
28
+ cartItem,
29
+ index
30
+ } = action.payload;
30
31
  state.cartItem = cartItem;
31
32
  state.index = index;
32
33
  }
33
34
  }
34
35
  });
35
- var _default = exports["default"] = sliceCartItem;
36
+ var _default = exports.default = sliceCartItem;
@@ -6,21 +6,18 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.sliceCartPayment = void 0;
7
7
  var _toolkit = require("@reduxjs/toolkit");
8
8
  function setLoadingKeys(state, action, newState) {
9
- var _action$payload = action.payload,
10
- _action$payload$loadi = _action$payload.loadingKey,
11
- loadingKey = _action$payload$loadi === void 0 ? null : _action$payload$loadi,
12
- _action$payload$loadi2 = _action$payload.loadingKeys,
13
- loadingKeys = _action$payload$loadi2 === void 0 ? null : _action$payload$loadi2;
9
+ const {
10
+ loadingKey = null,
11
+ loadingKeys = null
12
+ } = action.payload;
14
13
  if (Array.isArray(loadingKeys)) {
15
- loadingKeys.map(function (lK) {
16
- return state[lK] = newState;
17
- });
14
+ loadingKeys.map(lK => state[lK] = newState);
18
15
  }
19
16
  if (typeof loadingKey === 'string') {
20
17
  state[loadingKey] = newState;
21
18
  }
22
19
  }
23
- var sliceCartPayment = exports.sliceCartPayment = (0, _toolkit.createSlice)({
20
+ const sliceCartPayment = exports.sliceCartPayment = (0, _toolkit.createSlice)({
24
21
  initialState: {
25
22
  cartCompleteLoading: false,
26
23
  invoice: {},
@@ -28,24 +25,26 @@ var sliceCartPayment = exports.sliceCartPayment = (0, _toolkit.createSlice)({
28
25
  },
29
26
  name: 'stateCartPayment',
30
27
  reducers: {
31
- doCardComplete: function doCardComplete(state) {
28
+ doCardComplete: state => {
32
29
  state.cartCompleteLoading = true;
33
30
  },
34
- fetchInvoice: function fetchInvoice(state, action) {
31
+ fetchInvoice: (state, action) => {
35
32
  setLoadingKeys(state, action, true);
36
33
  },
37
- fetchInvoiceError: function fetchInvoiceError(state, action) {
34
+ fetchInvoiceError: (state, action) => {
38
35
  setLoadingKeys(state, action, false);
39
36
  },
40
- fetchInvoiceSuccess: function fetchInvoiceSuccess(state, action) {
41
- var invoice = action.payload.invoice;
37
+ fetchInvoiceSuccess: (state, action) => {
38
+ const {
39
+ invoice
40
+ } = action.payload;
42
41
  state.invoice = invoice;
43
42
  setLoadingKeys(state, action, false);
44
43
  },
45
- setInvoice: function setInvoice(state, action) {
44
+ setInvoice: (state, action) => {
46
45
  state.invoice = action.payload;
47
46
  },
48
- creditCardPaySuccess: function creditCardPaySuccess(state, action) {
47
+ creditCardPaySuccess: (state, action) => {
49
48
  state.invoice = action.payload;
50
49
  }
51
50
  }
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.sliceCartShipment = exports.shipmentFormId = void 0;
7
7
  var _toolkit = require("@reduxjs/toolkit");
8
- var shipmentFormId = exports.shipmentFormId = '_shipment-address-form-id';
9
- var sliceCartShipment = exports.sliceCartShipment = (0, _toolkit.createSlice)({
8
+ const shipmentFormId = exports.shipmentFormId = '_shipment-address-form-id';
9
+ const sliceCartShipment = exports.sliceCartShipment = (0, _toolkit.createSlice)({
10
10
  initialState: {
11
11
  addressFieldsOpen: false,
12
12
  fetchingShipmentGroups: false,
@@ -20,58 +20,55 @@ var sliceCartShipment = exports.sliceCartShipment = (0, _toolkit.createSlice)({
20
20
  },
21
21
  name: 'stateCartShipment',
22
22
  reducers: {
23
- initCartShipmentSlice: function initCartShipmentSlice(state, action) {
24
- var cart = action.payload;
25
- var groups = cart.shipmentGroups;
23
+ initCartShipmentSlice: (state, action) => {
24
+ const cart = action.payload;
25
+ const groups = cart.shipmentGroups;
26
26
  state.receiverAddress = cart.receiverAddress;
27
27
  state.receiverNotes = cart.receiverNotes;
28
28
  state.shipmentGroups = groups;
29
- state.selectedQuotes = groups.map(function (g) {
30
- return g.selectedQuote;
31
- });
29
+ state.selectedQuotes = groups.map(g => g.selectedQuote);
32
30
  },
33
- saveShipmentAddress: function saveShipmentAddress(state) {
31
+ saveShipmentAddress: state => {
34
32
  state.savingShipmentAddress = true;
35
33
  },
36
- saveShipmentAddressError: function saveShipmentAddressError(state) {
34
+ saveShipmentAddressError: state => {
37
35
  state.savingShipmentAddress = false;
38
36
  },
39
- saveShipmentAddressSuccess: function saveShipmentAddressSuccess(state) {
37
+ saveShipmentAddressSuccess: state => {
40
38
  state.savingShipmentAddress = false;
41
39
  },
42
- setGoogleMapsInitialised: function setGoogleMapsInitialised(state, action) {
40
+ setGoogleMapsInitialised: (state, action) => {
43
41
  state.googleMapsInitialised = action.payload;
44
42
  },
45
- setSelectedShipmentQuote: function setSelectedShipmentQuote(state, action) {
46
- var _action$payload = action.payload,
47
- groupIndex = _action$payload.groupIndex,
48
- quote = _action$payload.quote;
43
+ setSelectedShipmentQuote: (state, action) => {
44
+ const {
45
+ groupIndex,
46
+ quote
47
+ } = action.payload;
49
48
  state.selectedQuotes[groupIndex] = quote;
50
49
  state.fetchingShipmentQuote = true;
51
50
  },
52
- setSelectedShipmentQuoteError: function setSelectedShipmentQuoteError(state) {
51
+ setSelectedShipmentQuoteError: state => {
53
52
  state.fetchingShipmentQuote = false;
54
53
  },
55
- setSelectedShipmentQuoteSuccess: function setSelectedShipmentQuoteSuccess(state) {
54
+ setSelectedShipmentQuoteSuccess: state => {
56
55
  state.fetchingShipmentQuote = false;
57
56
  },
58
- toggleAddressFields: function toggleAddressFields(state) {
57
+ toggleAddressFields: state => {
59
58
  state.addressFieldsOpen = !state.addressFieldsOpen;
60
59
  },
61
- updateShipmentAddress: function updateShipmentAddress(state, action) {
60
+ updateShipmentAddress: (state, action) => {
62
61
  state.receiverAddress = action.payload;
63
62
  state.fetchingShipmentGroups = true;
64
63
  },
65
- updateShipmentAddressError: function updateShipmentAddressError(state) {
64
+ updateShipmentAddressError: state => {
66
65
  state.fetchingShipmentGroups = false;
67
66
  },
68
- updateShipmentAddressSuccess: function updateShipmentAddressSuccess(state, action) {
69
- var groups = action.payload;
67
+ updateShipmentAddressSuccess: (state, action) => {
68
+ const groups = action.payload;
70
69
  state.fetchingShipmentGroups = false;
71
70
  state.shipmentGroups = groups;
72
- state.selectedQuotes = groups.map(function (g) {
73
- return g.selectedQuote;
74
- });
71
+ state.selectedQuotes = groups.map(g => g.selectedQuote);
75
72
  }
76
73
  }
77
74
  });
@@ -3,27 +3,27 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = void 0;
6
+ exports.default = void 0;
7
7
  var _toolkit = require("@reduxjs/toolkit");
8
- var sliceFormReturningCustomer = (0, _toolkit.createSlice)({
8
+ const sliceFormReturningCustomer = (0, _toolkit.createSlice)({
9
9
  initialState: {
10
10
  returningCustomerError: false,
11
11
  returningCustomerLoading: false
12
12
  },
13
13
  name: 'stateFormReturningCustomer',
14
14
  reducers: {
15
- setReturningCustomerError: function setReturningCustomerError(state, action) {
15
+ setReturningCustomerError: (state, action) => {
16
16
  state.returningCustomerError = action.payload;
17
17
  },
18
- tryReturningCustomer: function tryReturningCustomer(state) {
18
+ tryReturningCustomer: state => {
19
19
  state.returningCustomerLoading = true;
20
20
  },
21
- tryReturningCustomerError: function tryReturningCustomerError(state) {
21
+ tryReturningCustomerError: state => {
22
22
  state.returningCustomerLoading = false;
23
23
  },
24
- tryReturningCustomerSuccess: function tryReturningCustomerSuccess(state) {
24
+ tryReturningCustomerSuccess: state => {
25
25
  state.returningCustomerLoading = false;
26
26
  }
27
27
  }
28
28
  });
29
- var _default = exports["default"] = sliceFormReturningCustomer;
29
+ var _default = exports.default = sliceFormReturningCustomer;
@@ -3,26 +3,26 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = void 0;
6
+ exports.default = void 0;
7
7
  var _toolkit = require("@reduxjs/toolkit");
8
- var sliceNewCustomerForm = (0, _toolkit.createSlice)({
8
+ const sliceNewCustomerForm = (0, _toolkit.createSlice)({
9
9
  initialState: {
10
10
  creatingNewCustomer: false,
11
11
  serverError: ''
12
12
  },
13
13
  name: 'stateNewCustomerForm',
14
14
  reducers: {
15
- createNewCustomer: function createNewCustomer(state) {
15
+ createNewCustomer: state => {
16
16
  state.creatingNewCustomer = true;
17
17
  state.serverError = '';
18
18
  },
19
- createNewCustomerError: function createNewCustomerError(state, action) {
19
+ createNewCustomerError: (state, action) => {
20
20
  state.creatingNewCustomer = false;
21
21
  state.serverError = action.payload;
22
22
  },
23
- createNewCustomerSuccess: function createNewCustomerSuccess(state) {
23
+ createNewCustomerSuccess: state => {
24
24
  state.creatingNewCustomer = false;
25
25
  }
26
26
  }
27
27
  });
28
- var _default = exports["default"] = sliceNewCustomerForm;
28
+ var _default = exports.default = sliceNewCustomerForm;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports["default"] = void 0;
6
+ exports.default = void 0;
8
7
  var React = _interopRequireWildcard(require("react"));
9
8
  var _reactRedux = require("react-redux");
10
9
  var _reactSquareWebPaymentsSdk = require("react-square-web-payments-sdk");
@@ -12,18 +11,19 @@ var _actions = require("./actions");
12
11
  var _currency = require("../utilities/currency");
13
12
  var _store = require("../store");
14
13
  var _jsxRuntime = require("react/jsx-runtime");
15
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
16
  function SquareCard() {
18
- var _useSelector = (0, _reactRedux.useSelector)(function (s) {
19
- return s.stateCart;
20
- }),
21
- cart = _useSelector.cart;
22
- var currency = cart.currency,
23
- domain = cart.domain,
24
- totalCost = cart.totalCost;
25
- var company = domain.company;
26
- var dispatch = (0, _reactRedux.useDispatch)();
17
+ const {
18
+ cart
19
+ } = (0, _reactRedux.useSelector)(s => s.stateCart);
20
+ const {
21
+ currency,
22
+ domain,
23
+ totalCost
24
+ } = cart;
25
+ const company = domain.company;
26
+ const dispatch = (0, _reactRedux.useDispatch)();
27
27
  function ButtonText() {
28
28
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
29
29
  children: ["Pay ", _currency.currencyMap[currency], totalCost, /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
@@ -31,7 +31,7 @@ function SquareCard() {
31
31
  })]
32
32
  });
33
33
  }
34
- var squareWebLocationId = company.squareWebLocationId;
34
+ const squareWebLocationId = company.squareWebLocationId;
35
35
  return squareWebLocationId ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSquareWebPaymentsSdk.PaymentForm
36
36
  /**
37
37
  * Identifies the calling form with a verified application ID generated from
@@ -42,9 +42,7 @@ function SquareCard() {
42
42
  * Invoked when payment form receives the result of a tokenize generation
43
43
  * request. The result will be a valid credit card or wallet token, or an error.
44
44
  */,
45
- cardTokenizeResponseReceived: function cardTokenizeResponseReceived(token, buyer) {
46
- return (0, _actions.actionSquarePaymentProcess)(dispatch, cart, token.token, _store.callbackCreditCardPaymentSuccess);
47
- }
45
+ cardTokenizeResponseReceived: (token, buyer) => (0, _actions.actionSquarePaymentProcess)(dispatch, cart, token.token, _store.callbackCreditCardPaymentSuccess)
48
46
  /**
49
47
  * Identifies the location of the merchant that is taking the payment.
50
48
  * Obtained from the Square Application Dashboard - Locations tab.
@@ -55,4 +53,4 @@ function SquareCard() {
55
53
  })
56
54
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
57
55
  }
58
- var _default = exports["default"] = SquareCard;
56
+ var _default = exports.default = SquareCard;