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.
Files changed (79) hide show
  1. package/blocklet.yml +1 -1
  2. package/package.json +19 -19
  3. package/src/app.tsx +13 -12
  4. package/src/components/balance-list.tsx +12 -2
  5. package/src/components/copyable.tsx +3 -2
  6. package/src/components/customer/edit.tsx +25 -21
  7. package/src/components/customer/form.tsx +18 -28
  8. package/src/components/customer/link.tsx +1 -2
  9. package/src/components/date-range-picker.tsx +21 -0
  10. package/src/components/drawer-form.tsx +27 -4
  11. package/src/components/event/list.tsx +3 -2
  12. package/src/components/filter-toolbar.tsx +11 -4
  13. package/src/components/info-card.tsx +4 -2
  14. package/src/components/info-metric.tsx +2 -2
  15. package/src/components/info-row.tsx +33 -26
  16. package/src/components/invoice/list.tsx +2 -2
  17. package/src/components/invoice/table.tsx +148 -85
  18. package/src/components/invoice-pdf/pdf.tsx +5 -1
  19. package/src/components/layout/admin.tsx +8 -2
  20. package/src/components/metadata/editor.tsx +25 -18
  21. package/src/components/metadata/form.tsx +83 -25
  22. package/src/components/metadata/list.tsx +22 -6
  23. package/src/components/payment-intent/list.tsx +3 -3
  24. package/src/components/payment-link/preview.tsx +42 -24
  25. package/src/components/payouts/list.tsx +2 -3
  26. package/src/components/price/form.tsx +27 -12
  27. package/src/components/price/upsell.tsx +1 -4
  28. package/src/components/pricing-table/preview.tsx +42 -23
  29. package/src/components/product/cross-sell-select.tsx +1 -1
  30. package/src/components/product/cross-sell.tsx +3 -4
  31. package/src/components/product/edit-price.tsx +0 -1
  32. package/src/components/refund/list.tsx +9 -4
  33. package/src/components/section/header.tsx +11 -4
  34. package/src/components/subscription/description.tsx +10 -6
  35. package/src/components/subscription/items/index.tsx +28 -6
  36. package/src/components/subscription/list.tsx +2 -2
  37. package/src/components/subscription/metrics.tsx +10 -8
  38. package/src/components/subscription/portal/actions.tsx +37 -11
  39. package/src/components/subscription/portal/list.tsx +131 -70
  40. package/src/components/subscription/status.tsx +9 -3
  41. package/src/global.css +1 -1
  42. package/src/hooks/mobile.ts +3 -3
  43. package/src/libs/util.ts +6 -2
  44. package/src/locales/en.tsx +37 -1
  45. package/src/locales/zh.tsx +37 -1
  46. package/src/pages/admin/billing/index.tsx +24 -4
  47. package/src/pages/admin/billing/invoices/detail.tsx +302 -147
  48. package/src/pages/admin/billing/subscriptions/detail.tsx +259 -134
  49. package/src/pages/admin/customers/customers/detail.tsx +358 -175
  50. package/src/pages/admin/customers/customers/index.tsx +8 -5
  51. package/src/pages/admin/customers/index.tsx +22 -5
  52. package/src/pages/admin/developers/webhooks/index.tsx +2 -2
  53. package/src/pages/admin/index.tsx +24 -10
  54. package/src/pages/admin/overview.tsx +1 -1
  55. package/src/pages/admin/payments/index.tsx +22 -7
  56. package/src/pages/admin/payments/intents/detail.tsx +263 -121
  57. package/src/pages/admin/payments/payouts/detail.tsx +235 -102
  58. package/src/pages/admin/payments/refunds/detail.tsx +286 -133
  59. package/src/pages/admin/products/index.tsx +28 -12
  60. package/src/pages/admin/products/links/create.tsx +16 -6
  61. package/src/pages/admin/products/links/detail.tsx +280 -176
  62. package/src/pages/admin/products/links/index.tsx +4 -7
  63. package/src/pages/admin/products/passports/index.tsx +6 -3
  64. package/src/pages/admin/products/prices/detail.tsx +260 -139
  65. package/src/pages/admin/products/prices/list.tsx +7 -3
  66. package/src/pages/admin/products/pricing-tables/create.tsx +17 -5
  67. package/src/pages/admin/products/pricing-tables/detail.tsx +221 -121
  68. package/src/pages/admin/products/pricing-tables/index.tsx +1 -2
  69. package/src/pages/admin/products/products/detail.tsx +262 -119
  70. package/src/pages/admin/products/products/index.tsx +1 -2
  71. package/src/pages/admin/settings/index.tsx +27 -7
  72. package/src/pages/customer/index.tsx +431 -143
  73. package/src/pages/customer/invoice/detail.tsx +138 -26
  74. package/src/pages/customer/refund/list.tsx +193 -4
  75. package/src/pages/customer/subscription/change-payment.tsx +20 -20
  76. package/src/pages/customer/subscription/detail.tsx +168 -34
  77. package/src/pages/customer/subscription/embed.tsx +22 -19
  78. package/src/pages/home.tsx +7 -1
  79. 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, Edit } from '@mui/icons-material';
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 md={12}>
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
- <Copyable text={props.id} style={{ marginLeft: 4 }} />
119
+ <PaymentLinkActions data={data} onChange={onChange} variant="normal" />
113
120
  </Stack>
