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
@@ -6,205 +6,84 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.stripeCardFormSubmit = stripeCardFormSubmit;
7
7
  exports.stripeInitPromise = stripeInitPromise;
8
8
  exports.stripePaymentButtonSubmit = stripePaymentButtonSubmit;
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
11
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
13
- function stripeInitPromise(_x) {
14
- return _stripeInitPromise.apply(this, arguments);
9
+ async function stripeInitPromise(urlApi) {
10
+ return await fetch(`${urlApi}stripe/master_publishable_key/`, {
11
+ method: 'GET',
12
+ mode: 'cors'
13
+ }).then(response => response.key);
15
14
  }
16
- function _stripeInitPromise() {
17
- _stripeInitPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(urlApi) {
18
- return _regeneratorRuntime().wrap(function _callee$(_context) {
19
- while (1) switch (_context.prev = _context.next) {
20
- case 0:
21
- _context.next = 2;
22
- return fetch("".concat(urlApi, "stripe/master_publishable_key/"), {
23
- method: 'GET',
24
- mode: 'cors'
25
- }).then(function (response) {
26
- return response.key;
27
- });
28
- case 2:
29
- return _context.abrupt("return", _context.sent);
30
- case 3:
31
- case "end":
32
- return _context.stop();
33
- }
34
- }, _callee);
35
- }));
36
- return _stripeInitPromise.apply(this, arguments);
15
+ async function createPaymentIntent(urlApi, cart, paymentMethodType) {
16
+ const {
17
+ id,
18
+ token
19
+ } = cart;
20
+ const fetchOptions = {
21
+ method: 'GET',
22
+ mode: 'cors'
23
+ };
24
+ const queryParams = [['cart_token', token]];
25
+ if (paymentMethodType) {
26
+ queryParams.push(['payment_method_types', paymentMethodType]);
27
+ }
28
+ const queryString = new URLSearchParams(queryParams).toString();
29
+ const uri = `stripe/payment_intent/cart/${id}/`;
30
+ const url = `${urlApi}${uri}?${queryString}`;
31
+ const response = await fetch(url, fetchOptions);
32
+ if (!response.ok) {
33
+ throw new Error("Failed to create payment intent.");
34
+ }
35
+ return await response.json();
37
36
  }
