payment-kit 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/.eslintrc.js +6 -0
- package/api/src/crons/index.ts +8 -0
- package/api/src/index.ts +4 -0
- package/api/src/libs/credit-grant.ts +146 -0
- package/api/src/libs/env.ts +1 -0
- package/api/src/libs/invoice.ts +4 -3
- package/api/src/libs/notification/template/base.ts +388 -2
- package/api/src/libs/notification/template/customer-credit-grant-granted.ts +149 -0
- package/api/src/libs/notification/template/customer-credit-grant-low-balance.ts +151 -0
- package/api/src/libs/notification/template/customer-credit-insufficient.ts +254 -0
- package/api/src/libs/notification/template/subscription-canceled.ts +193 -202
- package/api/src/libs/notification/template/subscription-refund-succeeded.ts +215 -237
- package/api/src/libs/notification/template/subscription-renewed.ts +130 -200
- package/api/src/libs/notification/template/subscription-succeeded.ts +100 -202
- package/api/src/libs/notification/template/subscription-trial-start.ts +142 -188
- package/api/src/libs/notification/template/subscription-trial-will-end.ts +146 -174
- package/api/src/libs/notification/template/subscription-upgraded.ts +96 -192
- package/api/src/libs/notification/template/subscription-will-canceled.ts +94 -135
- package/api/src/libs/notification/template/subscription-will-renew.ts +220 -245
- package/api/src/libs/payment.ts +69 -0
- package/api/src/libs/queue/index.ts +3 -2
- package/api/src/libs/session.ts +8 -0
- package/api/src/libs/subscription.ts +74 -3
- package/api/src/libs/ws.ts +23 -1
- package/api/src/locales/en.ts +33 -0
- package/api/src/locales/zh.ts +31 -0
- package/api/src/queues/credit-consume.ts +715 -0
- package/api/src/queues/credit-grant.ts +572 -0
- package/api/src/queues/notification.ts +173 -128
- package/api/src/queues/payment.ts +210 -122
- package/api/src/queues/subscription.ts +179 -0
- package/api/src/routes/checkout-sessions.ts +157 -9
- package/api/src/routes/connect/shared.ts +3 -2
- package/api/src/routes/credit-grants.ts +241 -0
- package/api/src/routes/credit-transactions.ts +208 -0
- package/api/src/routes/index.ts +8 -0
- package/api/src/routes/meter-events.ts +347 -0
- package/api/src/routes/meters.ts +219 -0
- package/api/src/routes/payment-currencies.ts +14 -2
- package/api/src/routes/payment-links.ts +1 -1
- package/api/src/routes/payment-methods.ts +14 -2
- package/api/src/routes/prices.ts +43 -0
- package/api/src/routes/pricing-table.ts +13 -7
- package/api/src/routes/products.ts +63 -4
- package/api/src/routes/settings.ts +1 -1
- package/api/src/routes/subscriptions.ts +4 -0
- package/api/src/store/migrations/20250610-billing-credit.ts +43 -0
- package/api/src/store/models/credit-grant.ts +486 -0
- package/api/src/store/models/credit-transaction.ts +268 -0
- package/api/src/store/models/customer.ts +8 -0
- package/api/src/store/models/index.ts +52 -1
- package/api/src/store/models/meter-event.ts +423 -0
- package/api/src/store/models/meter.ts +176 -0
- package/api/src/store/models/payment-currency.ts +66 -14
- package/api/src/store/models/price.ts +6 -0
- package/api/src/store/models/product.ts +2 -2
- package/api/src/store/models/subscription.ts +24 -0
- package/api/src/store/models/types.ts +28 -2
- package/api/tests/libs/subscription.spec.ts +53 -0
- package/blocklet.yml +9 -1
- package/package.json +57 -58
- package/scripts/sdk.js +233 -1
- package/src/app.tsx +10 -0
- package/src/components/actions.tsx +22 -9
- package/src/components/balance-list.tsx +40 -12
- package/src/components/collapse.tsx +33 -15
- 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/credit-grant-item-list.tsx +99 -0
- package/src/components/customer/credit-overview.tsx +233 -0
- package/src/components/customer/form.tsx +7 -2
- 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 +34 -26
- 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 +290 -94
- package/src/components/metadata/list.tsx +11 -3
- package/src/components/meter/actions.tsx +101 -0
- package/src/components/meter/add-usage-dialog.tsx +239 -0
- package/src/components/meter/events-list.tsx +657 -0
- package/src/components/meter/form.tsx +245 -0
- package/src/components/meter/products.tsx +264 -0
- package/src/components/meter/usage-guide.tsx +174 -0
- package/src/components/passport/actions.tsx +9 -4
- package/src/components/payment-currency/add.tsx +16 -3
- package/src/components/payment-currency/form.tsx +14 -6
- package/src/components/payment-intent/actions.tsx +24 -16
- package/src/components/payment-intent/list.tsx +30 -9
- 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 +69 -15
- package/src/components/payment-method/arcblock.tsx +8 -1
- package/src/components/payment-method/base.tsx +8 -1
- package/src/components/payment-method/bitcoin.tsx +8 -1
- package/src/components/payment-method/ethereum.tsx +8 -1
- package/src/components/payment-method/evm-rpc-input.tsx +11 -7
- package/src/components/payment-method/form.tsx +2 -7
- package/src/components/payment-method/stripe.tsx +2 -0
- package/src/components/payouts/actions.tsx +1 -5
- package/src/components/payouts/list.tsx +30 -10
- package/src/components/payouts/portal/list.tsx +11 -9
- package/src/components/price/currency-select.tsx +63 -32
- package/src/components/price/form.tsx +895 -370
- 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/add-price.tsx +9 -7
- package/src/components/product/create.tsx +8 -9
- package/src/components/product/cross-sell-select.tsx +5 -1
- package/src/components/product/cross-sell.tsx +7 -2
- package/src/components/product/edit-price.tsx +21 -12
- package/src/components/product/features.tsx +26 -6
- package/src/components/product/form.tsx +115 -72
- package/src/components/progress-bar.tsx +1 -1
- package/src/components/refund/actions.tsx +1 -7
- package/src/components/refund/list.tsx +31 -18
- package/src/components/section/header.tsx +12 -14
- 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 +31 -16
- package/src/components/subscription/items/usage-records.tsx +19 -5
- package/src/components/subscription/list.tsx +5 -7
- package/src/components/subscription/metrics.tsx +62 -15
- package/src/components/subscription/portal/actions.tsx +78 -71
- 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 +27 -10
- package/src/hooks/subscription.ts +34 -0
- package/src/libs/meter-utils.ts +196 -0
- package/src/libs/util.ts +4 -0
- package/src/locales/en.tsx +385 -4
- package/src/locales/zh.tsx +364 -0
- package/src/pages/admin/billing/index.tsx +61 -33
- package/src/pages/admin/billing/invoices/detail.tsx +49 -13
- package/src/pages/admin/billing/meters/create.tsx +60 -0
- package/src/pages/admin/billing/meters/detail.tsx +435 -0
- package/src/pages/admin/billing/meters/index.tsx +210 -0
- package/src/pages/admin/billing/meters/meter-event.tsx +346 -0
- package/src/pages/admin/billing/subscriptions/detail.tsx +90 -25
- package/src/pages/admin/customers/customers/credit-grant/detail.tsx +391 -0
- package/src/pages/admin/customers/customers/detail.tsx +67 -14
- package/src/pages/admin/customers/customers/index.tsx +6 -1
- package/src/pages/admin/customers/index.tsx +5 -0
- package/src/pages/admin/developers/events/detail.tsx +37 -11
- package/src/pages/admin/developers/index.tsx +1 -1
- 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 +58 -14
- package/src/pages/admin/payments/payouts/detail.tsx +63 -15
- package/src/pages/admin/payments/refunds/detail.tsx +58 -14
- package/src/pages/admin/products/index.tsx +11 -4
- package/src/pages/admin/products/links/create.tsx +22 -4
- package/src/pages/admin/products/links/detail.tsx +43 -14
- package/src/pages/admin/products/passports/index.tsx +23 -4
- package/src/pages/admin/products/prices/actions.tsx +16 -9
- package/src/pages/admin/products/prices/detail.tsx +73 -14
- package/src/pages/admin/products/prices/list.tsx +15 -3
- package/src/pages/admin/products/pricing-tables/create.tsx +45 -12
- package/src/pages/admin/products/pricing-tables/detail.tsx +45 -14
- package/src/pages/admin/products/products/create.tsx +233 -54
- package/src/pages/admin/products/products/detail.tsx +74 -18
- package/src/pages/admin/settings/index.tsx +8 -1
- package/src/pages/admin/settings/payment-methods/index.tsx +87 -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/credit-grant/detail.tsx +308 -0
- package/src/pages/customer/index.tsx +76 -17
- 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 +78 -18
- 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 +17 -6
- package/src/pages/customer/subscription/change-plan.tsx +34 -7
- package/src/pages/customer/subscription/detail.tsx +134 -34
- package/src/pages/customer/subscription/embed.tsx +25 -5
- 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
|
@@ -60,12 +60,21 @@ export default function PayoutDetail() {
|
|
|
60
60
|
return (
|
|
61
61
|
<Root direction="column" spacing={2.5} mb={4}>
|
|
62
62
|
<Box>
|
|
63
|
-
<Stack
|
|
63
|
+
<Stack
|
|
64
|
+
className="page-header"
|
|
65
|
+
direction="row"
|
|
66
|
+
sx={{
|
|
67
|
+
justifyContent: 'space-between',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
}}>
|
|
64
70
|
<Stack
|
|
65
71
|
direction="row"
|
|
66
|
-
|
|
67
|
-
sx={{
|
|
68
|
-
|
|
72
|
+
onClick={() => goBackOrFallback('/customer/payouts')}
|
|
73
|
+
sx={{
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
fontWeight: 'normal',
|
|
76
|
+
cursor: 'pointer',
|
|
77
|
+
}}>
|
|
69
78
|
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
70
79
|
<Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
|
|
71
80
|
{t('common.previous')}
|
|
@@ -82,37 +91,60 @@ export default function PayoutDetail() {
|
|
|
82
91
|
)}
|
|
83
92
|
</Stack>
|
|
84
93
|
<Box
|
|
85
|
-
mt={4}
|
|
86
|
-
mb={3}
|
|
87
94
|
sx={{
|
|
95
|
+
mt: 4,
|
|
96
|
+
mb: 3,
|
|
88
97
|
display: 'flex',
|
|
98
|
+
|
|
89
99
|
gap: {
|
|
90
100
|
xs: 2,
|
|
91
101
|
sm: 2,
|
|
92
102
|
md: 5,
|
|
93
103
|
},
|
|
104
|
+
|
|
94
105
|
flexWrap: 'wrap',
|
|
106
|
+
|
|
95
107
|
flexDirection: {
|
|
96
108
|
xs: 'column',
|
|
97
109
|
sm: 'column',
|
|
98
110
|
md: 'row',
|
|
99
111
|
},
|
|
112
|
+
|
|
100
113
|
alignItems: {
|
|
101
114
|
xs: 'flex-start',
|
|
102
115
|
sm: 'flex-start',
|
|
103
116
|
md: 'center',
|
|
104
117
|
},
|
|
105
118
|
}}>
|
|
106
|
-
<Stack
|
|
107
|
-
|
|
108
|
-
|
|
119
|
+
<Stack
|
|
120
|
+
direction="row"
|
|
121
|
+
sx={{
|
|
122
|
+
justifyContent: 'space-between',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
}}>
|
|
125
|
+
<Stack
|
|
126
|
+
direction="row"
|
|
127
|
+
sx={{
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
}}>
|
|
130
|
+
<Stack
|
|
131
|
+
direction="row"
|
|
132
|
+
spacing={1}
|
|
133
|
+
sx={{
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
}}>
|
|
109
136
|
<Avatar
|
|
110
137
|
src={data.paymentCurrency.logo}
|
|
111
138
|
alt={data.paymentCurrency.symbol}
|
|
112
139
|
variant="square"
|
|
113
140
|
sx={{ width: '52px', height: '52px', borderRadius: 0.5 }}
|
|
114
141
|
/>
|
|
115
|
-
<Stack
|
|
142
|
+
<Stack
|
|
143
|
+
direction="column"
|
|
144
|
+
sx={{
|
|
145
|
+
alignItems: 'flex-start',
|
|
146
|
+
justifyContent: 'space-around',
|
|
147
|
+
}}>
|
|
116
148
|
<Amount amount={total} sx={{ my: 0, fontSize: '1.75rem', lineHeight: '32px' }} />
|
|
117
149
|
</Stack>
|
|
118
150
|
</Stack>
|
|
@@ -120,18 +152,22 @@ export default function PayoutDetail() {
|
|
|
120
152
|
</Stack>
|
|
121
153
|
<Stack
|
|
122
154
|
className="section-body"
|
|
123
|
-
justifyContent="flex-start"
|
|
124
|
-
flexWrap="wrap"
|
|
125
155
|
sx={{
|
|
156
|
+
justifyContent: 'flex-start',
|
|
157
|
+
flexWrap: 'wrap',
|
|
158
|
+
|
|
126
159
|
'hr.MuiDivider-root:last-child': {
|
|
127
160
|
display: 'none',
|
|
128
161
|
},
|
|
162
|
+
|
|
129
163
|
flexDirection: {
|
|
130
164
|
xs: 'column',
|
|
131
165
|
sm: 'column',
|
|
132
166
|
md: 'row',
|
|
133
167
|
},
|
|
168
|
+
|
|
134
169
|
alignItems: 'flex-start',
|
|
170
|
+
|
|
135
171
|
gap: {
|
|
136
172
|
xs: 1,
|
|
137
173
|
sm: 1,
|
|
@@ -218,7 +254,14 @@ export default function PayoutDetail() {
|
|
|
218
254
|
},
|
|
219
255
|
},
|
|
220
256
|
}}>
|
|
221
|
-
<Box
|
|
257
|
+
<Box
|
|
258
|
+
className="payment-link-column-1"
|
|
259
|
+
sx={{
|
|
260
|
+
flex: 1,
|
|
261
|
+
gap: 2.5,
|
|
262
|
+
display: 'flex',
|
|
263
|
+
flexDirection: 'column',
|
|
264
|
+
}}>
|
|
222
265
|
<Box className="section">
|
|
223
266
|
<SectionHeader title={t('common.detail')} />
|
|
224
267
|
<InfoRowGroup
|
|
@@ -322,7 +322,13 @@ export default function BalanceRechargePage() {
|
|
|
322
322
|
|
|
323
323
|
return (
|
|
324
324
|
<Root>
|
|
325
|
-
<Stack
|
|
325
|
+
<Stack
|
|
326
|
+
direction="row"
|
|
327
|
+
sx={{
|
|
328
|
+
justifyContent: 'space-between',
|
|
329
|
+
alignItems: 'center',
|
|
330
|
+
position: 'relative',
|
|
331
|
+
}}>
|
|
326
332
|
<Button
|
|
327
333
|
startIcon={<ArrowBackOutlined />}
|
|
328
334
|
variant="text"
|
|
@@ -332,19 +338,27 @@ export default function BalanceRechargePage() {
|
|
|
332
338
|
{t('common.previous')}
|
|
333
339
|
</Button>
|
|
334
340
|
</Stack>
|
|
335
|
-
|
|
336
341
|
<Typography variant="h2" gutterBottom>
|
|
337
342
|
{currency?.symbol} {t('customer.recharge.title')}
|
|
338
343
|
</Typography>
|
|
339
|
-
|
|
340
344
|
{currency && (
|
|
341
345
|
<Box ref={rechargeRef}>
|
|
342
346
|
<Stack sx={{ maxWidth: '760px' }}>
|
|
343
347
|
<Box sx={{ mb: 4 }}>
|
|
344
348
|
<BalanceCard elevation={0}>
|
|
345
|
-
<Stack
|
|
349
|
+
<Stack
|
|
350
|
+
direction="row"
|
|
351
|
+
spacing={2}
|
|
352
|
+
sx={{
|
|
353
|
+
justifyContent: 'space-between',
|
|
354
|
+
alignItems: 'center',
|
|
355
|
+
}}>
|
|
346
356
|
<Stack spacing={0.5}>
|
|
347
|
-
<Typography
|
|
357
|
+
<Typography
|
|
358
|
+
variant="body2"
|
|
359
|
+
sx={{
|
|
360
|
+
color: 'text.secondary',
|
|
361
|
+
}}>
|
|
348
362
|
{t('customer.recharge.receiveAddress')}
|
|
349
363
|
</Typography>
|
|
350
364
|
<Typography variant="body1" sx={{ wordBreak: 'break-all', fontFamily: 'monospace' }}>
|
|
@@ -388,7 +402,12 @@ export default function BalanceRechargePage() {
|
|
|
388
402
|
}
|
|
389
403
|
: undefined,
|
|
390
404
|
}}>
|
|
391
|
-
<Stack
|
|
405
|
+
<Stack
|
|
406
|
+
direction="row"
|
|
407
|
+
sx={{
|
|
408
|
+
alignItems: 'center',
|
|
409
|
+
justifyContent: 'space-between',
|
|
410
|
+
}}>
|
|
392
411
|
<Stack>
|
|
393
412
|
<Typography
|
|
394
413
|
variant="body1"
|
|
@@ -420,7 +439,12 @@ export default function BalanceRechargePage() {
|
|
|
420
439
|
<Stack sx={{ mb: 3, backgroundColor: 'background.default', borderRadius: '16px' }}>
|
|
421
440
|
<Grid container spacing={2}>
|
|
422
441
|
{presetAmounts.map(({ amount: presetAmount, label, multiplier }) => (
|
|
423
|
-
<Grid
|
|
442
|
+
<Grid
|
|
443
|
+
key={presetAmount}
|
|
444
|
+
size={{
|
|
445
|
+
xs: 6,
|
|
446
|
+
sm: 3,
|
|
447
|
+
}}>
|
|
424
448
|
<Card
|
|
425
449
|
variant="outlined"
|
|
426
450
|
sx={{
|
|
@@ -456,7 +480,12 @@ export default function BalanceRechargePage() {
|
|
|
456
480
|
{formatNumber(presetAmount)} {currency.symbol}
|
|
457
481
|
</Typography>
|
|
458
482
|
{multiplier > 0 && label && (
|
|
459
|
-
<Typography
|
|
483
|
+
<Typography
|
|
484
|
+
variant="caption"
|
|
485
|
+
align="center"
|
|
486
|
+
sx={{
|
|
487
|
+
color: 'text.secondary',
|
|
488
|
+
}}>
|
|
460
489
|
{label}
|
|
461
490
|
</Typography>
|
|
462
491
|
)}
|
|
@@ -464,7 +493,11 @@ export default function BalanceRechargePage() {
|
|
|
464
493
|
</Card>
|
|
465
494
|
</Grid>
|
|
466
495
|
))}
|
|
467
|
-
<Grid
|
|
496
|
+
<Grid
|
|
497
|
+
size={{
|
|
498
|
+
xs: 6,
|
|
499
|
+
sm: 3,
|
|
500
|
+
}}>
|
|
468
501
|
<Card
|
|
469
502
|
variant="outlined"
|
|
470
503
|
sx={{
|
|
@@ -488,7 +521,13 @@ export default function BalanceRechargePage() {
|
|
|
488
521
|
: {}),
|
|
489
522
|
}}>
|
|
490
523
|
<CardActionArea onClick={handleCustomSelect} sx={{ height: '100%', p: 1 }}>
|
|
491
|
-
<Stack
|
|
524
|
+
<Stack
|
|
525
|
+
direction="row"
|
|
526
|
+
spacing={1}
|
|
527
|
+
sx={{
|
|
528
|
+
justifyContent: 'center',
|
|
529
|
+
alignItems: 'center',
|
|
530
|
+
}}>
|
|
492
531
|
<Typography
|
|
493
532
|
variant="h6"
|
|
494
533
|
align="center"
|
|
@@ -513,18 +552,26 @@ export default function BalanceRechargePage() {
|
|
|
513
552
|
error={!!amountError}
|
|
514
553
|
helperText={amountError}
|
|
515
554
|
onChange={handleAmountChange}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
555
|
+
inputRef={customInputRef}
|
|
556
|
+
autoComplete="off"
|
|
557
|
+
slotProps={{
|
|
558
|
+
input: {
|
|
559
|
+
endAdornment: <Typography>{currency.symbol}</Typography>,
|
|
560
|
+
},
|
|
561
|
+
htmlInput: {
|
|
520
562
|
min: 0,
|
|
521
563
|
max: MAX_SAFE_AMOUNT,
|
|
522
564
|
},
|
|
523
565
|
}}
|
|
524
|
-
inputRef={customInputRef}
|
|
525
566
|
/>
|
|
526
567
|
{amount && Number(amount) > 0 && Number(unitCycle.amount) > 0 && !amountError && (
|
|
527
|
-
<Typography
|
|
568
|
+
<Typography
|
|
569
|
+
variant="body2"
|
|
570
|
+
sx={{
|
|
571
|
+
fontSize: 12,
|
|
572
|
+
color: 'text.lighter',
|
|
573
|
+
mt: 1,
|
|
574
|
+
}}>
|
|
528
575
|
{t('common.estimatedDuration', {
|
|
529
576
|
duration: formatSmartDuration(
|
|
530
577
|
Math.floor(Number(amount) / Number(unitCycle.amount)) < 1
|
|
@@ -568,12 +615,25 @@ export default function BalanceRechargePage() {
|
|
|
568
615
|
|
|
569
616
|
<Grid container spacing={2}>
|
|
570
617
|
{relatedSubscriptions.map((subscription) => (
|
|
571
|
-
<Grid
|
|
618
|
+
<Grid
|
|
619
|
+
key={subscription.id}
|
|
620
|
+
size={{
|
|
621
|
+
xs: 12,
|
|
622
|
+
sm: 6,
|
|
623
|
+
md: 4,
|
|
624
|
+
lg: 3,
|
|
625
|
+
}}>
|
|
572
626
|
<Stack
|
|
573
627
|
onClick={() => handleSubscriptionClick(subscription.id)}
|
|
574
628
|
className="base-card"
|
|
575
629
|
sx={{ height: '100%' }}>
|
|
576
|
-
<Stack
|
|
630
|
+
<Stack
|
|
631
|
+
direction="row"
|
|
632
|
+
spacing={1.5}
|
|
633
|
+
sx={{
|
|
634
|
+
alignItems: 'center',
|
|
635
|
+
mb: 1,
|
|
636
|
+
}}>
|
|
577
637
|
<Typography
|
|
578
638
|
variant="subtitle1"
|
|
579
639
|
sx={{
|
|
@@ -254,12 +254,21 @@ export default function RechargePage() {
|
|
|
254
254
|
|
|
255
255
|
return (
|
|
256
256
|
<Root>
|
|
257
|
-
<Stack
|
|
257
|
+
<Stack
|
|
258
|
+
direction="row"
|
|
259
|
+
sx={{
|
|
260
|
+
justifyContent: 'space-between',
|
|
261
|
+
alignItems: 'center',
|
|
262
|
+
position: 'relative',
|
|
263
|
+
}}>
|
|
258
264
|
<Stack
|
|
259
265
|
direction="row"
|
|
260
266
|
onClick={() => goBackOrFallback('/customer')}
|
|
261
|
-
|
|
262
|
-
|
|
267
|
+
sx={{
|
|
268
|
+
alignItems: 'center',
|
|
269
|
+
fontWeight: 'normal',
|
|
270
|
+
cursor: 'pointer',
|
|
271
|
+
}}>
|
|
263
272
|
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
264
273
|
<Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
|
|
265
274
|
{t('common.previous')}
|
|
@@ -269,7 +278,6 @@ export default function RechargePage() {
|
|
|
269
278
|
{t('customer.recharge.view')}
|
|
270
279
|
</Button>
|
|
271
280
|
</Stack>
|
|
272
|
-
|
|
273
281
|
<Box>
|
|
274
282
|
<Box
|
|
275
283
|
sx={{
|
|
@@ -279,15 +287,26 @@ export default function RechargePage() {
|
|
|
279
287
|
flexDirection: { xs: 'column', sm: 'column', md: 'row' },
|
|
280
288
|
alignItems: { xs: 'flex-start', sm: 'flex-start', md: 'center' },
|
|
281
289
|
}}>
|
|
282
|
-
<Stack
|
|
283
|
-
|
|
290
|
+
<Stack
|
|
291
|
+
direction="row"
|
|
292
|
+
sx={{
|
|
293
|
+
justifyContent: 'space-between',
|
|
294
|
+
alignItems: 'center',
|
|
295
|
+
}}>
|
|
296
|
+
<Stack
|
|
297
|
+
direction="row"
|
|
298
|
+
sx={{
|
|
299
|
+
alignItems: 'center',
|
|
300
|
+
flexWrap: 'wrap',
|
|
301
|
+
gap: 1,
|
|
302
|
+
}}>
|
|
284
303
|
<SubscriptionDescription subscription={subscription} variant="h1" />
|
|
285
304
|
</Stack>
|
|
286
305
|
</Stack>
|
|
287
306
|
<Stack
|
|
288
|
-
justifyContent="flex-start"
|
|
289
|
-
flexWrap="wrap"
|
|
290
307
|
sx={{
|
|
308
|
+
justifyContent: 'flex-start',
|
|
309
|
+
flexWrap: 'wrap',
|
|
291
310
|
flexDirection: { xs: 'column', sm: 'column', md: 'row' },
|
|
292
311
|
alignItems: { xs: 'flex-start', sm: 'flex-start', md: 'center' },
|
|
293
312
|
gap: { xs: 1, sm: 1, md: 3 },
|
|
@@ -341,7 +360,6 @@ export default function RechargePage() {
|
|
|
341
360
|
</Box>
|
|
342
361
|
</Box>
|
|
343
362
|
<Divider />
|
|
344
|
-
|
|
345
363
|
<Box sx={{ maxWidth: 600 }} ref={rechargeRef}>
|
|
346
364
|
<Typography variant="h4" gutterBottom>
|
|
347
365
|
{t('customer.recharge.title')}
|
|
@@ -373,8 +391,16 @@ export default function RechargePage() {
|
|
|
373
391
|
}
|
|
374
392
|
: undefined,
|
|
375
393
|
}}>
|
|
376
|
-
<Stack
|
|
377
|
-
|
|
394
|
+
<Stack
|
|
395
|
+
direction="row"
|
|
396
|
+
spacing={1}
|
|
397
|
+
sx={{
|
|
398
|
+
alignItems: 'center',
|
|
399
|
+
}}>
|
|
400
|
+
<Stack
|
|
401
|
+
sx={{
|
|
402
|
+
flex: 1,
|
|
403
|
+
}}>
|
|
378
404
|
<Typography
|
|
379
405
|
variant="body1"
|
|
380
406
|
color="inherit"
|
|
@@ -402,7 +428,12 @@ export default function RechargePage() {
|
|
|
402
428
|
<Stack sx={{ mb: 2, mt: 2, backgroundColor: 'background.default' }}>
|
|
403
429
|
<Grid container spacing={2}>
|
|
404
430
|
{presetAmounts.map(({ amount: presetAmount, cycles }) => (
|
|
405
|
-
<Grid
|
|
431
|
+
<Grid
|
|
432
|
+
key={presetAmount}
|
|
433
|
+
size={{
|
|
434
|
+
xs: 6,
|
|
435
|
+
sm: 4,
|
|
436
|
+
}}>
|
|
406
437
|
<Card
|
|
407
438
|
variant="outlined"
|
|
408
439
|
sx={{
|
|
@@ -421,7 +452,14 @@ export default function RechargePage() {
|
|
|
421
452
|
: {}),
|
|
422
453
|
}}>
|
|
423
454
|
<CardActionArea onClick={() => handleSelect(presetAmount)} sx={{ height: '100%' }}>
|
|
424
|
-
<Stack
|
|
455
|
+
<Stack
|
|
456
|
+
direction="column"
|
|
457
|
+
spacing={1}
|
|
458
|
+
sx={{
|
|
459
|
+
alignItems: 'center',
|
|
460
|
+
justifyContent: 'center',
|
|
461
|
+
p: 1,
|
|
462
|
+
}}>
|
|
425
463
|
<Typography
|
|
426
464
|
variant="h6"
|
|
427
465
|
sx={{
|
|
@@ -430,7 +468,11 @@ export default function RechargePage() {
|
|
|
430
468
|
}}>
|
|
431
469
|
{presetAmount} {subscription.paymentCurrency.symbol}
|
|
432
470
|
</Typography>
|
|
433
|
-
<Typography
|
|
471
|
+
<Typography
|
|
472
|
+
variant="caption"
|
|
473
|
+
sx={{
|
|
474
|
+
color: 'text.secondary',
|
|
475
|
+
}}>
|
|
434
476
|
{formatEstimatedDuration(cycles)}
|
|
435
477
|
</Typography>
|
|
436
478
|
</Stack>
|
|
@@ -438,7 +480,11 @@ export default function RechargePage() {
|
|
|
438
480
|
</Card>
|
|
439
481
|
</Grid>
|
|
440
482
|
))}
|
|
441
|
-
<Grid
|
|
483
|
+
<Grid
|
|
484
|
+
size={{
|
|
485
|
+
xs: 6,
|
|
486
|
+
sm: 4,
|
|
487
|
+
}}>
|
|
442
488
|
<Card
|
|
443
489
|
variant="outlined"
|
|
444
490
|
sx={{
|
|
@@ -455,7 +501,14 @@ export default function RechargePage() {
|
|
|
455
501
|
...(customAmount ? { borderColor: 'primary.main', borderWidth: 1 } : {}),
|
|
456
502
|
}}>
|
|
457
503
|
<CardActionArea onClick={handleCustomSelect} sx={{ height: '100%' }}>
|
|
458
|
-
<Stack
|
|
504
|
+
<Stack
|
|
505
|
+
direction="column"
|
|
506
|
+
spacing={1}
|
|
507
|
+
sx={{
|
|
508
|
+
alignItems: 'center',
|
|
509
|
+
justifyContent: 'center',
|
|
510
|
+
p: 1,
|
|
511
|
+
}}>
|
|
459
512
|
<Typography
|
|
460
513
|
variant="h6"
|
|
461
514
|
sx={{ fontWeight: 600, color: customAmount ? 'primary.main' : 'text.primary' }}>
|
|
@@ -479,19 +532,27 @@ export default function RechargePage() {
|
|
|
479
532
|
error={!!amountError}
|
|
480
533
|
helperText={amountError}
|
|
481
534
|
onChange={handleAmountChange}
|
|
482
|
-
InputProps={{
|
|
483
|
-
endAdornment: <Typography>{subscription.paymentCurrency.symbol}</Typography>,
|
|
484
|
-
autoComplete: 'off',
|
|
485
|
-
inputProps: {
|
|
486
|
-
min: 0,
|
|
487
|
-
max: MAX_SAFE_AMOUNT,
|
|
488
|
-
},
|
|
489
|
-
}}
|
|
490
535
|
sx={{ mt: 1 }}
|
|
491
536
|
inputRef={customInputRef}
|
|
537
|
+
slotProps={{
|
|
538
|
+
input: {
|
|
539
|
+
endAdornment: <Typography>{subscription.paymentCurrency.symbol}</Typography>,
|
|
540
|
+
autoComplete: 'off',
|
|
541
|
+
inputProps: {
|
|
542
|
+
min: 0,
|
|
543
|
+
max: MAX_SAFE_AMOUNT,
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
}}
|
|
492
547
|
/>
|
|
493
548
|
{amount && Number(amount) > 0 && Number(cycleAmount) > 0 && !amountError && (
|
|
494
|
-
<Typography
|
|
549
|
+
<Typography
|
|
550
|
+
variant="body2"
|
|
551
|
+
sx={{
|
|
552
|
+
fontSize: 12,
|
|
553
|
+
color: 'text.lighter',
|
|
554
|
+
mt: '8px !important',
|
|
555
|
+
}}>
|
|
495
556
|
{formatEstimatedDuration(
|
|
496
557
|
Math.floor(Number(amount) / Number(cycleAmount)) < 1
|
|
497
558
|
? parseFloat((Number(amount) / Number(cycleAmount)).toFixed(1))
|
|
@@ -72,8 +72,12 @@ const RefundTable = memo(({ invoice_id }: Props) => {
|
|
|
72
72
|
customBodyRenderLite: (_: string, index: number) => {
|
|
73
73
|
const item = data.list[index] as TRefundExpanded;
|
|
74
74
|
return (
|
|
75
|
-
<Typography
|
|
76
|
-
|
|
75
|
+
<Typography
|
|
76
|
+
component="strong"
|
|
77
|
+
sx={{
|
|
78
|
+
fontWeight: 600,
|
|
79
|
+
}}>
|
|
80
|
+
{formatBNStr(item?.amount, item?.paymentCurrency.decimal)}
|
|
77
81
|
{item?.paymentCurrency.symbol}
|
|
78
82
|
</Typography>
|
|
79
83
|
);
|
|
@@ -228,7 +232,14 @@ const RefundList = memo(({ invoice_id }: Props) => {
|
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
if (data && data.list.length === 0) {
|
|
231
|
-
return
|
|
235
|
+
return (
|
|
236
|
+
<Typography
|
|
237
|
+
sx={{
|
|
238
|
+
color: 'text.secondary',
|
|
239
|
+
}}>
|
|
240
|
+
{t('payment.customer.refund.empty')}
|
|
241
|
+
</Typography>
|
|
242
|
+
);
|
|
232
243
|
}
|
|
233
244
|
|
|
234
245
|
const hasMore = data && data.list.length < data.count;
|
|
@@ -236,7 +247,12 @@ const RefundList = memo(({ invoice_id }: Props) => {
|
|
|
236
247
|
const grouped = groupByDate(data.list);
|
|
237
248
|
|
|
238
249
|
return (
|
|
239
|
-
<Stack
|
|
250
|
+
<Stack
|
|
251
|
+
direction="column"
|
|
252
|
+
sx={{
|
|
253
|
+
gap: 1,
|
|
254
|
+
mt: 1,
|
|
255
|
+
}}>
|
|
240
256
|
{Object.entries(grouped).map(([date, payments]) => (
|
|
241
257
|
<Box key={date}>
|
|
242
258
|
<Typography sx={{ fontWeight: 'bold', color: 'text.secondary', mt: 2, mb: 1 }}>{date}</Typography>
|
|
@@ -248,31 +264,53 @@ const RefundList = memo(({ invoice_id }: Props) => {
|
|
|
248
264
|
xs: 'column',
|
|
249
265
|
sm: 'row',
|
|
250
266
|
}}
|
|
251
|
-
sx={{
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
267
|
+
sx={{
|
|
268
|
+
gap: {
|
|
269
|
+
xs: 0.5,
|
|
270
|
+
sm: 1.5,
|
|
271
|
+
md: 3,
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
flexWrap: 'nowrap',
|
|
275
|
+
my: 1,
|
|
276
|
+
}}>
|
|
277
|
+
<Box
|
|
278
|
+
sx={{
|
|
279
|
+
flex: 3,
|
|
280
|
+
}}>
|
|
259
281
|
<Typography>{formatToDate(item.created_at)}</Typography>
|
|
260
282
|
</Box>
|
|
261
|
-
<Box
|
|
262
|
-
|
|
283
|
+
<Box
|
|
284
|
+
sx={{
|
|
285
|
+
flex: 2,
|
|
286
|
+
}}>
|
|
287
|
+
<Typography
|
|
288
|
+
sx={{
|
|
289
|
+
textAlign: 'right',
|
|
290
|
+
}}>
|
|
263
291
|
{formatBNStr(item.amount, item.paymentCurrency.decimal)}
|
|
264
292
|
{item.paymentCurrency.symbol}
|
|
265
293
|
</Typography>
|
|
266
294
|
</Box>
|
|
267
|
-
<Box
|
|
295
|
+
<Box
|
|
296
|
+
sx={{
|
|
297
|
+
flex: 3,
|
|
298
|
+
}}>
|
|
268
299
|
<Status label={item.status} color={getPaymentIntentStatusColor(item.status)} />
|
|
269
300
|
</Box>
|
|
270
|
-
<Box
|
|
301
|
+
<Box
|
|
302
|
+
sx={{
|
|
303
|
+
flex: 3,
|
|
304
|
+
}}>
|
|
271
305
|
<Typography>
|
|
272
306
|
{item.description ? capitalize(toLower(item.description.replace(/_/g, ' '))) : '-'}
|
|
273
307
|
</Typography>
|
|
274
308
|
</Box>
|
|
275
|
-
<Box
|
|
309
|
+
<Box
|
|
310
|
+
sx={{
|
|
311
|
+
flex: 3,
|
|
312
|
+
minWidth: '220px',
|
|
313
|
+
}}>
|
|
276
314
|
{(item.payment_details?.arcblock?.tx_hash ||
|
|
277
315
|
item.payment_details?.ethereum?.tx_hash ||
|
|
278
316
|
item.payment_details?.base?.tx_hash) && (
|
|
@@ -293,7 +331,10 @@ const RefundList = memo(({ invoice_id }: Props) => {
|
|
|
293
331
|
</Button>
|
|
294
332
|
)}
|
|
295
333
|
{!hasMore && data.count > pageSize && (
|
|
296
|
-
<Typography
|
|
334
|
+
<Typography
|
|
335
|
+
sx={{
|
|
336
|
+
color: 'text.secondary',
|
|
337
|
+
}}>
|
|
297
338
|
{t('common.noMore', { resource: t('payment.customer.payments') })}
|
|
298
339
|
</Typography>
|
|
299
340
|
)}
|
|
@@ -302,14 +343,9 @@ const RefundList = memo(({ invoice_id }: Props) => {
|
|
|
302
343
|
);
|
|
303
344
|
});
|
|
304
345
|
|
|
305
|
-
export default function CustomerRefundList(
|
|
306
|
-
const { type, ...restProps } = props;
|
|
346
|
+
export default function CustomerRefundList({ type = 'list', ...restProps }: Props & { type?: 'table' | 'list' }) {
|
|
307
347
|
if (type === 'table') {
|
|
308
348
|
return <RefundTable {...restProps} />;
|
|
309
349
|
}
|
|
310
350
|
return <RefundList {...restProps} />;
|
|
311
351
|
}
|
|
312
|
-
|
|
313
|
-
CustomerRefundList.defaultProps = {
|
|
314
|
-
type: 'list',
|
|
315
|
-
};
|