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
|
@@ -19,7 +19,14 @@ type Props = {
|
|
|
19
19
|
simple?: boolean;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export default function ProductForm(
|
|
22
|
+
export default function ProductForm(rawProps: Props) {
|
|
23
|
+
const props = Object.assign(
|
|
24
|
+
{
|
|
25
|
+
simple: false,
|
|
26
|
+
},
|
|
27
|
+
rawProps
|
|
28
|
+
);
|
|
29
|
+
|
|
23
30
|
const { t } = useLocaleContext();
|
|
24
31
|
const { control, setValue, formState } = useFormContext();
|
|
25
32
|
const images = useWatch({ control, name: 'images' });
|
|
@@ -34,8 +41,19 @@ export default function ProductForm(props: Props) {
|
|
|
34
41
|
};
|
|
35
42
|
|
|
36
43
|
return (
|
|
37
|
-
<Stack
|
|
38
|
-
|
|
44
|
+
<Stack
|
|
45
|
+
spacing={2}
|
|
46
|
+
direction="row"
|
|
47
|
+
sx={{
|
|
48
|
+
mb: 3,
|
|
49
|
+
alignItems: 'flex-start',
|
|
50
|
+
}}>
|
|
51
|
+
<Stack
|
|
52
|
+
spacing={2}
|
|
53
|
+
sx={{
|
|
54
|
+
flex: 2,
|
|
55
|
+
alignItems: 'flex-start',
|
|
56
|
+
}}>
|
|
39
57
|
<FormInput
|
|
40
58
|
name="name"
|
|
41
59
|
rules={{
|
|
@@ -71,7 +89,11 @@ export default function ProductForm(props: Props) {
|
|
|
71
89
|
inputProps={{ maxLength: 250 }}
|
|
72
90
|
/>
|
|
73
91
|
<Collapse trigger={t('admin.product.additional')}>
|
|
74
|
-
<Stack
|
|
92
|
+
<Stack
|
|
93
|
+
spacing={2}
|
|
94
|
+
sx={{
|
|
95
|
+
alignItems: 'flex-start',
|
|
96
|
+
}}>
|
|
75
97
|
<FormInput
|
|
76
98
|
name="statement_descriptor"
|
|
77
99
|
label={t('admin.product.statement_descriptor.label')}
|
|
@@ -90,21 +112,27 @@ export default function ProductForm(props: Props) {
|
|
|
90
112
|
maxLength: { value: 12, message: t('common.maxLength', { len: 12 }) },
|
|
91
113
|
}}
|
|
92
114
|
/>
|
|
115
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
93
116
|
{!props.simple && <ProductFeatures />}
|
|
117
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
94
118
|
{!props.simple && <MetadataForm title={t('common.metadata.label')} />}
|
|
95
119
|
</Stack>
|
|
96
120
|
</Collapse>
|
|
97
121
|
</Stack>
|
|
98
|
-
<Box
|
|
122
|
+
<Box
|
|
123
|
+
sx={{
|
|
124
|
+
flex: 1,
|
|
125
|
+
}}>
|
|
99
126
|
<Stack direction="column">
|
|
100
|
-
<Typography
|
|
127
|
+
<Typography
|
|
128
|
+
sx={{
|
|
129
|
+
mb: 1,
|
|
130
|
+
}}>
|
|
131
|
+
{t('admin.product.image.label')}
|
|
132
|
+
</Typography>
|
|
101
133
|
<Uploader onUploaded={onUploaded} preview={images[0]} />
|
|
102
134
|
</Stack>
|
|
103
135
|
</Box>
|
|
104
136
|
</Stack>
|
|
105
137
|
);
|
|
106
138
|
}
|
|
107
|
-
|
|
108
|
-
ProductForm.defaultProps = {
|
|
109
|
-
simple: false,
|
|
110
|
-
};
|
|
@@ -15,13 +15,7 @@ type Props = {
|
|
|
15
15
|
variant?: LiteralUnion<'compact' | 'normal', string>;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
RefundActions
|
|
19
|
-
variant: 'compact',
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
21
|
-
onChange: () => {},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default function RefundActions({ data, variant, onChange }: Props) {
|
|
18
|
+
export default function RefundActions({ data, variant = 'compact', onChange = () => {} }: Props) {
|
|
25
19
|
const { t } = useLocaleContext();
|
|
26
20
|
const navigate = useNavigate();
|
|
27
21
|
const [state, setState] = useSetState({
|
|
@@ -78,25 +78,16 @@ const getListKey = (props: ListProps) => {
|
|
|
78
78
|
return 'refunds';
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
export default function RefundList({
|
|
82
|
+
customer_id = '',
|
|
83
|
+
invoice_id = '',
|
|
84
|
+
subscription_id = '',
|
|
85
|
+
status = '',
|
|
86
|
+
features = {
|
|
83
87
|
customer: true,
|
|
84
88
|
filter: true,
|
|
85
89
|
},
|
|
86
|
-
|
|
87
|
-
invoice_id: '',
|
|
88
|
-
status: '',
|
|
89
|
-
subscription_id: '',
|
|
90
|
-
payment_intent_id: '',
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export default function RefundList({
|
|
94
|
-
customer_id,
|
|
95
|
-
invoice_id,
|
|
96
|
-
subscription_id,
|
|
97
|
-
status,
|
|
98
|
-
features,
|
|
99
|
-
payment_intent_id,
|
|
90
|
+
payment_intent_id = '',
|
|
100
91
|
}: ListProps) {
|
|
101
92
|
const { t } = useLocaleContext();
|
|
102
93
|
const listKey = getListKey({ customer_id, invoice_id, subscription_id, payment_intent_id });
|
|
@@ -139,7 +130,11 @@ export default function RefundList({
|
|
|
139
130
|
const item = data.list[index] as TRefundExpanded;
|
|
140
131
|
return (
|
|
141
132
|
<Link to={`/admin/payments/${item.id}`}>
|
|
142
|
-
<Typography
|
|
133
|
+
<Typography
|
|
134
|
+
component="strong"
|
|
135
|
+
sx={{
|
|
136
|
+
fontWeight: 600,
|
|
137
|
+
}}>
|
|
143
138
|
{formatBNStr(item?.amount, item?.paymentCurrency.decimal)}
|
|
144
139
|
{item?.paymentCurrency.symbol}
|
|
145
140
|
</Typography>
|
|
@@ -8,16 +8,31 @@ type Props = {
|
|
|
8
8
|
mt?: number;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export default function SectionHeader(
|
|
11
|
+
export default function SectionHeader(rawProps: Props) {
|
|
12
|
+
const props = Object.assign(
|
|
13
|
+
{
|
|
14
|
+
children: null,
|
|
15
|
+
mb: 1.5,
|
|
16
|
+
mt: 1.5,
|
|
17
|
+
},
|
|
18
|
+
rawProps
|
|
19
|
+
);
|
|
20
|
+
|
|
12
21
|
return (
|
|
13
22
|
<Stack
|
|
14
23
|
className="section-header"
|
|
15
24
|
direction="row"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
sx={{
|
|
26
|
+
justifyContent: 'space-between',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
flexWrap: 'wrap',
|
|
29
|
+
gap: 1,
|
|
30
|
+
// eslint-disable-next-line react/prop-types
|
|
31
|
+
mb: props.mb,
|
|
32
|
+
// eslint-disable-next-line react/prop-types
|
|
33
|
+
mt: props.mt,
|
|
34
|
+
pb: 1,
|
|
35
|
+
}}>
|
|
21
36
|
<Typography
|
|
22
37
|
variant="h3"
|
|
23
38
|
sx={{
|
|
@@ -27,15 +42,11 @@ export default function SectionHeader(props: Props) {
|
|
|
27
42
|
},
|
|
28
43
|
}}
|
|
29
44
|
component="div">
|
|
45
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
30
46
|
{props.title}
|
|
31
47
|
</Typography>
|
|
48
|
+
{/* eslint-disable-next-line react/prop-types */}
|
|
32
49
|
{props.children}
|
|
33
50
|
</Stack>
|
|
34
51
|
);
|
|
35
52
|
}
|
|
36
|
-
|
|
37
|
-
SectionHeader.defaultProps = {
|
|
38
|
-
children: null,
|
|
39
|
-
mb: 1.5,
|
|
40
|
-
mt: 1.5,
|
|
41
|
-
};
|
|
@@ -56,7 +56,12 @@ export default function SubscriptionCancelForm({ data }: { data: TSubscriptionEx
|
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
58
|
<Root sx={{ width: 400 }}>
|
|
59
|
-
<Stack
|
|
59
|
+
<Stack
|
|
60
|
+
direction="row"
|
|
61
|
+
spacing={3}
|
|
62
|
+
sx={{
|
|
63
|
+
alignItems: 'flex-start',
|
|
64
|
+
}}>
|
|
60
65
|
<Typography className="form-title">{t('admin.subscription.cancel.at.title')}</Typography>
|
|
61
66
|
<Stack>
|
|
62
67
|
<RadioGroup>
|
|
@@ -114,7 +119,12 @@ export default function SubscriptionCancelForm({ data }: { data: TSubscriptionEx
|
|
|
114
119
|
</Stack>
|
|
115
120
|
</Stack>
|
|
116
121
|
<Divider sx={{ my: 1 }} />
|
|
117
|
-
<Stack
|
|
122
|
+
<Stack
|
|
123
|
+
direction="row"
|
|
124
|
+
spacing={3}
|
|
125
|
+
sx={{
|
|
126
|
+
alignItems: 'flex-start',
|
|
127
|
+
}}>
|
|
118
128
|
<Typography className="form-title">{t('admin.subscription.cancel.refund.title')}</Typography>
|
|
119
129
|
<Stack>
|
|
120
130
|
<RadioGroup>
|
|
@@ -152,7 +162,12 @@ export default function SubscriptionCancelForm({ data }: { data: TSubscriptionEx
|
|
|
152
162
|
{data.paymentMethod.type === 'arcblock' && (
|
|
153
163
|
<>
|
|
154
164
|
<Divider sx={{ my: 1 }} />
|
|
155
|
-
<Stack
|
|
165
|
+
<Stack
|
|
166
|
+
direction="row"
|
|
167
|
+
spacing={3}
|
|
168
|
+
sx={{
|
|
169
|
+
alignItems: 'flex-start',
|
|
170
|
+
}}>
|
|
156
171
|
<Typography className="form-title">{t('admin.subscription.cancel.staking.title')}</Typography>
|
|
157
172
|
<RadioGroup>
|
|
158
173
|
<FormControlLabel
|
|
@@ -204,8 +219,10 @@ export default function SubscriptionCancelForm({ data }: { data: TSubscriptionEx
|
|
|
204
219
|
placeholder={t('admin.subscription.cancel.staking.slashReason')}
|
|
205
220
|
error={!!(formState.errors as any)?.cancel?.slashReason}
|
|
206
221
|
helperText={(formState.errors as any)?.cancel?.slashReason?.message}
|
|
207
|
-
|
|
208
|
-
|
|
222
|
+
slotProps={{
|
|
223
|
+
htmlInput: {
|
|
224
|
+
maxLength: 200,
|
|
225
|
+
},
|
|
209
226
|
}}
|
|
210
227
|
/>
|
|
211
228
|
)}
|
|
@@ -20,15 +20,11 @@ type Props = {
|
|
|
20
20
|
onChange: (action: string) => void;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
SubscriptionActionsInner.defaultProps = {
|
|
24
|
-
variant: 'compact',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
23
|
const fetchStakingData = (id: string, time: string): Promise<{ return_amount: string; slash_amount: string }> => {
|
|
28
24
|
return api.get(`/api/subscriptions/${id}/staking?time=${encodeURIComponent(time)}`).then((res: any) => res.data);
|
|
29
25
|
};
|
|
30
26
|
|
|
31
|
-
function SubscriptionActionsInner({ data, variant, onChange }: Props) {
|
|
27
|
+
function SubscriptionActionsInner({ data, variant = 'compact', onChange }: Props) {
|
|
32
28
|
const { t } = useLocaleContext();
|
|
33
29
|
const navigate = useNavigate();
|
|
34
30
|
const { reset, getValues, setError, handleSubmit } = useFormContext();
|
|
@@ -197,7 +193,14 @@ function SubscriptionActionsInner({ data, variant, onChange }: Props) {
|
|
|
197
193
|
);
|
|
198
194
|
}
|
|
199
195
|
|
|
200
|
-
export default function SubscriptionActions(
|
|
196
|
+
export default function SubscriptionActions(rawProps: Props) {
|
|
197
|
+
const props = Object.assign(
|
|
198
|
+
{
|
|
199
|
+
variant: 'compact',
|
|
200
|
+
},
|
|
201
|
+
rawProps
|
|
202
|
+
);
|
|
203
|
+
|
|
201
204
|
const methods = useForm({
|
|
202
205
|
defaultValues: {
|
|
203
206
|
cancel: {
|
|
@@ -224,7 +227,3 @@ export default function SubscriptionActions(props: Props) {
|
|
|
224
227
|
</FormProvider>
|
|
225
228
|
);
|
|
226
229
|
}
|
|
227
|
-
|
|
228
|
-
SubscriptionActions.defaultProps = {
|
|
229
|
-
variant: 'compact',
|
|
230
|
-
};
|
|
@@ -9,9 +9,22 @@ export default function SubscriptionPauseForm() {
|
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<Stack direction="column" spacing={3} sx={{ width: 400 }}>
|
|
12
|
-
<Stack
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
<Stack
|
|
13
|
+
direction="row"
|
|
14
|
+
spacing={3}
|
|
15
|
+
sx={{
|
|
16
|
+
alignItems: 'flex-start',
|
|
17
|
+
}}>
|
|
18
|
+
<Typography
|
|
19
|
+
sx={{
|
|
20
|
+
flex: 1,
|
|
21
|
+
}}>
|
|
22
|
+
{t('admin.subscription.pause.type.title')}
|
|
23
|
+
</Typography>
|
|
24
|
+
<Stack
|
|
25
|
+
sx={{
|
|
26
|
+
flex: 2,
|
|
27
|
+
}}>
|
|
15
28
|
<Controller
|
|
16
29
|
name="pause.type"
|
|
17
30
|
control={control}
|
|
@@ -50,9 +63,22 @@ export default function SubscriptionPauseForm() {
|
|
|
50
63
|
)}
|
|
51
64
|
</Stack>
|
|
52
65
|
</Stack>
|
|
53
|
-
<Stack
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
<Stack
|
|
67
|
+
direction="row"
|
|
68
|
+
spacing={3}
|
|
69
|
+
sx={{
|
|
70
|
+
alignItems: 'flex-start',
|
|
71
|
+
}}>
|
|
72
|
+
<Typography
|
|
73
|
+
sx={{
|
|
74
|
+
flex: 1,
|
|
75
|
+
}}>
|
|
76
|
+
{t('admin.subscription.pause.behavior.title')}
|
|
77
|
+
</Typography>
|
|
78
|
+
<Stack
|
|
79
|
+
sx={{
|
|
80
|
+
flex: 2,
|
|
81
|
+
}}>
|
|
56
82
|
<Controller
|
|
57
83
|
name="pause.behavior"
|
|
58
84
|
control={control}
|
|
@@ -34,10 +34,12 @@ export default function SlashStakeForm({ data, stakeValue }: { data: TSubscripti
|
|
|
34
34
|
placeholder={t('admin.subscription.cancel.staking.slashReason')}
|
|
35
35
|
error={!!(formState.errors as any)?.slashStake?.slashReason}
|
|
36
36
|
helperText={(formState.errors as any)?.slashStake?.slashReason?.message}
|
|
37
|
-
inputProps={{
|
|
38
|
-
maxLength: 200,
|
|
39
|
-
}}
|
|
40
37
|
sx={{ mt: 1 }}
|
|
38
|
+
slotProps={{
|
|
39
|
+
htmlInput: {
|
|
40
|
+
maxLength: 200,
|
|
41
|
+
},
|
|
42
|
+
}}
|
|
41
43
|
/>
|
|
42
44
|
)}
|
|
43
45
|
/>
|
|
@@ -10,11 +10,21 @@ type Props = {
|
|
|
10
10
|
maxLength?: number;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export default function SubscriptionDescription({
|
|
13
|
+
export default function SubscriptionDescription({
|
|
14
|
+
subscription,
|
|
15
|
+
variant = 'body1',
|
|
16
|
+
hideSubscription = false,
|
|
17
|
+
maxLength = 80,
|
|
18
|
+
}: Props) {
|
|
14
19
|
const { isMobile } = useMobile();
|
|
15
20
|
if (subscription.description) {
|
|
16
21
|
return (
|
|
17
|
-
<Stack
|
|
22
|
+
<Stack
|
|
23
|
+
direction="row"
|
|
24
|
+
spacing={1}
|
|
25
|
+
sx={{
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
}}>
|
|
18
28
|
<Typography variant={variant} className="subscription-description">
|
|
19
29
|
<TruncatedText text={subscription.description} maxLength={maxLength} useWidth />
|
|
20
30
|
</Typography>
|
|
@@ -33,9 +43,3 @@ export default function SubscriptionDescription({ subscription, variant, hideSub
|
|
|
33
43
|
</Typography>
|
|
34
44
|
);
|
|
35
45
|
}
|
|
36
|
-
|
|
37
|
-
SubscriptionDescription.defaultProps = {
|
|
38
|
-
variant: 'body1',
|
|
39
|
-
hideSubscription: false,
|
|
40
|
-
maxLength: 80,
|
|
41
|
-
};
|
|
@@ -15,13 +15,9 @@ type ListProps = {
|
|
|
15
15
|
mode?: 'admin' | 'customer';
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
SubscriptionItemList.defaultProps = {
|
|
19
|
-
mode: 'customer',
|
|
20
|
-
};
|
|
21
|
-
|
|
22
18
|
const size = { width: 48, height: 48 };
|
|
23
19
|
|
|
24
|
-
export default function SubscriptionItemList({ data, currency, mode }: ListProps) {
|
|
20
|
+
export default function SubscriptionItemList({ data, currency, mode = 'customer' }: ListProps) {
|
|
25
21
|
const { t } = useLocaleContext();
|
|
26
22
|
const { isMobile } = useMobile();
|
|
27
23
|
const isAdmin = mode === 'admin';
|
|
@@ -35,12 +31,15 @@ export default function SubscriptionItemList({ data, currency, mode }: ListProps
|
|
|
35
31
|
const item = data[index] as TSubscriptionItemExpanded;
|
|
36
32
|
return (
|
|
37
33
|
<Stack
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
sx={{
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
flexWrap: 'wrap',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
|
|
39
|
+
gap: {
|
|
40
|
+
xs: 1,
|
|
41
|
+
sm: 2,
|
|
42
|
+
},
|
|
44
43
|
}}>
|
|
45
44
|
{item.price.product.images.length > 0 ? (
|
|
46
45
|
// @ts-ignore
|
|
@@ -58,12 +57,20 @@ export default function SubscriptionItemList({ data, currency, mode }: ListProps
|
|
|
58
57
|
)}
|
|
59
58
|
{isAdmin ? (
|
|
60
59
|
<>
|
|
61
|
-
<Typography
|
|
60
|
+
<Typography
|
|
61
|
+
sx={{
|
|
62
|
+
color: 'text.primary',
|
|
63
|
+
fontWeight: 600,
|
|
64
|
+
}}>
|
|
62
65
|
<Link to={`/admin/products/${item?.price.product_id}`}>
|
|
63
66
|
<TruncatedText text={item?.price.product.name} maxLength={isMobile ? 20 : 50} useWidth />
|
|
64
67
|
</Link>
|
|
65
68
|
</Typography>
|
|
66
|
-
<Typography
|
|
69
|
+
<Typography
|
|
70
|
+
sx={{
|
|
71
|
+
color: 'text.secondary',
|
|
72
|
+
whiteSpace: 'nowrap',
|
|
73
|
+
}}>
|
|
67
74
|
<Link to={`/admin/products/${item?.price.id}`}>
|
|
68
75
|
{formatPrice(item.price, currency, item?.price.product.unit_label)}
|
|
69
76
|
</Link>
|
|
@@ -71,10 +78,18 @@ export default function SubscriptionItemList({ data, currency, mode }: ListProps
|
|
|
71
78
|
</>
|
|
72
79
|
) : (
|
|
73
80
|
<>
|
|
74
|
-
<Typography
|
|
81
|
+
<Typography
|
|
82
|
+
sx={{
|
|
83
|
+
color: 'text.primary',
|
|
84
|
+
fontWeight: 600,
|
|
85
|
+
}}>
|
|
75
86
|
<TruncatedText text={item?.price.product.name} maxLength={isMobile ? 20 : 50} useWidth />
|
|
76
87
|
</Typography>
|
|
77
|
-
<Typography
|
|
88
|
+
<Typography
|
|
89
|
+
sx={{
|
|
90
|
+
color: 'text.secondary',
|
|
91
|
+
whiteSpace: 'nowrap',
|
|
92
|
+
}}>
|
|
78
93
|
{formatPrice(item.price, currency, item?.price.product.unit_label)}
|
|
79
94
|
</Typography>
|
|
80
95
|
</>
|
|
@@ -117,7 +117,11 @@ export function UsageRecordDialog({
|
|
|
117
117
|
message={
|
|
118
118
|
<>
|
|
119
119
|
{start && end ? (
|
|
120
|
-
<Typography
|
|
120
|
+
<Typography
|
|
121
|
+
variant="h6"
|
|
122
|
+
sx={{
|
|
123
|
+
mb: 2,
|
|
124
|
+
}}>
|
|
121
125
|
{t('admin.subscription.usage.cycle')}: {formatTime(start * 1000)} - {formatTime(end * 1000)}
|
|
122
126
|
</Typography>
|
|
123
127
|
) : null}
|
|
@@ -148,17 +152,27 @@ export function UsageRecordDialog({
|
|
|
148
152
|
<Empty>{t('admin.usageRecord.empty')}</Empty>
|
|
149
153
|
)}
|
|
150
154
|
{!settings.livemode && window.location.pathname.includes('/admin/billing') && !disableAddUsageQuantity && (
|
|
151
|
-
<Box
|
|
155
|
+
<Box
|
|
156
|
+
sx={{
|
|
157
|
+
pt: 1,
|
|
158
|
+
pb: 1,
|
|
159
|
+
gap: 1,
|
|
160
|
+
display: 'flex',
|
|
161
|
+
justifyContent: 'center',
|
|
162
|
+
alignItems: 'center',
|
|
163
|
+
}}>
|
|
152
164
|
<TextField
|
|
153
165
|
id="add-usage-record"
|
|
154
166
|
label={t('admin.usageRecord.add.quantity')}
|
|
155
167
|
type="number"
|
|
156
168
|
size="small"
|
|
157
|
-
InputLabelProps={{
|
|
158
|
-
shrink: true,
|
|
159
|
-
}}
|
|
160
169
|
value={usageQuantity}
|
|
161
170
|
onChange={(e) => setUsageQuantity(+e.target.value)}
|
|
171
|
+
slotProps={{
|
|
172
|
+
inputLabel: {
|
|
173
|
+
shrink: true,
|
|
174
|
+
},
|
|
175
|
+
}}
|
|
162
176
|
/>
|
|
163
177
|
<Button onClick={handAddUsageQuantity} sx={{ color: 'text.link' }}>
|
|
164
178
|
{t('admin.usageRecord.add.label')}
|
|
@@ -56,16 +56,14 @@ const getListKey = (props: ListProps) => {
|
|
|
56
56
|
return 'subscriptions';
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
export default function SubscriptionList({
|
|
60
|
+
customer_id = '',
|
|
61
|
+
features = {
|
|
61
62
|
customer: true,
|
|
62
63
|
filter: true,
|
|
63
64
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default function SubscriptionList({ customer_id, features, status }: ListProps) {
|
|
65
|
+
status = '',
|
|
66
|
+
}: ListProps) {
|
|
69
67
|
const listKey = getListKey({ customer_id });
|
|
70
68
|
|
|
71
69
|
const { t } = useLocaleContext();
|
|
@@ -60,17 +60,26 @@ export default function SubscriptionMetrics({ subscription, showBalance = true }
|
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
62
|
<Stack
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
onClick={() => navigate(`/customer/subscription/${subscription.id}/recharge`)}
|
|
64
|
+
sx={{
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
gap: 0.5,
|
|
68
|
+
fontSize: '16px',
|
|
69
|
+
fontWeight: 500,
|
|
70
|
+
cursor: 'pointer',
|
|
71
|
+
'&:hover': { color: 'primary.main' },
|
|
72
|
+
}}>
|
|
68
73
|
<Avatar
|
|
69
74
|
src={subscription.paymentCurrency?.logo}
|
|
70
75
|
sx={{ width: 16, height: 16 }}
|
|
71
76
|
alt={subscription.paymentCurrency?.name}
|
|
72
77
|
/>
|
|
73
|
-
<Box
|
|
78
|
+
<Box
|
|
79
|
+
sx={{
|
|
80
|
+
display: 'flex',
|
|
81
|
+
alignItems: 'baseline',
|
|
82
|
+
}}>
|
|
74
83
|
{formatBNStr(payerValue?.token, subscription.paymentCurrency.decimal)}
|
|
75
84
|
<Typography sx={{ fontSize: '14px', ml: 0.5 }}>{subscription.paymentCurrency.symbol}</Typography>
|
|
76
85
|
</Box>
|
|
@@ -90,7 +99,12 @@ export default function SubscriptionMetrics({ subscription, showBalance = true }
|
|
|
90
99
|
{['active', 'trialing'].includes(subscription.status) && upcoming?.amount && upcoming.amount !== '0' && (
|
|
91
100
|
<InfoMetric
|
|
92
101
|
label={
|
|
93
|
-
<Typography
|
|
102
|
+
<Typography
|
|
103
|
+
sx={{
|
|
104
|
+
display: 'flex',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
gap: 0.5,
|
|
107
|
+
}}>
|
|
94
108
|
{t('admin.subscription.nextInvoiceAmount')}
|
|
95
109
|
<Tooltip title={t('admin.subscription.nextInvoiceAmountTip')} placement="top" arrow>
|
|
96
110
|
<InfoOutlined fontSize="small" sx={{ color: 'text.secondary', cursor: 'pointer', fontSize: '16px' }} />
|
|
@@ -106,7 +120,12 @@ export default function SubscriptionMetrics({ subscription, showBalance = true }
|
|
|
106
120
|
{supportShowBalance && ['active', 'trialing'].includes(subscription.status) && (
|
|
107
121
|
<InfoMetric
|
|
108
122
|
label={
|
|
109
|
-
<Stack
|
|
123
|
+
<Stack
|
|
124
|
+
direction="row"
|
|
125
|
+
spacing={1}
|
|
126
|
+
sx={{
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
}}>
|
|
110
129
|
<Typography>{t('admin.subscription.currentBalance')}</Typography>
|
|
111
130
|
<Tooltip
|
|
112
131
|
title={
|
|
@@ -149,7 +168,3 @@ export default function SubscriptionMetrics({ subscription, showBalance = true }
|
|
|
149
168
|
</>
|
|
150
169
|
);
|
|
151
170
|
}
|
|
152
|
-
|
|
153
|
-
SubscriptionMetrics.defaultProps = {
|
|
154
|
-
showBalance: true,
|
|
155
|
-
};
|