38
- function createPaymentIntent(_x2, _x3, _x4) {
39
- return _createPaymentIntent.apply(this, arguments);
37
+ async function checkPaymentIntnetIsComplete(urlApi, cart) {
38
+ const url = `stripe/payment_intent/cart/complete/${cart.id}/`;
39
+ const fetchOptions = {
40
+ method: 'GET',
41
+ mode: 'cors'
42
+ };
43
+ const queryString = new URLSearchParams({
44
+ cart_token: cart.token
45
+ }).toString();
46
+ const response = await fetch(`${urlApi}${url}?${queryString}`, fetchOptions);
47
+ if (!response.ok) {
48
+ throw new Error("Failed to check if payment intent is complete.");
49
+ }
50
+ return await response.json();
40
51
  }
41
- function _createPaymentIntent() {
42
- _createPaymentIntent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(urlApi, cart, paymentMethodType) {
43
- var id, token, fetchOptions, queryParams, queryString, uri, url, response;
44
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
45
- while (1) switch (_context2.prev = _context2.next) {
46
- case 0:
47
- id = cart.id, token = cart.token;
48
- fetchOptions = {
49
- method: 'GET',
50
- mode: 'cors'
51
- };
52
- queryParams = [['cart_token', token]];
53
- if (paymentMethodType) {
54
- queryParams.push(['payment_method_types', paymentMethodType]);
55
- }
56
- queryString = new URLSearchParams(queryParams).toString();
57
- uri = "stripe/payment_intent/cart/".concat(id, "/");
58
- url = "".concat(urlApi).concat(uri, "?").concat(queryString);
59
- _context2.next = 9;
60
- return fetch(url, fetchOptions);
61
- case 9:
62
- response = _context2.sent;
63
- if (response.ok) {
64
- _context2.next = 12;
65
- break;
66
- }
67
- throw new Error("Failed to create payment intent.");
68
- case 12:
69
- _context2.next = 14;
70
- return response.json();
71
- case 14:
72
- return _context2.abrupt("return", _context2.sent);
73
- case 15:
74
- case "end":
75
- return _context2.stop();
52
+ async function stripeCardFormSubmit(urlApi, stripe, card, cart) {
53
+ try {
54
+ const intent = await createPaymentIntent(urlApi, cart);
55
+ const stripePayment = await stripe.confirmCardPayment(intent.stripeClientSecret, {
56
+ payment_method: {
57
+ card
76
58
  }
77
- }, _callee2);
78
- }));
79
- return _createPaymentIntent.apply(this, arguments);
80
- }
81
- function checkPaymentIntnetIsComplete(_x5, _x6) {
82
- return _checkPaymentIntnetIsComplete.apply(this, arguments);
83
- }
84
- function _checkPaymentIntnetIsComplete() {
85
- _checkPaymentIntnetIsComplete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(urlApi, cart) {
86
- var url, fetchOptions, queryString, response;
87
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
88
- while (1) switch (_context3.prev = _context3.next) {
89
- case 0:
90
- url = "stripe/payment_intent/cart/complete/".concat(cart.id, "/");
91
- fetchOptions = {
92
- method: 'GET',
93
- mode: 'cors'
94
- };
95
- queryString = new URLSearchParams({
96
- cart_token: cart.token
97
- }).toString();
98
- _context3.next = 5;
99
- return fetch("".concat(urlApi).concat(url, "?").concat(queryString), fetchOptions);
100
- case 5:
101
- response = _context3.sent;
102
- if (response.ok) {
103
- _context3.next = 8;
104
- break;
105
- }
106
- throw new Error("Failed to check if payment intent is complete.");
107
- case 8:
108
- _context3.next = 10;
109
- return response.json();
110
- case 10:
111
- return _context3.abrupt("return", _context3.sent);
112
- case 11:
113
- case "end":
114
- return _context3.stop();
115
- }
116
- }, _callee3);
117
- }));
118
- return _checkPaymentIntnetIsComplete.apply(this, arguments);
119
- }
120
- function stripeCardFormSubmit(_x7, _x8, _x9, _x10) {
121
- return _stripeCardFormSubmit.apply(this, arguments);
59
+ });
60
+ if (stripePayment.error) {
61
+ throw new Error(stripePayment.error.message || 'Stripe connect unknown error');
62
+ }
63
+ return await checkPaymentIntnetIsComplete(urlApi, cart);
64
+ } catch (e) {
65
+ throw e;
66
+ }
122
67
  }
