payment-kit 1.14.21 → 1.14.22
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/blocklet.yml +1 -1
- package/package.json +19 -19
- package/src/app.tsx +13 -12
- package/src/components/balance-list.tsx +12 -2
- package/src/components/copyable.tsx +3 -2
- package/src/components/customer/edit.tsx +25 -21
- package/src/components/customer/form.tsx +18 -28
- package/src/components/customer/link.tsx +1 -2
- package/src/components/date-range-picker.tsx +21 -0
- package/src/components/drawer-form.tsx +27 -4
- package/src/components/event/list.tsx +3 -2
- package/src/components/filter-toolbar.tsx +11 -4
- package/src/components/info-card.tsx +4 -2
- package/src/components/info-metric.tsx +2 -2
- package/src/components/info-row.tsx +33 -26
- package/src/components/invoice/list.tsx +2 -2
- package/src/components/invoice/table.tsx +148 -85
- package/src/components/invoice-pdf/pdf.tsx +5 -1
- package/src/components/layout/admin.tsx +8 -2
- package/src/components/metadata/editor.tsx +25 -18
- package/src/components/metadata/form.tsx +83 -25
- package/src/components/metadata/list.tsx +22 -6
- package/src/components/payment-intent/list.tsx +3 -3
- package/src/components/payment-link/preview.tsx +42 -24
- package/src/components/payouts/list.tsx +2 -3
- package/src/components/price/form.tsx +27 -12
- package/src/components/price/upsell.tsx +1 -4
- package/src/components/pricing-table/preview.tsx +42 -23
- package/src/components/product/cross-sell-select.tsx +1 -1
- package/src/components/product/cross-sell.tsx +3 -4
- package/src/components/product/edit-price.tsx +0 -1
- package/src/components/refund/list.tsx +9 -4
- package/src/components/section/header.tsx +11 -4
- package/src/components/subscription/description.tsx +10 -6
- package/src/components/subscription/items/index.tsx +28 -6
- package/src/components/subscription/list.tsx +2 -2
- package/src/components/subscription/metrics.tsx +10 -8
- package/src/components/subscription/portal/actions.tsx +37 -11
- package/src/components/subscription/portal/list.tsx +131 -70
- package/src/components/subscription/status.tsx +9 -3
- package/src/global.css +1 -1
- package/src/hooks/mobile.ts +3 -3
- package/src/libs/util.ts +6 -2
- package/src/locales/en.tsx +37 -1
- package/src/locales/zh.tsx +37 -1
- package/src/pages/admin/billing/index.tsx +24 -4
- package/src/pages/admin/billing/invoices/detail.tsx +302 -147
- package/src/pages/admin/billing/subscriptions/detail.tsx +259 -134
- package/src/pages/admin/customers/customers/detail.tsx +358 -175
- package/src/pages/admin/customers/customers/index.tsx +8 -5
- package/src/pages/admin/customers/index.tsx +22 -5
- package/src/pages/admin/developers/webhooks/index.tsx +2 -2
- package/src/pages/admin/index.tsx +24 -10
- package/src/pages/admin/overview.tsx +1 -1
- package/src/pages/admin/payments/index.tsx +22 -7
- package/src/pages/admin/payments/intents/detail.tsx +263 -121
- package/src/pages/admin/payments/payouts/detail.tsx +235 -102
- package/src/pages/admin/payments/refunds/detail.tsx +286 -133
- package/src/pages/admin/products/index.tsx +28 -12
- package/src/pages/admin/products/links/create.tsx +16 -6
- package/src/pages/admin/products/links/detail.tsx +280 -176
- package/src/pages/admin/products/links/index.tsx +4 -7
- package/src/pages/admin/products/passports/index.tsx +6 -3
- package/src/pages/admin/products/prices/detail.tsx +260 -139
- package/src/pages/admin/products/prices/list.tsx +7 -3
- package/src/pages/admin/products/pricing-tables/create.tsx +17 -5
- package/src/pages/admin/products/pricing-tables/detail.tsx +221 -121
- package/src/pages/admin/products/pricing-tables/index.tsx +1 -2
- package/src/pages/admin/products/products/detail.tsx +262 -119
- package/src/pages/admin/products/products/index.tsx +1 -2
- package/src/pages/admin/settings/index.tsx +27 -7
- package/src/pages/customer/index.tsx +431 -143
- package/src/pages/customer/invoice/detail.tsx +138 -26
- package/src/pages/customer/refund/list.tsx +193 -4
- package/src/pages/customer/subscription/change-payment.tsx +20 -20
- package/src/pages/customer/subscription/detail.tsx +168 -34
- package/src/pages/customer/subscription/embed.tsx +22 -19
- package/src/pages/home.tsx +7 -1
- package/src/components/table.tsx +0 -93
|
@@ -12,15 +12,28 @@ import { useNavigate } from 'react-router-dom';
|
|
|
12
12
|
|
|
13
13
|
import CustomerCancelForm from './cancel';
|
|
14
14
|
|
|
15
|
+
type ActionProps = {
|
|
16
|
+
[key: string]: {
|
|
17
|
+
color?: string;
|
|
18
|
+
variant?: string;
|
|
19
|
+
sx?: {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
text?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
15
26
|
type Props = {
|
|
16
27
|
subscription: TSubscriptionExpanded;
|
|
17
28
|
showExtra?: boolean;
|
|
18
29
|
onChange?: (action?: string) => any | Promise<any>;
|
|
30
|
+
actionProps?: ActionProps;
|
|
19
31
|
};
|
|
20
32
|
|
|
21
33
|
SubscriptionActions.defaultProps = {
|
|
22
34
|
showExtra: false,
|
|
23
35
|
onChange: null,
|
|
36
|
+
actionProps: {},
|
|
24
37
|
};
|
|
25
38
|
|
|
26
39
|
const fetchExtraActions = async ({
|
|
@@ -54,12 +67,12 @@ const fetchExtraActions = async ({
|
|
|
54
67
|
return { changePlan, batchPay };
|
|
55
68
|
};
|
|
56
69
|
|
|
57
|
-
export function SubscriptionActionsInner({ subscription, showExtra, onChange }: Props) {
|
|
70
|
+
export function SubscriptionActionsInner({ subscription, showExtra, onChange, actionProps }: Props) {
|
|
58
71
|
const { t, locale } = useLocaleContext();
|
|
59
72
|
const { reset, getValues } = useFormContext();
|
|
60
73
|
const navigate = useNavigate();
|
|
61
74
|
const [subs, setSubscription] = useState(subscription);
|
|
62
|
-
const action = getSubscriptionAction(subs);
|
|
75
|
+
const action = getSubscriptionAction(subs, actionProps ?? {});
|
|
63
76
|
|
|
64
77
|
const { data: extraActions } = useRequest(() => fetchExtraActions({ id: subscription.id, showExtra: !!showExtra }));
|
|
65
78
|
|
|
@@ -107,13 +120,15 @@ export function SubscriptionActionsInner({ subscription, showExtra, onChange }:
|
|
|
107
120
|
};
|
|
108
121
|
|
|
109
122
|
return (
|
|
110
|
-
<Stack direction="row" alignItems="center"
|
|
123
|
+
<Stack direction="row" alignItems="center" gap={1} flexWrap="wrap">
|
|
111
124
|
{!extraActions?.batchPay && action && (
|
|
112
125
|
<Button
|
|
113
126
|
variant={action.variant as any}
|
|
114
127
|
color={action.color as any}
|
|
115
128
|
size="small"
|
|
116
|
-
|
|
129
|
+
sx={action?.sx as any}
|
|
130
|
+
onClick={(e) => {
|
|
131
|
+
e.stopPropagation();
|
|
117
132
|
if (action.action === 'pastDue') {
|
|
118
133
|
navigate(`/customer/invoice/past-due?subscription=${subscription.id}`);
|
|
119
134
|
} else {
|
|
@@ -123,7 +138,7 @@ export function SubscriptionActionsInner({ subscription, showExtra, onChange }:
|
|
|
123
138
|
});
|
|
124
139
|
}
|
|
125
140
|
}}>
|
|
126
|
-
{t(`payment.customer.${action.action}.button`)}
|
|
141
|
+
{action?.text || t(`payment.customer.${action.action}.button`)}
|
|
127
142
|
</Button>
|
|
128
143
|
)}
|
|
129
144
|
{extraActions?.changePlan && (
|
|
@@ -131,10 +146,12 @@ export function SubscriptionActionsInner({ subscription, showExtra, onChange }:
|
|
|
131
146
|
variant="contained"
|
|
132
147
|
color="primary"
|
|
133
148
|
size="small"
|
|
134
|
-
|
|
149
|
+
sx={action?.sx as any}
|
|
150
|
+
onClick={(e) => {
|
|
151
|
+
e.stopPropagation();
|
|
135
152
|
navigate(`/customer/subscription/${subscription.id}/change-plan`);
|
|
136
153
|
}}>
|
|
137
|
-
{t('payment.customer.changePlan.button')}
|
|
154
|
+
{action?.text || t('payment.customer.changePlan.button')}
|
|
138
155
|
</Button>
|
|
139
156
|
)}
|
|
140
157
|
{!!extraActions?.batchPay && (
|
|
@@ -142,10 +159,12 @@ export function SubscriptionActionsInner({ subscription, showExtra, onChange }:
|
|
|
142
159
|
variant="contained"
|
|
143
160
|
color="info"
|
|
144
161
|
size="small"
|
|
145
|
-
|
|
162
|
+
sx={action?.sx as any}
|
|
163
|
+
onClick={(e) => {
|
|
164
|
+
e.stopPropagation();
|
|
146
165
|
navigate(`/customer/invoice/past-due?subscription=${subscription.id}¤cy=${extraActions.batchPay}`);
|
|
147
166
|
}}>
|
|
148
|
-
{t('admin.subscription.batchPay.button')}
|
|
167
|
+
{action?.text || t('admin.subscription.batchPay.button')}
|
|
149
168
|
</Button>
|
|
150
169
|
)}
|
|
151
170
|
{subscription.service_actions?.map((x) => (
|
|
@@ -165,7 +184,10 @@ export function SubscriptionActionsInner({ subscription, showExtra, onChange }:
|
|
|
165
184
|
{state.action === 'cancel' && state.subscription && (
|
|
166
185
|
<ConfirmDialog
|
|
167
186
|
onConfirm={handleCancel}
|
|
168
|
-
onCancel={() =>
|
|
187
|
+
onCancel={(e) => {
|
|
188
|
+
e.stopPropagation();
|
|
189
|
+
setState({ action: '', subscription: '' });
|
|
190
|
+
}}
|
|
169
191
|
title={t('payment.customer.cancel.title')}
|
|
170
192
|
message={<CustomerCancelForm data={subscription} />}
|
|
171
193
|
loading={state.loading}
|
|
@@ -174,7 +196,10 @@ export function SubscriptionActionsInner({ subscription, showExtra, onChange }:
|
|
|
174
196
|
{state.action === 'recover' && state.subscription && (
|
|
175
197
|
<ConfirmDialog
|
|
176
198
|
onConfirm={handleRecover}
|
|
177
|
-
onCancel={() =>
|
|
199
|
+
onCancel={(e) => {
|
|
200
|
+
e.stopPropagation();
|
|
201
|
+
setState({ action: '', subscription: '' });
|
|
202
|
+
}}
|
|
178
203
|
title={t('payment.customer.recover.title')}
|
|
179
204
|
message={t('payment.customer.recover.description', {
|
|
180
205
|
date: formatToDate(subscription.current_period_end * 1000),
|
|
@@ -207,4 +232,5 @@ export default function SubscriptionActions(props: Props) {
|
|
|
207
232
|
SubscriptionActionsInner.defaultProps = {
|
|
208
233
|
showExtra: false,
|
|
209
234
|
onChange: null,
|
|
235
|
+
actionProps: {},
|
|
210
236
|
};
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
formatPrice,
|
|
7
7
|
getSubscriptionStatusColor,
|
|
8
8
|
getSubscriptionTimeSummary,
|
|
9
|
+
useMobile,
|
|
10
|
+
formatSubscriptionStatus,
|
|
9
11
|
} from '@blocklet/payment-react';
|
|
10
12
|
import type { Paginated, TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
11
13
|
import { Avatar, AvatarGroup, Box, Button, CircularProgress, Stack, StackProps, Typography } from '@mui/material';
|
|
@@ -33,6 +35,7 @@ const pageSize = 4;
|
|
|
33
35
|
|
|
34
36
|
export default function CurrentSubscriptions({ id, status, onChange, onClickSubscription, ...rest }: Props) {
|
|
35
37
|
const { t } = useLocaleContext();
|
|
38
|
+
const { isMobile } = useMobile();
|
|
36
39
|
|
|
37
40
|
const { data, loadMore, loadingMore, loading } = useInfiniteScroll<Paginated<TSubscriptionExpanded>>(
|
|
38
41
|
(d) => {
|
|
@@ -57,80 +60,138 @@ export default function CurrentSubscriptions({ id, status, onChange, onClickSubs
|
|
|
57
60
|
|
|
58
61
|
return (
|
|
59
62
|
<Stack direction="column" spacing={2} sx={{ mt: 2 }}>
|
|
60
|
-
{data.list
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
63
|
+
{data.list?.length > 0 ? (
|
|
64
|
+
<>
|
|
65
|
+
{data.list.map((subscription) => {
|
|
66
|
+
return (
|
|
67
|
+
<Stack
|
|
68
|
+
key={subscription.id}
|
|
69
|
+
direction="row"
|
|
70
|
+
justifyContent="space-between"
|
|
71
|
+
gap={{
|
|
72
|
+
xs: 1,
|
|
73
|
+
sm: 2,
|
|
74
|
+
}}
|
|
75
|
+
sx={{
|
|
76
|
+
padding: 1.5,
|
|
77
|
+
background: 'var(--backgrounds-bg-subtle, #F9FAFB)',
|
|
78
|
+
'&:hover': {
|
|
79
|
+
backgroundColor: 'grey.50',
|
|
80
|
+
transition: 'background-color 200ms linear',
|
|
81
|
+
cursor: 'pointer',
|
|
82
|
+
},
|
|
83
|
+
}}
|
|
84
|
+
flexWrap="wrap">
|
|
85
|
+
<Stack direction="column" flex={1} spacing={0.5} {...rest}>
|
|
86
|
+
<Stack
|
|
87
|
+
direction={isMobile ? 'column' : 'row'}
|
|
88
|
+
spacing={1}
|
|
89
|
+
alignItems={isMobile ? 'flex-start' : 'center'}
|
|
90
|
+
flexWrap="wrap"
|
|
91
|
+
justifyContent="space-between"
|
|
92
|
+
onClick={() => onClickSubscription(subscription)}>
|
|
93
|
+
<Stack direction="row" spacing={1.5}>
|
|
94
|
+
<AvatarGroup max={3}>
|
|
95
|
+
{subscription.items.map((item) =>
|
|
96
|
+
item.price.product.images.length > 0 ? (
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
<Avatar
|
|
99
|
+
key={item.price.product_id}
|
|
100
|
+
src={item.price.product.images[0]}
|
|
101
|
+
alt={item.price.product.name}
|
|
102
|
+
variant="rounded"
|
|
103
|
+
sx={size}
|
|
104
|
+
/>
|
|
105
|
+
) : (
|
|
106
|
+
<Avatar key={item.price.product_id} variant="rounded" sx={size}>
|
|
107
|
+
{item.price.product.name.slice(0, 1)}
|
|
108
|
+
</Avatar>
|
|
109
|
+
)
|
|
110
|
+
)}
|
|
111
|
+
</AvatarGroup>
|
|
112
|
+
<Stack
|
|
113
|
+
direction="column"
|
|
114
|
+
spacing={0.5}
|
|
115
|
+
sx={{
|
|
116
|
+
'.MuiTypography-body1': {
|
|
117
|
+
fontSize: '16px',
|
|
118
|
+
},
|
|
119
|
+
}}>
|
|
120
|
+
<SubscriptionDescription subscription={subscription} hideSubscription variant="body1" />
|
|
121
|
+
<Status
|
|
122
|
+
size="small"
|
|
123
|
+
sx={{ height: 18, width: 'fit-content' }}
|
|
124
|
+
label={formatSubscriptionStatus(subscription.status)}
|
|
125
|
+
color={getSubscriptionStatusColor(subscription.status)}
|
|
126
|
+
/>
|
|
127
|
+
</Stack>
|
|
128
|
+
</Stack>
|
|
129
|
+
<Stack>
|
|
130
|
+
<Typography variant="subtitle1" fontWeight={500} fontSize={16}>
|
|
131
|
+
{
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
formatPrice(subscription.items[0].price, subscription.paymentCurrency)
|
|
134
|
+
}
|
|
135
|
+
</Typography>
|
|
136
|
+
</Stack>
|
|
137
|
+
</Stack>
|
|
138
|
+
<Stack
|
|
139
|
+
gap={1}
|
|
140
|
+
justifyContent="space-between"
|
|
141
|
+
flexWrap="wrap"
|
|
142
|
+
sx={{
|
|
143
|
+
flexDirection: {
|
|
144
|
+
xs: 'column',
|
|
145
|
+
lg: 'row',
|
|
146
|
+
},
|
|
147
|
+
alignItems: {
|
|
148
|
+
xs: 'flex-start',
|
|
149
|
+
lg: 'center',
|
|
150
|
+
},
|
|
151
|
+
}}>
|
|
152
|
+
<Box
|
|
153
|
+
component="div"
|
|
154
|
+
onClick={() => onClickSubscription(subscription)}
|
|
155
|
+
sx={{ display: 'flex', gap: 0.5, flexDirection: isMobile ? 'column' : 'row' }}>
|
|
156
|
+
{getSubscriptionTimeSummary(subscription)
|
|
157
|
+
.split(',')
|
|
158
|
+
.map((x) => (
|
|
159
|
+
<Typography key={x} variant="body1" color="text.secondary">
|
|
160
|
+
{x}
|
|
161
|
+
</Typography>
|
|
162
|
+
))}
|
|
163
|
+
</Box>
|
|
164
|
+
<SubscriptionActions
|
|
165
|
+
subscription={subscription}
|
|
166
|
+
onChange={onChange}
|
|
167
|
+
actionProps={{
|
|
168
|
+
cancel: {
|
|
169
|
+
variant: 'outlined',
|
|
170
|
+
color: 'primary',
|
|
171
|
+
},
|
|
172
|
+
recover: {
|
|
173
|
+
variant: 'outlined',
|
|
174
|
+
color: 'info',
|
|
175
|
+
},
|
|
176
|
+
pastDue: {
|
|
177
|
+
variant: 'outlined',
|
|
178
|
+
color: 'primary',
|
|
179
|
+
},
|
|
180
|
+
}}
|
|
112
181
|
/>
|
|
113
182
|
</Stack>
|
|
114
|
-
<Typography variant="subtitle1" fontWeight={500}>
|
|
115
|
-
{
|
|
116
|
-
// @ts-ignore
|
|
117
|
-
formatPrice(subscription.items[0].price, subscription.paymentCurrency)
|
|
118
|
-
}
|
|
119
|
-
</Typography>
|
|
120
183
|
</Stack>
|
|
121
184
|
</Stack>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
);
|
|
133
|
-
})}
|
|
185
|
+
);
|
|
186
|
+
})}
|
|
187
|
+
</>
|
|
188
|
+
) : (
|
|
189
|
+
<Box sx={{ textAlign: 'center' }}>
|
|
190
|
+
<Typography>📦</Typography>
|
|
191
|
+
<Typography>{t('admin.subscription.empty')}</Typography>
|
|
192
|
+
</Box>
|
|
193
|
+
)}
|
|
194
|
+
|
|
134
195
|
<Box>
|
|
135
196
|
{hasMore && (
|
|
136
197
|
<Button variant="text" type="button" color="inherit" onClick={loadMore} disabled={loadingMore}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import { Status, formatToDate, getSubscriptionStatusColor } from '@blocklet/payment-react';
|
|
2
|
+
import { Status, formatToDate, getSubscriptionStatusColor, formatSubscriptionStatus } from '@blocklet/payment-react';
|
|
3
3
|
import type { TSubscription } from '@blocklet/payment-types';
|
|
4
4
|
import { AccessTimeOutlined } from '@mui/icons-material';
|
|
5
5
|
|
|
@@ -47,7 +47,7 @@ export default function SubscriptionStatus({
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
if (subscription.pause_collection) {
|
|
50
|
+
if (subscription.pause_collection && ['active', 'trialing'].includes(subscription.status)) {
|
|
51
51
|
if (subscription.pause_collection.resumes_at && subscription.pause_collection.resumes_at > Date.now() / 1000) {
|
|
52
52
|
return (
|
|
53
53
|
<Status
|
|
@@ -64,5 +64,11 @@ export default function SubscriptionStatus({
|
|
|
64
64
|
return <Status label={t('admin.subscription.pause.until.never')} color="default" />;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
return
|
|
67
|
+
return (
|
|
68
|
+
<Status
|
|
69
|
+
label={formatSubscriptionStatus(subscription.status)}
|
|
70
|
+
color={getSubscriptionStatusColor(subscription.status)}
|
|
71
|
+
{...rest}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
68
74
|
}
|
package/src/global.css
CHANGED
package/src/hooks/mobile.ts
CHANGED
|
@@ -3,12 +3,12 @@ import useMediaQuery from '@mui/material/useMediaQuery';
|
|
|
3
3
|
|
|
4
4
|
const MOBILE_POINT = 'md';
|
|
5
5
|
|
|
6
|
-
function useMobile() {
|
|
6
|
+
export function useMobile(mobilePoint: 'md' | 'sm' | 'lg' | 'xl' | 'xs' = MOBILE_POINT) {
|
|
7
7
|
const theme = useTheme();
|
|
8
8
|
|
|
9
9
|
return {
|
|
10
|
-
isMobile: useMediaQuery(theme.breakpoints.down(
|
|
11
|
-
mobileSize: `${theme.breakpoints.values[
|
|
10
|
+
isMobile: useMediaQuery(theme.breakpoints.down(mobilePoint)),
|
|
11
|
+
mobileSize: `${theme.breakpoints.values[mobilePoint]}px`,
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
|
package/src/libs/util.ts
CHANGED
|
@@ -62,8 +62,12 @@ export function getPriceFromProducts(products: TProductExpanded[], priceId: stri
|
|
|
62
62
|
return product?.prices.find((x) => x.id === priceId);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
export function formatPaymentLinkPricing(
|
|
66
|
-
|
|
65
|
+
export function formatPaymentLinkPricing(
|
|
66
|
+
link: TPaymentLinkExpanded,
|
|
67
|
+
currency: TPaymentCurrency,
|
|
68
|
+
locale: string = 'en'
|
|
69
|
+
) {
|
|
70
|
+
return formatCheckoutHeadlines(link.line_items, currency, link.subscription_data?.trial_period_days || 0, locale);
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
export function getWebhookStatusColor(status: string) {
|
package/src/locales/en.tsx
CHANGED
|
@@ -10,7 +10,12 @@ export default flat({
|
|
|
10
10
|
add: 'Add more metadata',
|
|
11
11
|
edit: 'Edit metadata',
|
|
12
12
|
empty: 'No metadata',
|
|
13
|
+
emptyTip: 'You haven’t added any metadata you can add it',
|
|
13
14
|
},
|
|
15
|
+
price: 'Price',
|
|
16
|
+
add: 'Add',
|
|
17
|
+
fullscreen: 'Fullscreen',
|
|
18
|
+
exit: 'Exit',
|
|
14
19
|
},
|
|
15
20
|
admin: {
|
|
16
21
|
balances: 'Balances',
|
|
@@ -435,7 +440,7 @@ export default flat({
|
|
|
435
440
|
schedule: 'Scheduled to cancel',
|
|
436
441
|
title: 'Cancel subscription',
|
|
437
442
|
required: 'Custom cancel time is required',
|
|
438
|
-
will: '
|
|
443
|
+
will: 'End on {date}',
|
|
439
444
|
done: 'Canceled',
|
|
440
445
|
at: {
|
|
441
446
|
title: 'Cancel',
|
|
@@ -502,6 +507,13 @@ export default flat({
|
|
|
502
507
|
phone: 'Phone',
|
|
503
508
|
invoicePrefix: 'Invoice Prefix',
|
|
504
509
|
balance: 'Balance ({currency})',
|
|
510
|
+
summary: {
|
|
511
|
+
refund: 'Refunds',
|
|
512
|
+
spent: 'Spent',
|
|
513
|
+
due: 'Due',
|
|
514
|
+
stake: 'Stake',
|
|
515
|
+
balance: 'Balance',
|
|
516
|
+
},
|
|
505
517
|
address: {
|
|
506
518
|
label: 'Address',
|
|
507
519
|
country: 'Country',
|
|
@@ -560,5 +572,29 @@ export default flat({
|
|
|
560
572
|
},
|
|
561
573
|
empty: {
|
|
562
574
|
image: 'No Image',
|
|
575
|
+
refunds: 'No Refunds',
|
|
576
|
+
invoices: 'No Invoices',
|
|
577
|
+
subscriptions: 'No Subscriptions',
|
|
578
|
+
customers: 'No Customers',
|
|
579
|
+
products: 'No Products',
|
|
580
|
+
paymentLinks: 'No Payment Links',
|
|
581
|
+
paymentMethods: 'No Payment Methods',
|
|
582
|
+
pricingTables: 'No Pricing Tables',
|
|
583
|
+
paymentCurrencies: 'No Payment Currencies',
|
|
584
|
+
webhooks: 'No Webhooks',
|
|
585
|
+
events: 'No Events',
|
|
586
|
+
records: 'No matching records found',
|
|
587
|
+
payments: 'No Payments',
|
|
588
|
+
prices: 'No Prices',
|
|
589
|
+
pricing: 'You haven’t added any prices you can add it',
|
|
590
|
+
},
|
|
591
|
+
customer: {
|
|
592
|
+
subscription: {
|
|
593
|
+
cancel: 'Cancel Subscription',
|
|
594
|
+
},
|
|
595
|
+
invoiceHistory: 'Invoice History',
|
|
596
|
+
product: {
|
|
597
|
+
empty: 'No Product',
|
|
598
|
+
},
|
|
563
599
|
},
|
|
564
600
|
});
|
package/src/locales/zh.tsx
CHANGED
|
@@ -10,7 +10,12 @@ export default flat({
|
|
|
10
10
|
add: '添加更多元数据',
|
|
11
11
|
edit: '编辑元数据',
|
|
12
12
|
empty: '无元数据',
|
|
13
|
+
emptyTip: '您还没有添加任何元数据,您可以添加它',
|
|
13
14
|
},
|
|
15
|
+
price: '价格',
|
|
16
|
+
add: '添加',
|
|
17
|
+
fullscreen: '全屏',
|
|
18
|
+
exit: '退出',
|
|
14
19
|
},
|
|
15
20
|
admin: {
|
|
16
21
|
balances: '余额',
|
|
@@ -27,7 +32,7 @@ export default flat({
|
|
|
27
32
|
products: '产品定价',
|
|
28
33
|
coupons: '优惠券',
|
|
29
34
|
pricing: '定价',
|
|
30
|
-
pricingTables: '
|
|
35
|
+
pricingTables: '定价表',
|
|
31
36
|
billing: '订阅和账单',
|
|
32
37
|
invoices: '账单',
|
|
33
38
|
subscriptions: '订阅',
|
|
@@ -493,6 +498,13 @@ export default flat({
|
|
|
493
498
|
phone: '电话',
|
|
494
499
|
invoicePrefix: '账单前缀',
|
|
495
500
|
balance: '余额 ({currency})',
|
|
501
|
+
summary: {
|
|
502
|
+
refund: '退款金额',
|
|
503
|
+
spent: '花费金额',
|
|
504
|
+
due: '欠款金额',
|
|
505
|
+
stake: '质押金额',
|
|
506
|
+
balance: '余额',
|
|
507
|
+
},
|
|
496
508
|
address: {
|
|
497
509
|
label: '地址',
|
|
498
510
|
country: '国家',
|
|
@@ -550,5 +562,29 @@ export default flat({
|
|
|
550
562
|
},
|
|
551
563
|
empty: {
|
|
552
564
|
image: '无图片',
|
|
565
|
+
refunds: '没有退款记录',
|
|
566
|
+
invoices: '没有账单',
|
|
567
|
+
subscriptions: '没有订阅记录',
|
|
568
|
+
customers: '没有客户',
|
|
569
|
+
products: '没有产品',
|
|
570
|
+
paymentLinks: '没有支付链接',
|
|
571
|
+
paymentMethods: '没有支付方式',
|
|
572
|
+
pricingTables: '没有定价表',
|
|
573
|
+
paymentCurrencies: '没有货币',
|
|
574
|
+
webhooks: '没有钩子',
|
|
575
|
+
events: '没有事件',
|
|
576
|
+
records: '没有找到匹配的记录',
|
|
577
|
+
payments: '没有付款记录',
|
|
578
|
+
prices: '没有价格',
|
|
579
|
+
pricing: '您还没有设置定价,您可以添加它',
|
|
580
|
+
},
|
|
581
|
+
customer: {
|
|
582
|
+
subscription: {
|
|
583
|
+
cancel: '取消订阅',
|
|
584
|
+
},
|
|
585
|
+
invoiceHistory: '历史账单',
|
|
586
|
+
product: {
|
|
587
|
+
empty: '没有订阅产品',
|
|
588
|
+
},
|
|
553
589
|
},
|
|
554
590
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Tabs from '@arcblock/ux/lib/Tabs';
|
|
3
|
-
import { Typography } from '@mui/material';
|
|
3
|
+
// import { Typography } from '@mui/material';
|
|
4
4
|
import React, { isValidElement } from 'react';
|
|
5
5
|
import { useNavigate, useParams } from 'react-router-dom';
|
|
6
6
|
|
|
@@ -43,10 +43,30 @@ export default function BillingIndex() {
|
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<div>
|
|
46
|
-
<Typography variant="h5" sx={{ mb: 1, fontWeight: 600 }}>
|
|
46
|
+
{/* <Typography variant="h5" sx={{ mb: 1, fontWeight: 600 }}>
|
|
47
47
|
{t('admin.billing')}
|
|
48
|
-
</Typography>
|
|
49
|
-
<Tabs
|
|
48
|
+
</Typography> */}
|
|
49
|
+
<Tabs
|
|
50
|
+
tabs={tabs}
|
|
51
|
+
current={page}
|
|
52
|
+
onChange={onTabChange}
|
|
53
|
+
scrollButtons="auto"
|
|
54
|
+
sx={{
|
|
55
|
+
'.MuiTab-root': {
|
|
56
|
+
color: 'text.lighter',
|
|
57
|
+
},
|
|
58
|
+
'.MuiTabs-indicator': {
|
|
59
|
+
display: 'none',
|
|
60
|
+
},
|
|
61
|
+
'.Mui-selected': {
|
|
62
|
+
fontSize: 24,
|
|
63
|
+
color: 'text.primary',
|
|
64
|
+
},
|
|
65
|
+
'.MuiTabs-hideScrollbar': {
|
|
66
|
+
border: 'none !important',
|
|
67
|
+
},
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
50
70
|
{isValidElement(TabComponent) ? TabComponent : <TabComponent />}
|
|
51
71
|
</div>
|
|
52
72
|
);
|