merchi_cart 0.0.7-c → 0.0.7-e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -3
- package/src/Cart.tsx +100 -0
- package/src/CartAlert.tsx +34 -0
- package/src/CartHeader.tsx +27 -0
- package/src/CartProvider.tsx +386 -0
- package/src/CartTotals.tsx +106 -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/buttons/Button.tsx +35 -0
- package/src/buttons/ButtonBack.tsx +37 -0
- package/src/buttons/ButtonClearCart.tsx +18 -0
- package/src/buttons/ButtonInvoiceDownload.tsx +63 -0
- package/src/buttons/ButtonNext.tsx +38 -0
- package/src/buttons/ButtonNextDynamic.tsx +31 -0
- package/src/buttons/ButtonPay.tsx +32 -0
- package/src/buttons/ButtonShipmentTabNext.tsx +25 -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 +48 -0
- package/src/components/CartFooter.tsx +15 -0
- package/src/components/CartItemRow.tsx +145 -0
- package/src/components/CartPaymentSettingsInvalid.tsx +12 -0
- package/src/components/CartShipment.tsx +55 -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/Collapse.tsx +23 -0
- package/src/components/LoadingTemplate.tsx +22 -0
- package/src/components/NoCartItems.tsx +15 -0
- package/src/components/ShipmentGroupCard.tsx +156 -0
- package/src/components/Table.tsx +14 -0
- package/src/components/Title.tsx +22 -0
- package/src/components/containers.tsx +40 -0
- package/src/components/index.ts +30 -0
- package/src/forms/FormNewCustomer.tsx +119 -0
- package/src/forms/FormReturningCustomer.tsx +70 -0
- package/src/forms/FormShipmentAddressAndNotes.tsx +142 -0
- package/src/forms/FormSquarePayment.tsx +14 -0
- package/src/forms/FormStripePayment.tsx +14 -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 +205 -0
- package/src/index.tsx +13 -0
- package/src/panels/PanelCartItems.tsx +61 -0
- package/src/panels/PanelCartShipment.tsx +89 -0
- package/src/panels/PanelClearCart.tsx +47 -0
- package/src/panels/PanelClientCheckout.tsx +92 -0
- package/src/panels/PanelEditCartItem.tsx +58 -0
- package/src/panels/PanelPaymentSuccess.tsx +69 -0
- package/src/panels/index.ts +15 -0
- package/src/slices/sliceCart.ts +159 -0
- package/src/slices/sliceCartAlert.ts +39 -0
- package/src/slices/sliceCartItem.ts +29 -0
- package/src/slices/sliceCartPayment.ts +45 -0
- package/src/slices/sliceCartShipment.ts +67 -0
- package/src/slices/sliceFormReturningCustomer.ts +25 -0
- package/src/slices/sliceNewCustomerForm.ts +24 -0
- package/src/square/SquareCard.tsx +58 -0
- package/src/square/actions.ts +40 -0
- package/src/square/slices/reducersSquare.ts +9 -0
- package/src/square/slices/sliceSquareAlerts.ts +29 -0
- package/src/square/slices/sliceSquareForm.ts +29 -0
- package/src/store.ts +499 -0
- package/src/stripe/StripeCardFields.tsx +164 -0
- package/src/stripe/StripeCardForm.tsx +86 -0
- package/src/stripe/StripePaymentButtons.tsx +117 -0
- package/src/stripe/actions.ts +94 -0
- package/src/stripe/slices/sliceStripeAlerts.ts +29 -0
- package/src/stripe/slices/sliceStripeCardForm.ts +9 -0
- package/src/stripe/slices/sliceStripeForm.ts +56 -0
- package/src/stripe/utils.ts +21 -0
- package/src/styles/globals.css +191 -0
- package/src/styles/globals.css.map +1 -0
- package/src/styles/globals.scss +197 -0
- package/src/tabs/CartNav.tsx +20 -0
- package/src/tabs/NavTab.tsx +38 -0
- package/src/utilities/address.ts +351 -0
- package/src/utilities/cart.ts +73 -0
- package/src/utilities/company.ts +8 -0
- package/src/utilities/cookie.ts +54 -0
- package/src/utilities/currency.ts +216 -0
- package/src/utilities/helpers.ts +209 -0
- package/src/utilities/invoice.ts +60 -0
- package/src/utilities/product.ts +7 -0
- package/src/utilities/user.ts +38 -0
- package/src/utilities/variations.ts +56 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
|
+
import { ButtonPay } from '../buttons';
|
|
5
|
+
import {
|
|
6
|
+
callbackCreditCardPaymentSuccess
|
|
7
|
+
} from '../store';
|
|
8
|
+
import FormStripeCardFields from './StripeCardFields';
|
|
9
|
+
import {
|
|
10
|
+
stripeCardFormSubmit,
|
|
11
|
+
stripeInitPromise,
|
|
12
|
+
stripePaymentButtonSubmit,
|
|
13
|
+
} from './actions';
|
|
14
|
+
import { PaymentRequestPaymentMethodEvent } from '@stripe/stripe-js';
|
|
15
|
+
import { companyStripePubKeyOrTestPubKey } from './utils';
|
|
16
|
+
import { useCartContext } from '../CartProvider';
|
|
17
|
+
import { alertError } from '../store';
|
|
18
|
+
|
|
19
|
+
function PaymentButton({ loading }: any) {
|
|
20
|
+
const { cart } = useSelector((s: any) => s.stateCart);
|
|
21
|
+
return (
|
|
22
|
+
<div>
|
|
23
|
+
<ButtonPay cart={cart} loading={loading} />
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const badgeTestMode = <div style={{color: 'red'}}>Test mode</div>;
|
|
29
|
+
|
|
30
|
+
function StripeCardForm() {
|
|
31
|
+
const { cart } = useSelector((s: any) => s.stateCart);
|
|
32
|
+
const { urlApi } = useCartContext();
|
|
33
|
+
const { domain } = cart;
|
|
34
|
+
const company = domain.company;
|
|
35
|
+
const hasCompanyPubKey = Boolean(company.isStripeValid && companyStripePubKeyOrTestPubKey(company));
|
|
36
|
+
const companyPubKey = hasCompanyPubKey ? companyStripePubKeyOrTestPubKey(company) : '';
|
|
37
|
+
const canUseConnect = !!company.stripeAccountId;
|
|
38
|
+
const [loadingStripePayment, setLoadingStripePayment] = useState(false);
|
|
39
|
+
const [loadingStripePaymentButtons, setLoadingStripePaymentButtons] = useState(false);
|
|
40
|
+
const url: string = urlApi || '';
|
|
41
|
+
async function doStripePayment(r: any) {
|
|
42
|
+
setLoadingStripePayment(true);
|
|
43
|
+
try {
|
|
44
|
+
const response = await stripeCardFormSubmit(url, r.stripe, r.card, cart);
|
|
45
|
+
callbackCreditCardPaymentSuccess(response);
|
|
46
|
+
setLoadingStripePayment(false);
|
|
47
|
+
} catch (e: any) {
|
|
48
|
+
setLoadingStripePayment(false);
|
|
49
|
+
alertError(e.message);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function doStripePaymentRequestForButton(
|
|
53
|
+
stripe: any, event: PaymentRequestPaymentMethodEvent
|
|
54
|
+
) {
|
|
55
|
+
setLoadingStripePaymentButtons(true);
|
|
56
|
+
try {
|
|
57
|
+
const response = await stripePaymentButtonSubmit(url, stripe, cart, event);
|
|
58
|
+
callbackCreditCardPaymentSuccess(response);
|
|
59
|
+
setLoadingStripePaymentButtons(false);
|
|
60
|
+
} catch (e: any) {
|
|
61
|
+
setLoadingStripePaymentButtons(false);
|
|
62
|
+
alertError(e.message);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const [stripePublicKey, setStripePublicKey] = useState(companyPubKey);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!stripePublicKey && canUseConnect) stripeInitPromise(url).then(setStripePublicKey)
|
|
68
|
+
}, [stripePublicKey, canUseConnect]);
|
|
69
|
+
return (
|
|
70
|
+
<>
|
|
71
|
+
{company.isTesting && badgeTestMode}
|
|
72
|
+
<FormStripeCardFields
|
|
73
|
+
doStripePayment={doStripePayment}
|
|
74
|
+
doStripePaymentRequestForButton={doStripePaymentRequestForButton}
|
|
75
|
+
cart={cart}
|
|
76
|
+
loadingStripePayment={loadingStripePayment}
|
|
77
|
+
loadingStripePaymentButtons={loadingStripePaymentButtons}
|
|
78
|
+
PaymentButton={PaymentButton}
|
|
79
|
+
setLoadingStripePayment={setLoadingStripePayment}
|
|
80
|
+
stripePubKey={stripePublicKey}
|
|
81
|
+
/>
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default StripeCardForm;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
CanMakePaymentResult,
|
|
5
|
+
PaymentRequest,
|
|
6
|
+
PaymentRequestOptions,
|
|
7
|
+
PaymentRequestPaymentMethodEvent,
|
|
8
|
+
StripePaymentRequestButtonElementOptions
|
|
9
|
+
} from '@stripe/stripe-js';
|
|
10
|
+
import {
|
|
11
|
+
PaymentRequestButtonElement,
|
|
12
|
+
useStripe,
|
|
13
|
+
} from '@stripe/react-stripe-js';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function useOptions(paymentRequest: PaymentRequest) {
|
|
17
|
+
const options = useMemo(
|
|
18
|
+
() => ({
|
|
19
|
+
paymentRequest,
|
|
20
|
+
style: {
|
|
21
|
+
paymentRequestButton: {
|
|
22
|
+
theme: 'dark',
|
|
23
|
+
height: '48px',
|
|
24
|
+
type: 'buy'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
[paymentRequest]
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return options;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface UsePaymentRequest {
|
|
35
|
+
onPaymentMethod: (payload: any) => void;
|
|
36
|
+
options: PaymentRequestOptions;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function usePaymentRequest({ options, onPaymentMethod }: UsePaymentRequest) {
|
|
40
|
+
const stripe = useStripe();
|
|
41
|
+
const [paymentRequest, setPaymentRequest] = useState((null as unknown));
|
|
42
|
+
const [canMakePayment, setCanMakePayment] = useState(false);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (stripe && paymentRequest === null) {
|
|
46
|
+
const pr = stripe.paymentRequest(options);
|
|
47
|
+
setPaymentRequest((pr as any));
|
|
48
|
+
}
|
|
49
|
+
}, [stripe, options, paymentRequest]);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
let subscribed = true;
|
|
53
|
+
if (paymentRequest) {
|
|
54
|
+
(paymentRequest as PaymentRequest).canMakePayment().then(
|
|
55
|
+
(res: CanMakePaymentResult | null) => {
|
|
56
|
+
if (res && subscribed) {
|
|
57
|
+
setCanMakePayment(true);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return () => {
|
|
63
|
+
subscribed = false;
|
|
64
|
+
};
|
|
65
|
+
}, [paymentRequest]);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (paymentRequest) {
|
|
69
|
+
(paymentRequest as any).on('paymentmethod', onPaymentMethod);
|
|
70
|
+
}
|
|
71
|
+
return () => {
|
|
72
|
+
if (paymentRequest) {
|
|
73
|
+
(paymentRequest as any).off('paymentmethod', onPaymentMethod);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}, [paymentRequest, onPaymentMethod]);
|
|
77
|
+
|
|
78
|
+
return canMakePayment ? paymentRequest : null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface PropsStripePaymentButtons {
|
|
82
|
+
doPaymentRequest: (event: PaymentRequestPaymentMethodEvent) => void;
|
|
83
|
+
cart: any;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function StripePaymentButtons(
|
|
87
|
+
{
|
|
88
|
+
doPaymentRequest,
|
|
89
|
+
cart,
|
|
90
|
+
}: PropsStripePaymentButtons) {
|
|
91
|
+
const paymentRequest: unknown = usePaymentRequest({
|
|
92
|
+
options: {
|
|
93
|
+
country: cart.domain.company.country,
|
|
94
|
+
currency: String(cart.currency).toLowerCase(),
|
|
95
|
+
total: {
|
|
96
|
+
label: `Merchi Cart #${cart.id}`,
|
|
97
|
+
amount: Math.round(cart.totalCost * 100)
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
onPaymentMethod: doPaymentRequest
|
|
101
|
+
});
|
|
102
|
+
const options = useOptions((paymentRequest as PaymentRequest));
|
|
103
|
+
|
|
104
|
+
if (!paymentRequest) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return (
|
|
108
|
+
<div style={{marginBottom: '2rem', marginTop: '2rem'}}>
|
|
109
|
+
<PaymentRequestButtonElement
|
|
110
|
+
className='PaymentRequestButton'
|
|
111
|
+
options={(options as StripePaymentRequestButtonElementOptions)}
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export default StripePaymentButtons;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PaymentRequestPaymentMethodEvent } from '@stripe/stripe-js';
|
|
2
|
+
|
|
3
|
+
export async function stripeInitPromise(urlApi: string) {
|
|
4
|
+
return await fetch(
|
|
5
|
+
`${urlApi}stripe/master_publishable_key/`,
|
|
6
|
+
{ method: 'GET', mode: 'cors' }
|
|
7
|
+
).then((response: any) => response.key);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async function createPaymentIntent(urlApi: string, cart: any, paymentMethodType?: string) {
|
|
11
|
+
const { id, token } = cart;
|
|
12
|
+
const fetchOptions: any = {
|
|
13
|
+
method: 'GET',
|
|
14
|
+
mode: 'cors',
|
|
15
|
+
};
|
|
16
|
+
const queryParams: any[] = [['cart_token', token]];
|
|
17
|
+
|
|
18
|
+
if (paymentMethodType) {
|
|
19
|
+
queryParams.push(['payment_method_types', paymentMethodType]);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const queryString = new URLSearchParams(queryParams).toString();
|
|
23
|
+
const uri = `stripe/payment_intent/cart/${id}/`
|
|
24
|
+
const url = `${urlApi}${uri}?${queryString}`;
|
|
25
|
+
|
|
26
|
+
const response = await fetch(url, fetchOptions);
|
|
27
|
+
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
throw new Error("Failed to create payment intent.");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return await response.json();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function checkPaymentIntnetIsComplete(urlApi: string, cart: any) {
|
|
36
|
+
const url = `stripe/payment_intent/cart/complete/${cart.id}/`;
|
|
37
|
+
const fetchOptions: any = {
|
|
38
|
+
method: 'GET',
|
|
39
|
+
mode: 'cors',
|
|
40
|
+
};
|
|
41
|
+
const queryString = new URLSearchParams({cart_token: cart.token}).toString();
|
|
42
|
+
|
|
43
|
+
const response = await fetch(`${urlApi}${url}?${queryString}`, fetchOptions);
|
|
44
|
+
|
|
45
|
+
if (!response.ok) {
|
|
46
|
+
throw new Error("Failed to check if payment intent is complete.");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return await response.json();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function stripeCardFormSubmit(urlApi: string, stripe: any, card: any, cart: any) {
|
|
53
|
+
try {
|
|
54
|
+
const intent = await createPaymentIntent(urlApi, cart);
|
|
55
|
+
const stripePayment = await stripe.confirmCardPayment(intent.stripeClientSecret, { payment_method: { card } });
|
|
56
|
+
|
|
57
|
+
if (stripePayment.error) {
|
|
58
|
+
throw new Error(stripePayment.error.message || 'Stripe connect unknown error');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return await checkPaymentIntnetIsComplete(urlApi, cart);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
throw e;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function stripePaymentButtonSubmit(
|
|
68
|
+
urlApi: string,
|
|
69
|
+
stripe: any,
|
|
70
|
+
cart: any,
|
|
71
|
+
paymentMethodEvent: PaymentRequestPaymentMethodEvent
|
|
72
|
+
) {
|
|
73
|
+
const { complete, paymentMethod } = paymentMethodEvent;
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
const intent = await createPaymentIntent(urlApi, cart);
|
|
77
|
+
const stripePayment = await stripe.confirmCardPayment(
|
|
78
|
+
intent.stripeClientSecret,
|
|
79
|
+
{ payment_method: paymentMethod.id },
|
|
80
|
+
{ handleActions: false }
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if (stripePayment.error) {
|
|
84
|
+
throw new Error(stripePayment.error.message || 'Stripe unknown error');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
complete('success');
|
|
88
|
+
return await checkPaymentIntnetIsComplete(urlApi, cart);
|
|
89
|
+
|
|
90
|
+
} catch (e) {
|
|
91
|
+
complete('fail');
|
|
92
|
+
throw e;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
const sliceStripeAlerts = createSlice({
|
|
4
|
+
initialState: {
|
|
5
|
+
alerts: [],
|
|
6
|
+
},
|
|
7
|
+
name: 'stateStripeAlerts',
|
|
8
|
+
reducers: {
|
|
9
|
+
alertError: (state: any, action: PayloadAction<any>) => {
|
|
10
|
+
state.alerts =
|
|
11
|
+
[...state.alerts,
|
|
12
|
+
{ alertType: 'danger',
|
|
13
|
+
message: action.payload,
|
|
14
|
+
title: 'Error!' }];
|
|
15
|
+
},
|
|
16
|
+
alertRemove: (state: any, action: PayloadAction<any>) => {
|
|
17
|
+
state.alerts.splice(action.payload, 1);
|
|
18
|
+
},
|
|
19
|
+
alertSuccess: (state: any, action: PayloadAction<any>) => {
|
|
20
|
+
state.alerts =
|
|
21
|
+
[...state.alerts,
|
|
22
|
+
{ alertType: 'success',
|
|
23
|
+
message: action.payload,
|
|
24
|
+
title: 'Success!' }];
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default sliceStripeAlerts;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import sliceStripeAlerts from './sliceStripeAlerts';
|
|
2
|
+
import sliceStripeForm from './sliceStripeForm';
|
|
3
|
+
|
|
4
|
+
const sliceStripeCardForm = {
|
|
5
|
+
stateStripeAlerts: sliceStripeAlerts.reducer,
|
|
6
|
+
stateStripeForm: sliceStripeForm.reducer,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default sliceStripeCardForm;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
const sliceStripeForm = createSlice({
|
|
4
|
+
initialState: {
|
|
5
|
+
acceptedPaymentMethods: {},
|
|
6
|
+
invoice: {},
|
|
7
|
+
isCart: false,
|
|
8
|
+
loading: false,
|
|
9
|
+
loadingAcceptedPaymentMethods: false,
|
|
10
|
+
loadingPaymentRequestButton: false,
|
|
11
|
+
loadingWeChatPayment: false,
|
|
12
|
+
},
|
|
13
|
+
name: 'stateStripeForm',
|
|
14
|
+
reducers: {
|
|
15
|
+
actionFetchAcceptedPaymentMethods: (state: any) => {
|
|
16
|
+
state.loadingAcceptedPaymentMethods = true;
|
|
17
|
+
},
|
|
18
|
+
actionFetchAcceptedPaymentMethodsDone: (state: any, action: PayloadAction<any>) => {
|
|
19
|
+
state.loadingAcceptedPaymentMethods = false;
|
|
20
|
+
state.acceptedPaymentMethods = action.payload;
|
|
21
|
+
},
|
|
22
|
+
actionStripePaymentEnd: (state: any) => {
|
|
23
|
+
state.loading = false;
|
|
24
|
+
},
|
|
25
|
+
actionStripePaymentStart: (state: any) => {
|
|
26
|
+
state.loading = true;
|
|
27
|
+
},
|
|
28
|
+
actionStripePaymentRequestButtonEnd: (state: any) => {
|
|
29
|
+
state.loadingPaymentRequestButton = false;
|
|
30
|
+
},
|
|
31
|
+
actionStripePaymentRequestButtonStart: (state: any) => {
|
|
32
|
+
state.loadingPaymentRequestButton = true;
|
|
33
|
+
},
|
|
34
|
+
actionStripeWeChatPaymentEnd: (state: any) => {
|
|
35
|
+
state.loadingWeChatPayment = false;
|
|
36
|
+
},
|
|
37
|
+
actionStripeWeChatPaymentStart: (state: any) => {
|
|
38
|
+
state.loadingWeChatPayment = true;
|
|
39
|
+
},
|
|
40
|
+
setInvoiceOrCart: (state: any, action: PayloadAction<any>) => {
|
|
41
|
+
const { invoice, isCart } = action.payload;
|
|
42
|
+
state.invoice = invoice;
|
|
43
|
+
if (isCart) {
|
|
44
|
+
state.isCart = isCart;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
stripePaymentEnd: (state: any) => {
|
|
48
|
+
state.loading = false;
|
|
49
|
+
},
|
|
50
|
+
stripePaymentStart: (state: any, action: PayloadAction<any>) => {
|
|
51
|
+
state.loading = true;
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export default sliceStripeForm;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function companyStripePubKeyOrTestPubKey(company: any) {
|
|
2
|
+
return company.isTesting ? company.stripePublishableTestKey :
|
|
3
|
+
company.stripePublishableKey;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const CARD_ELEMENT_OPTIONS = {
|
|
7
|
+
style: {
|
|
8
|
+
base: {
|
|
9
|
+
'::placeholder': {
|
|
10
|
+
color: '#999',
|
|
11
|
+
fontSize: '16px',
|
|
12
|
+
},
|
|
13
|
+
fontSize: '16px',
|
|
14
|
+
lineHeight: '1.33',
|
|
15
|
+
paddingTop: '4px',
|
|
16
|
+
},
|
|
17
|
+
invalid: {
|
|
18
|
+
color: '#9e2146',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
.merchi-cart-body {
|
|
2
|
+
display: block;
|
|
3
|
+
align-items: center;
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
min-height: 100px;
|
|
7
|
+
height: 450px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.merchi-loading-container {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
height: var(--bs-height-md, 100px);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.merchi-loading-container-text {
|
|
19
|
+
font-size: 1.2rem;
|
|
20
|
+
font-weight: bold;
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.merchi-payment-gateway-inactive {
|
|
25
|
+
height: 300px;
|
|
26
|
+
background: url("../assets/merchi-swipe-outline.png");
|
|
27
|
+
background-repeat: no-repeat;
|
|
28
|
+
background-position: center center;
|
|
29
|
+
background-size: 276px 215px;
|
|
30
|
+
margin-top: 100px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.merchi-tab-panel {
|
|
34
|
+
display: none;
|
|
35
|
+
padding: 1rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.merchi-cart-tab-content {
|
|
39
|
+
padding: 15px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.merchi-cart-tab-content > .merchi-cart-tab-panel {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.merchi-cart-tab-content > .active {
|
|
47
|
+
display: block;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.merchi-cart-clear-container {
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
align-items: center;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.merchi-cart-clear-text {
|
|
57
|
+
font-size: 16px;
|
|
58
|
+
margin-top: 3rem;
|
|
59
|
+
margin-bottom: 3rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.merchi-cart-item-table-head {
|
|
63
|
+
border: none;
|
|
64
|
+
background-color: #f8f9fa;
|
|
65
|
+
padding: 0.5rem;
|
|
66
|
+
padding-left: 0.75rem;
|
|
67
|
+
padding-right: 0.75rem;
|
|
68
|
+
text-transform: uppercase;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.merchi-cart-item-table-head-right {
|
|
72
|
+
border: none;
|
|
73
|
+
background-color: #f8f9fa;
|
|
74
|
+
padding: 0.5rem;
|
|
75
|
+
padding-left: 0.75rem;
|
|
76
|
+
padding-right: 0.75rem;
|
|
77
|
+
text-transform: uppercase;
|
|
78
|
+
text-align: right;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.merchi-cart-success-message {
|
|
82
|
+
font-size: 16px;
|
|
83
|
+
padding-bottom: 4rem;
|
|
84
|
+
padding-top: 4rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Merchi checkout */
|
|
88
|
+
.merchi-row {
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@media (min-width: 768px) {
|
|
94
|
+
.merchi-row {
|
|
95
|
+
flex-direction: row;
|
|
96
|
+
}
|
|
97
|
+
.merchi-column {
|
|
98
|
+
width: 50%;
|
|
99
|
+
padding-right: 10px;
|
|
100
|
+
}
|
|
101
|
+
.merchi-column:last-child {
|
|
102
|
+
padding-left: 10px;
|
|
103
|
+
padding-right: 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
.merchi-collapse {
|
|
107
|
+
display: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.merchi-collapse.show {
|
|
111
|
+
display: block;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.merchi-nav {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-wrap: wrap;
|
|
117
|
+
padding-left: 0;
|
|
118
|
+
margin-bottom: 0;
|
|
119
|
+
list-style: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.merchi-nav-link {
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
display: block;
|
|
125
|
+
padding: 0.5rem 1rem;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.merchi-nav-link:hover, .merchi-nav-link:focus {
|
|
129
|
+
text-decoration: none;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.merchi-nav-link.disabled {
|
|
133
|
+
color: #6c757d;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
cursor: default;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.merchi-nav-tabs {
|
|
139
|
+
border-bottom: 1px solid #dee2e6;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.merchi-nav-tabs .merchi-nav-item {
|
|
143
|
+
margin-bottom: -1px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.merchi-nav-tabs .merchi-nav-link {
|
|
147
|
+
border: 1px solid transparent;
|
|
148
|
+
border-top-left-radius: 0.25rem;
|
|
149
|
+
border-top-right-radius: 0.25rem;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.merchi-nav-tabs .merchi-nav-link:hover, .merchi-nav-tabs .merchi-nav-link:focus {
|
|
153
|
+
border-color: #e9ecef #e9ecef #dee2e6;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.merchi-nav-tabs .merchi-nav-link.disabled {
|
|
157
|
+
color: #6c757d;
|
|
158
|
+
background-color: transparent;
|
|
159
|
+
border-color: transparent;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.merchi-nav-tabs .merchi-nav-link.active,
|
|
163
|
+
.merchi-nav-tabs .merchi-nav-item.show .merchi-nav-link {
|
|
164
|
+
color: #495057;
|
|
165
|
+
background-color: #fff;
|
|
166
|
+
border-color: #dee2e6 #dee2e6 #fff;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.merchi-nav-pills .merchi-nav-link {
|
|
170
|
+
border-radius: 0.25rem;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.merchi-nav-pills .merchi-nav-link.active,
|
|
174
|
+
.merchi-nav-pills .show > .merchi-nav-link {
|
|
175
|
+
color: #fff;
|
|
176
|
+
background-color: #007bff;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.merchi-nav-fill .merchi-nav-item {
|
|
180
|
+
flex: 1 1 auto;
|
|
181
|
+
text-align: center;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.merchi-no-cart-items {
|
|
185
|
+
display: flex;
|
|
186
|
+
justify-content: center;
|
|
187
|
+
align-content: center;
|
|
188
|
+
height: 450px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/*# sourceMappingURL=globals.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["globals.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAGF;AACA;EACE;EACA;;;AAGF;EACE;IACE;;EAGF;IACE;IACA;;EAGF;IACE;IACA;;;AAIJ;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;AAAA;EAEE;EACA;EACA;;;AAGF;EACE;;;AAGF;AAAA;EAEE;EACA;;;AAGF;EACE;EACA;;;AAEF;EACE;EACA;EACA;EACA","file":"globals.css"}
|