114
- <Box mt={2}>
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 direction="column" alignItems="flex-start">
117
- <Stack direction="row" alignItems="center" mb={1}>
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 variant="h6" sx={{ color: 'text.secondary', mr: 1 }}>
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
- <PaymentLinkActions data={data} onChange={onChange} variant="normal" />
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} md={5}>
137
- <Div direction="column" spacing={4}>
138
- <Box className="section">
139
- <SectionHeader title={t('admin.products')} />
140
- <Box className="section-body">
141
- <Table
142
- className="link-products-table"
143
- toolbar={false}
144
- footer={false}
145
- locale={locale}
146
- data={data.line_items}
147
- columns={[
148
- {
149
- label: t('common.title'),
150
- name: 'name',
151
- options: {
152
- sort: false,
153
- customBodyRenderLite: (_: any, index: number) => {
154
- const item = data.line_items[index] as TLineItemExpanded;
155
- return (
156
- <Link to={`/admin/products/${item.price.product_id}`}>
157
- <InfoCard
158
- name={item.price.product.name}
159
- description={formatProductPrice(
160
- // @ts-ignore
161
- { ...item.price.product, prices: [item.price] },
162
- settings.baseCurrency,
163
- locale
164
- )}
165
- logo={item.price.product.images[0]}
166
- />
167
- </Link>
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
- label: t('common.quantity'),
174
- name: 'quantity',
175
- },
176
- {
177
- label: t('admin.paymentLink.adjustable'),
178
- name: 'price_id',
179
- options: {
180
- customBodyRenderLite: (_: any, index: number) => {
181
- const item = data.line_items[index];
182
- if (item?.adjustable_quantity?.enabled) {
183
- return `${t('common.yes')} (${item.adjustable_quantity.minimum} - ${
184
- item.adjustable_quantity.maximum
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
- return t('common.no');
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
- options={{
194
- count: data.line_items.length,
195
- page: 0,
196
- rowsPerPage: 20,
197
- }}
198
- />
199
- {state.adding.price && (
200
- <AddPrice
201
- loading={state.loading.price}
202
- onSave={onAddPrice}
203
- onCancel={() => setState((prev) => ({ adding: { ...prev.adding, price: false } }))}
204
- />
205
- )}
206
- </Box>
207
- </Box>
208
- <Box className="section">
209
- <SectionHeader title={t('admin.details')}>
210
- <Button
211
- variant="outlined"
212
- color="inherit"
213
- size="small"
214
- onClick={() => setState((prev) => ({ editing: { ...prev.editing, product: true } }))}>
215
- <Edit fontSize="small" sx={{ mr: 0.5 }} />
216
- {t('common.edit')}
217
- </Button>
218
- </SectionHeader>
219
- <Stack>
220
- <InfoRow
221
- sizes={[1, 1]}
222
- label={t('admin.paymentLink.allowPromotionCodes')}
223
- value={data.allow_promotion_codes ? t('common.yes') : t('common.no')}
224
- />
225
- <InfoRow
226
- sizes={[1, 1]}
227
- label={t('admin.paymentLink.requireBillingAddress')}
228
- value={data.billing_address_collection ? t('common.yes') : t('common.no')}
229
- />
230
- <InfoRow
231
- sizes={[1, 1]}
232
- label={t('admin.paymentLink.requirePhoneNumber')}
233
- value={data.phone_number_collection?.enabled ? t('common.yes') : t('common.no')}
234
- />
235
- <InfoRow
236
- sizes={[1, 1]}
237
- label={t('admin.paymentLink.includeFreeTrial')}
238
- value={data.subscription_data?.trial_period_days ? t('common.yes') : t('common.no')}
239
- />
240
- <InfoRow
241
- sizes={[1, 1]}
242
- label={t('admin.paymentLink.showConfirmPage')}
243
- value={data.after_completion?.type}
244
- />
245
- <InfoRow
246
- sizes={[1, 1]}
247
- label={t('admin.paymentLink.mintNft')}
248
- value={data.nft_mint_settings?.factory || ''}
249
- />
250
- <InfoRow sizes={[1, 1]} label={t('common.createdAt')} value={formatTime(data.created_at)} />
251
- <InfoRow sizes={[1, 1]} label={t('common.updatedAt')} value={formatTime(data.updated_at)} />
252
- </Stack>
253
- </Box>
254
- <Box className="section">
255
- <SectionHeader title={t('common.metadata.label')}>
256
- <Button
257
- variant="outlined"
258
- color="inherit"
259
- size="small"
260
- disabled={state.editing.metadata}
261
- onClick={() => setState((prev) => ({ editing: { ...prev.editing, metadata: true } }))}>
262
- <Edit fontSize="small" sx={{ mr: 0.5 }} />
263
- {t('common.metadata.edit')}
264
- </Button>
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="section">
283
- <SectionHeader title={t('admin.events')} />
284
- <Box className="section-body">
285
- <EventList features={{ toolbar: false }} object_id={data.id} />
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
- </Div>
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={<Typography variant="subtitle1">{t('admin.passport.intro')}</Typography>}
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,