payment-kit 1.18.56 → 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.
Files changed (129) hide show
  1. package/.eslintrc.js +6 -0
  2. package/blocklet.yml +1 -1
  3. package/package.json +57 -58
  4. package/src/components/actions.tsx +22 -9
  5. package/src/components/balance-list.tsx +40 -12
  6. package/src/components/collapse.tsx +22 -14
  7. package/src/components/copyable.tsx +8 -7
  8. package/src/components/currency.tsx +15 -7
  9. package/src/components/customer/actions.tsx +1 -5
  10. package/src/components/customer/form.tsx +3 -1
  11. package/src/components/customer/link.tsx +4 -12
  12. package/src/components/customer/notification-preference.tsx +18 -9
  13. package/src/components/customer/overdraft-protection.tsx +112 -41
  14. package/src/components/drawer-form.tsx +42 -18
  15. package/src/components/error.tsx +1 -5
  16. package/src/components/event/list.tsx +9 -10
  17. package/src/components/filter-toolbar.tsx +20 -19
  18. package/src/components/info-card.tsx +32 -18
  19. package/src/components/info-metric.tsx +16 -6
  20. package/src/components/info-row-group.tsx +1 -7
  21. package/src/components/info-row.tsx +30 -24
  22. package/src/components/invoice/action.tsx +1 -7
  23. package/src/components/invoice/list.tsx +15 -25
  24. package/src/components/invoice/recharge.tsx +5 -7
  25. package/src/components/invoice/table.tsx +17 -12
  26. package/src/components/layout/user.tsx +1 -1
  27. package/src/components/metadata/form.tsx +13 -13
  28. package/src/components/metadata/list.tsx +11 -3
  29. package/src/components/passport/actions.tsx +9 -4
  30. package/src/components/payment-currency/add.tsx +16 -3
  31. package/src/components/payment-currency/form.tsx +12 -6
  32. package/src/components/payment-intent/actions.tsx +24 -16
  33. package/src/components/payment-intent/list.tsx +11 -8
  34. package/src/components/payment-link/actions.tsx +1 -5
  35. package/src/components/payment-link/after-pay.tsx +4 -2
  36. package/src/components/payment-link/before-pay.tsx +14 -4
  37. package/src/components/payment-link/item.tsx +27 -6
  38. package/src/components/payment-link/preview.tsx +9 -9
  39. package/src/components/payment-link/product-select.tsx +17 -3
  40. package/src/components/payment-method/arcblock.tsx +6 -1
  41. package/src/components/payment-method/base.tsx +6 -1
  42. package/src/components/payment-method/bitcoin.tsx +6 -1
  43. package/src/components/payment-method/ethereum.tsx +6 -1
  44. package/src/components/payment-method/evm-rpc-input.tsx +11 -7
  45. package/src/components/payment-method/form.tsx +2 -7
  46. package/src/components/payouts/actions.tsx +1 -5
  47. package/src/components/payouts/list.tsx +11 -9
  48. package/src/components/payouts/portal/list.tsx +11 -9
  49. package/src/components/price/currency-select.tsx +28 -17
  50. package/src/components/price/form.tsx +135 -84
  51. package/src/components/price/upsell-select.tsx +10 -2
  52. package/src/components/price/upsell.tsx +7 -2
  53. package/src/components/pricing-table/actions.tsx +1 -5
  54. package/src/components/pricing-table/customer-settings.tsx +5 -1
  55. package/src/components/pricing-table/payment-settings.tsx +14 -4
  56. package/src/components/pricing-table/preview.tsx +9 -9
  57. package/src/components/pricing-table/price-item.tsx +6 -1
  58. package/src/components/pricing-table/product-item.tsx +6 -1
  59. package/src/components/pricing-table/product-settings.tsx +17 -4
  60. package/src/components/product/actions.tsx +1 -5
  61. package/src/components/product/create.tsx +1 -5
  62. package/src/components/product/cross-sell-select.tsx +5 -1
  63. package/src/components/product/cross-sell.tsx +7 -2
  64. package/src/components/product/features.tsx +13 -3
  65. package/src/components/product/form.tsx +38 -10
  66. package/src/components/progress-bar.tsx +1 -1
  67. package/src/components/refund/actions.tsx +1 -7
  68. package/src/components/refund/list.tsx +12 -17
  69. package/src/components/section/header.tsx +23 -12
  70. package/src/components/subscription/actions/cancel.tsx +22 -5
  71. package/src/components/subscription/actions/index.tsx +9 -10
  72. package/src/components/subscription/actions/pause.tsx +32 -6
  73. package/src/components/subscription/actions/slash-stake.tsx +5 -3
  74. package/src/components/subscription/description.tsx +12 -8
  75. package/src/components/subscription/items/index.tsx +30 -15
  76. package/src/components/subscription/items/usage-records.tsx +19 -5
  77. package/src/components/subscription/list.tsx +5 -7
  78. package/src/components/subscription/metrics.tsx +27 -12
  79. package/src/components/subscription/portal/actions.tsx +76 -70
  80. package/src/components/subscription/portal/cancel.tsx +10 -3
  81. package/src/components/subscription/portal/list.tsx +48 -26
  82. package/src/components/uploader.tsx +5 -13
  83. package/src/components/webhook/attempts.tsx +51 -16
  84. package/src/components/webhook/request-info.tsx +8 -6
  85. package/src/contexts/products.tsx +1 -1
  86. package/src/pages/admin/billing/invoices/detail.tsx +48 -12
  87. package/src/pages/admin/billing/subscriptions/detail.tsx +43 -11
  88. package/src/pages/admin/customers/customers/detail.tsx +53 -12
  89. package/src/pages/admin/customers/customers/index.tsx +6 -1
  90. package/src/pages/admin/developers/events/detail.tsx +36 -10
  91. package/src/pages/admin/developers/webhooks/detail.tsx +41 -11
  92. package/src/pages/admin/index.tsx +15 -2
  93. package/src/pages/admin/overview.tsx +107 -19
  94. package/src/pages/admin/payments/intents/detail.tsx +57 -13
  95. package/src/pages/admin/payments/payouts/detail.tsx +62 -14
  96. package/src/pages/admin/payments/refunds/detail.tsx +57 -13
  97. package/src/pages/admin/products/index.tsx +8 -2
  98. package/src/pages/admin/products/links/create.tsx +22 -4
  99. package/src/pages/admin/products/links/detail.tsx +42 -13
  100. package/src/pages/admin/products/passports/index.tsx +23 -4
  101. package/src/pages/admin/products/prices/actions.tsx +1 -6
  102. package/src/pages/admin/products/prices/detail.tsx +43 -11
  103. package/src/pages/admin/products/prices/list.tsx +7 -2
  104. package/src/pages/admin/products/pricing-tables/create.tsx +45 -12
  105. package/src/pages/admin/products/pricing-tables/detail.tsx +44 -13
  106. package/src/pages/admin/products/products/create.tsx +4 -1
  107. package/src/pages/admin/products/products/detail.tsx +72 -17
  108. package/src/pages/admin/settings/index.tsx +8 -1
  109. package/src/pages/admin/settings/payment-methods/index.tsx +84 -19
  110. package/src/pages/admin/settings/vault-config/edit-form.tsx +42 -28
  111. package/src/pages/admin/settings/vault-config/index.tsx +57 -10
  112. package/src/pages/customer/index.tsx +41 -15
  113. package/src/pages/customer/invoice/detail.tsx +63 -14
  114. package/src/pages/customer/invoice/past-due.tsx +11 -3
  115. package/src/pages/customer/payout/detail.tsx +56 -13
  116. package/src/pages/customer/recharge/account.tsx +80 -20
  117. package/src/pages/customer/recharge/subscription.tsx +86 -25
  118. package/src/pages/customer/refund/list.tsx +60 -24
  119. package/src/pages/customer/subscription/change-payment.tsx +13 -4
  120. package/src/pages/customer/subscription/change-plan.tsx +34 -7
  121. package/src/pages/customer/subscription/detail.tsx +86 -20
  122. package/src/pages/customer/subscription/embed.tsx +24 -4
  123. package/src/pages/home.tsx +26 -4
  124. package/src/pages/integrations/donations/edit-form.tsx +25 -9
  125. package/src/pages/integrations/donations/index.tsx +26 -9
  126. package/src/pages/integrations/donations/preview.tsx +59 -15
  127. package/src/pages/integrations/index.tsx +10 -1
  128. package/src/pages/integrations/overview.tsx +78 -17
  129. package/vite.config.ts +60 -30
