@blocklet/payment-react 1.14.21 → 1.14.22
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/es/checkout/donate.d.ts +2 -1
- package/es/checkout/donate.js +9 -10
- package/es/checkout/form.d.ts +1 -1
- package/es/checkout/form.js +23 -1
- package/es/checkout/table.d.ts +1 -1
- package/es/checkout/table.js +8 -1
- package/es/components/blockchain/tx.js +2 -1
- package/es/components/country-select.d.ts +16 -0
- package/es/components/country-select.js +82 -0
- package/es/components/input.d.ts +21 -21
- package/es/components/input.js +43 -42
- package/es/components/livemode.js +1 -0
- package/es/components/pricing-table.js +0 -2
- package/es/components/status.js +2 -3
- package/es/components/table.d.ts +2 -0
- package/es/components/table.js +186 -0
- package/es/contexts/payment.d.ts +2 -0
- package/es/contexts/payment.js +5 -2
- package/es/history/invoice/list.d.ts +3 -1
- package/es/history/invoice/list.js +215 -48
- package/es/hooks/mobile.d.ts +4 -0
- package/es/hooks/mobile.js +10 -0
- package/es/index.d.ts +5 -1
- package/es/index.js +7 -1
- package/es/libs/util.d.ts +15 -2
- package/es/libs/util.js +92 -28
- package/es/locales/en.js +22 -7
- package/es/locales/index.d.ts +0 -1
- package/es/locales/index.js +10 -1
- package/es/locales/zh.js +21 -6
- package/es/payment/error.js +2 -2
- package/es/payment/footer.js +1 -1
- package/es/payment/form/address.d.ts +9 -2
- package/es/payment/form/address.js +69 -69
- package/es/payment/form/currency.js +39 -25
- package/es/payment/form/index.d.ts +1 -1
- package/es/payment/form/index.js +83 -81
- package/es/payment/form/phone.js +15 -51
- package/es/payment/index.d.ts +1 -10
- package/es/payment/index.js +274 -219
- package/es/payment/product-card.js +4 -4
- package/es/payment/product-donation.js +7 -2
- package/es/payment/product-item.d.ts +2 -2
- package/es/payment/product-item.js +120 -81
- package/es/payment/summary.js +188 -118
- package/es/theme/index.css +240 -0
- package/es/theme/index.d.ts +9 -0
- package/es/theme/index.js +243 -0
- package/es/theme/typography.d.ts +2 -0
- package/es/theme/typography.js +53 -0
- package/es/types/index.d.ts +11 -0
- package/lib/checkout/donate.d.ts +2 -1
- package/lib/checkout/donate.js +14 -2
- package/lib/checkout/form.d.ts +1 -1
- package/lib/checkout/form.js +22 -1
- package/lib/checkout/table.d.ts +1 -1
- package/lib/checkout/table.js +14 -1
- package/lib/components/blockchain/tx.js +4 -1
- package/lib/components/country-select.d.ts +16 -0
- package/lib/components/country-select.js +115 -0
- package/lib/components/input.d.ts +21 -21
- package/lib/components/input.js +21 -12
- package/lib/components/livemode.js +1 -0
- package/lib/components/pricing-table.js +0 -2
- package/lib/components/status.js +2 -3
- package/lib/components/table.d.ts +2 -0
- package/lib/components/table.js +220 -0
- package/lib/contexts/payment.d.ts +2 -0
- package/lib/contexts/payment.js +4 -1
- package/lib/history/invoice/list.d.ts +3 -1
- package/lib/history/invoice/list.js +290 -62
- package/lib/hooks/mobile.d.ts +4 -0
- package/lib/hooks/mobile.js +17 -0
- package/lib/index.d.ts +5 -1
- package/lib/index.js +36 -0
- package/lib/libs/util.d.ts +15 -2
- package/lib/libs/util.js +115 -37
- package/lib/locales/en.js +22 -7
- package/lib/locales/index.d.ts +0 -1
- package/lib/locales/index.js +14 -3
- package/lib/locales/zh.js +21 -6
- package/lib/payment/error.js +5 -1
- package/lib/payment/footer.js +1 -1
- package/lib/payment/form/address.d.ts +9 -2
- package/lib/payment/form/address.js +67 -59
- package/lib/payment/form/currency.js +31 -24
- package/lib/payment/form/index.d.ts +1 -1
- package/lib/payment/form/index.js +92 -93
- package/lib/payment/form/phone.js +11 -59
- package/lib/payment/index.d.ts +1 -10
- package/lib/payment/index.js +291 -219
- package/lib/payment/product-card.js +5 -4
- package/lib/payment/product-donation.js +9 -2
- package/lib/payment/product-item.d.ts +2 -2
- package/lib/payment/product-item.js +38 -19
- package/lib/payment/summary.js +219 -127
- package/lib/theme/index.css +240 -0
- package/lib/theme/index.d.ts +9 -0
- package/lib/theme/index.js +259 -0
- package/lib/theme/typography.d.ts +2 -0
- package/lib/theme/typography.js +59 -0
- package/lib/types/index.d.ts +11 -0
- package/package.json +14 -11
- package/src/checkout/donate.tsx +16 -10
- package/src/checkout/form.tsx +23 -0
- package/src/checkout/table.tsx +13 -1
- package/src/components/blockchain/tx.tsx +2 -1
- package/src/components/country-select.tsx +93 -0
- package/src/components/input.tsx +49 -46
- package/src/components/livemode.tsx +1 -0
- package/src/components/pricing-table.tsx +0 -2
- package/src/components/status.tsx +1 -2
- package/src/components/table.tsx +200 -0
- package/src/contexts/payment.tsx +6 -1
- package/src/history/invoice/list.tsx +254 -49
- package/src/hooks/mobile.ts +13 -0
- package/src/index.ts +7 -0
- package/src/libs/util.ts +120 -31
- package/src/locales/en.tsx +18 -4
- package/src/locales/index.tsx +10 -3
- package/src/locales/zh.tsx +17 -3
- package/src/payment/error.tsx +2 -2
- package/src/payment/footer.tsx +1 -1
- package/src/payment/form/address.tsx +56 -47
- package/src/payment/form/currency.tsx +29 -23
- package/src/payment/form/index.tsx +89 -76
- package/src/payment/form/phone.tsx +14 -51
- package/src/payment/index.tsx +294 -242
- package/src/payment/product-card.tsx +4 -4
- package/src/payment/product-donation.tsx +7 -3
- package/src/payment/product-item.tsx +49 -20
- package/src/payment/summary.tsx +191 -108
- package/src/theme/index.css +240 -0
- package/src/theme/index.tsx +250 -0
- package/src/theme/typography.ts +56 -0
- package/src/types/index.ts +12 -0
package/es/payment/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
3
3
|
import Toast from "@arcblock/ux/lib/Toast";
|
|
4
|
+
import Header from "@blocklet/ui-react/lib/Header";
|
|
4
5
|
import { ArrowBackOutlined } from "@mui/icons-material";
|
|
5
6
|
import { Box, Fade, Stack } from "@mui/material";
|
|
6
7
|
import { styled } from "@mui/system";
|
|
@@ -10,120 +11,19 @@ import { useEffect, useState } from "react";
|
|
|
10
11
|
import { FormProvider, useForm, useWatch } from "react-hook-form";
|
|
11
12
|
import { usePaymentContext } from "../contexts/payment.js";
|
|
12
13
|
import api from "../libs/api.js";
|
|
13
|
-
import {
|
|
14
|
-
findCurrency,
|
|
15
|
-
formatAmountPrecisionLimit,
|
|
16
|
-
formatError,
|
|
17
|
-
getStatementDescriptor,
|
|
18
|
-
isValidCountry
|
|
19
|
-
} from "../libs/util.js";
|
|
14
|
+
import { findCurrency, formatError, getStatementDescriptor, isValidCountry } from "../libs/util.js";
|
|
20
15
|
import PaymentError from "./error.js";
|
|
21
16
|
import CheckoutFooter from "./footer.js";
|
|
22
17
|
import PaymentForm from "./form/index.js";
|
|
23
|
-
import PaymentHeader from "./header.js";
|
|
24
18
|
import OverviewSkeleton from "./skeleton/overview.js";
|
|
25
19
|
import PaymentSkeleton from "./skeleton/payment.js";
|
|
26
20
|
import PaymentSuccess from "./success.js";
|
|
27
21
|
import PaymentSummary from "./summary.js";
|
|
28
|
-
|
|
29
|
-
completed: false,
|
|
30
|
-
error: null
|
|
31
|
-
};
|
|
32
|
-
export default function Payment({
|
|
33
|
-
checkoutSession,
|
|
34
|
-
paymentMethods,
|
|
35
|
-
paymentIntent,
|
|
36
|
-
paymentLink,
|
|
37
|
-
customer,
|
|
38
|
-
completed,
|
|
39
|
-
error,
|
|
40
|
-
mode,
|
|
41
|
-
onPaid,
|
|
42
|
-
onError,
|
|
43
|
-
onChange,
|
|
44
|
-
goBack,
|
|
45
|
-
action
|
|
46
|
-
}) {
|
|
47
|
-
const { t } = useLocaleContext();
|
|
48
|
-
const { refresh, livemode, setLivemode } = usePaymentContext();
|
|
49
|
-
const [delay, setDelay] = useState(false);
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
setTimeout(() => {
|
|
52
|
-
setDelay(true);
|
|
53
|
-
}, 500);
|
|
54
|
-
}, []);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (checkoutSession) {
|
|
57
|
-
if (livemode !== checkoutSession.livemode) {
|
|
58
|
-
setLivemode(checkoutSession.livemode);
|
|
59
|
-
setTimeout(() => {
|
|
60
|
-
refresh();
|
|
61
|
-
}, 10);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}, [checkoutSession, livemode, setLivemode, refresh]);
|
|
65
|
-
if (error) {
|
|
66
|
-
return /* @__PURE__ */ jsx(PaymentError, { mode, title: "Oops", description: formatError(error) });
|
|
67
|
-
}
|
|
68
|
-
if (!checkoutSession || !delay) {
|
|
69
|
-
return /* @__PURE__ */ jsx(Root, { mode, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : 8 } }, children: [
|
|
70
|
-
/* @__PURE__ */ jsx(Stack, { className: "cko-overview", children: /* @__PURE__ */ jsx(OverviewSkeleton, {}) }),
|
|
71
|
-
/* @__PURE__ */ jsx(Stack, { className: "cko-payment", children: /* @__PURE__ */ jsx(PaymentSkeleton, {}) }),
|
|
72
|
-
mode === "standalone" && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer" })
|
|
73
|
-
] }) });
|
|
74
|
-
}
|
|
75
|
-
if (checkoutSession.expires_at <= Math.round(Date.now() / 1e3)) {
|
|
76
|
-
return /* @__PURE__ */ jsx(
|
|
77
|
-
PaymentError,
|
|
78
|
-
{
|
|
79
|
-
mode,
|
|
80
|
-
title: t("payment.checkout.expired.title"),
|
|
81
|
-
description: t("payment.checkout.expired.description")
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
if (checkoutSession.status === "complete") {
|
|
86
|
-
return /* @__PURE__ */ jsx(
|
|
87
|
-
PaymentError,
|
|
88
|
-
{
|
|
89
|
-
mode,
|
|
90
|
-
title: t("payment.checkout.complete.title"),
|
|
91
|
-
description: t("payment.checkout.complete.description")
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
if (!checkoutSession.line_items.length) {
|
|
96
|
-
return /* @__PURE__ */ jsx(
|
|
97
|
-
PaymentError,
|
|
98
|
-
{
|
|
99
|
-
mode,
|
|
100
|
-
title: t("payment.checkout.emptyItems.title"),
|
|
101
|
-
description: t("payment.checkout.emptyItems.description")
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
return /* @__PURE__ */ jsx(
|
|
106
|
-
PaymentInner,
|
|
107
|
-
{
|
|
108
|
-
checkoutSession,
|
|
109
|
-
paymentMethods,
|
|
110
|
-
paymentLink,
|
|
111
|
-
paymentIntent,
|
|
112
|
-
completed,
|
|
113
|
-
customer,
|
|
114
|
-
onPaid,
|
|
115
|
-
onError,
|
|
116
|
-
onChange,
|
|
117
|
-
goBack,
|
|
118
|
-
mode,
|
|
119
|
-
action
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
}
|
|
22
|
+
import { useMobile } from "../hooks/mobile.js";
|
|
123
23
|
PaymentInner.defaultProps = {
|
|
124
24
|
completed: false
|
|
125
25
|
};
|
|
126
|
-
|
|
26
|
+
function PaymentInner({
|
|
127
27
|
checkoutSession,
|
|
128
28
|
paymentMethods,
|
|
129
29
|
paymentLink,
|
|
@@ -134,11 +34,11 @@ export function PaymentInner({
|
|
|
134
34
|
onPaid,
|
|
135
35
|
onError,
|
|
136
36
|
onChange,
|
|
137
|
-
goBack,
|
|
138
37
|
action
|
|
139
38
|
}) {
|
|
140
|
-
const { t
|
|
39
|
+
const { t } = useLocaleContext();
|
|
141
40
|
const { settings, session } = usePaymentContext();
|
|
41
|
+
const { isMobile } = useMobile();
|
|
142
42
|
const [state, setState] = useSetState({ checkoutSession });
|
|
143
43
|
const defaultCurrencyId = state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
|
|
144
44
|
const defaultMethodId = paymentMethods.find((m) => m.payment_currencies.some((c) => c.id === defaultCurrencyId))?.id;
|
|
@@ -207,15 +107,7 @@ export function PaymentInner({
|
|
|
207
107
|
Toast.error(formatError(err));
|
|
208
108
|
}
|
|
209
109
|
};
|
|
210
|
-
const min = parseFloat(paymentLink?.donation_settings?.amount.minimum || "0");
|
|
211
|
-
const max = paymentLink?.donation_settings?.amount.maximum ? parseFloat(paymentLink?.donation_settings?.amount.maximum) : Infinity;
|
|
212
110
|
const onChangeAmount = async ({ priceId, amount }) => {
|
|
213
|
-
if (Number(amount) < min || Number(amount) > max) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if (amount && formatAmountPrecisionLimit(String(amount), locale)) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
111
|
try {
|
|
220
112
|
const { data } = await api.put(`/api/checkout-sessions/${state.checkoutSession.id}/amount`, {
|
|
221
113
|
priceId,
|
|
@@ -231,112 +123,215 @@ export function PaymentInner({
|
|
|
231
123
|
setState({ checkoutSession: result.checkoutSession });
|
|
232
124
|
onPaid(result);
|
|
233
125
|
};
|
|
234
|
-
return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsxs(
|
|
235
|
-
|
|
236
|
-
|
|
126
|
+
return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: [
|
|
127
|
+
/* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-overview base-card", direction: "column", children: [
|
|
128
|
+
/* @__PURE__ */ jsx(
|
|
129
|
+
PaymentSummary,
|
|
130
|
+
{
|
|
131
|
+
items: state.checkoutSession.line_items,
|
|
132
|
+
trialInDays: state.checkoutSession.subscription_data?.trial_period_days || 0,
|
|
133
|
+
billingThreshold: Math.max(
|
|
134
|
+
state.checkoutSession.subscription_data?.billing_threshold_amount || 0,
|
|
135
|
+
// @ts-ignore
|
|
136
|
+
state.checkoutSession.subscription_data?.min_stake_amount || 0
|
|
137
|
+
),
|
|
138
|
+
showStaking: method.type === "arcblock",
|
|
139
|
+
currency,
|
|
140
|
+
onUpsell,
|
|
141
|
+
onDownsell,
|
|
142
|
+
onApplyCrossSell,
|
|
143
|
+
onCancelCrossSell,
|
|
144
|
+
onChangeAmount,
|
|
145
|
+
checkoutSessionId: state.checkoutSession.id,
|
|
146
|
+
crossSellBehavior: state.checkoutSession.cross_sell_behavior,
|
|
147
|
+
donationSettings: paymentLink?.donation_settings,
|
|
148
|
+
action
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
mode === "standalone" && !isMobile && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer", sx: { color: "var(--foregrounds-fg-muted, #98A3B1)" } })
|
|
152
|
+
] }) }),
|
|
153
|
+
/* @__PURE__ */ jsxs(Stack, { className: "cko-payment base-card", direction: "column", spacing: { xs: 2, sm: 3 }, children: [
|
|
154
|
+
completed && /* @__PURE__ */ jsx(
|
|
155
|
+
PaymentSuccess,
|
|
156
|
+
{
|
|
157
|
+
mode,
|
|
158
|
+
payee: getStatementDescriptor(state.checkoutSession.line_items),
|
|
159
|
+
action: state.checkoutSession.mode,
|
|
160
|
+
invoiceId: state.checkoutSession.invoice_id,
|
|
161
|
+
subscriptionId: state.checkoutSession.subscription_id,
|
|
162
|
+
message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(
|
|
163
|
+
`payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
!completed && /* @__PURE__ */ jsx(
|
|
168
|
+
PaymentForm,
|
|
169
|
+
{
|
|
170
|
+
checkoutSession: state.checkoutSession,
|
|
171
|
+
paymentMethods,
|
|
172
|
+
paymentIntent,
|
|
173
|
+
paymentLink,
|
|
174
|
+
customer,
|
|
175
|
+
onPaid: handlePaid,
|
|
176
|
+
onError,
|
|
177
|
+
mode,
|
|
178
|
+
action
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] }),
|
|
182
|
+
mode === "standalone" && isMobile && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer", sx: { color: "var(--foregrounds-fg-muted, #98A3B1)" } })
|
|
183
|
+
] }) });
|
|
184
|
+
}
|
|
185
|
+
Payment.defaultProps = {
|
|
186
|
+
completed: false,
|
|
187
|
+
error: null
|
|
188
|
+
};
|
|
189
|
+
export default function Payment({
|
|
190
|
+
checkoutSession,
|
|
191
|
+
paymentMethods,
|
|
192
|
+
paymentIntent,
|
|
193
|
+
paymentLink,
|
|
194
|
+
customer,
|
|
195
|
+
completed,
|
|
196
|
+
// error,
|
|
197
|
+
mode,
|
|
198
|
+
onPaid,
|
|
199
|
+
onError,
|
|
200
|
+
onChange,
|
|
201
|
+
goBack,
|
|
202
|
+
action
|
|
203
|
+
}) {
|
|
204
|
+
const { t } = useLocaleContext();
|
|
205
|
+
const { refresh, livemode, setLivemode } = usePaymentContext();
|
|
206
|
+
const [delay, setDelay] = useState(false);
|
|
207
|
+
useEffect(() => {
|
|
208
|
+
setTimeout(() => {
|
|
209
|
+
setDelay(true);
|
|
210
|
+
}, 500);
|
|
211
|
+
}, []);
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
if (checkoutSession) {
|
|
214
|
+
if (livemode !== checkoutSession.livemode) {
|
|
215
|
+
setLivemode(checkoutSession.livemode);
|
|
216
|
+
setTimeout(() => {
|
|
217
|
+
refresh();
|
|
218
|
+
}, 10);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}, [checkoutSession, livemode, setLivemode, refresh]);
|
|
222
|
+
const renderContent = () => {
|
|
223
|
+
if (!checkoutSession || !delay) {
|
|
224
|
+
return /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: [
|
|
225
|
+
/* @__PURE__ */ jsx(Stack, { className: "cko-overview base-card", children: /* @__PURE__ */ jsx(Box, { className: "cko-product", children: /* @__PURE__ */ jsx(OverviewSkeleton, {}) }) }),
|
|
226
|
+
/* @__PURE__ */ jsx(Stack, { className: "cko-payment base-card", children: /* @__PURE__ */ jsx(PaymentSkeleton, {}) })
|
|
227
|
+
] });
|
|
228
|
+
}
|
|
229
|
+
if (checkoutSession.expires_at <= Math.round(Date.now() / 1e3)) {
|
|
230
|
+
return /* @__PURE__ */ jsx(
|
|
231
|
+
PaymentError,
|
|
232
|
+
{
|
|
233
|
+
mode,
|
|
234
|
+
title: t("payment.checkout.expired.title"),
|
|
235
|
+
description: t("payment.checkout.expired.description")
|
|
236
|
+
}
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
if (!checkoutSession.line_items.length) {
|
|
240
|
+
return /* @__PURE__ */ jsx(
|
|
241
|
+
PaymentError,
|
|
242
|
+
{
|
|
243
|
+
mode,
|
|
244
|
+
title: t("payment.checkout.emptyItems.title"),
|
|
245
|
+
description: t("payment.checkout.emptyItems.description")
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
return /* @__PURE__ */ jsx(
|
|
250
|
+
PaymentInner,
|
|
237
251
|
{
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
252
|
+
checkoutSession,
|
|
253
|
+
paymentMethods,
|
|
254
|
+
paymentLink,
|
|
255
|
+
paymentIntent,
|
|
256
|
+
completed: completed || checkoutSession.status === "complete",
|
|
257
|
+
customer,
|
|
258
|
+
onPaid,
|
|
259
|
+
onError,
|
|
260
|
+
onChange,
|
|
261
|
+
goBack,
|
|
262
|
+
mode,
|
|
263
|
+
action
|
|
241
264
|
}
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
// @ts-ignore
|
|
254
|
-
state.checkoutSession.subscription_data?.min_stake_amount || 0
|
|
255
|
-
),
|
|
256
|
-
showStaking: method.type === "arcblock",
|
|
257
|
-
currency,
|
|
258
|
-
onUpsell,
|
|
259
|
-
onDownsell,
|
|
260
|
-
onApplyCrossSell,
|
|
261
|
-
onCancelCrossSell,
|
|
262
|
-
onChangeAmount,
|
|
263
|
-
checkoutSessionId: state.checkoutSession.id,
|
|
264
|
-
crossSellBehavior: state.checkoutSession.cross_sell_behavior,
|
|
265
|
-
donationSettings: paymentLink?.donation_settings,
|
|
266
|
-
action
|
|
267
|
-
}
|
|
268
|
-
)
|
|
269
|
-
] }) }),
|
|
270
|
-
/* @__PURE__ */ jsxs(Stack, { className: "cko-payment", direction: "column", spacing: { xs: 2, sm: 3 }, children: [
|
|
271
|
-
completed && /* @__PURE__ */ jsx(
|
|
272
|
-
PaymentSuccess,
|
|
273
|
-
{
|
|
274
|
-
mode,
|
|
275
|
-
payee: getStatementDescriptor(state.checkoutSession.line_items),
|
|
276
|
-
action: state.checkoutSession.mode,
|
|
277
|
-
invoiceId: state.checkoutSession.invoice_id,
|
|
278
|
-
subscriptionId: state.checkoutSession.subscription_id,
|
|
279
|
-
message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(
|
|
280
|
-
`payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`
|
|
281
|
-
)
|
|
282
|
-
}
|
|
283
|
-
),
|
|
284
|
-
!completed && /* @__PURE__ */ jsx(
|
|
285
|
-
PaymentForm,
|
|
265
|
+
);
|
|
266
|
+
};
|
|
267
|
+
return /* @__PURE__ */ jsxs(
|
|
268
|
+
Stack,
|
|
269
|
+
{
|
|
270
|
+
display: "flex",
|
|
271
|
+
flexDirection: "column",
|
|
272
|
+
sx: { height: mode === "standalone" ? "100vh" : "auto", overflow: "hidden" },
|
|
273
|
+
children: [
|
|
274
|
+
mode === "standalone" ? /* @__PURE__ */ jsx(
|
|
275
|
+
Header,
|
|
286
276
|
{
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
action
|
|
277
|
+
meta: void 0,
|
|
278
|
+
addons: void 0,
|
|
279
|
+
sessionManagerProps: void 0,
|
|
280
|
+
homeLink: void 0,
|
|
281
|
+
theme: void 0,
|
|
282
|
+
hideNavMenu: void 0,
|
|
283
|
+
maxWidth: false,
|
|
284
|
+
sx: { borderBottom: "1px solid var(--stroke-border-base, #EFF1F5)" }
|
|
296
285
|
}
|
|
297
|
-
)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
286
|
+
) : null,
|
|
287
|
+
/* @__PURE__ */ jsxs(Root, { mode, sx: { flex: 1 }, children: [
|
|
288
|
+
goBack && /* @__PURE__ */ jsx(
|
|
289
|
+
ArrowBackOutlined,
|
|
290
|
+
{
|
|
291
|
+
sx: { mr: 0.5, color: "text.secondary", alignSelf: "flex-start", margin: "16px 0", cursor: "pointer" },
|
|
292
|
+
onClick: goBack,
|
|
293
|
+
fontSize: "medium"
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
/* @__PURE__ */ jsx(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: renderContent() })
|
|
297
|
+
] })
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
);
|
|
302
301
|
}
|
|
303
302
|
export const Root = styled(Box)`
|
|
304
303
|
box-sizing: border-box;
|
|
305
304
|
display: flex;
|
|
306
305
|
flex-direction: column;
|
|
307
|
-
justify-content: center;
|
|
306
|
+
// justify-content: center;
|
|
308
307
|
align-items: center;
|
|
309
|
-
|
|
308
|
+
overflow: hidden;
|
|
309
|
+
// min-height: ${(props) => props.mode === "standalone" ? "100vh" : "auto"};
|
|
310
310
|
position: relative;
|
|
311
|
-
|
|
312
|
-
${(props) => props.mode === "standalone" ? `&:before {
|
|
313
|
-
animation-fill-mode: both;
|
|
314
|
-
background: #ffffff;
|
|
315
|
-
content: '';
|
|
316
|
-
height: 100%;
|
|
317
|
-
position: fixed;
|
|
318
|
-
right: 0;
|
|
319
|
-
top: 0;
|
|
320
|
-
transform-origin: right;
|
|
321
|
-
width: 50%;
|
|
322
|
-
box-shadow: 15px 0 30px 0 rgba(0, 0, 0, 0.18);
|
|
323
|
-
}` : ""}
|
|
324
|
-
|
|
325
311
|
.cko-container {
|
|
312
|
+
overflow: hidden;
|
|
326
313
|
width: 100%;
|
|
327
|
-
max-width: ${(props) => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
|
|
314
|
+
// max-width: ${(props) => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
|
|
328
315
|
display: flex;
|
|
329
316
|
flex-direction: row;
|
|
330
|
-
justify-content:
|
|
317
|
+
justify-content: center;
|
|
318
|
+
// gap: 4px;
|
|
331
319
|
position: relative;
|
|
332
|
-
|
|
320
|
+
flex: 1;
|
|
321
|
+
padding: 1px;
|
|
322
|
+
// padding: ${(props) => props.mode === "standalone" ? "0 16px" : "0"};
|
|
333
323
|
}
|
|
334
324
|
|
|
335
325
|
.cko-overview {
|
|
336
|
-
width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
|
|
337
|
-
min-height: ${(props) => props.mode === "standalone" ? "540px" : "auto"};
|
|
326
|
+
// width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
|
|
327
|
+
// min-height: ${(props) => props.mode === "standalone" ? "540px" : "auto"};
|
|
338
328
|
position: relative;
|
|
339
329
|
display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "block"};
|
|
330
|
+
background: var(--backgrounds-bg-base);
|
|
331
|
+
min-height: 'auto';
|
|
332
|
+
// width: 502px;
|
|
333
|
+
display: flex;
|
|
334
|
+
flex-direction: column;
|
|
340
335
|
}
|
|
341
336
|
.cko-header {
|
|
342
337
|
left: 0;
|
|
@@ -349,7 +344,8 @@ export const Root = styled(Box)`
|
|
|
349
344
|
box-shadow 0.15s ease-out;
|
|
350
345
|
}
|
|
351
346
|
.cko-product {
|
|
352
|
-
|
|
347
|
+
flex: 1;
|
|
348
|
+
overflow: hidden;
|
|
353
349
|
}
|
|
354
350
|
.cko-product-summary {
|
|
355
351
|
width: 100%;
|
|
@@ -361,30 +357,60 @@ export const Root = styled(Box)`
|
|
|
361
357
|
text-overflow: ellipsis;
|
|
362
358
|
}
|
|
363
359
|
|
|
360
|
+
.base-card {
|
|
361
|
+
border: none;
|
|
362
|
+
border-radius: 0;
|
|
363
|
+
padding: ${(props) => props.mode === "standalone" ? "100px 40px 20px" : "20px 0"};
|
|
364
|
+
box-shadow: none;
|
|
365
|
+
flex: 1;
|
|
366
|
+
max-width: 582px;
|
|
367
|
+
}
|
|
368
|
+
|
|
364
369
|
.cko-payment {
|
|
365
|
-
width:
|
|
366
|
-
.
|
|
367
|
-
|
|
370
|
+
width: 502px;
|
|
371
|
+
// width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
|
|
372
|
+
// box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
|
|
373
|
+
padding-left: ${(props) => props.mode === "standalone" ? "40px" : "20px"};
|
|
374
|
+
position: relative;
|
|
375
|
+
&:before {
|
|
376
|
+
-webkit-animation-fill-mode: both;
|
|
377
|
+
content: '';
|
|
378
|
+
height: 100%;
|
|
379
|
+
position: absolute;
|
|
380
|
+
left: 0px;
|
|
381
|
+
top: 0px;
|
|
382
|
+
transform-origin: left center;
|
|
383
|
+
width: 8px;
|
|
384
|
+
box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
|
|
368
385
|
}
|
|
369
386
|
}
|
|
387
|
+
.cko-payment-contact {
|
|
388
|
+
overflow: hidden;
|
|
389
|
+
}
|
|
390
|
+
.cko-footer {
|
|
391
|
+
display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "block"};
|
|
392
|
+
text-align: center;
|
|
393
|
+
margin-top: 20px;
|
|
394
|
+
}
|
|
370
395
|
|
|
371
396
|
.cko-payment-form {
|
|
372
|
-
.MuiInputAdornment-positionStart {
|
|
373
|
-
|
|
374
|
-
}
|
|
397
|
+
// .MuiInputAdornment-positionStart {
|
|
398
|
+
// width: 50px;
|
|
399
|
+
// }
|
|
375
400
|
|
|
401
|
+
.MuiFormLabel-root {
|
|
402
|
+
color: var(--foregrounds-fg-base, #010714);
|
|
403
|
+
font-weight: 500;
|
|
404
|
+
margin-top: 12px;
|
|
405
|
+
margin-bottom: 4px;
|
|
406
|
+
}
|
|
376
407
|
.MuiBox-root {
|
|
377
|
-
border: 1px solid #ccc;
|
|
378
408
|
margin: -1px 0 0 -1px;
|
|
379
409
|
}
|
|
380
410
|
|
|
381
411
|
.MuiFormHelperText-root {
|
|
382
412
|
margin-left: 14px;
|
|
383
413
|
}
|
|
384
|
-
|
|
385
|
-
.MuiOutlinedInput-notchedOutline {
|
|
386
|
-
border: none;
|
|
387
|
-
}
|
|
388
414
|
}
|
|
389
415
|
|
|
390
416
|
.cko-payment-methods {
|
|
@@ -392,9 +418,9 @@ export const Root = styled(Box)`
|
|
|
392
418
|
|
|
393
419
|
.cko-payment-submit {
|
|
394
420
|
.MuiButtonBase-root {
|
|
395
|
-
border-radius: 0;
|
|
396
421
|
font-size: 1.3rem;
|
|
397
422
|
position: relative;
|
|
423
|
+
padding: 4px 22px;
|
|
398
424
|
}
|
|
399
425
|
|
|
400
426
|
.cko-submit-progress {
|
|
@@ -409,15 +435,28 @@ export const Root = styled(Box)`
|
|
|
409
435
|
.cko-header {
|
|
410
436
|
}
|
|
411
437
|
|
|
412
|
-
.
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
438
|
+
.product-item {
|
|
439
|
+
border-radius: var(--radius-l, 12px);
|
|
440
|
+
border: 1px solid var(--stroke-border-base, #eff1f5);
|
|
441
|
+
.product-item-content {
|
|
442
|
+
padding: 16px;
|
|
443
|
+
background: var(--backgrounds-bg-subtle, #f9fafb);
|
|
444
|
+
border-top-left-radius: var(--radius-l, 12px);
|
|
445
|
+
border-top-right-radius: var(--radius-l, 12px);
|
|
446
|
+
}
|
|
447
|
+
.product-item-upsell {
|
|
448
|
+
margin-top: 0;
|
|
449
|
+
padding: 16px;
|
|
450
|
+
background: var(--backgrounds-bg-component, #f1f3f5);
|
|
451
|
+
border-bottom-left-radius: var(--radius-l, 12px);
|
|
452
|
+
border-bottom-right-radius: var(--radius-l, 12px);
|
|
453
|
+
}
|
|
418
454
|
}
|
|
419
455
|
|
|
420
456
|
@media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
|
|
457
|
+
background: ${(props) => props.mode === "standalone" ? "var(--backgrounds-bg-subtle, #F9FAFB)" : "transparent"};
|
|
458
|
+
padding-top: 0;
|
|
459
|
+
overflow: auto;
|
|
421
460
|
&:before {
|
|
422
461
|
display: none;
|
|
423
462
|
}
|
|
@@ -427,18 +466,34 @@ export const Root = styled(Box)`
|
|
|
427
466
|
gap: 32px;
|
|
428
467
|
min-width: 350px;
|
|
429
468
|
max-width: 400px;
|
|
469
|
+
overflow: visible;
|
|
430
470
|
}
|
|
431
471
|
.cko-overview {
|
|
432
472
|
width: 100%;
|
|
433
473
|
min-height: auto;
|
|
474
|
+
flex: none;
|
|
434
475
|
}
|
|
435
476
|
.cko-payment {
|
|
436
477
|
width: 100%;
|
|
478
|
+
height: fit-content;
|
|
479
|
+
flex: none;
|
|
480
|
+
&:before {
|
|
481
|
+
display: none;
|
|
482
|
+
}
|
|
437
483
|
}
|
|
438
484
|
|
|
439
485
|
.cko-footer {
|
|
440
|
-
position:
|
|
486
|
+
position: relative;
|
|
487
|
+
margin-bottom: 4px;
|
|
441
488
|
margin-top: 0;
|
|
489
|
+
bottom: 0;
|
|
490
|
+
left: 0;
|
|
491
|
+
transform: translateX(0);
|
|
492
|
+
}
|
|
493
|
+
.base-card {
|
|
494
|
+
box-shadow: none;
|
|
495
|
+
border-radius: 0;
|
|
496
|
+
padding: 20px;
|
|
442
497
|
}
|
|
443
498
|
}
|
|
444
499
|
`;
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Avatar, Stack, Typography } from "@mui/material";
|
|
3
3
|
export default function ProductCard({ size, variant, name, logo, description, extra }) {
|
|
4
4
|
const s = { width: size, height: size };
|
|
5
|
-
return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "
|
|
5
|
+
return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, flex: 2, sx: { width: "100%" }, children: [
|
|
6
6
|
logo ? (
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
/* @__PURE__ */ jsx(Avatar, { src: logo, alt: name, variant, sx: s })
|
|
@@ -24,7 +24,7 @@ export default function ProductCard({ size, variant, name, logo, description, ex
|
|
|
24
24
|
className: "cko-ellipsis",
|
|
25
25
|
variant: "body1",
|
|
26
26
|
title: name,
|
|
27
|
-
sx: { fontWeight: 500, mb: 0.5, lineHeight: 1 },
|
|
27
|
+
sx: { fontWeight: 500, mb: 0.5, lineHeight: 1, fontSize: 16 },
|
|
28
28
|
color: "text.primary",
|
|
29
29
|
children: name
|
|
30
30
|
}
|
|
@@ -35,11 +35,11 @@ export default function ProductCard({ size, variant, name, logo, description, ex
|
|
|
35
35
|
variant: "body1",
|
|
36
36
|
title: description,
|
|
37
37
|
sx: { fontSize: "0.85rem", mb: 0.5, lineHeight: 1, textAlign: "left" },
|
|
38
|
-
color: "text.
|
|
38
|
+
color: "text.lighter",
|
|
39
39
|
children: description
|
|
40
40
|
}
|
|
41
41
|
),
|
|
42
|
-
extra && /* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { fontSize: "0.85rem" }, color: "text.
|
|
42
|
+
extra && /* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { fontSize: "0.85rem" }, color: "text.lighter", children: extra })
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
)
|