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
@@ -96,12 +96,21 @@ export default function PaymentIntentDetail(props: { id: string }) {
96
96
  return (
97
97
  <Root direction="column" spacing={2.5} mb={4}>
98
98
  <Box>
99
- <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
99
+ <Stack
100
+ className="page-header"
101
+ direction="row"
102
+ sx={{
103
+ justifyContent: 'space-between',
104
+ alignItems: 'center',
105
+ }}>
100
106
  <Stack
101
107
  direction="row"
102
- alignItems="center"
103
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}
104
- onClick={() => goBackOrFallback('/admin/payments/intents')}>
108
+ onClick={() => goBackOrFallback('/admin/payments/intents')}
109
+ sx={{
110
+ alignItems: 'center',
111
+ fontWeight: 'normal',
112
+ cursor: 'pointer',
113
+ }}>
105
114
  <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
106
115
  <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
107
116
  {t('admin.payments')}
@@ -110,36 +119,55 @@ export default function PaymentIntentDetail(props: { id: string }) {
110
119
  <PaymentIntentActions data={data} variant="normal" onChange={runAsync} />
111
120
  </Stack>
112
121
  <Box
113
- mt={4}
114
- mb={3}
115
122
  sx={{
123
+ mt: 4,
124
+ mb: 3,
116
125
  display: 'flex',
126
+
117
127
  gap: {
118
128
  xs: 2,
119
129
  sm: 2,
120
130
  md: 5,
121
131
  },
132
+
122
133
  flexWrap: 'wrap',
134
+
123
135
  flexDirection: {
124
136
  xs: 'column',
125
137
  sm: 'column',
126
138
  md: 'row',
127
139
  },
140
+
128
141
  alignItems: {
129
142
  xs: 'flex-start',
130
143
  sm: 'flex-start',
131
144
  md: 'center',
132
145
  },
133
146
  }}>
134
- <Stack direction="row" justifyContent="space-between" alignItems="center">
135
- <Stack direction="row" alignItems="center" spacing={1}>
147
+ <Stack
148
+ direction="row"
149
+ sx={{
150
+ justifyContent: 'space-between',
151
+ alignItems: 'center',
152
+ }}>
153
+ <Stack
154
+ direction="row"
155
+ spacing={1}
156
+ sx={{
157
+ alignItems: 'center',
158
+ }}>
136
159
  <Avatar
137
160
  src={data.paymentCurrency.logo}
138
161
  alt={data.paymentCurrency.symbol}
139
162
  variant="square"
140
163
  sx={{ width: '52px', height: '52px', borderRadius: 0.5 }}
141
164
  />
142
- <Stack direction="column" alignItems="flex-start" justifyContent="space-around">
165
+ <Stack
166
+ direction="column"
167
+ sx={{
168
+ alignItems: 'flex-start',
169
+ justifyContent: 'space-around',
170
+ }}>
143
171
  <Amount
144
172
  amount={data?.amount_received === '0' ? total : received}
145
173
  sx={{ my: 0, fontSize: '1.75rem', lineHeight: '32px' }}
@@ -150,18 +178,22 @@ export default function PaymentIntentDetail(props: { id: string }) {
150
178
  </Stack>
151
179
  <Stack
152
180
  className="section-body"
153
- justifyContent="flex-start"
154
- flexWrap="wrap"
155
181
  sx={{
182
+ justifyContent: 'flex-start',
183
+ flexWrap: 'wrap',
184
+
156
185
  'hr.MuiDivider-root:last-child': {
157
186
  display: 'none',
158
187
  },
188
+
159
189
  flexDirection: {
160
190
  xs: 'column',
161
191
  sm: 'column',
162
192
  md: 'row',
163
193
  },
194
+
164
195
  alignItems: 'flex-start',
196
+
165
197
  gap: {
166
198
  xs: 1,
167
199
  sm: 1,
@@ -208,7 +240,14 @@ export default function PaymentIntentDetail(props: { id: string }) {
208
240
  },
209
241
  },
210
242
  }}>
211
- <Box flex={1} className="payment-link-column-1" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
243
+ <Box
244
+ className="payment-link-column-1"
245
+ sx={{
246
+ flex: 1,
247
+ gap: 2.5,
248
+ display: 'flex',
249
+ flexDirection: 'column',
250
+ }}>
212
251
  <Box className="section" sx={{ containerType: 'inline-size' }}>
213
252
  <SectionHeader title={t('admin.details')} />
214
253
  <InfoRowGroup
@@ -240,7 +279,12 @@ export default function PaymentIntentDetail(props: { id: string }) {
240
279
  <InfoRow
241
280
  label={t('common.status')}
242
281
  value={
243
- <Stack direction="row" alignItems="center" spacing={1}>
282
+ <Stack
283
+ direction="row"
284
+ spacing={1}
285
+ sx={{
286
+ alignItems: 'center',
287
+ }}>
244
288
  <Status label={data.status} color={getPaymentIntentStatusColor(data.status)} />
245
289
  {data.last_payment_error && (
246
290
  <Tooltip
@@ -286,7 +330,7 @@ export default function PaymentIntentDetail(props: { id: string }) {
286
330
  </Box>
287
331
  <Divider />
288
332
  <Box className="section">
289
- <SectionHeader title={t('admin.events')} />
333
+ <SectionHeader title={t('admin.events.title')} />
290
334
  <Box className="section-body">
291
335
  <EventList features={{ toolbar: false }} object_id={data.id} />
292
336
  </Box>
@@ -119,12 +119,21 @@ export default function PayoutDetail(props: { id: string }) {
119
119
  return (
120
120
  <Root direction="column" spacing={2.5} mb={4}>
121
121
  <Box>
122
- <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
122
+ <Stack
123
+ className="page-header"
124
+ direction="row"
125
+ sx={{
126
+ justifyContent: 'space-between',
127
+ alignItems: 'center',
128
+ }}>
123
129
  <Stack
124
130
  direction="row"
125
- alignItems="center"
126
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}
127
- onClick={() => goBackOrFallback('/admin/payments/payouts')}>
131
+ onClick={() => goBackOrFallback('/admin/payments/payouts')}
132
+ sx={{
133
+ alignItems: 'center',
134
+ fontWeight: 'normal',
135
+ cursor: 'pointer',
136
+ }}>
128
137
  <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
129
138
  <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
130
139
  {t('admin.payouts')}
@@ -132,37 +141,60 @@ export default function PayoutDetail(props: { id: string }) {
132
141
  </Stack>
133
142
  </Stack>
134
143
  <Box
135
- mt={4}
136
- mb={3}
137
144
  sx={{
145
+ mt: 4,
146
+ mb: 3,
138
147
  display: 'flex',
148
+
139
149
  gap: {
140
150
  xs: 2,
141
151
  sm: 2,
142
152
  md: 5,
143
153
  },
154
+
144
155
  flexWrap: 'wrap',
156
+
145
157
  flexDirection: {
146
158
  xs: 'column',
147
159
  sm: 'column',
148
160
  md: 'row',
149
161
  },
162
+
150
163
  alignItems: {
151
164
  xs: 'flex-start',
152
165
  sm: 'flex-start',
153
166
  md: 'center',
154
167
  },
155
168
  }}>
156
- <Stack direction="row" justifyContent="space-between" alignItems="center">
157
- <Stack direction="row" alignItems="center">
158
- <Stack direction="row" alignItems="center" spacing={1}>
169
+ <Stack
170
+ direction="row"
171
+ sx={{
172
+ justifyContent: 'space-between',
173
+ alignItems: 'center',
174
+ }}>
175
+ <Stack
176
+ direction="row"
177
+ sx={{
178
+ alignItems: 'center',
179
+ }}>
180
+ <Stack
181
+ direction="row"
182
+ spacing={1}
183
+ sx={{
184
+ alignItems: 'center',
185
+ }}>
159
186
  <Avatar
160
187
  src={data.paymentCurrency.logo}
161
188
  alt={data.paymentCurrency.symbol}
162
189
  variant="square"
163
190
  sx={{ width: '52px', height: '52px', borderRadius: 0.5 }}
164
191
  />
165
- <Stack direction="column" alignItems="flex-start" justifyContent="space-around">
192
+ <Stack
193
+ direction="column"
194
+ sx={{
195
+ alignItems: 'flex-start',
196
+ justifyContent: 'space-around',
197
+ }}>
166
198
  <Amount amount={total} sx={{ my: 0, fontSize: '1.75rem', lineHeight: '32px' }} />
167
199
  <Copyable text={props.id} />
168
200
  </Stack>
@@ -171,18 +203,22 @@ export default function PayoutDetail(props: { id: string }) {
171
203
  </Stack>
172
204
  <Stack
173
205
  className="section-body"
174
- justifyContent="flex-start"
175
- flexWrap="wrap"
176
206
  sx={{
207
+ justifyContent: 'flex-start',
208
+ flexWrap: 'wrap',
209
+
177
210
  'hr.MuiDivider-root:last-child': {
178
211
  display: 'none',
179
212
  },
213
+
180
214
  flexDirection: {
181
215
  xs: 'column',
182
216
  sm: 'column',
183
217
  md: 'row',
184
218
  },
219
+
185
220
  alignItems: 'flex-start',
221
+
186
222
  gap: {
187
223
  xs: 1,
188
224
  sm: 1,
@@ -278,7 +314,14 @@ export default function PayoutDetail(props: { id: string }) {
278
314
  },
279
315
  },
280
316
  }}>
281
- <Box flex={1} className="payment-link-column-1" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
317
+ <Box
318
+ className="payment-link-column-1"
319
+ sx={{
320
+ flex: 1,
321
+ gap: 2.5,
322
+ display: 'flex',
323
+ flexDirection: 'column',
324
+ }}>
282
325
  <Box className="section" sx={{ containerType: 'inline-size' }}>
283
326
  <SectionHeader title={t('admin.details')} />
284
327
  <InfoRowGroup
@@ -310,7 +353,12 @@ export default function PayoutDetail(props: { id: string }) {
310
353
  <InfoRow
311
354
  label={t('common.status')}
312
355
  value={
313
- <Stack direction="row" alignItems="center" spacing={1}>
356
+ <Stack
357
+ direction="row"
358
+ spacing={1}
359
+ sx={{
360
+ alignItems: 'center',
361
+ }}>
314
362
  <Status label={data.status} color={getPayoutStatusColor(data.status)} />
315
363
  {data.last_attempt_error && (
316
364
  <Tooltip
@@ -334,7 +382,7 @@ export default function PayoutDetail(props: { id: string }) {
334
382
  </Box>
335
383
  <Divider />
336
384
  <Box className="section">
337
- <SectionHeader title={t('admin.events')} />
385
+ <SectionHeader title={t('admin.events.title')} />
338
386
  <Box className="section-body">
339
387
  <EventList features={{ toolbar: false }} object_id={data.id} />
340
388
  </Box>
@@ -94,12 +94,21 @@ export default function RefundDetail(props: { id: string }) {
94
94
  return (
95
95
  <Root direction="column" spacing={2.5} mb={4}>
96
96
  <Box>
97
- <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
97
+ <Stack
98
+ className="page-header"
99
+ direction="row"
100
+ sx={{
101
+ justifyContent: 'space-between',
102
+ alignItems: 'center',
103
+ }}>
98
104
  <Stack
99
105
  direction="row"
100
- alignItems="center"
101
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}
102
- onClick={() => goBackOrFallback('/admin/payments/refunds')}>
106
+ onClick={() => goBackOrFallback('/admin/payments/refunds')}
107
+ sx={{
108
+ alignItems: 'center',
109
+ fontWeight: 'normal',
110
+ cursor: 'pointer',
111
+ }}>
103
112
  <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
104
113
  <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
105
114
  {t('admin.refunds')}
@@ -108,36 +117,55 @@ export default function RefundDetail(props: { id: string }) {
108
117
  <RefundActions data={data} variant="normal" onChange={() => runAsync()} />
109
118
  </Stack>
110
119
  <Box
111
- mt={4}
112
- mb={3}
113
120
  sx={{
121
+ mt: 4,
122
+ mb: 3,
114
123
  display: 'flex',
124
+
115
125
  gap: {
116
126
  xs: 2,
117
127
  sm: 2,
118
128
  md: 5,
119
129
  },
130
+
120
131
  flexWrap: 'wrap',
132
+
121
133
  flexDirection: {
122
134
  xs: 'column',
123
135
  sm: 'column',
124
136
  md: 'row',
125
137
  },
138
+
126
139
  alignItems: {
127
140
  xs: 'flex-start',
128
141
  sm: 'flex-start',
129
142
  md: 'center',
130
143
  },
131
144
  }}>
132
- <Stack direction="row" justifyContent="space-between" alignItems="center">
133
- <Stack direction="row" alignItems="center" spacing={1}>
145
+ <Stack
146
+ direction="row"
147
+ sx={{
148
+ justifyContent: 'space-between',
149
+ alignItems: 'center',
150
+ }}>
151
+ <Stack
152
+ direction="row"
153
+ spacing={1}
154
+ sx={{
155
+ alignItems: 'center',
156
+ }}>
134
157
  <Avatar
135
158
  src={data.paymentCurrency.logo}
136
159
  alt={data.paymentCurrency.symbol}
137
160
  variant="square"
138
161
  sx={{ width: '52px', height: '52px', borderRadius: 0.5 }}
139
162
  />
140
- <Stack direction="column" alignItems="flex-start" justifyContent="space-around">
163
+ <Stack
164
+ direction="column"
165
+ sx={{
166
+ alignItems: 'flex-start',
167
+ justifyContent: 'space-around',
168
+ }}>
141
169
  <Amount amount={amount} sx={{ my: 0, fontSize: '1.75rem', lineHeight: '32px' }} />
142
170
  <Copyable text={props.id} />
143
171
  </Stack>
@@ -145,18 +173,22 @@ export default function RefundDetail(props: { id: string }) {
145
173
  </Stack>
146
174
  <Stack
147
175
  className="section-body"
148
- justifyContent="flex-start"
149
- flexWrap="wrap"
150
176
  sx={{
177
+ justifyContent: 'flex-start',
178
+ flexWrap: 'wrap',
179
+
151
180
  'hr.MuiDivider-root:last-child': {
152
181
  display: 'none',
153
182
  },
183
+
154
184
  flexDirection: {
155
185
  xs: 'column',
156
186
  sm: 'column',
157
187
  md: 'row',
158
188
  },
189
+
159
190
  alignItems: 'flex-start',
191
+
160
192
  gap: {
161
193
  xs: 1,
162
194
  sm: 1,
@@ -203,7 +235,14 @@ export default function RefundDetail(props: { id: string }) {
203
235
  },
204
236
  },
205
237
  }}>
206
- <Box flex={1} className="payment-link-column-1" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
238
+ <Box
239
+ className="payment-link-column-1"
240
+ sx={{
241
+ flex: 1,
242
+ gap: 2.5,
243
+ display: 'flex',
244
+ flexDirection: 'column',
245
+ }}>
207
246
  <Box className="section" sx={{ containerType: 'inline-size' }}>
208
247
  <SectionHeader title={t('admin.details')} />
209
248
  <InfoRowGroup
@@ -235,7 +274,12 @@ export default function RefundDetail(props: { id: string }) {
235
274
  <InfoRow
236
275
  label={t('common.status')}
237
276
  value={
238
- <Stack direction="row" alignItems="center" spacing={1}>
277
+ <Stack
278
+ direction="row"
279
+ spacing={1}
280
+ sx={{
281
+ alignItems: 'center',
282
+ }}>
239
283
  <Status label={data.status} color={getRefundStatusColor(data.status)} />
240
284
  {data.last_attempt_error && data.status !== 'canceled' && (
241
285
  <Tooltip
@@ -268,7 +312,7 @@ export default function RefundDetail(props: { id: string }) {
268
312
  </Box>
269
313
  <Divider />
270
314
  <Box className="section">
271
- <SectionHeader title={t('admin.events')} />
315
+ <SectionHeader title={t('admin.events.title')} />
272
316
  <Box className="section-body">
273
317
  <EventList features={{ toolbar: false }} object_id={data.id} />
274
318
  </Box>
@@ -1,7 +1,7 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
2
  import Tabs from '@arcblock/ux/lib/Tabs';
3
3
  import { Box, Stack } from '@mui/material';
4
- import React, { isValidElement } from 'react';
4
+ import React, { isValidElement, useState } from 'react';
5
5
  import { useNavigate, useParams } from 'react-router-dom';
6
6
 
7
7
  import { useTransitionContext } from '../../../components/progress-bar';
@@ -26,6 +26,7 @@ export default function Products() {
26
26
  const navigate = useNavigate();
27
27
  const { t } = useLocaleContext();
28
28
  const { page = 'products' } = useParams();
29
+ const [createProduct, setCreateProduct] = useState(false);
29
30
  const { startTransition } = useTransitionContext();
30
31
 
31
32
  if (page.startsWith('prod_')) {
@@ -56,7 +57,7 @@ export default function Products() {
56
57
 
57
58
  let extra = null;
58
59
  if (page === 'products') {
59
- extra = <ProductCreate />;
60
+ extra = <ProductCreate open={createProduct} onClose={() => setCreateProduct(false)} />;
60
61
  } else if (page === 'links') {
61
62
  extra = <PaymentLinkCreate />;
62
63
  } else if (page === 'pricing-tables') {
@@ -65,7 +66,14 @@ export default function Products() {
65
66
 
66
67
  return (
67
68
  <>
68
- <Stack direction="row" alignItems="flex-start" justifyContent="end" flexWrap="wrap" spacing={1}>
69
+ <Stack
70
+ direction="row"
71
+ spacing={1}
72
+ sx={{
73
+ alignItems: 'flex-start',
74
+ justifyContent: 'end',
75
+ flexWrap: 'wrap',
76
+ }}>
69
77
  {/* @ts-ignore */}
70
78
  <Tabs
71
79
  // @ts-ignore
@@ -99,7 +107,6 @@ export default function Products() {
99
107
  />
100
108
  <Box> {extra}</Box>
101
109
  </Stack>
102
-
103
110
  {isValidElement(TabComponent) ? TabComponent : <TabComponent />}
104
111
  </>
105
112
  );
@@ -150,8 +150,18 @@ export default function CreatePaymentLink() {
150
150
  </Button>
151
151
  }>
152
152
  <FormProvider {...methods}>
153
- <Stack spacing={3} direction="row" alignItems="flex-start">
154
- <Stack spacing={2} flex={2} alignItems="flex-start">
153
+ <Stack
154
+ spacing={3}
155
+ direction="row"
156
+ sx={{
157
+ alignItems: 'flex-start',
158
+ }}>
159
+ <Stack
160
+ spacing={2}
161
+ sx={{
162
+ flex: 2,
163
+ alignItems: 'flex-start',
164
+ }}>
155
165
  <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>
156
166
  {t('common.setup')}
157
167
  </Typography>
@@ -172,12 +182,20 @@ export default function CreatePaymentLink() {
172
182
  <TabComponent triggerError={triggerError} />
173
183
  </ProductsProvider>
174
184
  </Stack>
175
- <Stack flex={1} sx={{ maxWidth: 680 }}>
185
+ <Stack
186
+ sx={{
187
+ flex: 1,
188
+ maxWidth: 680,
189
+ }}>
176
190
  <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>
177
191
  {t('common.preview')}
178
192
  </Typography>
179
193
  {stashed && <PaymentLinkPreview id={`plink_${session?.user?.did}`} version={stashed} ref={fullScreenRef} />}
180
- <Box textAlign="center" mt={2.5}>
194
+ <Box
195
+ sx={{
196
+ textAlign: 'center',
197
+ mt: 2.5,
198
+ }}>
181
199
  <Button
182
200
  variant="outlined"
183
201
  color="primary"
@@ -104,13 +104,22 @@ export default function PaymentLinkDetail(props: { id: string }) {
104
104
 
105
105
  return (
106
106
  <Grid container spacing={4} sx={{ mb: 4 }}>
107
- <Grid item xs={12}>
108
- <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
107
+ <Grid size={12}>
108
+ <Stack
109
+ className="page-header"
110
+ direction="row"
111
+ sx={{
112
+ justifyContent: 'space-between',
113
+ alignItems: 'center',
114
+ }}>
109
115
  <Stack
110
116
  direction="row"
111
- alignItems="center"
112
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}
113
- onClick={() => goBackOrFallback('/admin/products/links')}>
117
+ onClick={() => goBackOrFallback('/admin/products/links')}
118
+ sx={{
119
+ alignItems: 'center',
120
+ fontWeight: 'normal',
121
+ cursor: 'pointer',
122
+ }}>
114
123
  <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
115
124
  <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
116
125
  {t('admin.paymentLinks')}
@@ -119,29 +128,41 @@ export default function PaymentLinkDetail(props: { id: string }) {
119
128
  <PaymentLinkActions data={data} onChange={onChange} variant="normal" />
120
129
  </Stack>
121
130
  <Box
122
- mt={4}
123
- mb={3}
124
131
  sx={{
132
+ mt: 4,
133
+ mb: 3,
125
134
  display: 'flex',
135
+
126
136
  gap: {
127
137
  xs: 2,
128
138
  sm: 2,
129
139
  md: 5,
130
140
  },
141
+
131
142
  flexWrap: 'wrap',
143
+
132
144
  flexDirection: {
133
145
  xs: 'column',
134
146
  sm: 'column',
135
147
  md: 'row',
136
148
  },
149
+
137
150
  alignItems: {
138
151
  xs: 'flex-start',
139
152
  sm: 'flex-start',
140
153
  md: 'center',
141
154
  },
142
155
  }}>
143
- <Stack direction="row" justifyContent="space-between" alignItems="center">
144
- <Stack gap={1}>
156
+ <Stack
157
+ direction="row"
158
+ sx={{
159
+ justifyContent: 'space-between',
160
+ alignItems: 'center',
161
+ }}>
162
+ <Stack
163
+ sx={{
164
+ gap: 1,
165
+ }}>
145
166
  <Typography variant="h1">{data.name}</Typography>
146
167
  <Copyable text={joinURL(window.blocklet.appUrl, window.blocklet.prefix, `/checkout/pay/${data.id}`)}>
147
168
  <Typography
@@ -160,18 +181,22 @@ export default function PaymentLinkDetail(props: { id: string }) {
160
181
  </Stack>
161
182
  <Stack
162
183
  className="section-body"
163
- justifyContent="flex-start"
164
- flexWrap="wrap"
165
184
  sx={{
185
+ justifyContent: 'flex-start',
186
+ flexWrap: 'wrap',
187
+
166
188
  'hr.MuiDivider-root:last-child': {
167
189
  display: 'none',
168
190
  },
191
+
169
192
  flexDirection: {
170
193
  xs: 'column',
171
194
  sm: 'column',
172
195
  md: 'row',
173
196
  },
197
+
174
198
  alignItems: 'flex-start',
199
+
175
200
  gap: {
176
201
  xs: 1,
177
202
  sm: 1,
@@ -184,7 +209,7 @@ export default function PaymentLinkDetail(props: { id: string }) {
184
209
  </Box>
185
210
  <Divider />
186
211
  </Grid>
187
- <Grid item xs={12}>
212
+ <Grid size={12}>
188
213
  <Stack
189
214
  sx={{
190
215
  flexDirection: {
@@ -210,7 +235,11 @@ export default function PaymentLinkDetail(props: { id: string }) {
210
235
  },
211
236
  },
212
237
  }}>
213
- <Box flex={1} className="payment-link-column-1">
238
+ <Box
239
+ className="payment-link-column-1"
240
+ sx={{
241
+ flex: 1,
242
+ }}>
214
243
  <Div direction="column" spacing={3}>
215
244
  <Box className="section">
216
245
  <SectionHeader title={t('admin.products')} />
@@ -348,7 +377,7 @@ export default function PaymentLinkDetail(props: { id: string }) {
348
377
  </Box>
349
378
  <Divider />
350
379
  <Box className="section">
351
- <SectionHeader title={t('admin.events')} />
380
+ <SectionHeader title={t('admin.events.title')} />
352
381
  <Box className="section-body">
353
382
  <EventList features={{ toolbar: false }} object_id={data.id} />
354
383
  </Box>