@blocklet/payment-react 1.18.6 → 1.18.8
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/README.md +394 -341
- package/es/checkout/donate.d.ts +29 -4
- package/es/checkout/donate.js +193 -95
- package/es/components/livemode.js +1 -1
- package/es/components/loading-button.d.ts +10 -0
- package/es/components/loading-button.js +75 -0
- package/es/components/pricing-table.js +2 -3
- package/es/components/table.js +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +3 -1
- package/es/libs/util.d.ts +1 -0
- package/es/libs/util.js +10 -1
- package/es/payment/amount.js +1 -1
- package/es/payment/form/index.js +14 -12
- package/es/payment/form/stripe/form.js +20 -5
- package/es/payment/index.js +0 -1
- package/es/payment/product-card.js +2 -2
- package/es/payment/product-item.js +1 -1
- package/es/payment/product-skeleton.js +2 -2
- package/es/payment/skeleton/donation.js +1 -1
- package/es/payment/skeleton/overview.js +1 -1
- package/es/payment/skeleton/payment.js +1 -1
- package/es/payment/summary.js +2 -2
- package/es/theme/index.js +5 -3
- package/es/theme/typography.js +8 -8
- package/lib/checkout/donate.d.ts +29 -4
- package/lib/checkout/donate.js +197 -136
- package/lib/components/livemode.js +1 -1
- package/lib/components/loading-button.d.ts +10 -0
- package/lib/components/loading-button.js +86 -0
- package/lib/components/pricing-table.js +3 -4
- package/lib/components/table.js +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -0
- package/lib/libs/util.d.ts +1 -0
- package/lib/libs/util.js +7 -0
- package/lib/payment/amount.js +1 -1
- package/lib/payment/form/index.js +14 -15
- package/lib/payment/form/stripe/form.js +25 -6
- package/lib/payment/index.js +0 -1
- package/lib/payment/product-card.js +2 -2
- package/lib/payment/product-item.js +1 -1
- package/lib/payment/product-skeleton.js +2 -2
- package/lib/payment/skeleton/donation.js +1 -1
- package/lib/payment/skeleton/overview.js +1 -1
- package/lib/payment/skeleton/payment.js +1 -1
- package/lib/payment/summary.js +4 -4
- package/lib/theme/index.js +5 -3
- package/lib/theme/typography.js +8 -8
- package/package.json +8 -8
- package/src/checkout/donate.tsx +209 -128
- package/src/components/livemode.tsx +1 -1
- package/src/components/loading-button.tsx +100 -0
- package/src/components/pricing-table.tsx +3 -3
- package/src/components/table.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/libs/util.ts +11 -1
- package/src/payment/amount.tsx +1 -1
- package/src/payment/form/index.tsx +65 -60
- package/src/payment/form/stripe/form.tsx +21 -6
- package/src/payment/index.tsx +0 -1
- package/src/payment/product-card.tsx +2 -2
- package/src/payment/product-item.tsx +1 -1
- package/src/payment/product-skeleton.tsx +2 -2
- package/src/payment/skeleton/donation.tsx +1 -1
- package/src/payment/skeleton/overview.tsx +1 -1
- package/src/payment/skeleton/payment.tsx +1 -1
- package/src/payment/summary.tsx +2 -2
- package/src/theme/index.tsx +3 -1
- package/src/theme/typography.ts +8 -8
package/es/payment/form/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import PhoneInput from "./phone.js";
|
|
|
30
30
|
import StripeCheckout from "./stripe/index.js";
|
|
31
31
|
import { useMobile } from "../../hooks/mobile.js";
|
|
32
32
|
import { validatePhoneNumber } from "../../libs/phone-validator.js";
|
|
33
|
+
import LoadingButton from "../../components/loading-button.js";
|
|
33
34
|
export const waitForCheckoutComplete = async (sessionId) => {
|
|
34
35
|
let result;
|
|
35
36
|
await pWaitFor(
|
|
@@ -143,7 +144,7 @@ export default function PaymentForm({
|
|
|
143
144
|
}, [paymentCurrencyIndex, currencies, setValue]);
|
|
144
145
|
const paymentMethod = useWatch({ control, name: "payment_method" });
|
|
145
146
|
const afterUserLoggedIn = useMemoizedFn(() => {
|
|
146
|
-
if (hasDidWallet(session.user)) {
|
|
147
|
+
if (hasDidWallet(session.user) || skipBindWallet) {
|
|
147
148
|
handleSubmit(onFormSubmit, onFormError)();
|
|
148
149
|
} else {
|
|
149
150
|
session.bindWallet(() => {
|
|
@@ -166,6 +167,8 @@ export default function PaymentForm({
|
|
|
166
167
|
}
|
|
167
168
|
buttonText = session?.user ? buttonText : t("payment.checkout.connect", { action: buttonText });
|
|
168
169
|
const method = paymentMethods.find((x) => x.id === paymentMethod);
|
|
170
|
+
const showForm = session?.user;
|
|
171
|
+
const skipBindWallet = method.type === "stripe";
|
|
169
172
|
const handleConnected = async () => {
|
|
170
173
|
try {
|
|
171
174
|
const result = await waitForCheckoutComplete(checkoutSession.id);
|
|
@@ -292,6 +295,10 @@ export default function PaymentForm({
|
|
|
292
295
|
errorRef.current.scrollIntoView({ behavior: "smooth" });
|
|
293
296
|
}
|
|
294
297
|
if (session?.user) {
|
|
298
|
+
if (skipBindWallet) {
|
|
299
|
+
handleSubmit(onFormSubmit, onFormError)();
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
295
302
|
if (hasDidWallet(session.user)) {
|
|
296
303
|
handleSubmit(onFormSubmit, onFormError)();
|
|
297
304
|
} else {
|
|
@@ -406,7 +413,7 @@ export default function PaymentForm({
|
|
|
406
413
|
}
|
|
407
414
|
)
|
|
408
415
|
] }) }),
|
|
409
|
-
/* @__PURE__ */ jsxs(
|
|
416
|
+
showForm && /* @__PURE__ */ jsxs(
|
|
410
417
|
Stack,
|
|
411
418
|
{
|
|
412
419
|
direction: "column",
|
|
@@ -474,28 +481,23 @@ export default function PaymentForm({
|
|
|
474
481
|
] }) }),
|
|
475
482
|
/* @__PURE__ */ jsx(Divider, { sx: { mt: 2.5, mb: 2.5 } }),
|
|
476
483
|
/* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-payment-submit", children: [
|
|
477
|
-
/* @__PURE__ */ jsx(Box, { className: "cko-payment-submit-btn", children: /* @__PURE__ */
|
|
478
|
-
|
|
484
|
+
/* @__PURE__ */ jsx(Box, { className: "cko-payment-submit-btn", children: /* @__PURE__ */ jsx(
|
|
485
|
+
LoadingButton,
|
|
479
486
|
{
|
|
480
487
|
variant: "contained",
|
|
481
488
|
color: "primary",
|
|
482
489
|
size: "large",
|
|
483
490
|
className: "cko-submit-button",
|
|
484
491
|
onClick: () => {
|
|
485
|
-
if (state.submitting || state.paying) {
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
492
|
onAction();
|
|
489
493
|
},
|
|
490
494
|
fullWidth: true,
|
|
495
|
+
loading: state.submitting || state.paying,
|
|
491
496
|
disabled: state.stripePaying || !quantityInventoryStatus || !payable,
|
|
492
|
-
children:
|
|
493
|
-
(state.submitting || state.paying) && /* @__PURE__ */ jsx(CircularProgress, { size: 16, sx: { mr: 0.5, color: "var(--foregrounds-fg-on-color, #fff)" } }),
|
|
494
|
-
state.submitting || state.paying ? t("payment.checkout.processing") : buttonText
|
|
495
|
-
]
|
|
497
|
+
children: state.submitting || state.paying ? t("payment.checkout.processing") : buttonText
|
|
496
498
|
}
|
|
497
499
|
) }),
|
|
498
|
-
["subscription", "setup"].includes(checkoutSession.mode) && /* @__PURE__ */ jsx(Typography, { sx: { mt: 2.5, color: "text.lighter", fontSize: "0.
|
|
500
|
+
["subscription", "setup"].includes(checkoutSession.mode) && /* @__PURE__ */ jsx(Typography, { sx: { mt: 2.5, color: "text.lighter", fontSize: "0.7875rem", lineHeight: "0.9625rem" }, children: t("payment.checkout.confirm", { payee }) })
|
|
499
501
|
] }) }),
|
|
500
502
|
state.customerLimited && /* @__PURE__ */ jsx(
|
|
501
503
|
ConfirmDialog,
|
|
@@ -2,11 +2,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import Center from "@arcblock/ux/lib/Center";
|
|
3
3
|
import Dialog from "@arcblock/ux/lib/Dialog";
|
|
4
4
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
5
|
-
import { LoadingButton } from "@mui/lab";
|
|
6
5
|
import { CircularProgress, Typography } from "@mui/material";
|
|
7
6
|
import { styled } from "@mui/system";
|
|
8
7
|
import { useSetState } from "ahooks";
|
|
9
8
|
import { useEffect, useCallback } from "react";
|
|
9
|
+
import { useMobile } from "../../../hooks/mobile.js";
|
|
10
|
+
import LoadingButton from "../../../components/loading-button.js";
|
|
10
11
|
const { Elements, PaymentElement, useElements, useStripe, loadStripe } = globalThis.__STRIPE_COMPONENTS__;
|
|
11
12
|
function StripeCheckoutForm({
|
|
12
13
|
clientSecret,
|
|
@@ -101,11 +102,10 @@ function StripeCheckoutForm({
|
|
|
101
102
|
LoadingButton,
|
|
102
103
|
{
|
|
103
104
|
fullWidth: true,
|
|
104
|
-
sx: { mt: 2, mb: 1, borderRadius: 0, fontSize: "
|
|
105
|
+
sx: { mt: 2, mb: 1, borderRadius: 0, fontSize: "0.875rem" },
|
|
105
106
|
type: "submit",
|
|
106
107
|
disabled: state.confirming || !state.loaded,
|
|
107
108
|
loading: state.confirming,
|
|
108
|
-
loadingPosition: "end",
|
|
109
109
|
variant: "contained",
|
|
110
110
|
color: "primary",
|
|
111
111
|
size: "large",
|
|
@@ -135,7 +135,8 @@ export default function StripeCheckout({
|
|
|
135
135
|
returnUrl = ""
|
|
136
136
|
}) {
|
|
137
137
|
const stripePromise = loadStripe(publicKey);
|
|
138
|
-
const {
|
|
138
|
+
const { isMobile } = useMobile();
|
|
139
|
+
const { t, locale } = useLocaleContext();
|
|
139
140
|
const [state, setState] = useSetState({
|
|
140
141
|
open: true,
|
|
141
142
|
closable: true
|
|
@@ -155,7 +156,21 @@ export default function StripeCheckout({
|
|
|
155
156
|
open: state.open,
|
|
156
157
|
onClose: handleClose,
|
|
157
158
|
disableEscapeKeyDown: true,
|
|
158
|
-
|
|
159
|
+
sx: {
|
|
160
|
+
".StripeElement": {
|
|
161
|
+
minWidth: isMobile ? "100%" : "500px",
|
|
162
|
+
py: 1
|
|
163
|
+
},
|
|
164
|
+
form: {
|
|
165
|
+
justifyContent: "flex-start"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
PaperProps: {
|
|
169
|
+
style: {
|
|
170
|
+
minWidth: isMobile ? "100%" : "500px"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
children: /* @__PURE__ */ jsx(Elements, { options: { clientSecret, locale: locale === "zh" ? "zh-CN" : "en" }, stripe: stripePromise, children: /* @__PURE__ */ jsx(
|
|
159
174
|
StripeCheckoutForm,
|
|
160
175
|
{
|
|
161
176
|
clientSecret,
|
package/es/payment/index.js
CHANGED
|
@@ -34,12 +34,12 @@ export default function ProductCard({ size, variant, name, logo, description, ex
|
|
|
34
34
|
{
|
|
35
35
|
variant: "body1",
|
|
36
36
|
title: description,
|
|
37
|
-
sx: { fontSize: "0.
|
|
37
|
+
sx: { fontSize: "0.74375rem", mb: 0.5, lineHeight: 1.2, textAlign: "left" },
|
|
38
38
|
color: "text.lighter",
|
|
39
39
|
children: description
|
|
40
40
|
}
|
|
41
41
|
),
|
|
42
|
-
extra && /* @__PURE__ */ jsx(Box, { sx: { fontSize: "0.
|
|
42
|
+
extra && /* @__PURE__ */ jsx(Box, { sx: { fontSize: "0.74375rem" }, color: "text.lighter", children: extra })
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
)
|
|
@@ -65,7 +65,7 @@ export default function ProductItem({
|
|
|
65
65
|
),
|
|
66
66
|
/* @__PURE__ */ jsxs(Stack, { direction: "column", alignItems: "flex-end", flex: 1, children: [
|
|
67
67
|
/* @__PURE__ */ jsx(Typography, { sx: { color: "text.primary", fontWeight: 500, whiteSpace: "nowrap" }, gutterBottom: true, children: primaryText }),
|
|
68
|
-
pricing.secondary && /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.
|
|
68
|
+
pricing.secondary && /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.74375rem", color: "text.lighter" }, children: pricing.secondary })
|
|
69
69
|
] })
|
|
70
70
|
]
|
|
71
71
|
}
|
|
@@ -21,12 +21,12 @@ export default function ProductSkeleton({ count }) {
|
|
|
21
21
|
},
|
|
22
22
|
children: [
|
|
23
23
|
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h4", sx: { width: "50%" }, children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
|
24
|
-
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "
|
|
24
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "0.875rem", width: "60%" } }),
|
|
25
25
|
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h3", sx: { width: "60%" }, children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
|
26
26
|
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h3", sx: { width: "100%" }, children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
|
27
27
|
Array.from({ length: count }).map((_, i) => (
|
|
28
28
|
// eslint-disable-next-line react/no-array-index-key
|
|
29
|
-
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "
|
|
29
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "0.875rem", width: "60%" } }, i)
|
|
30
30
|
))
|
|
31
31
|
]
|
|
32
32
|
}
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Divider, Fade, Skeleton, Stack } from "@mui/material";
|
|
3
3
|
export default function DonationSkeleton() {
|
|
4
4
|
return /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { direction: "column", children: [
|
|
5
|
-
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "
|
|
5
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "1.75rem", width: "40%" } }),
|
|
6
6
|
/* @__PURE__ */ jsx(Skeleton, { sx: { mt: 2 }, variant: "rounded", height: 40 }),
|
|
7
7
|
/* @__PURE__ */ jsx(
|
|
8
8
|
Divider,
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Fade, Skeleton, Stack, Typography } from "@mui/material";
|
|
3
3
|
export default function OverviewSkeleton() {
|
|
4
4
|
return /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { direction: "column", children: [
|
|
5
|
-
/* @__PURE__ */ jsx(Stack, { direction: "row", alignItems: "center", spacing: 2, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "
|
|
5
|
+
/* @__PURE__ */ jsx(Stack, { direction: "row", alignItems: "center", spacing: 2, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "1.75rem", width: "40%" } }) }),
|
|
6
6
|
/* @__PURE__ */ jsx(Skeleton, { sx: { mt: 2 }, variant: "rounded", height: 100 }),
|
|
7
7
|
/* @__PURE__ */ jsx(Typography, { mt: 2, component: "div", variant: "h4", children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
|
8
8
|
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h2", children: /* @__PURE__ */ jsx(Skeleton, {}) })
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Fade, Skeleton, Stack, Typography } from "@mui/material";
|
|
3
3
|
export default function PaymentSkeleton() {
|
|
4
4
|
return /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { direction: "column", children: [
|
|
5
|
-
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "
|
|
5
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "1.75rem", width: "40%" } }),
|
|
6
6
|
/* @__PURE__ */ jsx(Skeleton, { sx: { mt: 2 }, variant: "rounded", height: 68 }),
|
|
7
7
|
/* @__PURE__ */ jsxs(Box, { mt: 1, children: [
|
|
8
8
|
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h4", mb: -1, children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
package/es/payment/summary.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
3
3
|
import { HelpOutline } from "@mui/icons-material";
|
|
4
|
-
import { LoadingButton } from "@mui/lab";
|
|
5
4
|
import { Box, Divider, Fade, Grow, Stack, Tooltip, Typography, Collapse, IconButton } from "@mui/material";
|
|
6
5
|
import { BN, fromTokenToUnit, fromUnitToToken } from "@ocap/util";
|
|
7
6
|
import { useRequest, useSetState } from "ahooks";
|
|
@@ -18,6 +17,7 @@ import ProductItem from "./product-item.js";
|
|
|
18
17
|
import Livemode from "../components/livemode.js";
|
|
19
18
|
import { usePaymentContext } from "../contexts/payment.js";
|
|
20
19
|
import { useMobile } from "../hooks/mobile.js";
|
|
20
|
+
import LoadingButton from "../components/loading-button.js";
|
|
21
21
|
const ExpandMore = styled((props) => {
|
|
22
22
|
const { expand, ...other } = props;
|
|
23
23
|
return /* @__PURE__ */ jsx(IconButton, { ...other });
|
|
@@ -309,7 +309,7 @@ export default function PaymentSummary({
|
|
|
309
309
|
Typography,
|
|
310
310
|
{
|
|
311
311
|
component: "div",
|
|
312
|
-
sx: { fontSize: "0.
|
|
312
|
+
sx: { fontSize: "0.7875rem", color: "text.lighter", textAlign: "right", margin: "-2px 0 8px" },
|
|
313
313
|
children: headlines.then
|
|
314
314
|
}
|
|
315
315
|
)
|
package/es/theme/index.js
CHANGED
|
@@ -50,9 +50,10 @@ export function PaymentThemeProvider({
|
|
|
50
50
|
},
|
|
51
51
|
styleOverrides: {
|
|
52
52
|
root: {
|
|
53
|
-
fontSize: "
|
|
53
|
+
fontSize: "0.875rem",
|
|
54
54
|
fontWeight: 500,
|
|
55
|
-
textTransform: "none"
|
|
55
|
+
textTransform: "none",
|
|
56
|
+
boxShadow: "none"
|
|
56
57
|
},
|
|
57
58
|
containedPrimary: {
|
|
58
59
|
backgroundColor: "var(--buttons-button-inverted, #010714)",
|
|
@@ -97,7 +98,8 @@ export function PaymentThemeProvider({
|
|
|
97
98
|
MuiTab: {
|
|
98
99
|
styleOverrides: {
|
|
99
100
|
root: {
|
|
100
|
-
textTransform: "none"
|
|
101
|
+
textTransform: "none",
|
|
102
|
+
fontSize: "0.875rem"
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
},
|
package/es/theme/typography.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const typography = {
|
|
2
2
|
h1: {
|
|
3
|
-
fontSize: "1.
|
|
3
|
+
fontSize: "1.5rem",
|
|
4
4
|
lineHeight: 1.2,
|
|
5
5
|
fontWeight: 800,
|
|
6
6
|
letterSpacing: "-.025em"
|
|
@@ -12,38 +12,38 @@ export const typography = {
|
|
|
12
12
|
letterSpacing: "-.025em"
|
|
13
13
|
},
|
|
14
14
|
h3: {
|
|
15
|
-
fontSize: "1.
|
|
15
|
+
fontSize: "1.09375rem",
|
|
16
16
|
lineHeight: 1.4,
|
|
17
17
|
fontWeight: 600,
|
|
18
18
|
letterSpacing: "-.025em"
|
|
19
19
|
},
|
|
20
20
|
h4: {
|
|
21
|
-
fontSize: "1.
|
|
21
|
+
fontSize: "1.09375rem",
|
|
22
22
|
lineHeight: 1.5,
|
|
23
23
|
fontWeight: 600
|
|
24
24
|
},
|
|
25
25
|
h5: {
|
|
26
|
-
fontSize: "
|
|
26
|
+
fontSize: "0.875rem",
|
|
27
27
|
lineHeight: 1.75,
|
|
28
28
|
fontWeight: 400
|
|
29
29
|
},
|
|
30
30
|
h6: {
|
|
31
|
-
fontSize: "
|
|
31
|
+
fontSize: "0.875rem",
|
|
32
32
|
lineHeight: 1.75,
|
|
33
33
|
fontWeight: 400
|
|
34
34
|
},
|
|
35
35
|
subtitle1: {
|
|
36
|
-
fontSize: "
|
|
36
|
+
fontSize: "0.875rem",
|
|
37
37
|
lineHeight: 1.75,
|
|
38
38
|
fontWeight: 400
|
|
39
39
|
},
|
|
40
40
|
subtitle2: {
|
|
41
|
-
fontSize: "
|
|
41
|
+
fontSize: "0.875rem",
|
|
42
42
|
lineHeight: 1.75,
|
|
43
43
|
fontWeight: 400
|
|
44
44
|
},
|
|
45
45
|
body1: {
|
|
46
|
-
fontSize: "
|
|
46
|
+
fontSize: "0.875rem",
|
|
47
47
|
lineHeight: 1.75
|
|
48
48
|
},
|
|
49
49
|
fontWeightLight: 300,
|
package/lib/checkout/donate.d.ts
CHANGED
|
@@ -1,20 +1,45 @@
|
|
|
1
|
-
import type { DonationSettings, TCheckoutSessionExpanded, TPaymentCurrency, TPaymentMethod } from '@blocklet/payment-types';
|
|
1
|
+
import type { DonationSettings, PaymentBeneficiary, TCheckoutSessionExpanded, TPaymentCurrency, TPaymentMethod } from '@blocklet/payment-types';
|
|
2
2
|
import { type ButtonProps as MUIButtonProps } from '@mui/material';
|
|
3
3
|
import type { CheckoutProps, PaymentThemeOptions } from '../types';
|
|
4
4
|
export type DonateHistory = {
|
|
5
5
|
supporters: TCheckoutSessionExpanded[];
|
|
6
6
|
currency: TPaymentCurrency;
|
|
7
7
|
method: TPaymentMethod;
|
|
8
|
+
total?: number;
|
|
8
9
|
totalAmount: string;
|
|
9
10
|
};
|
|
10
|
-
export type
|
|
11
|
-
|
|
11
|
+
export type CheckoutDonateSettings = {
|
|
12
|
+
target: string;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
reference: string;
|
|
16
|
+
beneficiaries: PaymentBeneficiary[];
|
|
17
|
+
amount?: {
|
|
18
|
+
presets?: string[];
|
|
19
|
+
preset?: string;
|
|
20
|
+
minimum?: string;
|
|
21
|
+
maximum?: string;
|
|
22
|
+
custom?: boolean;
|
|
23
|
+
};
|
|
24
|
+
appearance?: {
|
|
25
|
+
button?: {
|
|
26
|
+
text?: any;
|
|
27
|
+
icon?: any;
|
|
28
|
+
size?: string;
|
|
29
|
+
color?: string;
|
|
30
|
+
variant?: string;
|
|
31
|
+
};
|
|
32
|
+
history?: {
|
|
33
|
+
variant?: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
12
37
|
export interface ButtonType extends Omit<MUIButtonProps, 'text' | 'icon'> {
|
|
13
38
|
text?: string | React.ReactNode;
|
|
14
39
|
icon: React.ReactNode;
|
|
15
40
|
}
|
|
16
41
|
export type DonateProps = Pick<CheckoutProps, 'onPaid' | 'onError'> & {
|
|
17
|
-
settings:
|
|
42
|
+
settings: CheckoutDonateSettings;
|
|
18
43
|
livemode?: boolean;
|
|
19
44
|
timeout?: number;
|
|
20
45
|
mode?: 'inline' | 'default' | 'custom';
|