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
@@ -31,7 +31,14 @@ export default function PassportList() {
31
31
  }
32
32
 
33
33
  if (data && data.length === 0) {
34
- return <Typography color="text.secondary">{t('admin.event.empty')}</Typography>;
34
+ return (
35
+ <Typography
36
+ sx={{
37
+ color: 'text.secondary',
38
+ }}>
39
+ {t('admin.event.empty')}
40
+ </Typography>
41
+ );
35
42
  }
36
43
 
37
44
  const columns = [
@@ -61,7 +68,11 @@ export default function PassportList() {
61
68
  }
62
69
 
63
70
  return (
64
- <Typography component="span" color="text.secondary">
71
+ <Typography
72
+ component="span"
73
+ sx={{
74
+ color: 'text.secondary',
75
+ }}>
65
76
  {t('common.none')}
66
77
  </Typography>
67
78
  );
@@ -82,7 +93,11 @@ export default function PassportList() {
82
93
  }
83
94
 
84
95
  return (
85
- <Typography component="span" color="text.secondary">
96
+ <Typography
97
+ component="span"
98
+ sx={{
99
+ color: 'text.secondary',
100
+ }}>
86
101
  {t('common.none')}
87
102
  </Typography>
88
103
  );
@@ -114,7 +129,11 @@ export default function PassportList() {
114
129
  }
115
130
 
116
131
  return (
117
- <Typography component="span" color="text.secondary">
132
+ <Typography
133
+ component="span"
134
+ sx={{
135
+ color: 'text.secondary',
136
+ }}>
118
137
  {t('common.none')}
119
138
  </Typography>
120
139
  );
@@ -1,7 +1,7 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
2
  import Toast from '@arcblock/ux/lib/Toast';
3
3
  import { ConfirmDialog, api, formatError } from '@blocklet/payment-react';
4
- import type { TPrice } from '@blocklet/payment-types';
4
+ import type { TPrice, TProduct } from '@blocklet/payment-types';
5
5
  import { useSetState } from 'ahooks';
6
6
  import noop from 'lodash/noop';
7
7
  import { useNavigate } from 'react-router-dom';
@@ -14,14 +14,16 @@ type Props = {
14
14
  onChange: Function;
15
15
  variant?: string;
16
16
  setAsDefault?: boolean;
17
+ product?: TProduct | null;
17
18
  };
18
19
 
19
- PriceActions.defaultProps = {
20
- variant: 'compact',
21
- setAsDefault: false,
22
- };
23
-
24
- export default function PriceActions({ data, onChange, variant, setAsDefault }: Props) {
20
+ export default function PriceActions({
21
+ data,
22
+ onChange,
23
+ variant = 'compact',
24
+ setAsDefault = false,
25
+ product = null,
26
+ }: Props) {
25
27
  const { t } = useLocaleContext();
26
28
  const navigate = useNavigate();
27
29
 
@@ -150,8 +152,13 @@ export default function PriceActions({ data, onChange, variant, setAsDefault }:
150
152
  <>
151
153
  <Actions variant={variant} actions={actions} />
152
154
  {state.action === 'edit' && (
153
- // @ts-ignore
154
- <EditPrice price={data} onSave={onEditPrice} onCancel={() => setState({ action: '' })} />
155
+ <EditPrice
156
+ // @ts-ignore
157
+ price={data}
158
+ onSave={onEditPrice}
159
+ onCancel={() => setState({ action: '' })}
160
+ productType={product?.type}
161
+ />
155
162
  )}
156
163
  {state.action === 'archive' && (
157
164
  <ConfirmDialog
@@ -1,12 +1,21 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
2
  import Toast from '@arcblock/ux/lib/Toast';
3
- import { api, formatError, formatPrice, formatRecurring, formatTime, Table, useMobile } from '@blocklet/payment-react';
3
+ import {
4
+ api,
5
+ formatError,
6
+ formatPrice,
7
+ formatRecurring,
8
+ formatTime,
9
+ Table,
10
+ useMobile,
11
+ isCreditMetered,
12
+ } from '@blocklet/payment-react';
4
13
  import type { PriceRecurring, TPrice, TPriceExpanded } from '@blocklet/payment-types';
5
14
  import { ArrowBackOutlined } from '@mui/icons-material';
6
15
  import { Alert, AlertTitle, Box, Button, CircularProgress, Divider, Stack, Typography } from '@mui/material';
7
16
  import { styled } from '@mui/system';
8
17
  import { useRequest, useSetState } from 'ahooks';
9
- import { useNavigate } from 'react-router-dom';
18
+ import { Link, useNavigate } from 'react-router-dom';
10
19
 
11
20
  import Copyable from '../../../../components/copyable';
12
21
  import Currency from '../../../../components/currency';
@@ -107,12 +116,21 @@ export default function PriceDetail(props: { id: string }) {
107
116
  {t('admin.price.locked')}
108
117
  </Alert>
109
118
  )}
110
- <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
119
+ <Stack
120
+ className="page-header"
121
+ direction="row"
122
+ sx={{
123
+ justifyContent: 'space-between',
124
+ alignItems: 'center',
125
+ }}>
111
126
  <Stack
112
127
  direction="row"
113
- alignItems="center"
114
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}
115
- onClick={() => goBackOrFallback(`/admin/products/${data.product_id}`)}>
128
+ onClick={() => goBackOrFallback(`/admin/products/${data.product_id}`)}
129
+ sx={{
130
+ alignItems: 'center',
131
+ fontWeight: 'normal',
132
+ cursor: 'pointer',
133
+ }}>
116
134
  <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
117
135
  <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
118
136
  {t('admin.products')}
@@ -121,47 +139,63 @@ export default function PriceDetail(props: { id: string }) {
121
139
  <PriceActions data={data} onChange={onChange} variant="normal" />
122
140
  </Stack>
123
141
  <Box
124
- mt={4}
125
- mb={3}
126
142
  sx={{
143
+ mt: 4,
144
+ mb: 3,
127
145
  display: 'flex',
146
+
128
147
  gap: {
129
148
  xs: 2,
130
149
  sm: 2,
131
150
  md: 5,
132
151
  },
152
+
133
153
  flexWrap: 'wrap',
154
+
134
155
  flexDirection: {
135
156
  xs: 'column',
136
157
  sm: 'column',
137
158
  md: 'row',
138
159
  },
160
+
139
161
  alignItems: {
140
162
  xs: 'flex-start',
141
163
  sm: 'flex-start',
142
164
  md: 'center',
143
165
  },
144
166
  }}>
145
- <Stack direction="column" gap={1}>
146
- <Typography variant="h2" fontWeight={600}>
167
+ <Stack
168
+ direction="column"
169
+ sx={{
170
+ gap: 1,
171
+ }}>
172
+ <Typography
173
+ variant="h2"
174
+ sx={{
175
+ fontWeight: 600,
176
+ }}>
147
177
  Price for {data.product.name}
148
178
  </Typography>
149
179
  <Copyable text={props.id} style={{ marginLeft: 4 }} />
150
180
  </Stack>
151
181
  <Stack
152
182
  className="section-body"
153
- justifyContent="flex-start"
154
- flexWrap="wrap"
155
183
  sx={{
184
+ justifyContent: 'flex-start',
185
+ flexWrap: 'wrap',
186
+
156
187
  'hr.MuiDivider-root:last-child': {
157
188
  display: 'none',
158
189
  },
190
+
159
191
  flexDirection: {
160
192
  xs: 'column',
161
193
  sm: 'column',
162
194
  md: 'row',
163
195
  },
196
+
164
197
  alignItems: 'flex-start',
198
+
165
199
  gap: {
166
200
  xs: 1,
167
201
  sm: 1,
@@ -207,7 +241,14 @@ export default function PriceDetail(props: { id: string }) {
207
241
  },
208
242
  },
209
243
  }}>
210
- <Box flex={1} className="payment-link-column-1" sx={{ gap: 2.5, display: 'flex', flexDirection: 'column' }}>
244
+ <Box
245
+ className="payment-link-column-1"
246
+ sx={{
247
+ flex: 1,
248
+ gap: 2.5,
249
+ display: 'flex',
250
+ flexDirection: 'column',
251
+ }}>
211
252
  <Box className="section" sx={{ containerType: 'inline-size' }}>
212
253
  <SectionHeader title={t('admin.details')}>
213
254
  <Button
@@ -267,6 +308,24 @@ export default function PriceDetail(props: { id: string }) {
267
308
  </Box>
268
309
 
269
310
  <Divider />
311
+ {isCreditMetered(data) && (
312
+ <>
313
+ <Box className="section">
314
+ <SectionHeader title={t('admin.meters')} />
315
+ <Box className="section-body">
316
+ <InfoRow
317
+ label={t('admin.meter.eventName.label')}
318
+ value={
319
+ <Link to={`/admin/billing/${data.meter?.id}`} target="_blank">
320
+ {data.meter?.event_name}
321
+ </Link>
322
+ }
323
+ />
324
+ </Box>
325
+ </Box>
326
+ <Divider />
327
+ </>
328
+ )}
270
329
  <Box className="section">
271
330
  <SectionHeader title={t('admin.price.currency.list')} />
272
331
  <Box className="section-body">
@@ -325,7 +384,7 @@ export default function PriceDetail(props: { id: string }) {
325
384
  </Box>
326
385
  <Divider />
327
386
  <Box className="section">
328
- <SectionHeader title={t('admin.events')} />
387
+ <SectionHeader title={t('admin.events.title')} />
329
388
  <Box className="section-body">
330
389
  <EventList features={{ toolbar: false }} object_id={data.id} />
331
390
  </Box>
@@ -36,10 +36,15 @@ export default function PricesList({ product, onChange }: { product: Product; on
36
36
  const priceCurrency = showHighlight
37
37
  ? findCurrency(settings.paymentMethods, query.currency_id || '')
38
38
  : price.currency;
39
- const highlightColor = theme.mode === 'dark' ? '#2e3035' : '#FFF9C4';
39
+ const highlightColor = theme.palette.mode === 'dark' ? '#2e3035' : '#FFF9C4';
40
40
  return (
41
41
  <Link to={`/admin/products/${price.id}`} color="text.primary">
42
- <Stack direction="row" alignItems="center" spacing={1}>
42
+ <Stack
43
+ direction="row"
44
+ spacing={1}
45
+ sx={{
46
+ alignItems: 'center',
47
+ }}>
43
48
  {price.locked && (
44
49
  <Tooltip title={t('admin.price.locked')}>
45
50
  <LockOutlined sx={{ color: 'text.secondary' }} />
@@ -123,7 +128,14 @@ export default function PricesList({ product, onChange }: { product: Product; on
123
128
  sort: false,
124
129
  customBodyRenderLite: (_: any, index: number) => {
125
130
  const price = product.prices[index] as any;
126
- return <PriceActions data={price} onChange={onChange} setAsDefault={price.id === product.default_price_id} />;
131
+ return (
132
+ <PriceActions
133
+ data={price}
134
+ onChange={onChange}
135
+ setAsDefault={price.id === product.default_price_id}
136
+ product={product as any}
137
+ />
138
+ );
127
139
  },
128
140
  },
129
141
  },
@@ -121,23 +121,48 @@ export default function CreatePricingTable() {
121
121
  }>
122
122
  <FormProvider {...methods}>
123
123
  <ProductsProvider>
124
- <Stack height="92vh" spacing={2} direction="row">
125
- <Box flex={2} sx={{ borderRight: '1px solid', borderColor: 'grey.100' }} position="relative">
126
- <Stack height="100%" spacing={2}>
127
- <Box overflow="auto" sx={{ pr: 2, pb: 8 }}>
124
+ <Stack
125
+ spacing={2}
126
+ direction="row"
127
+ sx={{
128
+ height: '92vh',
129
+ }}>
130
+ <Box
131
+ sx={{
132
+ flex: 2,
133
+ position: 'relative',
134
+ borderRight: '1px solid',
135
+ borderColor: 'grey.100',
136
+ }}>
137
+ <Stack
138
+ spacing={2}
139
+ sx={{
140
+ height: '100%',
141
+ }}>
142
+ <Box
143
+ sx={{
144
+ overflow: 'auto',
145
+ pr: 2,
146
+ pb: 8,
147
+ }}>
128
148
  {step === 0 && <PricingTableProductSettings triggerError={triggerError} />}
129
149
  {step === 1 && <PricingTablePaymentSettings />}
130
150
  {/* {step === 2 && <PricingTableCustomerSettings />} */}
131
151
  </Box>
132
152
  <Stack
133
- padding={2}
134
153
  spacing={2}
135
- width="100%"
136
154
  direction="row"
137
- alignItems="center"
138
- justifyContent="flex-end"
139
- position="absolute"
140
- sx={{ borderTop: '1px solid', borderColor: 'grey.100', left: 0, bottom: 0 }}>
155
+ sx={{
156
+ padding: 2,
157
+ width: '100%',
158
+ alignItems: 'center',
159
+ justifyContent: 'flex-end',
160
+ position: 'absolute',
161
+ borderTop: '1px solid',
162
+ borderColor: 'grey.100',
163
+ left: 0,
164
+ bottom: 0,
165
+ }}>
141
166
  <Button variant="text" color="inherit" disabled={step === 0} onClick={onPrevious}>
142
167
  {t('common.previous')}
143
168
  </Button>
@@ -147,14 +172,22 @@ export default function CreatePricingTable() {
147
172
  </Stack>
148
173
  </Stack>
149
174
  </Box>
150
- <Box flex={1} sx={{ maxWidth: 680 }}>
175
+ <Box
176
+ sx={{
177
+ flex: 1,
178
+ maxWidth: 680,
179
+ }}>
151
180
  <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>
152
181
  {t('common.preview')}
153
182
  </Typography>
154
183
  {stashed && (
155
184
  <PricingTablePreview id={`prctbl_${session?.user?.did}`} version={stashed} ref={fullScreenRef} />
156
185
  )}
157
- <Box textAlign="center" mt={2.5}>
186
+ <Box
187
+ sx={{
188
+ textAlign: 'center',
189
+ mt: 2.5,
190
+ }}>
158
191
  <Button
159
192
  variant="outlined"
160
193
  color="primary"
@@ -85,13 +85,22 @@ export default function PricingTableDetail(props: { id: string }) {
85
85
 
86
86
  return (
87
87
  <Grid container spacing={4} sx={{ mb: 4 }}>
88
- <Grid item xs={12}>
89
- <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
88
+ <Grid size={12}>
89
+ <Stack
90
+ className="page-header"
91
+ direction="row"
92
+ sx={{
93
+ justifyContent: 'space-between',
94
+ alignItems: 'center',
95
+ }}>
90
96
  <Stack
91
97
  direction="row"
92
- alignItems="center"
93
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}
94
- onClick={() => goBackOrFallback('/admin/products/pricing-tables')}>
98
+ onClick={() => goBackOrFallback('/admin/products/pricing-tables')}
99
+ sx={{
100
+ alignItems: 'center',
101
+ fontWeight: 'normal',
102
+ cursor: 'pointer',
103
+ }}>
95
104
  <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
96
105
  <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
97
106
  {t('admin.pricingTables')}
@@ -100,29 +109,43 @@ export default function PricingTableDetail(props: { id: string }) {
100
109
  <PricingTableActions data={data} onChange={onChange} variant="normal" />
101
110
  </Stack>
102
111
  <Box
103
- mt={4}
104
- mb={3}
105
112
  sx={{
113
+ mt: 4,
114
+ mb: 3,
106
115
  display: 'flex',
116
+
107
117
  gap: {
108
118
  xs: 2,
109
119
  sm: 2,
110
120
  md: 5,
111
121
  },
122
+
112
123
  flexWrap: 'wrap',
124
+
113
125
  flexDirection: {
114
126
  xs: 'column',
115
127
  sm: 'column',
116
128
  md: 'row',
117
129
  },
130
+
118
131
  alignItems: {
119
132
  xs: 'flex-start',
120
133
  sm: 'flex-start',
121
134
  md: 'center',
122
135
  },
123
136
  }}>
124
- <Stack direction="row" justifyContent="space-between" alignItems="center" gap={5}>
125
- <Stack direction="column" alignItems="flex-start">
137
+ <Stack
138
+ direction="row"
139
+ sx={{
140
+ justifyContent: 'space-between',
141
+ alignItems: 'center',
142
+ gap: 5,
143
+ }}>
144
+ <Stack
145
+ direction="column"
146
+ sx={{
147
+ alignItems: 'flex-start',
148
+ }}>
126
149
  <Typography variant="h1">{data.name}</Typography>
127
150
  <Copyable
128
151
  text={joinURL(window.blocklet.appUrl, window.blocklet.prefix, `/checkout/pricing-table/${data.id}`)}>
@@ -146,18 +169,22 @@ export default function PricingTableDetail(props: { id: string }) {
146
169
  </Stack>
147
170
  <Stack
148
171
  className="section-body"
149
- justifyContent="flex-start"
150
- flexWrap="wrap"
151
172
  sx={{
173
+ justifyContent: 'flex-start',
174
+ flexWrap: 'wrap',
175
+
152
176
  'hr.MuiDivider-root:last-child': {
153
177
  display: 'none',
154
178
  },
179
+
155
180
  flexDirection: {
156
181
  xs: 'column',
157
182
  sm: 'column',
158
183
  md: 'row',
159
184
  },
185
+
160
186
  alignItems: 'flex-start',
187
+
161
188
  gap: {
162
189
  xs: 1,
163
190
  sm: 1,
@@ -169,7 +196,7 @@ export default function PricingTableDetail(props: { id: string }) {
169
196
  </Box>
170
197
  <Divider />
171
198
  </Grid>
172
- <Grid item xs={12}>
199
+ <Grid size={12}>
173
200
  <Stack
174
201
  sx={{
175
202
  flexDirection: {
@@ -195,7 +222,11 @@ export default function PricingTableDetail(props: { id: string }) {
195
222
  },
196
223
  },
197
224
  }}>
198
- <Box flex={1} className="payment-link-column-1">
225
+ <Box
226
+ className="payment-link-column-1"
227
+ sx={{
228
+ flex: 1,
229
+ }}>
199
230
  <Div direction="column" spacing={3}>
200
231
  <Box className="section">
201
232
  <SectionHeader title={t('admin.products')} />
@@ -289,7 +320,7 @@ export default function PricingTableDetail(props: { id: string }) {
289
320
  </Box>
290
321
  <Divider />
291
322
  <Box className="section">
292
- <SectionHeader title={t('admin.events')} />
323
+ <SectionHeader title={t('admin.events.title')} />
293
324
  <Box className="section-body">
294
325
  <EventList features={{ toolbar: false }} object_id={data.id} />
295
326
  </Box>