123
- function _stripeCardFormSubmit() {
124
- _stripeCardFormSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(urlApi, stripe, card, cart) {
125
- var intent, stripePayment;
126
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
127
- while (1) switch (_context4.prev = _context4.next) {
128
- case 0:
129
- _context4.prev = 0;
130
- _context4.next = 3;
131
- return createPaymentIntent(urlApi, cart);
132
- case 3:
133
- intent = _context4.sent;
134
- _context4.next = 6;
135
- return stripe.confirmCardPayment(intent.stripeClientSecret, {
136
- payment_method: {
137
- card: card
138
- }
139
- });
140
- case 6:
141
- stripePayment = _context4.sent;
142
- if (!stripePayment.error) {
143
- _context4.next = 9;
144
- break;
145
- }
146
- throw new Error(stripePayment.error.message || 'Stripe connect unknown error');
147
- case 9:
148
- _context4.next = 11;
149
- return checkPaymentIntnetIsComplete(urlApi, cart);
150
- case 11:
151
- return _context4.abrupt("return", _context4.sent);
152
- case 14:
153
- _context4.prev = 14;
154
- _context4.t0 = _context4["catch"](0);
155
- throw _context4.t0;
156
- case 17:
157
- case "end":
158
- return _context4.stop();
159
- }
160
- }, _callee4, null, [[0, 14]]);
161
- }));
162
- return _stripeCardFormSubmit.apply(this, arguments);
163
- }
164
- function stripePaymentButtonSubmit(_x11, _x12, _x13, _x14) {
165
- return _stripePaymentButtonSubmit.apply(this, arguments);
166
- }
167
- function _stripePaymentButtonSubmit() {
168
- _stripePaymentButtonSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(urlApi, stripe, cart, paymentMethodEvent) {
169
- var complete, paymentMethod, intent, stripePayment;
170
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
171
- while (1) switch (_context5.prev = _context5.next) {
172
- case 0:
173
- complete = paymentMethodEvent.complete, paymentMethod = paymentMethodEvent.paymentMethod;
174
- _context5.prev = 1;
175
- _context5.next = 4;
176
- return createPaymentIntent(urlApi, cart);
177
- case 4:
178
- intent = _context5.sent;
179
- _context5.next = 7;
180
- return stripe.confirmCardPayment(intent.stripeClientSecret, {
181
- payment_method: paymentMethod.id
182
- }, {
183
- handleActions: false
184
- });
185
- case 7:
186
- stripePayment = _context5.sent;
187
- if (!stripePayment.error) {
188
- _context5.next = 10;
189
- break;
190
- }
191
- throw new Error(stripePayment.error.message || 'Stripe unknown error');
192
- case 10:
193
- complete('success');
194
- _context5.next = 13;
195
- return checkPaymentIntnetIsComplete(urlApi, cart);
196
- case 13:
197
- return _context5.abrupt("return", _context5.sent);
198
- case 16:
199
- _context5.prev = 16;
200
- _context5.t0 = _context5["catch"](1);
201
- complete('fail');
202
- throw _context5.t0;
203
- case 20:
204
- case "end":
205
- return _context5.stop();
206
- }
207
- }, _callee5, null, [[1, 16]]);
208
- }));
209
- return _stripePaymentButtonSubmit.apply(this, arguments);
68
+ async function stripePaymentButtonSubmit(urlApi, stripe, cart, paymentMethodEvent) {
69
+ const {
70
+ complete,
71
+ paymentMethod
72
+ } = paymentMethodEvent;
73
+ try {
74
+ const intent = await createPaymentIntent(urlApi, cart);
75
+ const stripePayment = await stripe.confirmCardPayment(intent.stripeClientSecret, {
76
+ payment_method: paymentMethod.id
77
+ }, {
78
+ handleActions: false
79
+ });
80
+ if (stripePayment.error) {
81
+ throw new Error(stripePayment.error.message || 'Stripe unknown error');
82
+ }
83
+ complete('success');
84
+ return await checkPaymentIntnetIsComplete(urlApi, cart);
85
+ } catch (e) {
86
+ complete('fail');
87
+ throw e;
88
+ }
210
89
  }
