merchi_cart 0.0.7-e → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/package.json +3 -4
  2. package/src/Cart.tsx +0 -100
  3. package/src/CartAlert.tsx +0 -34
  4. package/src/CartHeader.tsx +0 -27
  5. package/src/CartProvider.tsx +0 -386
  6. package/src/CartTotals.tsx +0 -106
  7. package/src/assets/merchi-monster-loader.gif +0 -0
  8. package/src/assets/merchi-swipe-outline.png +0 -0
  9. package/src/assets/product-not-found.png +0 -0
  10. package/src/buttons/Button.tsx +0 -35
  11. package/src/buttons/ButtonBack.tsx +0 -37
  12. package/src/buttons/ButtonClearCart.tsx +0 -18
  13. package/src/buttons/ButtonInvoiceDownload.tsx +0 -63
  14. package/src/buttons/ButtonNext.tsx +0 -38
  15. package/src/buttons/ButtonNextDynamic.tsx +0 -31
  16. package/src/buttons/ButtonPay.tsx +0 -32
  17. package/src/buttons/ButtonShipmentTabNext.tsx +0 -25
  18. package/src/buttons/index.ts +0 -15
  19. package/src/components/Alert.tsx +0 -31
  20. package/src/components/CartBody.tsx +0 -16
  21. package/src/components/CartClient.tsx +0 -48
  22. package/src/components/CartFooter.tsx +0 -15
  23. package/src/components/CartItemRow.tsx +0 -145
  24. package/src/components/CartPaymentSettingsInvalid.tsx +0 -12
  25. package/src/components/CartShipment.tsx +0 -55
  26. package/src/components/CartTabContent.tsx +0 -15
  27. package/src/components/CartTabPanel.tsx +0 -25
  28. package/src/components/CartTableContainer.tsx +0 -15
  29. package/src/components/Collapse.tsx +0 -23
  30. package/src/components/LoadingTemplate.tsx +0 -22
  31. package/src/components/NoCartItems.tsx +0 -15
  32. package/src/components/ShipmentGroupCard.tsx +0 -156
  33. package/src/components/Table.tsx +0 -14
  34. package/src/components/Title.tsx +0 -22
  35. package/src/components/containers.tsx +0 -40
  36. package/src/components/index.ts +0 -30
  37. package/src/forms/FormNewCustomer.tsx +0 -119
  38. package/src/forms/FormReturningCustomer.tsx +0 -70
  39. package/src/forms/FormShipmentAddressAndNotes.tsx +0 -142
  40. package/src/forms/FormSquarePayment.tsx +0 -14
  41. package/src/forms/FormStripePayment.tsx +0 -14
  42. package/src/forms/InputAcceptUserTermsAndConditions.tsx +0 -43
  43. package/src/forms/InputError.tsx +0 -23
  44. package/src/forms/InputSelect.tsx +0 -58
  45. package/src/forms/InputText.tsx +0 -56
  46. package/src/forms/InputsAddress.tsx +0 -205
  47. package/src/index.tsx +0 -13
  48. package/src/panels/PanelCartItems.tsx +0 -61
  49. package/src/panels/PanelCartShipment.tsx +0 -89
  50. package/src/panels/PanelClearCart.tsx +0 -47
  51. package/src/panels/PanelClientCheckout.tsx +0 -92
  52. package/src/panels/PanelEditCartItem.tsx +0 -58
  53. package/src/panels/PanelPaymentSuccess.tsx +0 -69
  54. package/src/panels/index.ts +0 -15
  55. package/src/slices/sliceCart.ts +0 -159
  56. package/src/slices/sliceCartAlert.ts +0 -39
  57. package/src/slices/sliceCartItem.ts +0 -29
  58. package/src/slices/sliceCartPayment.ts +0 -45
  59. package/src/slices/sliceCartShipment.ts +0 -67
  60. package/src/slices/sliceFormReturningCustomer.ts +0 -25
  61. package/src/slices/sliceNewCustomerForm.ts +0 -24
  62. package/src/square/SquareCard.tsx +0 -58
  63. package/src/square/actions.ts +0 -40
  64. package/src/square/slices/reducersSquare.ts +0 -9
  65. package/src/square/slices/sliceSquareAlerts.ts +0 -29
  66. package/src/square/slices/sliceSquareForm.ts +0 -29
  67. package/src/store.ts +0 -499
  68. package/src/stripe/StripeCardFields.tsx +0 -164
  69. package/src/stripe/StripeCardForm.tsx +0 -86
  70. package/src/stripe/StripePaymentButtons.tsx +0 -117
  71. package/src/stripe/actions.ts +0 -94
  72. package/src/stripe/slices/sliceStripeAlerts.ts +0 -29
  73. package/src/stripe/slices/sliceStripeCardForm.ts +0 -9
  74. package/src/stripe/slices/sliceStripeForm.ts +0 -56
  75. package/src/stripe/utils.ts +0 -21
  76. package/src/styles/globals.css +0 -191
  77. package/src/styles/globals.css.map +0 -1
  78. package/src/styles/globals.scss +0 -197
  79. package/src/tabs/CartNav.tsx +0 -20
  80. package/src/tabs/NavTab.tsx +0 -38
  81. package/src/utilities/address.ts +0 -351
  82. package/src/utilities/cart.ts +0 -73
  83. package/src/utilities/company.ts +0 -8
  84. package/src/utilities/cookie.ts +0 -54
  85. package/src/utilities/currency.ts +0 -216
  86. package/src/utilities/helpers.ts +0 -209
  87. package/src/utilities/invoice.ts +0 -60
  88. package/src/utilities/product.ts +0 -7
  89. package/src/utilities/user.ts +0 -38
  90. package/src/utilities/variations.ts +0 -56
