merchi_cart 1.3.10 → 1.3.11
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 -21
- package/README.md +134 -134
- package/esm/components/CustomCartProductForm.js +3 -3
- package/esm/components/CustomerCheckoutMethodTabs.js +96 -0
- package/esm/components/index.js +2 -1
- package/esm/components/product-form-sdk-externals.js +3 -3
- package/esm/forms/index.js +2 -1
- package/esm/panels/PanelClientCheckout.js +8 -30
- package/esm/square/SquareCard.js +9 -9
- package/esm/styles/globals.css +102 -2
- package/esm/styles/globals.css.map +1 -1
- package/esm/utilities/area.js +15 -15
- package/esm/utilities/currency.js +7 -7
- package/esm/utilities/customForm.js +4 -4
- package/lib/components/CustomCartProductForm.js +3 -3
- package/lib/components/CustomerCheckoutMethodTabs.js +104 -0
- package/lib/components/index.js +7 -0
- package/lib/components/product-form-sdk-externals.js +3 -3
- package/lib/forms/index.js +7 -0
- package/lib/panels/PanelClientCheckout.js +6 -28
- package/lib/square/SquareCard.js +9 -9
- package/lib/styles/globals.css +102 -2
- package/lib/styles/globals.css.map +1 -1
- package/lib/utilities/area.js +15 -15
- package/lib/utilities/currency.js +7 -7
- package/lib/utilities/customForm.js +4 -4
- package/package.json +104 -104
- package/src/Cart.tsx +96 -96
- package/src/CartAlert.tsx +35 -35
- package/src/CartHeader.tsx +28 -28
- package/src/CartProvider.tsx +998 -998
- package/src/CartTotals.tsx +102 -102
- package/src/buttons/Button.tsx +35 -35
- package/src/buttons/ButtonBack.tsx +42 -42
- package/src/buttons/ButtonClearCart.tsx +17 -17
- package/src/buttons/ButtonInvoiceDownload.tsx +60 -60
- package/src/buttons/ButtonNext.tsx +35 -35
- package/src/buttons/ButtonNextDynamic.tsx +31 -31
- package/src/buttons/ButtonOpenCartMerchiCartModal.tsx +61 -61
- package/src/buttons/ButtonPay.tsx +32 -32
- package/src/buttons/ButtonShipmentTabNext.tsx +24 -24
- package/src/buttons/index.ts +15 -15
- package/src/components/Alert.tsx +31 -31
- package/src/components/CartBody.tsx +16 -16
- package/src/components/CartClient.tsx +52 -52
- package/src/components/CartFooter.tsx +15 -15
- package/src/components/CartItemRow.tsx +212 -212
- package/src/components/CartPaymentSettingsInvalid.tsx +12 -12
- package/src/components/CartShipment.tsx +56 -56
- package/src/components/CartTabContent.tsx +15 -15
- package/src/components/CartTabPanel.tsx +25 -25
- package/src/components/CartTableContainer.tsx +15 -15
- package/src/components/CartTitle.tsx +22 -22
- package/src/components/CartTotalsListGroup.tsx +58 -58
- package/src/components/Collapse.tsx +23 -23
- package/src/components/CustomCartProductForm.tsx +123 -123
- package/src/components/CustomerCheckoutMethodTabs.tsx +106 -0
- package/src/components/DiscountInputGroup.tsx +160 -160
- package/src/components/LoadingTemplate.tsx +22 -22
- package/src/components/NoCartItems.tsx +20 -20
- package/src/components/ShipmentGroupCard.tsx +170 -170
- package/src/components/Table.tsx +15 -15
- package/src/components/containers.tsx +40 -40
- package/src/components/index.ts +38 -36
- package/src/components/product-form-sdk-externals.ts +67 -67
- package/src/forms/FormNewCustomer.tsx +170 -170
- package/src/forms/FormReturningCustomer.tsx +117 -117
- package/src/forms/FormShipmentAddressAndNotes.tsx +165 -165
- package/src/forms/FormSquarePayment.tsx +19 -19
- package/src/forms/FormStripePayment.tsx +19 -19
- package/src/forms/FormWhatsappCustomer.tsx +179 -179
- package/src/forms/InputAcceptUserTermsAndConditions.tsx +43 -43
- package/src/forms/InputError.tsx +23 -23
- package/src/forms/InputSelect.tsx +58 -58
- package/src/forms/InputText.tsx +56 -56
- package/src/forms/InputsAddress.tsx +205 -205
- package/src/forms/index.ts +18 -16
- package/src/index.ts +31 -31
- package/src/modals.tsx +65 -65
- package/src/panels/PanelCartItems.tsx +56 -56
- package/src/panels/PanelCartShipment.tsx +86 -86
- package/src/panels/PanelClearCart.tsx +50 -50
- package/src/panels/PanelClientCheckout.tsx +102 -130
- package/src/panels/PanelEditCartItem.tsx +172 -172
- package/src/panels/PanelPaymentSuccess.tsx +66 -66
- package/src/panels/index.ts +15 -15
- package/src/square/SquareCard.tsx +84 -84
- package/src/stripe/StripeCardFields.tsx +173 -173
- package/src/stripe/StripeCardForm.tsx +91 -91
- package/src/stripe/StripePaymentButtons.tsx +117 -117
- package/src/stripe/actions.ts +94 -94
- package/src/stripe/utils.ts +22 -22
- package/src/styles/globals.scss +433 -307
- package/src/tabs/CartNav.tsx +18 -18
- package/src/tabs/NavTab.tsx +36 -36
- package/src/types/assets.d.ts +4 -4
- package/src/types/index.ts +15 -15
- package/src/types/merchi_product_form/index.d.ts +1 -1
- package/src/types/merchi_sdk_ts/index.d.ts +1 -1
- package/src/types/react-geosuggest/index.d.ts +1 -1
- package/src/utilities/address.ts +364 -364
- package/src/utilities/area.ts +359 -359
- package/src/utilities/cart.ts +80 -80
- package/src/utilities/company.ts +8 -8
- package/src/utilities/cookie.ts +58 -58
- package/src/utilities/currency.ts +216 -216
- package/src/utilities/customForm.ts +71 -71
- package/src/utilities/helpers.ts +213 -213
- package/src/utilities/index.ts +14 -14
- package/src/utilities/invoice.ts +60 -60
- package/src/utilities/job.ts +13 -13
- package/src/utilities/local_storage.ts +130 -130
- package/src/utilities/product.ts +14 -14
- package/src/utilities/shipment.ts +11 -11
- package/src/utilities/tabs.ts +38 -38
- package/src/utilities/user.ts +33 -33
- package/src/utilities/variations.ts +80 -80
- package/esm/components/title.js +0 -28
- package/esm/slices/sliceCart.js +0 -193
- package/esm/slices/sliceCartAlert.js +0 -43
- package/esm/slices/sliceCartItem.js +0 -30
- package/esm/slices/sliceCartPayment.js +0 -47
- package/esm/slices/sliceCartShipment.js +0 -72
- package/esm/slices/sliceFormReturningCustomer.js +0 -24
- package/esm/slices/sliceNewCustomerForm.js +0 -23
- package/esm/square/actions.js +0 -53
- package/esm/square/slices/reducersSquare.js +0 -8
- package/esm/square/slices/sliceSquareAlerts.js +0 -34
- package/esm/square/slices/sliceSquareForm.js +0 -30
- package/esm/store.js +0 -1007
- package/esm/stripe/slices/sliceStripeAlerts.js +0 -34
- package/esm/stripe/slices/sliceStripeCardForm.js +0 -8
- package/esm/stripe/slices/sliceStripeForm.js +0 -57
- package/lib/components/title.js +0 -36
- package/lib/slices/sliceCart.js +0 -200
- package/lib/slices/sliceCartAlert.js +0 -49
- package/lib/slices/sliceCartItem.js +0 -36
- package/lib/slices/sliceCartPayment.js +0 -53
- package/lib/slices/sliceCartShipment.js +0 -78
- package/lib/slices/sliceFormReturningCustomer.js +0 -30
- package/lib/slices/sliceNewCustomerForm.js +0 -29
- package/lib/square/actions.js +0 -61
- package/lib/square/slices/reducersSquare.js +0 -15
- package/lib/square/slices/sliceSquareAlerts.js +0 -40
- package/lib/square/slices/sliceSquareForm.js +0 -36
- package/lib/store.js +0 -1027
- package/lib/stripe/slices/sliceStripeAlerts.js +0 -40
- package/lib/stripe/slices/sliceStripeCardForm.js +0 -15
- package/lib/stripe/slices/sliceStripeForm.js +0 -63
- package/src/styles/globals.css +0 -319
- package/src/styles/globals.css.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Merchi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Merchi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
# merchi_cart
|
|
2
|
-
Merchi's cart
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
- [Installation](#installation)
|
|
8
|
-
- [Usage](#usage)
|
|
9
|
-
- [Props](#props)
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install merchi_cart
|
|
15
|
-
|
|
16
|
-
or
|
|
17
|
-
|
|
18
|
-
yarn add merchi_cart
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Usage
|
|
22
|
-
context functions:
|
|
23
|
-
|
|
24
|
-
components:
|
|
25
|
-
ButtonOpenCart
|
|
26
|
-
ButtonListWrappedOpenCart
|
|
27
|
-
MerchiCart
|
|
28
|
-
MerchiCartModal
|
|
29
|
-
MerchiShoppingCartModal
|
|
30
|
-
|
|
31
|
-
context functions:
|
|
32
|
-
setCartComplete - Resets the cart
|
|
33
|
-
refetchCart - refetches the cart
|
|
34
|
-
createCartAndCookie - clears and resets the cart with a new cookie
|
|
35
|
-
getCartShipmentOptions - refetches the cart shipment options
|
|
36
|
-
|
|
37
|
-
window functions:
|
|
38
|
-
addCartItem - takes job json and creates a cart item
|
|
39
|
-
getCart - fetches the cart
|
|
40
|
-
getMerchiCartValues - retruns the following:
|
|
41
|
-
cart
|
|
42
|
-
cartItemsCount
|
|
43
|
-
currency
|
|
44
|
-
subtotalCost
|
|
45
|
-
taxAmount
|
|
46
|
-
totalCost
|
|
47
|
-
isMerchiCartFetching - checks the fetching state of the cart
|
|
48
|
-
setCartComplete - Resets the cart
|
|
49
|
-
toggleCartOpen - open close cart modal
|
|
50
|
-
refetchCart - refetches the cart
|
|
51
|
-
createCartAndCookie = clears and resets the cart with a new cookie
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
### Props
|
|
55
|
-
|
|
56
|
-
| Name | Type | Default | Description |
|
|
57
|
-
|-----------------------------------------------|------------|-----------------------------------------------------------------------------|---------------------------------------|
|
|
58
|
-
| `cart` | `cartJson Object || undefined`| `"{}"` | `Pass in a cart to init the cart state in the provider`|
|
|
59
|
-
| `classNameAlertError` | `string?` | `"alert alert-danger"` | `Class for alert error` |
|
|
60
|
-
| `classNameAlertInfo` | `string?` | `"alert alert-info"` | `Class for alert info` |
|
|
61
|
-
| `classNameAlertSuccess` | `string?` | `"alert alert-success"` | `Class for alert success` |
|
|
62
|
-
| `classNameAlertWarning` | `string?` | `"alert alert-warning"` | `Class for alert warning` |
|
|
63
|
-
| `classNameBtn` | `string?` | `"btn"` | `Base class for button elements` |
|
|
64
|
-
| `classNameBtnBack` | `string?` | `"btn-lg btn-default pull-left"` | `Class for back button` |
|
|
65
|
-
| `classNameBtnCartClear` | `string?` | `"btn-lg btn-danger mr-auto"` | `Class for clear cart button` |
|
|
66
|
-
| `classNameBtnClose` | `string?` | `"btn-close"` | `Class for close button element` |
|
|
67
|
-
| `classNameBtnDanger` | `string?` | `"btn btn-md btn-danger"` | `Class for button danger element` |
|
|
68
|
-
| `classNameBtnDownloadInvoice` | `string?` | `"btn btn-lg btn-primary"` | `Class for button download element` |
|
|
69
|
-
| `classNameBtnLink` | `string?` | `"btn-md btn-link"` | `Class for link button elements` |
|
|
70
|
-
| `classNameBtnNext` | `string?` | `"btn-lg btn-primary"` | `Class for next button` |
|
|
71
|
-
| `classNameBtnNextComplete` | `string?` | `"btn-lg btn-success"` | `Class for next button completed` |
|
|
72
|
-
| `classNameBtnPay` | `string?` | `"btn-lg btn-primary width-full"` | `Class for pay button completed` |
|
|
73
|
-
| `classNameBtnPrimary` | `string?` | `"btn btn-md btn-primary"` | `Class for edit cart item button` |
|
|
74
|
-
| `classNameBtnEditCartItem` | `string?` | `"btn btn-md btn-primary ml-auto"` | `Class for primary button completed` |
|
|
75
|
-
| `classNameCartBody` | `string?` | `"merchi-cart-body"` | `Class for cart body container` |
|
|
76
|
-
| `classNameCartFooter` | `string?` | `"merchi-cart-footer"` | `Class for cart footer container` |
|
|
77
|
-
| `classNameCartFormGroup` | `string?` | `"form-group merchi-form-group"` | `Class for form group element` |
|
|
78
|
-
| `classNameCartFormGroupButton` | `string?` | `"merchi-form-group-button"` | `Class for form group button` |
|
|
79
|
-
| `classNameCartFormGroupCheckbox` | `string?` | `"form-check"` | `Class for form group checkbox` |
|
|
80
|
-
| `classNameCartFormInput` | `string?` | `"form-control"` | `Class for form input` |
|
|
81
|
-
| `classNameCartFormLabelCheckbox` | `string?` | `""` | `Class for form input checkbpx label` |
|
|
82
|
-
| `classNameCartFormCheckbox` | `string?` | `"form-check-input"` | `Class for form input checkbpx` |
|
|
83
|
-
| `classNameCartHeader` | `string?` | `"merchi-cart-header"` | `Class for cart header container` |
|
|
84
|
-
| `classNameCartInputError` | `string?` | `"text-danger"` | `Class for form error` |
|
|
85
|
-
| `classNameCartNav` | `string?` | `"nav merchi-nav-tabs merchi-nav merchi-nav-fill merchi-nav-pills"` | `Class for cart nav` |
|
|
86
|
-
| `classNameNoItems` | `string?` | `"merchi-no-cart-items"` | `Class for no items in cart` |
|
|
87
|
-
| `classNameCartGoogleSuggestList` | `string?` | `"list-group m-b-0"` | `Class for google suggest list` |
|
|
88
|
-
| `classNameCartGoogleSuggestListItem` | `string?` | `"list-group-item cursor-pointer"` | `Class for google suggest list item` |
|
|
89
|
-
| `classNameCartItemFeatureImage` | `string?` | `"img-rounded m-10"` | `Class for cart item feature image` |
|
|
90
|
-
| `classNameCartItemInfo` | `string?` | `"text-muted font-weight-normal font-italic"` | `Class for cart item info element` |
|
|
91
|
-
| `classNameCartItemInfoCell` | `string?` | `"border-0 align-middle"` | `Class for cart item cell` |
|
|
92
|
-
| `classNameCartItemInfoCellRight` | `string?` | `"border-0 align-middle text-right"` | `Class for cart item cell right align`|
|
|
93
|
-
| `classNameCartItemInfoContainer` | `string?` | `"ml-3 d-inline-block align-middle"` | `Class for cart item info container` |
|
|
94
|
-
| `classNameCartRow` | `string?` | `"merchi-row"` | `Class for row element` |
|
|
95
|
-
| `classNameCartRowColumn` | `string?` | `"merchi-column"` | `Class for row column element` |
|
|
96
|
-
| `classNameTableContainer` | `string?` | `"table-responsive"` | `Class for cart table container` |
|
|
97
|
-
| `classNameCartTab` | `string?` | `"merchi-tab-content"` | `Class for cart tab container` |
|
|
98
|
-
| `classNameCartTabItem` | `string?` | `"nav-item merchi-nav-item"` | `Class for cart tab item` |
|
|
99
|
-
| `classNameCartTabItemLink` | `string?` | `"merchi-nav-link"` | `Class for cart tab item link |`
|
|
100
|
-
| `classNameCartTitle` | `string?` | `"merchi-cart-title"` | `Class for cart Title container` |
|
|
101
|
-
| `classNameCartTotalContainer` | `string?` | `"merchi-cart-total-container"` | `Class for totals container elements` |
|
|
102
|
-
| `classNameCartToggleIconButton` | `string?` | `"cart-icon-button-class"` | `Class for toggle modal button` |
|
|
103
|
-
| `classNameCartTotalItem` | `string?` | `"merchi-cart-total-item"` | `Class for totals item elements` |
|
|
104
|
-
| `classNameCartTotalItemPrice` | `string?` | `"merchi-cart-total-item-price"` | `Class for totals item price elements`|
|
|
105
|
-
| `classNameClearCartContainer` | `string?` | `"merchi-cart-clear-container"` | `Class cart clear container` |
|
|
106
|
-
| `classNameClearCartText` | `string?` | `"merchi-cart-clear-text"` | `Class cart clear text container` |
|
|
107
|
-
| `classNameListClientInfo` | `string?` | `"merchi-cart-client-info-list"` | `Class for client info list` |
|
|
108
|
-
| `classNameListContainer` | `string?` | `"pb-2"` | `Class for list conatiner element` |
|
|
109
|
-
| `classNameCartTotaListContainer` | `string?` | `"merchi-cart-total-list-container"` | `Class for list conatiner for cart totlas element`|
|
|
110
|
-
| `classNameListItem` | `string?` | `"list-group-item"` | `Class for list item elements` |
|
|
111
|
-
| `classNameListItemCartTotals` | `string?` | `"list-group-item d-flex justify-content-between align-items-center"` | `Class for list item cart totals elements`|
|
|
112
|
-
| `classNameList` | `string?` | `"list-group"` | `Class for list elements` |
|
|
113
|
-
| `classNameListInline` | `string?` | `"list-inline"` | `Class for list inline elements` |
|
|
114
|
-
| `classNameListUnstyles` | `string?` | `"list-unstyled"` | `Class for list unstyled elements` |
|
|
115
|
-
| `classNameLoadingTemplate` | `string?` | `"merchi-loading-template"` | `Class for loading elements` |
|
|
116
|
-
| `classNameLoadingTemplateContainer` | `string?` | `"merchi-loading-template-container"` | `Class for loading container elements`|
|
|
117
|
-
| `classNameShipmentOption` | `string?` | `"merchi-shipment-option"` | `Class for shipment option element` |
|
|
118
|
-
| `classNameTable` | `string?` | `"table"` | `Class for table elements` |
|
|
119
|
-
| `classNameVariationsList` | `string?` | `"list-unstyled list-inline"` | `Class for variation info` |
|
|
120
|
-
| `customSuccessMessage` | `string?` | `undefined` | `A message to display on payment success` |
|
|
121
|
-
| `domainId` | `number` | `undefined` | `The merchi domain/store id for the cart` |
|
|
122
|
-
| `footer` | `ReactElement`| `undefined` | `A customer footer component` |
|
|
123
|
-
| `hideHead` | `boolean` | `false` | `hides the cart head title and close` |
|
|
124
|
-
| `includeTheme` | `boolean?` | `false` | `If true will fetch and apply the store theme to the page` |
|
|
125
|
-
| `initialiseCart` | `boolean?` | `true` | `If true will initial fetch cart and set cart function on window`|
|
|
126
|
-
| `onClickClose` | `() => void?`| `() => console.log('close merchi cart!')` | `a function to close the cart` |
|
|
127
|
-
| `setIsCartModalOpen` | `(isOpen: boolean) => void?`| `() => console.log('close merchi cart!')` | `a function to open/close cart modal wrapper`|
|
|
128
|
-
| `isCartModalOpen` | `boolean` | `false` | `a boolean value to control the cart modal open/closed`|
|
|
129
|
-
| `productFormClassNames` | `obj` | `{}` | `An object to be passsed to the merchi_product_form `|
|
|
130
|
-
| `showUserTermsAndConditions` | `boolean?` | `true` | `Display the user t&cs for Merchi` |
|
|
131
|
-
| `showCartItemInfo` | `boolean?` | `true` | `Will display the cart item info in the cart items table`|
|
|
132
|
-
| `apiUrl` | `string?` | `'https://api.merchi.co/v6/'` | `URL to connect to the Merchi API` |
|
|
133
|
-
| `urlFrontend` | `string?` | `'https://merchi.co/'` | `URL to redirect users to a frontend` |
|
|
134
|
-
| `urlTrackingPage` | `string?` | `undefined` | `URL used on the thankyou page for tracking`|
|
|
1
|
+
# merchi_cart
|
|
2
|
+
Merchi's cart
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Usage](#usage)
|
|
9
|
+
- [Props](#props)
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install merchi_cart
|
|
15
|
+
|
|
16
|
+
or
|
|
17
|
+
|
|
18
|
+
yarn add merchi_cart
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Usage
|
|
22
|
+
context functions:
|
|
23
|
+
|
|
24
|
+
components:
|
|
25
|
+
ButtonOpenCart
|
|
26
|
+
ButtonListWrappedOpenCart
|
|
27
|
+
MerchiCart
|
|
28
|
+
MerchiCartModal
|
|
29
|
+
MerchiShoppingCartModal
|
|
30
|
+
|
|
31
|
+
context functions:
|
|
32
|
+
setCartComplete - Resets the cart
|
|
33
|
+
refetchCart - refetches the cart
|
|
34
|
+
createCartAndCookie - clears and resets the cart with a new cookie
|
|
35
|
+
getCartShipmentOptions - refetches the cart shipment options
|
|
36
|
+
|
|
37
|
+
window functions:
|
|
38
|
+
addCartItem - takes job json and creates a cart item
|
|
39
|
+
getCart - fetches the cart
|
|
40
|
+
getMerchiCartValues - retruns the following:
|
|
41
|
+
cart
|
|
42
|
+
cartItemsCount
|
|
43
|
+
currency
|
|
44
|
+
subtotalCost
|
|
45
|
+
taxAmount
|
|
46
|
+
totalCost
|
|
47
|
+
isMerchiCartFetching - checks the fetching state of the cart
|
|
48
|
+
setCartComplete - Resets the cart
|
|
49
|
+
toggleCartOpen - open close cart modal
|
|
50
|
+
refetchCart - refetches the cart
|
|
51
|
+
createCartAndCookie = clears and resets the cart with a new cookie
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Props
|
|
55
|
+
|
|
56
|
+
| Name | Type | Default | Description |
|
|
57
|
+
|-----------------------------------------------|------------|-----------------------------------------------------------------------------|---------------------------------------|
|
|
58
|
+
| `cart` | `cartJson Object || undefined`| `"{}"` | `Pass in a cart to init the cart state in the provider`|
|
|
59
|
+
| `classNameAlertError` | `string?` | `"alert alert-danger"` | `Class for alert error` |
|
|
60
|
+
| `classNameAlertInfo` | `string?` | `"alert alert-info"` | `Class for alert info` |
|
|
61
|
+
| `classNameAlertSuccess` | `string?` | `"alert alert-success"` | `Class for alert success` |
|
|
62
|
+
| `classNameAlertWarning` | `string?` | `"alert alert-warning"` | `Class for alert warning` |
|
|
63
|
+
| `classNameBtn` | `string?` | `"btn"` | `Base class for button elements` |
|
|
64
|
+
| `classNameBtnBack` | `string?` | `"btn-lg btn-default pull-left"` | `Class for back button` |
|
|
65
|
+
| `classNameBtnCartClear` | `string?` | `"btn-lg btn-danger mr-auto"` | `Class for clear cart button` |
|
|
66
|
+
| `classNameBtnClose` | `string?` | `"btn-close"` | `Class for close button element` |
|
|
67
|
+
| `classNameBtnDanger` | `string?` | `"btn btn-md btn-danger"` | `Class for button danger element` |
|
|
68
|
+
| `classNameBtnDownloadInvoice` | `string?` | `"btn btn-lg btn-primary"` | `Class for button download element` |
|
|
69
|
+
| `classNameBtnLink` | `string?` | `"btn-md btn-link"` | `Class for link button elements` |
|
|
70
|
+
| `classNameBtnNext` | `string?` | `"btn-lg btn-primary"` | `Class for next button` |
|
|
71
|
+
| `classNameBtnNextComplete` | `string?` | `"btn-lg btn-success"` | `Class for next button completed` |
|
|
72
|
+
| `classNameBtnPay` | `string?` | `"btn-lg btn-primary width-full"` | `Class for pay button completed` |
|
|
73
|
+
| `classNameBtnPrimary` | `string?` | `"btn btn-md btn-primary"` | `Class for edit cart item button` |
|
|
74
|
+
| `classNameBtnEditCartItem` | `string?` | `"btn btn-md btn-primary ml-auto"` | `Class for primary button completed` |
|
|
75
|
+
| `classNameCartBody` | `string?` | `"merchi-cart-body"` | `Class for cart body container` |
|
|
76
|
+
| `classNameCartFooter` | `string?` | `"merchi-cart-footer"` | `Class for cart footer container` |
|
|
77
|
+
| `classNameCartFormGroup` | `string?` | `"form-group merchi-form-group"` | `Class for form group element` |
|
|
78
|
+
| `classNameCartFormGroupButton` | `string?` | `"merchi-form-group-button"` | `Class for form group button` |
|
|
79
|
+
| `classNameCartFormGroupCheckbox` | `string?` | `"form-check"` | `Class for form group checkbox` |
|
|
80
|
+
| `classNameCartFormInput` | `string?` | `"form-control"` | `Class for form input` |
|
|
81
|
+
| `classNameCartFormLabelCheckbox` | `string?` | `""` | `Class for form input checkbpx label` |
|
|
82
|
+
| `classNameCartFormCheckbox` | `string?` | `"form-check-input"` | `Class for form input checkbpx` |
|
|
83
|
+
| `classNameCartHeader` | `string?` | `"merchi-cart-header"` | `Class for cart header container` |
|
|
84
|
+
| `classNameCartInputError` | `string?` | `"text-danger"` | `Class for form error` |
|
|
85
|
+
| `classNameCartNav` | `string?` | `"nav merchi-nav-tabs merchi-nav merchi-nav-fill merchi-nav-pills"` | `Class for cart nav` |
|
|
86
|
+
| `classNameNoItems` | `string?` | `"merchi-no-cart-items"` | `Class for no items in cart` |
|
|
87
|
+
| `classNameCartGoogleSuggestList` | `string?` | `"list-group m-b-0"` | `Class for google suggest list` |
|
|
88
|
+
| `classNameCartGoogleSuggestListItem` | `string?` | `"list-group-item cursor-pointer"` | `Class for google suggest list item` |
|
|
89
|
+
| `classNameCartItemFeatureImage` | `string?` | `"img-rounded m-10"` | `Class for cart item feature image` |
|
|
90
|
+
| `classNameCartItemInfo` | `string?` | `"text-muted font-weight-normal font-italic"` | `Class for cart item info element` |
|
|
91
|
+
| `classNameCartItemInfoCell` | `string?` | `"border-0 align-middle"` | `Class for cart item cell` |
|
|
92
|
+
| `classNameCartItemInfoCellRight` | `string?` | `"border-0 align-middle text-right"` | `Class for cart item cell right align`|
|
|
93
|
+
| `classNameCartItemInfoContainer` | `string?` | `"ml-3 d-inline-block align-middle"` | `Class for cart item info container` |
|
|
94
|
+
| `classNameCartRow` | `string?` | `"merchi-row"` | `Class for row element` |
|
|
95
|
+
| `classNameCartRowColumn` | `string?` | `"merchi-column"` | `Class for row column element` |
|
|
96
|
+
| `classNameTableContainer` | `string?` | `"table-responsive"` | `Class for cart table container` |
|
|
97
|
+
| `classNameCartTab` | `string?` | `"merchi-tab-content"` | `Class for cart tab container` |
|
|
98
|
+
| `classNameCartTabItem` | `string?` | `"nav-item merchi-nav-item"` | `Class for cart tab item` |
|
|
99
|
+
| `classNameCartTabItemLink` | `string?` | `"merchi-nav-link"` | `Class for cart tab item link |`
|
|
100
|
+
| `classNameCartTitle` | `string?` | `"merchi-cart-title"` | `Class for cart Title container` |
|
|
101
|
+
| `classNameCartTotalContainer` | `string?` | `"merchi-cart-total-container"` | `Class for totals container elements` |
|
|
102
|
+
| `classNameCartToggleIconButton` | `string?` | `"cart-icon-button-class"` | `Class for toggle modal button` |
|
|
103
|
+
| `classNameCartTotalItem` | `string?` | `"merchi-cart-total-item"` | `Class for totals item elements` |
|
|
104
|
+
| `classNameCartTotalItemPrice` | `string?` | `"merchi-cart-total-item-price"` | `Class for totals item price elements`|
|
|
105
|
+
| `classNameClearCartContainer` | `string?` | `"merchi-cart-clear-container"` | `Class cart clear container` |
|
|
106
|
+
| `classNameClearCartText` | `string?` | `"merchi-cart-clear-text"` | `Class cart clear text container` |
|
|
107
|
+
| `classNameListClientInfo` | `string?` | `"merchi-cart-client-info-list"` | `Class for client info list` |
|
|
108
|
+
| `classNameListContainer` | `string?` | `"pb-2"` | `Class for list conatiner element` |
|
|
109
|
+
| `classNameCartTotaListContainer` | `string?` | `"merchi-cart-total-list-container"` | `Class for list conatiner for cart totlas element`|
|
|
110
|
+
| `classNameListItem` | `string?` | `"list-group-item"` | `Class for list item elements` |
|
|
111
|
+
| `classNameListItemCartTotals` | `string?` | `"list-group-item d-flex justify-content-between align-items-center"` | `Class for list item cart totals elements`|
|
|
112
|
+
| `classNameList` | `string?` | `"list-group"` | `Class for list elements` |
|
|
113
|
+
| `classNameListInline` | `string?` | `"list-inline"` | `Class for list inline elements` |
|
|
114
|
+
| `classNameListUnstyles` | `string?` | `"list-unstyled"` | `Class for list unstyled elements` |
|
|
115
|
+
| `classNameLoadingTemplate` | `string?` | `"merchi-loading-template"` | `Class for loading elements` |
|
|
116
|
+
| `classNameLoadingTemplateContainer` | `string?` | `"merchi-loading-template-container"` | `Class for loading container elements`|
|
|
117
|
+
| `classNameShipmentOption` | `string?` | `"merchi-shipment-option"` | `Class for shipment option element` |
|
|
118
|
+
| `classNameTable` | `string?` | `"table"` | `Class for table elements` |
|
|
119
|
+
| `classNameVariationsList` | `string?` | `"list-unstyled list-inline"` | `Class for variation info` |
|
|
120
|
+
| `customSuccessMessage` | `string?` | `undefined` | `A message to display on payment success` |
|
|
121
|
+
| `domainId` | `number` | `undefined` | `The merchi domain/store id for the cart` |
|
|
122
|
+
| `footer` | `ReactElement`| `undefined` | `A customer footer component` |
|
|
123
|
+
| `hideHead` | `boolean` | `false` | `hides the cart head title and close` |
|
|
124
|
+
| `includeTheme` | `boolean?` | `false` | `If true will fetch and apply the store theme to the page` |
|
|
125
|
+
| `initialiseCart` | `boolean?` | `true` | `If true will initial fetch cart and set cart function on window`|
|
|
126
|
+
| `onClickClose` | `() => void?`| `() => console.log('close merchi cart!')` | `a function to close the cart` |
|
|
127
|
+
| `setIsCartModalOpen` | `(isOpen: boolean) => void?`| `() => console.log('close merchi cart!')` | `a function to open/close cart modal wrapper`|
|
|
128
|
+
| `isCartModalOpen` | `boolean` | `false` | `a boolean value to control the cart modal open/closed`|
|
|
129
|
+
| `productFormClassNames` | `obj` | `{}` | `An object to be passsed to the merchi_product_form `|
|
|
130
|
+
| `showUserTermsAndConditions` | `boolean?` | `true` | `Display the user t&cs for Merchi` |
|
|
131
|
+
| `showCartItemInfo` | `boolean?` | `true` | `Will display the cart item info in the cart items table`|
|
|
132
|
+
| `apiUrl` | `string?` | `'https://api.merchi.co/v6/'` | `URL to connect to the Merchi API` |
|
|
133
|
+
| `urlFrontend` | `string?` | `'https://merchi.co/'` | `URL to redirect users to a frontend` |
|
|
134
|
+
| `urlTrackingPage` | `string?` | `undefined` | `URL used on the thankyou page for tracking`|
|
|
@@ -16,9 +16,9 @@ import { loadFormBundle, publishedFormBundle } from '../utilities/customForm';
|
|
|
16
16
|
import { LoadingTemplateSm } from './LoadingTemplate';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
-
/**
|
|
20
|
-
* Loads a product's published custom form for cart-item edit. On any failure
|
|
21
|
-
* renders `fallback` (the default merchi_product_form) so the cart stays usable.
|
|
19
|
+
/**
|
|
20
|
+
* Loads a product's published custom form for cart-item edit. On any failure
|
|
21
|
+
* renders `fallback` (the default merchi_product_form) so the cart stays usable.
|
|
22
22
|
*/
|
|
23
23
|
export function CustomCartProductForm(_ref) {
|
|
24
24
|
var _publishedFormBundle$, _publishedFormBundle;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _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(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
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(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import { BiCheck, BiUser } from 'react-icons/bi';
|
|
10
|
+
import { FaWhatsapp } from 'react-icons/fa';
|
|
11
|
+
import FormNewCustomer from '../forms/FormNewCustomer';
|
|
12
|
+
import FormReturningCustomer from '../forms/FormReturningCustomer';
|
|
13
|
+
import FormWhatsappCustomer from '../forms/FormWhatsappCustomer';
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
+
function renderSectionIcon(iconType) {
|
|
18
|
+
if (iconType === 'whatsapp') {
|
|
19
|
+
return /*#__PURE__*/_jsx(FaWhatsapp, {
|
|
20
|
+
className: "merchi-customer-checkout-option__icon-svg merchi-customer-checkout-option__icon-svg--whatsapp"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/_jsx(BiUser, {
|
|
24
|
+
className: "merchi-customer-checkout-option__icon-svg"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export default function CustomerCheckoutMethodTabs(_ref) {
|
|
28
|
+
var _ref$whatsappEnabled = _ref.whatsappEnabled,
|
|
29
|
+
whatsappEnabled = _ref$whatsappEnabled === void 0 ? false : _ref$whatsappEnabled;
|
|
30
|
+
var _useState = useState(null),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
activeMethod = _useState2[0],
|
|
33
|
+
setActiveMethod = _useState2[1];
|
|
34
|
+
var sections = [{
|
|
35
|
+
id: 'returning',
|
|
36
|
+
label: 'Returning customer',
|
|
37
|
+
iconType: 'user',
|
|
38
|
+
form: /*#__PURE__*/_jsx(FormReturningCustomer, {})
|
|
39
|
+
}, {
|
|
40
|
+
id: 'new',
|
|
41
|
+
label: 'New customer',
|
|
42
|
+
iconType: 'user',
|
|
43
|
+
form: /*#__PURE__*/_jsx(FormNewCustomer, {})
|
|
44
|
+
}];
|
|
45
|
+
if (whatsappEnabled) {
|
|
46
|
+
sections.push({
|
|
47
|
+
id: 'whatsapp',
|
|
48
|
+
label: 'WhatsApp checkout',
|
|
49
|
+
iconType: 'whatsapp',
|
|
50
|
+
form: /*#__PURE__*/_jsx(FormWhatsappCustomer, {})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
54
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
55
|
+
className: "merchi-customer-checkout__heading",
|
|
56
|
+
children: "Choose a checkout option"
|
|
57
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
58
|
+
className: "merchi-customer-checkout-options",
|
|
59
|
+
role: "radiogroup",
|
|
60
|
+
"aria-label": "Choose a checkout option",
|
|
61
|
+
children: sections.map(function (section) {
|
|
62
|
+
var isSelected = activeMethod === section.id;
|
|
63
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
64
|
+
className: "merchi-customer-checkout-option".concat(isSelected ? ' is-selected' : ''),
|
|
65
|
+
children: [/*#__PURE__*/_jsxs("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
role: "radio",
|
|
68
|
+
"aria-checked": isSelected,
|
|
69
|
+
"aria-expanded": isSelected,
|
|
70
|
+
className: "merchi-customer-checkout-option__header",
|
|
71
|
+
onClick: function onClick() {
|
|
72
|
+
return setActiveMethod(section.id);
|
|
73
|
+
},
|
|
74
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
75
|
+
className: "merchi-customer-checkout-option__title",
|
|
76
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
77
|
+
className: "merchi-customer-checkout-option__icon",
|
|
78
|
+
children: renderSectionIcon(section.iconType)
|
|
79
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
80
|
+
className: "merchi-customer-checkout-option__label",
|
|
81
|
+
children: section.label
|
|
82
|
+
})]
|
|
83
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
84
|
+
className: "merchi-customer-checkout-option__checkbox",
|
|
85
|
+
"aria-hidden": true,
|
|
86
|
+
children: isSelected && /*#__PURE__*/_jsx(BiCheck, {})
|
|
87
|
+
})]
|
|
88
|
+
}), isSelected && /*#__PURE__*/_jsx("div", {
|
|
89
|
+
className: "merchi-customer-checkout-option__body",
|
|
90
|
+
children: section.form
|
|
91
|
+
})]
|
|
92
|
+
}, section.id);
|
|
93
|
+
})
|
|
94
|
+
})]
|
|
95
|
+
});
|
|
96
|
+
}
|
package/esm/components/index.js
CHANGED
|
@@ -8,10 +8,11 @@ import CartTabContent from './CartTabContent';
|
|
|
8
8
|
import CartTableContainer from './CartTableContainer';
|
|
9
9
|
import CartTabPanel from './CartTabPanel';
|
|
10
10
|
import Collapse from './Collapse';
|
|
11
|
+
import CustomerCheckoutMethodTabs from './CustomerCheckoutMethodTabs';
|
|
11
12
|
import DiscountInputGroup from './DiscountInputGroup';
|
|
12
13
|
import LoadingTemplate, { LoadingTemplateSm } from './LoadingTemplate';
|
|
13
14
|
import NoCartItems from './NoCartItems';
|
|
14
15
|
import ShipmentGroupCard from './ShipmentGroupCard';
|
|
15
16
|
import Table from './Table';
|
|
16
17
|
import Title from './CartTitle';
|
|
17
|
-
export { Alert, CartBody, CartClient, CartFooter, CartPaymentSettingsInvalid, CartShipment, CartTabContent, CartTableContainer, CartTabPanel, Collapse, DiscountInputGroup, LoadingTemplate, LoadingTemplateSm, NoCartItems, ShipmentGroupCard, Table, Title };
|
|
18
|
+
export { Alert, CartBody, CartClient, CartFooter, CartPaymentSettingsInvalid, CartShipment, CartTabContent, CartTableContainer, CartTabPanel, Collapse, CustomerCheckoutMethodTabs, DiscountInputGroup, LoadingTemplate, LoadingTemplateSm, NoCartItems, ShipmentGroupCard, Table, Title };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Full merchi_sdk_product_form runtime for window.MerchiProductFormSdk.
|
|
3
|
-
* Keep in sync with merchi_api/common/js/product_form_gate.cjs SDK_EXPORTS.
|
|
1
|
+
/**
|
|
2
|
+
* Full merchi_sdk_product_form runtime for window.MerchiProductFormSdk.
|
|
3
|
+
* Keep in sync with merchi_api/common/js/product_form_gate.cjs SDK_EXPORTS.
|
|
4
4
|
*/
|
|
5
5
|
import { SDK_VERSION, serializeJob, nonEmptyGroups, formatCurrency, urlFor, createPricing, createProductFormRuntime, productHasGroups, groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, buildProductFormJob, jobToFormState, selectionsToVariations, Section, Stack, Card, Heading, Text, Divider, Field, GroupRows, OptionQuantityGrid, ProductFormProvider, ProductFormShell, ProductFormActions, useProductForm, OPTION_FIELD_TYPES, theme } from 'merchi_sdk_product_form';
|
|
6
6
|
export var MerchiProductFormSdkExternals = {
|
package/esm/forms/index.js
CHANGED
|
@@ -4,4 +4,5 @@ import FormShipmentAddressAndNotes, { ActiveFormShipmentAddressAndNotes } from "
|
|
|
4
4
|
import FormSquarePayment from "./FormSquarePayment";
|
|
5
5
|
import FormStripePayment from "./FormStripePayment";
|
|
6
6
|
import FormWhatsappCustomer from "./FormWhatsappCustomer";
|
|
7
|
-
|
|
7
|
+
import CustomerCheckoutMethodTabs from "../components/CustomerCheckoutMethodTabs";
|
|
8
|
+
export { ActiveFormShipmentAddressAndNotes, CustomerCheckoutMethodTabs, FormCustomerNew, FormReturningCustomer, FormShipmentAddressAndNotes, FormSquarePayment, FormStripePayment, FormWhatsappCustomer };
|
|
@@ -2,13 +2,10 @@ import { tabIdCheckout } from '../utilities/tabs';
|
|
|
2
2
|
import { CheckoutContainer, InnerContainer } from '../components/containers';
|
|
3
3
|
import CartClient from '../components/CartClient';
|
|
4
4
|
import CartShipment from '../components/CartShipment';
|
|
5
|
-
import { CartBody, CartTabPanel, Title } from '../components';
|
|
6
|
-
import FormNewCustomer from '../forms/FormNewCustomer';
|
|
7
|
-
import FormReturningCustomer from '../forms/FormReturningCustomer';
|
|
8
|
-
import FormWhatsappCustomer from '../forms/FormWhatsappCustomer';
|
|
5
|
+
import { CartBody, CartTabPanel, CustomerCheckoutMethodTabs, Title } from '../components';
|
|
9
6
|
import FormSquarePayment from '../forms/FormSquarePayment';
|
|
10
7
|
import FormStripePayment from '../forms/FormStripePayment';
|
|
11
|
-
import { faCoins, faCreditCard
|
|
8
|
+
import { faCoins, faCreditCard } from '@fortawesome/free-solid-svg-icons';
|
|
12
9
|
import { useCartContext } from '../CartProvider';
|
|
13
10
|
import DiscountInputGroup from '../components/DiscountInputGroup';
|
|
14
11
|
import CartTotalsListGroup from '../components/CartTotalsListGroup';
|
|
@@ -72,32 +69,13 @@ function PanelClientCheckout() {
|
|
|
72
69
|
}), /*#__PURE__*/_jsx(FormStripePayment, {})]
|
|
73
70
|
})
|
|
74
71
|
})]
|
|
75
|
-
}) : /*#__PURE__*/
|
|
76
|
-
children:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
icon: faUserPlus,
|
|
81
|
-
title: "Checkout as new customer"
|
|
82
|
-
}), /*#__PURE__*/_jsx(FormNewCustomer, {})]
|
|
72
|
+
}) : /*#__PURE__*/_jsx(CheckoutContainer, {
|
|
73
|
+
children: /*#__PURE__*/_jsx(InnerContainer, {
|
|
74
|
+
paddingBottom: "0px",
|
|
75
|
+
children: /*#__PURE__*/_jsx(CustomerCheckoutMethodTabs, {
|
|
76
|
+
whatsappEnabled: whatsappEnabled
|
|
83
77
|
})
|
|
84
|
-
})
|
|
85
|
-
children: /*#__PURE__*/_jsxs(InnerContainer, {
|
|
86
|
-
paddingBottom: "0px",
|
|
87
|
-
children: [/*#__PURE__*/_jsx(Title, {
|
|
88
|
-
icon: faUserTag,
|
|
89
|
-
title: "Checkout as returning customer"
|
|
90
|
-
}), /*#__PURE__*/_jsx(FormReturningCustomer, {})]
|
|
91
|
-
})
|
|
92
|
-
}), whatsappEnabled && /*#__PURE__*/_jsx(CheckoutContainer, {
|
|
93
|
-
children: /*#__PURE__*/_jsxs(InnerContainer, {
|
|
94
|
-
paddingBottom: "0px",
|
|
95
|
-
children: [/*#__PURE__*/_jsx(Title, {
|
|
96
|
-
icon: faPhone,
|
|
97
|
-
title: "Checkout with WhatsApp"
|
|
98
|
-
}), /*#__PURE__*/_jsx(FormWhatsappCustomer, {})]
|
|
99
|
-
})
|
|
100
|
-
})]
|
|
78
|
+
})
|
|
101
79
|
})
|
|
102
80
|
})
|
|
103
81
|
});
|
package/esm/square/SquareCard.js
CHANGED
|
@@ -84,21 +84,21 @@ function SquareCard() {
|
|
|
84
84
|
return _actionSquarePaymentProcess.apply(this, arguments);
|
|
85
85
|
}
|
|
86
86
|
return squareWebLocationId ? /*#__PURE__*/_jsx(PaymentForm
|
|
87
|
-
/**
|
|
88
|
-
* Identifies the calling form with a verified application ID generated from
|
|
89
|
-
* the Square Application Dashboard.
|
|
87
|
+
/**
|
|
88
|
+
* Identifies the calling form with a verified application ID generated from
|
|
89
|
+
* the Square Application Dashboard.
|
|
90
90
|
*/, {
|
|
91
91
|
applicationId: SQUARE_APPLICATION_ID
|
|
92
|
-
/**
|
|
93
|
-
* Invoked when payment form receives the result of a tokenize generation
|
|
94
|
-
* request. The result will be a valid credit card or wallet token, or an error.
|
|
92
|
+
/**
|
|
93
|
+
* Invoked when payment form receives the result of a tokenize generation
|
|
94
|
+
* request. The result will be a valid credit card or wallet token, or an error.
|
|
95
95
|
*/,
|
|
96
96
|
cardTokenizeResponseReceived: function cardTokenizeResponseReceived(token, buyer) {
|
|
97
97
|
return actionSquarePaymentProcess(token.token, callbackCreditCardPaymentSuccess);
|
|
98
98
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Identifies the location of the merchant that is taking the payment.
|
|
101
|
-
* Obtained from the Square Application Dashboard - Locations tab.
|
|
99
|
+
/**
|
|
100
|
+
* Identifies the location of the merchant that is taking the payment.
|
|
101
|
+
* Obtained from the Square Application Dashboard - Locations tab.
|
|
102
102
|
*/,
|
|
103
103
|
locationId: squareWebLocationId,
|
|
104
104
|
children: /*#__PURE__*/_jsx(CreditCard, {
|