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.
- package/.eslintrc.js +6 -0
- package/api/src/crons/index.ts +8 -0
- package/api/src/index.ts +4 -0
- package/api/src/libs/credit-grant.ts +146 -0
- package/api/src/libs/env.ts +1 -0
- package/api/src/libs/invoice.ts +4 -3
- package/api/src/libs/notification/template/base.ts +388 -2
- package/api/src/libs/notification/template/customer-credit-grant-granted.ts +149 -0
- package/api/src/libs/notification/template/customer-credit-grant-low-balance.ts +151 -0
- package/api/src/libs/notification/template/customer-credit-insufficient.ts +254 -0
- package/api/src/libs/notification/template/subscription-canceled.ts +193 -202
- package/api/src/libs/notification/template/subscription-refund-succeeded.ts +215 -237
- package/api/src/libs/notification/template/subscription-renewed.ts +130 -200
- package/api/src/libs/notification/template/subscription-succeeded.ts +100 -202
- package/api/src/libs/notification/template/subscription-trial-start.ts +142 -188
- package/api/src/libs/notification/template/subscription-trial-will-end.ts +146 -174
- package/api/src/libs/notification/template/subscription-upgraded.ts +96 -192
- package/api/src/libs/notification/template/subscription-will-canceled.ts +94 -135
- package/api/src/libs/notification/template/subscription-will-renew.ts +220 -245
- package/api/src/libs/payment.ts +69 -0
- package/api/src/libs/queue/index.ts +3 -2
- package/api/src/libs/session.ts +8 -0
- package/api/src/libs/subscription.ts +74 -3
- package/api/src/libs/ws.ts +23 -1
- package/api/src/locales/en.ts +33 -0
- package/api/src/locales/zh.ts +31 -0
- package/api/src/queues/credit-consume.ts +715 -0
- package/api/src/queues/credit-grant.ts +572 -0
- package/api/src/queues/notification.ts +173 -128
- package/api/src/queues/payment.ts +210 -122
- package/api/src/queues/subscription.ts +179 -0
- package/api/src/routes/checkout-sessions.ts +157 -9
- package/api/src/routes/connect/shared.ts +3 -2
- package/api/src/routes/credit-grants.ts +241 -0
- package/api/src/routes/credit-transactions.ts +208 -0
- package/api/src/routes/index.ts +8 -0
- package/api/src/routes/meter-events.ts +347 -0
- package/api/src/routes/meters.ts +219 -0
- package/api/src/routes/payment-currencies.ts +14 -2
- package/api/src/routes/payment-links.ts +1 -1
- package/api/src/routes/payment-methods.ts +14 -2
- package/api/src/routes/prices.ts +43 -0
- package/api/src/routes/pricing-table.ts +13 -7
- package/api/src/routes/products.ts +63 -4
- package/api/src/routes/settings.ts +1 -1
- package/api/src/routes/subscriptions.ts +4 -0
- package/api/src/store/migrations/20250610-billing-credit.ts +43 -0
- package/api/src/store/models/credit-grant.ts +486 -0
- package/api/src/store/models/credit-transaction.ts +268 -0
- package/api/src/store/models/customer.ts +8 -0
- package/api/src/store/models/index.ts +52 -1
- package/api/src/store/models/meter-event.ts +423 -0
- package/api/src/store/models/meter.ts +176 -0
- package/api/src/store/models/payment-currency.ts +66 -14
- package/api/src/store/models/price.ts +6 -0
- package/api/src/store/models/product.ts +2 -2
- package/api/src/store/models/subscription.ts +24 -0
- package/api/src/store/models/types.ts +28 -2
- package/api/tests/libs/subscription.spec.ts +53 -0
- package/blocklet.yml +9 -1
- package/package.json +57 -58
- package/scripts/sdk.js +233 -1
- package/src/app.tsx +10 -0
- package/src/components/actions.tsx +22 -9
- package/src/components/balance-list.tsx +40 -12
- package/src/components/collapse.tsx +33 -15
- package/src/components/copyable.tsx +8 -7
- package/src/components/currency.tsx +15 -7
- package/src/components/customer/actions.tsx +1 -5
- package/src/components/customer/credit-grant-item-list.tsx +99 -0
- package/src/components/customer/credit-overview.tsx +233 -0
- package/src/components/customer/form.tsx +7 -2
- package/src/components/customer/link.tsx +4 -12
- package/src/components/customer/notification-preference.tsx +18 -9
- package/src/components/customer/overdraft-protection.tsx +112 -41
- package/src/components/drawer-form.tsx +42 -18
- package/src/components/error.tsx +1 -5
- package/src/components/event/list.tsx +9 -10
- package/src/components/filter-toolbar.tsx +20 -19
- package/src/components/info-card.tsx +32 -18
- package/src/components/info-metric.tsx +16 -6
- package/src/components/info-row-group.tsx +1 -7
- package/src/components/info-row.tsx +30 -24
- package/src/components/invoice/action.tsx +1 -7
- package/src/components/invoice/list.tsx +34 -26
- package/src/components/invoice/recharge.tsx +5 -7
- package/src/components/invoice/table.tsx +17 -12
- package/src/components/layout/user.tsx +1 -1
- package/src/components/metadata/form.tsx +290 -94
- package/src/components/metadata/list.tsx +11 -3
- package/src/components/meter/actions.tsx +101 -0
- package/src/components/meter/add-usage-dialog.tsx +239 -0
- package/src/components/meter/events-list.tsx +657 -0
- package/src/components/meter/form.tsx +245 -0
- package/src/components/meter/products.tsx +264 -0
- package/src/components/meter/usage-guide.tsx +174 -0
- package/src/components/passport/actions.tsx +9 -4
- package/src/components/payment-currency/add.tsx +16 -3
- package/src/components/payment-currency/form.tsx +14 -6
- package/src/components/payment-intent/actions.tsx +24 -16
- package/src/components/payment-intent/list.tsx +30 -9
- package/src/components/payment-link/actions.tsx +1 -5
- package/src/components/payment-link/after-pay.tsx +4 -2
- package/src/components/payment-link/before-pay.tsx +14 -4
- package/src/components/payment-link/item.tsx +27 -6
- package/src/components/payment-link/preview.tsx +9 -9
- package/src/components/payment-link/product-select.tsx +69 -15
- package/src/components/payment-method/arcblock.tsx +8 -1
- package/src/components/payment-method/base.tsx +8 -1
- package/src/components/payment-method/bitcoin.tsx +8 -1
- package/src/components/payment-method/ethereum.tsx +8 -1
- package/src/components/payment-method/evm-rpc-input.tsx +11 -7
- package/src/components/payment-method/form.tsx +2 -7
- package/src/components/payment-method/stripe.tsx +2 -0
- package/src/components/payouts/actions.tsx +1 -5
- package/src/components/payouts/list.tsx +30 -10
- package/src/components/payouts/portal/list.tsx +11 -9
- package/src/components/price/currency-select.tsx +63 -32
- package/src/components/price/form.tsx +895 -370
- package/src/components/price/upsell-select.tsx +10 -2
- package/src/components/price/upsell.tsx +7 -2
- package/src/components/pricing-table/actions.tsx +1 -5
- package/src/components/pricing-table/customer-settings.tsx +5 -1
- package/src/components/pricing-table/payment-settings.tsx +14 -4
- package/src/components/pricing-table/preview.tsx +9 -9
- package/src/components/pricing-table/price-item.tsx +6 -1
- package/src/components/pricing-table/product-item.tsx +6 -1
- package/src/components/pricing-table/product-settings.tsx +17 -4
- package/src/components/product/actions.tsx +1 -5
- package/src/components/product/add-price.tsx +9 -7
- package/src/components/product/create.tsx +8 -9
- package/src/components/product/cross-sell-select.tsx +5 -1
- package/src/components/product/cross-sell.tsx +7 -2
- package/src/components/product/edit-price.tsx +21 -12
- package/src/components/product/features.tsx +26 -6
- package/src/components/product/form.tsx +115 -72
- package/src/components/progress-bar.tsx +1 -1
- package/src/components/refund/actions.tsx +1 -7
- package/src/components/refund/list.tsx +31 -18
- package/src/components/section/header.tsx +12 -14
- package/src/components/subscription/actions/cancel.tsx +22 -5
- package/src/components/subscription/actions/index.tsx +9 -10
- package/src/components/subscription/actions/pause.tsx +32 -6
- package/src/components/subscription/actions/slash-stake.tsx +5 -3
- package/src/components/subscription/description.tsx +12 -8
- package/src/components/subscription/items/index.tsx +31 -16
- package/src/components/subscription/items/usage-records.tsx +19 -5
- package/src/components/subscription/list.tsx +5 -7
- package/src/components/subscription/metrics.tsx +62 -15
- package/src/components/subscription/portal/actions.tsx +78 -71
- package/src/components/subscription/portal/cancel.tsx +10 -3
- package/src/components/subscription/portal/list.tsx +48 -26
- package/src/components/uploader.tsx +5 -13
- package/src/components/webhook/attempts.tsx +51 -16
- package/src/components/webhook/request-info.tsx +8 -6
- package/src/contexts/products.tsx +27 -10
- package/src/hooks/subscription.ts +34 -0
- package/src/libs/meter-utils.ts +196 -0
- package/src/libs/util.ts +4 -0
- package/src/locales/en.tsx +385 -4
- package/src/locales/zh.tsx +364 -0
- package/src/pages/admin/billing/index.tsx +61 -33
- package/src/pages/admin/billing/invoices/detail.tsx +49 -13
- package/src/pages/admin/billing/meters/create.tsx +60 -0
- package/src/pages/admin/billing/meters/detail.tsx +435 -0
- package/src/pages/admin/billing/meters/index.tsx +210 -0
- package/src/pages/admin/billing/meters/meter-event.tsx +346 -0
- package/src/pages/admin/billing/subscriptions/detail.tsx +90 -25
- package/src/pages/admin/customers/customers/credit-grant/detail.tsx +391 -0
- package/src/pages/admin/customers/customers/detail.tsx +67 -14
- package/src/pages/admin/customers/customers/index.tsx +6 -1
- package/src/pages/admin/customers/index.tsx +5 -0
- package/src/pages/admin/developers/events/detail.tsx +37 -11
- package/src/pages/admin/developers/index.tsx +1 -1
- package/src/pages/admin/developers/webhooks/detail.tsx +41 -11
- package/src/pages/admin/index.tsx +15 -2
- package/src/pages/admin/overview.tsx +107 -19
- package/src/pages/admin/payments/intents/detail.tsx +58 -14
- package/src/pages/admin/payments/payouts/detail.tsx +63 -15
- package/src/pages/admin/payments/refunds/detail.tsx +58 -14
- package/src/pages/admin/products/index.tsx +11 -4
- package/src/pages/admin/products/links/create.tsx +22 -4
- package/src/pages/admin/products/links/detail.tsx +43 -14
- package/src/pages/admin/products/passports/index.tsx +23 -4
- package/src/pages/admin/products/prices/actions.tsx +16 -9
- package/src/pages/admin/products/prices/detail.tsx +73 -14
- package/src/pages/admin/products/prices/list.tsx +15 -3
- package/src/pages/admin/products/pricing-tables/create.tsx +45 -12
- package/src/pages/admin/products/pricing-tables/detail.tsx +45 -14
- package/src/pages/admin/products/products/create.tsx +233 -54
- package/src/pages/admin/products/products/detail.tsx +74 -18
- package/src/pages/admin/settings/index.tsx +8 -1
- package/src/pages/admin/settings/payment-methods/index.tsx +87 -19
- package/src/pages/admin/settings/vault-config/edit-form.tsx +42 -28
- package/src/pages/admin/settings/vault-config/index.tsx +57 -10
- package/src/pages/customer/credit-grant/detail.tsx +308 -0
- package/src/pages/customer/index.tsx +76 -17
- package/src/pages/customer/invoice/detail.tsx +63 -14
- package/src/pages/customer/invoice/past-due.tsx +11 -3
- package/src/pages/customer/payout/detail.tsx +56 -13
- package/src/pages/customer/recharge/account.tsx +78 -18
- package/src/pages/customer/recharge/subscription.tsx +86 -25
- package/src/pages/customer/refund/list.tsx +60 -24
- package/src/pages/customer/subscription/change-payment.tsx +17 -6
- package/src/pages/customer/subscription/change-plan.tsx +34 -7
- package/src/pages/customer/subscription/detail.tsx +134 -34
- package/src/pages/customer/subscription/embed.tsx +25 -5
- package/src/pages/home.tsx +26 -4
- package/src/pages/integrations/donations/edit-form.tsx +25 -9
- package/src/pages/integrations/donations/index.tsx +26 -9
- package/src/pages/integrations/donations/preview.tsx +59 -15
- package/src/pages/integrations/index.tsx +10 -1
- package/src/pages/integrations/overview.tsx +78 -17
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
154
|
-
|
|
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 {
|
|
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
|
|
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
|
-
|
|
114
|
-
sx={{
|
|
115
|
-
|
|
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
|
|
146
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
|
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
|
|
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
|
|
89
|
-
<Stack
|
|
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
|
-
|
|
93
|
-
sx={{
|
|
94
|
-
|
|
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
|
|
125
|
-
|
|
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
|
|
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
|
|
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>
|