@merchi/cart 1.4.4
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.
- package/LICENSE +21 -0
- package/README.md +134 -0
- package/esm/Cart.js +62 -0
- package/esm/CartAlert.js +47 -0
- package/esm/CartHeader.js +29 -0
- package/esm/CartProvider.js +1101 -0
- package/esm/CartTotals.js +89 -0
- package/esm/assets/merchi-monster-loader.gif +0 -0
- package/esm/assets/merchi-swipe-outline.png +0 -0
- package/esm/assets/product-not-found.png +0 -0
- package/esm/assets/stripe-payment-secure.png +0 -0
- package/esm/buttons/Button.js +23 -0
- package/esm/buttons/ButtonBack.js +35 -0
- package/esm/buttons/ButtonClearCart.js +17 -0
- package/esm/buttons/ButtonInvoiceDownload.js +88 -0
- package/esm/buttons/ButtonNext.js +39 -0
- package/esm/buttons/ButtonNextDynamic.js +19 -0
- package/esm/buttons/ButtonOpenCartMerchiCartModal.js +47 -0
- package/esm/buttons/ButtonPay.js +26 -0
- package/esm/buttons/ButtonShipmentTabNext.js +28 -0
- package/esm/buttons/index.js +7 -0
- package/esm/components/Alert.js +26 -0
- package/esm/components/CartBody.js +14 -0
- package/esm/components/CartClient.js +62 -0
- package/esm/components/CartFooter.js +12 -0
- package/esm/components/CartItemRow.js +230 -0
- package/esm/components/CartPaymentSettingsInvalid.js +13 -0
- package/esm/components/CartShipment.js +52 -0
- package/esm/components/CartTabContent.js +12 -0
- package/esm/components/CartTabPanel.js +25 -0
- package/esm/components/CartTableContainer.js +12 -0
- package/esm/components/CartTitle.js +26 -0
- package/esm/components/CartTotalsListGroup.js +71 -0
- package/esm/components/Collapse.js +32 -0
- package/esm/components/CustomCartProductForm.js +128 -0
- package/esm/components/CustomerCheckoutMethodTabs.js +94 -0
- package/esm/components/DiscountInputGroup.js +293 -0
- package/esm/components/LoadingTemplate.js +23 -0
- package/esm/components/NoCartItems.js +20 -0
- package/esm/components/ShipmentGroupCard.js +207 -0
- package/esm/components/Table.js +13 -0
- package/esm/components/containers.js +31 -0
- package/esm/components/index.js +18 -0
- package/esm/components/product-form-sdk-externals.js +36 -0
- package/esm/forms/FormNewCustomer.js +243 -0
- package/esm/forms/FormReturningCustomer.js +165 -0
- package/esm/forms/FormShipmentAddressAndNotes.js +195 -0
- package/esm/forms/FormSquarePayment.js +19 -0
- package/esm/forms/FormStripePayment.js +19 -0
- package/esm/forms/FormWhatsappCustomer.js +253 -0
- package/esm/forms/InputAcceptUserTermsAndConditions.js +35 -0
- package/esm/forms/InputError.js +16 -0
- package/esm/forms/InputSelect.js +48 -0
- package/esm/forms/InputText.js +56 -0
- package/esm/forms/InputsAddress.js +476 -0
- package/esm/forms/index.js +8 -0
- package/esm/index.js +13 -0
- package/esm/modals.js +51 -0
- package/esm/panels/PanelCartItems.js +49 -0
- package/esm/panels/PanelCartShipment.js +66 -0
- package/esm/panels/PanelClearCart.js +56 -0
- package/esm/panels/PanelClientCheckout.js +81 -0
- package/esm/panels/PanelEditCartItem.js +199 -0
- package/esm/panels/PanelPaymentSuccess.js +63 -0
- package/esm/panels/index.js +7 -0
- package/esm/square/SquareCard.js +106 -0
- package/esm/stripe/LegacyStripeCardForm.js +157 -0
- package/esm/stripe/StripeCardFields.js +126 -0
- package/esm/stripe/StripeCardForm.js +33 -0
- package/esm/stripe/StripePaymentButtons.js +98 -0
- package/esm/stripe/actions.js +192 -0
- package/esm/stripe/utils.js +20 -0
- package/esm/styles/globals.css +463 -0
- package/esm/styles/globals.css.map +1 -0
- package/esm/tabs/CartNav.js +28 -0
- package/esm/tabs/NavTab.js +31 -0
- package/esm/types/assets.d.js +0 -0
- package/esm/types/index.js +1 -0
- package/esm/types/merchi_product_form/index.d.js +0 -0
- package/esm/types/merchi_sdk_ts/index.d.js +0 -0
- package/esm/types/react-redux/index.d.js +0 -0
- package/esm/utilities/address.js +457 -0
- package/esm/utilities/area.js +297 -0
- package/esm/utilities/cart.js +95 -0
- package/esm/utilities/company.js +6 -0
- package/esm/utilities/cookie.js +156 -0
- package/esm/utilities/currency.js +219 -0
- package/esm/utilities/customForm.js +57 -0
- package/esm/utilities/helpers.js +229 -0
- package/esm/utilities/index.js +14 -0
- package/esm/utilities/invoice.js +112 -0
- package/esm/utilities/job.js +9 -0
- package/esm/utilities/local_storage.js +85 -0
- package/esm/utilities/product.js +13 -0
- package/esm/utilities/shipment.js +11 -0
- package/esm/utilities/tabs.js +51 -0
- package/esm/utilities/user.js +65 -0
- package/esm/utilities/variations.js +58 -0
- package/lib/Cart.d.ts +9 -0
- package/lib/Cart.js +69 -0
- package/lib/CartAlert.d.ts +3 -0
- package/lib/CartAlert.js +53 -0
- package/lib/CartHeader.d.ts +3 -0
- package/lib/CartHeader.js +37 -0
- package/lib/CartProvider.d.ts +236 -0
- package/lib/CartProvider.js +1107 -0
- package/lib/CartTotals.d.ts +7 -0
- package/lib/CartTotals.js +96 -0
- package/lib/assets/merchi-monster-loader.gif +0 -0
- package/lib/assets/merchi-swipe-outline.png +0 -0
- package/lib/assets/product-not-found.png +0 -0
- package/lib/assets/stripe-payment-secure.png +0 -0
- package/lib/buttons/Button.d.ts +11 -0
- package/lib/buttons/Button.js +31 -0
- package/lib/buttons/ButtonBack.d.ts +6 -0
- package/lib/buttons/ButtonBack.js +44 -0
- package/lib/buttons/ButtonClearCart.d.ts +3 -0
- package/lib/buttons/ButtonClearCart.js +24 -0
- package/lib/buttons/ButtonInvoiceDownload.d.ts +3 -0
- package/lib/buttons/ButtonInvoiceDownload.js +96 -0
- package/lib/buttons/ButtonNext.d.ts +3 -0
- package/lib/buttons/ButtonNext.js +48 -0
- package/lib/buttons/ButtonNextDynamic.d.ts +3 -0
- package/lib/buttons/ButtonNextDynamic.js +28 -0
- package/lib/buttons/ButtonOpenCartMerchiCartModal.d.ts +9 -0
- package/lib/buttons/ButtonOpenCartMerchiCartModal.js +57 -0
- package/lib/buttons/ButtonPay.d.ts +7 -0
- package/lib/buttons/ButtonPay.js +35 -0
- package/lib/buttons/ButtonShipmentTabNext.d.ts +2 -0
- package/lib/buttons/ButtonShipmentTabNext.js +37 -0
- package/lib/buttons/index.d.ts +7 -0
- package/lib/buttons/index.js +48 -0
- package/lib/components/Alert.d.ts +7 -0
- package/lib/components/Alert.js +34 -0
- package/lib/components/CartBody.d.ts +7 -0
- package/lib/components/CartBody.js +22 -0
- package/lib/components/CartClient.d.ts +4 -0
- package/lib/components/CartClient.js +71 -0
- package/lib/components/CartFooter.d.ts +6 -0
- package/lib/components/CartFooter.js +20 -0
- package/lib/components/CartItemRow.d.ts +7 -0
- package/lib/components/CartItemRow.js +236 -0
- package/lib/components/CartPaymentSettingsInvalid.d.ts +2 -0
- package/lib/components/CartPaymentSettingsInvalid.js +21 -0
- package/lib/components/CartShipment.d.ts +6 -0
- package/lib/components/CartShipment.js +59 -0
- package/lib/components/CartTabContent.d.ts +6 -0
- package/lib/components/CartTabContent.js +20 -0
- package/lib/components/CartTabPanel.d.ts +7 -0
- package/lib/components/CartTabPanel.js +31 -0
- package/lib/components/CartTableContainer.d.ts +6 -0
- package/lib/components/CartTableContainer.js +20 -0
- package/lib/components/CartTitle.d.ts +2 -0
- package/lib/components/CartTitle.js +34 -0
- package/lib/components/CartTotalsListGroup.d.ts +3 -0
- package/lib/components/CartTotalsListGroup.js +78 -0
- package/lib/components/Collapse.d.ts +3 -0
- package/lib/components/Collapse.js +40 -0
- package/lib/components/CustomCartProductForm.d.ts +18 -0
- package/lib/components/CustomCartProductForm.js +136 -0
- package/lib/components/CustomerCheckoutMethodTabs.d.ts +6 -0
- package/lib/components/CustomerCheckoutMethodTabs.js +103 -0
- package/lib/components/DiscountInputGroup.d.ts +2 -0
- package/lib/components/DiscountInputGroup.js +301 -0
- package/lib/components/LoadingTemplate.d.ts +7 -0
- package/lib/components/LoadingTemplate.js +30 -0
- package/lib/components/NoCartItems.d.ts +3 -0
- package/lib/components/NoCartItems.js +27 -0
- package/lib/components/ShipmentGroupCard.d.ts +7 -0
- package/lib/components/ShipmentGroupCard.js +215 -0
- package/lib/components/Table.d.ts +7 -0
- package/lib/components/Table.js +19 -0
- package/lib/components/containers.d.ts +14 -0
- package/lib/components/containers.js +40 -0
- package/lib/components/index.d.ts +18 -0
- package/lib/components/index.js +133 -0
- package/lib/components/product-form-sdk-externals.d.ts +46 -0
- package/lib/components/product-form-sdk-externals.js +43 -0
- package/lib/forms/FormNewCustomer.d.ts +4 -0
- package/lib/forms/FormNewCustomer.js +252 -0
- package/lib/forms/FormReturningCustomer.d.ts +3 -0
- package/lib/forms/FormReturningCustomer.js +173 -0
- package/lib/forms/FormShipmentAddressAndNotes.d.ts +15 -0
- package/lib/forms/FormShipmentAddressAndNotes.js +203 -0
- package/lib/forms/FormSquarePayment.d.ts +3 -0
- package/lib/forms/FormSquarePayment.js +27 -0
- package/lib/forms/FormStripePayment.d.ts +3 -0
- package/lib/forms/FormStripePayment.js +27 -0
- package/lib/forms/FormWhatsappCustomer.d.ts +3 -0
- package/lib/forms/FormWhatsappCustomer.js +261 -0
- package/lib/forms/InputAcceptUserTermsAndConditions.d.ts +7 -0
- package/lib/forms/InputAcceptUserTermsAndConditions.js +41 -0
- package/lib/forms/InputError.d.ts +8 -0
- package/lib/forms/InputError.js +24 -0
- package/lib/forms/InputSelect.d.ts +14 -0
- package/lib/forms/InputSelect.js +55 -0
- package/lib/forms/InputText.d.ts +12 -0
- package/lib/forms/InputText.js +63 -0
- package/lib/forms/InputsAddress.d.ts +11 -0
- package/lib/forms/InputsAddress.js +485 -0
- package/lib/forms/index.d.ts +8 -0
- package/lib/forms/index.js +63 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +93 -0
- package/lib/modals.d.ts +17 -0
- package/lib/modals.js +59 -0
- package/lib/panels/PanelCartItems.d.ts +3 -0
- package/lib/panels/PanelCartItems.js +56 -0
- package/lib/panels/PanelCartShipment.d.ts +3 -0
- package/lib/panels/PanelCartShipment.js +72 -0
- package/lib/panels/PanelClearCart.d.ts +3 -0
- package/lib/panels/PanelClearCart.js +62 -0
- package/lib/panels/PanelClientCheckout.d.ts +3 -0
- package/lib/panels/PanelClientCheckout.js +88 -0
- package/lib/panels/PanelEditCartItem.d.ts +6 -0
- package/lib/panels/PanelEditCartItem.js +206 -0
- package/lib/panels/PanelPaymentSuccess.d.ts +3 -0
- package/lib/panels/PanelPaymentSuccess.js +69 -0
- package/lib/panels/index.d.ts +7 -0
- package/lib/panels/index.js +48 -0
- package/lib/square/SquareCard.d.ts +3 -0
- package/lib/square/SquareCard.js +114 -0
- package/lib/stripe/LegacyStripeCardForm.d.ts +3 -0
- package/lib/stripe/LegacyStripeCardForm.js +166 -0
- package/lib/stripe/StripeCardFields.d.ts +15 -0
- package/lib/stripe/StripeCardFields.js +135 -0
- package/lib/stripe/StripeCardForm.d.ts +2 -0
- package/lib/stripe/StripeCardForm.js +42 -0
- package/lib/stripe/StripePaymentButtons.d.ts +8 -0
- package/lib/stripe/StripePaymentButtons.js +106 -0
- package/lib/stripe/actions.d.ts +4 -0
- package/lib/stripe/actions.js +200 -0
- package/lib/stripe/utils.d.ts +18 -0
- package/lib/stripe/utils.js +27 -0
- package/lib/styles/globals.css +463 -0
- package/lib/styles/globals.css.map +1 -0
- package/lib/tabs/CartNav.d.ts +3 -0
- package/lib/tabs/CartNav.js +36 -0
- package/lib/tabs/NavTab.d.ts +9 -0
- package/lib/tabs/NavTab.js +39 -0
- package/lib/types/index.d.ts +13 -0
- package/lib/types/index.js +1 -0
- package/lib/utilities/address.d.ts +30 -0
- package/lib/utilities/address.js +468 -0
- package/lib/utilities/area.d.ts +77 -0
- package/lib/utilities/area.js +328 -0
- package/lib/utilities/cart.d.ts +9 -0
- package/lib/utilities/cart.js +108 -0
- package/lib/utilities/company.d.ts +2 -0
- package/lib/utilities/company.js +13 -0
- package/lib/utilities/cookie.d.ts +4 -0
- package/lib/utilities/cookie.js +165 -0
- package/lib/utilities/currency.d.ts +5 -0
- package/lib/utilities/currency.js +229 -0
- package/lib/utilities/customForm.d.ts +17 -0
- package/lib/utilities/customForm.js +64 -0
- package/lib/utilities/helpers.d.ts +24 -0
- package/lib/utilities/helpers.js +240 -0
- package/lib/utilities/index.d.ts +14 -0
- package/lib/utilities/index.js +159 -0
- package/lib/utilities/invoice.d.ts +3 -0
- package/lib/utilities/invoice.js +118 -0
- package/lib/utilities/job.d.ts +1 -0
- package/lib/utilities/job.js +15 -0
- package/lib/utilities/local_storage.d.ts +31 -0
- package/lib/utilities/local_storage.js +96 -0
- package/lib/utilities/product.d.ts +2 -0
- package/lib/utilities/product.js +21 -0
- package/lib/utilities/shipment.d.ts +2 -0
- package/lib/utilities/shipment.js +18 -0
- package/lib/utilities/tabs.d.ts +14 -0
- package/lib/utilities/tabs.js +60 -0
- package/lib/utilities/user.d.ts +5 -0
- package/lib/utilities/user.js +75 -0
- package/lib/utilities/variations.d.ts +18 -0
- package/lib/utilities/variations.js +66 -0
- package/package.json +109 -0
- package/src/Cart.tsx +96 -0
- package/src/CartAlert.tsx +35 -0
- package/src/CartHeader.tsx +28 -0
- package/src/CartProvider.tsx +992 -0
- package/src/CartTotals.tsx +102 -0
- package/src/assets/merchi-monster-loader.gif +0 -0
- package/src/assets/merchi-swipe-outline.png +0 -0
- package/src/assets/product-not-found.png +0 -0
- package/src/assets/stripe-payment-secure.png +0 -0
- package/src/buttons/Button.tsx +35 -0
- package/src/buttons/ButtonBack.tsx +42 -0
- package/src/buttons/ButtonClearCart.tsx +17 -0
- package/src/buttons/ButtonInvoiceDownload.tsx +60 -0
- package/src/buttons/ButtonNext.tsx +35 -0
- package/src/buttons/ButtonNextDynamic.tsx +31 -0
- package/src/buttons/ButtonOpenCartMerchiCartModal.tsx +61 -0
- package/src/buttons/ButtonPay.tsx +32 -0
- package/src/buttons/ButtonShipmentTabNext.tsx +24 -0
- package/src/buttons/index.ts +15 -0
- package/src/components/Alert.tsx +31 -0
- package/src/components/CartBody.tsx +16 -0
- package/src/components/CartClient.tsx +52 -0
- package/src/components/CartFooter.tsx +15 -0
- package/src/components/CartItemRow.tsx +212 -0
- package/src/components/CartPaymentSettingsInvalid.tsx +12 -0
- package/src/components/CartShipment.tsx +56 -0
- package/src/components/CartTabContent.tsx +15 -0
- package/src/components/CartTabPanel.tsx +25 -0
- package/src/components/CartTableContainer.tsx +15 -0
- package/src/components/CartTitle.tsx +22 -0
- package/src/components/CartTotalsListGroup.tsx +58 -0
- package/src/components/Collapse.tsx +23 -0
- package/src/components/CustomCartProductForm.tsx +123 -0
- package/src/components/CustomerCheckoutMethodTabs.tsx +106 -0
- package/src/components/DiscountInputGroup.tsx +160 -0
- package/src/components/LoadingTemplate.tsx +22 -0
- package/src/components/NoCartItems.tsx +20 -0
- package/src/components/ShipmentGroupCard.tsx +170 -0
- package/src/components/Table.tsx +15 -0
- package/src/components/containers.tsx +40 -0
- package/src/components/index.ts +38 -0
- package/src/components/product-form-sdk-externals.ts +67 -0
- package/src/forms/FormNewCustomer.tsx +170 -0
- package/src/forms/FormReturningCustomer.tsx +117 -0
- package/src/forms/FormShipmentAddressAndNotes.tsx +165 -0
- package/src/forms/FormSquarePayment.tsx +19 -0
- package/src/forms/FormStripePayment.tsx +19 -0
- package/src/forms/FormWhatsappCustomer.tsx +179 -0
- package/src/forms/InputAcceptUserTermsAndConditions.tsx +43 -0
- package/src/forms/InputError.tsx +23 -0
- package/src/forms/InputSelect.tsx +58 -0
- package/src/forms/InputText.tsx +56 -0
- package/src/forms/InputsAddress.tsx +438 -0
- package/src/forms/index.ts +18 -0
- package/src/index.ts +31 -0
- package/src/modals.tsx +65 -0
- package/src/panels/PanelCartItems.tsx +56 -0
- package/src/panels/PanelCartShipment.tsx +86 -0
- package/src/panels/PanelClearCart.tsx +50 -0
- package/src/panels/PanelClientCheckout.tsx +102 -0
- package/src/panels/PanelEditCartItem.tsx +172 -0
- package/src/panels/PanelPaymentSuccess.tsx +66 -0
- package/src/panels/index.ts +15 -0
- package/src/square/SquareCard.tsx +84 -0
- package/src/stripe/LegacyStripeCardForm.tsx +91 -0
- package/src/stripe/StripeCardFields.tsx +173 -0
- package/src/stripe/StripeCardForm.tsx +18 -0
- package/src/stripe/StripePaymentButtons.tsx +117 -0
- package/src/stripe/actions.ts +94 -0
- package/src/stripe/utils.ts +22 -0
- package/src/styles/globals.scss +475 -0
- package/src/tabs/CartNav.tsx +18 -0
- package/src/tabs/NavTab.tsx +36 -0
- package/src/types/assets.d.ts +4 -0
- package/src/types/index.ts +15 -0
- package/src/types/merchi_product_form/index.d.ts +1 -0
- package/src/types/merchi_sdk_ts/index.d.ts +1 -0
- package/src/types/react-redux/index.d.ts +0 -0
- package/src/utilities/address.ts +463 -0
- package/src/utilities/area.ts +359 -0
- package/src/utilities/cart.ts +80 -0
- package/src/utilities/company.ts +8 -0
- package/src/utilities/cookie.ts +58 -0
- package/src/utilities/currency.ts +216 -0
- package/src/utilities/customForm.ts +71 -0
- package/src/utilities/helpers.ts +213 -0
- package/src/utilities/index.ts +14 -0
- package/src/utilities/invoice.ts +60 -0
- package/src/utilities/job.ts +13 -0
- package/src/utilities/local_storage.ts +130 -0
- package/src/utilities/product.ts +14 -0
- package/src/utilities/shipment.ts +11 -0
- package/src/utilities/tabs.ts +38 -0
- package/src/utilities/user.ts +33 -0
- package/src/utilities/variations.ts +80 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
3
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
4
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
5
|
+
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."); }
|
|
6
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
7
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
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); }
|
|
13
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
14
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
15
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { cartItemCurrencyAndCost } from '../utilities/currency';
|
|
23
|
+
import { productFeatureImageUrl } from '../utilities/product';
|
|
24
|
+
import { valueString } from '../utilities/variations';
|
|
25
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
26
|
+
import { faCircleNotch, faEdit, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
|
27
|
+
import { Button } from '../buttons';
|
|
28
|
+
import { useCartContext } from '../CartProvider';
|
|
29
|
+
import { makeCart } from '../utilities/cart';
|
|
30
|
+
import { cartEmbed } from '../utilities/helpers';
|
|
31
|
+
import { tabIdItem } from '../utilities/tabs';
|
|
32
|
+
import { cartItemsNeedShipment } from '../utilities/shipment';
|
|
33
|
+
import { cartHasShippmentGroupsAndAllHaveSelectedGroups, initTabs, setDisableTab, tabCheckout, tabShipment, tabsWithShipment } from '../utilities/tabs';
|
|
34
|
+
import { getCartCookieToken } from '../utilities/cookie';
|
|
35
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
36
|
+
function VariationListItem(props) {
|
|
37
|
+
var variation = props.variation;
|
|
38
|
+
var field = variation.variationField;
|
|
39
|
+
return /*#__PURE__*/_jsx("li", {
|
|
40
|
+
children: "".concat(field.name, ": ").concat(valueString(variation))
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function VariationList(_ref) {
|
|
44
|
+
var variations = _ref.variations;
|
|
45
|
+
var _useCartContext = useCartContext(),
|
|
46
|
+
classNameVariationsList = _useCartContext.classNameVariationsList;
|
|
47
|
+
return /*#__PURE__*/_jsx("ul", {
|
|
48
|
+
className: classNameVariationsList,
|
|
49
|
+
children: variations.map(function (v, index) {
|
|
50
|
+
return /*#__PURE__*/_jsx(VariationListItem, {
|
|
51
|
+
variation: v
|
|
52
|
+
}, "".concat(index, "-variation"));
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function GroupVariationItems(props) {
|
|
57
|
+
var count = props.count,
|
|
58
|
+
group = props.group;
|
|
59
|
+
return /*#__PURE__*/_jsxs("li", {
|
|
60
|
+
children: ["Group ", count, " Quantity: ", group.quantity, /*#__PURE__*/_jsx(VariationList, {
|
|
61
|
+
variations: group.variations
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function VariationsGroupsList(_ref2) {
|
|
66
|
+
var groups = _ref2.groups;
|
|
67
|
+
var _useCartContext2 = useCartContext(),
|
|
68
|
+
classNameVariationsList = _useCartContext2.classNameVariationsList;
|
|
69
|
+
return /*#__PURE__*/_jsx("ul", {
|
|
70
|
+
className: classNameVariationsList,
|
|
71
|
+
children: groups.map(function (group, index) {
|
|
72
|
+
return /*#__PURE__*/_jsx(GroupVariationItems, {
|
|
73
|
+
group: group,
|
|
74
|
+
count: index + 1
|
|
75
|
+
}, "".concat(index, "-group-variations"));
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function CartItemRow(_ref3) {
|
|
80
|
+
var cartItem = _ref3.cartItem,
|
|
81
|
+
index = _ref3.index;
|
|
82
|
+
var _useCartContext3 = useCartContext(),
|
|
83
|
+
alertError = _useCartContext3.alertError,
|
|
84
|
+
cart = _useCartContext3.cart,
|
|
85
|
+
domainId = _useCartContext3.domainId,
|
|
86
|
+
setCart = _useCartContext3.setCart,
|
|
87
|
+
classNameBtnLink = _useCartContext3.classNameBtnLink,
|
|
88
|
+
classNameCartItemFeatureImage = _useCartContext3.classNameCartItemFeatureImage,
|
|
89
|
+
classNameCartItemInfo = _useCartContext3.classNameCartItemInfo,
|
|
90
|
+
classNameCartItemInfoCell = _useCartContext3.classNameCartItemInfoCell,
|
|
91
|
+
classNameCartItemInfoCellRight = _useCartContext3.classNameCartItemInfoCellRight,
|
|
92
|
+
classNameCartItemInfoContainer = _useCartContext3.classNameCartItemInfoContainer,
|
|
93
|
+
setActiveTabIndex = _useCartContext3.setActiveTabIndex,
|
|
94
|
+
setCartItem = _useCartContext3.setCartItem,
|
|
95
|
+
tabs = _useCartContext3.tabs,
|
|
96
|
+
setTabs = _useCartContext3.setTabs,
|
|
97
|
+
showCartItemInfo = _useCartContext3.showCartItemInfo;
|
|
98
|
+
var product = cartItem.product,
|
|
99
|
+
quantity = cartItem.quantity,
|
|
100
|
+
variations = cartItem.variations,
|
|
101
|
+
variationsGroups = cartItem.variationsGroups;
|
|
102
|
+
var name = product.name;
|
|
103
|
+
var _React$useState = React.useState(false),
|
|
104
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
105
|
+
loading = _React$useState2[0],
|
|
106
|
+
setLoading = _React$useState2[1];
|
|
107
|
+
function actionDeleteCartItem() {
|
|
108
|
+
return _actionDeleteCartItem.apply(this, arguments);
|
|
109
|
+
}
|
|
110
|
+
function _actionDeleteCartItem() {
|
|
111
|
+
_actionDeleteCartItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
112
|
+
var cartToken, cartEnt, cartItems, r, cartJson, needsShipping, _tabs, _t;
|
|
113
|
+
return _regenerator().w(function (_context) {
|
|
114
|
+
while (1) switch (_context.p = _context.n) {
|
|
115
|
+
case 0:
|
|
116
|
+
setLoading(true);
|
|
117
|
+
_context.n = 1;
|
|
118
|
+
return getCartCookieToken(domainId);
|
|
119
|
+
case 1:
|
|
120
|
+
cartToken = _context.v;
|
|
121
|
+
_context.p = 2;
|
|
122
|
+
cartEnt = makeCart(_objectSpread({}, cart), false, cartToken);
|
|
123
|
+
cartItems = cartEnt.cartItems;
|
|
124
|
+
cartItems.splice(index, 1);
|
|
125
|
+
cartEnt.cartItems = cartItems;
|
|
126
|
+
_context.n = 3;
|
|
127
|
+
return cartEnt.save({
|
|
128
|
+
embed: cartEmbed
|
|
129
|
+
});
|
|
130
|
+
case 3:
|
|
131
|
+
r = _context.v;
|
|
132
|
+
cartJson = r.toJson();
|
|
133
|
+
needsShipping = cartItemsNeedShipment(cartJson);
|
|
134
|
+
setCart(_objectSpread({}, cartJson));
|
|
135
|
+
if (cart.cartItems.length === 0) {
|
|
136
|
+
setTabs(_toConsumableArray(initTabs));
|
|
137
|
+
} else {
|
|
138
|
+
if (needsShipping) {
|
|
139
|
+
setTabs(_toConsumableArray(tabsWithShipment));
|
|
140
|
+
if (cart.cartItems.length) {
|
|
141
|
+
_tabs = _toConsumableArray(tabs);
|
|
142
|
+
_tabs[1] = setDisableTab(tabShipment, false);
|
|
143
|
+
if (cartHasShippmentGroupsAndAllHaveSelectedGroups(cartJson)) {
|
|
144
|
+
_tabs[2] = setDisableTab(tabCheckout, false);
|
|
145
|
+
}
|
|
146
|
+
setTabs(_toConsumableArray(_tabs));
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
setTabs(_toConsumableArray(initTabs));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
_context.n = 5;
|
|
153
|
+
break;
|
|
154
|
+
case 4:
|
|
155
|
+
_context.p = 4;
|
|
156
|
+
_t = _context.v;
|
|
157
|
+
alertError(_t.errorMessage || _t.message || 'Unable to remove item from cart.');
|
|
158
|
+
case 5:
|
|
159
|
+
_context.p = 5;
|
|
160
|
+
setLoading(false);
|
|
161
|
+
return _context.f(5);
|
|
162
|
+
case 6:
|
|
163
|
+
return _context.a(2);
|
|
164
|
+
}
|
|
165
|
+
}, _callee, null, [[2, 4, 5, 6]]);
|
|
166
|
+
}));
|
|
167
|
+
return _actionDeleteCartItem.apply(this, arguments);
|
|
168
|
+
}
|
|
169
|
+
return /*#__PURE__*/_jsxs("tr", {
|
|
170
|
+
children: [/*#__PURE__*/_jsxs("td", {
|
|
171
|
+
scope: "row",
|
|
172
|
+
className: classNameCartItemInfoCell,
|
|
173
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
174
|
+
src: productFeatureImageUrl(product),
|
|
175
|
+
alt: name,
|
|
176
|
+
width: "70",
|
|
177
|
+
className: classNameCartItemFeatureImage
|
|
178
|
+
}), showCartItemInfo && /*#__PURE__*/_jsxs("div", {
|
|
179
|
+
className: classNameCartItemInfoContainer,
|
|
180
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
181
|
+
className: classNameCartItemInfo,
|
|
182
|
+
children: [/*#__PURE__*/_jsx("h5", {
|
|
183
|
+
style: {
|
|
184
|
+
display: 'inline'
|
|
185
|
+
},
|
|
186
|
+
children: name
|
|
187
|
+
}), variations && /*#__PURE__*/_jsx(VariationList, {
|
|
188
|
+
variations: variations
|
|
189
|
+
})]
|
|
190
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
191
|
+
className: classNameCartItemInfo,
|
|
192
|
+
children: variationsGroups && /*#__PURE__*/_jsx(VariationsGroupsList, {
|
|
193
|
+
groups: variationsGroups
|
|
194
|
+
})
|
|
195
|
+
})]
|
|
196
|
+
})]
|
|
197
|
+
}), /*#__PURE__*/_jsx("td", {
|
|
198
|
+
className: classNameCartItemInfoCellRight,
|
|
199
|
+
children: /*#__PURE__*/_jsx("strong", {
|
|
200
|
+
children: quantity
|
|
201
|
+
})
|
|
202
|
+
}), /*#__PURE__*/_jsx("td", {
|
|
203
|
+
className: classNameCartItemInfoCellRight,
|
|
204
|
+
children: /*#__PURE__*/_jsx("strong", {
|
|
205
|
+
children: cartItemCurrencyAndCost(cartItem)
|
|
206
|
+
})
|
|
207
|
+
}), /*#__PURE__*/_jsxs("td", {
|
|
208
|
+
className: classNameCartItemInfoCellRight,
|
|
209
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
210
|
+
className: classNameBtnLink,
|
|
211
|
+
onClick: function onClick() {
|
|
212
|
+
setCartItem(_objectSpread({}, cartItem));
|
|
213
|
+
setActiveTabIndex(tabIdItem);
|
|
214
|
+
},
|
|
215
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
216
|
+
icon: faEdit
|
|
217
|
+
})
|
|
218
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
219
|
+
className: classNameBtnLink,
|
|
220
|
+
onClick: actionDeleteCartItem //TODO modify delete action
|
|
221
|
+
,
|
|
222
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
223
|
+
icon: loading ? faCircleNotch : faTrashAlt,
|
|
224
|
+
spin: loading
|
|
225
|
+
})
|
|
226
|
+
})]
|
|
227
|
+
})]
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
export default CartItemRow;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
export default function CartPaymentSettingsInvalid() {
|
|
4
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
5
|
+
className: "merchi-loading-container",
|
|
6
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
7
|
+
className: "merchi-payment-gateway-inactive"
|
|
8
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
9
|
+
className: "merchi-loading-container-text",
|
|
10
|
+
children: "Payment gateway is currently inactive."
|
|
11
|
+
})]
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Title from './CartTitle';
|
|
2
|
+
import { tabIdShipment } from '../utilities/tabs';
|
|
3
|
+
import { addressInOneLine } from '../utilities/address';
|
|
4
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
+
import { faEdit, faTruck } from '@fortawesome/free-solid-svg-icons';
|
|
6
|
+
import { Button } from '../buttons';
|
|
7
|
+
import { useCartContext } from '../CartProvider';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
function CartShipment(_ref) {
|
|
10
|
+
var cart = _ref.cart;
|
|
11
|
+
var _useCartContext = useCartContext(),
|
|
12
|
+
classNameBtnDefault = _useCartContext.classNameBtnDefault,
|
|
13
|
+
classNameListContainer = _useCartContext.classNameListContainer,
|
|
14
|
+
classNameListUnstyled = _useCartContext.classNameListUnstyled,
|
|
15
|
+
setActiveTabIndex = _useCartContext.setActiveTabIndex;
|
|
16
|
+
var receiverAddress = cart.receiverAddress,
|
|
17
|
+
receiverNotes = cart.receiverNotes;
|
|
18
|
+
var address = receiverAddress ? receiverAddress : null;
|
|
19
|
+
function openShipmentTab() {
|
|
20
|
+
setActiveTabIndex(tabIdShipment);
|
|
21
|
+
}
|
|
22
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
23
|
+
className: classNameListContainer,
|
|
24
|
+
children: [/*#__PURE__*/_jsx(Title, {
|
|
25
|
+
icon: faTruck,
|
|
26
|
+
title: "Ship to"
|
|
27
|
+
}), /*#__PURE__*/_jsxs("ul", {
|
|
28
|
+
className: classNameListUnstyled,
|
|
29
|
+
style: {
|
|
30
|
+
fontSize: '15px',
|
|
31
|
+
marginBottom: '1rem'
|
|
32
|
+
},
|
|
33
|
+
children: [/*#__PURE__*/_jsx("li", {
|
|
34
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
35
|
+
style: {
|
|
36
|
+
display: 'inline-block'
|
|
37
|
+
},
|
|
38
|
+
children: address ? addressInOneLine(address) : 'Shipping address not set'
|
|
39
|
+
})
|
|
40
|
+
}), receiverNotes && /*#__PURE__*/_jsx("li", {
|
|
41
|
+
children: receiverNotes
|
|
42
|
+
})]
|
|
43
|
+
}), /*#__PURE__*/_jsxs(Button, {
|
|
44
|
+
onClick: openShipmentTab,
|
|
45
|
+
className: classNameBtnDefault,
|
|
46
|
+
children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
47
|
+
icon: faEdit
|
|
48
|
+
}), " ", address ? ' Change' : ' Set']
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export default CartShipment;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCartContext } from '../CartProvider';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export default function CartTabContent(_ref) {
|
|
5
|
+
var children = _ref.children;
|
|
6
|
+
var _useCartContext = useCartContext(),
|
|
7
|
+
classNameCartTab = _useCartContext.classNameCartTab;
|
|
8
|
+
return /*#__PURE__*/_jsx("div", {
|
|
9
|
+
className: classNameCartTab,
|
|
10
|
+
children: children
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCartContext } from '../CartProvider';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export default function CartTabPanel(_ref) {
|
|
4
|
+
var children = _ref.children,
|
|
5
|
+
tabId = _ref.tabId;
|
|
6
|
+
var _useCartContext = useCartContext(),
|
|
7
|
+
activeTabIndex = _useCartContext.activeTabIndex,
|
|
8
|
+
classNameCartTabPanel = _useCartContext.classNameCartTabPanel,
|
|
9
|
+
tabs = _useCartContext.tabs;
|
|
10
|
+
var currentTabIndex = tabs.findIndex(function (t) {
|
|
11
|
+
return t.tabId === activeTabIndex;
|
|
12
|
+
});
|
|
13
|
+
var activeTabValues = tabs[currentTabIndex];
|
|
14
|
+
var isActive = tabId === -1 && activeTabIndex === -1 || tabId === -2 && activeTabIndex === -2 || !!(activeTabValues && tabId === activeTabValues.tabId);
|
|
15
|
+
|
|
16
|
+
// Unmount inactive tabs so heavy children (payments, product form) stay out of the tree.
|
|
17
|
+
if (!isActive) return null;
|
|
18
|
+
return /*#__PURE__*/_jsx("div", {
|
|
19
|
+
className: classNameCartTabPanel,
|
|
20
|
+
style: {
|
|
21
|
+
display: 'block'
|
|
22
|
+
},
|
|
23
|
+
children: children
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCartContext } from '../CartProvider';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export default function CartTableContainer(_ref) {
|
|
5
|
+
var children = _ref.children;
|
|
6
|
+
var _useCartContext = useCartContext(),
|
|
7
|
+
classNameTableContainer = _useCartContext.classNameTableContainer;
|
|
8
|
+
return /*#__PURE__*/_jsx("div", {
|
|
9
|
+
className: classNameTableContainer,
|
|
10
|
+
children: children
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
+
import { useCartContext } from '../CartProvider';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export default function Title(_ref) {
|
|
6
|
+
var icon = _ref.icon,
|
|
7
|
+
title = _ref.title;
|
|
8
|
+
var _useCartContext = useCartContext(),
|
|
9
|
+
classNameCartTitle = _useCartContext.classNameCartTitle;
|
|
10
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
11
|
+
className: classNameCartTitle,
|
|
12
|
+
children: [typeof icon === 'string' ? /*#__PURE__*/_jsx("i", {
|
|
13
|
+
className: "".concat(icon, " fa-2x")
|
|
14
|
+
}) : /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
15
|
+
icon: icon,
|
|
16
|
+
size: "2x"
|
|
17
|
+
}), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx("div", {
|
|
18
|
+
style: {
|
|
19
|
+
marginTop: '1rem'
|
|
20
|
+
},
|
|
21
|
+
children: /*#__PURE__*/_jsx("strong", {
|
|
22
|
+
children: title
|
|
23
|
+
})
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
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); }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { useCartContext } from '../CartProvider';
|
|
9
|
+
import { cartRequiresShipment } from '../utilities/cart';
|
|
10
|
+
import { CartTotal } from '../CartTotals';
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
function CostsListItem(_ref) {
|
|
13
|
+
var attr = _ref.attr,
|
|
14
|
+
name = _ref.name;
|
|
15
|
+
var _useCartContext = useCartContext(),
|
|
16
|
+
classNameCartTotalItem = _useCartContext.classNameCartTotalItem,
|
|
17
|
+
classNameCartTotalItemPrice = _useCartContext.classNameCartTotalItemPrice,
|
|
18
|
+
classNameListItemCartTotals = _useCartContext.classNameListItemCartTotals;
|
|
19
|
+
return /*#__PURE__*/_jsxs("li", {
|
|
20
|
+
className: classNameListItemCartTotals,
|
|
21
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
22
|
+
className: classNameCartTotalItem,
|
|
23
|
+
children: name
|
|
24
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
25
|
+
className: classNameCartTotalItemPrice,
|
|
26
|
+
children: /*#__PURE__*/_jsx(CartTotal, {
|
|
27
|
+
attribute: attr
|
|
28
|
+
})
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function CartTotalsListGroup() {
|
|
33
|
+
var _useCartContext2 = useCartContext(),
|
|
34
|
+
cart = _useCartContext2.cart,
|
|
35
|
+
classNameCartTotaListContainer = _useCartContext2.classNameCartTotaListContainer,
|
|
36
|
+
classNameCartTotalItemPrice = _useCartContext2.classNameCartTotalItemPrice,
|
|
37
|
+
classNameList = _useCartContext2.classNameList,
|
|
38
|
+
classNameListItem = _useCartContext2.classNameListItem;
|
|
39
|
+
var cartItems = cart.cartItems ? cart.cartItems : [];
|
|
40
|
+
return /*#__PURE__*/_jsx("div", {
|
|
41
|
+
className: classNameCartTotaListContainer,
|
|
42
|
+
children: /*#__PURE__*/_jsxs("ul", {
|
|
43
|
+
className: classNameList,
|
|
44
|
+
children: [!!Number(cart.discountedAmount) && /*#__PURE__*/_jsx(CostsListItem, {
|
|
45
|
+
attr: "discountedAmount",
|
|
46
|
+
name: "Discount"
|
|
47
|
+
}), /*#__PURE__*/_jsx(CostsListItem, {
|
|
48
|
+
attr: "cartItemsSubtotalCost",
|
|
49
|
+
name: "Subtotal"
|
|
50
|
+
}), cartRequiresShipment(_objectSpread(_objectSpread({}, cart), {}, {
|
|
51
|
+
cartItems: cartItems
|
|
52
|
+
})) && /*#__PURE__*/_jsx(CostsListItem, {
|
|
53
|
+
attr: "shipmentTotalCost",
|
|
54
|
+
name: "Shipping"
|
|
55
|
+
}), !!cart.taxAmount && /*#__PURE__*/_jsx(CostsListItem, {
|
|
56
|
+
attr: "taxAmount",
|
|
57
|
+
name: "Tax"
|
|
58
|
+
}), /*#__PURE__*/_jsx(CostsListItem, {
|
|
59
|
+
attr: "totalCost",
|
|
60
|
+
name: "Total"
|
|
61
|
+
}), /*#__PURE__*/_jsx("li", {
|
|
62
|
+
className: classNameListItem,
|
|
63
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
64
|
+
className: classNameCartTotalItemPrice,
|
|
65
|
+
children: "Total price includes taxes"
|
|
66
|
+
})
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export default CartTotalsListGroup;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { useState, useRef, useEffect } from 'react';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
function Collapse(_ref) {
|
|
11
|
+
var isOpen = _ref.isOpen,
|
|
12
|
+
children = _ref.children;
|
|
13
|
+
var _useState = useState(isOpen ? 'auto' : '0'),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
height = _useState2[0],
|
|
16
|
+
setHeight = _useState2[1];
|
|
17
|
+
var ref = useRef(null);
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
setHeight(isOpen ? "".concat(ref.current.scrollHeight, "px") : '0');
|
|
20
|
+
}, [isOpen]);
|
|
21
|
+
return /*#__PURE__*/_jsx("div", {
|
|
22
|
+
className: "merchi-collapse ".concat(isOpen ? 'show' : ''),
|
|
23
|
+
ref: ref,
|
|
24
|
+
style: {
|
|
25
|
+
transition: 'height 0.35s ease',
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
height: height
|
|
28
|
+
},
|
|
29
|
+
children: children
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export default Collapse;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
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); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
14
|
+
import { MerchiProductFormSdkExternals } from './product-form-sdk-externals';
|
|
15
|
+
import { loadFormBundle, publishedFormBundle } from '../utilities/customForm';
|
|
16
|
+
import { LoadingTemplateSm } from './LoadingTemplate';
|
|
17
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
+
/**
|
|
19
|
+
* Loads a product's published custom form for cart-item edit. On any failure
|
|
20
|
+
* renders `fallback` (the default @merchi/product-form) so the cart stays usable.
|
|
21
|
+
*/
|
|
22
|
+
export function CustomCartProductForm(_ref) {
|
|
23
|
+
var _publishedFormBundle$, _publishedFormBundle;
|
|
24
|
+
var product = _ref.product,
|
|
25
|
+
initialJob = _ref.initialJob,
|
|
26
|
+
apiUrl = _ref.apiUrl,
|
|
27
|
+
onSave = _ref.onSave,
|
|
28
|
+
fallback = _ref.fallback,
|
|
29
|
+
onActiveChange = _ref.onActiveChange;
|
|
30
|
+
var _useState = useState(null),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
Loaded = _useState2[0],
|
|
33
|
+
setLoaded = _useState2[1];
|
|
34
|
+
var _useState3 = useState(false),
|
|
35
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
|
+
failed = _useState4[0],
|
|
37
|
+
setFailed = _useState4[1];
|
|
38
|
+
var _useState5 = useState(true),
|
|
39
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
40
|
+
loading = _useState6[0],
|
|
41
|
+
setLoading = _useState6[1];
|
|
42
|
+
var onSaveRef = useRef(onSave);
|
|
43
|
+
onSaveRef.current = onSave;
|
|
44
|
+
var onActiveChangeRef = useRef(onActiveChange);
|
|
45
|
+
onActiveChangeRef.current = onActiveChange;
|
|
46
|
+
var bundleKey = (_publishedFormBundle$ = (_publishedFormBundle = publishedFormBundle(product)) === null || _publishedFormBundle === void 0 ? void 0 : _publishedFormBundle.url) !== null && _publishedFormBundle$ !== void 0 ? _publishedFormBundle$ : '';
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
var active = true;
|
|
49
|
+
setLoaded(null);
|
|
50
|
+
setFailed(false);
|
|
51
|
+
setLoading(true);
|
|
52
|
+
var bundle = publishedFormBundle(product);
|
|
53
|
+
if (!bundle) {
|
|
54
|
+
setFailed(true);
|
|
55
|
+
setLoading(false);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
var w = window;
|
|
59
|
+
w.React = React;
|
|
60
|
+
w.MerchiProductFormSdk = MerchiProductFormSdkExternals;
|
|
61
|
+
loadFormBundle(bundle).then(function (Component) {
|
|
62
|
+
if (active) {
|
|
63
|
+
setLoaded(function () {
|
|
64
|
+
return Component;
|
|
65
|
+
});
|
|
66
|
+
setLoading(false);
|
|
67
|
+
}
|
|
68
|
+
})["catch"](function (e) {
|
|
69
|
+
console.error('[merchi_cart] custom form load failed', e);
|
|
70
|
+
if (active) {
|
|
71
|
+
setFailed(true);
|
|
72
|
+
setLoading(false);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return function () {
|
|
76
|
+
active = false;
|
|
77
|
+
};
|
|
78
|
+
}, [product, bundleKey]);
|
|
79
|
+
var props = useMemo(function () {
|
|
80
|
+
try {
|
|
81
|
+
var runtime = MerchiProductFormSdkExternals.createProductFormRuntime({
|
|
82
|
+
apiUrl: apiUrl || '',
|
|
83
|
+
product: product,
|
|
84
|
+
onAddToCart: function onAddToCart(job) {
|
|
85
|
+
var _onSaveRef$current;
|
|
86
|
+
return (_onSaveRef$current = onSaveRef.current) === null || _onSaveRef$current === void 0 ? void 0 : _onSaveRef$current.call(onSaveRef, job);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
product: product,
|
|
91
|
+
pricing: runtime.pricing,
|
|
92
|
+
actions: runtime.actions,
|
|
93
|
+
helpers: runtime.helpers
|
|
94
|
+
};
|
|
95
|
+
} catch (e) {
|
|
96
|
+
console.error('[merchi_cart] custom form props build failed', e);
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}, [product, apiUrl]);
|
|
100
|
+
var isActive = !failed && !loading && !!Loaded && !!props;
|
|
101
|
+
useEffect(function () {
|
|
102
|
+
var _onActiveChangeRef$cu;
|
|
103
|
+
(_onActiveChangeRef$cu = onActiveChangeRef.current) === null || _onActiveChangeRef$cu === void 0 || _onActiveChangeRef$cu.call(onActiveChangeRef, isActive);
|
|
104
|
+
return function () {
|
|
105
|
+
var _onActiveChangeRef$cu2;
|
|
106
|
+
return (_onActiveChangeRef$cu2 = onActiveChangeRef.current) === null || _onActiveChangeRef$cu2 === void 0 ? void 0 : _onActiveChangeRef$cu2.call(onActiveChangeRef, false);
|
|
107
|
+
};
|
|
108
|
+
}, [isActive]);
|
|
109
|
+
if (loading) return /*#__PURE__*/_jsx(LoadingTemplateSm, {});
|
|
110
|
+
if (failed || !Loaded || !props) return /*#__PURE__*/_jsx(_Fragment, {
|
|
111
|
+
children: fallback
|
|
112
|
+
});
|
|
113
|
+
var Shell = MerchiProductFormSdkExternals.ProductFormShell;
|
|
114
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
115
|
+
children: Shell ? /*#__PURE__*/_jsx(Shell, {
|
|
116
|
+
product: props.product,
|
|
117
|
+
pricing: props.pricing,
|
|
118
|
+
actions: props.actions,
|
|
119
|
+
helpers: props.helpers,
|
|
120
|
+
initialJob: initialJob,
|
|
121
|
+
actionLabels: {
|
|
122
|
+
addToCart: 'Save'
|
|
123
|
+
},
|
|
124
|
+
children: /*#__PURE__*/_jsx(Loaded, _objectSpread({}, props))
|
|
125
|
+
}) : /*#__PURE__*/_jsx(Loaded, _objectSpread({}, props))
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export default CustomCartProductForm;
|