@@ -3,37 +3,31 @@
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
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
- var sliceStripeAlerts = (0, _toolkit.createSlice)({
8
+ const sliceStripeAlerts = (0, _toolkit.createSlice)({
15
9
  initialState: {
16
10
  alerts: []
17
11
  },
18
12
  name: 'stateStripeAlerts',
19
13
  reducers: {
20
- alertError: function alertError(state, action) {
21
- state.alerts = [].concat(_toConsumableArray(state.alerts), [{
14
+ alertError: (state, action) => {
15
+ state.alerts = [...state.alerts, {
22
16
  alertType: 'danger',
23
17
  message: action.payload,
24
18
  title: 'Error!'
25
- }]);
19
+ }];
26
20
  },
27
- alertRemove: function alertRemove(state, action) {
21
+ alertRemove: (state, action) => {
28
22
  state.alerts.splice(action.payload, 1);
29
23
  },
30
- alertSuccess: function alertSuccess(state, action) {
31
- state.alerts = [].concat(_toConsumableArray(state.alerts), [{
24
+ alertSuccess: (state, action) => {
25
+ state.alerts = [...state.alerts, {
32
26
  alertType: 'success',
33
27
  message: action.payload,
34
28
  title: 'Success!'
35
- }]);
29
+ }];
36
30
  }
37
31
  }
38
32
  });
39
- var _default = exports["default"] = sliceStripeAlerts;
33
+ var _default = exports.default = sliceStripeAlerts;
@@ -3,12 +3,12 @@
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 _sliceStripeAlerts = _interopRequireDefault(require("./sliceStripeAlerts"));
8
8
  var _sliceStripeForm = _interopRequireDefault(require("./sliceStripeForm"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
- var sliceStripeCardForm = {
11
- stateStripeAlerts: _sliceStripeAlerts["default"].reducer,
12
- stateStripeForm: _sliceStripeForm["default"].reducer
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const sliceStripeCardForm = {
11
+ stateStripeAlerts: _sliceStripeAlerts.default.reducer,
12
+ stateStripeForm: _sliceStripeForm.default.reducer
13
13
  };
14
- var _default = exports["default"] = sliceStripeCardForm;
14
+ var _default = exports.default = sliceStripeCardForm;
@@ -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 sliceStripeForm = (0, _toolkit.createSlice)({
8
+ const sliceStripeForm = (0, _toolkit.createSlice)({
9
9
  initialState: {
10
10
  acceptedPaymentMethods: {},
11
11
  invoice: {},
@@ -17,46 +17,47 @@ var sliceStripeForm = (0, _toolkit.createSlice)({
17
17
  },
18
18
  name: 'stateStripeForm',
19
19
  reducers: {
20
- actionFetchAcceptedPaymentMethods: function actionFetchAcceptedPaymentMethods(state) {
20
+ actionFetchAcceptedPaymentMethods: state => {
21
21
  state.loadingAcceptedPaymentMethods = true;
22
22
  },
23
- actionFetchAcceptedPaymentMethodsDone: function actionFetchAcceptedPaymentMethodsDone(state, action) {
23
+ actionFetchAcceptedPaymentMethodsDone: (state, action) => {
24
24
  state.loadingAcceptedPaymentMethods = false;
25
25
  state.acceptedPaymentMethods = action.payload;
26
26
  },
27
- actionStripePaymentEnd: function actionStripePaymentEnd(state) {
27
+ actionStripePaymentEnd: state => {
28
28
  state.loading = false;
29
29
  },
30
- actionStripePaymentStart: function actionStripePaymentStart(state) {
30
+ actionStripePaymentStart: state => {
31
31
  state.loading = true;
32
32
  },
33
- actionStripePaymentRequestButtonEnd: function actionStripePaymentRequestButtonEnd(state) {
33
+ actionStripePaymentRequestButtonEnd: state => {
34
34
  state.loadingPaymentRequestButton = false;
35
35
  },
36
- actionStripePaymentRequestButtonStart: function actionStripePaymentRequestButtonStart(state) {
36
+ actionStripePaymentRequestButtonStart: state => {
37
37
  state.loadingPaymentRequestButton = true;
38
38
  },
39
- actionStripeWeChatPaymentEnd: function actionStripeWeChatPaymentEnd(state) {
39
+ actionStripeWeChatPaymentEnd: state => {
40
40
  state.loadingWeChatPayment = false;
41
41
  },
42
- actionStripeWeChatPaymentStart: function actionStripeWeChatPaymentStart(state) {
42
+ actionStripeWeChatPaymentStart: state => {
43
43
  state.loadingWeChatPayment = true;
44
44
  },
45
- setInvoiceOrCart: function setInvoiceOrCart(state, action) {
46
- var _action$payload = action.payload,
47
- invoice = _action$payload.invoice,
48
- isCart = _action$payload.isCart;
45
+ setInvoiceOrCart: (state, action) => {
46
+ const {
47
+ invoice,
48
+ isCart
49
+ } = action.payload;
49
50
  state.invoice = invoice;
50
51
  if (isCart) {
51
52
  state.isCart = isCart;
52
53
  }
53
54
  },
54
- stripePaymentEnd: function stripePaymentEnd(state) {
55
+ stripePaymentEnd: state => {
55
56
  state.loading = false;
56
57
  },
57
- stripePaymentStart: function stripePaymentStart(state, action) {
58
+ stripePaymentStart: (state, action) => {
58
59
  state.loading = true;
59
60
  }
60
61
  }
61
62
  });
62
- var _default = exports["default"] = sliceStripeForm;
63
+ var _default = exports.default = sliceStripeForm;
@@ -8,7 +8,7 @@ exports.companyStripePubKeyOrTestPubKey = companyStripePubKeyOrTestPubKey;
8
8
  function companyStripePubKeyOrTestPubKey(company) {
9
9
  return company.isTesting ? company.stripePublishableTestKey : company.stripePublishableKey;
10
10
  }
11
- var CARD_ELEMENT_OPTIONS = exports.CARD_ELEMENT_OPTIONS = {
11
+ const CARD_ELEMENT_OPTIONS = exports.CARD_ELEMENT_OPTIONS = {
12
12
  style: {
13
13
  base: {
14
14
  '::placeholder': {
@@ -3,7 +3,7 @@
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 _react = _interopRequireWildcard(require("react"));
8
8
  var React = _react;
9
9
  var _reactRedux = require("react-redux");
@@ -11,31 +11,22 @@ var _CartProvider = require("../CartProvider");
11
11
  var _sliceCart = require("../slices/sliceCart");
12
12
  var _NavTab = _interopRequireDefault(require("./NavTab"));
13
13
  var _jsxRuntime = require("react/jsx-runtime");
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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; }
17
- 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); }
18
- 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; }
19
- 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; }
20
- 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; }
21
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
22
- 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); }
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ 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); }
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; }
23
17
  function CartNav() {
24
- var _useCartContext = (0, _CartProvider.useCartContext)(),
25
- classNameCartNav = _useCartContext.classNameCartNav;
26
- var _useSelector = (0, _reactRedux.useSelector)(function (s) {
27
- return s.stateCart;
28
- }),
29
- tabs = _useSelector.tabs;
18
+ const {
19
+ classNameCartNav
20
+ } = (0, _CartProvider.useCartContext)();
21
+ const {
22
+ tabs
23
+ } = (0, _reactRedux.useSelector)(s => s.stateCart);
30
24
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
31
25
  className: classNameCartNav,
32
- children: tabs.filter(function (tab) {
33
- return tab.tabId !== _sliceCart.tabIdPaymentSuccess;
34
- }).map(function (tab, index) {
35
- return /*#__PURE__*/(0, _react.createElement)(_NavTab["default"], _objectSpread(_objectSpread({}, tab), {}, {
36
- key: "".concat(index, "-tab")
37
- }));
38
- })
26
+ children: tabs.filter(tab => tab.tabId !== _sliceCart.tabIdPaymentSuccess).map((tab, index) => /*#__PURE__*/(0, _react.createElement)(_NavTab.default, {
27
+ ...tab,
28
+ key: `${index}-tab`
29
+ }))
39
30
  });
40
31
  }
41
- var _default = exports["default"] = CartNav;
32
+ var _default = exports.default = CartNav;
@@ -1,39 +1,40 @@
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 _sliceCart = require("../slices/sliceCart");
11
10
  var _CartProvider = require("../CartProvider");
12
11
  var _reactFontawesome = require("@fortawesome/react-fontawesome");
13
12
  var _jsxRuntime = require("react/jsx-runtime");
14
- 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); }
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; }
13
+ 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); }
14
+ 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; }
16
15
  function NavTab(_ref) {
17
- var disabled = _ref.disabled,
18
- icon = _ref.icon,
19
- name = _ref.name,
20
- tabId = _ref.tabId;
21
- var dispatch = (0, _reactRedux.useDispatch)();
22
- var _useCartContext = (0, _CartProvider.useCartContext)(),
23
- classNameCartTabItem = _useCartContext.classNameCartTabItem,
24
- classNameCartTabItemLink = _useCartContext.classNameCartTabItemLink;
25
- var _useSelector = (0, _reactRedux.useSelector)(function (s) {
26
- return s.stateCart;
27
- }),
28
- activeTab = _useSelector.activeTab;
16
+ let {
17
+ disabled,
18
+ icon,
19
+ name,
20
+ tabId
21
+ } = _ref;
22
+ const dispatch = (0, _reactRedux.useDispatch)();
23
+ const {
24
+ classNameCartTabItem,
25
+ classNameCartTabItemLink
26
+ } = (0, _CartProvider.useCartContext)();
27
+ const {
28
+ activeTab
29
+ } = (0, _reactRedux.useSelector)(s => s.stateCart);
29
30
  function toggle() {
30
31
  dispatch(_sliceCart.sliceCart.actions.setActiveTab(tabId));
31
32
  }
32
- var active = activeTab === tabId;
33
+ const active = activeTab === tabId;
33
34
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
34
35
  className: classNameCartTabItem,
35
36
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
36
- className: "".concat(classNameCartTabItemLink, " ").concat(active ? 'active' : ''),
37
+ className: `${classNameCartTabItemLink} ${active ? 'active' : ''}`,
37
38
  onClick: toggle,
38
39
  disabled: disabled,
39
40
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
@@ -42,4 +43,4 @@ function NavTab(_ref) {
42
43
  })
43
44
  });
44
45
  }
45
- var _default = exports["default"] = NavTab;
46
+ var _default = exports.default = NavTab;