@blocklet/payment-react 1.18.56 → 1.19.1
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 +29 -10
- 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/date-range-picker.d.ts +13 -0
- package/es/components/date-range-picker.js +279 -0
- package/es/components/input.d.ts +14 -20
- package/es/components/input.js +51 -44
- package/es/components/label.d.ts +7 -0
- package/es/components/label.js +49 -0
- 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/credit/grants-list.d.ts +14 -0
- package/es/history/credit/grants-list.js +215 -0
- package/es/history/credit/transactions-list.d.ts +13 -0
- package/es/history/credit/transactions-list.js +255 -0
- package/es/history/invoice/list.d.ts +2 -18
- package/es/history/invoice/list.js +172 -74
- 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/index.d.ts +5 -1
- package/es/index.js +10 -1
- package/es/libs/cached-request.js +2 -4
- package/es/libs/phone-validator.js +1 -2
- package/es/libs/util.d.ts +2 -0
- package/es/libs/util.js +14 -4
- package/es/libs/validator.js +2 -4
- package/es/locales/en.js +20 -2
- package/es/locales/zh.js +20 -2
- 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 +151 -71
- 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 +23 -17
- 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 +9 -9
- package/es/payment/product-item.js +320 -145
- 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 +4 -17
- package/es/payment/summary.js +193 -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 +15 -10
- 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/date-range-picker.d.ts +13 -0
- package/lib/components/date-range-picker.js +329 -0
- package/lib/components/input.d.ts +14 -20
- package/lib/components/input.js +28 -27
- package/lib/components/label.d.ts +7 -0
- package/lib/components/label.js +60 -0
- 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/credit/grants-list.d.ts +14 -0
- package/lib/history/credit/grants-list.js +277 -0
- package/lib/history/credit/transactions-list.d.ts +13 -0
- package/lib/history/credit/transactions-list.js +301 -0
- package/lib/history/invoice/list.d.ts +2 -18
- package/lib/history/invoice/list.js +73 -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.d.ts +5 -1
- package/lib/index.js +41 -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.d.ts +2 -0
- package/lib/libs/util.js +15 -1
- package/lib/libs/validator.js +1 -1
- package/lib/locales/en.js +21 -3
- package/lib/locales/index.js +1 -1
- package/lib/locales/zh.js +21 -3
- 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 +64 -21
- 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 +27 -18
- 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 +9 -9
- package/lib/payment/product-item.js +168 -29
- 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 +4 -17
- package/lib/payment/summary.js +53 -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 +19 -11
- package/src/components/confirm.tsx +4 -11
- package/src/components/country-select.tsx +391 -378
- package/src/components/date-range-picker.tsx +310 -0
- package/src/components/input.tsx +61 -46
- package/src/components/label.tsx +58 -0
- 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/credit/grants-list.tsx +276 -0
- package/src/history/credit/transactions-list.tsx +317 -0
- package/src/history/invoice/list.tsx +92 -36
- package/src/history/payment/list.tsx +53 -16
- package/src/hooks/keyboard.ts +1 -1
- package/src/index.ts +9 -0
- package/src/libs/util.ts +14 -0
- package/src/locales/en.tsx +20 -0
- package/src/locales/zh.tsx +19 -0
- 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 +121 -45
- package/src/payment/form/stripe/form.tsx +1 -5
- package/src/payment/header.tsx +14 -2
- package/src/payment/index.tsx +27 -22
- package/src/payment/product-card.tsx +41 -18
- package/src/payment/product-donation.tsx +85 -47
- package/src/payment/product-item.tsx +198 -28
- 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 +87 -44
- package/src/theme/index.tsx +5 -8
- package/src/theme/typography.ts +2 -2
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
Theme,
|
|
8
8
|
Typography,
|
|
9
9
|
} from '@mui/material';
|
|
10
|
-
import { forwardRef } from 'react';
|
|
11
10
|
|
|
12
11
|
export interface LoadingButtonProps extends ButtonProps {
|
|
13
12
|
loading?: boolean;
|
|
@@ -17,84 +16,72 @@ export interface LoadingButtonProps extends ButtonProps {
|
|
|
17
16
|
loadingOnly?: boolean;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
19
|
+
export default function LoadingButton({
|
|
20
|
+
ref = undefined,
|
|
21
|
+
children,
|
|
22
|
+
loading = false,
|
|
23
|
+
loadingPosition = 'start',
|
|
24
|
+
loadingIndicator = undefined,
|
|
25
|
+
loadingProps = {},
|
|
26
|
+
loadingOnly = false,
|
|
27
|
+
onClick,
|
|
28
|
+
sx,
|
|
29
|
+
...props
|
|
30
|
+
}: LoadingButtonProps & {
|
|
31
|
+
ref?: React.RefObject<HTMLButtonElement | null>;
|
|
32
|
+
}) {
|
|
33
|
+
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
34
|
+
if (loading) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
onClick?.(e);
|
|
38
|
+
};
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
const getPositionStyles = (position: string) => {
|
|
41
|
+
return {
|
|
42
|
+
color: 'inherit',
|
|
43
|
+
...(position === 'start' && { mr: 1 }),
|
|
44
|
+
...(position === 'end' && { ml: 1 }),
|
|
45
|
+
...(position === 'center' && {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
left: '50%',
|
|
48
|
+
transform: 'translateY(-50%) translateX(-50%)',
|
|
49
|
+
top: '50%',
|
|
50
|
+
}),
|
|
51
|
+
display: 'inline-flex',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
} as const;
|
|
54
|
+
};
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
const defaultIndicator = (
|
|
57
|
+
<CircularProgress size={16} {...loadingProps} sx={{ color: 'inherit', ...(loadingProps?.sx || {}) }} />
|
|
58
|
+
);
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
const indicator = (
|
|
61
|
+
<Typography sx={getPositionStyles(loadingPosition) as SxProps<Theme>}>
|
|
62
|
+
{loadingIndicator || defaultIndicator}
|
|
63
|
+
</Typography>
|
|
64
|
+
);
|
|
67
65
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
);
|
|
66
|
+
return (
|
|
67
|
+
<Button
|
|
68
|
+
ref={ref}
|
|
69
|
+
disabled={props.disabled || loading}
|
|
70
|
+
onClick={handleClick}
|
|
71
|
+
sx={{
|
|
72
|
+
position: 'relative',
|
|
73
|
+
display: 'inline-flex',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
...sx,
|
|
77
|
+
}}
|
|
78
|
+
{...props}>
|
|
79
|
+
{loading && loadingPosition === 'start' && indicator}
|
|
80
|
+
<Typography sx={{ visibility: loading && loadingOnly ? 'hidden' : 'visible' }}>{children}</Typography>
|
|
81
|
+
{loading && loadingPosition === 'center' && indicator}
|
|
82
|
+
{loading && loadingPosition === 'end' && indicator}
|
|
83
|
+
</Button>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
89
86
|
|
|
90
87
|
LoadingButton.displayName = 'LoadingButton';
|
|
91
|
-
|
|
92
|
-
LoadingButton.defaultProps = {
|
|
93
|
-
loading: false,
|
|
94
|
-
loadingIndicator: undefined,
|
|
95
|
-
loadingPosition: 'start',
|
|
96
|
-
loadingProps: {},
|
|
97
|
-
loadingOnly: false,
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default LoadingButton;
|
|
@@ -92,16 +92,18 @@ const fetchOverdueInvoices = async (params: {
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
function OverdueInvoicePayment({
|
|
95
|
-
subscriptionId,
|
|
96
|
-
customerId,
|
|
95
|
+
subscriptionId = undefined,
|
|
96
|
+
customerId = undefined,
|
|
97
97
|
mode = 'default',
|
|
98
|
-
dialogProps = {
|
|
99
|
-
|
|
98
|
+
dialogProps = {
|
|
99
|
+
open: true,
|
|
100
|
+
},
|
|
101
|
+
children = undefined,
|
|
100
102
|
onPaid = () => {},
|
|
101
103
|
detailLinkOptions = { enabled: true },
|
|
102
104
|
successToast = true,
|
|
103
105
|
alertMessage = '',
|
|
104
|
-
authToken,
|
|
106
|
+
authToken = undefined,
|
|
105
107
|
}: Props) {
|
|
106
108
|
const { t, locale } = useLocaleContext();
|
|
107
109
|
const theme = useTheme();
|
|
@@ -463,11 +465,19 @@ function OverdueInvoicePayment({
|
|
|
463
465
|
{error ? (
|
|
464
466
|
<Alert severity="error">{error.message}</Alert>
|
|
465
467
|
) : (
|
|
466
|
-
<Stack
|
|
468
|
+
<Stack
|
|
469
|
+
sx={{
|
|
470
|
+
gap: 1,
|
|
471
|
+
}}>
|
|
467
472
|
{summaryList.length === 0 && (
|
|
468
473
|
<>
|
|
469
474
|
<Alert severity="success">{getEmptyStateMessage()}</Alert>
|
|
470
|
-
<Stack
|
|
475
|
+
<Stack
|
|
476
|
+
direction="row"
|
|
477
|
+
sx={{
|
|
478
|
+
justifyContent: 'flex-end',
|
|
479
|
+
mt: 2,
|
|
480
|
+
}}>
|
|
471
481
|
<Button variant="outlined" color="primary" onClick={handleClose} sx={{ width: 'fit-content' }}>
|
|
472
482
|
{/* @ts-ignore */}
|
|
473
483
|
{t('common.know')}
|
|
@@ -477,7 +487,11 @@ function OverdueInvoicePayment({
|
|
|
477
487
|
)}
|
|
478
488
|
{summaryList.length === 1 && (
|
|
479
489
|
<>
|
|
480
|
-
<Typography
|
|
490
|
+
<Typography
|
|
491
|
+
variant="body1"
|
|
492
|
+
sx={{
|
|
493
|
+
color: 'text.secondary',
|
|
494
|
+
}}>
|
|
481
495
|
{getOverdueTitle()}
|
|
482
496
|
{detailLinkOptions.enabled && (
|
|
483
497
|
<>
|
|
@@ -494,7 +508,13 @@ function OverdueInvoicePayment({
|
|
|
494
508
|
</>
|
|
495
509
|
)}
|
|
496
510
|
</Typography>
|
|
497
|
-
<Stack
|
|
511
|
+
<Stack
|
|
512
|
+
direction="row"
|
|
513
|
+
sx={{
|
|
514
|
+
justifyContent: 'flex-end',
|
|
515
|
+
gap: 2,
|
|
516
|
+
mt: 2,
|
|
517
|
+
}}>
|
|
498
518
|
<Button variant="outlined" color="primary" onClick={handleClose}>
|
|
499
519
|
{/* @ts-ignore */}
|
|
500
520
|
{t('common.cancel')}
|
|
@@ -506,7 +526,11 @@ function OverdueInvoicePayment({
|
|
|
506
526
|
)}
|
|
507
527
|
{summaryList.length > 1 && (
|
|
508
528
|
<>
|
|
509
|
-
<Typography
|
|
529
|
+
<Typography
|
|
530
|
+
variant="body1"
|
|
531
|
+
sx={{
|
|
532
|
+
color: 'text.secondary',
|
|
533
|
+
}}>
|
|
510
534
|
{getOverdueTitle()}
|
|
511
535
|
{detailLinkOptions.enabled && (
|
|
512
536
|
<>
|
|
@@ -523,7 +547,11 @@ function OverdueInvoicePayment({
|
|
|
523
547
|
</>
|
|
524
548
|
)}
|
|
525
549
|
</Typography>
|
|
526
|
-
<Typography
|
|
550
|
+
<Typography
|
|
551
|
+
variant="body1"
|
|
552
|
+
sx={{
|
|
553
|
+
color: 'text.secondary',
|
|
554
|
+
}}>
|
|
527
555
|
{t('payment.subscription.overdue.list')}
|
|
528
556
|
</Typography>
|
|
529
557
|
<Stack>
|
|
@@ -531,16 +559,18 @@ function OverdueInvoicePayment({
|
|
|
531
559
|
<Stack
|
|
532
560
|
key={item?.currency?.id}
|
|
533
561
|
direction="row"
|
|
534
|
-
justifyContent="space-between"
|
|
535
|
-
alignItems="center"
|
|
536
562
|
sx={{
|
|
563
|
+
justifyContent: 'space-between',
|
|
564
|
+
alignItems: 'center',
|
|
537
565
|
py: 1,
|
|
538
566
|
px: 0.5,
|
|
539
567
|
borderBottom: '1px solid',
|
|
540
568
|
borderColor: 'grey.200',
|
|
569
|
+
|
|
541
570
|
'&:hover': {
|
|
542
571
|
backgroundColor: () => theme.palette.grey[100],
|
|
543
572
|
},
|
|
573
|
+
|
|
544
574
|
mt: 0,
|
|
545
575
|
}}>
|
|
546
576
|
<Typography>
|
|
@@ -567,19 +597,4 @@ function OverdueInvoicePayment({
|
|
|
567
597
|
);
|
|
568
598
|
}
|
|
569
599
|
|
|
570
|
-
OverdueInvoicePayment.defaultProps = {
|
|
571
|
-
mode: 'default',
|
|
572
|
-
onPaid: () => {},
|
|
573
|
-
dialogProps: {
|
|
574
|
-
open: true,
|
|
575
|
-
},
|
|
576
|
-
children: null,
|
|
577
|
-
detailLinkOptions: { enabled: true },
|
|
578
|
-
subscriptionId: undefined,
|
|
579
|
-
customerId: undefined,
|
|
580
|
-
successToast: true,
|
|
581
|
-
alertMessage: '',
|
|
582
|
-
authToken: undefined,
|
|
583
|
-
};
|
|
584
|
-
|
|
585
600
|
export default OverdueInvoicePayment;
|
|
@@ -22,18 +22,17 @@ interface BenefitsProps {
|
|
|
22
22
|
totalAmount?: string;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
PaymentBeneficiaries
|
|
26
|
-
totalAmount: '0',
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default function PaymentBeneficiaries({ data, currency, totalAmount }: BenefitsProps) {
|
|
25
|
+
export default function PaymentBeneficiaries({ data, currency, totalAmount = '0' }: BenefitsProps) {
|
|
30
26
|
const { t } = useLocaleContext();
|
|
31
27
|
return (
|
|
32
28
|
<Stack spacing={2}>
|
|
33
|
-
<Typography
|
|
29
|
+
<Typography
|
|
30
|
+
variant="subtitle2"
|
|
31
|
+
sx={{
|
|
32
|
+
color: 'text.secondary',
|
|
33
|
+
}}>
|
|
34
34
|
{t('benefits.title', { count: data.length })}
|
|
35
35
|
</Typography>
|
|
36
|
-
|
|
37
36
|
{data.map((item) => {
|
|
38
37
|
const amount =
|
|
39
38
|
item.amount ||
|
|
@@ -47,17 +46,24 @@ export default function PaymentBeneficiaries({ data, currency, totalAmount }: Be
|
|
|
47
46
|
<Stack
|
|
48
47
|
key={item.address}
|
|
49
48
|
direction={{ xs: 'column', sm: 'row' }}
|
|
50
|
-
alignItems="center"
|
|
51
|
-
justifyContent="space-between"
|
|
52
49
|
sx={{
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'space-between',
|
|
53
52
|
px: 0.5,
|
|
54
53
|
borderRadius: 1,
|
|
55
54
|
bgcolor: 'background.paper',
|
|
55
|
+
|
|
56
56
|
'&:hover': {
|
|
57
57
|
bgcolor: 'action.hover',
|
|
58
58
|
},
|
|
59
59
|
}}>
|
|
60
|
-
<Stack
|
|
60
|
+
<Stack
|
|
61
|
+
direction="row"
|
|
62
|
+
spacing={1.5}
|
|
63
|
+
sx={{
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
width: { xs: '100%', sm: 'auto' },
|
|
66
|
+
}}>
|
|
61
67
|
<Avatar src={item.avatar} alt={item.name} sx={{ width: 32, height: 32 }} variant="square" />
|
|
62
68
|
<Box>
|
|
63
69
|
<Typography
|
|
@@ -75,17 +81,30 @@ export default function PaymentBeneficiaries({ data, currency, totalAmount }: Be
|
|
|
75
81
|
}}>
|
|
76
82
|
{item.name}
|
|
77
83
|
</Typography>
|
|
78
|
-
<Typography
|
|
84
|
+
<Typography
|
|
85
|
+
variant="caption"
|
|
86
|
+
sx={{
|
|
87
|
+
color: 'text.secondary',
|
|
88
|
+
cursor: 'pointer',
|
|
89
|
+
}}>
|
|
79
90
|
{item.address}
|
|
80
91
|
</Typography>
|
|
81
92
|
</Box>
|
|
82
93
|
</Stack>
|
|
83
|
-
|
|
84
|
-
|
|
94
|
+
<Stack
|
|
95
|
+
sx={{
|
|
96
|
+
alignItems: 'flex-end',
|
|
97
|
+
width: { xs: '100%', sm: 'auto' },
|
|
98
|
+
mt: { xs: 1, sm: 0 },
|
|
99
|
+
}}>
|
|
85
100
|
<Typography variant="subtitle2">
|
|
86
101
|
{fromUnitToToken(amount, currency.decimal)} {currency.symbol}
|
|
87
102
|
</Typography>
|
|
88
|
-
<Typography
|
|
103
|
+
<Typography
|
|
104
|
+
variant="caption"
|
|
105
|
+
sx={{
|
|
106
|
+
color: 'text.secondary',
|
|
107
|
+
}}>
|
|
89
108
|
{Number(item.percent)}%
|
|
90
109
|
</Typography>
|
|
91
110
|
</Stack>
|
|
@@ -20,7 +20,7 @@ export type PricingItemProps = {
|
|
|
20
20
|
children?: (pricing: PricingRenderProps, product?: TProductExpanded | undefined) => React.ReactNode;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
function PricingItem({ productId, quantity, children, priceId }: PricingItemProps) {
|
|
23
|
+
function PricingItem({ productId, quantity, children = undefined, priceId }: PricingItemProps) {
|
|
24
24
|
const { locale } = useLocaleContext();
|
|
25
25
|
|
|
26
26
|
const { data: productInfo, loading = false } = useRequest(() => fetchProduct(productId), {
|
|
@@ -51,7 +51,4 @@ function PricingItem({ productId, quantity, children, priceId }: PricingItemProp
|
|
|
51
51
|
return <Box>{children ? children(pricing, productInfo) : <Typography>{pricing?.totalPrice}</Typography>}</Box>;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
PricingItem.defaultProps = {
|
|
55
|
-
children: null,
|
|
56
|
-
};
|
|
57
54
|
export default PricingItem;
|
|
@@ -75,14 +75,14 @@ type Props = {
|
|
|
75
75
|
hideCurrency?: boolean;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
interval
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
export default function PricingTable({
|
|
79
|
+
table,
|
|
80
|
+
alignItems = 'center',
|
|
81
|
+
interval = '',
|
|
82
|
+
mode = 'checkout',
|
|
83
|
+
onSelect,
|
|
84
|
+
hideCurrency = false,
|
|
85
|
+
}: Props) {
|
|
86
86
|
const { t, locale } = useLocaleContext();
|
|
87
87
|
const { isMobile } = useMobile();
|
|
88
88
|
const {
|
|
@@ -59,10 +59,12 @@ const recoverSubscription = async (params: {
|
|
|
59
59
|
|
|
60
60
|
function RecoverSubscription({
|
|
61
61
|
subscriptionId,
|
|
62
|
-
dialogProps = {
|
|
62
|
+
dialogProps = {
|
|
63
|
+
open: true,
|
|
64
|
+
},
|
|
63
65
|
onResumed = () => {},
|
|
64
66
|
successToast = true,
|
|
65
|
-
authToken,
|
|
67
|
+
authToken = undefined,
|
|
66
68
|
}: Props) {
|
|
67
69
|
const { t, locale } = useLocaleContext();
|
|
68
70
|
const { connect } = usePaymentContext();
|
|
@@ -182,8 +184,15 @@ function RecoverSubscription({
|
|
|
182
184
|
{error ? (
|
|
183
185
|
<Alert severity="error">{error.message}</Alert>
|
|
184
186
|
) : (
|
|
185
|
-
<Stack
|
|
186
|
-
|
|
187
|
+
<Stack
|
|
188
|
+
sx={{
|
|
189
|
+
gap: 2,
|
|
190
|
+
}}>
|
|
191
|
+
<Typography
|
|
192
|
+
variant="body2"
|
|
193
|
+
sx={{
|
|
194
|
+
color: 'text.secondary',
|
|
195
|
+
}}>
|
|
187
196
|
{t('payment.customer.recover.description', {
|
|
188
197
|
date: formatToDate(Number(data?.subscription?.current_period_end || '0') * 1000),
|
|
189
198
|
})}
|
|
@@ -191,7 +200,13 @@ function RecoverSubscription({
|
|
|
191
200
|
|
|
192
201
|
{needStake && <Alert severity="warning">{t('payment.customer.recover.stakeRequiredDescription')}</Alert>}
|
|
193
202
|
|
|
194
|
-
<Stack
|
|
203
|
+
<Stack
|
|
204
|
+
direction="row"
|
|
205
|
+
sx={{
|
|
206
|
+
justifyContent: 'flex-end',
|
|
207
|
+
gap: 2,
|
|
208
|
+
mt: 2,
|
|
209
|
+
}}>
|
|
195
210
|
<Button variant="outlined" color="primary" onClick={handleClose}>
|
|
196
211
|
{t('common.cancel')}
|
|
197
212
|
</Button>
|
|
@@ -205,13 +220,4 @@ function RecoverSubscription({
|
|
|
205
220
|
);
|
|
206
221
|
}
|
|
207
222
|
|
|
208
|
-
RecoverSubscription.defaultProps = {
|
|
209
|
-
onResumed: () => {},
|
|
210
|
-
dialogProps: {
|
|
211
|
-
open: true,
|
|
212
|
-
},
|
|
213
|
-
successToast: true,
|
|
214
|
-
authToken: undefined,
|
|
215
|
-
};
|
|
216
|
-
|
|
217
223
|
export default RecoverSubscription;
|
package/src/components/table.tsx
CHANGED
|
@@ -81,13 +81,13 @@ const Wrapped = styled(Datatable)`
|
|
|
81
81
|
table.MuiTable-root {
|
|
82
82
|
outline: 1px solid;
|
|
83
83
|
outline-color: ${({ theme }) => theme.palette.grey[100]};
|
|
84
|
-
border-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
|
|
84
|
+
border-radius: ${({ theme }) => `${2 * (theme.shape.borderRadius as number)}px`};
|
|
85
85
|
overflow: hidden;
|
|
86
86
|
}
|
|
87
87
|
[class*='MUIDataTable-responsiveBase'] {
|
|
88
88
|
outline: 1px solid;
|
|
89
89
|
outline-color: ${({ theme }) => theme.palette.grey[100]};
|
|
90
|
-
border-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
|
|
90
|
+
border-radius: ${({ theme }) => `${2 * (theme.shape.borderRadius as number)}px`};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
th.MuiTableCell-head {
|
package/src/contexts/donate.tsx
CHANGED
|
@@ -162,7 +162,12 @@ function DonateProvider({
|
|
|
162
162
|
<>
|
|
163
163
|
{enableDonate && isAdmin && (
|
|
164
164
|
<Stack spacing={1} sx={{ alignItems: 'center' }}>
|
|
165
|
-
<Typography
|
|
165
|
+
<Typography
|
|
166
|
+
sx={{
|
|
167
|
+
color: 'text.secondary',
|
|
168
|
+
}}>
|
|
169
|
+
{t('payment.checkout.donation.inactive')}
|
|
170
|
+
</Typography>
|
|
166
171
|
<Button
|
|
167
172
|
size="small"
|
|
168
173
|
variant="outlined"
|
|
@@ -205,12 +210,6 @@ function useDonateContext() {
|
|
|
205
210
|
return context;
|
|
206
211
|
}
|
|
207
212
|
|
|
208
|
-
DonateProvider.defaultProps = {
|
|
209
|
-
defaultSettings: {},
|
|
210
|
-
active: true,
|
|
211
|
-
enableDonate: false,
|
|
212
|
-
};
|
|
213
|
-
|
|
214
213
|
export const clearDonateCache = (mountLocation: string) => {
|
|
215
214
|
const livemode = localStorage.getItem('livemode') !== 'false';
|
|
216
215
|
const cacheKey = `donate-settings-${mountLocation}-${livemode}`;
|
package/src/contexts/payment.tsx
CHANGED
|
@@ -90,7 +90,13 @@ const syncToSpaceRequest = (userDid: string, spaceDid: string) => {
|
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
function PaymentProvider({
|
|
93
|
+
function PaymentProvider({
|
|
94
|
+
session,
|
|
95
|
+
connect,
|
|
96
|
+
children,
|
|
97
|
+
baseUrl = undefined,
|
|
98
|
+
authToken = undefined,
|
|
99
|
+
}: PaymentContextProps) {
|
|
94
100
|
const [crossOriginLoading, setCrossOriginLoading] = useState(false);
|
|
95
101
|
|
|
96
102
|
if (authToken) {
|
|
@@ -217,6 +223,4 @@ function usePaymentContext() {
|
|
|
217
223
|
return context;
|
|
218
224
|
}
|
|
219
225
|
|
|
220
|
-
PaymentProvider.defaultProps = {};
|
|
221
|
-
|
|
222
226
|
export { PaymentContext, PaymentProvider, Consumer as SettingsConsumer, usePaymentContext };
|