payment-kit 1.18.56 → 1.19.1

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 (214) hide show
  1. package/.eslintrc.js +6 -0
  2. package/api/src/crons/index.ts +8 -0
  3. package/api/src/index.ts +4 -0
  4. package/api/src/libs/credit-grant.ts +146 -0
  5. package/api/src/libs/env.ts +1 -0
  6. package/api/src/libs/invoice.ts +4 -3
  7. package/api/src/libs/notification/template/base.ts +388 -2
  8. package/api/src/libs/notification/template/customer-credit-grant-granted.ts +149 -0
  9. package/api/src/libs/notification/template/customer-credit-grant-low-balance.ts +151 -0
  10. package/api/src/libs/notification/template/customer-credit-insufficient.ts +254 -0
  11. package/api/src/libs/notification/template/subscription-canceled.ts +193 -202
  12. package/api/src/libs/notification/template/subscription-refund-succeeded.ts +215 -237
  13. package/api/src/libs/notification/template/subscription-renewed.ts +130 -200
  14. package/api/src/libs/notification/template/subscription-succeeded.ts +100 -202
  15. package/api/src/libs/notification/template/subscription-trial-start.ts +142 -188
  16. package/api/src/libs/notification/template/subscription-trial-will-end.ts +146 -174
  17. package/api/src/libs/notification/template/subscription-upgraded.ts +96 -192
  18. package/api/src/libs/notification/template/subscription-will-canceled.ts +94 -135
  19. package/api/src/libs/notification/template/subscription-will-renew.ts +220 -245
  20. package/api/src/libs/payment.ts +69 -0
  21. package/api/src/libs/queue/index.ts +3 -2
  22. package/api/src/libs/session.ts +8 -0
  23. package/api/src/libs/subscription.ts +74 -3
  24. package/api/src/libs/ws.ts +23 -1
  25. package/api/src/locales/en.ts +33 -0
  26. package/api/src/locales/zh.ts +31 -0
  27. package/api/src/queues/credit-consume.ts +715 -0
  28. package/api/src/queues/credit-grant.ts +572 -0
  29. package/api/src/queues/notification.ts +173 -128
  30. package/api/src/queues/payment.ts +210 -122
  31. package/api/src/queues/subscription.ts +179 -0
  32. package/api/src/routes/checkout-sessions.ts +157 -9
  33. package/api/src/routes/connect/shared.ts +3 -2
  34. package/api/src/routes/credit-grants.ts +241 -0
  35. package/api/src/routes/credit-transactions.ts +208 -0
  36. package/api/src/routes/index.ts +8 -0
  37. package/api/src/routes/meter-events.ts +347 -0
  38. package/api/src/routes/meters.ts +219 -0
  39. package/api/src/routes/payment-currencies.ts +14 -2
  40. package/api/src/routes/payment-links.ts +1 -1
  41. package/api/src/routes/payment-methods.ts +14 -2
  42. package/api/src/routes/prices.ts +43 -0
  43. package/api/src/routes/pricing-table.ts +13 -7
  44. package/api/src/routes/products.ts +63 -4
  45. package/api/src/routes/settings.ts +1 -1
  46. package/api/src/routes/subscriptions.ts +4 -0
  47. package/api/src/store/migrations/20250610-billing-credit.ts +43 -0
  48. package/api/src/store/models/credit-grant.ts +486 -0
  49. package/api/src/store/models/credit-transaction.ts +268 -0
  50. package/api/src/store/models/customer.ts +8 -0
  51. package/api/src/store/models/index.ts +52 -1
  52. package/api/src/store/models/meter-event.ts +423 -0
  53. package/api/src/store/models/meter.ts +176 -0
  54. package/api/src/store/models/payment-currency.ts +66 -14
  55. package/api/src/store/models/price.ts +6 -0
  56. package/api/src/store/models/product.ts +2 -2
  57. package/api/src/store/models/subscription.ts +24 -0
  58. package/api/src/store/models/types.ts +28 -2
  59. package/api/tests/libs/subscription.spec.ts +53 -0
  60. package/blocklet.yml +9 -1
  61. package/package.json +57 -58
  62. package/scripts/sdk.js +233 -1
  63. package/src/app.tsx +10 -0
  64. package/src/components/actions.tsx +22 -9
  65. package/src/components/balance-list.tsx +40 -12
  66. package/src/components/collapse.tsx +33 -15
  67. package/src/components/copyable.tsx +8 -7
  68. package/src/components/currency.tsx +15 -7
  69. package/src/components/customer/actions.tsx +1 -5
  70. package/src/components/customer/credit-grant-item-list.tsx +99 -0
  71. package/src/components/customer/credit-overview.tsx +233 -0
  72. package/src/components/customer/form.tsx +7 -2
  73. package/src/components/customer/link.tsx +4 -12
  74. package/src/components/customer/notification-preference.tsx +18 -9
  75. package/src/components/customer/overdraft-protection.tsx +112 -41
  76. package/src/components/drawer-form.tsx +42 -18
  77. package/src/components/error.tsx +1 -5
  78. package/src/components/event/list.tsx +9 -10
  79. package/src/components/filter-toolbar.tsx +20 -19
  80. package/src/components/info-card.tsx +32 -18
  81. package/src/components/info-metric.tsx +16 -6
  82. package/src/components/info-row-group.tsx +1 -7
  83. package/src/components/info-row.tsx +30 -24
  84. package/src/components/invoice/action.tsx +1 -7
  85. package/src/components/invoice/list.tsx +34 -26
  86. package/src/components/invoice/recharge.tsx +5 -7
  87. package/src/components/invoice/table.tsx +17 -12
  88. package/src/components/layout/user.tsx +1 -1
  89. package/src/components/metadata/form.tsx +290 -94
  90. package/src/components/metadata/list.tsx +11 -3
  91. package/src/components/meter/actions.tsx +101 -0
  92. package/src/components/meter/add-usage-dialog.tsx +239 -0
  93. package/src/components/meter/events-list.tsx +657 -0
  94. package/src/components/meter/form.tsx +245 -0
  95. package/src/components/meter/products.tsx +264 -0
  96. package/src/components/meter/usage-guide.tsx +174 -0
  97. package/src/components/passport/actions.tsx +9 -4
  98. package/src/components/payment-currency/add.tsx +16 -3
  99. package/src/components/payment-currency/form.tsx +14 -6
  100. package/src/components/payment-intent/actions.tsx +24 -16
  101. package/src/components/payment-intent/list.tsx +30 -9
  102. package/src/components/payment-link/actions.tsx +1 -5
  103. package/src/components/payment-link/after-pay.tsx +4 -2
  104. package/src/components/payment-link/before-pay.tsx +14 -4
  105. package/src/components/payment-link/item.tsx +27 -6
  106. package/src/components/payment-link/preview.tsx +9 -9
  107. package/src/components/payment-link/product-select.tsx +69 -15
  108. package/src/components/payment-method/arcblock.tsx +8 -1
  109. package/src/components/payment-method/base.tsx +8 -1
  110. package/src/components/payment-method/bitcoin.tsx +8 -1
  111. package/src/components/payment-method/ethereum.tsx +8 -1
  112. package/src/components/payment-method/evm-rpc-input.tsx +11 -7
  113. package/src/components/payment-method/form.tsx +2 -7
  114. package/src/components/payment-method/stripe.tsx +2 -0
  115. package/src/components/payouts/actions.tsx +1 -5
  116. package/src/components/payouts/list.tsx +30 -10
  117. package/src/components/payouts/portal/list.tsx +11 -9
  118. package/src/components/price/currency-select.tsx +63 -32
  119. package/src/components/price/form.tsx +895 -370
  120. package/src/components/price/upsell-select.tsx +10 -2
  121. package/src/components/price/upsell.tsx +7 -2
  122. package/src/components/pricing-table/actions.tsx +1 -5
  123. package/src/components/pricing-table/customer-settings.tsx +5 -1
  124. package/src/components/pricing-table/payment-settings.tsx +14 -4
  125. package/src/components/pricing-table/preview.tsx +9 -9
  126. package/src/components/pricing-table/price-item.tsx +6 -1
  127. package/src/components/pricing-table/product-item.tsx +6 -1
  128. package/src/components/pricing-table/product-settings.tsx +17 -4
  129. package/src/components/product/actions.tsx +1 -5
  130. package/src/components/product/add-price.tsx +9 -7
  131. package/src/components/product/create.tsx +8 -9
  132. package/src/components/product/cross-sell-select.tsx +5 -1
  133. package/src/components/product/cross-sell.tsx +7 -2
  134. package/src/components/product/edit-price.tsx +21 -12
  135. package/src/components/product/features.tsx +26 -6
  136. package/src/components/product/form.tsx +115 -72
  137. package/src/components/progress-bar.tsx +1 -1
  138. package/src/components/refund/actions.tsx +1 -7
  139. package/src/components/refund/list.tsx +31 -18
  140. package/src/components/section/header.tsx +12 -14
  141. package/src/components/subscription/actions/cancel.tsx +22 -5
  142. package/src/components/subscription/actions/index.tsx +9 -10
  143. package/src/components/subscription/actions/pause.tsx +32 -6
  144. package/src/components/subscription/actions/slash-stake.tsx +5 -3
  145. package/src/components/subscription/description.tsx +12 -8
  146. package/src/components/subscription/items/index.tsx +31 -16
  147. package/src/components/subscription/items/usage-records.tsx +19 -5
  148. package/src/components/subscription/list.tsx +5 -7
  149. package/src/components/subscription/metrics.tsx +62 -15
  150. package/src/components/subscription/portal/actions.tsx +78 -71
  151. package/src/components/subscription/portal/cancel.tsx +10 -3
  152. package/src/components/subscription/portal/list.tsx +48 -26
  153. package/src/components/uploader.tsx +5 -13
  154. package/src/components/webhook/attempts.tsx +51 -16
  155. package/src/components/webhook/request-info.tsx +8 -6
  156. package/src/contexts/products.tsx +27 -10
  157. package/src/hooks/subscription.ts +34 -0
  158. package/src/libs/meter-utils.ts +196 -0
  159. package/src/libs/util.ts +4 -0
  160. package/src/locales/en.tsx +385 -4
  161. package/src/locales/zh.tsx +364 -0
  162. package/src/pages/admin/billing/index.tsx +61 -33
  163. package/src/pages/admin/billing/invoices/detail.tsx +49 -13
  164. package/src/pages/admin/billing/meters/create.tsx +60 -0
  165. package/src/pages/admin/billing/meters/detail.tsx +435 -0
  166. package/src/pages/admin/billing/meters/index.tsx +210 -0
  167. package/src/pages/admin/billing/meters/meter-event.tsx +346 -0
  168. package/src/pages/admin/billing/subscriptions/detail.tsx +90 -25
  169. package/src/pages/admin/customers/customers/credit-grant/detail.tsx +391 -0
  170. package/src/pages/admin/customers/customers/detail.tsx +67 -14
  171. package/src/pages/admin/customers/customers/index.tsx +6 -1
  172. package/src/pages/admin/customers/index.tsx +5 -0
  173. package/src/pages/admin/developers/events/detail.tsx +37 -11
  174. package/src/pages/admin/developers/index.tsx +1 -1
  175. package/src/pages/admin/developers/webhooks/detail.tsx +41 -11
  176. package/src/pages/admin/index.tsx +15 -2
  177. package/src/pages/admin/overview.tsx +107 -19
  178. package/src/pages/admin/payments/intents/detail.tsx +58 -14
  179. package/src/pages/admin/payments/payouts/detail.tsx +63 -15
  180. package/src/pages/admin/payments/refunds/detail.tsx +58 -14
  181. package/src/pages/admin/products/index.tsx +11 -4
  182. package/src/pages/admin/products/links/create.tsx +22 -4
  183. package/src/pages/admin/products/links/detail.tsx +43 -14
  184. package/src/pages/admin/products/passports/index.tsx +23 -4
  185. package/src/pages/admin/products/prices/actions.tsx +16 -9
  186. package/src/pages/admin/products/prices/detail.tsx +73 -14
  187. package/src/pages/admin/products/prices/list.tsx +15 -3
  188. package/src/pages/admin/products/pricing-tables/create.tsx +45 -12
  189. package/src/pages/admin/products/pricing-tables/detail.tsx +45 -14
  190. package/src/pages/admin/products/products/create.tsx +233 -54
  191. package/src/pages/admin/products/products/detail.tsx +74 -18
  192. package/src/pages/admin/settings/index.tsx +8 -1
  193. package/src/pages/admin/settings/payment-methods/index.tsx +87 -19
  194. package/src/pages/admin/settings/vault-config/edit-form.tsx +42 -28
  195. package/src/pages/admin/settings/vault-config/index.tsx +57 -10
  196. package/src/pages/customer/credit-grant/detail.tsx +308 -0
  197. package/src/pages/customer/index.tsx +76 -17
  198. package/src/pages/customer/invoice/detail.tsx +63 -14
  199. package/src/pages/customer/invoice/past-due.tsx +11 -3
  200. package/src/pages/customer/payout/detail.tsx +56 -13
  201. package/src/pages/customer/recharge/account.tsx +78 -18
  202. package/src/pages/customer/recharge/subscription.tsx +86 -25
  203. package/src/pages/customer/refund/list.tsx +60 -24
  204. package/src/pages/customer/subscription/change-payment.tsx +17 -6
  205. package/src/pages/customer/subscription/change-plan.tsx +34 -7
  206. package/src/pages/customer/subscription/detail.tsx +134 -34
  207. package/src/pages/customer/subscription/embed.tsx +25 -5
  208. package/src/pages/home.tsx +26 -4
  209. package/src/pages/integrations/donations/edit-form.tsx +25 -9
  210. package/src/pages/integrations/donations/index.tsx +26 -9
  211. package/src/pages/integrations/donations/preview.tsx +59 -15
  212. package/src/pages/integrations/index.tsx +10 -1
  213. package/src/pages/integrations/overview.tsx +78 -17
  214. package/vite.config.ts +60 -30
