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
|
@@ -89,23 +89,6 @@ type Props = {
|
|
|
89
89
|
buttonSize?: 'small' | 'medium' | 'large';
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
SubscriptionActions.defaultProps = {
|
|
93
|
-
showExtra: false,
|
|
94
|
-
showRecharge: false,
|
|
95
|
-
showBalanceInfo: false,
|
|
96
|
-
showOverdraftProtection: false,
|
|
97
|
-
showDelegation: false,
|
|
98
|
-
onChange: null,
|
|
99
|
-
actionProps: {},
|
|
100
|
-
mode: 'all-buttons',
|
|
101
|
-
setUp: null,
|
|
102
|
-
showUnsubscribe: true,
|
|
103
|
-
includeActions: null,
|
|
104
|
-
excludeActions: null,
|
|
105
|
-
forceShowDetailAction: false,
|
|
106
|
-
buttonSize: 'small',
|
|
107
|
-
};
|
|
108
|
-
|
|
109
92
|
const fetchChangePlan = async (id: string): Promise<boolean> => {
|
|
110
93
|
try {
|
|
111
94
|
const res = await api.get(`/api/subscriptions/${id}/change-plan`);
|
|
@@ -136,20 +119,20 @@ const supportRecharge = (subscription: TSubscriptionExpanded) => {
|
|
|
136
119
|
|
|
137
120
|
export function SubscriptionActionsInner({
|
|
138
121
|
subscription,
|
|
139
|
-
showExtra,
|
|
140
|
-
showRecharge,
|
|
141
|
-
showOverdraftProtection,
|
|
142
|
-
showDelegation,
|
|
143
|
-
showUnsubscribe,
|
|
144
|
-
onChange,
|
|
145
|
-
actionProps,
|
|
146
|
-
mode,
|
|
147
|
-
setUp,
|
|
148
|
-
showBalanceInfo,
|
|
149
|
-
includeActions,
|
|
150
|
-
excludeActions,
|
|
151
|
-
forceShowDetailAction,
|
|
152
|
-
buttonSize,
|
|
122
|
+
showExtra = false,
|
|
123
|
+
showRecharge = false,
|
|
124
|
+
showOverdraftProtection = false,
|
|
125
|
+
showDelegation = false,
|
|
126
|
+
showUnsubscribe = true,
|
|
127
|
+
onChange = undefined,
|
|
128
|
+
actionProps = {},
|
|
129
|
+
mode = 'all-buttons',
|
|
130
|
+
setUp = undefined,
|
|
131
|
+
showBalanceInfo = false,
|
|
132
|
+
includeActions = null,
|
|
133
|
+
excludeActions = null,
|
|
134
|
+
forceShowDetailAction = false,
|
|
135
|
+
buttonSize = 'small',
|
|
153
136
|
}: Props) {
|
|
154
137
|
const { t, locale } = useLocaleContext();
|
|
155
138
|
const { reset, getValues } = useFormContext();
|
|
@@ -396,7 +379,12 @@ export function SubscriptionActionsInner({
|
|
|
396
379
|
show: !!(showRecharge && supportRecharge(subscription)),
|
|
397
380
|
label: () => {
|
|
398
381
|
const balanceDisplay = (
|
|
399
|
-
<Stack
|
|
382
|
+
<Stack
|
|
383
|
+
direction="row"
|
|
384
|
+
spacing={0.5}
|
|
385
|
+
sx={{
|
|
386
|
+
alignItems: 'center',
|
|
387
|
+
}}>
|
|
400
388
|
<AddOutlined fontSize="small" />
|
|
401
389
|
{t('customer.recharge.title')}
|
|
402
390
|
</Stack>
|
|
@@ -408,19 +396,6 @@ export function SubscriptionActionsInner({
|
|
|
408
396
|
|
|
409
397
|
return (
|
|
410
398
|
<Tooltip
|
|
411
|
-
componentsProps={{
|
|
412
|
-
tooltip: {
|
|
413
|
-
sx: {
|
|
414
|
-
bgcolor: 'background.paper',
|
|
415
|
-
color: 'text.primary',
|
|
416
|
-
boxShadow: 2,
|
|
417
|
-
padding: '10px 16px',
|
|
418
|
-
maxWidth: 480,
|
|
419
|
-
minWidth: 350,
|
|
420
|
-
wordBreak: 'break-word',
|
|
421
|
-
},
|
|
422
|
-
},
|
|
423
|
-
}}
|
|
424
399
|
title={
|
|
425
400
|
<Box>
|
|
426
401
|
{isInsufficientBalance && (
|
|
@@ -429,7 +404,11 @@ export function SubscriptionActionsInner({
|
|
|
429
404
|
</Alert>
|
|
430
405
|
)}
|
|
431
406
|
<Stack spacing={0.5}>
|
|
432
|
-
<Box
|
|
407
|
+
<Box
|
|
408
|
+
sx={{
|
|
409
|
+
display: 'flex',
|
|
410
|
+
justifyContent: 'space-between',
|
|
411
|
+
}}>
|
|
433
412
|
<Typography sx={{ color: 'text.secondary' }} variant="body2">
|
|
434
413
|
{t('admin.subscription.currentBalance')}
|
|
435
414
|
</Typography>
|
|
@@ -437,7 +416,11 @@ export function SubscriptionActionsInner({
|
|
|
437
416
|
{formattedBalance} {subscription.paymentCurrency.symbol}
|
|
438
417
|
</Typography>
|
|
439
418
|
</Box>
|
|
440
|
-
<Box
|
|
419
|
+
<Box
|
|
420
|
+
sx={{
|
|
421
|
+
display: 'flex',
|
|
422
|
+
justifyContent: 'space-between',
|
|
423
|
+
}}>
|
|
441
424
|
<Typography sx={{ color: 'text.secondary' }} variant="body2">
|
|
442
425
|
{t('admin.subscription.nextInvoiceAmount')}
|
|
443
426
|
</Typography>
|
|
@@ -445,7 +428,11 @@ export function SubscriptionActionsInner({
|
|
|
445
428
|
{formattedUpcoming} {subscription.paymentCurrency.symbol}
|
|
446
429
|
</Typography>
|
|
447
430
|
</Box>
|
|
448
|
-
<Box
|
|
431
|
+
<Box
|
|
432
|
+
sx={{
|
|
433
|
+
display: 'flex',
|
|
434
|
+
justifyContent: 'space-between',
|
|
435
|
+
}}>
|
|
449
436
|
<Typography sx={{ color: 'text.secondary' }} variant="body2">
|
|
450
437
|
{t('admin.subscription.paymentAddress')}
|
|
451
438
|
</Typography>
|
|
@@ -454,7 +441,20 @@ export function SubscriptionActionsInner({
|
|
|
454
441
|
</Stack>
|
|
455
442
|
</Box>
|
|
456
443
|
}
|
|
457
|
-
placement="top"
|
|
444
|
+
placement="top"
|
|
445
|
+
slotProps={{
|
|
446
|
+
tooltip: {
|
|
447
|
+
sx: {
|
|
448
|
+
bgcolor: 'background.paper',
|
|
449
|
+
color: 'text.primary',
|
|
450
|
+
boxShadow: 2,
|
|
451
|
+
padding: '10px 16px',
|
|
452
|
+
maxWidth: 480,
|
|
453
|
+
minWidth: 350,
|
|
454
|
+
wordBreak: 'break-word',
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
}}>
|
|
458
458
|
{balanceDisplay}
|
|
459
459
|
</Tooltip>
|
|
460
460
|
);
|
|
@@ -632,7 +632,13 @@ export function SubscriptionActionsInner({
|
|
|
632
632
|
};
|
|
633
633
|
|
|
634
634
|
return (
|
|
635
|
-
<Stack
|
|
635
|
+
<Stack
|
|
636
|
+
direction="row"
|
|
637
|
+
sx={{
|
|
638
|
+
alignItems: 'center',
|
|
639
|
+
gap: 1,
|
|
640
|
+
flexWrap: 'wrap',
|
|
641
|
+
}}>
|
|
636
642
|
{renderActions()}
|
|
637
643
|
{state.action === 'cancel' && state.subscription && (
|
|
638
644
|
<ConfirmDialog
|
|
@@ -660,7 +666,6 @@ export function SubscriptionActionsInner({
|
|
|
660
666
|
}}
|
|
661
667
|
/>
|
|
662
668
|
)}
|
|
663
|
-
|
|
664
669
|
{state.openProtection && (
|
|
665
670
|
<OverdraftProtectionDialog
|
|
666
671
|
value={overdraftProtection}
|
|
@@ -675,7 +680,6 @@ export function SubscriptionActionsInner({
|
|
|
675
680
|
initValues={state.protectionInitValues}
|
|
676
681
|
/>
|
|
677
682
|
)}
|
|
678
|
-
|
|
679
683
|
{state.batchPay && (
|
|
680
684
|
<OverdueInvoicePayment
|
|
681
685
|
subscriptionId={subscription.id}
|
|
@@ -694,7 +698,26 @@ export function SubscriptionActionsInner({
|
|
|
694
698
|
);
|
|
695
699
|
}
|
|
696
700
|
|
|
697
|
-
export default function SubscriptionActions(
|
|
701
|
+
export default function SubscriptionActions(rawProps: Props) {
|
|
702
|
+
const props: Props = Object.assign(
|
|
703
|
+
{
|
|
704
|
+
showExtra: false,
|
|
705
|
+
showRecharge: false,
|
|
706
|
+
showBalanceInfo: false,
|
|
707
|
+
showOverdraftProtection: false,
|
|
708
|
+
showDelegation: false,
|
|
709
|
+
onChange: null,
|
|
710
|
+
actionProps: {},
|
|
711
|
+
mode: 'all-buttons',
|
|
712
|
+
setUp: null,
|
|
713
|
+
showUnsubscribe: true,
|
|
714
|
+
includeActions: null,
|
|
715
|
+
excludeActions: null,
|
|
716
|
+
forceShowDetailAction: false,
|
|
717
|
+
buttonSize: 'small',
|
|
718
|
+
},
|
|
719
|
+
rawProps
|
|
720
|
+
);
|
|
698
721
|
const methods = useForm({
|
|
699
722
|
defaultValues: {
|
|
700
723
|
cancel: {
|
|
@@ -711,20 +734,3 @@ export default function SubscriptionActions(props: Props) {
|
|
|
711
734
|
</FormProvider>
|
|
712
735
|
);
|
|
713
736
|
}
|
|
714
|
-
|
|
715
|
-
SubscriptionActionsInner.defaultProps = {
|
|
716
|
-
showExtra: false,
|
|
717
|
-
showRecharge: false,
|
|
718
|
-
showOverdraftProtection: false,
|
|
719
|
-
showBalanceInfo: false,
|
|
720
|
-
showDelegation: false,
|
|
721
|
-
showUnsubscribe: true,
|
|
722
|
-
onChange: null,
|
|
723
|
-
actionProps: {},
|
|
724
|
-
mode: 'all-buttons',
|
|
725
|
-
setUp: null,
|
|
726
|
-
includeActions: null,
|
|
727
|
-
excludeActions: null,
|
|
728
|
-
forceShowDetailAction: false,
|
|
729
|
-
buttonSize: 'small',
|
|
730
|
-
};
|
|
@@ -9,7 +9,12 @@ export default function CustomerCancelForm({ data }: { data: TSubscriptionExpand
|
|
|
9
9
|
const { control } = useFormContext();
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<Stack
|
|
12
|
+
<Stack
|
|
13
|
+
direction="column"
|
|
14
|
+
spacing={1}
|
|
15
|
+
sx={{
|
|
16
|
+
alignItems: 'flex-start',
|
|
17
|
+
}}>
|
|
13
18
|
<Typography>
|
|
14
19
|
{data.status === 'trialing'
|
|
15
20
|
? t('payment.customer.cancel.trialDescription')
|
|
@@ -84,8 +89,10 @@ export default function CustomerCancelForm({ data }: { data: TSubscriptionExpand
|
|
|
84
89
|
maxRows={4}
|
|
85
90
|
placeholder={t('payment.customer.cancel.comment')}
|
|
86
91
|
{...field}
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
slotProps={{
|
|
93
|
+
htmlInput: {
|
|
94
|
+
maxLength: 200,
|
|
95
|
+
},
|
|
89
96
|
}}
|
|
90
97
|
/>
|
|
91
98
|
)}
|
|
@@ -52,9 +52,9 @@ type Props = {
|
|
|
52
52
|
export default function CurrentSubscriptions({
|
|
53
53
|
id,
|
|
54
54
|
status,
|
|
55
|
-
onChange,
|
|
55
|
+
onChange = () => {},
|
|
56
56
|
onClickSubscription,
|
|
57
|
-
onlyActive,
|
|
57
|
+
onlyActive = false,
|
|
58
58
|
changeActive = () => {},
|
|
59
59
|
setStatusState = () => {},
|
|
60
60
|
setHasSubscriptions = () => {},
|
|
@@ -74,10 +74,10 @@ export default function CurrentSubscriptions({
|
|
|
74
74
|
reloadDeps: [id, status],
|
|
75
75
|
onSuccess(res) {
|
|
76
76
|
if (res.totalCount > 0 || res.count > 0) {
|
|
77
|
-
setStatusState(true);
|
|
78
|
-
setHasSubscriptions(true);
|
|
77
|
+
setStatusState?.(true);
|
|
78
|
+
setHasSubscriptions?.(true);
|
|
79
79
|
} else {
|
|
80
|
-
setHasSubscriptions(false);
|
|
80
|
+
setHasSubscriptions?.(false);
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
...(isMobile
|
|
@@ -136,6 +136,7 @@ export default function CurrentSubscriptions({
|
|
|
136
136
|
<Stack
|
|
137
137
|
key={subscription.id}
|
|
138
138
|
sx={{
|
|
139
|
+
flexWrap: 'wrap',
|
|
139
140
|
padding: 2,
|
|
140
141
|
height: '100%',
|
|
141
142
|
borderRadius: 1,
|
|
@@ -146,21 +147,37 @@ export default function CurrentSubscriptions({
|
|
|
146
147
|
flexDirection: 'column',
|
|
147
148
|
justifyContent: 'space-between',
|
|
148
149
|
gap: 2,
|
|
150
|
+
|
|
149
151
|
'&:hover': {
|
|
150
152
|
backgroundColor: 'grey.50',
|
|
151
153
|
transition: 'background-color 200ms linear',
|
|
152
154
|
cursor: 'pointer',
|
|
153
155
|
},
|
|
154
|
-
}}
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
}}>
|
|
157
|
+
<Stack
|
|
158
|
+
direction="column"
|
|
159
|
+
spacing={2}
|
|
160
|
+
{...rest}
|
|
161
|
+
sx={[
|
|
162
|
+
{
|
|
163
|
+
flex: 1,
|
|
164
|
+
},
|
|
165
|
+
...(Array.isArray(rest.sx) ? rest.sx : [rest.sx]),
|
|
166
|
+
]}>
|
|
157
167
|
<Stack
|
|
158
168
|
direction="row"
|
|
159
169
|
spacing={1}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
170
|
+
onClick={() => onClickSubscription(subscription)}
|
|
171
|
+
sx={{
|
|
172
|
+
alignItems: 'flex-start',
|
|
173
|
+
justifyContent: 'space-between',
|
|
174
|
+
}}>
|
|
175
|
+
<Stack
|
|
176
|
+
direction="row"
|
|
177
|
+
spacing={1.5}
|
|
178
|
+
sx={{
|
|
179
|
+
alignItems: 'center',
|
|
180
|
+
}}>
|
|
164
181
|
{subscription.metadata?.appLogo ? (
|
|
165
182
|
<Avatar
|
|
166
183
|
src={formatProxyUrl(subscription.metadata?.appLogo)}
|
|
@@ -214,10 +231,10 @@ export default function CurrentSubscriptions({
|
|
|
214
231
|
|
|
215
232
|
<Divider />
|
|
216
233
|
<Stack
|
|
217
|
-
gap={1}
|
|
218
|
-
justifyContent="space-between"
|
|
219
|
-
flexWrap="nowrap"
|
|
220
234
|
sx={{
|
|
235
|
+
gap: 1,
|
|
236
|
+
justifyContent: 'space-between',
|
|
237
|
+
flexWrap: 'nowrap',
|
|
221
238
|
flexDirection: 'row',
|
|
222
239
|
alignItems: 'center',
|
|
223
240
|
}}>
|
|
@@ -242,7 +259,11 @@ export default function CurrentSubscriptions({
|
|
|
242
259
|
)}
|
|
243
260
|
</Typography>
|
|
244
261
|
{subscriptionTime && (
|
|
245
|
-
<Typography
|
|
262
|
+
<Typography
|
|
263
|
+
variant="body2"
|
|
264
|
+
sx={{
|
|
265
|
+
color: 'text.secondary',
|
|
266
|
+
}}>
|
|
246
267
|
({subscriptionTime})
|
|
247
268
|
</Typography>
|
|
248
269
|
)}
|
|
@@ -329,7 +350,13 @@ export default function CurrentSubscriptions({
|
|
|
329
350
|
})}
|
|
330
351
|
</Stack>
|
|
331
352
|
{hasMore && !isMobile && showLoadingMore && (
|
|
332
|
-
<Box
|
|
353
|
+
<Box
|
|
354
|
+
sx={{
|
|
355
|
+
alignItems: 'center',
|
|
356
|
+
gap: 0.5,
|
|
357
|
+
display: 'flex',
|
|
358
|
+
mt: 0.5,
|
|
359
|
+
}}>
|
|
333
360
|
{t('common.loadingMore', { resource: t('admin.subscriptions') })}
|
|
334
361
|
</Box>
|
|
335
362
|
)}
|
|
@@ -343,7 +370,10 @@ export default function CurrentSubscriptions({
|
|
|
343
370
|
</Button>
|
|
344
371
|
)}
|
|
345
372
|
{!hasMore && data.count > pageSize && (
|
|
346
|
-
<Typography
|
|
373
|
+
<Typography
|
|
374
|
+
sx={{
|
|
375
|
+
color: 'text.secondary',
|
|
376
|
+
}}>
|
|
347
377
|
{t('common.noMore', { resource: t('admin.subscriptions') })}
|
|
348
378
|
</Typography>
|
|
349
379
|
)}
|
|
@@ -369,11 +399,3 @@ export default function CurrentSubscriptions({
|
|
|
369
399
|
</Stack>
|
|
370
400
|
);
|
|
371
401
|
}
|
|
372
|
-
|
|
373
|
-
CurrentSubscriptions.defaultProps = {
|
|
374
|
-
onChange: null,
|
|
375
|
-
onlyActive: false,
|
|
376
|
-
changeActive: null,
|
|
377
|
-
setStatusState: null,
|
|
378
|
-
setHasSubscriptions: null,
|
|
379
|
-
};
|
|
@@ -21,11 +21,11 @@ type Props = {
|
|
|
21
21
|
|
|
22
22
|
export default function Uploader({
|
|
23
23
|
onUploaded,
|
|
24
|
-
preview,
|
|
25
|
-
maxFileSize,
|
|
26
|
-
maxNumberOfFiles,
|
|
27
|
-
allowedFileExts,
|
|
28
|
-
disabled,
|
|
24
|
+
preview = '',
|
|
25
|
+
maxFileSize = undefined,
|
|
26
|
+
maxNumberOfFiles = 1,
|
|
27
|
+
allowedFileExts = ['.png', '.jpeg', '.webp', '.svg', '.jpg'],
|
|
28
|
+
disabled = false,
|
|
29
29
|
}: Props) {
|
|
30
30
|
const uploaderRef = useRef<any>(null);
|
|
31
31
|
const handleOpen = useCallback(() => {
|
|
@@ -148,14 +148,6 @@ export default function Uploader({
|
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
Uploader.defaultProps = {
|
|
152
|
-
preview: '',
|
|
153
|
-
maxFileSize: undefined,
|
|
154
|
-
maxNumberOfFiles: 1,
|
|
155
|
-
allowedFileExts: ['.png', '.jpeg', '.webp', '.svg', '.jpg'],
|
|
156
|
-
disabled: false,
|
|
157
|
-
};
|
|
158
|
-
|
|
159
151
|
const Div = styled(Box)`
|
|
160
152
|
border: 1px solid;
|
|
161
153
|
border-color: ${({ theme }) => theme.palette.grey[100]};
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
Grid,
|
|
11
11
|
List,
|
|
12
12
|
ListItem,
|
|
13
|
+
ListItemButton,
|
|
13
14
|
ListItemIcon,
|
|
14
15
|
ListItemText,
|
|
15
16
|
ListSubheader,
|
|
@@ -49,13 +50,7 @@ type Props = {
|
|
|
49
50
|
event?: TEvent & { requestInfo?: RequestInfo };
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
WebhookAttempts
|
|
53
|
-
event_id: '',
|
|
54
|
-
webhook_endpoint_id: '',
|
|
55
|
-
event: null,
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default function WebhookAttempts({ event_id, webhook_endpoint_id, event }: Props) {
|
|
53
|
+
export default function WebhookAttempts({ event_id = '', webhook_endpoint_id = '', event = undefined }: Props) {
|
|
59
54
|
const { data, loadMore, loadingMore, loading } = useInfiniteScroll<Paginated<TWebhookAttemptExpanded>>(
|
|
60
55
|
(d) => {
|
|
61
56
|
const size = 15;
|
|
@@ -93,9 +88,14 @@ export default function WebhookAttempts({ event_id, webhook_endpoint_id, event }
|
|
|
93
88
|
|
|
94
89
|
return (
|
|
95
90
|
<Grid container spacing={2.5}>
|
|
96
|
-
<Grid
|
|
91
|
+
<Grid size={{ xs: 12, md: 4 }} className="attempt-list">
|
|
97
92
|
{isEmpty(Object.keys(groupedAttempts)) ? (
|
|
98
|
-
<Typography
|
|
93
|
+
<Typography
|
|
94
|
+
sx={{
|
|
95
|
+
color: 'text.secondary',
|
|
96
|
+
}}>
|
|
97
|
+
No Attempt
|
|
98
|
+
</Typography>
|
|
99
99
|
) : (
|
|
100
100
|
<>
|
|
101
101
|
<List sx={{ maxHeight: '64vh', overflowY: 'scroll' }}>
|
|
@@ -104,12 +104,17 @@ export default function WebhookAttempts({ event_id, webhook_endpoint_id, event }
|
|
|
104
104
|
<ListSubheader>{date}</ListSubheader>
|
|
105
105
|
{items.map((attempt) => (
|
|
106
106
|
<ListItem
|
|
107
|
-
button
|
|
108
107
|
key={attempt.id}
|
|
108
|
+
component={ListItemButton}
|
|
109
109
|
onClick={() => handleAttemptClick(attempt)}
|
|
110
110
|
selected={selected === attempt}
|
|
111
111
|
secondaryAction={
|
|
112
|
-
<Typography
|
|
112
|
+
<Typography
|
|
113
|
+
sx={{
|
|
114
|
+
color: 'text.secondary',
|
|
115
|
+
}}>
|
|
116
|
+
{formatTime(attempt.created_at, 'HH:mm:ss A')}
|
|
117
|
+
</Typography>
|
|
113
118
|
}>
|
|
114
119
|
<ListItemIcon>
|
|
115
120
|
{isSuccessAttempt(attempt.response_status) === false ? (
|
|
@@ -118,7 +123,16 @@ export default function WebhookAttempts({ event_id, webhook_endpoint_id, event }
|
|
|
118
123
|
<CheckCircleOutlined color="success" />
|
|
119
124
|
)}
|
|
120
125
|
</ListItemIcon>
|
|
121
|
-
<ListItemText
|
|
126
|
+
<ListItemText
|
|
127
|
+
primary={
|
|
128
|
+
<Typography
|
|
129
|
+
sx={{
|
|
130
|
+
color: 'text.primary',
|
|
131
|
+
}}>
|
|
132
|
+
{attempt.event.type}
|
|
133
|
+
</Typography>
|
|
134
|
+
}
|
|
135
|
+
/>
|
|
122
136
|
</ListItem>
|
|
123
137
|
))}
|
|
124
138
|
</React.Fragment>
|
|
@@ -129,11 +143,22 @@ export default function WebhookAttempts({ event_id, webhook_endpoint_id, event }
|
|
|
129
143
|
{loadingMore ? 'Loading more...' : 'Load more'}
|
|
130
144
|
</Button>
|
|
131
145
|
)}
|
|
132
|
-
{!hasMore &&
|
|
146
|
+
{!hasMore && (
|
|
147
|
+
<Typography
|
|
148
|
+
sx={{
|
|
149
|
+
color: 'text.secondary',
|
|
150
|
+
}}>
|
|
151
|
+
No more data
|
|
152
|
+
</Typography>
|
|
153
|
+
)}
|
|
133
154
|
</>
|
|
134
155
|
)}
|
|
135
156
|
</Grid>
|
|
136
|
-
<Grid
|
|
157
|
+
<Grid
|
|
158
|
+
size={{
|
|
159
|
+
xs: 12,
|
|
160
|
+
md: 8,
|
|
161
|
+
}}>
|
|
137
162
|
{selected && (
|
|
138
163
|
<Stack direction="column" spacing={2} sx={{ pt: 3, pl: 3, borderLeft: '1px solid', borderColor: 'grey.100' }}>
|
|
139
164
|
<Typography variant="h6">{event_id ? selected.endpoint.url : selected.event.type}</Typography>
|
|
@@ -143,7 +168,12 @@ export default function WebhookAttempts({ event_id, webhook_endpoint_id, event }
|
|
|
143
168
|
<CodeBlock language="json">{JSON.stringify(selected.response_body, null, 2)}</CodeBlock>
|
|
144
169
|
</Box>
|
|
145
170
|
<Box>
|
|
146
|
-
<Stack
|
|
171
|
+
<Stack
|
|
172
|
+
direction="row"
|
|
173
|
+
spacing={1}
|
|
174
|
+
sx={{
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
}}>
|
|
147
177
|
<Typography variant="h6">Request</Typography>
|
|
148
178
|
<RequestInfoPopper
|
|
149
179
|
// @ts-ignore
|
|
@@ -158,7 +188,12 @@ export default function WebhookAttempts({ event_id, webhook_endpoint_id, event }
|
|
|
158
188
|
)}
|
|
159
189
|
{data?.list.length === 0 && event && (
|
|
160
190
|
<Box>
|
|
161
|
-
<Stack
|
|
191
|
+
<Stack
|
|
192
|
+
direction="row"
|
|
193
|
+
spacing={1}
|
|
194
|
+
sx={{
|
|
195
|
+
alignItems: 'center',
|
|
196
|
+
}}>
|
|
162
197
|
<Typography variant="h6">Event Data</Typography>
|
|
163
198
|
<RequestInfoPopper
|
|
164
199
|
// @ts-ignore
|
|
@@ -16,11 +16,7 @@ type Props = {
|
|
|
16
16
|
requestInfo?: RequestInfo;
|
|
17
17
|
request?: RequestType;
|
|
18
18
|
};
|
|
19
|
-
RequestInfoPopper
|
|
20
|
-
requestInfo: null,
|
|
21
|
-
request: null,
|
|
22
|
-
};
|
|
23
|
-
export default function RequestInfoPopper({ requestInfo, request }: Props) {
|
|
19
|
+
export default function RequestInfoPopper({ requestInfo = undefined, request = undefined }: Props) {
|
|
24
20
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
25
21
|
|
|
26
22
|
const handleClick = (e: React.MouseEvent<HTMLElement>) => {
|
|
@@ -119,7 +115,13 @@ export default function RequestInfoPopper({ requestInfo, request }: Props) {
|
|
|
119
115
|
}}>
|
|
120
116
|
{requestInfo ? (
|
|
121
117
|
<>
|
|
122
|
-
<Typography
|
|
118
|
+
<Typography
|
|
119
|
+
variant="caption"
|
|
120
|
+
sx={{
|
|
121
|
+
color: 'text.secondary',
|
|
122
|
+
mb: 1,
|
|
123
|
+
display: 'block',
|
|
124
|
+
}}>
|
|
123
125
|
Requested by:
|
|
124
126
|
</Typography>
|
|
125
127
|
<InfoCard
|
|
@@ -2,7 +2,7 @@ import { api } from '@blocklet/payment-react';
|
|
|
2
2
|
import type { TProductExpanded } from '@blocklet/payment-types';
|
|
3
3
|
import { Alert, CircularProgress } from '@mui/material';
|
|
4
4
|
import { useRequest } from 'ahooks';
|
|
5
|
-
import { createContext, useContext } from 'react';
|
|
5
|
+
import { createContext, useContext, type JSX } from 'react';
|
|
6
6
|
|
|
7
7
|
type ProductsContextType = {
|
|
8
8
|
products: TProductExpanded[];
|