@blocklet/payment-react 1.18.29 → 1.18.31
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.js +51 -23
- package/es/components/country-select.js +1 -0
- package/es/components/over-due-invoice-payment.js +44 -5
- package/es/history/invoice/list.js +3 -1
- package/es/libs/util.d.ts +2 -0
- package/es/libs/util.js +25 -2
- package/es/locales/en.js +2 -1
- package/es/locales/zh.js +2 -1
- package/es/payment/form/currency.d.ts +1 -1
- package/es/payment/form/currency.js +3 -3
- package/es/payment/form/index.d.ts +1 -1
- package/es/payment/form/index.js +22 -36
- package/es/payment/form/stripe/form.js +4 -2
- package/es/payment/index.js +10 -1
- package/es/payment/product-donation.js +4 -3
- package/es/payment/success.d.ts +3 -1
- package/es/payment/success.js +78 -6
- package/lib/checkout/donate.js +19 -11
- package/lib/components/country-select.js +1 -0
- package/lib/components/over-due-invoice-payment.js +42 -3
- package/lib/history/invoice/list.js +1 -0
- package/lib/libs/util.d.ts +2 -0
- package/lib/libs/util.js +27 -2
- package/lib/locales/en.js +2 -1
- package/lib/locales/zh.js +2 -1
- package/lib/payment/form/currency.d.ts +1 -1
- package/lib/payment/form/currency.js +3 -3
- package/lib/payment/form/index.d.ts +1 -1
- package/lib/payment/form/index.js +21 -35
- package/lib/payment/form/stripe/form.js +4 -2
- package/lib/payment/index.js +10 -1
- package/lib/payment/product-donation.js +4 -3
- package/lib/payment/success.d.ts +3 -1
- package/lib/payment/success.js +68 -15
- package/package.json +8 -8
- package/src/checkout/donate.tsx +23 -5
- package/src/components/country-select.tsx +1 -0
- package/src/components/over-due-invoice-payment.tsx +47 -4
- package/src/history/invoice/list.tsx +2 -0
- package/src/libs/util.ts +28 -2
- package/src/locales/en.tsx +1 -0
- package/src/locales/zh.tsx +1 -0
- package/src/payment/form/currency.tsx +4 -4
- package/src/payment/form/index.tsx +23 -47
- package/src/payment/form/stripe/form.tsx +4 -2
- package/src/payment/index.tsx +12 -1
- package/src/payment/product-donation.tsx +4 -3
- package/src/payment/success.tsx +73 -11
- package/src/payment/summary.tsx +1 -0
package/src/payment/success.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import { Grow, Link, Stack, Typography } from '@mui/material';
|
|
2
|
+
import { Grow, Link, Stack, Typography, Box, Paper } from '@mui/material';
|
|
3
3
|
import { styled } from '@mui/system';
|
|
4
4
|
import { joinURL } from 'ufo';
|
|
5
5
|
|
|
6
|
+
import { Button } from '@arcblock/ux';
|
|
6
7
|
import { usePaymentContext } from '../contexts/payment';
|
|
7
8
|
|
|
8
9
|
type Props = {
|
|
@@ -12,20 +13,80 @@ type Props = {
|
|
|
12
13
|
payee: string;
|
|
13
14
|
invoiceId?: string;
|
|
14
15
|
subscriptionId?: string;
|
|
16
|
+
subscriptions?: any[];
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
export default function PaymentSuccess({
|
|
19
|
+
export default function PaymentSuccess({
|
|
20
|
+
mode,
|
|
21
|
+
message,
|
|
22
|
+
action,
|
|
23
|
+
payee,
|
|
24
|
+
invoiceId,
|
|
25
|
+
subscriptionId,
|
|
26
|
+
subscriptions,
|
|
27
|
+
}: Props) {
|
|
18
28
|
const { t } = useLocaleContext();
|
|
19
29
|
const { prefix } = usePaymentContext();
|
|
20
30
|
let next: any = null;
|
|
21
|
-
if (['subscription', 'setup'].includes(action)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
if (['subscription', 'setup'].includes(action)) {
|
|
32
|
+
if (subscriptions && subscriptions.length > 1) {
|
|
33
|
+
next = (
|
|
34
|
+
<Paper
|
|
35
|
+
elevation={0}
|
|
36
|
+
sx={{
|
|
37
|
+
p: 3,
|
|
38
|
+
backgroundColor: 'grey.50',
|
|
39
|
+
borderRadius: 2,
|
|
40
|
+
width: '100%',
|
|
41
|
+
mt: 2,
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'column',
|
|
44
|
+
gap: 2,
|
|
45
|
+
}}>
|
|
46
|
+
{subscriptions.map((subscription) => (
|
|
47
|
+
<Box
|
|
48
|
+
key={subscription.id}
|
|
49
|
+
sx={{
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
justifyContent: 'space-between',
|
|
53
|
+
}}>
|
|
54
|
+
<Typography
|
|
55
|
+
variant="body2"
|
|
56
|
+
sx={{
|
|
57
|
+
color: 'text.secondary',
|
|
58
|
+
fontWeight: 500,
|
|
59
|
+
}}>
|
|
60
|
+
{subscription.description}
|
|
61
|
+
</Typography>
|
|
62
|
+
<Box
|
|
63
|
+
sx={{
|
|
64
|
+
flex: 1,
|
|
65
|
+
borderBottom: '1px dashed',
|
|
66
|
+
borderColor: 'grey.300',
|
|
67
|
+
mx: 2,
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
<Button variant="text" color="primary" size="small">
|
|
71
|
+
<Link
|
|
72
|
+
href={joinURL(prefix, `/customer/subscription/${subscription.id}`)}
|
|
73
|
+
sx={{ color: 'text.secondary' }}>
|
|
74
|
+
{t('payment.checkout.next.view')}
|
|
75
|
+
</Link>
|
|
76
|
+
</Button>
|
|
77
|
+
</Box>
|
|
78
|
+
))}
|
|
79
|
+
</Paper>
|
|
80
|
+
);
|
|
81
|
+
} else if (subscriptionId) {
|
|
82
|
+
next = (
|
|
83
|
+
<Button variant="outlined" color="primary" sx={{ mt: 2 }}>
|
|
84
|
+
<Link href={joinURL(prefix, `/customer/subscription/${subscriptionId}`)}>
|
|
85
|
+
{t('payment.checkout.next.subscription', { payee })}
|
|
86
|
+
</Link>
|
|
87
|
+
</Button>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
29
90
|
} else if (invoiceId) {
|
|
30
91
|
next = (
|
|
31
92
|
<Typography textAlign="center" sx={{ mt: 2 }}>
|
|
@@ -42,7 +103,7 @@ export default function PaymentSuccess({ mode, message, action, payee, invoiceId
|
|
|
42
103
|
direction="column"
|
|
43
104
|
alignItems="center"
|
|
44
105
|
justifyContent={mode === 'standalone' ? 'center' : 'flex-start'}
|
|
45
|
-
sx={{ height: mode === 'standalone' ?
|
|
106
|
+
sx={{ height: mode === 'standalone' ? 'fit-content' : 300 }}>
|
|
46
107
|
<Div>
|
|
47
108
|
<div className="check-icon">
|
|
48
109
|
<span className="icon-line line-tip" />
|
|
@@ -66,6 +127,7 @@ export default function PaymentSuccess({ mode, message, action, payee, invoiceId
|
|
|
66
127
|
PaymentSuccess.defaultProps = {
|
|
67
128
|
invoiceId: '',
|
|
68
129
|
subscriptionId: '',
|
|
130
|
+
subscriptions: [],
|
|
69
131
|
};
|
|
70
132
|
|
|
71
133
|
const Div = styled('div')`
|
package/src/payment/summary.tsx
CHANGED
|
@@ -160,6 +160,7 @@ export default function PaymentSummary({
|
|
|
160
160
|
);
|
|
161
161
|
const headlines = formatCheckoutHeadlines(items, currency, { trialEnd, trialInDays }, locale);
|
|
162
162
|
const staking = showStaking ? getStakingSetup(items, currency, billingThreshold) : '0';
|
|
163
|
+
|
|
163
164
|
const totalAmount = fromUnitToToken(
|
|
164
165
|
new BN(fromTokenToUnit(headlines.actualAmount, currency?.decimal)).add(new BN(staking)).toString(),
|
|
165
166
|
currency?.decimal
|