@@ -22,6 +22,7 @@ import { useMemo } from 'react';
22
22
  import BalanceList from '../../../../components/balance-list';
23
23
  import Copyable from '../../../../components/copyable';
24
24
  import EditCustomer from '../../../../components/customer/edit';
25
+ import CreditOverview from '../../../../components/customer/credit-overview';
25
26
  import EventList from '../../../../components/event/list';
26
27
  import InfoMetric from '../../../../components/info-metric';
27
28
  import InfoRow from '../../../../components/info-row';
@@ -38,7 +39,14 @@ import InfoRowGroup from '../../../../components/info-row-group';
38
39
 
39
40
  const fetchData = async (
40
41
  id: string
41
- ): Promise<{ customer: TCustomerExpanded; summary: { [key: string]: GroupedBN } }> => {
42
+ ): Promise<{
43
+ customer: TCustomerExpanded;
44
+ summary: { [key: string]: GroupedBN };
45
+ creditSummary?: {
46
+ grants?: { [currencyId: string]: { totalAmount: string; remainingAmount: string } };
47
+ pendingAmount?: { [currencyId: string]: string };
48
+ } | null;
49
+ }> => {
42
50
  const [customer, summary] = await Promise.all([
43
51
  api.get(`/api/customers/${id}`).then((res) => res.data),
44
52
  api.get(`/api/customers/${id}/summary`).then((res) => res.data),
@@ -158,12 +166,21 @@ export default function CustomerDetail(props: { id: string }) {
158
166
  return (
159
167
  <Root direction="column" spacing={2.5} sx={{ mb: 4 }}>
160
168
  <Box>
161
- <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
169
+ <Stack
170
+ className="page-header"
171
+ direction="row"
172
+ sx={{
173
+ justifyContent: 'space-between',
174
+ alignItems: 'center',
175
+ }}>
162
176
  <Stack
163
177
  direction="row"
164
- alignItems="center"
165
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}
166
- onClick={() => goBackOrFallback('/admin/customers')}>
178
+ onClick={() => goBackOrFallback('/admin/customers')}
179
+ sx={{
180
+ alignItems: 'center',
181
+ fontWeight: 'normal',
182
+ cursor: 'pointer',
183
+ }}>
167
184
  <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
168
185
  <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
169
186
  {t('admin.customers')}
@@ -180,29 +197,43 @@ export default function CustomerDetail(props: { id: string }) {
180
197
  {/* <CustomerActions data={data.customer} onChange={onChange} variant="normal" /> */}
181
198
  </Stack>
182
199
  <Box
183
- mt={4}
184
- mb={3}
185
200
  sx={{
201
+ mt: 4,
202
+ mb: 3,
186
203
  display: 'flex',
204
+
187
205
  gap: {
188
206
  xs: 2,
189
207
  sm: 2,
190
208
  md: 5,
191
209
  },
210
+
192
211
  flexWrap: 'wrap',
212
+
193
213
  flexDirection: {
194
214
  xs: 'column',
195
215
  sm: 'column',
196
216
  md: 'row',
197
217
  },
218
+
198
219
  alignItems: {
199
220
  xs: 'flex-start',
200
221
  sm: 'flex-start',
201
222
  md: 'center',
202
223
  },
203
224
  }}>
204
- <Stack direction="row" justifyContent="space-between" alignItems="center">
205
- <Stack direction="row" alignItems="center" spacing={1}>
225
+ <Stack
226
+ direction="row"
227
+ sx={{
228
+ justifyContent: 'space-between',
229
+ alignItems: 'center',
230
+ }}>
231
+ <Stack
232
+ direction="row"
233
+ spacing={1}
234
+ sx={{
235
+ alignItems: 'center',
236
+ }}>
206
237
  <Avatar
207
238
  title={data.customer.name}
208
239
  src={getCustomerAvatar(
@@ -221,18 +252,22 @@ export default function CustomerDetail(props: { id: string }) {
221
252
  </Stack>
222
253
  <Stack
223
254
  className="section-body"
224
- justifyContent="flex-start"
225
- flexWrap="wrap"
226
255
  sx={{
256
+ justifyContent: 'flex-start',
257
+ flexWrap: 'wrap',
258
+
227
259
  'hr.MuiDivider-root:last-child': {
228
260
  display: 'none',
229
261
  },
262
+
230
263
  flexDirection: {
231
264
  xs: 'column',
232
265
  sm: 'column',
233
266
  md: 'row',
234
267
  },
268
+
235
269
  alignItems: 'flex-start',
270
+
236
271
  gap: {
237
272
  xs: 1,
238
273
  sm: 1,
@@ -274,7 +309,18 @@ export default function CustomerDetail(props: { id: string }) {
274
309
  },
275
310
  },
276
311
  }}>
277
- <Box flex={1} className="payment-link-column-1" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
312
+ <Box className="payment-link-column-1" sx={{ flex: 1, gap: 2.5, display: 'flex', flexDirection: 'column' }}>
313
+ {/* 信用管理区域 */}
314
+ {data.creditSummary && (
315
+ <>
316
+ <Box className="section">
317
+ <SectionHeader title={t('admin.creditGrants.title')} mb={0} />
318
+ <CreditOverview customerId={props.id} settings={settings} mode="dashboard" />
319
+ </Box>
320
+ <Divider />
321
+ </>
322
+ )}
323
+
278
324
  <Box className="section" sx={{ containerType: 'inline-size' }}>
279
325
  <SectionHeader title={t('admin.details')} />
280
326
  <InfoRowGroup
@@ -376,7 +422,7 @@ export default function CustomerDetail(props: { id: string }) {
376
422
  </Box>
377
423
  <Divider />
378
424
  <Box className="section">
379
- <SectionHeader title={t('admin.events')} />
425
+ <SectionHeader title={t('admin.events.title')} />
380
426
  <Box className="section-body">
381
427
  <EventList features={{ toolbar: false }} object_id={data.customer.id} />
382
428
  </Box>
@@ -436,7 +482,14 @@ export default function CustomerDetail(props: { id: string }) {
436
482
  label={t('admin.customer.address.country')}
437
483
  value={
438
484
  data.customer.address?.country ? (
439
- <Box display="flex" alignItems="center" flexWrap="nowrap" gap={0.5} sx={{ cursor: 'pointer' }}>
485
+ <Box
486
+ sx={{
487
+ display: 'flex',
488
+ alignItems: 'center',
489
+ flexWrap: 'nowrap',
490
+ gap: 0.5,
491
+ cursor: 'pointer',
492
+ }}>
440
493
  <FlagEmoji iso2={data.customer.address?.country} style={{ display: 'flex', width: 24 }} />
441
494
  <Typography>{countryDetail?.name}</Typography>
442
495
  </Box>
@@ -68,7 +68,12 @@ export default function CustomersList() {
68
68
  const item = data.list[index] as TCustomer;
69
69
  return (
70
70
  <Link to={`/admin/customers/${item.id}`}>
71
- <Stack direction="row" alignItems="center" spacing={1}>
71
+ <Stack
72
+ direction="row"
73
+ spacing={1}
74
+ sx={{
75
+ alignItems: 'center',
76
+ }}>
72
77
  <Avatar
73
78
  src={getCustomerAvatar(
74
79
  item?.did,
@@ -6,6 +6,7 @@ import { useNavigate, useParams } from 'react-router-dom';
6
6
  import { useTransitionContext } from '../../../components/progress-bar';
7
7
 
8
8
  const CustomerDetail = React.lazy(() => import('./customers/detail'));
9
+ const CreditGrantDetail = React.lazy(() => import('./customers/credit-grant/detail'));
9
10
 
10
11
  const pages = {
11
12
  overview: React.lazy(() => import('./customers')),
@@ -21,6 +22,10 @@ export default function CustomerIndex() {
21
22
  return <CustomerDetail id={page} />;
22
23
  }
23
24
 
25
+ if (page.startsWith('credgr_')) {
26
+ return <CreditGrantDetail id={page} />;
27
+ }
28
+
24
29
  const onTabChange = (newTab: string) => {
25
30
  startTransition(() => {
26
31
  navigate(`/admin/customers/${newTab}`);
@@ -33,59 +33,85 @@ export default function EventDetail(props: { id: string }) {
33
33
  return (
34
34
  <Root direction="column" spacing={2.5} sx={{ mb: 4 }}>
35
35
  <Box>
36
- <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
36
+ <Stack
37
+ className="page-header"
38
+ direction="row"
39
+ sx={{
40
+ justifyContent: 'space-between',
41
+ alignItems: 'center',
42
+ }}>
37
43
  <Stack
38
44
  direction="row"
39
- alignItems="center"
40
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}
41
- onClick={() => goBackOrFallback('/admin/developers/events')}>
45
+ onClick={() => goBackOrFallback('/admin/developers/events')}
46
+ sx={{
47
+ alignItems: 'center',
48
+ fontWeight: 'normal',
49
+ cursor: 'pointer',
50
+ }}>
42
51
  <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
43
52
  <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
44
- {t('admin.events')}
53
+ {t('admin.events.title')}
45
54
  </Typography>
46
55
  </Stack>
47
56
  </Stack>
48
57
  <Box
49
- mt={4}
50
- mb={3}
51
58
  sx={{
59
+ mt: 4,
60
+ mb: 3,
52
61
  display: 'flex',
62
+
53
63
  gap: {
54
64
  xs: 2,
55
65
  sm: 2,
56
66
  md: 5,
57
67
  },
68
+
58
69
  flexWrap: 'wrap',
70
+
59
71
  flexDirection: {
60
72
  xs: 'column',
61
73
  sm: 'column',
62
74
  md: 'row',
63
75
  },
76
+
64
77
  alignItems: {
65
78
  xs: 'flex-start',
66
79
  sm: 'flex-start',
67
80
  md: 'center',
68
81
  },
69
82
  }}>
70
- <Stack direction="row" justifyContent="space-between" alignItems="center">
71
- <Typography variant="h2" fontWeight={600}>
83
+ <Stack
84
+ direction="row"
85
+ sx={{
86
+ justifyContent: 'space-between',
87
+ alignItems: 'center',
88
+ }}>
89
+ <Typography
90
+ variant="h2"
91
+ sx={{
92
+ fontWeight: 600,
93
+ }}>
72
94
  {data.type}
73
95
  </Typography>
74
96
  </Stack>
75
97
  <Stack
76
98
  className="section-body"
77
- justifyContent="flex-start"
78
- flexWrap="wrap"
79
99
  sx={{
100
+ justifyContent: 'flex-start',
101
+ flexWrap: 'wrap',
102
+
80
103
  'hr.MuiDivider-root:last-child': {
81
104
  display: 'none',
82
105
  },
106
+
83
107
  flexDirection: {
84
108
  xs: 'column',
85
109
  sm: 'column',
86
110
  md: 'row',
87
111
  },
112
+
88
113
  alignItems: 'flex-start',
114
+
89
115
  gap: {
90
116
  xs: 1,
91
117
  sm: 1,
@@ -41,7 +41,7 @@ export default function DevelopersIndex() {
41
41
  const tabs = [
42
42
  { label: t('admin.overview'), value: 'overview' },
43
43
  { label: t('admin.webhooks'), value: 'webhooks' },
44
- { label: t('admin.events'), value: 'events' },
44
+ { label: t('admin.events.title'), value: 'events' },
45
45
  { label: t('admin.logs'), value: 'logs' },
46
46
  ];
47
47
 
@@ -33,12 +33,21 @@ export default function WebhookDetail(props: { id: string }) {
33
33
  return (
34
34
  <Root direction="column" spacing={4} sx={{ mb: 4 }}>
35
35
  <Box>
36
- <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
36
+ <Stack
37
+ className="page-header"
38
+ direction="row"
39
+ sx={{
40
+ justifyContent: 'space-between',
41
+ alignItems: 'center',
42
+ }}>
37
43
  <Stack
38
44
  direction="row"
39
- alignItems="center"
40
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}
41
- onClick={() => goBackOrFallback('/admin/developers/webhooks')}>
45
+ onClick={() => goBackOrFallback('/admin/developers/webhooks')}
46
+ sx={{
47
+ alignItems: 'center',
48
+ fontWeight: 'normal',
49
+ cursor: 'pointer',
50
+ }}>
42
51
  <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
43
52
  <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
44
53
  {t('admin.webhooks')}
@@ -46,11 +55,27 @@ export default function WebhookDetail(props: { id: string }) {
46
55
  </Stack>
47
56
  <Copyable text={props.id} style={{ marginLeft: 4 }} />
48
57
  </Stack>
49
- <Box mt={2}>
50
- <Stack direction="row" justifyContent="space-between" alignItems="center">
51
- <Stack direction="column" alignItems="flex-start">
58
+ <Box
59
+ sx={{
60
+ mt: 2,
61
+ }}>
62
+ <Stack
63
+ direction="row"
64
+ sx={{
65
+ justifyContent: 'space-between',
66
+ alignItems: 'center',
67
+ }}>
68
+ <Stack
69
+ direction="column"
70
+ sx={{
71
+ alignItems: 'flex-start',
72
+ }}>
52
73
  <Typography variant="h5">{data.url}</Typography>
53
- <Typography variant="body1" color="text.secondary">
74
+ <Typography
75
+ variant="body1"
76
+ sx={{
77
+ color: 'text.secondary',
78
+ }}>
54
79
  {data.description}
55
80
  </Typography>
56
81
  </Stack>
@@ -59,9 +84,14 @@ export default function WebhookDetail(props: { id: string }) {
59
84
  className="section-body"
60
85
  direction="row"
61
86
  spacing={3}
62
- justifyContent="flex-start"
63
- flexWrap="wrap"
64
- sx={{ pt: 2, mt: 2, borderTop: '1px solid', borderColor: 'grey.100' }}>
87
+ sx={{
88
+ justifyContent: 'flex-start',
89
+ flexWrap: 'wrap',
90
+ pt: 2,
91
+ mt: 2,
92
+ borderTop: '1px solid',
93
+ borderColor: 'grey.100',
94
+ }}>
65
95
  <InfoMetric
66
96
  label={t('common.status')}
67
97
  value={<Status label={data.status} color={getWebhookStatusColor(data.status)} />}
@@ -73,7 +73,16 @@ function Admin() {
73
73
  return (
74
74
  <>
75
75
  <ProgressBar pending={isPending} />
76
- <Stack direction="row" alignItems="center" justifyContent="end" flexWrap="wrap" spacing={1} sx={{ mt: 1, pb: 2 }}>
76
+ <Stack
77
+ direction="row"
78
+ spacing={1}
79
+ sx={{
80
+ alignItems: 'center',
81
+ justifyContent: 'end',
82
+ flexWrap: 'wrap',
83
+ mt: 1,
84
+ pb: 2,
85
+ }}>
77
86
  {/* <Box>{renderNav(group, onTabChange, group1)}</Box> */}
78
87
  {/* @ts-ignore */}
79
88
  <Tabs
@@ -101,7 +110,11 @@ function Admin() {
101
110
  },
102
111
  }}
103
112
  />
104
- <Stack direction="row" alignItems="center">
113
+ <Stack
114
+ direction="row"
115
+ sx={{
116
+ alignItems: 'center',
117
+ }}>
105
118
  {renderNav(group, onTabChange, group2)}
106
119
  <label
107
120
  htmlFor="livemode-switch"
@@ -209,10 +209,29 @@ export default function Overview() {
209
209
  };
210
210
 
211
211
  return (
212
- <Grid container gap={{ xs: 2, sm: 5, md: 8 }} sx={{ mb: 4 }}>
213
- <Grid item xs={12} sm={12} md={8}>
214
- <Stack direction="column" gap={{ xs: 1, sm: 3 }}>
215
- <Stack direction="row" alignItems="flex-end" justifyContent="space-between">
212
+ <Grid
213
+ container
214
+ sx={{
215
+ gap: { xs: 2, sm: 5, md: 8 },
216
+ mb: 4,
217
+ }}>
218
+ <Grid
219
+ size={{
220
+ xs: 12,
221
+ sm: 12,
222
+ md: 8,
223
+ }}>
224
+ <Stack
225
+ direction="column"
226
+ sx={{
227
+ gap: { xs: 1, sm: 3 },
228
+ }}>
229
+ <Stack
230
+ direction="row"
231
+ sx={{
232
+ alignItems: 'flex-end',
233
+ justifyContent: 'space-between',
234
+ }}>
216
235
  <Typography component="h3" variant="h4">
217
236
  {t('admin.trends')}
218
237
  </Typography>
@@ -221,19 +240,31 @@ export default function Overview() {
221
240
  {formatToDate(state.endDate, locale, 'YYYY-MM-DD')}
222
241
  </Button>
223
242
  </Stack>
224
- <Stack direction="column" gap={1}>
243
+ <Stack
244
+ direction="column"
245
+ sx={{
246
+ gap: 1,
247
+ }}>
225
248
  <Typography component="h4" variant="subtitle1">
226
249
  {t('admin.paymentIntent.list')}
227
250
  </Typography>
228
251
  <Chart loading={!trend.data} height={320} data={payments} currencies={currencies} />
229
252
  </Stack>
230
- <Stack direction="column" gap={1}>
253
+ <Stack
254
+ direction="column"
255
+ sx={{
256
+ gap: 1,
257
+ }}>
231
258
  <Typography component="h4" variant="subtitle1">
232
259
  {t('admin.payouts')}
233
260
  </Typography>
234
261
  <Chart loading={!trend.data} height={320} data={payouts} currencies={currencies} />
235
262
  </Stack>
236
- <Stack direction="column" gap={1}>
263
+ <Stack
264
+ direction="column"
265
+ sx={{
266
+ gap: 1,
267
+ }}>
237
268
  <Typography component="h4" variant="subtitle1">
238
269
  {t('admin.refunds')}
239
270
  </Typography>
@@ -241,11 +272,21 @@ export default function Overview() {
241
272
  </Stack>
242
273
  </Stack>
243
274
  </Grid>
244
- <Grid item xs={12} sm={12} md={3}>
275
+ <Grid
276
+ size={{
277
+ xs: 12,
278
+ sm: 12,
279
+ md: 3,
280
+ }}>
245
281
  <Stack direction="column" spacing={2}>
246
282
  {summary.data && summary.data.addresses && (
247
283
  <Box>
248
- <Stack direction="row" alignItems="flex-end" justifyContent="space-between">
284
+ <Stack
285
+ direction="row"
286
+ sx={{
287
+ alignItems: 'flex-end',
288
+ justifyContent: 'space-between',
289
+ }}>
249
290
  <Typography component="h3" variant="h4">
250
291
  {t('admin.addresses')}
251
292
  </Typography>
@@ -265,7 +306,12 @@ export default function Overview() {
265
306
  )}
266
307
  {summary.data && summary.data.balances && (
267
308
  <Box>
268
- <Stack direction="row" alignItems="flex-end" justifyContent="space-between">
309
+ <Stack
310
+ direction="row"
311
+ sx={{
312
+ alignItems: 'flex-end',
313
+ justifyContent: 'space-between',
314
+ }}>
269
315
  <Typography component="h3" variant="h4">
270
316
  {t('admin.balances')}
271
317
  </Typography>
@@ -291,20 +337,32 @@ export default function Overview() {
291
337
  },
292
338
  },
293
339
  }}>
294
- <Stack direction="row" alignItems="center" spacing={1}>
340
+ <Stack
341
+ direction="row"
342
+ spacing={1}
343
+ sx={{
344
+ alignItems: 'center',
345
+ }}>
295
346
  <Avatar
296
347
  src={currencies[currencyId]?.logo}
297
348
  alt={currencies[currencyId]?.symbol}
298
349
  sx={{ width: 36, height: 36 }}
299
350
  />
300
- <Box flex={1}>
351
+ <Box
352
+ sx={{
353
+ flex: 1,
354
+ }}>
301
355
  <Typography variant="body1" component="div" sx={{ fontSize: '1.75rem' }}>
302
356
  {formatBNStr(
303
357
  summary.data?.balances?.[currencyId] as string,
304
358
  currencies[currencyId]?.decimal as number
305
359
  )}
306
360
  </Typography>
307
- <Typography sx={{ fontSize: 14 }} color="text.secondary">
361
+ <Typography
362
+ sx={{
363
+ color: 'text.secondary',
364
+ fontSize: 14,
365
+ }}>
308
366
  {currencies[currencyId]?.symbol} on {currencies[currencyId]?.method.name}
309
367
  </Typography>
310
368
  </Box>
@@ -324,12 +382,23 @@ export default function Overview() {
324
382
  )}
325
383
  {metrics.length > 0 && (
326
384
  <Box>
327
- <Stack direction="row" alignItems="flex-end" justifyContent="space-between">
385
+ <Stack
386
+ direction="row"
387
+ sx={{
388
+ alignItems: 'flex-end',
389
+ justifyContent: 'space-between',
390
+ }}>
328
391
  <Typography component="h3" variant="h4">
329
392
  {t('admin.metrics')}
330
393
  </Typography>
331
394
  </Stack>
332
- <Stack direction="row" flexWrap="wrap" gap={1} sx={{ mt: 2 }}>
395
+ <Stack
396
+ direction="row"
397
+ sx={{
398
+ flexWrap: 'wrap',
399
+ gap: 1,
400
+ mt: 2,
401
+ }}>
333
402
  {metrics.map((metric) => (
334
403
  <Card
335
404
  component={Link}
@@ -341,7 +410,11 @@ export default function Overview() {
341
410
  <Typography component="div" sx={{ fontSize: '1.75rem' }}>
342
411
  {metric.count}
343
412
  </Typography>
344
- <Typography sx={{ fontSize: 14 }} color="text.secondary">
413
+ <Typography
414
+ sx={{
415
+ color: 'text.secondary',
416
+ fontSize: 14,
417
+ }}>
345
418
  {t(`admin.${metric.type}.name`)}
346
419
  </Typography>
347
420
  </Box>
@@ -352,12 +425,23 @@ export default function Overview() {
352
425
  )}
353
426
  {attentions.filter((x) => x.count > 0).length > 0 && (
354
427
  <Box>
355
- <Stack direction="row" alignItems="flex-end" justifyContent="space-between">
428
+ <Stack
429
+ direction="row"
430
+ sx={{
431
+ alignItems: 'flex-end',
432
+ justifyContent: 'space-between',
433
+ }}>
356
434
  <Typography component="h3" variant="h4" color="error">
357
435
  {t('admin.attention')}
358
436
  </Typography>
359
437
  </Stack>
360
- <Stack direction="row" flexWrap="wrap" gap={1} sx={{ mt: 2 }}>
438
+ <Stack
439
+ direction="row"
440
+ sx={{
441
+ flexWrap: 'wrap',
442
+ gap: 1,
443
+ mt: 2,
444
+ }}>
361
445
  {attentions.map((metric) => (
362
446
  <Card
363
447
  component={Link}
@@ -369,7 +453,11 @@ export default function Overview() {
369
453
  <Typography component="div" sx={{ fontSize: '1.75rem' }}>
370
454
  {metric.count}
371
455
  </Typography>
372
- <Typography sx={{ fontSize: 14 }} color="text.secondary">
456
+ <Typography
457
+ sx={{
458
+ color: 'text.secondary',
459
+ fontSize: 14,
460
+ }}>
373
461
  {t(`admin.${metric.type}.attention`)}
374
462
  </Typography>
375
463
  </Box>