payment-kit 1.18.55 → 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/api/src/libs/queue/index.ts +1 -3
- 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
|
@@ -90,23 +90,17 @@ type OverdraftProtectionDialogProps = {
|
|
|
90
90
|
} | null;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
OverdraftProtectionDialog.defaultProps = {
|
|
94
|
-
payerAddress: '',
|
|
95
|
-
stakingAddress: '',
|
|
96
|
-
initValues: null,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
93
|
export default function OverdraftProtectionDialog({
|
|
100
94
|
value,
|
|
101
95
|
loading,
|
|
102
96
|
onSave,
|
|
103
97
|
onCancel,
|
|
104
98
|
open,
|
|
105
|
-
stakingAddress,
|
|
106
|
-
payerAddress,
|
|
99
|
+
stakingAddress = '',
|
|
100
|
+
payerAddress = '',
|
|
107
101
|
currency,
|
|
108
102
|
subscription,
|
|
109
|
-
initValues,
|
|
103
|
+
initValues = null,
|
|
110
104
|
}: OverdraftProtectionDialogProps) {
|
|
111
105
|
const { t, locale } = useLocaleContext();
|
|
112
106
|
const { isMobile } = useMobile();
|
|
@@ -251,7 +245,12 @@ export default function OverdraftProtectionDialog({
|
|
|
251
245
|
fullWidth
|
|
252
246
|
className="base-dialog"
|
|
253
247
|
title={
|
|
254
|
-
<Stack
|
|
248
|
+
<Stack
|
|
249
|
+
direction="row"
|
|
250
|
+
spacing={1}
|
|
251
|
+
sx={{
|
|
252
|
+
alignItems: 'center',
|
|
253
|
+
}}>
|
|
255
254
|
<Typography variant="h6" component="span">
|
|
256
255
|
{t('customer.overdraftProtection.setting')}
|
|
257
256
|
</Typography>
|
|
@@ -296,7 +295,10 @@ export default function OverdraftProtectionDialog({
|
|
|
296
295
|
</Button>
|
|
297
296
|
</Stack>
|
|
298
297
|
}>
|
|
299
|
-
<Stack
|
|
298
|
+
<Stack
|
|
299
|
+
sx={{
|
|
300
|
+
gap: 2,
|
|
301
|
+
}}>
|
|
300
302
|
<Alert severity="info">
|
|
301
303
|
{value.used !== '0' && !isEnabled ? (
|
|
302
304
|
<>{t('customer.overdraftProtection.disableConfirm')}</>
|
|
@@ -317,8 +319,17 @@ export default function OverdraftProtectionDialog({
|
|
|
317
319
|
)}
|
|
318
320
|
</Alert>
|
|
319
321
|
|
|
320
|
-
<Stack
|
|
321
|
-
|
|
322
|
+
<Stack
|
|
323
|
+
spacing={2}
|
|
324
|
+
direction="row"
|
|
325
|
+
sx={{
|
|
326
|
+
alignItems: 'center',
|
|
327
|
+
}}>
|
|
328
|
+
<Typography
|
|
329
|
+
variant="subtitle1"
|
|
330
|
+
sx={{
|
|
331
|
+
color: 'text.secondary',
|
|
332
|
+
}}>
|
|
322
333
|
{t('customer.overdraftProtection.title')}
|
|
323
334
|
</Typography>
|
|
324
335
|
<FormControlLabel
|
|
@@ -328,7 +339,11 @@ export default function OverdraftProtectionDialog({
|
|
|
328
339
|
</Stack>
|
|
329
340
|
|
|
330
341
|
{isEnabled ? (
|
|
331
|
-
<Stack
|
|
342
|
+
<Stack
|
|
343
|
+
sx={{
|
|
344
|
+
gap: 1,
|
|
345
|
+
mt: '-8px',
|
|
346
|
+
}}>
|
|
332
347
|
{payerAddress && (
|
|
333
348
|
<Stack
|
|
334
349
|
sx={
|
|
@@ -343,7 +358,11 @@ export default function OverdraftProtectionDialog({
|
|
|
343
358
|
gap: 2,
|
|
344
359
|
}
|
|
345
360
|
}>
|
|
346
|
-
<Typography
|
|
361
|
+
<Typography
|
|
362
|
+
variant="subtitle2"
|
|
363
|
+
sx={{
|
|
364
|
+
color: 'text.secondary',
|
|
365
|
+
}}>
|
|
347
366
|
{t('customer.overdraftProtection.payerAddress')}
|
|
348
367
|
</Typography>
|
|
349
368
|
<Typography variant="body2" sx={{ wordBreak: 'break-all', fontFamily: 'monospace', fontWeight: '700' }}>
|
|
@@ -366,7 +385,11 @@ export default function OverdraftProtectionDialog({
|
|
|
366
385
|
gap: 2,
|
|
367
386
|
}
|
|
368
387
|
}>
|
|
369
|
-
<Typography
|
|
388
|
+
<Typography
|
|
389
|
+
variant="subtitle2"
|
|
390
|
+
sx={{
|
|
391
|
+
color: 'text.secondary',
|
|
392
|
+
}}>
|
|
370
393
|
{t('customer.overdraftProtection.stakingAddress')}
|
|
371
394
|
</Typography>
|
|
372
395
|
<Link
|
|
@@ -390,7 +413,11 @@ export default function OverdraftProtectionDialog({
|
|
|
390
413
|
</Stack>
|
|
391
414
|
)}
|
|
392
415
|
|
|
393
|
-
<Typography
|
|
416
|
+
<Typography
|
|
417
|
+
variant="body2"
|
|
418
|
+
sx={{
|
|
419
|
+
color: 'text.secondary',
|
|
420
|
+
}}>
|
|
394
421
|
{(() => {
|
|
395
422
|
if (Number(dueAmount) > 0 && !value.enabled) {
|
|
396
423
|
return t('customer.overdraftProtection.remainingNotEnough', {
|
|
@@ -414,15 +441,25 @@ export default function OverdraftProtectionDialog({
|
|
|
414
441
|
})()}
|
|
415
442
|
</Typography>
|
|
416
443
|
|
|
417
|
-
<Grid
|
|
444
|
+
<Grid
|
|
445
|
+
container
|
|
446
|
+
spacing={2}
|
|
447
|
+
sx={{
|
|
448
|
+
ml: -2,
|
|
449
|
+
mt: -1,
|
|
450
|
+
}}>
|
|
418
451
|
{cycleAmountLoading ? (
|
|
419
452
|
// 加载状态的占位
|
|
420
453
|
<>
|
|
421
454
|
{[1, 2, 3, 4, 5].map((key) => (
|
|
422
|
-
<Grid
|
|
455
|
+
<Grid size={{ xs: 6, sm: 4 }} key={key}>
|
|
423
456
|
<Card variant="outlined" sx={{ height: '100%' }}>
|
|
424
457
|
<CardActionArea sx={{ height: '100%', p: 1 }}>
|
|
425
|
-
<Stack
|
|
458
|
+
<Stack
|
|
459
|
+
spacing={1}
|
|
460
|
+
sx={{
|
|
461
|
+
alignItems: 'center',
|
|
462
|
+
}}>
|
|
426
463
|
<Skeleton variant="rectangular" width={80} height={32} />
|
|
427
464
|
<Skeleton width={100} />
|
|
428
465
|
</Stack>
|
|
@@ -430,10 +467,14 @@ export default function OverdraftProtectionDialog({
|
|
|
430
467
|
</Card>
|
|
431
468
|
</Grid>
|
|
432
469
|
))}
|
|
433
|
-
<Grid
|
|
470
|
+
<Grid size={{ xs: 6, sm: 4 }}>
|
|
434
471
|
<Card variant="outlined" sx={{ height: '100%' }}>
|
|
435
472
|
<CardActionArea sx={{ height: '100%', p: 2 }}>
|
|
436
|
-
<Stack
|
|
473
|
+
<Stack
|
|
474
|
+
spacing={1}
|
|
475
|
+
sx={{
|
|
476
|
+
alignItems: 'center',
|
|
477
|
+
}}>
|
|
437
478
|
<Skeleton variant="rectangular" width={80} height={24} />
|
|
438
479
|
</Stack>
|
|
439
480
|
</CardActionArea>
|
|
@@ -443,7 +484,7 @@ export default function OverdraftProtectionDialog({
|
|
|
443
484
|
) : (
|
|
444
485
|
<>
|
|
445
486
|
{presetAmounts.map(({ amount: presetAmount, cycles }) => (
|
|
446
|
-
<Grid
|
|
487
|
+
<Grid size={{ xs: 6, sm: 4 }} key={presetAmount}>
|
|
447
488
|
<Card
|
|
448
489
|
variant="outlined"
|
|
449
490
|
sx={{
|
|
@@ -464,11 +505,19 @@ export default function OverdraftProtectionDialog({
|
|
|
464
505
|
setCustomAmount(false);
|
|
465
506
|
}}
|
|
466
507
|
sx={{ height: '100%', p: 1 }}>
|
|
467
|
-
<Stack
|
|
508
|
+
<Stack
|
|
509
|
+
spacing={1}
|
|
510
|
+
sx={{
|
|
511
|
+
alignItems: 'center',
|
|
512
|
+
}}>
|
|
468
513
|
<Typography variant="h6" sx={{ fontWeight: 600 }}>
|
|
469
514
|
{presetAmount} {currency.symbol}
|
|
470
515
|
</Typography>
|
|
471
|
-
<Typography
|
|
516
|
+
<Typography
|
|
517
|
+
variant="caption"
|
|
518
|
+
sx={{
|
|
519
|
+
color: 'text.secondary',
|
|
520
|
+
}}>
|
|
472
521
|
{formatEstimatedDuration(cycles)}
|
|
473
522
|
</Typography>
|
|
474
523
|
</Stack>
|
|
@@ -476,7 +525,7 @@ export default function OverdraftProtectionDialog({
|
|
|
476
525
|
</Card>
|
|
477
526
|
</Grid>
|
|
478
527
|
))}
|
|
479
|
-
<Grid
|
|
528
|
+
<Grid size={{ xs: 6, sm: 4 }}>
|
|
480
529
|
<Card
|
|
481
530
|
variant="outlined"
|
|
482
531
|
sx={{
|
|
@@ -490,7 +539,11 @@ export default function OverdraftProtectionDialog({
|
|
|
490
539
|
...(customAmount ? { borderColor: 'primary.main', borderWidth: 1 } : {}),
|
|
491
540
|
}}>
|
|
492
541
|
<CardActionArea onClick={handleCustomSelect} sx={{ height: '100%', p: 2 }}>
|
|
493
|
-
<Stack
|
|
542
|
+
<Stack
|
|
543
|
+
spacing={1}
|
|
544
|
+
sx={{
|
|
545
|
+
alignItems: 'center',
|
|
546
|
+
}}>
|
|
494
547
|
<Typography variant="h6" sx={{ fontWeight: 600 }}>
|
|
495
548
|
{t('common.custom')}
|
|
496
549
|
</Typography>
|
|
@@ -538,16 +591,18 @@ export default function OverdraftProtectionDialog({
|
|
|
538
591
|
helperText={methods.formState.errors.amount?.message}
|
|
539
592
|
fullWidth
|
|
540
593
|
variant="outlined"
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
<
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
594
|
+
slotProps={{
|
|
595
|
+
input: {
|
|
596
|
+
endAdornment: (
|
|
597
|
+
<Box sx={{ ml: 1, display: 'flex', alignItems: 'center' }}>
|
|
598
|
+
<Currency logo={currency.logo} name={currency.symbol} />
|
|
599
|
+
</Box>
|
|
600
|
+
),
|
|
601
|
+
inputProps: {
|
|
602
|
+
min: 0,
|
|
603
|
+
max: MAX_SAFE_AMOUNT,
|
|
604
|
+
step: Number(estimateAmount),
|
|
605
|
+
},
|
|
551
606
|
},
|
|
552
607
|
}}
|
|
553
608
|
/>
|
|
@@ -555,7 +610,13 @@ export default function OverdraftProtectionDialog({
|
|
|
555
610
|
</Stack>
|
|
556
611
|
)}
|
|
557
612
|
{amount && Number(amount) > 0 && Number(estimateAmount) > 0 && !methods.formState.errors.amount && (
|
|
558
|
-
<Typography
|
|
613
|
+
<Typography
|
|
614
|
+
variant="body2"
|
|
615
|
+
sx={{
|
|
616
|
+
fontSize: 12,
|
|
617
|
+
color: 'text.lighter',
|
|
618
|
+
mt: '8px !important',
|
|
619
|
+
}}>
|
|
559
620
|
{t('customer.overdraftProtection.total', {
|
|
560
621
|
total: safeAdd(currency, amount, availableAmount),
|
|
561
622
|
symbol: currency.symbol,
|
|
@@ -568,11 +629,21 @@ export default function OverdraftProtectionDialog({
|
|
|
568
629
|
</Stack>
|
|
569
630
|
) : (
|
|
570
631
|
Number(availableAmount) > 0 && (
|
|
571
|
-
<Stack
|
|
632
|
+
<Stack
|
|
633
|
+
direction="row"
|
|
634
|
+
sx={{
|
|
635
|
+
alignItems: 'flex-start',
|
|
636
|
+
gap: 2,
|
|
637
|
+
}}>
|
|
572
638
|
<Typography
|
|
573
639
|
variant="subtitle2"
|
|
574
|
-
|
|
575
|
-
|
|
640
|
+
sx={{
|
|
641
|
+
color: 'text.secondary',
|
|
642
|
+
height: 39,
|
|
643
|
+
display: 'flex',
|
|
644
|
+
alignItems: 'center',
|
|
645
|
+
width: 56,
|
|
646
|
+
}}>
|
|
576
647
|
{t('customer.overdraftProtection.stake')}
|
|
577
648
|
</Typography>
|
|
578
649
|
<RadioGroup
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import { Livemode, usePaymentContext } from '@blocklet/payment-react';
|
|
2
3
|
import { Close } from '@mui/icons-material';
|
|
3
4
|
import { Box, Button, Divider, Drawer, Stack, Typography } from '@mui/material';
|
|
@@ -19,17 +20,19 @@ type Props = {
|
|
|
19
20
|
footer?: React.ReactNode;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
DrawerForm
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
export default function DrawerForm(rawProps: Props) {
|
|
24
|
+
const props = Object.assign(
|
|
25
|
+
{
|
|
26
|
+
style: {},
|
|
27
|
+
open: false,
|
|
28
|
+
width: 960,
|
|
29
|
+
onClose: noop,
|
|
30
|
+
hideLiveMode: false,
|
|
31
|
+
footer: null,
|
|
32
|
+
addons: null,
|
|
33
|
+
},
|
|
34
|
+
rawProps
|
|
35
|
+
);
|
|
33
36
|
const [open, setOpen] = useState(props.open);
|
|
34
37
|
const settings = usePaymentContext();
|
|
35
38
|
const handleClose = () => {
|
|
@@ -58,11 +61,11 @@ export default function DrawerForm(props: Props) {
|
|
|
58
61
|
disableEscapeKeyDown>
|
|
59
62
|
<Stack
|
|
60
63
|
direction="row"
|
|
61
|
-
alignItems="center"
|
|
62
|
-
justifyContent="space-between"
|
|
63
64
|
className="drawer-form-header-wrapper"
|
|
64
|
-
flexWrap="wrap"
|
|
65
65
|
sx={{
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
justifyContent: 'space-between',
|
|
68
|
+
flexWrap: 'wrap',
|
|
66
69
|
pl: 3,
|
|
67
70
|
pr: 3,
|
|
68
71
|
pb: 2,
|
|
@@ -70,6 +73,7 @@ export default function DrawerForm(props: Props) {
|
|
|
70
73
|
gap: 1,
|
|
71
74
|
borderBottom: '1px solid',
|
|
72
75
|
borderColor: 'grey.200',
|
|
76
|
+
|
|
73
77
|
'@media (max-width: 600px)': {
|
|
74
78
|
'& > .addons-wrapper': {
|
|
75
79
|
width: '100%',
|
|
@@ -80,21 +84,41 @@ export default function DrawerForm(props: Props) {
|
|
|
80
84
|
},
|
|
81
85
|
},
|
|
82
86
|
}}>
|
|
83
|
-
<Box
|
|
84
|
-
|
|
87
|
+
<Box
|
|
88
|
+
sx={{
|
|
89
|
+
flex: 1,
|
|
90
|
+
display: 'flex',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
justifyContent: 'space-between',
|
|
93
|
+
}}>
|
|
94
|
+
<Stack
|
|
95
|
+
direction="row"
|
|
96
|
+
sx={{
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
}}>
|
|
85
99
|
<Typography className="drawer-form-header" variant="h6" sx={{ fontWeight: 600 }}>
|
|
86
100
|
{props.text}
|
|
87
101
|
</Typography>
|
|
88
102
|
{!settings.livemode && !props.hideLiveMode && <Livemode />}
|
|
89
103
|
</Stack>
|
|
90
|
-
<Stack
|
|
104
|
+
<Stack
|
|
105
|
+
direction="row"
|
|
106
|
+
sx={{
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'space-between',
|
|
109
|
+
}}>
|
|
91
110
|
<Close
|
|
92
111
|
sx={{ mr: props.addons ? 1 : 0, color: 'text.secondary', cursor: 'pointer' }}
|
|
93
112
|
onClick={handleClose}
|
|
94
113
|
/>
|
|
95
114
|
</Stack>
|
|
96
115
|
</Box>
|
|
97
|
-
<Box
|
|
116
|
+
<Box
|
|
117
|
+
className="addons-wrapper"
|
|
118
|
+
sx={{
|
|
119
|
+
display: 'flex',
|
|
120
|
+
alignItems: 'center',
|
|
121
|
+
}}>
|
|
98
122
|
{props.addons && <Divider orientation="vertical" flexItem sx={{ mr: 2 }} className="addons-divider" />}
|
|
99
123
|
{props.addons}
|
|
100
124
|
</Box>
|
package/src/components/error.tsx
CHANGED
|
@@ -24,7 +24,7 @@ const Content = styled(Box)`
|
|
|
24
24
|
text-align: center;
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
|
-
export default function Error({ error }: { error?: Error }) {
|
|
27
|
+
export default function Error({ error = undefined }: { error?: Error }) {
|
|
28
28
|
const { t } = useLocaleContext();
|
|
29
29
|
|
|
30
30
|
return (
|
|
@@ -34,7 +34,3 @@ export default function Error({ error }: { error?: Error }) {
|
|
|
34
34
|
</Container>
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
Error.defaultProps = {
|
|
39
|
-
error: {},
|
|
40
|
-
};
|
|
@@ -120,15 +120,7 @@ const getEventDescription = (event: TEventExpanded) => {
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
EventList
|
|
124
|
-
features: {
|
|
125
|
-
toolbar: true,
|
|
126
|
-
},
|
|
127
|
-
type: '',
|
|
128
|
-
object_id: '',
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export default function EventList({ type, object_id, features }: ListProps) {
|
|
123
|
+
export default function EventList({ type = '', object_id = '', features = { toolbar: true } }: ListProps) {
|
|
132
124
|
const listKey = getListKey({ type, object_id });
|
|
133
125
|
const persisted = getDurableData(listKey);
|
|
134
126
|
|
|
@@ -156,7 +148,14 @@ export default function EventList({ type, object_id, features }: ListProps) {
|
|
|
156
148
|
}
|
|
157
149
|
|
|
158
150
|
if (data && data.list.length === 0) {
|
|
159
|
-
return
|
|
151
|
+
return (
|
|
152
|
+
<Typography
|
|
153
|
+
sx={{
|
|
154
|
+
color: 'text.secondary',
|
|
155
|
+
}}>
|
|
156
|
+
{t('admin.event.empty')}
|
|
157
|
+
</Typography>
|
|
158
|
+
);
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
const columns = [
|
|
@@ -51,7 +51,9 @@ type Props = {
|
|
|
51
51
|
formatStatus?: (x: string) => string;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
export default function FilterToolbar(
|
|
54
|
+
export default function FilterToolbar(rawProps: Props) {
|
|
55
|
+
const props = Object.assign({}, defaultProps, rawProps);
|
|
56
|
+
// eslint-disable-next-line react/prop-types
|
|
55
57
|
const { setSearch, search, status, currency, donation, formatStatus = (v) => v } = props;
|
|
56
58
|
const { isMobile } = useMobile();
|
|
57
59
|
const isProduct = window.location.pathname.includes('product');
|
|
@@ -74,7 +76,8 @@ export default function FilterToolbar(props: Props) {
|
|
|
74
76
|
<SearchStatus setSearch={handleSearch} search={search} status={status} formatStatus={formatStatus} />
|
|
75
77
|
{!isMobile && (
|
|
76
78
|
<>
|
|
77
|
-
{
|
|
79
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
80
|
+
{Array.isArray(donation) && donation?.length > 0 && (
|
|
78
81
|
<SearchDonation setSearch={handleSearch} search={search} donation={donation} />
|
|
79
82
|
)}
|
|
80
83
|
{isProduct ? null : (
|
|
@@ -96,26 +99,20 @@ export default function FilterToolbar(props: Props) {
|
|
|
96
99
|
);
|
|
97
100
|
}
|
|
98
101
|
|
|
99
|
-
const defaultProps = {
|
|
102
|
+
const defaultProps: Props = {
|
|
100
103
|
search: {},
|
|
101
104
|
status: [],
|
|
102
105
|
currency: false,
|
|
103
106
|
donation: [],
|
|
104
107
|
formatStatus: (v: string) => v,
|
|
108
|
+
setSearch: () => {},
|
|
105
109
|
};
|
|
106
110
|
|
|
107
|
-
FilterToolbar.defaultProps = defaultProps;
|
|
108
|
-
SearchStatus.defaultProps = defaultProps;
|
|
109
|
-
SearchCurrency.defaultProps = defaultProps;
|
|
110
|
-
SearchProducts.defaultProps = defaultProps;
|
|
111
|
-
SearchCustomers.defaultProps = defaultProps;
|
|
112
|
-
SearchDonation.defaultProps = defaultProps;
|
|
113
|
-
|
|
114
111
|
function SearchStatus({
|
|
115
|
-
status =
|
|
116
|
-
search,
|
|
112
|
+
status = defaultProps.status,
|
|
113
|
+
search = defaultProps.search,
|
|
117
114
|
setSearch,
|
|
118
|
-
formatStatus,
|
|
115
|
+
formatStatus = defaultProps.formatStatus,
|
|
119
116
|
}: Pick<Props, 'status' | 'search' | 'setSearch' | 'formatStatus'>) {
|
|
120
117
|
const [show, setShow] = useState(null);
|
|
121
118
|
const { t } = useLocaleContext();
|
|
@@ -150,7 +147,7 @@ function SearchStatus({
|
|
|
150
147
|
setShow(null);
|
|
151
148
|
}}
|
|
152
149
|
className="status-options">
|
|
153
|
-
{status
|
|
150
|
+
{status?.map((x: any) => (
|
|
154
151
|
<MenuItem
|
|
155
152
|
onClick={(e) => {
|
|
156
153
|
e.stopPropagation();
|
|
@@ -179,7 +176,7 @@ function filterCurrency(methods: any) {
|
|
|
179
176
|
return out;
|
|
180
177
|
}
|
|
181
178
|
|
|
182
|
-
function SearchCurrency({ setSearch, search }: Pick<Props, 'setSearch' | 'search'>) {
|
|
179
|
+
function SearchCurrency({ setSearch, search = defaultProps.search }: Pick<Props, 'setSearch' | 'search'>) {
|
|
183
180
|
const [show, setShow] = useState(null);
|
|
184
181
|
const { settings } = usePaymentContext();
|
|
185
182
|
const currencies = filterCurrency(settings.paymentMethods);
|
|
@@ -234,7 +231,7 @@ function SearchCurrency({ setSearch, search }: Pick<Props, 'setSearch' | 'search
|
|
|
234
231
|
);
|
|
235
232
|
}
|
|
236
233
|
|
|
237
|
-
function SearchCustomers({ setSearch, search }: Pick<Props, 'setSearch' | 'search'>) {
|
|
234
|
+
function SearchCustomers({ setSearch, search = defaultProps.search }: Pick<Props, 'setSearch' | 'search'>) {
|
|
238
235
|
const [customers, setCustomers] = useState<TCustomer[]>([]);
|
|
239
236
|
const [show, setShow] = useState(null);
|
|
240
237
|
const [searchText, setSearchText] = useState('');
|
|
@@ -337,7 +334,7 @@ function SearchCustomers({ setSearch, search }: Pick<Props, 'setSearch' | 'searc
|
|
|
337
334
|
);
|
|
338
335
|
}
|
|
339
336
|
|
|
340
|
-
function SearchProducts({ setSearch, search }: Pick<Props, 'setSearch' | 'search'>) {
|
|
337
|
+
function SearchProducts({ setSearch, search = defaultProps.search }: Pick<Props, 'setSearch' | 'search'>) {
|
|
341
338
|
const [show, setShow] = useState(null);
|
|
342
339
|
const { products } = useProductsContext();
|
|
343
340
|
const { settings } = usePaymentContext();
|
|
@@ -427,7 +424,11 @@ function SearchProducts({ setSearch, search }: Pick<Props, 'setSearch' | 'search
|
|
|
427
424
|
);
|
|
428
425
|
}
|
|
429
426
|
|
|
430
|
-
function SearchDonation({
|
|
427
|
+
function SearchDonation({
|
|
428
|
+
donation = defaultProps.donation,
|
|
429
|
+
search = defaultProps.search,
|
|
430
|
+
setSearch,
|
|
431
|
+
}: Pick<Props, 'donation' | 'search' | 'setSearch'>) {
|
|
431
432
|
const [show, setShow] = useState(null);
|
|
432
433
|
const { t } = useLocaleContext();
|
|
433
434
|
return (
|
|
@@ -461,7 +462,7 @@ function SearchDonation({ donation = [], search, setSearch }: Pick<Props, 'donat
|
|
|
461
462
|
setShow(null);
|
|
462
463
|
}}
|
|
463
464
|
className="status-options">
|
|
464
|
-
{donation
|
|
465
|
+
{donation?.map((x: any) => (
|
|
465
466
|
<MenuItem
|
|
466
467
|
onClick={(e) => {
|
|
467
468
|
e.stopPropagation();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
1
2
|
import { getWordBreakStyle } from '@blocklet/payment-react';
|
|
2
3
|
import { Avatar, Stack, SxProps, Typography, Tooltip } from '@mui/material';
|
|
3
4
|
import type { LiteralUnion } from 'type-fest';
|
|
@@ -14,17 +15,31 @@ type Props = {
|
|
|
14
15
|
tooltip?: string | React.ReactNode;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
export default function InfoCard(
|
|
18
|
+
export default function InfoCard(rawProps: Props) {
|
|
19
|
+
const props = Object.assign(
|
|
20
|
+
{
|
|
21
|
+
logo: '',
|
|
22
|
+
size: 40,
|
|
23
|
+
variant: 'rounded',
|
|
24
|
+
sx: {},
|
|
25
|
+
className: '',
|
|
26
|
+
logoName: '',
|
|
27
|
+
tooltip: false,
|
|
28
|
+
},
|
|
29
|
+
rawProps
|
|
30
|
+
);
|
|
18
31
|
const dimensions = { width: props.size, height: props.size, ...props.sx };
|
|
19
32
|
const avatarName = typeof props.name === 'string' ? props.name : props.logo;
|
|
20
33
|
|
|
21
34
|
const cardContent = (
|
|
22
35
|
<Stack
|
|
23
36
|
direction="row"
|
|
24
|
-
alignItems="center"
|
|
25
37
|
spacing={1}
|
|
26
38
|
className={`info-card-wrapper ${props.className}`}
|
|
27
|
-
sx={{
|
|
39
|
+
sx={{
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
cursor: props.tooltip ? 'pointer' : 'default',
|
|
42
|
+
}}>
|
|
28
43
|
{props.logo ? (
|
|
29
44
|
<Avatar src={props.logo} alt={props.logoName ?? avatarName} variant={props.variant as any} sx={dimensions} />
|
|
30
45
|
) : (
|
|
@@ -34,18 +49,27 @@ export default function InfoCard(props: Props) {
|
|
|
34
49
|
)}
|
|
35
50
|
<Stack
|
|
36
51
|
direction="column"
|
|
37
|
-
alignItems="flex-start"
|
|
38
|
-
justifyContent="space-around"
|
|
39
52
|
className="info-card"
|
|
40
53
|
sx={{
|
|
54
|
+
alignItems: 'flex-start',
|
|
55
|
+
justifyContent: 'space-around',
|
|
41
56
|
wordBreak: getWordBreakStyle(props.name),
|
|
42
57
|
minWidth: 140,
|
|
43
58
|
}}>
|
|
44
|
-
<Typography
|
|
59
|
+
<Typography
|
|
60
|
+
variant="body2"
|
|
61
|
+
component="div"
|
|
62
|
+
sx={{
|
|
63
|
+
color: 'text.primary',
|
|
64
|
+
}}>
|
|
45
65
|
{props.name}
|
|
46
66
|
</Typography>
|
|
47
67
|
{props.description && (
|
|
48
|
-
<Typography
|
|
68
|
+
<Typography
|
|
69
|
+
variant="subtitle2"
|
|
70
|
+
sx={{
|
|
71
|
+
color: 'text.secondary',
|
|
72
|
+
}}>
|
|
49
73
|
{props.description}
|
|
50
74
|
</Typography>
|
|
51
75
|
)}
|
|
@@ -58,7 +82,7 @@ export default function InfoCard(props: Props) {
|
|
|
58
82
|
<Tooltip
|
|
59
83
|
title={props.tooltip}
|
|
60
84
|
placement="top-start"
|
|
61
|
-
|
|
85
|
+
slotProps={{
|
|
62
86
|
tooltip: {
|
|
63
87
|
sx: {
|
|
64
88
|
bgcolor: 'background.paper',
|
|
@@ -90,13 +114,3 @@ export default function InfoCard(props: Props) {
|
|
|
90
114
|
|
|
91
115
|
return cardContent;
|
|
92
116
|
}
|
|
93
|
-
|
|
94
|
-
InfoCard.defaultProps = {
|
|
95
|
-
logo: '',
|
|
96
|
-
size: 40,
|
|
97
|
-
variant: 'rounded',
|
|
98
|
-
sx: {},
|
|
99
|
-
className: '',
|
|
100
|
-
logoName: '',
|
|
101
|
-
tooltip: false,
|
|
102
|
-
};
|