payment-kit 1.14.25 → 1.14.26

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 (43) hide show
  1. package/blocklet.yml +1 -1
  2. package/package.json +4 -4
  3. package/src/components/event/list.tsx +35 -24
  4. package/src/components/filter-toolbar.tsx +15 -10
  5. package/src/components/info-metric.tsx +10 -2
  6. package/src/components/info-row.tsx +2 -1
  7. package/src/components/invoice/list.tsx +11 -3
  8. package/src/components/metadata/editor.tsx +1 -0
  9. package/src/components/metadata/form.tsx +12 -3
  10. package/src/components/payment-currency/form.tsx +4 -0
  11. package/src/components/payment-intent/list.tsx +11 -2
  12. package/src/components/payment-link/before-pay.tsx +25 -2
  13. package/src/components/payment-method/arcblock.tsx +4 -0
  14. package/src/components/payment-method/bitcoin.tsx +4 -0
  15. package/src/components/payment-method/ethereum.tsx +4 -0
  16. package/src/components/payouts/list.tsx +12 -2
  17. package/src/components/pricing-table/price-item.tsx +18 -4
  18. package/src/components/product/actions.tsx +6 -3
  19. package/src/components/refund/list.tsx +11 -3
  20. package/src/components/subscription/description.tsx +3 -2
  21. package/src/components/subscription/list.tsx +3 -2
  22. package/src/components/uploader.tsx +65 -28
  23. package/src/components/webhook/attempts.tsx +40 -33
  24. package/src/libs/util.ts +8 -1
  25. package/src/locales/en.tsx +2 -0
  26. package/src/locales/zh.tsx +2 -0
  27. package/src/pages/admin/billing/index.tsx +3 -0
  28. package/src/pages/admin/billing/invoices/detail.tsx +10 -5
  29. package/src/pages/admin/billing/subscriptions/detail.tsx +10 -5
  30. package/src/pages/admin/customers/customers/detail.tsx +11 -6
  31. package/src/pages/admin/customers/index.tsx +3 -0
  32. package/src/pages/admin/developers/events/detail.tsx +47 -8
  33. package/src/pages/admin/index.tsx +4 -1
  34. package/src/pages/admin/payments/index.tsx +3 -0
  35. package/src/pages/admin/payments/intents/detail.tsx +10 -4
  36. package/src/pages/admin/payments/payouts/detail.tsx +10 -4
  37. package/src/pages/admin/payments/refunds/detail.tsx +10 -4
  38. package/src/pages/admin/products/index.tsx +3 -0
  39. package/src/pages/admin/products/passports/index.tsx +1 -1
  40. package/src/pages/admin/products/prices/detail.tsx +10 -5
  41. package/src/pages/admin/products/products/detail.tsx +18 -11
  42. package/src/pages/admin/settings/index.tsx +3 -0
  43. package/src/pages/customer/subscription/embed.tsx +3 -2
@@ -11,6 +11,7 @@ import {
11
11
  formatError,
12
12
  formatTime,
13
13
  getPayoutStatusColor,
14
+ useMobile,
14
15
  } from '@blocklet/payment-react';
15
16
  import type { TPayoutExpanded } from '@blocklet/payment-types';
16
17
  import { ArrowBackOutlined, InfoOutlined } from '@mui/icons-material';
@@ -38,6 +39,7 @@ const InfoAlignItems = 'flex-start';
38
39
 
