@blocklet/payment-react 1.18.56 → 1.19.0
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 +1 -15
- package/es/checkout/donate.js +301 -189
- package/es/checkout/form.d.ts +1 -15
- package/es/checkout/form.js +5 -13
- package/es/checkout/table.js +3 -3
- package/es/components/blockchain/gas.d.ts +1 -5
- package/es/components/blockchain/gas.js +10 -2
- package/es/components/blockchain/tx.d.ts +1 -8
- package/es/components/blockchain/tx.js +28 -7
- package/es/components/confirm.d.ts +1 -10
- package/es/components/confirm.js +4 -10
- package/es/components/country-select.d.ts +3 -2
- package/es/components/country-select.js +375 -352
- package/es/components/input.d.ts +11 -20
- package/es/components/input.js +46 -43
- package/es/components/lazy-loader.js +1 -2
- package/es/components/link.d.ts +2 -9
- package/es/components/link.js +9 -6
- package/es/components/livemode.d.ts +2 -8
- package/es/components/livemode.js +1 -5
- package/es/components/loading-button.d.ts +6 -1
- package/es/components/loading-button.js +56 -66
- package/es/components/over-due-invoice-payment.d.ts +0 -18
- package/es/components/over-due-invoice-payment.js +138 -95
- package/es/components/payment-beneficiaries.d.ts +2 -7
- package/es/components/payment-beneficiaries.js +86 -40
- package/es/components/pricing-item.d.ts +0 -5
- package/es/components/pricing-item.js +1 -4
- package/es/components/pricing-table.d.ts +2 -10
- package/es/components/pricing-table.js +8 -7
- package/es/components/resume-subscription.d.ts +0 -10
- package/es/components/resume-subscription.js +42 -21
- package/es/components/truncated-text.d.ts +2 -9
- package/es/components/truncated-text.js +0 -5
- package/es/contexts/donate.d.ts +0 -7
- package/es/contexts/donate.js +10 -8
- package/es/contexts/payment.d.ts +1 -4
- package/es/contexts/payment.js +7 -2
- package/es/history/invoice/list.d.ts +2 -18
- package/es/history/invoice/list.js +151 -73
- package/es/history/payment/list.js +115 -38
- package/es/hooks/keyboard.d.ts +1 -1
- package/es/hooks/keyboard.js +2 -4
- package/es/libs/cached-request.js +2 -4
- package/es/libs/phone-validator.js +1 -2
- package/es/libs/util.js +2 -4
- package/es/libs/validator.js +2 -4
- package/es/payment/amount.d.ts +2 -7
- package/es/payment/amount.js +1 -5
- package/es/payment/donation-form.d.ts +2 -10
- package/es/payment/donation-form.js +196 -160
- package/es/payment/error.d.ts +2 -8
- package/es/payment/error.js +40 -20
- package/es/payment/footer.d.ts +2 -3
- package/es/payment/footer.js +19 -6
- package/es/payment/form/addon.js +14 -4
- package/es/payment/form/address.d.ts +2 -9
- package/es/payment/form/address.js +3 -6
- package/es/payment/form/currency.js +45 -25
- package/es/payment/form/index.d.ts +2 -8
- package/es/payment/form/index.js +107 -65
- package/es/payment/form/phone.js +2 -4
- package/es/payment/form/stripe/form.d.ts +2 -8
- package/es/payment/form/stripe/form.js +1 -3
- package/es/payment/header.js +38 -16
- package/es/payment/index.d.ts +2 -9
- package/es/payment/index.js +5 -14
- package/es/payment/product-card.d.ts +2 -11
- package/es/payment/product-card.js +84 -50
- package/es/payment/product-donation.js +175 -114
- package/es/payment/product-item.d.ts +2 -9
- package/es/payment/product-item.js +185 -142
- package/es/payment/product-skeleton.js +2 -2
- package/es/payment/skeleton/donation.js +27 -7
- package/es/payment/skeleton/overview.js +22 -2
- package/es/payment/skeleton/payment.js +33 -5
- package/es/payment/success.d.ts +2 -9
- package/es/payment/success.js +41 -14
- package/es/payment/summary.d.ts +2 -17
- package/es/payment/summary.js +184 -111
- package/es/theme/index.d.ts +0 -5
- package/es/theme/index.js +2 -5
- package/es/theme/typography.d.ts +2 -2
- package/lib/checkout/donate.d.ts +1 -15
- package/lib/checkout/donate.js +75 -54
- package/lib/checkout/form.d.ts +1 -15
- package/lib/checkout/form.js +7 -15
- package/lib/checkout/table.js +4 -4
- package/lib/components/blockchain/gas.d.ts +1 -5
- package/lib/components/blockchain/gas.js +3 -2
- package/lib/components/blockchain/tx.d.ts +1 -8
- package/lib/components/blockchain/tx.js +11 -7
- package/lib/components/confirm.d.ts +1 -10
- package/lib/components/confirm.js +5 -11
- package/lib/components/country-select.d.ts +3 -2
- package/lib/components/country-select.js +23 -22
- package/lib/components/input.d.ts +11 -20
- package/lib/components/input.js +20 -23
- package/lib/components/lazy-loader.js +1 -1
- package/lib/components/link.d.ts +2 -9
- package/lib/components/link.js +3 -8
- package/lib/components/livemode.d.ts +2 -8
- package/lib/components/livemode.js +3 -7
- package/lib/components/loading-button.d.ts +6 -1
- package/lib/components/loading-button.js +9 -17
- package/lib/components/over-due-invoice-payment.d.ts +0 -18
- package/lib/components/over-due-invoice-payment.js +31 -33
- package/lib/components/payment-beneficiaries.d.ts +2 -7
- package/lib/components/payment-beneficiaries.js +12 -11
- package/lib/components/pricing-item.d.ts +0 -5
- package/lib/components/pricing-item.js +2 -5
- package/lib/components/pricing-table.d.ts +2 -10
- package/lib/components/pricing-table.js +5 -11
- package/lib/components/resume-subscription.d.ts +0 -10
- package/lib/components/resume-subscription.js +16 -16
- package/lib/components/table.js +1 -1
- package/lib/components/truncated-text.d.ts +2 -9
- package/lib/components/truncated-text.js +1 -6
- package/lib/contexts/donate.d.ts +0 -7
- package/lib/contexts/donate.js +4 -7
- package/lib/contexts/payment.d.ts +1 -4
- package/lib/contexts/payment.js +4 -7
- package/lib/history/invoice/list.d.ts +2 -18
- package/lib/history/invoice/list.js +49 -37
- package/lib/history/payment/list.js +30 -16
- package/lib/hooks/keyboard.d.ts +1 -1
- package/lib/hooks/mobile.js +1 -1
- package/lib/hooks/subscription.js +1 -1
- package/lib/index.js +2 -2
- package/lib/libs/api.js +1 -1
- package/lib/libs/dayjs.js +1 -1
- package/lib/libs/phone-validator.js +0 -2
- package/lib/libs/theme.js +1 -1
- package/lib/libs/util.js +1 -1
- package/lib/libs/validator.js +1 -1
- package/lib/locales/en.js +1 -1
- package/lib/locales/index.js +1 -1
- package/lib/locales/zh.js +1 -1
- package/lib/payment/amount.d.ts +2 -7
- package/lib/payment/amount.js +2 -6
- package/lib/payment/donation-form.d.ts +2 -10
- package/lib/payment/donation-form.js +33 -38
- package/lib/payment/error.d.ts +2 -8
- package/lib/payment/error.js +11 -13
- package/lib/payment/footer.d.ts +2 -3
- package/lib/payment/footer.js +5 -5
- package/lib/payment/form/addon.js +5 -3
- package/lib/payment/form/address.d.ts +2 -9
- package/lib/payment/form/address.js +5 -8
- package/lib/payment/form/currency.js +3 -3
- package/lib/payment/form/index.d.ts +2 -8
- package/lib/payment/form/index.js +19 -15
- package/lib/payment/form/phone.js +1 -1
- package/lib/payment/form/stripe/form.d.ts +2 -8
- package/lib/payment/form/stripe/form.js +3 -6
- package/lib/payment/header.js +8 -4
- package/lib/payment/index.d.ts +2 -9
- package/lib/payment/index.js +7 -16
- package/lib/payment/product-card.d.ts +2 -11
- package/lib/payment/product-card.js +13 -20
- package/lib/payment/product-donation.js +71 -66
- package/lib/payment/product-item.d.ts +2 -9
- package/lib/payment/product-item.js +24 -25
- package/lib/payment/product-skeleton.js +2 -2
- package/lib/payment/skeleton/donation.js +8 -4
- package/lib/payment/skeleton/overview.js +6 -2
- package/lib/payment/skeleton/payment.js +9 -3
- package/lib/payment/success.d.ts +2 -9
- package/lib/payment/success.js +12 -15
- package/lib/payment/summary.d.ts +2 -17
- package/lib/payment/summary.js +44 -45
- package/lib/theme/index.d.ts +0 -5
- package/lib/theme/index.js +2 -5
- package/lib/theme/typography.d.ts +2 -2
- package/package.json +40 -40
- package/src/checkout/donate.tsx +103 -35
- package/src/checkout/form.tsx +5 -14
- package/src/checkout/table.tsx +3 -3
- package/src/components/blockchain/gas.tsx +5 -3
- package/src/components/blockchain/tx.tsx +22 -8
- package/src/components/confirm.tsx +4 -11
- package/src/components/country-select.tsx +391 -378
- package/src/components/input.tsx +49 -45
- package/src/components/link.tsx +9 -7
- package/src/components/livemode.tsx +2 -6
- package/src/components/loading-button.tsx +63 -76
- package/src/components/over-due-invoice-payment.tsx +43 -28
- package/src/components/payment-beneficiaries.tsx +33 -14
- package/src/components/pricing-item.tsx +1 -4
- package/src/components/pricing-table.tsx +8 -8
- package/src/components/resume-subscription.tsx +20 -14
- package/src/components/table.tsx +2 -2
- package/src/components/truncated-text.tsx +0 -6
- package/src/contexts/donate.tsx +6 -7
- package/src/contexts/payment.tsx +7 -3
- package/src/history/invoice/list.tsx +74 -35
- package/src/history/payment/list.tsx +53 -16
- package/src/hooks/keyboard.ts +1 -1
- package/src/payment/amount.tsx +1 -6
- package/src/payment/donation-form.tsx +47 -29
- package/src/payment/error.tsx +16 -8
- package/src/payment/footer.tsx +11 -3
- package/src/payment/form/addon.tsx +6 -1
- package/src/payment/form/address.tsx +3 -7
- package/src/payment/form/currency.tsx +12 -2
- package/src/payment/form/index.tsx +30 -12
- package/src/payment/form/stripe/form.tsx +1 -5
- package/src/payment/header.tsx +14 -2
- package/src/payment/index.tsx +10 -21
- package/src/payment/product-card.tsx +41 -18
- package/src/payment/product-donation.tsx +85 -47
- package/src/payment/product-item.tsx +46 -24
- package/src/payment/product-skeleton.tsx +3 -2
- package/src/payment/skeleton/donation.tsx +12 -2
- package/src/payment/skeleton/overview.tsx +12 -2
- package/src/payment/skeleton/payment.tsx +16 -3
- package/src/payment/success.tsx +26 -15
- package/src/payment/summary.tsx +74 -42
- package/src/theme/index.tsx +5 -8
- package/src/theme/typography.ts +2 -2
|
@@ -21,31 +21,51 @@ export default function CurrencySelector({ value, currencies, onChange }) {
|
|
|
21
21
|
variant: "outlined",
|
|
22
22
|
onClick: () => onChange(x.id, x.method?.id),
|
|
23
23
|
className: selected ? "cko-payment-card" : "cko-payment-card-unselect",
|
|
24
|
-
children: /* @__PURE__ */ jsxs(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
24
|
+
children: /* @__PURE__ */ jsxs(
|
|
25
|
+
Stack,
|
|
26
|
+
{
|
|
27
|
+
direction: "row",
|
|
28
|
+
sx: {
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
position: "relative"
|
|
31
|
+
},
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Avatar, { src: x.logo, alt: x.name, sx: { width: 40, height: 40, marginRight: "12px" } }),
|
|
34
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
Typography,
|
|
37
|
+
{
|
|
38
|
+
variant: "h5",
|
|
39
|
+
component: "div",
|
|
40
|
+
sx: { fontSize: "16px", color: "text.primary", fontWeight: "500" },
|
|
41
|
+
children: x.symbol
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
Typography,
|
|
46
|
+
{
|
|
47
|
+
gutterBottom: true,
|
|
48
|
+
sx: {
|
|
49
|
+
color: "text.lighter",
|
|
50
|
+
fontSize: 14
|
|
51
|
+
},
|
|
52
|
+
children: x.method.name
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
Radio,
|
|
58
|
+
{
|
|
59
|
+
checked: selected,
|
|
60
|
+
sx: {
|
|
61
|
+
position: "absolute",
|
|
62
|
+
right: 0
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
)
|
|
49
69
|
},
|
|
50
70
|
x.id
|
|
51
71
|
);
|
|
@@ -6,11 +6,5 @@ type PageData = CheckoutContext & CheckoutCallbacks & {
|
|
|
6
6
|
onlyShowBtn?: boolean;
|
|
7
7
|
isDonation?: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var defaultProps: {
|
|
12
|
-
onlyShowBtn: boolean;
|
|
13
|
-
isDonation: boolean;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export default PaymentForm;
|
|
9
|
+
export default function PaymentForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, onPaid, onError, action, onlyShowBtn, isDonation, }: PageData): import("react").JSX.Element;
|
|
10
|
+
export {};
|
package/es/payment/form/index.js
CHANGED
|
@@ -85,10 +85,6 @@ const setUserFormValues = (userInfo, currentValues, setValue, options = {}) => {
|
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
};
|
|
88
|
-
PaymentForm.defaultProps = {
|
|
89
|
-
onlyShowBtn: false,
|
|
90
|
-
isDonation: false
|
|
91
|
-
};
|
|
92
88
|
export default function PaymentForm({
|
|
93
89
|
checkoutSession,
|
|
94
90
|
paymentMethods,
|
|
@@ -99,7 +95,7 @@ export default function PaymentForm({
|
|
|
99
95
|
onError,
|
|
100
96
|
// mode,
|
|
101
97
|
action,
|
|
102
|
-
onlyShowBtn,
|
|
98
|
+
onlyShowBtn = false,
|
|
103
99
|
isDonation = false
|
|
104
100
|
}) {
|
|
105
101
|
const { t, locale } = useLocaleContext();
|
|
@@ -270,8 +266,7 @@ export default function PaymentForm({
|
|
|
270
266
|
}
|
|
271
267
|
};
|
|
272
268
|
const handleFastCheckoutConfirm = async () => {
|
|
273
|
-
if (!state.fastCheckoutInfo)
|
|
274
|
-
return;
|
|
269
|
+
if (!state.fastCheckoutInfo) return;
|
|
275
270
|
setState({
|
|
276
271
|
fastCheckoutInfo: {
|
|
277
272
|
...state.fastCheckoutInfo,
|
|
@@ -455,34 +450,71 @@ export default function PaymentForm({
|
|
|
455
450
|
/* @__PURE__ */ jsx(Typography, { children: t("payment.checkout.fastPay.autoPaymentReason") }),
|
|
456
451
|
/* @__PURE__ */ jsx(Divider, { sx: { mt: 1.5, mb: 1.5 } }),
|
|
457
452
|
/* @__PURE__ */ jsxs(Stack, { spacing: 1, children: [
|
|
458
|
-
/* @__PURE__ */ jsxs(
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
453
|
+
/* @__PURE__ */ jsxs(
|
|
454
|
+
Stack,
|
|
455
|
+
{
|
|
456
|
+
sx: {
|
|
457
|
+
flexDirection: "row",
|
|
458
|
+
alignItems: "center",
|
|
459
|
+
justifyContent: "space-between"
|
|
460
|
+
},
|
|
461
|
+
children: [
|
|
462
|
+
/* @__PURE__ */ jsx(
|
|
463
|
+
Typography,
|
|
464
|
+
{
|
|
465
|
+
sx: {
|
|
466
|
+
color: "text.primary",
|
|
467
|
+
whiteSpace: "nowrap"
|
|
468
|
+
},
|
|
469
|
+
children: t("payment.checkout.fastPay.payer")
|
|
473
470
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
471
|
+
),
|
|
472
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
473
|
+
/* @__PURE__ */ jsx(DID, { did: state.fastCheckoutInfo.payer || "", compact: true, responsive: false }),
|
|
474
|
+
balanceLink && /* @__PURE__ */ jsx(Tooltip, { title: t("payment.checkout.fastPay.balanceLink"), placement: "top", children: /* @__PURE__ */ jsx(
|
|
475
|
+
OpenInNew,
|
|
476
|
+
{
|
|
477
|
+
sx: {
|
|
478
|
+
color: "text.lighter",
|
|
479
|
+
fontSize: "0.85rem",
|
|
480
|
+
cursor: "pointer",
|
|
481
|
+
"&:hover": { color: "text.primary" }
|
|
482
|
+
},
|
|
483
|
+
onClick: () => {
|
|
484
|
+
window.open(balanceLink, "_blank");
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
) })
|
|
488
|
+
] })
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
/* @__PURE__ */ jsxs(
|
|
493
|
+
Stack,
|
|
494
|
+
{
|
|
495
|
+
sx: {
|
|
496
|
+
flexDirection: "row",
|
|
497
|
+
alignItems: "center",
|
|
498
|
+
justifyContent: "space-between"
|
|
499
|
+
},
|
|
500
|
+
children: [
|
|
501
|
+
/* @__PURE__ */ jsx(
|
|
502
|
+
Typography,
|
|
503
|
+
{
|
|
504
|
+
sx: {
|
|
505
|
+
color: "text.primary"
|
|
506
|
+
},
|
|
507
|
+
children: t("payment.checkout.fastPay.amount")
|
|
508
|
+
}
|
|
509
|
+
),
|
|
510
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
511
|
+
fromUnitToToken(state.fastCheckoutInfo.amount, paymentCurrency?.decimal || 18).toString(),
|
|
512
|
+
" ",
|
|
513
|
+
paymentCurrency?.symbol
|
|
514
|
+
] })
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
)
|
|
486
518
|
] })
|
|
487
519
|
] }),
|
|
488
520
|
loading: state.fastCheckoutInfo.loading,
|
|
@@ -563,40 +595,50 @@ export default function PaymentForm({
|
|
|
563
595
|
children: t("payment.checkout.paymentDetails")
|
|
564
596
|
}
|
|
565
597
|
),
|
|
566
|
-
/* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
598
|
+
/* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(
|
|
599
|
+
Stack,
|
|
600
|
+
{
|
|
601
|
+
direction: "column",
|
|
602
|
+
className: "cko-payment-methods",
|
|
603
|
+
sx: {
|
|
604
|
+
alignItems: "flex-start"
|
|
605
|
+
},
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ jsx(Stack, { direction: "row", sx: { width: "100%" }, children: /* @__PURE__ */ jsx(
|
|
608
|
+
Controller,
|
|
574
609
|
{
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
610
|
+
name: "payment_currency",
|
|
611
|
+
control,
|
|
612
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
613
|
+
CurrencySelector,
|
|
614
|
+
{
|
|
615
|
+
value: field.value,
|
|
616
|
+
currencies,
|
|
617
|
+
onChange: (id, methodId) => {
|
|
618
|
+
field.onChange(id);
|
|
619
|
+
setValue("payment_method", methodId);
|
|
620
|
+
saveCurrencyPreference(id, session?.user?.did);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
)
|
|
624
|
+
}
|
|
625
|
+
) }),
|
|
626
|
+
state.stripePaying && state.stripeContext && /* @__PURE__ */ jsx(
|
|
627
|
+
StripeCheckout,
|
|
628
|
+
{
|
|
629
|
+
clientSecret: state.stripeContext.client_secret,
|
|
630
|
+
intentType: state.stripeContext.intent_type,
|
|
631
|
+
publicKey: method.settings.stripe?.publishable_key,
|
|
632
|
+
customer: state.customer,
|
|
633
|
+
mode: checkoutSession.mode,
|
|
634
|
+
onConfirm: onStripeConfirm,
|
|
635
|
+
onCancel: onStripeCancel,
|
|
636
|
+
returnUrl: checkoutSession?.success_url
|
|
582
637
|
}
|
|
583
638
|
)
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
StripeCheckout,
|
|
588
|
-
{
|
|
589
|
-
clientSecret: state.stripeContext.client_secret,
|
|
590
|
-
intentType: state.stripeContext.intent_type,
|
|
591
|
-
publicKey: method.settings.stripe?.publishable_key,
|
|
592
|
-
customer: state.customer,
|
|
593
|
-
mode: checkoutSession.mode,
|
|
594
|
-
onConfirm: onStripeConfirm,
|
|
595
|
-
onCancel: onStripeCancel,
|
|
596
|
-
returnUrl: checkoutSession?.success_url
|
|
597
|
-
}
|
|
598
|
-
)
|
|
599
|
-
] }) }),
|
|
639
|
+
]
|
|
640
|
+
}
|
|
641
|
+
) }),
|
|
600
642
|
showForm && /* @__PURE__ */ jsxs(
|
|
601
643
|
Stack,
|
|
602
644
|
{
|
package/es/payment/form/phone.js
CHANGED
|
@@ -15,8 +15,7 @@ export default function PhoneInput({ ...props }) {
|
|
|
15
15
|
const values = getValues();
|
|
16
16
|
const isUpdatingRef = useRef(false);
|
|
17
17
|
const safeUpdate = useCallback((callback) => {
|
|
18
|
-
if (isUpdatingRef.current)
|
|
19
|
-
return;
|
|
18
|
+
if (isUpdatingRef.current) return;
|
|
20
19
|
try {
|
|
21
20
|
isUpdatingRef.current = true;
|
|
22
21
|
callback();
|
|
@@ -39,8 +38,7 @@ export default function PhoneInput({ ...props }) {
|
|
|
39
38
|
});
|
|
40
39
|
const userCountry = useWatch({ control, name: countryFieldName });
|
|
41
40
|
useEffect(() => {
|
|
42
|
-
if (!userCountry || userCountry === country)
|
|
43
|
-
return;
|
|
41
|
+
if (!userCountry || userCountry === country) return;
|
|
44
42
|
safeUpdate(() => {
|
|
45
43
|
setCountry(userCountry);
|
|
46
44
|
});
|
|
@@ -5,7 +5,7 @@ export type StripeCheckoutFormProps = {
|
|
|
5
5
|
customer: TCustomer;
|
|
6
6
|
mode: string;
|
|
7
7
|
onConfirm: Function;
|
|
8
|
-
returnUrl
|
|
8
|
+
returnUrl?: string;
|
|
9
9
|
};
|
|
10
10
|
export type StripeCheckoutProps = {
|
|
11
11
|
clientSecret: string;
|
|
@@ -17,10 +17,4 @@ export type StripeCheckoutProps = {
|
|
|
17
17
|
onCancel: Function;
|
|
18
18
|
returnUrl?: string;
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
declare namespace StripeCheckout {
|
|
22
|
-
var defaultProps: {
|
|
23
|
-
returnUrl: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export default StripeCheckout;
|
|
20
|
+
export default function StripeCheckout({ clientSecret, intentType, publicKey, mode, customer, onConfirm, onCancel, returnUrl, }: StripeCheckoutProps): import("react").JSX.Element;
|
|
@@ -79,6 +79,7 @@ function StripeCheckoutForm({
|
|
|
79
79
|
setState({ message: t("paymentCredit.preparePayMessage.processing") });
|
|
80
80
|
break;
|
|
81
81
|
case "requires_payment_method":
|
|
82
|
+
// 忽略该状态
|
|
82
83
|
default:
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
@@ -304,6 +305,3 @@ export default function StripeCheckout({
|
|
|
304
305
|
}
|
|
305
306
|
);
|
|
306
307
|
}
|
|
307
|
-
StripeCheckout.defaultProps = {
|
|
308
|
-
returnUrl: ""
|
|
309
|
-
};
|
package/es/payment/header.js
CHANGED
|
@@ -18,20 +18,42 @@ export default function PaymentHeader({ checkoutSession }) {
|
|
|
18
18
|
}
|
|
19
19
|
return false;
|
|
20
20
|
}, [domSize, theme]);
|
|
21
|
-
return /* @__PURE__ */ jsxs(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
return /* @__PURE__ */ jsxs(
|
|
22
|
+
Stack,
|
|
23
|
+
{
|
|
24
|
+
className: "cko-header",
|
|
25
|
+
direction: "row",
|
|
26
|
+
spacing: 1,
|
|
27
|
+
sx: {
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
justifyContent: "space-between"
|
|
30
|
+
},
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsxs(
|
|
33
|
+
Stack,
|
|
34
|
+
{
|
|
35
|
+
direction: "row",
|
|
36
|
+
spacing: 1,
|
|
37
|
+
sx: {
|
|
38
|
+
alignItems: "center"
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Avatar,
|
|
43
|
+
{
|
|
44
|
+
variant: "square",
|
|
45
|
+
src: window.blocklet.appLogo,
|
|
46
|
+
sx: { width: 32, height: 32 },
|
|
47
|
+
alt: window.blocklet?.appName || "Logo"
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx(Typography, { sx: { color: "text.primary", fontWeight: 600 }, children: brand }),
|
|
51
|
+
!livemode && /* @__PURE__ */ jsx(Livemode, {})
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
isColumnLayout ? /* @__PURE__ */ jsx(UserButtons, {}) : null
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
37
59
|
}
|
package/es/payment/index.d.ts
CHANGED
|
@@ -6,16 +6,9 @@ type Props = CheckoutContext & CheckoutCallbacks & {
|
|
|
6
6
|
error?: any;
|
|
7
7
|
showCheckoutSummary?: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
declare namespace Payment {
|
|
11
|
-
var defaultProps: {
|
|
12
|
-
completed: boolean;
|
|
13
|
-
error: null;
|
|
14
|
-
showCheckoutSummary: boolean;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export default Payment;
|
|
9
|
+
export default function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, error, mode, onPaid, onError, onChange, goBack, action, showCheckoutSummary, }: Props): import("react").JSX.Element;
|
|
18
10
|
type RootProps = {
|
|
19
11
|
mode: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
|
|
20
12
|
} & BoxProps;
|
|
21
13
|
export declare const Root: React.FC<RootProps>;
|
|
14
|
+
export {};
|
package/es/payment/index.js
CHANGED
|
@@ -30,17 +30,13 @@ import PaymentSummary from "./summary.js";
|
|
|
30
30
|
import { useMobile } from "../hooks/mobile.js";
|
|
31
31
|
import { formatPhone } from "../libs/phone-validator.js";
|
|
32
32
|
import { getCurrencyPreference } from "../libs/currency.js";
|
|
33
|
-
PaymentInner.defaultProps = {
|
|
34
|
-
completed: false,
|
|
35
|
-
showCheckoutSummary: true
|
|
36
|
-
};
|
|
37
33
|
function PaymentInner({
|
|
38
34
|
checkoutSession,
|
|
39
35
|
paymentMethods,
|
|
40
36
|
paymentLink,
|
|
41
37
|
paymentIntent,
|
|
42
38
|
customer,
|
|
43
|
-
completed,
|
|
39
|
+
completed = false,
|
|
44
40
|
mode,
|
|
45
41
|
onPaid,
|
|
46
42
|
onError,
|
|
@@ -275,19 +271,14 @@ function PaymentInner({
|
|
|
275
271
|
mode === "standalone" && isMobile && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer", sx: { color: "text.lighter" } })
|
|
276
272
|
] }) });
|
|
277
273
|
}
|
|
278
|
-
Payment.defaultProps = {
|
|
279
|
-
completed: false,
|
|
280
|
-
error: null,
|
|
281
|
-
showCheckoutSummary: true
|
|
282
|
-
};
|
|
283
274
|
export default function Payment({
|
|
284
275
|
checkoutSession,
|
|
285
276
|
paymentMethods,
|
|
286
277
|
paymentIntent,
|
|
287
278
|
paymentLink,
|
|
288
279
|
customer,
|
|
289
|
-
completed,
|
|
290
|
-
error,
|
|
280
|
+
completed = false,
|
|
281
|
+
error = null,
|
|
291
282
|
mode,
|
|
292
283
|
onPaid,
|
|
293
284
|
onError,
|
|
@@ -366,9 +357,9 @@ export default function Payment({
|
|
|
366
357
|
return /* @__PURE__ */ jsxs(
|
|
367
358
|
Stack,
|
|
368
359
|
{
|
|
369
|
-
display: "flex",
|
|
370
|
-
flexDirection: "column",
|
|
371
360
|
sx: {
|
|
361
|
+
display: "flex",
|
|
362
|
+
flexDirection: "column",
|
|
372
363
|
height: mode === "standalone" ? "100vh" : "auto",
|
|
373
364
|
overflow: isMobileSafariEnv ? "visible" : "hidden"
|
|
374
365
|
},
|
|
@@ -7,14 +7,5 @@ type Props = {
|
|
|
7
7
|
extra?: React.ReactNode;
|
|
8
8
|
variant?: LiteralUnion<'square' | 'rounded' | 'circular', string>;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var defaultProps: {
|
|
13
|
-
logo: string;
|
|
14
|
-
size: number;
|
|
15
|
-
description: string;
|
|
16
|
-
variant: string;
|
|
17
|
-
extra: undefined;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export default ProductCard;
|
|
10
|
+
export default function ProductCard({ size, variant, name, logo, description, extra, }: Props): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -1,54 +1,88 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Avatar, Box, Stack, Typography } from "@mui/material";
|
|
3
|
-
export default function ProductCard({
|
|
3
|
+
export default function ProductCard({
|
|
4
|
+
size = 48,
|
|
5
|
+
variant = "rounded",
|
|
6
|
+
name,
|
|
7
|
+
logo = "",
|
|
8
|
+
description = "",
|
|
9
|
+
extra = void 0
|
|
10
|
+
}) {
|
|
4
11
|
const s = { width: size, height: size };
|
|
5
|
-
return /* @__PURE__ */ jsxs(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/* @__PURE__ */ jsx(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
Stack,
|
|
14
|
+
{
|
|
15
|
+
direction: "row",
|
|
16
|
+
spacing: 1,
|
|
17
|
+
sx: {
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
flex: 2,
|
|
20
|
+
width: "100%"
|
|
21
|
+
},
|
|
22
|
+
children: [
|
|
23
|
+
logo ? (
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
/* @__PURE__ */ jsx(Avatar, { src: logo, alt: name, variant, sx: s })
|
|
26
|
+
) : (
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
/* @__PURE__ */ jsx(Avatar, { variant, sx: s, children: (name || "?").slice(0, 1) })
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ jsxs(
|
|
31
|
+
Stack,
|
|
32
|
+
{
|
|
33
|
+
direction: "column",
|
|
34
|
+
sx: {
|
|
35
|
+
alignItems: "flex-start",
|
|
36
|
+
justifyContent: "space-around",
|
|
37
|
+
flexShrink: 1,
|
|
38
|
+
overflow: "hidden"
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Typography,
|
|
43
|
+
{
|
|
44
|
+
className: "cko-ellipsis",
|
|
45
|
+
variant: "body1",
|
|
46
|
+
title: name,
|
|
47
|
+
sx: {
|
|
48
|
+
color: "text.primary",
|
|
49
|
+
fontWeight: 500,
|
|
50
|
+
mb: 0.5,
|
|
51
|
+
lineHeight: 1.2,
|
|
52
|
+
fontSize: 16
|
|
53
|
+
},
|
|
54
|
+
children: name
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
description && /* @__PURE__ */ jsx(
|
|
58
|
+
Typography,
|
|
59
|
+
{
|
|
60
|
+
variant: "body1",
|
|
61
|
+
title: description,
|
|
62
|
+
sx: {
|
|
63
|
+
color: "text.lighter",
|
|
64
|
+
fontSize: "0.74375rem",
|
|
65
|
+
mb: 0.5,
|
|
66
|
+
lineHeight: 1.2,
|
|
67
|
+
textAlign: "left"
|
|
68
|
+
},
|
|
69
|
+
children: description
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
extra && /* @__PURE__ */ jsx(
|
|
73
|
+
Box,
|
|
74
|
+
{
|
|
75
|
+
sx: {
|
|
76
|
+
color: "text.lighter",
|
|
77
|
+
fontSize: "0.74375rem"
|
|
78
|
+
},
|
|
79
|
+
children: extra
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
);
|
|
47
88
|
}
|
|
48
|
-
ProductCard.defaultProps = {
|
|
49
|
-
logo: "",
|
|
50
|
-
size: 48,
|
|
51
|
-
description: "",
|
|
52
|
-
variant: "rounded",
|
|
53
|
-
extra: void 0
|
|
54
|
-
};
|