payment-kit 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/.eslintrc.js +6 -0
- package/blocklet.yml +1 -1
- package/package.json +57 -58
- package/src/components/actions.tsx +22 -9
- package/src/components/balance-list.tsx +40 -12
- package/src/components/collapse.tsx +22 -14
- package/src/components/copyable.tsx +8 -7
- package/src/components/currency.tsx +15 -7
- package/src/components/customer/actions.tsx +1 -5
- package/src/components/customer/form.tsx +3 -1
- package/src/components/customer/link.tsx +4 -12
- package/src/components/customer/notification-preference.tsx +18 -9
- package/src/components/customer/overdraft-protection.tsx +112 -41
- package/src/components/drawer-form.tsx +42 -18
- package/src/components/error.tsx +1 -5
- package/src/components/event/list.tsx +9 -10
- package/src/components/filter-toolbar.tsx +20 -19
- package/src/components/info-card.tsx +32 -18
- package/src/components/info-metric.tsx +16 -6
- package/src/components/info-row-group.tsx +1 -7
- package/src/components/info-row.tsx +30 -24
- package/src/components/invoice/action.tsx +1 -7
- package/src/components/invoice/list.tsx +15 -25
- package/src/components/invoice/recharge.tsx +5 -7
- package/src/components/invoice/table.tsx +17 -12
- package/src/components/layout/user.tsx +1 -1
- package/src/components/metadata/form.tsx +13 -13
- package/src/components/metadata/list.tsx +11 -3
- package/src/components/passport/actions.tsx +9 -4
- package/src/components/payment-currency/add.tsx +16 -3
- package/src/components/payment-currency/form.tsx +12 -6
- package/src/components/payment-intent/actions.tsx +24 -16
- package/src/components/payment-intent/list.tsx +11 -8
- package/src/components/payment-link/actions.tsx +1 -5
- package/src/components/payment-link/after-pay.tsx +4 -2
- package/src/components/payment-link/before-pay.tsx +14 -4
- package/src/components/payment-link/item.tsx +27 -6
- package/src/components/payment-link/preview.tsx +9 -9
- package/src/components/payment-link/product-select.tsx +17 -3
- package/src/components/payment-method/arcblock.tsx +6 -1
- package/src/components/payment-method/base.tsx +6 -1
- package/src/components/payment-method/bitcoin.tsx +6 -1
- package/src/components/payment-method/ethereum.tsx +6 -1
- package/src/components/payment-method/evm-rpc-input.tsx +11 -7
- package/src/components/payment-method/form.tsx +2 -7
- package/src/components/payouts/actions.tsx +1 -5
- package/src/components/payouts/list.tsx +11 -9
- package/src/components/payouts/portal/list.tsx +11 -9
- package/src/components/price/currency-select.tsx +28 -17
- package/src/components/price/form.tsx +135 -84
- package/src/components/price/upsell-select.tsx +10 -2
- package/src/components/price/upsell.tsx +7 -2
- package/src/components/pricing-table/actions.tsx +1 -5
- package/src/components/pricing-table/customer-settings.tsx +5 -1
- package/src/components/pricing-table/payment-settings.tsx +14 -4
- package/src/components/pricing-table/preview.tsx +9 -9
- package/src/components/pricing-table/price-item.tsx +6 -1
- package/src/components/pricing-table/product-item.tsx +6 -1
- package/src/components/pricing-table/product-settings.tsx +17 -4
- package/src/components/product/actions.tsx +1 -5
- package/src/components/product/create.tsx +1 -5
- package/src/components/product/cross-sell-select.tsx +5 -1
- package/src/components/product/cross-sell.tsx +7 -2
- package/src/components/product/features.tsx +13 -3
- package/src/components/product/form.tsx +38 -10
- package/src/components/progress-bar.tsx +1 -1
- package/src/components/refund/actions.tsx +1 -7
- package/src/components/refund/list.tsx +12 -17
- package/src/components/section/header.tsx +23 -12
- package/src/components/subscription/actions/cancel.tsx +22 -5
- package/src/components/subscription/actions/index.tsx +9 -10
- package/src/components/subscription/actions/pause.tsx +32 -6
- package/src/components/subscription/actions/slash-stake.tsx +5 -3
- package/src/components/subscription/description.tsx +12 -8
- package/src/components/subscription/items/index.tsx +30 -15
- package/src/components/subscription/items/usage-records.tsx +19 -5
- package/src/components/subscription/list.tsx +5 -7
- package/src/components/subscription/metrics.tsx +27 -12
- package/src/components/subscription/portal/actions.tsx +76 -70
- package/src/components/subscription/portal/cancel.tsx +10 -3
- package/src/components/subscription/portal/list.tsx +48 -26
- package/src/components/uploader.tsx +5 -13
- package/src/components/webhook/attempts.tsx +51 -16
- package/src/components/webhook/request-info.tsx +8 -6
- package/src/contexts/products.tsx +1 -1
- package/src/pages/admin/billing/invoices/detail.tsx +48 -12
- package/src/pages/admin/billing/subscriptions/detail.tsx +43 -11
- package/src/pages/admin/customers/customers/detail.tsx +53 -12
- package/src/pages/admin/customers/customers/index.tsx +6 -1
- package/src/pages/admin/developers/events/detail.tsx +36 -10
- package/src/pages/admin/developers/webhooks/detail.tsx +41 -11
- package/src/pages/admin/index.tsx +15 -2
- package/src/pages/admin/overview.tsx +107 -19
- package/src/pages/admin/payments/intents/detail.tsx +57 -13
- package/src/pages/admin/payments/payouts/detail.tsx +62 -14
- package/src/pages/admin/payments/refunds/detail.tsx +57 -13
- package/src/pages/admin/products/index.tsx +8 -2
- package/src/pages/admin/products/links/create.tsx +22 -4
- package/src/pages/admin/products/links/detail.tsx +42 -13
- package/src/pages/admin/products/passports/index.tsx +23 -4
- package/src/pages/admin/products/prices/actions.tsx +1 -6
- package/src/pages/admin/products/prices/detail.tsx +43 -11
- package/src/pages/admin/products/prices/list.tsx +7 -2
- package/src/pages/admin/products/pricing-tables/create.tsx +45 -12
- package/src/pages/admin/products/pricing-tables/detail.tsx +44 -13
- package/src/pages/admin/products/products/create.tsx +4 -1
- package/src/pages/admin/products/products/detail.tsx +72 -17
- package/src/pages/admin/settings/index.tsx +8 -1
- package/src/pages/admin/settings/payment-methods/index.tsx +84 -19
- package/src/pages/admin/settings/vault-config/edit-form.tsx +42 -28
- package/src/pages/admin/settings/vault-config/index.tsx +57 -10
- package/src/pages/customer/index.tsx +41 -15
- package/src/pages/customer/invoice/detail.tsx +63 -14
- package/src/pages/customer/invoice/past-due.tsx +11 -3
- package/src/pages/customer/payout/detail.tsx +56 -13
- package/src/pages/customer/recharge/account.tsx +80 -20
- package/src/pages/customer/recharge/subscription.tsx +86 -25
- package/src/pages/customer/refund/list.tsx +60 -24
- package/src/pages/customer/subscription/change-payment.tsx +13 -4
- package/src/pages/customer/subscription/change-plan.tsx +34 -7
- package/src/pages/customer/subscription/detail.tsx +86 -20
- package/src/pages/customer/subscription/embed.tsx +24 -4
- package/src/pages/home.tsx +26 -4
- package/src/pages/integrations/donations/edit-form.tsx +25 -9
- package/src/pages/integrations/donations/index.tsx +26 -9
- package/src/pages/integrations/donations/preview.tsx +59 -15
- package/src/pages/integrations/index.tsx +10 -1
- package/src/pages/integrations/overview.tsx +78 -17
- package/vite.config.ts +60 -30
|
@@ -10,15 +10,28 @@ type Props = {
|
|
|
10
10
|
divider?: boolean;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export default function InfoMetric(
|
|
13
|
+
export default function InfoMetric(rawProps: Props) {
|
|
14
|
+
const props = Object.assign(
|
|
15
|
+
{
|
|
16
|
+
tip: '',
|
|
17
|
+
divider: false,
|
|
18
|
+
},
|
|
19
|
+
rawProps
|
|
20
|
+
);
|
|
21
|
+
|
|
14
22
|
const { t } = useLocaleContext();
|
|
23
|
+
// eslint-disable-next-line react/prop-types
|
|
15
24
|
const isNone = isEmptyExceptNumber(props.value);
|
|
16
25
|
return (
|
|
17
26
|
<>
|
|
18
27
|
<Stack direction="column" alignItems="flex-start">
|
|
19
28
|
<Typography component="div" variant="subtitle2" mb={1} color="text.primary">
|
|
29
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
20
30
|
{props.label}
|
|
31
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
32
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
21
33
|
{!!props.tip && (
|
|
34
|
+
// eslint-disable-next-line react/prop-types
|
|
22
35
|
<Tooltip title={props.tip}>
|
|
23
36
|
<InfoOutlined fontSize="small" />
|
|
24
37
|
</Tooltip>
|
|
@@ -29,15 +42,12 @@ export default function InfoMetric(props: Props) {
|
|
|
29
42
|
variant="body1"
|
|
30
43
|
color={isNone ? 'text.disabled' : 'text.secondary'}
|
|
31
44
|
sx={{ width: '100%', minHeight: '24px' }}>
|
|
45
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
32
46
|
{isNone ? t('common.none') : props.value}
|
|
33
47
|
</Typography>
|
|
34
48
|
</Stack>
|
|
49
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
35
50
|
{props.divider && <Divider orientation="vertical" flexItem />}
|
|
36
51
|
</>
|
|
37
52
|
);
|
|
38
53
|
}
|
|
39
|
-
|
|
40
|
-
InfoMetric.defaultProps = {
|
|
41
|
-
tip: '',
|
|
42
|
-
divider: false,
|
|
43
|
-
};
|
|
@@ -98,7 +98,7 @@ function InfoRowGroup({ children, loading = false, skeletonHeight = 24, sx = {}
|
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
100
|
};
|
|
101
|
-
return cloneElement(child as ReactElement
|
|
101
|
+
return cloneElement(child as ReactElement<any>, childProps);
|
|
102
102
|
}
|
|
103
103
|
return child;
|
|
104
104
|
});
|
|
@@ -113,10 +113,4 @@ function InfoRowGroup({ children, loading = false, skeletonHeight = 24, sx = {}
|
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
InfoRowGroup.defaultProps = {
|
|
117
|
-
loading: false,
|
|
118
|
-
skeletonHeight: 24,
|
|
119
|
-
sx: {},
|
|
120
|
-
};
|
|
121
|
-
|
|
122
116
|
export default InfoRowGroup;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
3
|
import { Box, Stack, SxProps } from '@mui/material';
|
|
3
4
|
import { useContext } from 'react';
|
|
@@ -16,16 +17,18 @@ type Props = {
|
|
|
16
17
|
showLabel?: boolean;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
InfoRow
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
export default function InfoRow(rawProps: Props) {
|
|
21
|
+
const props = Object.assign(
|
|
22
|
+
{
|
|
23
|
+
value: undefined,
|
|
24
|
+
sizes: [1, 3],
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
direction: 'row',
|
|
27
|
+
sx: {},
|
|
28
|
+
showLabel: true,
|
|
29
|
+
},
|
|
30
|
+
rawProps
|
|
31
|
+
);
|
|
29
32
|
const { t } = useLocaleContext();
|
|
30
33
|
const isNone = isEmptyExceptNumber(props.value);
|
|
31
34
|
const sizes = props.sizes || [1, 3];
|
|
@@ -33,31 +36,33 @@ export default function InfoRow(props: Props) {
|
|
|
33
36
|
return (
|
|
34
37
|
<Stack
|
|
35
38
|
direction={props.direction || 'row'}
|
|
36
|
-
|
|
37
|
-
justifyContent="space-between"
|
|
38
|
-
flexWrap="wrap"
|
|
39
|
-
gap={1}
|
|
39
|
+
className="info-row-wrapper"
|
|
40
40
|
sx={{
|
|
41
|
+
alignItems: props.alignItems,
|
|
42
|
+
justifyContent: 'space-between',
|
|
43
|
+
flexWrap: 'wrap',
|
|
44
|
+
gap: 1,
|
|
41
45
|
mb: 2,
|
|
42
46
|
...props.sx,
|
|
47
|
+
|
|
43
48
|
a: {
|
|
44
49
|
color: 'text.link',
|
|
45
50
|
},
|
|
46
|
-
}}
|
|
47
|
-
className="info-row-wrapper">
|
|
51
|
+
}}>
|
|
48
52
|
{props.showLabel && (
|
|
49
53
|
<Box
|
|
50
|
-
flex={sizes[0]}
|
|
51
54
|
className="info-row-label"
|
|
52
|
-
color="text.primary"
|
|
53
|
-
fontSize={14}
|
|
54
55
|
sx={{
|
|
56
|
+
color: 'text.primary',
|
|
57
|
+
fontSize: 14,
|
|
55
58
|
flex: props.direction === 'column' ? 'none' : sizes[0],
|
|
56
59
|
mb: props.direction === 'column' ? 0.5 : 0,
|
|
60
|
+
|
|
57
61
|
...(inGroup && {
|
|
58
62
|
flex: 'none',
|
|
59
63
|
whiteSpace: 'nowrap',
|
|
60
64
|
}),
|
|
65
|
+
|
|
61
66
|
fontWeight: {
|
|
62
67
|
xs: 500,
|
|
63
68
|
md: 400,
|
|
@@ -66,13 +71,14 @@ export default function InfoRow(props: Props) {
|
|
|
66
71
|
{props.label}
|
|
67
72
|
</Box>
|
|
68
73
|
)}
|
|
69
|
-
|
|
70
74
|
<Box
|
|
71
|
-
flex={sizes[1]}
|
|
72
|
-
color={isNone ? 'text.disabled' : 'text.secondary'}
|
|
73
75
|
className="info-row-value"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
sx={{
|
|
77
|
+
flex: sizes[1],
|
|
78
|
+
color: isNone ? 'text.disabled' : 'text.secondary',
|
|
79
|
+
fontSize: 14,
|
|
80
|
+
wordBreak: getWordBreakStyle(props.value),
|
|
81
|
+
}}>
|
|
76
82
|
{isNone ? t('common.none') : props.value}
|
|
77
83
|
</Box>
|
|
78
84
|
</Stack>
|
|
@@ -17,17 +17,11 @@ type Props = {
|
|
|
17
17
|
mode?: 'admin' | 'customer';
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
InvoiceActions.defaultProps = {
|
|
21
|
-
variant: 'compact',
|
|
22
|
-
|
|
23
|
-
mode: 'admin',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
20
|
const fetchStakingData = (id: string): Promise<{ value: string }> => {
|
|
27
21
|
return api.get(`/api/invoices/${id}/return-stake`).then((res: any) => res.data);
|
|
28
22
|
};
|
|
29
23
|
|
|
30
|
-
export default function InvoiceActions({ data, variant, onChange, mode }: Props) {
|
|
24
|
+
export default function InvoiceActions({ data, variant = 'compact', onChange, mode = 'admin' }: Props) {
|
|
31
25
|
const { t } = useLocaleContext();
|
|
32
26
|
const navigate = useNavigate();
|
|
33
27
|
const [state, setState] = useSetState({
|
|
@@ -73,21 +73,6 @@ const getListKey = (props: ListProps) => {
|
|
|
73
73
|
return 'invoices';
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
InvoiceList.defaultProps = {
|
|
77
|
-
features: {
|
|
78
|
-
customer: true,
|
|
79
|
-
filter: true,
|
|
80
|
-
},
|
|
81
|
-
customer_id: '',
|
|
82
|
-
subscription_id: '',
|
|
83
|
-
status: '',
|
|
84
|
-
include_staking: false,
|
|
85
|
-
include_return_staking: false,
|
|
86
|
-
ignore_zero: false,
|
|
87
|
-
|
|
88
|
-
mode: 'admin',
|
|
89
|
-
};
|
|
90
|
-
|
|
91
76
|
const getInvoiceLink = (invoice: TInvoiceExpanded) => {
|
|
92
77
|
if (invoice.id.startsWith('in_')) {
|
|
93
78
|
return {
|
|
@@ -116,14 +101,17 @@ function InvoiceLink({ invoice, children }: { invoice: TInvoiceExpanded; childre
|
|
|
116
101
|
}
|
|
117
102
|
|
|
118
103
|
export default function InvoiceList({
|
|
119
|
-
customer_id,
|
|
120
|
-
subscription_id,
|
|
121
|
-
features
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
104
|
+
customer_id = '',
|
|
105
|
+
subscription_id = '',
|
|
106
|
+
features = {
|
|
107
|
+
customer: true,
|
|
108
|
+
filter: true,
|
|
109
|
+
},
|
|
110
|
+
status = '',
|
|
111
|
+
include_staking = false,
|
|
112
|
+
include_return_staking = false,
|
|
113
|
+
ignore_zero = false,
|
|
114
|
+
mode = 'admin',
|
|
127
115
|
}: ListProps) {
|
|
128
116
|
const listKey = getListKey({ customer_id, subscription_id });
|
|
129
117
|
|
|
@@ -176,8 +164,10 @@ export default function InvoiceList({
|
|
|
176
164
|
<InvoiceLink invoice={item}>
|
|
177
165
|
<Typography
|
|
178
166
|
component="strong"
|
|
179
|
-
|
|
180
|
-
|
|
167
|
+
sx={{
|
|
168
|
+
fontWeight: 600,
|
|
169
|
+
textDecoration: item.status === 'void' ? 'line-through' : 'none',
|
|
170
|
+
}}>
|
|
181
171
|
{formatBNStr(item?.total, item?.paymentCurrency.decimal)}
|
|
182
172
|
{item?.paymentCurrency.symbol}
|
|
183
173
|
</Typography>
|
|
@@ -77,16 +77,14 @@ const getListKey = (props: ListProps) => {
|
|
|
77
77
|
return 'invoices';
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
export default function RechargeList({
|
|
81
|
+
currency_id = '',
|
|
82
|
+
subscription_id = '',
|
|
83
|
+
features = {
|
|
82
84
|
customer: true,
|
|
83
85
|
filter: true,
|
|
84
86
|
},
|
|
85
|
-
|
|
86
|
-
subscription_id: '',
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export default function RechargeList({ currency_id, subscription_id, features }: ListProps) {
|
|
87
|
+
}: ListProps) {
|
|
90
88
|
const listKey = getListKey({ currency_id, subscription_id });
|
|
91
89
|
|
|
92
90
|
const { t, locale } = useLocaleContext();
|
|
@@ -119,7 +119,7 @@ export function getInvoiceRows(invoice: TInvoiceExpanded) {
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
export default function InvoiceTable({ invoice, simple, emptyNodeText }: Props) {
|
|
122
|
+
export default function InvoiceTable({ invoice, simple = false, emptyNodeText = '' }: Props) {
|
|
123
123
|
const { t, locale } = useLocaleContext();
|
|
124
124
|
const { detail, summary } = getInvoiceRows(invoice);
|
|
125
125
|
const [state, setState] = useSetState({
|
|
@@ -163,15 +163,16 @@ export default function InvoiceTable({ invoice, simple, emptyNodeText }: Props)
|
|
|
163
163
|
<Stack
|
|
164
164
|
direction="row"
|
|
165
165
|
spacing={0.5}
|
|
166
|
-
|
|
166
|
+
onClick={() => onOpenUsageRecords(item)}
|
|
167
167
|
sx={{
|
|
168
|
+
alignItems: 'center',
|
|
168
169
|
cursor: 'pointer',
|
|
170
|
+
|
|
169
171
|
justifyContent: {
|
|
170
172
|
xs: 'flex-start',
|
|
171
173
|
md: 'flex-end',
|
|
172
174
|
},
|
|
173
|
-
}}
|
|
174
|
-
onClick={() => onOpenUsageRecords(item)}>
|
|
175
|
+
}}>
|
|
175
176
|
<Typography component="span">{item.quantity}</Typography>
|
|
176
177
|
{!!item.rawQuantity && (
|
|
177
178
|
<Tooltip
|
|
@@ -268,17 +269,26 @@ export default function InvoiceTable({ invoice, simple, emptyNodeText }: Props)
|
|
|
268
269
|
}}>
|
|
269
270
|
{summary.map((line) => (
|
|
270
271
|
<Box key={line.key}>
|
|
271
|
-
<Typography
|
|
272
|
+
<Typography
|
|
273
|
+
component="span"
|
|
274
|
+
variant="body1"
|
|
275
|
+
sx={{
|
|
276
|
+
color: 'text.secondary',
|
|
277
|
+
}}>
|
|
272
278
|
{t(line.key)}:
|
|
273
279
|
</Typography>
|
|
274
|
-
<Typography
|
|
280
|
+
<Typography
|
|
281
|
+
component="span"
|
|
282
|
+
variant="body1"
|
|
283
|
+
sx={{
|
|
284
|
+
color: 'text.primary',
|
|
285
|
+
}}>
|
|
275
286
|
{line.value}
|
|
276
287
|
</Typography>
|
|
277
288
|
</Box>
|
|
278
289
|
))}
|
|
279
290
|
</Stack>
|
|
280
291
|
)}
|
|
281
|
-
|
|
282
292
|
{state.subscriptionId && state.subscriptionItemId && (
|
|
283
293
|
<UsageRecordDialog
|
|
284
294
|
subscriptionId={state.subscriptionId}
|
|
@@ -294,11 +304,6 @@ export default function InvoiceTable({ invoice, simple, emptyNodeText }: Props)
|
|
|
294
304
|
);
|
|
295
305
|
}
|
|
296
306
|
|
|
297
|
-
InvoiceTable.defaultProps = {
|
|
298
|
-
simple: false,
|
|
299
|
-
emptyNodeText: '',
|
|
300
|
-
};
|
|
301
|
-
|
|
302
307
|
const Root = styled(Box)`
|
|
303
308
|
.invoice-summary {
|
|
304
309
|
padding-right: 16px;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
2
|
import { PaymentProvider } from '@blocklet/payment-react';
|
|
3
|
-
import { UserCenter } from '@blocklet/ui-react';
|
|
3
|
+
import { UserCenter } from '@blocklet/ui-react/lib/UserCenter';
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
5
|
|
|
6
6
|
import { useSearchParams } from 'react-router-dom';
|
|
@@ -6,8 +6,8 @@ import { useEffect, useRef } from 'react';
|
|
|
6
6
|
import { useFieldArray, useFormContext } from 'react-hook-form';
|
|
7
7
|
|
|
8
8
|
export default function MetadataForm({
|
|
9
|
-
title,
|
|
10
|
-
actions,
|
|
9
|
+
title = undefined,
|
|
10
|
+
actions = null,
|
|
11
11
|
minHeight = 'auto',
|
|
12
12
|
}: {
|
|
13
13
|
title?: string;
|
|
@@ -60,11 +60,13 @@ export default function MetadataForm({
|
|
|
60
60
|
{metadata.fields.map((meta, index) => (
|
|
61
61
|
<Stack
|
|
62
62
|
key={meta.id}
|
|
63
|
-
mt={2}
|
|
64
63
|
spacing={2}
|
|
65
64
|
direction="row"
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
ref={index === metadata.fields.length - 1 ? lastItemRef : null}
|
|
66
|
+
sx={{
|
|
67
|
+
mt: 2,
|
|
68
|
+
alignItems: 'flex-end',
|
|
69
|
+
}}>
|
|
68
70
|
<Stack direction="row" spacing={2} sx={{ flex: 1 }}>
|
|
69
71
|
<FormInput
|
|
70
72
|
sx={{ flex: 1 }}
|
|
@@ -120,9 +122,13 @@ export default function MetadataForm({
|
|
|
120
122
|
</Stack>
|
|
121
123
|
))}
|
|
122
124
|
</Stack>
|
|
123
|
-
|
|
124
125
|
<Divider />
|
|
125
|
-
<Stack
|
|
126
|
+
<Stack
|
|
127
|
+
direction="row"
|
|
128
|
+
sx={{
|
|
129
|
+
mt: metadata.fields.length ? 2 : 1,
|
|
130
|
+
justifyContent: 'space-between',
|
|
131
|
+
}}>
|
|
126
132
|
<Button size="small" variant="outlined" color="primary" onClick={() => metadata.append({ key: '', value: '' })}>
|
|
127
133
|
<AddOutlined fontSize="small" /> {t('common.metadata.add')}
|
|
128
134
|
</Button>
|
|
@@ -131,9 +137,3 @@ export default function MetadataForm({
|
|
|
131
137
|
</Box>
|
|
132
138
|
);
|
|
133
139
|
}
|
|
134
|
-
|
|
135
|
-
MetadataForm.defaultProps = {
|
|
136
|
-
title: true,
|
|
137
|
-
actions: null,
|
|
138
|
-
minHeight: 'auto',
|
|
139
|
-
};
|
|
@@ -11,17 +11,25 @@ export default function MetadataList({
|
|
|
11
11
|
handleEditMetadata = () => {},
|
|
12
12
|
}: {
|
|
13
13
|
data: any;
|
|
14
|
-
handleEditMetadata
|
|
14
|
+
handleEditMetadata?: () => void;
|
|
15
15
|
}) {
|
|
16
16
|
const { t } = useLocaleContext();
|
|
17
17
|
|
|
18
18
|
if (isEmpty(data)) {
|
|
19
19
|
return (
|
|
20
20
|
<Box sx={{ textAlign: 'center' }}>
|
|
21
|
-
<Typography
|
|
21
|
+
<Typography
|
|
22
|
+
variant="subtitle1"
|
|
23
|
+
sx={{
|
|
24
|
+
color: 'text.primary',
|
|
25
|
+
}}>
|
|
22
26
|
{t('common.metadata.empty')}
|
|
23
27
|
</Typography>
|
|
24
|
-
<Typography
|
|
28
|
+
<Typography
|
|
29
|
+
variant="body2"
|
|
30
|
+
sx={{
|
|
31
|
+
color: 'text.lighter',
|
|
32
|
+
}}>
|
|
25
33
|
{t('common.metadata.emptyTip')}
|
|
26
34
|
</Typography>
|
|
27
35
|
<Button sx={{ color: 'text.link' }} onClick={handleEditMetadata}>
|
|
@@ -11,11 +11,14 @@ type Props = {
|
|
|
11
11
|
variant?: string;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
PassportActions
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export default function PassportActions(rawProps: Props) {
|
|
15
|
+
const props = Object.assign(
|
|
16
|
+
{
|
|
17
|
+
variant: 'compact',
|
|
18
|
+
},
|
|
19
|
+
rawProps
|
|
20
|
+
);
|
|
17
21
|
|
|
18
|
-
export default function PassportActions(props: Props) {
|
|
19
22
|
const { t } = useLocaleContext();
|
|
20
23
|
|
|
21
24
|
const [state, setState] = useSetState({
|
|
@@ -26,6 +29,7 @@ export default function PassportActions(props: Props) {
|
|
|
26
29
|
const onUnassign = async () => {
|
|
27
30
|
try {
|
|
28
31
|
setState({ loading: true });
|
|
32
|
+
// eslint-disable-next-line react/prop-types
|
|
29
33
|
await api.delete(`/api/passports/assign/${props.data.name}`).then((res) => res.data);
|
|
30
34
|
Toast.success(t('common.saved'));
|
|
31
35
|
} catch (err) {
|
|
@@ -46,6 +50,7 @@ export default function PassportActions(props: Props) {
|
|
|
46
50
|
|
|
47
51
|
return (
|
|
48
52
|
<ClickBoundary>
|
|
53
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
49
54
|
<Actions variant={props.variant} actions={actions} />
|
|
50
55
|
{state.action === 'unassign' && (
|
|
51
56
|
<ConfirmDialog
|
|
@@ -179,8 +179,17 @@ export default function PaymentCurrencyAdd({
|
|
|
179
179
|
}}
|
|
180
180
|
/>
|
|
181
181
|
<Stack>
|
|
182
|
-
<Typography
|
|
183
|
-
|
|
182
|
+
<Typography
|
|
183
|
+
sx={{
|
|
184
|
+
fontWeight: 500,
|
|
185
|
+
}}>
|
|
186
|
+
{option.name}
|
|
187
|
+
</Typography>
|
|
188
|
+
<Typography
|
|
189
|
+
variant="caption"
|
|
190
|
+
sx={{
|
|
191
|
+
color: 'text.secondary',
|
|
192
|
+
}}>
|
|
184
193
|
{option.symbol}
|
|
185
194
|
</Typography>
|
|
186
195
|
</Stack>
|
|
@@ -189,7 +198,11 @@ export default function PaymentCurrencyAdd({
|
|
|
189
198
|
isOptionEqualToValue={(option, value) => option.address === value.address}
|
|
190
199
|
/>
|
|
191
200
|
<Divider sx={{ my: 3 }}>
|
|
192
|
-
<Typography
|
|
201
|
+
<Typography
|
|
202
|
+
variant="caption"
|
|
203
|
+
sx={{
|
|
204
|
+
color: 'text.secondary',
|
|
205
|
+
}}>
|
|
193
206
|
{t('admin.paymentCurrency.orManualInput')}
|
|
194
207
|
</Typography>
|
|
195
208
|
</Divider>
|
|
@@ -10,10 +10,6 @@ type TPaymentCurrencyFormProps = {
|
|
|
10
10
|
disableKeys?: string[];
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
PaymentCurrencyForm.defaultProps = {
|
|
14
|
-
disableKeys: [],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
13
|
export default function PaymentCurrencyForm({ disableKeys = [] }: TPaymentCurrencyFormProps) {
|
|
18
14
|
const { t } = useLocaleContext();
|
|
19
15
|
const { control, setValue } = useFormContext();
|
|
@@ -29,7 +25,12 @@ export default function PaymentCurrencyForm({ disableKeys = [] }: TPaymentCurren
|
|
|
29
25
|
};
|
|
30
26
|
|
|
31
27
|
return (
|
|
32
|
-
<Stack
|
|
28
|
+
<Stack
|
|
29
|
+
direction="column"
|
|
30
|
+
spacing={2}
|
|
31
|
+
sx={{
|
|
32
|
+
alignItems: 'flex-start',
|
|
33
|
+
}}>
|
|
33
34
|
<FormInput
|
|
34
35
|
key="name"
|
|
35
36
|
name="name"
|
|
@@ -58,7 +59,12 @@ export default function PaymentCurrencyForm({ disableKeys = [] }: TPaymentCurren
|
|
|
58
59
|
disabled={disableKeys.includes('contract')}
|
|
59
60
|
/>
|
|
60
61
|
<Stack direction="column">
|
|
61
|
-
<Typography
|
|
62
|
+
<Typography
|
|
63
|
+
sx={{
|
|
64
|
+
mb: 1,
|
|
65
|
+
}}>
|
|
66
|
+
{t('admin.paymentCurrency.logo.label')}
|
|
67
|
+
</Typography>
|
|
62
68
|
<Uploader onUploaded={onUploaded} preview={logo} />
|
|
63
69
|
</Stack>
|
|
64
70
|
</Stack>
|
|
@@ -27,13 +27,6 @@ type Props = {
|
|
|
27
27
|
onChange: (action: string) => void;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
PaymentIntentActionsInner.defaultProps = {
|
|
31
|
-
variant: 'compact',
|
|
32
|
-
};
|
|
33
|
-
PaymentIntentActions.defaultProps = {
|
|
34
|
-
variant: 'compact',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
30
|
const fetchRefundData = (id: string) => {
|
|
38
31
|
return api.get(`/api/payment-intents/${id}/refundable-amount`).then((res) => res.data);
|
|
39
32
|
};
|
|
@@ -64,7 +57,13 @@ function RefundForm({ data, refundMaxAmount }: { data: TPaymentIntentExpanded; r
|
|
|
64
57
|
return true;
|
|
65
58
|
};
|
|
66
59
|
return (
|
|
67
|
-
<Stack
|
|
60
|
+
<Stack
|
|
61
|
+
direction="column"
|
|
62
|
+
spacing={1}
|
|
63
|
+
sx={{
|
|
64
|
+
alignItems: 'flex-start',
|
|
65
|
+
width: 400,
|
|
66
|
+
}}>
|
|
68
67
|
<Controller
|
|
69
68
|
name="refund.reason"
|
|
70
69
|
control={control}
|
|
@@ -103,7 +102,6 @@ function RefundForm({ data, refundMaxAmount }: { data: TPaymentIntentExpanded; r
|
|
|
103
102
|
</RadioGroup>
|
|
104
103
|
)}
|
|
105
104
|
/>
|
|
106
|
-
|
|
107
105
|
<FormControl fullWidth component="fieldset" variant="outlined">
|
|
108
106
|
<Controller
|
|
109
107
|
name="refund.amount"
|
|
@@ -121,8 +119,10 @@ function RefundForm({ data, refundMaxAmount }: { data: TPaymentIntentExpanded; r
|
|
|
121
119
|
placeholder={t('admin.paymentIntent.refundForm.amount')}
|
|
122
120
|
error={!!(errors as any)?.refund?.amount}
|
|
123
121
|
helperText={(errors as any)?.refund?.amount?.message}
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
slotProps={{
|
|
123
|
+
input: {
|
|
124
|
+
endAdornment: <InputAdornment position="end">{data.paymentCurrency.symbol}</InputAdornment>,
|
|
125
|
+
},
|
|
126
126
|
}}
|
|
127
127
|
/>
|
|
128
128
|
)}
|
|
@@ -135,7 +135,6 @@ function RefundForm({ data, refundMaxAmount }: { data: TPaymentIntentExpanded; r
|
|
|
135
135
|
})}
|
|
136
136
|
</FormHelperText>
|
|
137
137
|
</FormControl>
|
|
138
|
-
|
|
139
138
|
<Controller
|
|
140
139
|
name="refund.description"
|
|
141
140
|
control={control}
|
|
@@ -155,8 +154,10 @@ function RefundForm({ data, refundMaxAmount }: { data: TPaymentIntentExpanded; r
|
|
|
155
154
|
placeholder={t('admin.paymentIntent.refundForm.description')}
|
|
156
155
|
error={!!(errors as any)?.refund?.description}
|
|
157
156
|
helperText={(errors as any)?.refund?.description?.message}
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
slotProps={{
|
|
158
|
+
htmlInput: {
|
|
159
|
+
maxLength: 200,
|
|
160
|
+
},
|
|
160
161
|
}}
|
|
161
162
|
/>
|
|
162
163
|
)}
|
|
@@ -165,7 +166,7 @@ function RefundForm({ data, refundMaxAmount }: { data: TPaymentIntentExpanded; r
|
|
|
165
166
|
);
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
export function PaymentIntentActionsInner({ data, variant, onChange }: Props) {
|
|
169
|
+
export function PaymentIntentActionsInner({ data, variant = 'compact', onChange }: Props) {
|
|
169
170
|
const { t } = useLocaleContext();
|
|
170
171
|
const navigate = useNavigate();
|
|
171
172
|
const { reset, getValues, setValue, handleSubmit } = useFormContext();
|
|
@@ -262,7 +263,14 @@ export function PaymentIntentActionsInner({ data, variant, onChange }: Props) {
|
|
|
262
263
|
);
|
|
263
264
|
}
|
|
264
265
|
|
|
265
|
-
export default function PaymentIntentActions(
|
|
266
|
+
export default function PaymentIntentActions(rawProps: Props) {
|
|
267
|
+
const props = Object.assign(
|
|
268
|
+
{
|
|
269
|
+
variant: 'compact',
|
|
270
|
+
},
|
|
271
|
+
rawProps
|
|
272
|
+
);
|
|
273
|
+
|
|
266
274
|
const methods = useForm({
|
|
267
275
|
mode: 'onChange',
|
|
268
276
|
defaultValues: {
|
|
@@ -66,16 +66,14 @@ const getListKey = (props: ListProps) => {
|
|
|
66
66
|
return 'payments';
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
export default function PaymentList({
|
|
70
|
+
customer_id = '',
|
|
71
|
+
invoice_id = '',
|
|
72
|
+
features = {
|
|
71
73
|
customer: true,
|
|
72
74
|
filter: true,
|
|
73
75
|
},
|
|
74
|
-
|
|
75
|
-
invoice_id: '',
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export default function PaymentList({ customer_id, invoice_id, features }: ListProps) {
|
|
76
|
+
}: ListProps) {
|
|
79
77
|
const { t } = useLocaleContext();
|
|
80
78
|
|
|
81
79
|
const listKey = getListKey({ customer_id, invoice_id });
|
|
@@ -120,7 +118,12 @@ export default function PaymentList({ customer_id, invoice_id, features }: ListP
|
|
|
120
118
|
const highlight = item.amount_received === '0' && item.status !== 'canceled';
|
|
121
119
|
return (
|
|
122
120
|
<Link to={`/admin/payments/${item.id}`}>
|
|
123
|
-
<Typography
|
|
121
|
+
<Typography
|
|
122
|
+
component="strong"
|
|
123
|
+
sx={{
|
|
124
|
+
fontWeight: 600,
|
|
125
|
+
color: highlight ? 'warning.main' : 'inherit',
|
|
126
|
+
}}>
|
|
124
127
|
{formatBNStr(
|
|
125
128
|
item.amount_received === '0' ? item.amount : item.amount_received,
|
|
126
129
|
item?.paymentCurrency.decimal
|