39
40
  export default function PayoutDetail(props: { id: string }) {
40
41
  const { t } = useLocaleContext();
42
+ const { isMobile } = useMobile();
41
43
  const [state, setState] = useSetState({
42
44
  adding: {
43
45
  price: false,
@@ -87,7 +89,7 @@ export default function PayoutDetail(props: { id: string }) {
87
89
  };
88
90
 
89
91
  return (
90
- <Root direction="column" spacing={4} mb={4}>
92
+ <Root direction="column" spacing={2.5} mb={4}>
91
93
  <Box>
92
94
  <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
93
95
  <Stack
@@ -180,7 +182,10 @@ export default function PayoutDetail(props: { id: string }) {
180
182
  xs: 'column',
181
183
  lg: 'row',
182
184
  },
183
- gap: 4,
185
+ gap: {
186
+ xs: 2.5,
187
+ md: 4,
188
+ },
184
189
  '.payment-link-column-1': {
185
190
  minWidth: {
186
191
  xs: '100%',
@@ -199,7 +204,7 @@ export default function PayoutDetail(props: { id: string }) {
199
204
  },
200
205
  },
201
206
  }}>
202
- <Box flex={1} className="payment-link-column-1" sx={{ gap: 4, display: 'flex', flexDirection: 'column' }}>
207
+ <Box flex={1} className="payment-link-column-1" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
203
208
  <Box className="section">
204
209
  <SectionHeader title={t('admin.details')} />
205
210
  <Stack
@@ -262,7 +267,8 @@ export default function PayoutDetail(props: { id: string }) {
262
267
  </Box>
263
268
  </Box>
264
269
  </Box>
265
- <Box className="payment-link-column-2" sx={{ gap: 3, display: 'flex', flexDirection: 'column' }}>
270
+ {isMobile && <Divider />}
271
+ <Box className="payment-link-column-2" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
266
272
  <Box className="section">
267
273
  <SectionHeader title={t('admin.paymentMethod._name')} />
268
274
  <Stack>
@@ -11,6 +11,7 @@ import {
11
11
  formatError,
12
12
  formatTime,
13
13
  getRefundStatusColor,
14
+ useMobile,
14
15
  } from '@blocklet/payment-react';
15
16
  import type { TRefundExpanded } from '@blocklet/payment-types';
16
17
  import { ArrowBackOutlined, InfoOutlined } from '@mui/icons-material';
@@ -40,6 +41,7 @@ const InfoAlignItems = 'flex-start';
40
41
 
41
42
  export default function RefundDetail(props: { id: string }) {
42
43
  const { t } = useLocaleContext();
44
+ const { isMobile } = useMobile();
43
45
  const [state, setState] = useSetState({
44
46
  adding: {
45
47
  price: false,
@@ -89,7 +91,7 @@ export default function RefundDetail(props: { id: string }) {
89
91
  };
90
92
 
91
93
  return (
92
- <Root direction="column" spacing={4} mb={4}>
94
+ <Root direction="column" spacing={2.5} mb={4}>
93
95
  <Box>
94
96
  <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
95
97
  <Stack
@@ -182,7 +184,10 @@ export default function RefundDetail(props: { id: string }) {
182
184
  xs: 'column',
183
185
  lg: 'row',
184
186
  },
185
- gap: 4,
187
+ gap: {
188
+ xs: 2.5,
189
+ md: 4,
190
+ },
186
191
  '.payment-link-column-1': {
187
192
  minWidth: {
188
193
  xs: '100%',
@@ -201,7 +206,7 @@ export default function RefundDetail(props: { id: string }) {
201
206
  },
202
207
  },
203
208
  }}>
204
- <Box flex={1} className="payment-link-column-1" sx={{ gap: 4, display: 'flex', flexDirection: 'column' }}>
209
+ <Box flex={1} className="payment-link-column-1" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
205
210
  <Box className="section">
206
211
  <SectionHeader title={t('admin.details')} />
207
212
  <Stack
@@ -283,7 +288,8 @@ export default function RefundDetail(props: { id: string }) {
283
288
  </Box>
284
289
  </Box>
285
290
  </Box>
286
- <Box className="payment-link-column-2" sx={{ gap: 3, display: 'flex', flexDirection: 'column' }}>
291
+ {isMobile && <Divider />}
292
+ <Box className="payment-link-column-2" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
287
293
  {data.paymentMethod && (
288
294
  <>
289
295
  <Box className="section">
@@ -88,6 +88,9 @@ export default function Products() {
88
88
  '.MuiTabs-hideScrollbar': {
89
89
  border: 'none !important',
90
90
  },
91
+ '.MuiTouchRipple-root': {
92
+ display: 'none',
93
+ },
91
94
  }}
92
95
  />
93
96
  <Box> {extra}</Box>
@@ -140,7 +140,7 @@ export default function PassportList() {
140
140
  columns={columns}
141
141
  loading={loading}
142
142
  title={
143
- <Typography variant="subtitle1" sx={{ color: 'text.secondary' }}>
143
+ <Typography variant="subtitle1" sx={{ color: 'text.secondary', whiteSpace: 'break-spaces' }}>
144
144
  {t('admin.passport.intro')}
145
145
  </Typography>
146
146
  }
@@ -1,6 +1,6 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
2
  import Toast from '@arcblock/ux/lib/Toast';
3
- import { api, formatError, formatPrice, formatTime, Table } from '@blocklet/payment-react';
3
+ import { api, formatError, formatPrice, formatTime, Table, useMobile } from '@blocklet/payment-react';
4
4
  import type { TPrice, TPriceExpanded } from '@blocklet/payment-types';
5
5
  import { ArrowBackOutlined } from '@mui/icons-material';
6
6
  import { Alert, AlertTitle, Box, Button, CircularProgress, Divider, Stack, Typography } from '@mui/material';
@@ -30,6 +30,7 @@ const InfoAlignItems = 'flex-start';
30
30
 
31
31
  export default function PriceDetail(props: { id: string }) {
32
32
  const { t, locale } = useLocaleContext();
33
+ const { isMobile } = useMobile();
33
34
  const navigate = useNavigate();
34
35
  const [state, setState] = useSetState({
35
36
  adding: {
@@ -84,7 +85,7 @@ export default function PriceDetail(props: { id: string }) {
84
85
  };
85
86
 
86
87
  return (
87
- <Root direction="column" spacing={4} sx={{ mb: 4 }}>
88
+ <Root direction="column" spacing={2.5} sx={{ mb: 4 }}>
88
89
  <Box>
89
90
  {data.active === false && (
90
91
  <Alert severity="warning">
@@ -179,7 +180,10 @@ export default function PriceDetail(props: { id: string }) {
179
180
  xs: 'column',
180
181
  lg: 'row',
181
182
  },
182
- gap: 4,
183
+ gap: {
184
+ xs: 2.5,
185
+ md: 4,
186
+ },
183
187
  '.payment-link-column-1': {
184
188
  minWidth: {
185
189
  xs: '100%',
@@ -198,7 +202,7 @@ export default function PriceDetail(props: { id: string }) {
198
202
  },
199
203
  },
200
204
  }}>
201
- <Box flex={1} className="payment-link-column-1" sx={{ gap: 4, display: 'flex', flexDirection: 'column' }}>
205
+ <Box flex={1} className="payment-link-column-1" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
202
206
  <Box className="section">
203
207
  <SectionHeader title={t('admin.details')}>
204
208
  <Button
@@ -333,7 +337,8 @@ export default function PriceDetail(props: { id: string }) {
333
337
  </Box>
334
338
  </Box>
335
339
  </Box>
336
- <Box className="payment-link-column-2" sx={{ gap: 3, display: 'flex', flexDirection: 'column' }}>
340
+ {isMobile && <Divider />}
341
+ <Box className="payment-link-column-2" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
337
342
  <Box className="section">
338
343
  <SectionHeader title={t('admin.price.upsell.title')} />
339
344
  <Box className="section-body">
@@ -1,6 +1,6 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
2
  import Toast from '@arcblock/ux/lib/Toast';
3
- import { api, formatError, formatTime, usePaymentContext } from '@blocklet/payment-react';
3
+ import { api, formatError, formatTime, useMobile, usePaymentContext } from '@blocklet/payment-react';
4
4
  import type { TPrice, TProduct, TProductExpanded } from '@blocklet/payment-types';
5
5
  import { ArrowBackOutlined } from '@mui/icons-material';
6
6
  import {
@@ -19,6 +19,7 @@ import { styled } from '@mui/system';
19
19
  import { useRequest, useSetState } from 'ahooks';
20
20
  import { useNavigate } from 'react-router-dom';
21
21
 
22
+ import { isEmpty } from 'lodash';
22
23
  import Copyable from '../../../../components/copyable';
23
24
  import EventList from '../../../../components/event/list';
24
25
  import InfoMetric from '../../../../components/info-metric';
@@ -42,6 +43,7 @@ const InfoAlignItems = 'flex-start';
42
43
 
43
44
  export default function ProductDetail(props: { id: string }) {
44
45
  const { t, locale } = useLocaleContext();
46
+ const { isMobile } = useMobile();
45
47
  const navigate = useNavigate();
46
48
  const { settings } = usePaymentContext();
47
49
  const [state, setState] = useSetState({
@@ -107,13 +109,13 @@ export default function ProductDetail(props: { id: string }) {
107
109
  }
108
110
  };
109
111
 
110
- const isLocked = data.locked || data.prices.some((x) => x.locked);
112
+ const isLocked = data.locked || (!isEmpty(data.prices) && data.prices.some((x) => x.locked));
111
113
  const handleEditMetadata = () => {
112
114
  setState((prev) => ({ editing: { ...prev.editing, metadata: true } }));
113
115
  };
114
116
 
115
117
  return (
116
- <Root direction="column" spacing={4} sx={{ mb: 4 }}>
118
+ <Root direction="column" spacing={2.5} sx={{ mb: 4 }}>
117
119
  <Box>
118
120
  {data.active === false && (
119
121
  <Alert severity="warning">
@@ -163,7 +165,9 @@ export default function ProductDetail(props: { id: string }) {
163
165
  }}>
164
166
  <Stack direction="row" justifyContent="space-between" alignItems="center">
165
167
  <Stack direction="row" alignItems="center" spacing={1}>
166
- <Avatar src={data.images[0]} alt={data.name} variant="square" sx={{ width: '52px', height: '52px' }} />
168
+ {data.images.length > 0 && (
169
+ <Avatar src={data.images[0]} alt={data.name} variant="square" sx={{ width: '52px', height: '52px' }} />
170
+ )}
167
171
  <Stack direction="column" alignItems="flex-start" justifyContent="space-around">
168
172
  <Typography variant="h2" color="text.primary">
169
173
  {data.name}
@@ -210,7 +214,10 @@ export default function ProductDetail(props: { id: string }) {
210
214
  xs: 'column',
211
215
  lg: 'row',
212
216
  },
213
- gap: 4,
217
+ gap: {
218
+ xs: 2.5,
219
+ md: 4,
220
+ },
214
221
  '.payment-link-column-1': {
215
222
  minWidth: {
216
223
  xs: '100%',
@@ -229,7 +236,7 @@ export default function ProductDetail(props: { id: string }) {
229
236
  },
230
237
  },
231
238
  }}>
232
- <Box flex={1} className="payment-link-column-1" sx={{ gap: 4, display: 'flex', flexDirection: 'column' }}>
239
+ <Box flex={1} className="payment-link-column-1" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
233
240
  <Box className="section">
234
241
  <SectionHeader title={t('admin.details')}>
235
242
  <Button
@@ -300,12 +307,11 @@ export default function ProductDetail(props: { id: string }) {
300
307
  label={t('admin.product.image.label')}
301
308
  value={
302
309
  data.images.length ? (
303
- <img
310
+ <Avatar
304
311
  src={data.images[0]}
305
- width={160}
306
- height={160}
307
312
  alt={data.name}
308
- style={{ objectFit: 'cover' }}
313
+ variant="square"
314
+ sx={{ width: '160px', height: '160px' }}
309
315
  />
310
316
  ) : (
311
317
  t('empty.image')
@@ -359,7 +365,8 @@ export default function ProductDetail(props: { id: string }) {
359
365
  </Box>
360
366
  </Box>
361
367
  </Box>
362
- <Box className="payment-link-column-2" sx={{ gap: 3, display: 'flex', flexDirection: 'column' }}>
368
+ {isMobile && <Divider />}
369
+ <Box className="payment-link-column-2" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
363
370
  <Box className="section">
364
371
  <SectionHeader title={t('admin.product.cross_sell.title')} />
365
372
  <Box className="section-body">
@@ -64,6 +64,9 @@ export default function SettingsIndex() {
64
64
  '.MuiTabs-hideScrollbar': {
65
65
  border: 'none !important',
66
66
  },
67
+ '.MuiTouchRipple-root': {
68
+ display: 'none',
69
+ },
67
70
  }}
68
71
  />
69
72
  <Box> {extra}</Box>
@@ -14,6 +14,7 @@ import {
14
14
  getInvoiceStatusColor,
15
15
  getPrefix,
16
16
  getSubscriptionStatusColor,
17
+ useDefaultPageSize,
17
18
  } from '@blocklet/payment-react';
18
19
  import type { Paginated, TInvoiceExpanded, TSubscriptionExpanded } from '@blocklet/payment-types';
19
20
  import {
@@ -57,12 +58,12 @@ export default function SubscriptionEmbed() {
57
58
 
58
59
  const subscriptionId = params.get('id') || '';
59
60
  const authToken = params.get('authToken') || '';
60
-
61
+ const defaultPageSize = useDefaultPageSize(20);
61
62
  const { data: subscription, error, loading } = useRequest(() => fetchSubscriptionData(subscriptionId, authToken));
62
63
  const { data } = useRequest(() =>
63
64
  fetchInvoiceData({
64
65
  page: 1,
65
- pageSize: 20,
66
+ pageSize: defaultPageSize,
66
67
  status: 'open,paid,uncollectible',
67
68
  subscription_id: subscriptionId,
68
69
  authToken,