@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
package/lib/modals.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PropsCart } from './CartProvider';
|
|
3
|
+
interface Props extends PropsCart {
|
|
4
|
+
cartButtonWrappedInContainer?: boolean;
|
|
5
|
+
cartIconButtonClass?: string;
|
|
6
|
+
currentUser?: any;
|
|
7
|
+
customSuccessMessage?: string;
|
|
8
|
+
domainId?: number;
|
|
9
|
+
listContainerClass?: string;
|
|
10
|
+
listItemClass?: string;
|
|
11
|
+
showOpenCartButton?: boolean;
|
|
12
|
+
size?: string;
|
|
13
|
+
storeId?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function MerchiCartModal(props: Props): import("react").JSX.Element;
|
|
16
|
+
export declare function MerchiShoppingCartModal(props: Props): import("react").JSX.Element;
|
|
17
|
+
export {};
|
package/lib/modals.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MerchiCartModal = MerchiCartModal;
|
|
7
|
+
exports.MerchiShoppingCartModal = MerchiShoppingCartModal;
|
|
8
|
+
var _Cart = require("./Cart");
|
|
9
|
+
var _reactstrap = require("reactstrap");
|
|
10
|
+
var _ButtonOpenCartMerchiCartModal = require("./buttons/ButtonOpenCartMerchiCartModal");
|
|
11
|
+
var _CartProvider = _interopRequireWildcard(require("./CartProvider"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
+
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); }
|
|
20
|
+
function CartModal(props) {
|
|
21
|
+
var _useCartContext = (0, _CartProvider.useCartContext)(),
|
|
22
|
+
isCartModalOpen = _useCartContext.isCartModalOpen,
|
|
23
|
+
toggleCartModal = _useCartContext.toggleCartModal;
|
|
24
|
+
var _props$cartButtonWrap = props.cartButtonWrappedInContainer,
|
|
25
|
+
cartButtonWrappedInContainer = _props$cartButtonWrap === void 0 ? true : _props$cartButtonWrap,
|
|
26
|
+
footer = props.footer,
|
|
27
|
+
listContainerClass = props.listContainerClass,
|
|
28
|
+
listItemClass = props.listItemClass,
|
|
29
|
+
_props$showOpenCartBu = props.showOpenCartButton,
|
|
30
|
+
showOpenCartButton = _props$showOpenCartBu === void 0 ? true : _props$showOpenCartBu,
|
|
31
|
+
_props$size = props.size,
|
|
32
|
+
size = _props$size === void 0 ? 'xl' : _props$size;
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
34
|
+
children: [showOpenCartButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonOpenCartMerchiCartModal.ButtonListWrappedOpenCart, {
|
|
35
|
+
cartButtonWrappedInContainer: cartButtonWrappedInContainer,
|
|
36
|
+
listContainerClass: listContainerClass,
|
|
37
|
+
listItemClass: listItemClass
|
|
38
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Modal, {
|
|
39
|
+
size: size,
|
|
40
|
+
className: "m-auto",
|
|
41
|
+
isOpen: isCartModalOpen,
|
|
42
|
+
toggle: toggleCartModal,
|
|
43
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Cart.CartComponents, {
|
|
44
|
+
footer: footer
|
|
45
|
+
})
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function MerchiCartModal(props) {
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartProvider["default"], _objectSpread(_objectSpread({}, props), {}, {
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CartModal, _objectSpread({}, props))
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
function MerchiShoppingCartModal(props) {
|
|
55
|
+
var storeId = props.storeId;
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MerchiCartModal, _objectSpread(_objectSpread({}, props), {}, {
|
|
57
|
+
domainId: storeId
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _CartItemRow = _interopRequireDefault(require("../components/CartItemRow"));
|
|
8
|
+
var _tabs = require("../utilities/tabs");
|
|
9
|
+
var _components = require("../components");
|
|
10
|
+
var _CartProvider = require("../CartProvider");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
+
function PanelCartItems() {
|
|
14
|
+
var _useCartContext = (0, _CartProvider.useCartContext)(),
|
|
15
|
+
cart = _useCartContext.cart;
|
|
16
|
+
var cartItems = cart.cartItems ? cart.cartItems : [];
|
|
17
|
+
var hasItems = cartItems.length > 0;
|
|
18
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CartTabPanel, {
|
|
19
|
+
tabId: _tabs.tabIdItems,
|
|
20
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
21
|
+
children: hasItems ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CartTableContainer, {
|
|
22
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Table, {
|
|
23
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
|
|
24
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("tr", {
|
|
25
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
26
|
+
scope: "col",
|
|
27
|
+
className: "merchi-cart-item-table-head",
|
|
28
|
+
children: "Product"
|
|
29
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
30
|
+
scope: "col",
|
|
31
|
+
className: "merchi-cart-item-table-head-right",
|
|
32
|
+
children: "Quantity"
|
|
33
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
34
|
+
scope: "col",
|
|
35
|
+
className: "merchi-cart-item-table-head-right",
|
|
36
|
+
children: "Price"
|
|
37
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
38
|
+
scope: "col",
|
|
39
|
+
className: "merchi-cart-item-table-head-right",
|
|
40
|
+
children: "Actions"
|
|
41
|
+
})]
|
|
42
|
+
})
|
|
43
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
|
|
44
|
+
children: cartItems.map(function (cartItem, index) {
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartItemRow["default"], {
|
|
46
|
+
cartItem: cartItem,
|
|
47
|
+
index: index
|
|
48
|
+
}, cartItem.id);
|
|
49
|
+
})
|
|
50
|
+
})]
|
|
51
|
+
})
|
|
52
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.NoCartItems, {})
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
var _default = exports["default"] = PanelCartItems;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
8
|
+
var _FormShipmentAddressAndNotes = require("../forms/FormShipmentAddressAndNotes");
|
|
9
|
+
var _containers = require("../components/containers");
|
|
10
|
+
var _components = require("../components");
|
|
11
|
+
var _tabs = require("../utilities/tabs");
|
|
12
|
+
var _CartProvider = require("../CartProvider");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function PanelCartShipment() {
|
|
15
|
+
var _useCartContext = (0, _CartProvider.useCartContext)(),
|
|
16
|
+
cart = _useCartContext.cart,
|
|
17
|
+
fetchingShipmentGroups = _useCartContext.fetchingShipmentGroups;
|
|
18
|
+
var _cart$shipmentGroups = cart.shipmentGroups,
|
|
19
|
+
shipmentGroups = _cart$shipmentGroups === void 0 ? [] : _cart$shipmentGroups;
|
|
20
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CartTabPanel, {
|
|
21
|
+
tabId: _tabs.tabIdShipment,
|
|
22
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CartBody, {
|
|
23
|
+
style: {
|
|
24
|
+
paddingTop: '2rem'
|
|
25
|
+
},
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
27
|
+
className: "merchi-cart-tab-content",
|
|
28
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
29
|
+
textAlign: "left",
|
|
30
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.InnerContainer, {
|
|
31
|
+
width: 700,
|
|
32
|
+
paddingBottom: "3rem",
|
|
33
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormShipmentAddressAndNotes.ActiveFormShipmentAddressAndNotes, {})
|
|
34
|
+
})
|
|
35
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
36
|
+
textAlign: "center",
|
|
37
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.InnerContainer, {
|
|
38
|
+
paddingBottom: "0px",
|
|
39
|
+
width: 700,
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Title, {
|
|
41
|
+
icon: _freeSolidSvgIcons.faTruck,
|
|
42
|
+
title: shipmentGroups.length > 1 ? 'Select shipment methods' : shipmentGroups.length ? 'Select a shipment method' : ''
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
}), fetchingShipmentGroups ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
46
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_containers.InnerContainer, {
|
|
47
|
+
width: 700,
|
|
48
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.LoadingTemplateSm, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
49
|
+
children: "Fetching shipping options."
|
|
50
|
+
})]
|
|
51
|
+
})
|
|
52
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
53
|
+
textAlign: "left",
|
|
54
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_containers.InnerContainer, {
|
|
55
|
+
paddingBottom: "1rem",
|
|
56
|
+
width: 700,
|
|
57
|
+
children: [shipmentGroups.length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Alert, {
|
|
58
|
+
alertType: "warning",
|
|
59
|
+
children: "Items within this cart are warehoused in different locations and will be shipped separately. Please select how you would like your items to be shipped."
|
|
60
|
+
}), shipmentGroups.map(function (group, index) {
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ShipmentGroupCard, {
|
|
62
|
+
group: group,
|
|
63
|
+
groupIndex: index
|
|
64
|
+
}, "".concat(index, "-shipment-group"));
|
|
65
|
+
})]
|
|
66
|
+
})
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
var _default = exports["default"] = PanelCartShipment;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
8
|
+
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
9
|
+
var _tabs = require("../utilities/tabs");
|
|
10
|
+
var _buttons = require("../buttons");
|
|
11
|
+
var _components = require("../components");
|
|
12
|
+
var _CartProvider = require("../CartProvider");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function PanelClearCart() {
|
|
15
|
+
var _useCartContext = (0, _CartProvider.useCartContext)(),
|
|
16
|
+
classNameBtnDanger = _useCartContext.classNameBtnDanger,
|
|
17
|
+
classNameBtnDefault = _useCartContext.classNameBtnDefault,
|
|
18
|
+
classNameClearCartContainer = _useCartContext.classNameClearCartContainer,
|
|
19
|
+
classNameClearCartText = _useCartContext.classNameClearCartText,
|
|
20
|
+
clearCart = _useCartContext.clearCart,
|
|
21
|
+
closeClearCart = _useCartContext.closeClearCart;
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CartTabPanel, {
|
|
23
|
+
tabId: _tabs.tabIdClearCart,
|
|
24
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CartBody, {
|
|
25
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
26
|
+
style: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
minHeight: '450px'
|
|
30
|
+
},
|
|
31
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
32
|
+
className: classNameClearCartContainer,
|
|
33
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
34
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
35
|
+
icon: _freeSolidSvgIcons.faTrashAlt
|
|
36
|
+
})
|
|
37
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
38
|
+
children: "Clear Cart"
|
|
39
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
40
|
+
className: classNameClearCartText,
|
|
41
|
+
children: "Are you sure you would like to clear this cart?"
|
|
42
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
43
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_buttons.Button, {
|
|
44
|
+
className: classNameBtnDefault,
|
|
45
|
+
onClick: closeClearCart,
|
|
46
|
+
children: "Cancel"
|
|
47
|
+
})
|
|
48
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
49
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_buttons.Button, {
|
|
50
|
+
className: classNameBtnDanger,
|
|
51
|
+
onClick: function onClick() {
|
|
52
|
+
return clearCart();
|
|
53
|
+
},
|
|
54
|
+
children: "Yes, clear cart"
|
|
55
|
+
})
|
|
56
|
+
})]
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
var _default = exports["default"] = PanelClearCart;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _tabs = require("../utilities/tabs");
|
|
8
|
+
var _containers = require("../components/containers");
|
|
9
|
+
var _CartClient = _interopRequireDefault(require("../components/CartClient"));
|
|
10
|
+
var _CartShipment = _interopRequireDefault(require("../components/CartShipment"));
|
|
11
|
+
var _components = require("../components");
|
|
12
|
+
var _FormSquarePayment = _interopRequireDefault(require("../forms/FormSquarePayment"));
|
|
13
|
+
var _FormStripePayment = _interopRequireDefault(require("../forms/FormStripePayment"));
|
|
14
|
+
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
15
|
+
var _CartProvider = require("../CartProvider");
|
|
16
|
+
var _DiscountInputGroup = _interopRequireDefault(require("../components/DiscountInputGroup"));
|
|
17
|
+
var _CartTotalsListGroup = _interopRequireDefault(require("../components/CartTotalsListGroup"));
|
|
18
|
+
var _shipment = require("../utilities/shipment");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
21
|
+
function PanelClientCheckout() {
|
|
22
|
+
var _useCartContext = (0, _CartProvider.useCartContext)(),
|
|
23
|
+
cart = _useCartContext.cart,
|
|
24
|
+
cartClient = _useCartContext.cartClient,
|
|
25
|
+
showDiscountCode = _useCartContext.showDiscountCode;
|
|
26
|
+
var needsShipping = (0, _shipment.cartItemsNeedShipment)(cart);
|
|
27
|
+
var domain = cart.domain;
|
|
28
|
+
var company = domain && domain.company;
|
|
29
|
+
var whatsappEnabled = Boolean(domain === null || domain === void 0 ? void 0 : domain.enableWhatsappNotifications);
|
|
30
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CartTabPanel, {
|
|
31
|
+
tabId: _tabs.tabIdCheckout,
|
|
32
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CartBody, {
|
|
33
|
+
style: {
|
|
34
|
+
paddingTop: '2rem'
|
|
35
|
+
},
|
|
36
|
+
children: cartClient && cartClient.id > -1 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
37
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
38
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.InnerContainer, {
|
|
39
|
+
paddingBottom: "3rem",
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartClient["default"], {})
|
|
41
|
+
})
|
|
42
|
+
}), needsShipping && /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
43
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.InnerContainer, {
|
|
44
|
+
paddingBottom: "3rem",
|
|
45
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartShipment["default"], {
|
|
46
|
+
cart: cart
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
}), showDiscountCode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
50
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.InnerContainer, {
|
|
51
|
+
paddingBottom: "3rem",
|
|
52
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DiscountInputGroup["default"], {})
|
|
53
|
+
})
|
|
54
|
+
}), Boolean(company) && company.acceptSquare && /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.InnerContainer, {
|
|
56
|
+
paddingTop: "3rem",
|
|
57
|
+
paddingBottom: "3rem",
|
|
58
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormSquarePayment["default"], {})
|
|
59
|
+
})
|
|
60
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
61
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_containers.InnerContainer, {
|
|
62
|
+
paddingBottom: "3rem",
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Title, {
|
|
64
|
+
icon: _freeSolidSvgIcons.faCoins,
|
|
65
|
+
title: "Cart total"
|
|
66
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartTotalsListGroup["default"], {})]
|
|
67
|
+
})
|
|
68
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
69
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_containers.InnerContainer, {
|
|
70
|
+
paddingBottom: "3rem",
|
|
71
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Title, {
|
|
72
|
+
icon: _freeSolidSvgIcons.faCreditCard,
|
|
73
|
+
title: "Credit card payment"
|
|
74
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormStripePayment["default"], {})]
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
77
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.CheckoutContainer, {
|
|
78
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_containers.InnerContainer, {
|
|
79
|
+
paddingBottom: "0px",
|
|
80
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CustomerCheckoutMethodTabs, {
|
|
81
|
+
whatsappEnabled: whatsappEnabled
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
var _default = exports["default"] = PanelClientCheckout;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _tabs = require("../utilities/tabs");
|
|
9
|
+
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
10
|
+
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
11
|
+
var _buttons = require("../buttons");
|
|
12
|
+
var _components = require("../components");
|
|
13
|
+
var _LoadingTemplate = require("../components/LoadingTemplate");
|
|
14
|
+
var _CartProvider = require("../CartProvider");
|
|
15
|
+
var _cart = require("../utilities/cart");
|
|
16
|
+
var _cookie = require("../utilities/cookie");
|
|
17
|
+
var _customForm = require("../utilities/customForm");
|
|
18
|
+
var _CustomCartProductForm = _interopRequireDefault(require("../components/CustomCartProductForm"));
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
21
|
+
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); }
|
|
22
|
+
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 }; })(); }
|
|
23
|
+
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); }
|
|
24
|
+
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); }
|
|
25
|
+
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); }); }; }
|
|
26
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
27
|
+
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."); }
|
|
28
|
+
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; } }
|
|
29
|
+
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; }
|
|
30
|
+
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; } }
|
|
31
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
32
|
+
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; }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
35
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
36
|
+
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); }
|
|
37
|
+
var MerchiProductForm = /*#__PURE__*/(0, _react.lazy)(function () {
|
|
38
|
+
return import('@merchi/product-form');
|
|
39
|
+
});
|
|
40
|
+
function cleanVariation(variation) {
|
|
41
|
+
var _variation$variationF = variation.variationField,
|
|
42
|
+
variationField = _variation$variationF === void 0 ? {} : _variation$variationF,
|
|
43
|
+
_variation$variationF2 = variation.variationFiles,
|
|
44
|
+
variationFiles = _variation$variationF2 === void 0 ? [] : _variation$variationF2;
|
|
45
|
+
return _objectSpread(_objectSpread({}, variation), {}, {
|
|
46
|
+
id: undefined,
|
|
47
|
+
value: variation.value,
|
|
48
|
+
variationField: {
|
|
49
|
+
id: variationField.id
|
|
50
|
+
},
|
|
51
|
+
variationFiles: variationFiles.map(function (f) {
|
|
52
|
+
return {
|
|
53
|
+
id: f.id
|
|
54
|
+
};
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function cleanVariationGroups(variationsGroup) {
|
|
59
|
+
var _variationsGroup$quan = variationsGroup.quantity,
|
|
60
|
+
quantity = _variationsGroup$quan === void 0 ? 0 : _variationsGroup$quan,
|
|
61
|
+
_variationsGroup$vari = variationsGroup.variations,
|
|
62
|
+
variations = _variationsGroup$vari === void 0 ? [] : _variationsGroup$vari;
|
|
63
|
+
return {
|
|
64
|
+
idL: undefined,
|
|
65
|
+
quantity: quantity,
|
|
66
|
+
variations: variations === null || variations === void 0 ? void 0 : variations.map(cleanVariation)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function PanelEditCartItem(_ref) {
|
|
70
|
+
var _cartItem$product;
|
|
71
|
+
var cart = _ref.cart;
|
|
72
|
+
var _useCartContext = (0, _CartProvider.useCartContext)(),
|
|
73
|
+
activeTabIndex = _useCartContext.activeTabIndex,
|
|
74
|
+
alertError = _useCartContext.alertError,
|
|
75
|
+
alertSuccess = _useCartContext.alertSuccess,
|
|
76
|
+
cartItem = _useCartContext.cartItem,
|
|
77
|
+
domainId = _useCartContext.domainId,
|
|
78
|
+
productFormClassNames = _useCartContext.productFormClassNames,
|
|
79
|
+
classNameBtnEditCartItem = _useCartContext.classNameBtnEditCartItem,
|
|
80
|
+
apiUrl = _useCartContext.apiUrl,
|
|
81
|
+
refetchCart = _useCartContext.refetchCart,
|
|
82
|
+
setActiveTabIndex = _useCartContext.setActiveTabIndex,
|
|
83
|
+
setCartItem = _useCartContext.setCartItem;
|
|
84
|
+
var _useState = (0, _react.useState)(false),
|
|
85
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
86
|
+
loading = _useState2[0],
|
|
87
|
+
setLoading = _useState2[1];
|
|
88
|
+
var _useState3 = (0, _react.useState)(false),
|
|
89
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
90
|
+
customFormActive = _useState4[0],
|
|
91
|
+
setCustomFormActive = _useState4[1];
|
|
92
|
+
var formId = 'edit-cart-item-form';
|
|
93
|
+
|
|
94
|
+
// This action patches the cart item
|
|
95
|
+
function actionCartItemEdit(_x) {
|
|
96
|
+
return _actionCartItemEdit.apply(this, arguments);
|
|
97
|
+
}
|
|
98
|
+
function _actionCartItemEdit() {
|
|
99
|
+
_actionCartItemEdit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(cartItemJson) {
|
|
100
|
+
var cartToken, product, _cartItemJson$quantit, quantity, taxType, _cartItemJson$variati, variations, _cartItemJson$variati2, variationsGroups, cartItemEnt, _t;
|
|
101
|
+
return _regenerator().w(function (_context) {
|
|
102
|
+
while (1) switch (_context.p = _context.n) {
|
|
103
|
+
case 0:
|
|
104
|
+
setLoading(true);
|
|
105
|
+
_context.n = 1;
|
|
106
|
+
return (0, _cookie.getCartCookieToken)(domainId);
|
|
107
|
+
case 1:
|
|
108
|
+
cartToken = _context.v;
|
|
109
|
+
_context.p = 2;
|
|
110
|
+
product = cartItemJson.product, _cartItemJson$quantit = cartItemJson.quantity, quantity = _cartItemJson$quantit === void 0 ? 0 : _cartItemJson$quantit, taxType = cartItemJson.taxType, _cartItemJson$variati = cartItemJson.variations, variations = _cartItemJson$variati === void 0 ? [] : _cartItemJson$variati, _cartItemJson$variati2 = cartItemJson.variationsGroups, variationsGroups = _cartItemJson$variati2 === void 0 ? [] : _cartItemJson$variati2;
|
|
111
|
+
cartItemEnt = (0, _cart.makeCartItem)(_objectSpread(_objectSpread({}, cartItem), {}, {
|
|
112
|
+
id: cartItem.id,
|
|
113
|
+
cart: {
|
|
114
|
+
id: cart.id
|
|
115
|
+
},
|
|
116
|
+
product: product ? {
|
|
117
|
+
id: product.id
|
|
118
|
+
} : undefined,
|
|
119
|
+
taxType: taxType ? {
|
|
120
|
+
id: taxType.id
|
|
121
|
+
} : undefined,
|
|
122
|
+
quantity: quantity,
|
|
123
|
+
variations: variations.map(cleanVariation),
|
|
124
|
+
variationsGroups: variationsGroups.map(cleanVariationGroups)
|
|
125
|
+
}), true, cartToken); // Save changes to the Cart Item
|
|
126
|
+
_context.n = 3;
|
|
127
|
+
return cartItemEnt.save();
|
|
128
|
+
case 3:
|
|
129
|
+
_context.n = 4;
|
|
130
|
+
return refetchCart();
|
|
131
|
+
case 4:
|
|
132
|
+
// Show success alert
|
|
133
|
+
alertSuccess('Item updated.');
|
|
134
|
+
|
|
135
|
+
// Set active Cart tab
|
|
136
|
+
setActiveTabIndex(_tabs.tabIdItems);
|
|
137
|
+
|
|
138
|
+
// Clear Cart Item from state
|
|
139
|
+
setCartItem({});
|
|
140
|
+
_context.n = 6;
|
|
141
|
+
break;
|
|
142
|
+
case 5:
|
|
143
|
+
_context.p = 5;
|
|
144
|
+
_t = _context.v;
|
|
145
|
+
alertError(_t.errorMessage || _t.message || 'Unable to edit Cart Item.');
|
|
146
|
+
case 6:
|
|
147
|
+
_context.p = 6;
|
|
148
|
+
setLoading(false);
|
|
149
|
+
return _context.f(6);
|
|
150
|
+
case 7:
|
|
151
|
+
return _context.a(2);
|
|
152
|
+
}
|
|
153
|
+
}, _callee, null, [[2, 5, 6, 7]]);
|
|
154
|
+
}));
|
|
155
|
+
return _actionCartItemEdit.apply(this, arguments);
|
|
156
|
+
}
|
|
157
|
+
function onSubmit(jobJson) {
|
|
158
|
+
actionCartItemEdit(jobJson);
|
|
159
|
+
}
|
|
160
|
+
var cleanCartItem = _objectSpread(_objectSpread({}, cartItem), {}, {
|
|
161
|
+
id: undefined
|
|
162
|
+
});
|
|
163
|
+
var showForm = activeTabIndex === _tabs.tabIdItem && !!(cartItem !== null && cartItem !== void 0 && cartItem.id) && !!(cartItem !== null && cartItem !== void 0 && (_cartItem$product = cartItem.product) !== null && _cartItem$product !== void 0 && _cartItem$product.id);
|
|
164
|
+
var hasPublishedCustomForm = !!(0, _customForm.publishedFormBundle)(cartItem === null || cartItem === void 0 ? void 0 : cartItem.product);
|
|
165
|
+
var defaultForm = /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Suspense, {
|
|
166
|
+
fallback: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingTemplate.LoadingTemplateSm, {}),
|
|
167
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(MerchiProductForm, _objectSpread({
|
|
168
|
+
apiUrl: apiUrl,
|
|
169
|
+
isCartItem: true,
|
|
170
|
+
initJob: _objectSpread({}, cleanCartItem),
|
|
171
|
+
initProduct: cartItem.product,
|
|
172
|
+
onSubmit: onSubmit,
|
|
173
|
+
productFormId: formId,
|
|
174
|
+
hideRequestQuotationButton: true,
|
|
175
|
+
hidePaymentUpfrontButton: true
|
|
176
|
+
}, productFormClassNames))
|
|
177
|
+
});
|
|
178
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.CartTabPanel, {
|
|
179
|
+
tabId: _tabs.tabIdItem,
|
|
180
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CartBody, {
|
|
181
|
+
style: {
|
|
182
|
+
padding: '2rem'
|
|
183
|
+
},
|
|
184
|
+
children: showForm && (hasPublishedCustomForm ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomCartProductForm["default"], {
|
|
185
|
+
product: cartItem.product,
|
|
186
|
+
initialJob: cleanCartItem,
|
|
187
|
+
apiUrl: apiUrl,
|
|
188
|
+
onSave: onSubmit,
|
|
189
|
+
fallback: defaultForm,
|
|
190
|
+
onActiveChange: setCustomFormActive
|
|
191
|
+
}) : defaultForm)
|
|
192
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.CartFooter, {
|
|
193
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_buttons.ButtonBack, {}), !customFormActive && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_buttons.Button, {
|
|
194
|
+
className: classNameBtnEditCartItem,
|
|
195
|
+
disabled: loading,
|
|
196
|
+
form: formId,
|
|
197
|
+
type: "submit",
|
|
198
|
+
children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
199
|
+
icon: _freeSolidSvgIcons.faCircleNotch,
|
|
200
|
+
spin: true
|
|
201
|
+
}), loading ? ' Loading...' : 'Save']
|
|
202
|
+
})]
|
|
203
|
+
})]
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
var _default = exports["default"] = PanelEditCartItem;
|