@@ -153,7 +153,11 @@ export default function SubscriptionEmbed() {
153
153
  {
154
154
  name: t('payment.customer.subscriptions.plan'),
155
155
  value: (
156
- <Typography fontWeight={600} sx={{ marginRight: '10px' }}>
156
+ <Typography
157
+ sx={{
158
+ fontWeight: 600,
159
+ marginRight: '10px',
160
+ }}>
157
161
  {formatSubscriptionProduct(subscription.items)}
158
162
  </Typography>
159
163
  ),
@@ -278,12 +282,22 @@ export default function SubscriptionEmbed() {
278
282
  <Box sx={{ flex: 1, overflow: 'hidden' }}>
279
283
  <List sx={{ height: '100%', display: 'flex', flexDirection: 'column' }} className="mini-invoice-list">
280
284
  <ListSubheader disableGutters sx={{ padding: 0 }}>
281
- <Typography component="h2" variant="h6" fontSize="16px">
285
+ <Typography
286
+ component="h2"
287
+ variant="h6"
288
+ sx={{
289
+ fontSize: '16px',
290
+ }}>
282
291
  {t('payment.customer.invoices')}
283
292
  </Typography>
284
293
  </ListSubheader>
285
294
  {(invoices as any).length === 0 ? (
286
- <Typography color="text.lighter">{t('payment.customer.invoice.empty')}</Typography>
295
+ <Typography
296
+ sx={{
297
+ color: 'text.lighter',
298
+ }}>
299
+ {t('payment.customer.invoice.empty')}
300
+ </Typography>
287
301
  ) : (
288
302
  <Box sx={{ flex: 1, overflow: 'auto' }}>
289
303
  {(invoices as any).map((item: any) => {
@@ -309,7 +323,13 @@ export default function SubscriptionEmbed() {
309
323
  )}
310
324
  </List>
311
325
  </Box>
312
- <Stack direction="row" justifyContent="center" spacing={2} sx={{ mt: 2 }}>
326
+ <Stack
327
+ direction="row"
328
+ spacing={2}
329
+ sx={{
330
+ justifyContent: 'center',
331
+ mt: 2,
332
+ }}>
313
333
  {subscription.service_actions
314
334
  ?.filter((x: any) => x?.type !== 'notification')
315
335
  ?.map((x) => (
@@ -15,17 +15,39 @@ function Home() {
15
15
  hideNavMenu={undefined}
16
16
  maxWidth={false}
17
17
  />
18
- <Stack alignItems="center" justifyContent="center" sx={{ height: '60vh', width: '100vw' }}>
19
- <Stack maxWidth="sm" direction="column" alignItems="center" spacing={3}>
18
+ <Stack
19
+ sx={{
20
+ alignItems: 'center',
21
+ justifyContent: 'center',
22
+ height: '60vh',
23
+ width: '100vw',
24
+ }}>
25
+ <Stack
26
+ direction="column"
27
+ spacing={3}
28
+ sx={{
29
+ maxWidth: 'sm',
30
+ alignItems: 'center',
31
+ }}>
20
32
  <Avatar
21
33
  src={window.blocklet.appLogo}
22
34
  sx={{ width: 80, height: 80 }}
23
35
  variant="square"
24
36
  alt={window.blocklet.appName || 'Payment Kit'}
25
37
  />
26
- <Stack direction="column" alignItems="center" spacing={1}>
38
+ <Stack
39
+ direction="column"
40
+ spacing={1}
41
+ sx={{
42
+ alignItems: 'center',
43
+ }}>
27
44
  <Typography variant="h4">Payment Kit</Typography>
28
- <Typography variant="h5" color="text.secondary" fontWeight="normal">
45
+ <Typography
46
+ variant="h5"
47
+ sx={{
48
+ color: 'text.secondary',
49
+ fontWeight: 'normal',
50
+ }}>
29
51
  <Typewriter
30
52
  options={{
31
53
  strings: ['The decentralized stripe alike payment solution for blocklets'],
@@ -157,11 +157,12 @@ export default function EditDonationForm({
157
157
  minHeight: 0,
158
158
  }}>
159
159
  <Grid
160
- item
161
- xs={12}
162
- md={6}
163
160
  sx={{
164
161
  height: '100%',
162
+ }}
163
+ size={{
164
+ xs: 12,
165
+ md: 6,
165
166
  }}>
166
167
  <Paper
167
168
  elevation={0}
@@ -173,7 +174,13 @@ export default function EditDonationForm({
173
174
  }}>
174
175
  <Stack spacing={4}>
175
176
  <Box>
176
- <Typography variant="h6" gutterBottom color="text.primary" sx={{ mb: 3 }}>
177
+ <Typography
178
+ variant="h6"
179
+ gutterBottom
180
+ sx={{
181
+ color: 'text.primary',
182
+ mb: 3,
183
+ }}>
177
184
  {t('admin.donate.buttonSettings')}
178
185
  </Typography>
179
186
  <Stack spacing={3}>
@@ -190,7 +197,10 @@ export default function EditDonationForm({
190
197
  )}
191
198
  />
192
199
 
193
- <Stack gap={1}>
200
+ <Stack
201
+ sx={{
202
+ gap: 1,
203
+ }}>
194
204
  <Typography variant="subtitle2" gutterBottom>
195
205
  {t('admin.donate.historyType.title')}
196
206
  </Typography>
@@ -219,7 +229,13 @@ export default function EditDonationForm({
219
229
  <Divider />
220
230
 
221
231
  <Box>
222
- <Typography variant="h6" gutterBottom color="text.primary" sx={{ mb: 3 }}>
232
+ <Typography
233
+ variant="h6"
234
+ gutterBottom
235
+ sx={{
236
+ color: 'text.primary',
237
+ mb: 3,
238
+ }}>
223
239
  {t('admin.donate.amountSettings')}
224
240
  </Typography>
225
241
  <Stack spacing={3}>
@@ -297,11 +313,12 @@ export default function EditDonationForm({
297
313
  </Grid>
298
314
 
299
315
  <Grid
300
- item
301
- md={6}
302
316
  sx={{
303
317
  display: { xs: 'none', md: 'block' },
304
318
  height: '100%',
319
+ }}
320
+ size={{
321
+ md: 6,
305
322
  }}>
306
323
  <Paper
307
324
  elevation={0}
@@ -317,7 +334,6 @@ export default function EditDonationForm({
317
334
  </Grid>
318
335
  </FormProvider>
319
336
  </Box>
320
-
321
337
  <Box
322
338
  sx={{
323
339
  mt: 2,
@@ -26,8 +26,8 @@ function YourComponent() {
26
26
  settings={{
27
27
  target: "post-123", // required, unique identifier for the donation instance
28
28
  title: "Support Author", // required, title of the donation modal
29
- description: "If you find this article helpful, feel free to buy me a coffee", // required, description of the donation
30
- reference: "https://your-site.com/posts/123", // required, reference link of the donation
29
+ description: "If you find this article helpful, feel free to buy me a coffee", // required, description of the donation
30
+ reference: "https://your-site.com/posts/123", // required, reference link of the donation
31
31
  beneficiaries: [
32
32
  {
33
33
  address: "tip user did", // required, address of the beneficiary
@@ -194,7 +194,12 @@ export default function DonationList() {
194
194
  return data[index]?.component_did || t('common.none');
195
195
  }
196
196
  return (
197
- <Stack direction="row" alignItems="center" gap={1}>
197
+ <Stack
198
+ direction="row"
199
+ sx={{
200
+ alignItems: 'center',
201
+ gap: 1,
202
+ }}>
198
203
  <Avatar
199
204
  src={joinURL(getPrefix(), `.well-known/service/blocklet/logo-bundle/${componentInfo.did}`)}
200
205
  alt={componentInfo?.title}
@@ -269,7 +274,13 @@ export default function DonationList() {
269
274
 
270
275
  return (
271
276
  <>
272
- <Stack direction="row" alignItems="center" gap={1} flexWrap="wrap">
277
+ <Stack
278
+ direction="row"
279
+ sx={{
280
+ alignItems: 'center',
281
+ gap: 1,
282
+ flexWrap: 'wrap',
283
+ }}>
273
284
  <Typography variant="body2">{t('admin.donate.intro')}</Typography>
274
285
  <Button variant="text" size="small" onClick={() => setShowExample(true)} sx={{ color: 'text.link' }}>
275
286
  {t('admin.donate.usage.viewExample')}
@@ -307,7 +318,6 @@ export default function DonationList() {
307
318
  }}
308
319
  onChange={onTableChange}
309
320
  />
310
-
311
321
  {showExample && (
312
322
  <Dialog
313
323
  open
@@ -317,17 +327,25 @@ export default function DonationList() {
317
327
  sx={{ '.MuiDialogContent-root': { padding: 0 } }}
318
328
  fullWidth>
319
329
  <Box sx={{ p: 3 }}>
320
- <Typography variant="body2" paragraph>
330
+ <Typography
331
+ variant="body2"
332
+ sx={{
333
+ marginBottom: '16px',
334
+ }}>
321
335
  {t('admin.donate.usage.description')}
322
336
  </Typography>
323
337
  <CodeExample code={exampleCode} />
324
- <Typography variant="body2" color="text.secondary" sx={{ mt: 2 }}>
338
+ <Typography
339
+ variant="body2"
340
+ sx={{
341
+ color: 'text.secondary',
342
+ mt: 2,
343
+ }}>
325
344
  {t('admin.donate.usage.note')}
326
345
  </Typography>
327
346
  </Box>
328
347
  </Dialog>
329
348
  )}
330
-
331
349
  {editingItem && (
332
350
  <Dialog
333
351
  open
@@ -346,7 +364,6 @@ export default function DonationList() {
346
364
  />
347
365
  </Dialog>
348
366
  )}
349
-
350
367
  {confirmDialog.open && (
351
368
  <ConfirmDialog
352
369
  title={t('admin.donate.status.inactiveTitle')}
@@ -5,7 +5,12 @@ import type { TSetting } from '@blocklet/payment-types';
5
5
 
6
6
  function PreviewAvatars({ count }: { count: number }) {
7
7
  return (
8
- <Stack flexDirection="row" justifyContent="center" alignItems="center">
8
+ <Stack
9
+ sx={{
10
+ flexDirection: 'row',
11
+ justifyContent: 'center',
12
+ alignItems: 'center',
13
+ }}>
9
14
  {/* Avatar Group */}
10
15
  <Box sx={{ display: 'flex', position: 'relative' }}>
11
16
  {Array(Math.min(count, 5))
@@ -28,7 +33,6 @@ function PreviewAvatars({ count }: { count: number }) {
28
33
  />
29
34
  ))}
30
35
  </Box>
31
-
32
36
  {/* Counter Box */}
33
37
  <Box
34
38
  sx={{
@@ -68,10 +72,14 @@ export default function DonationPreview({ config }: { config: TSetting['settings
68
72
 
69
73
  return (
70
74
  <Stack spacing={3}>
71
- <Typography variant="h6" gutterBottom color="text.primary">
75
+ <Typography
76
+ variant="h6"
77
+ gutterBottom
78
+ sx={{
79
+ color: 'text.primary',
80
+ }}>
72
81
  {t('admin.donate.previewTitle')}
73
82
  </Typography>
74
-
75
83
  {/* Button Preview */}
76
84
  <Paper
77
85
  elevation={0}
@@ -82,10 +90,21 @@ export default function DonationPreview({ config }: { config: TSetting['settings
82
90
  borderColor: 'divider',
83
91
  borderRadius: 1,
84
92
  }}>
85
- <Typography variant="caption" display="block" gutterBottom color="text.secondary" mb={1}>
93
+ <Typography
94
+ variant="caption"
95
+ gutterBottom
96
+ sx={{
97
+ display: 'block',
98
+ color: 'text.secondary',
99
+ mb: 1,
100
+ }}>
86
101
  {t('admin.donate.btn.preview')}
87
102
  </Typography>
88
- <Stack spacing={2} alignItems="center">
103
+ <Stack
104
+ spacing={2}
105
+ sx={{
106
+ alignItems: 'center',
107
+ }}>
89
108
  <Button variant="outlined" color="primary">
90
109
  {config.settings.btnText}
91
110
  </Button>
@@ -116,7 +135,13 @@ export default function DonationPreview({ config }: { config: TSetting['settings
116
135
  width: '100%',
117
136
  maxWidth: 240,
118
137
  }}>
119
- <Box display="flex" alignItems="center" gap={0.5} width="75%">
138
+ <Box
139
+ sx={{
140
+ display: 'flex',
141
+ alignItems: 'center',
142
+ gap: 0.5,
143
+ width: '75%',
144
+ }}>
120
145
  <Box
121
146
  // eslint-disable-next-line react/no-array-index-key
122
147
  key={i}
@@ -155,7 +180,6 @@ export default function DonationPreview({ config }: { config: TSetting['settings
155
180
  </Box>
156
181
  </Stack>
157
182
  </Paper>
158
-
159
183
  {/* Dialog Preview */}
160
184
  <Paper
161
185
  elevation={0}
@@ -166,11 +190,23 @@ export default function DonationPreview({ config }: { config: TSetting['settings
166
190
  borderColor: 'divider',
167
191
  borderRadius: 1,
168
192
  }}>
169
- <Typography variant="caption" display="block" gutterBottom color="text.secondary" mb={1}>
193
+ <Typography
194
+ variant="caption"
195
+ gutterBottom
196
+ sx={{
197
+ display: 'block',
198
+ color: 'text.secondary',
199
+ mb: 1,
200
+ }}>
170
201
  {t('admin.donate.dialog.preview')}
171
202
  </Typography>
172
203
  <Stack spacing={3}>
173
- <Box display="flex" gap={1} flexWrap="wrap">
204
+ <Box
205
+ sx={{
206
+ display: 'flex',
207
+ gap: 1,
208
+ flexWrap: 'wrap',
209
+ }}>
174
210
  {config.settings.amount.presets?.map((amount: string) => (
175
211
  <Button
176
212
  key={amount}
@@ -211,19 +247,27 @@ export default function DonationPreview({ config }: { config: TSetting['settings
211
247
  const { value } = e.target;
212
248
  setCustomAmount(value);
213
249
  }}
214
- InputProps={{
215
- endAdornment: <Typography sx={{ ml: 1 }}>ABT</Typography>,
216
- autoComplete: 'off',
217
- }}
218
250
  helperText={t('admin.donate.amountRange', {
219
251
  min: config.settings.amount.minimum,
220
252
  max: config.settings.amount.maximum,
221
253
  })}
254
+ slotProps={{
255
+ input: {
256
+ endAdornment: <Typography sx={{ ml: 1 }}>ABT</Typography>,
257
+ },
258
+ }}
259
+ autoComplete="off"
222
260
  />
223
261
  )}
224
262
  </Stack>
225
263
  <Divider sx={{ my: 2 }} />
226
- <Box display="flex" justifyContent="flex-end" alignItems="center" gap={1}>
264
+ <Box
265
+ sx={{
266
+ display: 'flex',
267
+ justifyContent: 'flex-end',
268
+ alignItems: 'center',
269
+ gap: 1,
270
+ }}>
227
271
  <Box
228
272
  sx={{
229
273
  px: 2,
@@ -35,7 +35,16 @@ function Integrations() {
35
35
  return (
36
36
  <>
37
37
  <ProgressBar pending={isPending} />
38
- <Stack direction="row" alignItems="center" justifyContent="end" flexWrap="wrap" spacing={1} sx={{ mt: 1, pb: 2 }}>
38
+ <Stack
39
+ direction="row"
40
+ spacing={1}
41
+ sx={{
42
+ alignItems: 'center',
43
+ justifyContent: 'end',
44
+ flexWrap: 'wrap',
45
+ mt: 1,
46
+ pb: 2,
47
+ }}>
39
48
  <Tabs
40
49
  tabs={tabs}
41
50
  current={group}
@@ -67,21 +67,51 @@ export default function Overview() {
67
67
 
68
68
  return (
69
69
  <Box>
70
- <Box mb={4}>
71
- <Typography variant="h2" gutterBottom fontWeight="bold" mb={1}>
70
+ <Box
71
+ sx={{
72
+ mb: 4,
73
+ }}>
74
+ <Typography
75
+ variant="h2"
76
+ gutterBottom
77
+ sx={{
78
+ fontWeight: 'bold',
79
+ mb: 1,
80
+ }}>
72
81
  {t('common.welcome')}
73
82
  </Typography>
74
- <Typography variant="body2" color="text.secondary" mb={2}>
83
+ <Typography
84
+ variant="body2"
85
+ sx={{
86
+ color: 'text.secondary',
87
+ mb: 2,
88
+ }}>
75
89
  {t('common.welcomeDesc')}
76
90
  </Typography>
77
91
  </Box>
78
-
79
- <Typography variant="h3" gutterBottom mb={2}>
92
+ <Typography
93
+ variant="h3"
94
+ gutterBottom
95
+ sx={{
96
+ mb: 2,
97
+ }}>
80
98
  {t('integrations.basicFeatures')} 🚀
81
99
  </Typography>
82
- <Grid container spacing={2} mb={4} sx={{ maxWidth: 1200 }}>
100
+ <Grid
101
+ container
102
+ spacing={2}
103
+ sx={{
104
+ mb: 4,
105
+ maxWidth: 1200,
106
+ }}>
83
107
  {basicFeatures.map((item) => (
84
- <Grid item xs={12} sm={6} md={4} key={item.path}>
108
+ <Grid
109
+ key={item.path}
110
+ size={{
111
+ xs: 12,
112
+ sm: 6,
113
+ md: 4,
114
+ }}>
85
115
  <Box
86
116
  className="base-card"
87
117
  onClick={() => handleClick(item)}
@@ -92,28 +122,48 @@ export default function Overview() {
92
122
  boxShadow: 2,
93
123
  },
94
124
  }}>
95
- <Box mb={1}>
125
+ <Box
126
+ sx={{
127
+ mb: 1,
128
+ }}>
96
129
  {item.icon}
97
- <Typography variant="h4" mt={1.5}>
130
+ <Typography
131
+ variant="h4"
132
+ sx={{
133
+ mt: 1.5,
134
+ }}>
98
135
  {t(item.title)}
99
136
  </Typography>
100
137
  </Box>
101
- <Typography variant="body2" color="text.secondary">
138
+ <Typography
139
+ variant="body2"
140
+ sx={{
141
+ color: 'text.secondary',
142
+ }}>
102
143
  {t(item.description)}
103
144
  </Typography>
104
145
  </Box>
105
146
  </Grid>
106
147
  ))}
107
148
  </Grid>
108
-
109
149
  <Divider sx={{ my: 4 }} />
110
-
111
- <Typography variant="h3" gutterBottom mb={2}>
150
+ <Typography
151
+ variant="h3"
152
+ gutterBottom
153
+ sx={{
154
+ mb: 2,
155
+ }}>
112
156
  {t('integrations.advancedFeatures')} 🔥
113
157
  </Typography>
114
158
  <Grid container spacing={2} sx={{ maxWidth: 1200 }}>
115
159
  {advancedFeatures.map((item) => (
116
- <Grid item xs={12} sm={6} md={4} key={item.path}>
160
+ <Grid
161
+ key={item.path}
162
+ size={{
163
+ xs: 12,
164
+ sm: 6,
165
+ md: 4,
166
+ }}>
117
167
  <Box
118
168
  className="base-card"
119
169
  onClick={() => handleClick(item)}
@@ -124,13 +174,24 @@ export default function Overview() {
124
174
  boxShadow: 2,
125
175
  },
126
176
  }}>
127
- <Box mb={1}>
177
+ <Box
178
+ sx={{
179
+ mb: 1,
180
+ }}>
128
181
  {item.icon}
129
- <Typography variant="h4" mt={1.5}>
182
+ <Typography
183
+ variant="h4"
184
+ sx={{
185
+ mt: 1.5,
186
+ }}>
130
187
  {t(item.title)}
131
188
  </Typography>
132
189
  </Box>
133
- <Typography variant="body2" color="text.secondary">
190
+ <Typography
191
+ variant="body2"
192
+ sx={{
193
+ color: 'text.secondary',
194
+ }}>
134
195
  {t(item.description)}
135
196
  </Typography>
136
197
  </Box>
package/vite.config.ts CHANGED
@@ -10,14 +10,27 @@ import path from 'path';
10
10
  // https://vitejs.dev/config/
11
11
  export default defineConfig(({ mode }) => {
12
12
  const isProduction = mode === 'production';
13
+ const isDevelopment = mode === 'development';
14
+ const alias: Record<string, string> = {};
15
+
16
+ if (isDevelopment) {
17
+ alias['@blocklet/payment-react'] = path.resolve(__dirname, '../../packages/react/src');
18
+ alias['@blocklet/payment-js'] = path.resolve(__dirname, '../../packages/client/src');
19
+ }
20
+
21
+ if (isProduction) {
22
+ // mui-datatable
23
+ alias['lodash.assign'] = 'lodash/assign';
24
+ alias['lodash.clonedeep'] = 'lodash/cloneDeep';
25
+ alias['lodash.isequal'] = 'lodash/isEqual';
26
+ alias['lodash.merge'] = 'lodash/merge';
27
+ alias['lodash.find'] = 'lodash/find';
28
+ }
29
+
13
30
  return {
14
31
  plugins: [
15
32
  tsconfigPaths(),
16
- react({
17
- babel: {
18
- plugins: isProduction ? [['lodash']] : [],
19
- },
20
- }),
33
+ react({ babel: { plugins: isProduction ? [['lodash']] : [] } }),
21
34
  createBlockletPlugin(),
22
35
  svgr(),
23
36
  process.env.ANALYZE && visualizer({ open: true, gzipSize: true, brotliSize: true }),
@@ -26,46 +39,63 @@ export default defineConfig(({ mode }) => {
26
39
  build: {
27
40
  cssCodeSplit: false,
28
41
  minify: 'terser',
29
- terserOptions: {
30
- compress: {
31
- drop_debugger: true,
32
- pure_funcs: ['assert', 'debug'],
33
- },
34
- },
42
+ terserOptions: { compress: { drop_debugger: true, pure_funcs: ['assert', 'debug'] } },
35
43
  reportCompressedSize: false,
36
44
  chunkSizeWarningLimit: 1000,
37
- commonjsOptions: {
38
- include: [/node_modules/],
39
- transformMixedEsModules: true,
40
- },
45
+ commonjsOptions: { include: [/node_modules/], transformMixedEsModules: true },
41
46
  rollupOptions: {
42
47
  external: [],
43
48
  output: {
44
49
  manualChunks: {
45
50
  'vendor-react': ['react', 'react-dom', 'react-router-dom'],
46
- 'vendor-mui': ['@mui/material', '@mui/system', '@mui/icons-material'],
51
+ 'vendor-mui': [
52
+ '@mui/material',
53
+ '@mui/icons-material',
54
+ '@mui/system',
55
+ '@mui/lab',
56
+ // '@mui/material-nextjs',
57
+ '@mui/styled-engine',
58
+ // '@mui/styled-engine-sc',
59
+ '@mui/utils',
60
+ // '@mui/x-data-grid',
61
+ // '@mui/x-data-grid-pro',
62
+ // '@mui/x-data-grid-premium',
63
+ // '@mui/x-date-pickers',
64
+ // '@mui/x-date-pickers-pro',
65
+ // '@mui/x-charts',
66
+ // '@mui/x-tree-view',
67
+ // '@mui/x-tree-view-pro',
68
+ ],
69
+ moment: ['moment', 'moment-timezone'],
47
70
  utils: ['dayjs', 'numbro', 'bn.js'],
48
71
  hooks: ['ahooks', 'use-bus'],
49
- 'vendor-arcblock': ['@arcblock/did-connect'],
72
+ lottie: ['lottie-web', 'react-lottie-player', '@lottiefiles/react-lottie-player'],
73
+ 'vendor-arcblock': ['@arcblock/did-connect', '@arcblock/ux'],
74
+ 'vendor-blocklet': ['@blocklet/ui-react'],
50
75
  },
51
76
  },
52
77
  },
53
78
  },
54
79
  optimizeDeps: {
55
80
  include: ['react', 'react-dom', 'react/jsx-runtime'],
56
- esbuildOptions: {
57
- mainFields: ['module', 'main'],
58
- resolveExtensions: ['.ts', '.tsx', '.js', '.jsx'],
59
- },
60
- exclude: mode === 'development' ? ['@blocklet/payment-react', '@blocklet/payment-js'] : [],
81
+ esbuildOptions: { mainFields: ['module', 'main'], resolveExtensions: ['.ts', '.tsx', '.js', '.jsx'] },
82
+ exclude: isDevelopment ? ['@blocklet/payment-react', '@blocklet/payment-js'] : [],
83
+ },
84
+ resolve: {
85
+ alias,
86
+ dedupe: [
87
+ //
88
+ '@blocklet/ui-react',
89
+ '@arcblock/ux',
90
+ '@arcblock/did-connect',
91
+ '@mui/material',
92
+ // '@mui/utils',
93
+ '@mui/icons-material',
94
+ 'react',
95
+ 'react-dom',
96
+ 'lodash',
97
+ 'bn.js',
98
+ ],
61
99
  },
62
- ...(mode === 'development' && {
63
- resolve: {
64
- alias: [
65
- { find: '@blocklet/payment-react', replacement: path.resolve(__dirname, '../../packages/react/src') },
66
- { find: '@blocklet/payment-js', replacement: path.resolve(__dirname, '../../packages/client/src') },
67
- ],
68
- },
69
- }),
70
100
  };
71
101
  });