payment-kit 1.13.111 → 1.13.113
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/api/src/libs/notification/template/subscription-trial-will-end.ts +1 -1
- package/api/src/libs/notification/template/subscription-will-renew.ts +1 -1
- package/api/src/routes/products.ts +1 -0
- package/api/src/routes/subscriptions.ts +2 -0
- package/blocklet.yml +1 -1
- package/package.json +6 -6
- package/src/components/actions.tsx +1 -2
- package/src/components/blockchain/tx.tsx +1 -1
- package/src/components/click-boundary.tsx +1 -2
- package/src/components/customer/actions.tsx +2 -3
- package/src/components/customer/edit.tsx +3 -3
- package/src/components/customer/form.tsx +22 -24
- package/src/components/drawer-form.tsx +2 -4
- package/src/components/event/list.tsx +2 -3
- package/src/components/invoice/action.tsx +2 -3
- package/src/components/invoice/list.tsx +3 -4
- package/src/components/invoice/table.tsx +7 -7
- package/src/components/metadata/form.tsx +3 -4
- package/src/components/passport/actions.tsx +1 -2
- package/src/components/passport/assign.tsx +1 -1
- package/src/components/payment-intent/actions.tsx +2 -3
- package/src/components/payment-intent/list.tsx +3 -4
- package/src/components/payment-link/actions.tsx +2 -3
- package/src/components/payment-link/item.tsx +3 -5
- package/src/components/payment-link/product-select.tsx +3 -4
- package/src/components/payment-link/rename.tsx +3 -4
- package/src/components/payment-method/arcblock.tsx +1 -2
- package/src/components/payment-method/bitcoin.tsx +1 -2
- package/src/components/payment-method/ethereum.tsx +1 -2
- package/src/components/payment-method/stripe.tsx +1 -2
- package/src/components/portal/invoice/list.tsx +4 -5
- package/src/components/portal/subscription/actions.tsx +7 -8
- package/src/components/portal/subscription/cancel.tsx +13 -12
- package/src/components/portal/subscription/list.tsx +4 -10
- package/src/components/price/currency-select.tsx +2 -2
- package/src/components/price/form.tsx +3 -4
- package/src/components/price/upsell-select.tsx +2 -3
- package/src/components/price/upsell.tsx +3 -5
- package/src/components/pricing-table/actions.tsx +2 -3
- package/src/components/pricing-table/payment-settings.tsx +4 -4
- package/src/components/pricing-table/price-item.tsx +4 -7
- package/src/components/pricing-table/product-item.tsx +3 -3
- package/src/components/pricing-table/rename.tsx +3 -4
- package/src/components/product/actions.tsx +2 -3
- package/src/components/product/add-price.tsx +2 -2
- package/src/components/product/create.tsx +2 -4
- package/src/components/product/cross-sell-select.tsx +3 -3
- package/src/components/product/cross-sell.tsx +4 -5
- package/src/components/product/edit.tsx +1 -1
- package/src/components/product/form.tsx +6 -6
- package/src/components/relative-time.tsx +1 -2
- package/src/components/subscription/actions/cancel.tsx +2 -3
- package/src/components/subscription/actions/index.tsx +2 -3
- package/src/components/subscription/items/actions.tsx +1 -1
- package/src/components/subscription/items/index.tsx +2 -2
- package/src/components/subscription/items/usage-records.tsx +2 -3
- package/src/components/subscription/list.tsx +3 -4
- package/src/components/subscription/metrics.tsx +2 -2
- package/src/components/subscription/status.tsx +3 -3
- package/src/components/webhook/attempts.tsx +3 -3
- package/src/contexts/products.tsx +2 -3
- package/src/libs/api.ts +2 -19
- package/src/libs/dayjs.ts +1 -15
- package/src/libs/util.ts +24 -555
- package/src/locales/en.tsx +0 -139
- package/src/locales/index.tsx +5 -23
- package/src/locales/zh.tsx +0 -136
- package/src/pages/admin/billing/index.tsx +4 -2
- package/src/pages/admin/billing/invoices/detail.tsx +3 -4
- package/src/pages/admin/billing/subscriptions/detail.tsx +3 -3
- package/src/pages/admin/customers/customers/detail.tsx +3 -5
- package/src/pages/admin/customers/customers/index.tsx +2 -3
- package/src/pages/admin/customers/index.tsx +4 -2
- package/src/pages/admin/developers/events/detail.tsx +2 -3
- package/src/pages/admin/developers/index.tsx +4 -2
- package/src/pages/admin/developers/webhooks/detail.tsx +3 -4
- package/src/pages/admin/developers/webhooks/index.tsx +3 -4
- package/src/pages/admin/index.tsx +10 -7
- package/src/pages/admin/payments/index.tsx +4 -2
- package/src/pages/admin/payments/intents/detail.tsx +4 -6
- package/src/pages/admin/payments/links/create.tsx +3 -5
- package/src/pages/admin/payments/links/detail.tsx +4 -5
- package/src/pages/admin/payments/links/index.tsx +4 -6
- package/src/pages/admin/products/passports/index.tsx +1 -1
- package/src/pages/admin/products/prices/actions.tsx +2 -3
- package/src/pages/admin/products/prices/detail.tsx +2 -3
- package/src/pages/admin/products/prices/list.tsx +2 -4
- package/src/pages/admin/products/pricing-tables/create.tsx +2 -3
- package/src/pages/admin/products/pricing-tables/detail.tsx +4 -5
- package/src/pages/admin/products/pricing-tables/index.tsx +2 -4
- package/src/pages/admin/products/products/create.tsx +2 -4
- package/src/pages/admin/products/products/detail.tsx +4 -5
- package/src/pages/admin/products/products/index.tsx +4 -6
- package/src/pages/admin/settings/index.tsx +4 -2
- package/src/pages/admin/settings/payment-methods/create.tsx +3 -5
- package/src/pages/admin/settings/payment-methods/index.tsx +2 -3
- package/src/pages/checkout/index.tsx +6 -3
- package/src/pages/checkout/pay.tsx +5 -69
- package/src/pages/checkout/pricing-table.tsx +3 -7
- package/src/pages/customer/index.tsx +7 -7
- package/src/pages/customer/invoice.tsx +10 -11
- package/src/pages/customer/subscription/detail.tsx +4 -4
- package/src/pages/customer/subscription/update.tsx +19 -19
- package/src/components/checkout/amount.tsx +0 -24
- package/src/components/checkout/error.tsx +0 -30
- package/src/components/checkout/footer.tsx +0 -12
- package/src/components/checkout/form/address.tsx +0 -119
- package/src/components/checkout/form/index.tsx +0 -400
- package/src/components/checkout/form/phone.tsx +0 -103
- package/src/components/checkout/form/stripe.tsx +0 -195
- package/src/components/checkout/form/user-buttons.tsx +0 -24
- package/src/components/checkout/header.tsx +0 -40
- package/src/components/checkout/pay.tsx +0 -385
- package/src/components/checkout/pricing-table.tsx +0 -205
- package/src/components/checkout/product-card.tsx +0 -52
- package/src/components/checkout/product-item.tsx +0 -111
- package/src/components/checkout/skeleton/overview.tsx +0 -21
- package/src/components/checkout/skeleton/payment.tsx +0 -35
- package/src/components/checkout/success.tsx +0 -183
- package/src/components/checkout/summary.tsx +0 -198
- package/src/components/input.tsx +0 -58
- package/src/components/livemode.tsx +0 -23
- package/src/components/pricing-table/product-skeleton.tsx +0 -39
- package/src/components/status.tsx +0 -19
- package/src/components/switch.tsx +0 -48
- package/src/contexts/settings.tsx +0 -54
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
4
|
-
import
|
|
4
|
+
import { Status, api, formatError, formatTime } from '@blocklet/payment-react';
|
|
5
|
+
import type { TInvoiceExpanded } from '@blocklet/payment-types';
|
|
5
6
|
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
6
7
|
import { Alert, Box, Button, CircularProgress, Grid, Stack, Typography } from '@mui/material';
|
|
7
8
|
import { useRequest, useSetState } from 'ahooks';
|
|
@@ -13,10 +14,8 @@ import Currency from '../../components/currency';
|
|
|
13
14
|
import InfoRow from '../../components/info-row';
|
|
14
15
|
import InvoiceTable from '../../components/invoice/table';
|
|
15
16
|
import SectionHeader from '../../components/section/header';
|
|
16
|
-
import Status from '../../components/status';
|
|
17
17
|
import { useSessionContext } from '../../contexts/session';
|
|
18
|
-
import
|
|
19
|
-
import { formatError, formatTime, getInvoiceStatusColor } from '../../libs/util';
|
|
18
|
+
import { getInvoiceStatusColor } from '../../libs/util';
|
|
20
19
|
|
|
21
20
|
const fetchData = (id: string): Promise<TInvoiceExpanded> => {
|
|
22
21
|
return api.get(`/api/invoices/${id}`).then((res) => res.data);
|
|
@@ -42,9 +41,9 @@ export default function CustomerHome() {
|
|
|
42
41
|
action: 'collect',
|
|
43
42
|
timeout: 5 * 60 * 1000,
|
|
44
43
|
messages: {
|
|
45
|
-
title: t('customer.invoice.pay'),
|
|
46
|
-
success: t('customer.invoice.paySuccess'),
|
|
47
|
-
error: t('customer.invoice.payError'),
|
|
44
|
+
title: t('payment.customer.invoice.pay'),
|
|
45
|
+
success: t('payment.customer.invoice.paySuccess'),
|
|
46
|
+
error: t('payment.customer.invoice.payError'),
|
|
48
47
|
},
|
|
49
48
|
extraParams: { invoiceId: params.id },
|
|
50
49
|
onSuccess: async () => {
|
|
@@ -96,7 +95,7 @@ export default function CustomerHome() {
|
|
|
96
95
|
</Grid>
|
|
97
96
|
<Grid item xs={12} md={5}>
|
|
98
97
|
<Box>
|
|
99
|
-
<SectionHeader title={t('customer.invoice.summary')} mb={0} />
|
|
98
|
+
<SectionHeader title={t('payment.customer.invoice.summary')} mb={0} />
|
|
100
99
|
<Stack sx={{ mt: 1 }}>
|
|
101
100
|
<InfoRow label={t('admin.invoice.number')} value={data.number} />
|
|
102
101
|
<InfoRow label={t('admin.invoice.from')} value={data.statement_descriptor || blocklet.appName} />
|
|
@@ -134,7 +133,7 @@ export default function CustomerHome() {
|
|
|
134
133
|
</Box>
|
|
135
134
|
</Grid>
|
|
136
135
|
<Grid item xs={12} md={7}>
|
|
137
|
-
<SectionHeader title={t('customer.invoice.details')} mb={0}>
|
|
136
|
+
<SectionHeader title={t('payment.customer.invoice.details')} mb={0}>
|
|
138
137
|
{['open'].includes(data.status) && (
|
|
139
138
|
<Button
|
|
140
139
|
variant="contained"
|
|
@@ -142,7 +141,7 @@ export default function CustomerHome() {
|
|
|
142
141
|
size="small"
|
|
143
142
|
disabled={state.downloading}
|
|
144
143
|
onClick={() => setState({ downloading: true })}>
|
|
145
|
-
{t('customer.invoice.download')}
|
|
144
|
+
{t('payment.customer.invoice.download')}
|
|
146
145
|
</Button>
|
|
147
146
|
)}
|
|
148
147
|
</SectionHeader>
|
|
@@ -150,7 +149,7 @@ export default function CustomerHome() {
|
|
|
150
149
|
<Stack direction="row" justifyContent="flex-end" alignItems="center" mt={2}>
|
|
151
150
|
{['open', 'uncollectible'].includes(data.status) && (
|
|
152
151
|
<Button variant="contained" color="primary" disabled={state.paying} onClick={onPay}>
|
|
153
|
-
{t('customer.invoice.pay')}
|
|
152
|
+
{t('payment.customer.invoice.pay')}
|
|
154
153
|
</Button>
|
|
155
154
|
)}
|
|
156
155
|
</Stack>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import
|
|
3
|
+
import { api, formatTime } from '@blocklet/payment-react';
|
|
4
|
+
import type { TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
4
5
|
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
5
6
|
import { Alert, Box, CircularProgress, Stack, Typography } from '@mui/material';
|
|
6
7
|
import { styled } from '@mui/system';
|
|
@@ -16,8 +17,7 @@ import SectionHeader from '../../../components/section/header';
|
|
|
16
17
|
import SubscriptionItemList from '../../../components/subscription/items';
|
|
17
18
|
import SubscriptionMetrics from '../../../components/subscription/metrics';
|
|
18
19
|
import SubscriptionStatus from '../../../components/subscription/status';
|
|
19
|
-
import
|
|
20
|
-
import { formatSubscriptionProduct, formatTime } from '../../../libs/util';
|
|
20
|
+
import { formatSubscriptionProduct } from '../../../libs/util';
|
|
21
21
|
|
|
22
22
|
const fetchData = (id: string | undefined): Promise<TSubscriptionExpanded> => {
|
|
23
23
|
return api.get(`/api/subscriptions/${id}`).then((res) => res.data);
|
|
@@ -45,7 +45,7 @@ export default function CustomerSubscriptionDetail() {
|
|
|
45
45
|
<Stack direction="row" alignItems="center" sx={{ fontWeight: 'normal', mt: '16px' }}>
|
|
46
46
|
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
47
47
|
<Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
|
|
48
|
-
{t('customer.subscriptions.title')}
|
|
48
|
+
{t('payment.customer.subscriptions.title')}
|
|
49
49
|
</Typography>
|
|
50
50
|
</Stack>
|
|
51
51
|
</Link>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
4
|
-
import
|
|
4
|
+
import { PricingTable, api, formatError, formatPrice, formatTime } from '@blocklet/payment-react';
|
|
5
|
+
import type { TLineItemExpanded, TPricingTableExpanded, TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
5
6
|
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
6
7
|
import { LoadingButton } from '@mui/lab';
|
|
7
8
|
import { Alert, CircularProgress, Divider, Stack, Typography } from '@mui/material';
|
|
@@ -10,12 +11,10 @@ import { fromUnitToToken } from '@ocap/util';
|
|
|
10
11
|
import { useRequest, useSetState } from 'ahooks';
|
|
11
12
|
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
12
13
|
|
|
13
|
-
import PricingTable from '../../../components/checkout/pricing-table';
|
|
14
14
|
import InfoCard from '../../../components/info-card';
|
|
15
15
|
import SectionHeader from '../../../components/section/header';
|
|
16
16
|
import { useSessionContext } from '../../../contexts/session';
|
|
17
|
-
import
|
|
18
|
-
import { formatError, formatPrice, formatSubscriptionProduct, formatTime } from '../../../libs/util';
|
|
17
|
+
import { formatSubscriptionProduct } from '../../../libs/util';
|
|
19
18
|
|
|
20
19
|
const fetchData = async (
|
|
21
20
|
id: string
|
|
@@ -73,11 +72,11 @@ export default function CustomerSubscriptionUpdate() {
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
if (!data.subscription) {
|
|
76
|
-
return <Alert severity="error">{t('customer.upgrade.subscriptionNotFound')}</Alert>;
|
|
75
|
+
return <Alert severity="error">{t('payment.customer.upgrade.subscriptionNotFound')}</Alert>;
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
if (!data.table) {
|
|
80
|
-
return <Alert severity="error">{t('customer.upgrade.tableNotFound')}</Alert>;
|
|
79
|
+
return <Alert severity="error">{t('payment.customer.upgrade.tableNotFound')}</Alert>;
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
const handleSelect = async (priceId: string) => {
|
|
@@ -137,7 +136,7 @@ export default function CustomerSubscriptionUpdate() {
|
|
|
137
136
|
// FIXME: support more proration_behavior
|
|
138
137
|
const result = await api.put(`/api/subscriptions/${id}`, { proration_behavior: 'create_prorations', items });
|
|
139
138
|
if (result.data.status === 'active') {
|
|
140
|
-
Toast.success(t('customer.upgrade.success'));
|
|
139
|
+
Toast.success(t('payment.customer.upgrade.success'));
|
|
141
140
|
setState({ paid: true });
|
|
142
141
|
setTimeout(handleBack, 2000);
|
|
143
142
|
} else {
|
|
@@ -148,10 +147,10 @@ export default function CustomerSubscriptionUpdate() {
|
|
|
148
147
|
action: result.data.connectAction,
|
|
149
148
|
timeout: 5 * 60 * 1000,
|
|
150
149
|
messages: {
|
|
151
|
-
title: t('customer.upgrade.pay'),
|
|
152
|
-
scan: t('customer.upgrade.scan'),
|
|
153
|
-
success: t('customer.upgrade.success'),
|
|
154
|
-
error: t('customer.upgrade.error'),
|
|
150
|
+
title: t('payment.customer.upgrade.pay'),
|
|
151
|
+
scan: t('payment.customer.upgrade.scan'),
|
|
152
|
+
success: t('payment.customer.upgrade.success'),
|
|
153
|
+
error: t('payment.customer.upgrade.error'),
|
|
155
154
|
},
|
|
156
155
|
extraParams: { invoiceId: result.data.latest_invoice_id, subscriptionId: result.data.id },
|
|
157
156
|
onSuccess: () => {
|
|
@@ -190,7 +189,7 @@ export default function CustomerSubscriptionUpdate() {
|
|
|
190
189
|
if (data.subscription.items.find((y) => y.price_id === x.price_id)) {
|
|
191
190
|
x.is_highlight = true;
|
|
192
191
|
x.is_disabled = true;
|
|
193
|
-
x.highlight_text = t('customer.upgrade.current');
|
|
192
|
+
x.highlight_text = t('payment.customer.upgrade.current');
|
|
194
193
|
if (!state.priceId) {
|
|
195
194
|
x.is_selected = true;
|
|
196
195
|
}
|
|
@@ -227,15 +226,15 @@ export default function CustomerSubscriptionUpdate() {
|
|
|
227
226
|
</Link>
|
|
228
227
|
</Stack>
|
|
229
228
|
<Stack direction="column" sx={{ marginTop: 32 }}>
|
|
230
|
-
<SectionHeader title={t('customer.upgrade.config')} />
|
|
229
|
+
<SectionHeader title={t('payment.customer.upgrade.config')} />
|
|
231
230
|
<PricingTable mode="select" alignItems="left" interval={interval} table={table} onSelect={handleSelect} />
|
|
232
231
|
</Stack>
|
|
233
232
|
{state.priceId && state.total && state.setup && (
|
|
234
233
|
<Stack direction="column" spacing={3} sx={{ maxWidth: 640 }}>
|
|
235
|
-
<SectionHeader title={t('customer.upgrade.confirm')} />
|
|
234
|
+
<SectionHeader title={t('payment.customer.upgrade.confirm')} />
|
|
236
235
|
<Stack direction="column" spacing={2}>
|
|
237
236
|
<Typography variant="h6" sx={{ fontWeight: 'normal' }}>
|
|
238
|
-
{t('customer.upgrade.summary', {
|
|
237
|
+
{t('payment.customer.upgrade.summary', {
|
|
239
238
|
// @ts-ignore
|
|
240
239
|
date: formatTime(state.setup.period.end * 1000, 'lll', locale),
|
|
241
240
|
})}
|
|
@@ -261,12 +260,13 @@ export default function CustomerSubscriptionUpdate() {
|
|
|
261
260
|
</Stack>
|
|
262
261
|
<Divider />
|
|
263
262
|
<Stack direction="column" spacing={1}>
|
|
264
|
-
{getInfoRow(t('customer.upgrade.total'), state.total)}
|
|
263
|
+
{getInfoRow(t('payment.customer.upgrade.total'), state.total)}
|
|
265
264
|
{state.prorations.map((x: any) => getInfoRow(x.description, x.amount))}
|
|
266
|
-
{state.appliedCredit > '0' &&
|
|
267
|
-
|
|
265
|
+
{state.appliedCredit > '0' &&
|
|
266
|
+
getInfoRow(t('payment.customer.upgrade.appliedCredit'), state.appliedCredit, '-')}
|
|
267
|
+
{state.newCredit > '0' && getInfoRow(t('payment.customer.upgrade.newCredit'), state.newCredit)}
|
|
268
268
|
<Divider />
|
|
269
|
-
{getInfoRow(t('customer.upgrade.remaining'), state.remaining)}
|
|
269
|
+
{getInfoRow(t('payment.customer.upgrade.remaining'), state.remaining)}
|
|
270
270
|
<Divider />
|
|
271
271
|
<Stack direction="row" alignItems="center" justifyContent="flex-end" spacing={2} sx={{ pt: 2 }}>
|
|
272
272
|
<LoadingButton
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Typography } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
type Props = { amount: string; sx?: any };
|
|
4
|
-
|
|
5
|
-
export default function PaymentAmount({ amount, sx }: Props) {
|
|
6
|
-
return (
|
|
7
|
-
<Typography
|
|
8
|
-
sx={{
|
|
9
|
-
my: 0.5,
|
|
10
|
-
fontWeight: 600,
|
|
11
|
-
fontSize: '2.5rem',
|
|
12
|
-
lineHeight: '1.3',
|
|
13
|
-
letterSpacing: '-0.03rem',
|
|
14
|
-
fontVariantNumeric: 'tabular-nums',
|
|
15
|
-
...sx,
|
|
16
|
-
}}>
|
|
17
|
-
{amount}
|
|
18
|
-
</Typography>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
PaymentAmount.defaultProps = {
|
|
23
|
-
sx: {},
|
|
24
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Button, Stack, Typography } from '@mui/material';
|
|
2
|
-
import { Link } from 'react-router-dom';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
title: string;
|
|
6
|
-
description: string;
|
|
7
|
-
button?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default function PaymentError({ title, description, button }: Props) {
|
|
11
|
-
return (
|
|
12
|
-
<Stack sx={{ height: '100vh' }} alignItems="center" justifyContent="center">
|
|
13
|
-
<Stack sx={{ width: '280px' }} direction="column" alignItems="center" justifyContent="center">
|
|
14
|
-
<Typography variant="h5" sx={{ mb: 2 }}>
|
|
15
|
-
{title}
|
|
16
|
-
</Typography>
|
|
17
|
-
<Typography variant="body1" sx={{ mb: 2, textAlign: 'center' }}>
|
|
18
|
-
{description}
|
|
19
|
-
</Typography>
|
|
20
|
-
<Button variant="text" size="small" component={Link} to={window.blocklet.appUrl}>
|
|
21
|
-
{button}
|
|
22
|
-
</Button>
|
|
23
|
-
</Stack>
|
|
24
|
-
</Stack>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
PaymentError.defaultProps = {
|
|
29
|
-
button: 'Back',
|
|
30
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Typography } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
export default function CheckoutFooter({ ...props }) {
|
|
4
|
-
return (
|
|
5
|
-
<Typography color="text.secondary" fontSize={12} {...props}>
|
|
6
|
-
Powered by{' '}
|
|
7
|
-
<Typography component="span" sx={{ fontWeight: 'bold', fontSize: 12 }}>
|
|
8
|
-
ArcBlock
|
|
9
|
-
</Typography>
|
|
10
|
-
</Typography>
|
|
11
|
-
);
|
|
12
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import { Fade, Stack, Typography } from '@mui/material';
|
|
3
|
-
import { Controller, useFormContext } from 'react-hook-form';
|
|
4
|
-
import { CountrySelector } from 'react-international-phone';
|
|
5
|
-
|
|
6
|
-
import FormInput from '../../input';
|
|
7
|
-
|
|
8
|
-
type Props = {
|
|
9
|
-
mode: string;
|
|
10
|
-
stripe: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default function AddressForm({ mode, stripe }: Props) {
|
|
14
|
-
const { t } = useLocaleContext();
|
|
15
|
-
const { control, setValue } = useFormContext();
|
|
16
|
-
|
|
17
|
-
if (mode === 'required') {
|
|
18
|
-
return (
|
|
19
|
-
<Fade in>
|
|
20
|
-
<Stack className="cko-payment-address cko-payment-form">
|
|
21
|
-
<Typography sx={{ mb: 1, color: 'text.primary', fontWeight: 600 }}>
|
|
22
|
-
{t(`checkout.billing.${mode}`)}
|
|
23
|
-
</Typography>
|
|
24
|
-
<Stack direction="column" className="cko-payment-form" spacing={0}>
|
|
25
|
-
<Stack direction="row" spacing={0}>
|
|
26
|
-
<Controller
|
|
27
|
-
name="billing_address.country"
|
|
28
|
-
control={control}
|
|
29
|
-
render={({ field }) => (
|
|
30
|
-
<CountrySelector
|
|
31
|
-
selectedCountry={field.value}
|
|
32
|
-
onSelect={({ iso2 }) => setValue(field.name, iso2)}
|
|
33
|
-
buttonStyle={{
|
|
34
|
-
width: '64px',
|
|
35
|
-
height: '40px',
|
|
36
|
-
border: '1px solid #ccc',
|
|
37
|
-
marginLeft: -1,
|
|
38
|
-
marginTop: -1,
|
|
39
|
-
}}
|
|
40
|
-
/>
|
|
41
|
-
)}
|
|
42
|
-
/>
|
|
43
|
-
<FormInput
|
|
44
|
-
name="billing_address.postal_code"
|
|
45
|
-
rules={{ required: t('checkout.required') }}
|
|
46
|
-
errorPosition="right"
|
|
47
|
-
variant="outlined"
|
|
48
|
-
placeholder={t('checkout.billing.postal_code')}
|
|
49
|
-
/>
|
|
50
|
-
</Stack>
|
|
51
|
-
<FormInput
|
|
52
|
-
name="billing_address.state"
|
|
53
|
-
rules={{ required: t('checkout.required') }}
|
|
54
|
-
errorPosition="right"
|
|
55
|
-
variant="outlined"
|
|
56
|
-
placeholder={t('checkout.billing.state')}
|
|
57
|
-
/>
|
|
58
|
-
<FormInput
|
|
59
|
-
name="billing_address.line1"
|
|
60
|
-
rules={{ required: t('checkout.required') }}
|
|
61
|
-
errorPosition="right"
|
|
62
|
-
variant="outlined"
|
|
63
|
-
placeholder={t('checkout.billing.line1')}
|
|
64
|
-
/>
|
|
65
|
-
<FormInput
|
|
66
|
-
name="billing_address.city"
|
|
67
|
-
rules={{ required: t('checkout.required') }}
|
|
68
|
-
errorPosition="right"
|
|
69
|
-
variant="outlined"
|
|
70
|
-
placeholder={t('checkout.billing.city')}
|
|
71
|
-
/>
|
|
72
|
-
</Stack>
|
|
73
|
-
</Stack>
|
|
74
|
-
</Fade>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (stripe) {
|
|
79
|
-
return (
|
|
80
|
-
<Fade in>
|
|
81
|
-
<Stack className="cko-payment-address cko-payment-form">
|
|
82
|
-
<Typography sx={{ mb: 1, color: 'text.primary', fontWeight: 600 }}>
|
|
83
|
-
{t(`checkout.billing.${mode}`)}
|
|
84
|
-
</Typography>
|
|
85
|
-
<Stack direction="column" className="cko-payment-form" spacing={0}>
|
|
86
|
-
<Stack direction="row" spacing={0}>
|
|
87
|
-
<Controller
|
|
88
|
-
name="billing_address.country"
|
|
89
|
-
control={control}
|
|
90
|
-
render={({ field }) => (
|
|
91
|
-
<CountrySelector
|
|
92
|
-
selectedCountry={field.value}
|
|
93
|
-
onSelect={({ iso2 }) => setValue(field.name, iso2)}
|
|
94
|
-
buttonStyle={{
|
|
95
|
-
width: '64px',
|
|
96
|
-
height: '40px',
|
|
97
|
-
border: '1px solid #ccc',
|
|
98
|
-
marginLeft: -1,
|
|
99
|
-
marginTop: -1,
|
|
100
|
-
}}
|
|
101
|
-
/>
|
|
102
|
-
)}
|
|
103
|
-
/>
|
|
104
|
-
<FormInput
|
|
105
|
-
name="billing_address.postal_code"
|
|
106
|
-
rules={{ required: t('checkout.required') }}
|
|
107
|
-
errorPosition="right"
|
|
108
|
-
variant="outlined"
|
|
109
|
-
placeholder={t('checkout.billing.postal_code')}
|
|
110
|
-
/>
|
|
111
|
-
</Stack>
|
|
112
|
-
</Stack>
|
|
113
|
-
</Stack>
|
|
114
|
-
</Fade>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return null;
|
|
119
|
-
}
|