@@ -1,43 +0,0 @@
1
- import { useCartContext } from '../CartProvider';
2
-
3
-
4
- interface Props {
5
- isChecked: boolean;
6
- setIsChecked: (isChecked: boolean) => void;
7
- }
8
-
9
- function InputAcceptUserTermsAndConditions({ isChecked, setIsChecked }: Props) {
10
- const {
11
- classNameCartFormCheckbox,
12
- classNameCartFormGroupCheckbox,
13
- classNameCartFormLabelCheckbox,
14
- } = useCartContext();
15
- return (
16
- <div
17
- onClick={
18
- () => setIsChecked(!isChecked)
19
- }
20
- className={classNameCartFormGroupCheckbox}
21
- >
22
- <label className={classNameCartFormLabelCheckbox}>
23
- <input
24
- className={classNameCartFormCheckbox}
25
- defaultChecked={isChecked}
26
- type='checkbox'
27
- />
28
- {' '}
29
- <span style={{ fontSize: '14px' }} className='text-muted'>
30
- I agree to the user profile{' '}
31
- <a
32
- href='/terms-and-conditions/user/'
33
- target='_blank'
34
- >
35
- terms &amp; conditions
36
- </a>.
37
- </span>
38
- </label>
39
- </div>
40
- );
41
- }
42
-
43
- export default InputAcceptUserTermsAndConditions;
@@ -1,23 +0,0 @@
1
- import * as React from 'react';
2
- import { useCartContext } from '../CartProvider';
3
-
4
- interface InputErrorProps {
5
- error?: {
6
- message?: string;
7
- };
8
- }
9
-
10
- const InputError: React.FC<InputErrorProps> = ({ error }) => {
11
- const { classNameCartInputError } = useCartContext();
12
- if (!error || !error.message) {
13
- return null;
14
- }
15
-
16
- return (
17
- <div className={classNameCartInputError}>
18
- {error.message}
19
- </div>
20
- );
21
- };
22
-
23
- export default InputError;
@@ -1,58 +0,0 @@
1
- import { v4 as uuidv4 } from 'uuid';
2
- import { useController } from 'react-hook-form';
3
- import InputError from './InputError';
4
- import { useCartContext } from '../CartProvider';
5
-
6
- interface Option {
7
- label: string;
8
- value: string;
9
- }
10
-
11
- interface Props {
12
- control: any;
13
- label?: string;
14
- name: string;
15
- options: Option[];
16
- rules?: any;
17
- }
18
-
19
- function InputSelect({
20
- control,
21
- label,
22
- name,
23
- options,
24
- rules,
25
- }: Props) {
26
- const {
27
- classNameCartFormGroup,
28
- classNameCartFormInput,
29
- } = useCartContext();
30
- const {
31
- field,
32
- fieldState: { error, invalid }
33
- } = useController({
34
- name,
35
- control,
36
- rules,
37
- defaultValue: '',
38
- });
39
-
40
- return (
41
- <div className={classNameCartFormGroup}>
42
- {label && <label>{label}</label>}
43
- <select
44
- {...field}
45
- className={`${classNameCartFormInput} ${invalid && ' is-invalid'}`}
46
- >
47
- {options.map((option, index) => (
48
- <option key={index + uuidv4()} value={option.value}>
49
- {option.label}
50
- </option>
51
- ))}
52
- </select>
53
- <InputError error={error} />
54
- </div>
55
- );
56
- }
57
-
58
- export default InputSelect;
@@ -1,56 +0,0 @@
1
- import { useController } from 'react-hook-form';
2
- import { useCartContext } from '../CartProvider';
3
- import InputError from './InputError';
4
-
5
- interface Props {
6
- control: any;
7
- label?: string;
8
- name: string;
9
- placeholder: string;
10
- type?: string;
11
- onChange?: (event: any) => void;
12
- rules?: Record<string, any>;
13
- }
14
-
15
- function InputText({
16
- control,
17
- label,
18
- name,
19
- placeholder,
20
- type = 'text',
21
- onChange,
22
- rules,
23
- }: Props) {
24
- const {
25
- classNameCartFormGroup,
26
- classNameCartFormInput,
27
- } = useCartContext();
28
- const {
29
- field: { ref, ...inputProps },
30
- fieldState: { error, invalid }
31
- } = useController({
32
- name,
33
- control,
34
- rules,
35
- defaultValue: '',
36
- });
37
-
38
- return (
39
- <div className={classNameCartFormGroup}>
40
- {label && <label>{label}</label>}
41
- <input
42
- className={`${classNameCartFormInput} ${invalid && ' is-invalid'}`}
43
- type={type}
44
- placeholder={placeholder}
45
- {...inputProps}
46
- onChange={(e) => {
47
- if (onChange) onChange(e); // Check if custom onChange was provided
48
- inputProps.onChange(e); // Default RHF onChange
49
- }}
50
- />
51
- <InputError error={error} />
52
- </div>
53
- );
54
- }
55
-
56
- export default InputText;
@@ -1,205 +0,0 @@
1
- import { useEffect, useRef } from 'react';
2
- import Geosuggest from 'react-geosuggest';
3
- import { CountryDropdown, RegionDropdown } from 'react-country-region-selector';
4
- import { Controller } from 'react-hook-form';
5
- import InputText from './InputText';
6
- import { addressInOneLine, geoSuggestResultAsNewAddress } from '../utilities/address';
7
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
- import { faTimes, faEdit, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
9
- import { useState } from 'react';
10
- import { Collapse } from '../components';
11
- import { useCartContext } from '../CartProvider';
12
-
13
- interface Props {
14
- defaultAddress?: any;
15
- labelGeoSuggest?: string;
16
- hookForm: any;
17
- name: string;
18
- placeholder?: string;
19
- updateAddress: (address: any) => void;
20
- }
21
-
22
- export function InputsAddress({
23
- defaultAddress = {},
24
- labelGeoSuggest = 'Address',
25
- hookForm,
26
- name,
27
- placeholder = 'Search your address',
28
- updateAddress
29
- }: Props) {
30
- const geosuggestEl = useRef(null);
31
- const {
32
- googlePlacesLoaded,
33
- classNameCartFormGroup,
34
- classNameCartFormInput,
35
- classNameCartRow,
36
- classNameCartRowColumn,
37
- classNameCartGoogleSuggestList,
38
- classNameCartGoogleSuggestListItem,
39
- } = useCartContext();
40
-
41
- const {
42
- control,
43
- formState: { errors, isValid, submitCount },
44
- setValue,
45
- getValues,
46
- } = hookForm;
47
- const inputName = (_name: string) => `${name ? `${name}.` : ''}${_name}`;
48
- function onSuggestSelect(suggest: any) {
49
- if (suggest) {
50
- updateAddress(geoSuggestResultAsNewAddress(suggest));
51
- } else {
52
- updateAddress({
53
- city: '',
54
- country: '',
55
- lineOne: '',
56
- lineTwo: '',
57
- postcode: '',
58
- state: '',
59
- });
60
- }
61
- (geosuggestEl as any).current.blur();
62
- }
63
- function onChangeCountryState() {
64
- const addr = getValues();
65
- updateAddress(addr[name]);
66
- }
67
- const [addressFieldsOpen, setAddressFieldsOpen] = useState(false);
68
- const toggleAddressFieldsOpen = () => setAddressFieldsOpen(!addressFieldsOpen);
69
- useEffect(() => {
70
- if (!isValid && !addressFieldsOpen && submitCount > 0) {
71
- toggleAddressFieldsOpen();
72
- }
73
- }, [isValid, submitCount]);
74
- const addressForm = (
75
- <>
76
- <InputText
77
- control={control}
78
- label="Address line one"
79
- name={inputName("lineOne")}
80
- placeholder="123 Fake st"
81
- rules={{ required: 'Address line one is required.' }}
82
- />
83
- <InputText
84
- control={control}
85
- label="Continue address"
86
- name={inputName("lineTwo")}
87
- placeholder="Continue address..."
88
- />
89
- <div className={classNameCartRow}>
90
- <div className={classNameCartRowColumn}>
91
- <InputText
92
- control={control}
93
- label="City / Province"
94
- name={inputName("city")}
95
- placeholder="City"
96
- rules={{ required: 'City / Province is required.' }}
97
- />
98
- </div>
99
- <div className={classNameCartRowColumn}>
100
- <InputText
101
- control={control}
102
- label="Post / Zip code"
103
- name={inputName("postcode")}
104
- placeholder="90210"
105
- />
106
- </div>
107
- </div>
108
- <div className={classNameCartRow}>
109
- <div className={classNameCartRowColumn}>
110
- <div className={classNameCartFormGroup}>
111
- <label>Country</label>
112
- <Controller
113
- name={inputName("country")}
114
- control={control}
115
- defaultValue={defaultAddress && defaultAddress.country}
116
- render={({ field }: any) => (
117
- <CountryDropdown
118
- {...field}
119
- // value={defaultAddress && defaultAddress.country}
120
- classes={classNameCartFormInput}
121
- onChange={(val) => {
122
- setValue(inputName("country"), val);
123
- field.onChange(val);
124
- onChangeCountryState();
125
- }}
126
- valueType='short'
127
- />
128
- )}
129
- />
130
- </div>
131
- </div>
132
- <div className={classNameCartRowColumn}>
133
- <div className={classNameCartFormGroup}>
134
- <label>State / Region</label>
135
- <Controller
136
- name={inputName("state")}
137
- control={control}
138
- defaultValue={defaultAddress && defaultAddress.state}
139
- render={({ field }: any) => (
140
- <RegionDropdown
141
- {...field}
142
- // value={defaultAddress && defaultAddress.state}
143
- countryValueType="short"
144
- country={getValues(inputName("country"))}
145
- classes={classNameCartFormInput}
146
- onChange={(val) => {
147
- setValue(inputName("state"), val);
148
- field.onChange(val);
149
- onChangeCountryState();
150
- }}
151
- valueType='short'
152
- />
153
- )}
154
- />
155
- </div>
156
- </div>
157
- </div>
158
- </>
159
- );
160
- return (
161
- <>
162
- {googlePlacesLoaded
163
- ? <>
164
- <div className={classNameCartFormGroup}>
165
- <label>{labelGeoSuggest}</label>
166
- <Geosuggest
167
- ref={geosuggestEl}
168
- style={{input: {'::placeholder': {color: '#525f7f'}}}}
169
- initialValue={addressInOneLine(defaultAddress)}
170
- inputClassName={classNameCartFormInput}
171
- onSuggestSelect={onSuggestSelect}
172
- placeholder={placeholder}
173
- suggestsClassName={classNameCartGoogleSuggestList}
174
- suggestItemClassName={classNameCartGoogleSuggestListItem}
175
- types={['establishment', 'geocode']}
176
- />
177
- </div>
178
- <Collapse isOpen={addressFieldsOpen}>
179
- {addressForm}
180
- </Collapse>
181
- <div className='d-flex align-items-center'>
182
- {!!errors.length &&
183
- <div className='text-danger'>
184
- <FontAwesomeIcon
185
- icon={faExclamationTriangle}
186
- /> Invalid address!
187
- </div>
188
- }
189
- <a
190
- className={`ml-auto btn btn-sm btn-link ${!!errors.length && 'text-danger'}`}
191
- onClick={toggleAddressFieldsOpen}
192
- >
193
- <FontAwesomeIcon
194
- icon={addressFieldsOpen ? faTimes : faEdit}
195
- /> {addressFieldsOpen ? 'Close' : 'Edit fields'}
196
- </a>
197
- </div>
198
- </>
199
- : addressForm
200
- }
201
- </>
202
- );
203
- }
204
-
205
- export default InputsAddress;
package/src/index.tsx DELETED
@@ -1,13 +0,0 @@
1
- import Cart from './Cart';
2
- import {
3
- actionGetMerchiCart as getMerchiCart,
4
- getMerchiCartValues,
5
- isMerchiCartFetching
6
- } from './store';
7
-
8
- export {
9
- Cart,
10
- getMerchiCart,
11
- getMerchiCartValues,
12
- isMerchiCartFetching
13
- };
@@ -1,61 +0,0 @@
1
- import { useSelector } from 'react-redux';
2
- import CartItemRow from '../components/CartItemRow'
3
- import { tabIdItems } from '../slices/sliceCart';
4
- import {
5
- CartBody,
6
- CartTabContent,
7
- CartTableContainer,
8
- CartTabPanel,
9
- NoCartItems,
10
- Table,
11
- } from '../components';
12
-
13
- function PanelCartItems() {
14
- const { cart, deletingCartItemIndex } = useSelector((s: any) => s.stateCart);
15
- const cartItems = cart.cartItems ? cart.cartItems : [];
16
- const hasItems = cartItems.length > 0;
17
- return (
18
- <CartTabPanel tabId={tabIdItems}>
19
- <CartBody>
20
- <CartTabContent>
21
- {hasItems ? (
22
- <CartTableContainer>
23
- <Table>
24
- <thead>
25
- <tr>
26
- <th scope='col' className='merchi-cart-item-table-head'>
27
- Product
28
- </th>
29
- <th scope='col' className='merchi-cart-item-table-head-right'>
30
- Quantity
31
- </th>
32
- <th scope='col' className='merchi-cart-item-table-head-right'>
33
- Price
34
- </th>
35
- <th scope='col' className='merchi-cart-item-table-head-right'>
36
- Actions
37
- </th>
38
- </tr>
39
- </thead>
40
- <tbody>
41
- {cartItems.map((cartItem: any, index: number) =>
42
- <CartItemRow
43
- key={cartItem.id}
44
- cartItem={cartItem}
45
- index={index}
46
- loading={deletingCartItemIndex === index}
47
- />)
48
- }
49
- </tbody>
50
- </Table>
51
- </CartTableContainer>
52
- ) : (
53
- <NoCartItems />
54
- )}
55
- </CartTabContent>
56
- </CartBody>
57
- </CartTabPanel>
58
- );
59
- }
60
-
61
- export default PanelCartItems;
@@ -1,89 +0,0 @@
1
- import { useSelector } from 'react-redux';
2
- import { faTruck } from '@fortawesome/free-solid-svg-icons';
3
- import { ActiveFormShipmentAddressAndNotes } from '../forms/FormShipmentAddressAndNotes';
4
- import {
5
- CheckoutContainer,
6
- InnerContainer,
7
- } from '../components/containers';
8
- import {
9
- Alert,
10
- CartBody,
11
- CartTabPanel,
12
- LoadingTemplateSm,
13
- ShipmentGroupCard,
14
- Title,
15
- } from '../components';
16
- import { tabIdShipment } from '../slices/sliceCart';
17
-
18
- function PanelCartShipment() {
19
- const {
20
- fetchingShipmentGroups,
21
- shipmentGroups,
22
- } = useSelector((s: any) => s.stateCartShipment);
23
- return (
24
- <CartTabPanel tabId={tabIdShipment}>
25
- <CartBody style={{ paddingTop: '2rem' }}>
26
- <div className='merchi-cart-tab-content'>
27
- <CheckoutContainer textAlign='left'>
28
- <InnerContainer width={700} paddingBottom='3rem'>
29
- <ActiveFormShipmentAddressAndNotes />
30
- </InnerContainer>
31
- </CheckoutContainer>
32
- {fetchingShipmentGroups ? (
33
- <CheckoutContainer>
34
- <InnerContainer width={700}>
35
- <LoadingTemplateSm />
36
- <p>Fetching shipping options.</p>
37
- </InnerContainer>
38
- </CheckoutContainer>
39
- ) : (
40
- <>
41
- <CheckoutContainer textAlign='left'>
42
- <InnerContainer
43
- paddingBottom='1rem'
44
- width={700}
45
- >
46
- <Title
47
- icon={faTruck}
48
- title={
49
- shipmentGroups.length > 1 ?
50
- 'Select shipment methods'
51
- : shipmentGroups.length ?
52
- 'Select a shipment method'
53
- : ''
54
- }
55
- />
56
- </InnerContainer>
57
- </CheckoutContainer>
58
- <CheckoutContainer
59
- textAlign='left'
60
- >
61
- <InnerContainer
62
- paddingBottom='1rem'
63
- width={700}
64
- >
65
- {shipmentGroups.length > 1 &&
66
- <Alert alertType='warning'>
67
- Items within this cart are warehoused in different locations
68
- and will be shipped separately. Please select how you would
69
- like your items to be shipped.
70
- </Alert>
71
- }
72
- {shipmentGroups.map((group: any, index: number) =>
73
- <ShipmentGroupCard
74
- group={group}
75
- groupIndex={index}
76
- key={`${index}-shipment-group`}
77
- />)
78
- }
79
- </InnerContainer>
80
- </CheckoutContainer>
81
- </>
82
- )}
83
- </div>
84
- </CartBody>
85
- </CartTabPanel>
86
- );
87
- }
88
-
89
- export default PanelCartShipment;
@@ -1,47 +0,0 @@
1
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2
- import { faTrashAlt } from '@fortawesome/free-solid-svg-icons';
3
- import { doClearCart, closeClearCart } from '../store';
4
- import { tabIdClearCart } from '../slices/sliceCart'
5
- import { Button } from '../buttons';
6
- import { CartBody, CartTabPanel } from '../components';
7
- import { useCartContext } from '../CartProvider';
8
-
9
- function PanelClearCart() {
10
- const {
11
- classNameBtnDanger,
12
- classNameBtnDefault,
13
- classNameClearCartContainer,
14
- classNameClearCartText,
15
- } = useCartContext();
16
- return (
17
- <CartTabPanel tabId={tabIdClearCart}>
18
- <CartBody>
19
- <div className={classNameClearCartContainer}>
20
- <h2><FontAwesomeIcon icon={faTrashAlt} /></h2>
21
- <h3>Clear Cart</h3>
22
- <p className={classNameClearCartText}>
23
- Are you sure you would like to clear this cart?
24
- </p>
25
- <p>
26
- <Button
27
- className={classNameBtnDefault}
28
- onClick={closeClearCart}
29
- >
30
- Cancel
31
- </Button>
32
- </p>
33
- <p>
34
- <Button
35
- className={classNameBtnDanger}
36
- onClick={doClearCart}
37
- >
38
- Yes, clear cart
39
- </Button>
40
- </p>
41
- </div>
42
- </CartBody>
43
- </CartTabPanel>
44
- );
45
- }
46
-
47
- export default PanelClearCart;
@@ -1,92 +0,0 @@
1
- import { useSelector } from 'react-redux';
2
- import { tabIdCheckout } from '../slices/sliceCart';
3
- import {
4
- CheckoutContainer,
5
- InnerContainer,
6
- } from '../components/containers';
7
- import CartClient from '../components/CartClient';
8
- import CartShipment from '../components/CartShipment';
9
- import {
10
- CartBody,
11
- CartTabPanel,
12
- Title,
13
- } from '../components';
14
- import FormNewCustomer from '../forms/FormNewCustomer';
15
- import FormReturningCustomer from '../forms/FormReturningCustomer';
16
- import FormSquarePayment from '../forms/FormSquarePayment';
17
- import FormStripePayment from '../forms/FormStripePayment';
18
- import { faUserPlus, faUserTag } from '@fortawesome/free-solid-svg-icons';
19
-
20
- function PanelClientCheckout() {
21
- const { cart, needsShipping } = useSelector((s: any) => s.stateCart);
22
- const { client, domain } = cart;
23
- const company = domain && domain.company;
24
- return (
25
- <CartTabPanel tabId={tabIdCheckout}>
26
- <CartBody style={{ paddingTop: '2rem' }}>
27
- {client && client.id > -1 ?
28
- <>
29
- <CheckoutContainer>
30
- <InnerContainer
31
- paddingBottom='3rem'
32
- >
33
- <CartClient client={client} />
34
- </InnerContainer>
35
- </CheckoutContainer>
36
- {needsShipping &&
37
- <CheckoutContainer>
38
- <InnerContainer
39
- paddingBottom='3rem'
40
- >
41
- <CartShipment cart={cart} />
42
- </InnerContainer>
43
- </CheckoutContainer>
44
- }
45
- {Boolean(company) && company.acceptSquare &&
46
- <CheckoutContainer>
47
- <InnerContainer
48
- paddingBottom='3rem'
49
- >
50
- <FormSquarePayment />
51
- </InnerContainer>
52
- </CheckoutContainer>
53
- }
54
- <CheckoutContainer>
55
- <InnerContainer>
56
- <FormStripePayment />
57
- </InnerContainer>
58
- </CheckoutContainer>
59
-
60
- </>
61
- :
62
- <>
63
- <CheckoutContainer>
64
- <InnerContainer
65
- paddingBottom='3rem'
66
- >
67
- <Title
68
- icon={faUserPlus}
69
- Title='Checkout as new customer'
70
- />
71
- <FormNewCustomer />
72
- </InnerContainer>
73
- </CheckoutContainer>
74
- <CheckoutContainer>
75
- <InnerContainer
76
- paddingBottom='3rem'
77
- >
78
- <Title
79
- icon={faUserTag}
80
- Title='Checkout as returning customer'
81
- />
82
- <FormReturningCustomer />
83
- </InnerContainer>
84
- </CheckoutContainer>
85
- </>
86
- }
87
- </CartBody>
88
- </CartTabPanel>
89
- );
90
- }
91
-
92
- export default PanelClientCheckout;