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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
4
|
-
import { api, formatError, formatTime, usePaymentContext } from '@blocklet/payment-react';
|
|
4
|
+
import { api, formatError, formatTime, usePaymentContext, Table } from '@blocklet/payment-react';
|
|
5
5
|
import type { TLineItemExpanded, TPaymentLinkExpanded, TPrice, TProduct } from '@blocklet/payment-types';
|
|
6
|
-
import { ArrowBackOutlined
|
|
7
|
-
import { Alert, Box, Button, CircularProgress, Grid, Stack, Typography } from '@mui/material';
|
|
6
|
+
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
7
|
+
import { Alert, Box, Button, CircularProgress, Divider, Grid, Stack, Typography } from '@mui/material';
|
|
8
8
|
import { styled } from '@mui/system';
|
|
9
9
|
import { useRequest, useSetState } from 'ahooks';
|
|
10
10
|
import { Link, useNavigate } from 'react-router-dom';
|
|
@@ -20,13 +20,16 @@ import PaymentLinkActions from '../../../../components/payment-link/actions';
|
|
|
20
20
|
import PaymentLinkPreview from '../../../../components/payment-link/preview';
|
|
21
21
|
import AddPrice from '../../../../components/product/add-price';
|
|
22
22
|
import SectionHeader from '../../../../components/section/header';
|
|
23
|
-
import Table from '../../../../components/table';
|
|
24
23
|
import { formatPaymentLinkPricing, formatProductPrice, goBackOrFallback } from '../../../../libs/util';
|
|
24
|
+
import InfoMetric from '../../../../components/info-metric';
|
|
25
25
|
|
|
26
26
|
const fetchData = (id: string): Promise<TPaymentLinkExpanded> => {
|
|
27
27
|
return api.get(`/api/payment-links/${id}`).then((res) => res.data);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const InfoDirection = 'column';
|
|
31
|
+
const InfoAlignItems = 'flex-start';
|
|
32
|
+
|
|
30
33
|
export default function PaymentLinkDetail(props: { id: string }) {
|
|
31
34
|
const { t, locale } = useLocaleContext();
|
|
32
35
|
const navigate = useNavigate();
|
|
@@ -93,11 +96,15 @@ export default function PaymentLinkDetail(props: { id: string }) {
|
|
|
93
96
|
}
|
|
94
97
|
};
|
|
95
98
|
|
|
96
|
-
const result = formatPaymentLinkPricing(data, settings.baseCurrency);
|
|
99
|
+
const result = formatPaymentLinkPricing(data, settings.baseCurrency, locale);
|
|
100
|
+
|
|
101
|
+
const handleEditMetadata = () => {
|
|
102
|
+
setState((prev) => ({ editing: { ...prev.editing, metadata: true } }));
|
|
103
|
+
};
|
|
97
104
|
|
|
98
105
|
return (
|
|
99
106
|
<Grid container spacing={4} sx={{ mb: 4 }}>
|
|
100
|
-
<Grid item
|
|
107
|
+
<Grid item xs={12}>
|
|
101
108
|
<Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
|
|
102
109
|
<Stack
|
|
103
110
|
direction="row"
|
|
@@ -109,193 +116,290 @@ export default function PaymentLinkDetail(props: { id: string }) {
|
|
|
109
116
|
{t('admin.paymentLinks')}
|
|
110
117
|
</Typography>
|
|
111
118
|
</Stack>
|
|
112
|
-
<
|
|
119
|
+
<PaymentLinkActions data={data} onChange={onChange} variant="normal" />
|
|
113
120
|
</Stack>
|
|
114
|
-
<Box
|
|
121
|
+
<Box
|
|
122
|
+
mt={4}
|
|
123
|
+
mb={3}
|
|
124
|
+
sx={{
|
|
125
|
+
display: 'flex',
|
|
126
|
+
gap: {
|
|
127
|
+
xs: 2,
|
|
128
|
+
sm: 2,
|
|
129
|
+
md: 5,
|
|
130
|
+
},
|
|
131
|
+
flexWrap: 'wrap',
|
|
132
|
+
flexDirection: {
|
|
133
|
+
xs: 'column',
|
|
134
|
+
sm: 'column',
|
|
135
|
+
md: 'row',
|
|
136
|
+
},
|
|
137
|
+
alignItems: {
|
|
138
|
+
xs: 'flex-start',
|
|
139
|
+
sm: 'flex-start',
|
|
140
|
+
md: 'center',
|
|
141
|
+
},
|
|
142
|
+
}}>
|
|
115
143
|
<Stack direction="row" justifyContent="space-between" alignItems="center">
|
|
116
|
-
<Stack
|
|
117
|
-
<
|
|
118
|
-
<Typography variant="h5" sx={{ color: 'text.primary', fontWeight: 600 }}>
|
|
119
|
-
{data.name}
|
|
120
|
-
</Typography>
|
|
121
|
-
<Typography sx={{ mx: 1, color: 'text.secondary' }}>for</Typography>
|
|
122
|
-
<Typography variant="h6" sx={{ color: 'text.primary', fontWeight: 500 }}>
|
|
123
|
-
{[result.amount, result.then].filter(Boolean).join(', ')}
|
|
124
|
-
</Typography>
|
|
125
|
-
</Stack>
|
|
144
|
+
<Stack gap={1}>
|
|
145
|
+
<Typography variant="h1">{data.name}</Typography>
|
|
126
146
|
<Copyable text={joinURL(window.blocklet.appUrl, window.blocklet.prefix, `/checkout/pay/${data.id}`)}>
|
|
127
|
-
<Typography
|
|
147
|
+
<Typography
|
|
148
|
+
variant="h6"
|
|
149
|
+
sx={{
|
|
150
|
+
color: 'text.secondary',
|
|
151
|
+
mr: 1,
|
|
152
|
+
maxWidth: '80%',
|
|
153
|
+
textOverflow: 'ellipsis',
|
|
154
|
+
overflow: 'hidden',
|
|
155
|
+
}}>
|
|
128
156
|
{joinURL(window.blocklet.prefix, `/checkout/pay/${data.id}`)}
|
|
129
157
|
</Typography>
|
|
130
158
|
</Copyable>
|
|
131
159
|
</Stack>
|
|
132
|
-
|
|
160
|
+
</Stack>
|
|
161
|
+
<Stack
|
|
162
|
+
className="section-body"
|
|
163
|
+
justifyContent="flex-start"
|
|
164
|
+
flexWrap="wrap"
|
|
165
|
+
sx={{
|
|
166
|
+
'hr.MuiDivider-root:last-child': {
|
|
167
|
+
display: 'none',
|
|
168
|
+
},
|
|
169
|
+
flexDirection: {
|
|
170
|
+
xs: 'column',
|
|
171
|
+
sm: 'column',
|
|
172
|
+
md: 'row',
|
|
173
|
+
},
|
|
174
|
+
alignItems: {
|
|
175
|
+
xs: 'flex-start',
|
|
176
|
+
sm: 'flex-start',
|
|
177
|
+
md: 'center',
|
|
178
|
+
},
|
|
179
|
+
gap: {
|
|
180
|
+
xs: 1,
|
|
181
|
+
sm: 1,
|
|
182
|
+
md: 3,
|
|
183
|
+
},
|
|
184
|
+
}}>
|
|
185
|
+
<InfoMetric label={t('common.price')} value={result.priceDisplay} divider />
|
|
186
|
+
<InfoMetric label={t('common.id')} value={<Copyable text={props.id} style={{ marginLeft: 4 }} />} divider />
|
|
133
187
|
</Stack>
|
|
134
188
|
</Box>
|
|
189
|
+
<Divider />
|
|
135
190
|
</Grid>
|
|
136
|
-
<Grid item xs={12}
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
191
|
+
<Grid item xs={12}>
|
|
192
|
+
<Stack
|
|
193
|
+
sx={{
|
|
194
|
+
flexDirection: {
|
|
195
|
+
xs: 'column',
|
|
196
|
+
lg: 'row',
|
|
197
|
+
},
|
|
198
|
+
gap: 4,
|
|
199
|
+
'.payment-link-column-1': {
|
|
200
|
+
minWidth: {
|
|
201
|
+
xs: '100%',
|
|
202
|
+
lg: '600px',
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
'.payment-link-column-2': {
|
|
206
|
+
width: {
|
|
207
|
+
xs: '100%',
|
|
208
|
+
md: '100%',
|
|
209
|
+
lg: '580px',
|
|
210
|
+
},
|
|
211
|
+
maxWidth: {
|
|
212
|
+
xs: '100%',
|
|
213
|
+
md: '33%',
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
}}>
|
|
217
|
+
<Box flex={1} className="payment-link-column-1">
|
|
218
|
+
<Div direction="column" spacing={3}>
|
|
219
|
+
<Box className="section">
|
|
220
|
+
<SectionHeader title={t('admin.products')} />
|
|
221
|
+
<Box className="section-body">
|
|
222
|
+
<Table
|
|
223
|
+
className="link-products-table"
|
|
224
|
+
toolbar={false}
|
|
225
|
+
footer={false}
|
|
226
|
+
locale={locale}
|
|
227
|
+
data={data.line_items}
|
|
228
|
+
columns={[
|
|
229
|
+
{
|
|
230
|
+
label: t('common.title'),
|
|
231
|
+
name: 'name',
|
|
232
|
+
options: {
|
|
233
|
+
sort: false,
|
|
234
|
+
customBodyRenderLite: (_: any, index: number) => {
|
|
235
|
+
const item = data.line_items[index] as TLineItemExpanded;
|
|
236
|
+
return (
|
|
237
|
+
<Link to={`/admin/products/${item.price.product_id}`}>
|
|
238
|
+
<InfoCard
|
|
239
|
+
name={item.price.product.name}
|
|
240
|
+
description={formatProductPrice(
|
|
241
|
+
// @ts-ignore
|
|
242
|
+
{ ...item.price.product, prices: [item.price] },
|
|
243
|
+
settings.baseCurrency,
|
|
244
|
+
locale
|
|
245
|
+
)}
|
|
246
|
+
logo={item.price.product.images[0]}
|
|
247
|
+
/>
|
|
248
|
+
</Link>
|
|
249
|
+
);
|
|
250
|
+
},
|
|
251
|
+
},
|
|
169
252
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
})`;
|
|
186
|
-
}
|
|
253
|
+
{
|
|
254
|
+
label: t('common.quantity'),
|
|
255
|
+
name: 'quantity',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
label: t('admin.paymentLink.adjustable'),
|
|
259
|
+
name: 'price_id',
|
|
260
|
+
options: {
|
|
261
|
+
customBodyRenderLite: (_: any, index: number) => {
|
|
262
|
+
const item = data.line_items[index];
|
|
263
|
+
if (item?.adjustable_quantity?.enabled) {
|
|
264
|
+
return `${t('common.yes')} (${item.adjustable_quantity.minimum} - ${
|
|
265
|
+
item.adjustable_quantity.maximum
|
|
266
|
+
})`;
|
|
267
|
+
}
|
|
187
268
|
|
|
188
|
-
|
|
269
|
+
return t('common.no');
|
|
270
|
+
},
|
|
271
|
+
},
|
|
189
272
|
},
|
|
273
|
+
]}
|
|
274
|
+
options={{
|
|
275
|
+
count: data.line_items.length,
|
|
276
|
+
page: 0,
|
|
277
|
+
rowsPerPage: 20,
|
|
278
|
+
}}
|
|
279
|
+
/>
|
|
280
|
+
{state.adding.price && (
|
|
281
|
+
<AddPrice
|
|
282
|
+
loading={state.loading.price}
|
|
283
|
+
onSave={onAddPrice}
|
|
284
|
+
onCancel={() => setState((prev) => ({ adding: { ...prev.adding, price: false } }))}
|
|
285
|
+
/>
|
|
286
|
+
)}
|
|
287
|
+
</Box>
|
|
288
|
+
</Box>
|
|
289
|
+
<Divider />
|
|
290
|
+
<Box className="section">
|
|
291
|
+
<SectionHeader title={t('admin.details')} />
|
|
292
|
+
<Stack
|
|
293
|
+
sx={{
|
|
294
|
+
display: 'grid',
|
|
295
|
+
gridTemplateColumns: {
|
|
296
|
+
xs: 'repeat(1, 1fr)',
|
|
297
|
+
sm: 'repeat(1, 1fr)',
|
|
298
|
+
md: 'repeat(2, 1fr)',
|
|
299
|
+
lg: 'repeat(3, 1fr)',
|
|
190
300
|
},
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
<
|
|
251
|
-
<
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
</SectionHeader>
|
|
266
|
-
<Box className="section-body">
|
|
267
|
-
<Grid container>
|
|
268
|
-
<Grid item xs={12} md={6}>
|
|
269
|
-
{!state.editing.metadata && <MetadataList data={data.metadata} />}
|
|
270
|
-
</Grid>
|
|
271
|
-
</Grid>
|
|
272
|
-
{state.editing.metadata && (
|
|
273
|
-
<MetadataEditor
|
|
274
|
-
data={data}
|
|
275
|
-
loading={state.loading.metadata}
|
|
276
|
-
onSave={onUpdateMetadata}
|
|
277
|
-
onCancel={() => setState((prev) => ({ editing: { ...prev.editing, metadata: false } }))}
|
|
278
|
-
/>
|
|
279
|
-
)}
|
|
280
|
-
</Box>
|
|
301
|
+
}}>
|
|
302
|
+
<InfoRow
|
|
303
|
+
sizes={[1, 1]}
|
|
304
|
+
label={t('admin.paymentLink.allowPromotionCodes')}
|
|
305
|
+
value={data.allow_promotion_codes ? t('common.yes') : t('common.no')}
|
|
306
|
+
direction={InfoDirection}
|
|
307
|
+
alignItems={InfoAlignItems}
|
|
308
|
+
/>
|
|
309
|
+
<InfoRow
|
|
310
|
+
sizes={[1, 1]}
|
|
311
|
+
label={t('admin.paymentLink.requireBillingAddress')}
|
|
312
|
+
value={data.billing_address_collection ? t('common.yes') : t('common.no')}
|
|
313
|
+
direction={InfoDirection}
|
|
314
|
+
alignItems={InfoAlignItems}
|
|
315
|
+
/>
|
|
316
|
+
<InfoRow
|
|
317
|
+
sizes={[1, 1]}
|
|
318
|
+
label={t('admin.paymentLink.requirePhoneNumber')}
|
|
319
|
+
value={data.phone_number_collection?.enabled ? t('common.yes') : t('common.no')}
|
|
320
|
+
direction={InfoDirection}
|
|
321
|
+
alignItems={InfoAlignItems}
|
|
322
|
+
/>
|
|
323
|
+
<InfoRow
|
|
324
|
+
sizes={[1, 1]}
|
|
325
|
+
label={t('admin.paymentLink.includeFreeTrial')}
|
|
326
|
+
value={data.subscription_data?.trial_period_days ? t('common.yes') : t('common.no')}
|
|
327
|
+
direction={InfoDirection}
|
|
328
|
+
alignItems={InfoAlignItems}
|
|
329
|
+
/>
|
|
330
|
+
<InfoRow
|
|
331
|
+
sizes={[1, 1]}
|
|
332
|
+
label={t('admin.paymentLink.showConfirmPage')}
|
|
333
|
+
value={data.after_completion?.type}
|
|
334
|
+
direction={InfoDirection}
|
|
335
|
+
alignItems={InfoAlignItems}
|
|
336
|
+
/>
|
|
337
|
+
<InfoRow
|
|
338
|
+
sizes={[1, 1]}
|
|
339
|
+
label={t('admin.paymentLink.mintNft')}
|
|
340
|
+
value={data.nft_mint_settings?.factory || ''}
|
|
341
|
+
direction={InfoDirection}
|
|
342
|
+
alignItems={InfoAlignItems}
|
|
343
|
+
/>
|
|
344
|
+
<InfoRow
|
|
345
|
+
sizes={[1, 1]}
|
|
346
|
+
label={t('common.createdAt')}
|
|
347
|
+
value={formatTime(data.created_at)}
|
|
348
|
+
direction={InfoDirection}
|
|
349
|
+
alignItems={InfoAlignItems}
|
|
350
|
+
/>
|
|
351
|
+
<InfoRow
|
|
352
|
+
sizes={[1, 1]}
|
|
353
|
+
label={t('common.updatedAt')}
|
|
354
|
+
value={formatTime(data.updated_at)}
|
|
355
|
+
direction={InfoDirection}
|
|
356
|
+
alignItems={InfoAlignItems}
|
|
357
|
+
/>
|
|
358
|
+
</Stack>
|
|
359
|
+
</Box>
|
|
360
|
+
<Divider />
|
|
361
|
+
<Box className="section">
|
|
362
|
+
<SectionHeader title={t('common.preview')} />
|
|
363
|
+
<Box className="section-body" sx={{ maxWidth: 1050 }}>
|
|
364
|
+
<PaymentLinkPreview id={data.id} />
|
|
365
|
+
</Box>
|
|
366
|
+
</Box>
|
|
367
|
+
<Divider />
|
|
368
|
+
<Box className="section">
|
|
369
|
+
<SectionHeader title={t('admin.events')} />
|
|
370
|
+
<Box className="section-body">
|
|
371
|
+
<EventList features={{ toolbar: false }} object_id={data.id} />
|
|
372
|
+
</Box>
|
|
373
|
+
</Box>
|
|
374
|
+
</Div>
|
|
281
375
|
</Box>
|
|
282
|
-
<Box className="
|
|
283
|
-
<
|
|
284
|
-
|
|
285
|
-
|
|
376
|
+
<Box className="payment-link-column-2">
|
|
377
|
+
<Box className="section">
|
|
378
|
+
<SectionHeader title={t('common.metadata.label')}>
|
|
379
|
+
<Button
|
|
380
|
+
variant="text"
|
|
381
|
+
color="inherit"
|
|
382
|
+
size="small"
|
|
383
|
+
sx={{ color: 'text.link' }}
|
|
384
|
+
disabled={state.editing.metadata}
|
|
385
|
+
onClick={handleEditMetadata}>
|
|
386
|
+
{t('common.edit')}
|
|
387
|
+
</Button>
|
|
388
|
+
</SectionHeader>
|
|
389
|
+
<Box className="section-body">
|
|
390
|
+
<MetadataList data={data.metadata} handleEditMetadata={handleEditMetadata} />
|
|
391
|
+
{state.editing.metadata && (
|
|
392
|
+
<MetadataEditor
|
|
393
|
+
data={data}
|
|
394
|
+
loading={state.loading.metadata}
|
|
395
|
+
onSave={onUpdateMetadata}
|
|
396
|
+
onCancel={() => setState((prev) => ({ editing: { ...prev.editing, metadata: false } }))}
|
|
397
|
+
/>
|
|
398
|
+
)}
|
|
399
|
+
</Box>
|
|
286
400
|
</Box>
|
|
287
401
|
</Box>
|
|
288
|
-
</
|
|
289
|
-
</Grid>
|
|
290
|
-
<Grid item xs={12} md={7}>
|
|
291
|
-
<Div>
|
|
292
|
-
<Box className="section">
|
|
293
|
-
<SectionHeader title={t('common.preview')} />
|
|
294
|
-
<Box className="section-body">
|
|
295
|
-
<PaymentLinkPreview id={data.id} />
|
|
296
|
-
</Box>
|
|
297
|
-
</Box>
|
|
298
|
-
</Div>
|
|
402
|
+
</Stack>
|
|
299
403
|
</Grid>
|
|
300
404
|
</Grid>
|
|
301
405
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { getDurableData } from '@arcblock/ux/lib/Datatable';
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
-
import { Status, api, formatTime, usePaymentContext } from '@blocklet/payment-react';
|
|
4
|
+
import { Status, api, formatTime, usePaymentContext, Table } from '@blocklet/payment-react';
|
|
5
5
|
import type { TPaymentLinkExpanded } from '@blocklet/payment-types';
|
|
6
6
|
import { Alert, CircularProgress, ToggleButton, ToggleButtonGroup, Typography } from '@mui/material';
|
|
7
7
|
import { useRequest } from 'ahooks';
|
|
@@ -12,7 +12,6 @@ import useBus from 'use-bus';
|
|
|
12
12
|
|
|
13
13
|
import Copyable from '../../../../components/copyable';
|
|
14
14
|
import PaymentLinkActions from '../../../../components/payment-link/actions';
|
|
15
|
-
import Table from '../../../../components/table';
|
|
16
15
|
import { ProductsProvider } from '../../../../contexts/products';
|
|
17
16
|
import { formatPaymentLinkPricing } from '../../../../libs/util';
|
|
18
17
|
|
|
@@ -26,7 +25,7 @@ const fetchData = (params: Record<string, any> = {}): Promise<{ list: TPaymentLi
|
|
|
26
25
|
|
|
27
26
|
function PaymentLinks() {
|
|
28
27
|
const listKey = 'payment-links';
|
|
29
|
-
const { t } = useLocaleContext();
|
|
28
|
+
const { t, locale } = useLocaleContext();
|
|
30
29
|
const { settings } = usePaymentContext();
|
|
31
30
|
|
|
32
31
|
const persisted = getDurableData(listKey);
|
|
@@ -98,10 +97,8 @@ function PaymentLinks() {
|
|
|
98
97
|
sort: false,
|
|
99
98
|
customBodyRenderLite: (_: string, index: number) => {
|
|
100
99
|
const item = data.list[index] as TPaymentLinkExpanded;
|
|
101
|
-
const result = formatPaymentLinkPricing(item, settings.baseCurrency);
|
|
102
|
-
return
|
|
103
|
-
<Link to={`/admin/products/${item.id}`}>{[result.amount, result.then].filter(Boolean).join(', ')}</Link>
|
|
104
|
-
);
|
|
100
|
+
const result = formatPaymentLinkPricing(item, settings.baseCurrency, locale);
|
|
101
|
+
return <Link to={`/admin/products/${item.id}`}>{result.priceDisplay}</Link>;
|
|
105
102
|
},
|
|
106
103
|
},
|
|
107
104
|
},
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import { api } from '@blocklet/payment-react';
|
|
3
|
+
import { api, Table } from '@blocklet/payment-react';
|
|
4
4
|
import { Alert, CircularProgress, Typography } from '@mui/material';
|
|
5
5
|
import { useRequest } from 'ahooks';
|
|
6
6
|
import { Link } from 'react-router-dom';
|
|
7
7
|
|
|
8
8
|
import PassportActions from '../../../../components/passport/actions';
|
|
9
|
-
import Table from '../../../../components/table';
|
|
10
9
|
|
|
11
10
|
const fetchData = (params: Record<string, any> = {}): Promise<any[]> => {
|
|
12
11
|
const search = new URLSearchParams();
|
|
@@ -140,7 +139,11 @@ export default function PassportList() {
|
|
|
140
139
|
data={data}
|
|
141
140
|
columns={columns}
|
|
142
141
|
loading={loading}
|
|
143
|
-
title={
|
|
142
|
+
title={
|
|
143
|
+
<Typography variant="subtitle1" sx={{ color: 'text.secondary' }}>
|
|
144
|
+
{t('admin.passport.intro')}
|
|
145
|
+
</Typography>
|
|
146
|
+
}
|
|
144
147
|
options={{
|
|
145
148
|
count: data.length,
|
|
146
149
|
page: 1,
|