payment-kit 1.13.112 → 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/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/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/developers/events/detail.tsx +2 -3
- 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 +6 -5
- 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/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 +3 -67
- 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
|
@@ -74,7 +74,7 @@ export class SubscriptionTrailWilEndEmailTemplate
|
|
|
74
74
|
const productName = await getMainProductName(subscription.id);
|
|
75
75
|
const at: string = formatTime((subscription.trail_end as number) * 1000);
|
|
76
76
|
const willRenewDuration: string =
|
|
77
|
-
locale === 'en' ? this.getWillRenewDuration(locale) : this.getWillRenewDuration(locale).
|
|
77
|
+
locale === 'en' ? this.getWillRenewDuration(locale) : this.getWillRenewDuration(locale).split(' ').join('');
|
|
78
78
|
|
|
79
79
|
const userDid = customer.did;
|
|
80
80
|
const paymentDetail: PaymentDetail = await getPaymentDetail(userDid, invoice);
|
|
@@ -74,7 +74,7 @@ export class SubscriptionWillRenewEmailTemplate
|
|
|
74
74
|
const productName = await getMainProductName(subscription.id);
|
|
75
75
|
const at: string = formatTime(invoice.period_end * 1000);
|
|
76
76
|
const willRenewDuration: string =
|
|
77
|
-
locale === 'en' ? this.getWillRenewDuration(locale) : this.getWillRenewDuration(locale).
|
|
77
|
+
locale === 'en' ? this.getWillRenewDuration(locale) : this.getWillRenewDuration(locale).split(' ').join('');
|
|
78
78
|
|
|
79
79
|
const userDid = customer.did;
|
|
80
80
|
const paymentDetail: PaymentDetail = await getPaymentDetail(userDid, invoice);
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.113",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "cross-env COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@arcblock/jwt": "^1.18.108",
|
|
51
51
|
"@arcblock/ux": "^2.9.15",
|
|
52
52
|
"@blocklet/logger": "1.16.23-beta-aeb9f5bd",
|
|
53
|
+
"@blocklet/payment-react": "1.13.113",
|
|
53
54
|
"@blocklet/sdk": "1.16.23-beta-aeb9f5bd",
|
|
54
55
|
"@blocklet/ui-react": "^2.9.15",
|
|
55
56
|
"@blocklet/uploader": "^0.0.65",
|
|
@@ -108,9 +109,8 @@
|
|
|
108
109
|
},
|
|
109
110
|
"devDependencies": {
|
|
110
111
|
"@abtnode/types": "1.16.23-beta-aeb9f5bd",
|
|
111
|
-
"@arcblock/eslint-config": "^0.2.4",
|
|
112
112
|
"@arcblock/eslint-config-ts": "^0.2.4",
|
|
113
|
-
"@
|
|
113
|
+
"@blocklet/payment-types": "1.13.113",
|
|
114
114
|
"@types/cookie-parser": "^1.4.6",
|
|
115
115
|
"@types/cors": "^2.8.17",
|
|
116
116
|
"@types/dotenv-flow": "^3.3.3",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@vitejs/plugin-react": "^2.2.0",
|
|
122
122
|
"bumpp": "^8.2.1",
|
|
123
123
|
"cross-env": "^7.0.3",
|
|
124
|
-
"eslint": "^8.
|
|
124
|
+
"eslint": "^8.56.0",
|
|
125
125
|
"import-sort-style-module": "^6.0.0",
|
|
126
126
|
"jest": "^29.7.0",
|
|
127
127
|
"lint-staged": "^12.5.0",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"npm-run-all": "^4.1.5",
|
|
130
130
|
"prettier": "^2.8.8",
|
|
131
131
|
"prettier-plugin-import-sort": "^0.0.7",
|
|
132
|
-
"ts-jest": "^29.1.
|
|
132
|
+
"ts-jest": "^29.1.2",
|
|
133
133
|
"ts-node": "^10.9.1",
|
|
134
134
|
"type-fest": "^4.8.3",
|
|
135
135
|
"typescript": "^4.9.5",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"parser": "typescript"
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "d1a99d9bbdb06d4e7742d7741ec511fa0fee4663"
|
|
153
153
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
+
import { stopEvent } from '@blocklet/payment-react';
|
|
2
3
|
import { ExpandMoreOutlined, MoreHorizOutlined } from '@mui/icons-material';
|
|
3
4
|
import { Button, IconButton, ListItemText, Menu, MenuItem } from '@mui/material';
|
|
4
5
|
import React, { useState } from 'react';
|
|
5
6
|
import type { LiteralUnion } from 'type-fest';
|
|
6
7
|
|
|
7
|
-
import { stopEvent } from '../libs/util';
|
|
8
|
-
|
|
9
8
|
type ActionItem = {
|
|
10
9
|
label: string;
|
|
11
10
|
handler: Function;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PaymentDetails, TPaymentMethod } from '@
|
|
1
|
+
import type { PaymentDetails, TPaymentMethod } from '@blocklet/payment-types';
|
|
2
2
|
import { OpenInNewOutlined } from '@mui/icons-material';
|
|
3
3
|
import { Link, Stack, Typography } from '@mui/material';
|
|
4
4
|
import { joinURL } from 'ufo';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { stopEvent } from '@blocklet/payment-react';
|
|
1
2
|
import { Box } from '@mui/material';
|
|
2
3
|
|
|
3
|
-
import { stopEvent } from '../libs/util';
|
|
4
|
-
|
|
5
4
|
export default function ClickBoundary({ children }: { children: React.ReactNode }) {
|
|
6
5
|
return <Box onClick={stopEvent}>{children}</Box>;
|
|
7
6
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import
|
|
3
|
+
import { api, formatError } from '@blocklet/payment-react';
|
|
4
|
+
import type { TCustomerExpanded } from '@blocklet/payment-types';
|
|
4
5
|
import { useSetState } from 'ahooks';
|
|
5
6
|
import type { LiteralUnion } from 'type-fest';
|
|
6
7
|
|
|
7
|
-
import api from '../../libs/api';
|
|
8
|
-
import { formatError } from '../../libs/util';
|
|
9
8
|
import Actions from '../actions';
|
|
10
9
|
import ClickBoundary from '../click-boundary';
|
|
11
10
|
import EditCustomer from './edit';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import
|
|
3
|
+
import { isValidCountry } from '@blocklet/payment-react';
|
|
4
|
+
import type { TCustomer } from '@blocklet/payment-types';
|
|
4
5
|
import { Button, CircularProgress, Stack } from '@mui/material';
|
|
5
6
|
import type { EventHandler } from 'react';
|
|
6
7
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
7
8
|
|
|
8
|
-
import { isValidCountry } from '../../libs/util';
|
|
9
9
|
import CustomerForm from './form';
|
|
10
10
|
|
|
11
11
|
export default function EditCustomer({
|
|
@@ -56,7 +56,7 @@ export default function EditCustomer({
|
|
|
56
56
|
maxWidth="sm"
|
|
57
57
|
onClose={() => onCancel(null)}
|
|
58
58
|
showCloseButton={false}
|
|
59
|
-
title={t('customer.update')}
|
|
59
|
+
title={t('payment.customer.update')}
|
|
60
60
|
actions={
|
|
61
61
|
<Stack direction="row">
|
|
62
62
|
<Button size="small" sx={{ mr: 2 }} onClick={onCancel}>
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import 'react-international-phone/style.css';
|
|
2
2
|
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
+
import { FormInput, PhoneInput } from '@blocklet/payment-react';
|
|
4
5
|
import { InputAdornment, Stack, Typography } from '@mui/material';
|
|
5
6
|
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
6
7
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
7
8
|
import { CountrySelector } from 'react-international-phone';
|
|
8
9
|
import isEmail from 'validator/es/lib/isEmail';
|
|
9
10
|
|
|
10
|
-
import PhoneInput from '../checkout/form/phone';
|
|
11
|
-
import FormInput from '../input';
|
|
12
|
-
|
|
13
11
|
const phoneUtil = PhoneNumberUtil.getInstance();
|
|
14
12
|
|
|
15
13
|
export default function CustomerForm() {
|
|
@@ -19,17 +17,17 @@ export default function CustomerForm() {
|
|
|
19
17
|
return (
|
|
20
18
|
<Stack direction="column" spacing={1}>
|
|
21
19
|
<Typography component="h6" sx={{ mb: 1, color: 'text.primary', fontWeight: 600 }}>
|
|
22
|
-
{t('checkout.contact')}
|
|
20
|
+
{t('payment.checkout.contact')}
|
|
23
21
|
</Typography>
|
|
24
22
|
<FormInput
|
|
25
23
|
name="name"
|
|
26
24
|
variant="outlined"
|
|
27
25
|
errorPosition="right"
|
|
28
26
|
rules={{
|
|
29
|
-
required: t('checkout.required'),
|
|
27
|
+
required: t('payment.checkout.required'),
|
|
30
28
|
}}
|
|
31
29
|
InputProps={{
|
|
32
|
-
startAdornment: <InputAdornment position="start">{t('checkout.customer.name')}</InputAdornment>,
|
|
30
|
+
startAdornment: <InputAdornment position="start">{t('payment.checkout.customer.name')}</InputAdornment>,
|
|
33
31
|
}}
|
|
34
32
|
/>
|
|
35
33
|
<FormInput
|
|
@@ -37,11 +35,11 @@ export default function CustomerForm() {
|
|
|
37
35
|
variant="outlined"
|
|
38
36
|
errorPosition="right"
|
|
39
37
|
rules={{
|
|
40
|
-
required: t('checkout.required'),
|
|
41
|
-
validate: (x) => (isEmail(x) ? true : t('checkout.invalid')),
|
|
38
|
+
required: t('payment.checkout.required'),
|
|
39
|
+
validate: (x) => (isEmail(x) ? true : t('payment.checkout.invalid')),
|
|
42
40
|
}}
|
|
43
41
|
InputProps={{
|
|
44
|
-
startAdornment: <InputAdornment position="start">{t('checkout.customer.email')}</InputAdornment>,
|
|
42
|
+
startAdornment: <InputAdornment position="start">{t('payment.checkout.customer.email')}</InputAdornment>,
|
|
45
43
|
}}
|
|
46
44
|
/>
|
|
47
45
|
<PhoneInput
|
|
@@ -49,23 +47,23 @@ export default function CustomerForm() {
|
|
|
49
47
|
variant="outlined"
|
|
50
48
|
countryFieldName="address.country"
|
|
51
49
|
errorPosition="right"
|
|
52
|
-
placeholder={t('checkout.customer.phonePlaceholder')}
|
|
50
|
+
placeholder={t('payment.checkout.customer.phonePlaceholder')}
|
|
53
51
|
rules={{
|
|
54
|
-
required: t('checkout.required'),
|
|
52
|
+
required: t('payment.checkout.required'),
|
|
55
53
|
validate: (x: string) => {
|
|
56
54
|
try {
|
|
57
55
|
const parsed = phoneUtil.parseAndKeepRawInput(x);
|
|
58
|
-
return phoneUtil.isValidNumber(parsed) ? true : t('checkout.invalid');
|
|
56
|
+
return phoneUtil.isValidNumber(parsed) ? true : t('payment.checkout.invalid');
|
|
59
57
|
} catch (err) {
|
|
60
58
|
console.error(err, x);
|
|
61
|
-
return t('checkout.invalid');
|
|
59
|
+
return t('payment.checkout.invalid');
|
|
62
60
|
}
|
|
63
61
|
},
|
|
64
62
|
}}
|
|
65
63
|
/>
|
|
66
64
|
|
|
67
65
|
<Typography component="h6" sx={{ pt: 2, color: 'text.primary', fontWeight: 600 }}>
|
|
68
|
-
{t('checkout.billing.required')}
|
|
66
|
+
{t('payment.checkout.billing.required')}
|
|
69
67
|
</Typography>
|
|
70
68
|
<Controller
|
|
71
69
|
name="address.country"
|
|
@@ -82,36 +80,36 @@ export default function CustomerForm() {
|
|
|
82
80
|
name="address.state"
|
|
83
81
|
variant="outlined"
|
|
84
82
|
errorPosition="right"
|
|
85
|
-
label={t('checkout.billing.state')}
|
|
86
|
-
placeholder={t('checkout.billing.state')}
|
|
83
|
+
label={t('payment.checkout.billing.state')}
|
|
84
|
+
placeholder={t('payment.checkout.billing.state')}
|
|
87
85
|
/>
|
|
88
86
|
<FormInput
|
|
89
87
|
name="address.city"
|
|
90
88
|
variant="outlined"
|
|
91
89
|
errorPosition="right"
|
|
92
|
-
label={t('checkout.billing.city')}
|
|
93
|
-
placeholder={t('checkout.billing.city')}
|
|
90
|
+
label={t('payment.checkout.billing.city')}
|
|
91
|
+
placeholder={t('payment.checkout.billing.city')}
|
|
94
92
|
/>
|
|
95
93
|
<FormInput
|
|
96
94
|
name="address.line1"
|
|
97
95
|
variant="outlined"
|
|
98
96
|
errorPosition="right"
|
|
99
|
-
label={t('checkout.billing.line1')}
|
|
100
|
-
placeholder={t('checkout.billing.line1')}
|
|
97
|
+
label={t('payment.checkout.billing.line1')}
|
|
98
|
+
placeholder={t('payment.checkout.billing.line1')}
|
|
101
99
|
/>
|
|
102
100
|
<FormInput
|
|
103
101
|
name="address.line2"
|
|
104
102
|
variant="outlined"
|
|
105
103
|
errorPosition="right"
|
|
106
|
-
label={t('checkout.billing.line2')}
|
|
107
|
-
placeholder={t('checkout.billing.line2')}
|
|
104
|
+
label={t('payment.checkout.billing.line2')}
|
|
105
|
+
placeholder={t('payment.checkout.billing.line2')}
|
|
108
106
|
/>
|
|
109
107
|
<FormInput
|
|
110
108
|
name="address.postal_code"
|
|
111
109
|
variant="outlined"
|
|
112
110
|
errorPosition="right"
|
|
113
|
-
label={t('checkout.billing.postal_code')}
|
|
114
|
-
placeholder={t('checkout.billing.postal_code')}
|
|
111
|
+
label={t('payment.checkout.billing.postal_code')}
|
|
112
|
+
placeholder={t('payment.checkout.billing.postal_code')}
|
|
115
113
|
/>
|
|
116
114
|
</Stack>
|
|
117
115
|
);
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import { Livemode, usePaymentContext } from '@blocklet/payment-react';
|
|
1
2
|
import { Close } from '@mui/icons-material';
|
|
2
3
|
import { Box, Button, Divider, Drawer, Stack, Typography } from '@mui/material';
|
|
3
4
|
import { styled } from '@mui/system';
|
|
4
5
|
import React, { useState } from 'react';
|
|
5
6
|
import useBus from 'use-bus';
|
|
6
7
|
|
|
7
|
-
import { useSettingsContext } from '../contexts/settings';
|
|
8
|
-
import Livemode from './livemode';
|
|
9
|
-
|
|
10
8
|
type Props = {
|
|
11
9
|
icon: React.ReactNode;
|
|
12
10
|
text: string;
|
|
@@ -25,7 +23,7 @@ DrawerForm.defaultProps = {
|
|
|
25
23
|
|
|
26
24
|
export default function DrawerForm(props: Props) {
|
|
27
25
|
const [open, setOpen] = useState(props.open);
|
|
28
|
-
const settings =
|
|
26
|
+
const settings = usePaymentContext();
|
|
29
27
|
|
|
30
28
|
useBus('drawer.submitted', () => setOpen(false), []);
|
|
31
29
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { getDurableData } from '@arcblock/ux/lib/Datatable';
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
-
import
|
|
4
|
+
import { api, formatTime } from '@blocklet/payment-react';
|
|
5
|
+
import type { TEventExpanded } from '@blocklet/payment-types';
|
|
5
6
|
import { Alert, CircularProgress, Typography } from '@mui/material';
|
|
6
7
|
import { useRequest } from 'ahooks';
|
|
7
8
|
import { useEffect, useState } from 'react';
|
|
8
9
|
import { useNavigate } from 'react-router-dom';
|
|
9
10
|
|
|
10
|
-
import api from '../../libs/api';
|
|
11
|
-
import { formatTime } from '../../libs/util';
|
|
12
11
|
import Table from '../table';
|
|
13
12
|
|
|
14
13
|
const fetchData = (params: Record<string, any> = {}): Promise<{ list: TEventExpanded[]; count: number }> => {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import
|
|
3
|
+
import { api, formatError } from '@blocklet/payment-react';
|
|
4
|
+
import type { TInvoiceExpanded } from '@blocklet/payment-types';
|
|
4
5
|
import { useSetState } from 'ahooks';
|
|
5
6
|
import { useNavigate } from 'react-router-dom';
|
|
6
7
|
import type { LiteralUnion } from 'type-fest';
|
|
7
8
|
|
|
8
|
-
import api from '../../libs/api';
|
|
9
|
-
import { formatError } from '../../libs/util';
|
|
10
9
|
import Actions from '../actions';
|
|
11
10
|
import ClickBoundary from '../click-boundary';
|
|
12
11
|
import ConfirmDialog from '../confirm';
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { getDurableData } from '@arcblock/ux/lib/Datatable';
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
-
import
|
|
4
|
+
import { Status, api, formatTime } from '@blocklet/payment-react';
|
|
5
|
+
import type { TInvoiceExpanded } from '@blocklet/payment-types';
|
|
5
6
|
import { Alert, CircularProgress, ToggleButton, ToggleButtonGroup, Typography } from '@mui/material';
|
|
6
7
|
import { fromUnitToToken } from '@ocap/util';
|
|
7
8
|
import { useRequest } from 'ahooks';
|
|
8
9
|
import { useEffect, useState } from 'react';
|
|
9
10
|
import { useNavigate } from 'react-router-dom';
|
|
10
11
|
|
|
11
|
-
import
|
|
12
|
-
import { formatTime, getInvoiceStatusColor } from '../../libs/util';
|
|
13
|
-
import Status from '../status';
|
|
12
|
+
import { getInvoiceStatusColor } from '../../libs/util';
|
|
14
13
|
import Table from '../table';
|
|
15
14
|
import InvoiceActions from './action';
|
|
16
15
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import
|
|
2
|
+
import { formatAmount, formatToDate, getPriceUintAmountByCurrency } from '@blocklet/payment-react';
|
|
3
|
+
import type { TInvoiceExpanded } from '@blocklet/payment-types';
|
|
3
4
|
import { InfoOutlined } from '@mui/icons-material';
|
|
4
5
|
import { Stack, Table, TableBody, TableCell, TableHead, TableRow, Tooltip, Typography } from '@mui/material';
|
|
5
6
|
import { styled } from '@mui/system';
|
|
6
7
|
import { toBN } from '@ocap/util';
|
|
7
8
|
|
|
8
|
-
import { formatAmount, formatToDate, getPriceUintAmountByCurrency } from '../../libs/util';
|
|
9
9
|
import LineItemActions from '../subscription/items/actions';
|
|
10
10
|
|
|
11
11
|
type Props = {
|
|
@@ -51,7 +51,7 @@ export default function InvoiceTable({ invoice, simple }: Props) {
|
|
|
51
51
|
{t('common.quantity')}
|
|
52
52
|
</TableCell>
|
|
53
53
|
<TableCell sx={{ textTransform: 'none', fontWeight: 'normal', width: 120 }} align="right">
|
|
54
|
-
{t('customer.invoice.unitPrice')}
|
|
54
|
+
{t('payment.customer.invoice.unitPrice')}
|
|
55
55
|
</TableCell>
|
|
56
56
|
<TableCell sx={{ textTransform: 'none', fontWeight: 'normal', width: 100 }} align="right">
|
|
57
57
|
{t('common.amount')}
|
|
@@ -84,7 +84,7 @@ export default function InvoiceTable({ invoice, simple }: Props) {
|
|
|
84
84
|
<Typography>{line.quantity}</Typography>
|
|
85
85
|
{line.metadata && line.metadata.quantity && (
|
|
86
86
|
<Tooltip
|
|
87
|
-
title={t('customer.invoice.rawQuantity', { quantity: line.metadata.quantity })}
|
|
87
|
+
title={t('payment.customer.invoice.rawQuantity', { quantity: line.metadata.quantity })}
|
|
88
88
|
placement="top">
|
|
89
89
|
<InfoOutlined fontSize="small" sx={{ color: 'text.secondary', cursor: 'pointer' }} />
|
|
90
90
|
</Tooltip>
|
|
@@ -125,7 +125,7 @@ export default function InvoiceTable({ invoice, simple }: Props) {
|
|
|
125
125
|
{invoice.amount_paid !== '0' && (
|
|
126
126
|
<TableRow>
|
|
127
127
|
<TableCell colSpan={3} align="right" sx={{ fontWeight: 600, color: 'text.secondary' }}>
|
|
128
|
-
{t('customer.invoice.amountPaid')}
|
|
128
|
+
{t('payment.customer.invoice.amountPaid')}
|
|
129
129
|
</TableCell>
|
|
130
130
|
<TableCell align="right" sx={{ fontWeight: 600 }}>
|
|
131
131
|
{invoice.amount_paid === '0' ? '' : '-'}
|
|
@@ -137,7 +137,7 @@ export default function InvoiceTable({ invoice, simple }: Props) {
|
|
|
137
137
|
{appliedBalance !== '0' && (
|
|
138
138
|
<TableRow>
|
|
139
139
|
<TableCell colSpan={3} align="right" sx={{ fontWeight: 600, color: 'text.secondary' }}>
|
|
140
|
-
{t('customer.invoice.amountApplied')}
|
|
140
|
+
{t('payment.customer.invoice.amountApplied')}
|
|
141
141
|
</TableCell>
|
|
142
142
|
<TableCell align="right" sx={{ fontWeight: 600 }}>
|
|
143
143
|
{formatAmount(appliedBalance, invoice.paymentCurrency.decimal)}
|
|
@@ -147,7 +147,7 @@ export default function InvoiceTable({ invoice, simple }: Props) {
|
|
|
147
147
|
)}
|
|
148
148
|
<TableRow>
|
|
149
149
|
<TableCell colSpan={3} align="right" sx={{ fontWeight: 600 }}>
|
|
150
|
-
{t('customer.invoice.amountDue')}
|
|
150
|
+
{t('payment.customer.invoice.amountDue')}
|
|
151
151
|
</TableCell>
|
|
152
152
|
<TableCell align="right" sx={{ fontWeight: 600 }}>
|
|
153
153
|
{formatAmount(invoice.amount_remaining, invoice.paymentCurrency.decimal)}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
+
import { FormInput } from '@blocklet/payment-react';
|
|
2
3
|
import { AddOutlined, DeleteOutlineOutlined } from '@mui/icons-material';
|
|
3
4
|
import { Box, Button, IconButton, Stack, Typography } from '@mui/material';
|
|
4
5
|
import { useFieldArray, useFormContext } from 'react-hook-form';
|
|
5
6
|
|
|
6
|
-
import FormInput from '../input';
|
|
7
|
-
|
|
8
7
|
export default function MetadataForm({ title, actions }: { title?: string; actions?: React.ReactNode }) {
|
|
9
8
|
const { t } = useLocaleContext();
|
|
10
9
|
const { control } = useFormContext();
|
|
@@ -19,7 +18,7 @@ export default function MetadataForm({ title, actions }: { title?: string; actio
|
|
|
19
18
|
sx={{ flex: 1 }}
|
|
20
19
|
size="small"
|
|
21
20
|
name={`metadata.${index}.key`}
|
|
22
|
-
rules={{ required: t('checkout.required') }}
|
|
21
|
+
rules={{ required: t('payment.checkout.required') }}
|
|
23
22
|
placeholder="Key"
|
|
24
23
|
/>
|
|
25
24
|
<FormInput
|
|
@@ -27,7 +26,7 @@ export default function MetadataForm({ title, actions }: { title?: string; actio
|
|
|
27
26
|
size="small"
|
|
28
27
|
name={`metadata.${index}.value`}
|
|
29
28
|
placeholder="Value"
|
|
30
|
-
rules={{ required: t('checkout.required') }}
|
|
29
|
+
rules={{ required: t('payment.checkout.required') }}
|
|
31
30
|
/>
|
|
32
31
|
</Stack>
|
|
33
32
|
<IconButton size="small" onClick={() => metadata.remove(index)}>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
+
import { api, formatError } from '@blocklet/payment-react';
|
|
3
4
|
import { useSetState } from 'ahooks';
|
|
4
5
|
|
|
5
|
-
import api from '../../libs/api';
|
|
6
|
-
import { formatError } from '../../libs/util';
|
|
7
6
|
import Actions from '../actions';
|
|
8
7
|
import ClickBoundary from '../click-boundary';
|
|
9
8
|
import ConfirmDialog from '../confirm';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
+
import { api } from '@blocklet/payment-react';
|
|
3
4
|
import { Alert, Box, CircularProgress, MenuItem, Select, Typography } from '@mui/material';
|
|
4
5
|
import { useRequest } from 'ahooks';
|
|
5
6
|
import { useEffect, useState } from 'react';
|
|
6
7
|
|
|
7
|
-
import api from '../../libs/api';
|
|
8
8
|
import ConfirmDialog from '../confirm';
|
|
9
9
|
|
|
10
10
|
const fetchData = (): Promise<any[]> => {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import
|
|
3
|
+
import { api, formatError } from '@blocklet/payment-react';
|
|
4
|
+
import type { TPaymentIntentExpanded } from '@blocklet/payment-types';
|
|
4
5
|
import { useSetState } from 'ahooks';
|
|
5
6
|
import { useNavigate } from 'react-router-dom';
|
|
6
7
|
import type { LiteralUnion } from 'type-fest';
|
|
7
8
|
|
|
8
|
-
import api from '../../libs/api';
|
|
9
|
-
import { formatError } from '../../libs/util';
|
|
10
9
|
import Actions from '../actions';
|
|
11
10
|
import ClickBoundary from '../click-boundary';
|
|
12
11
|
import ConfirmDialog from '../confirm';
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { getDurableData } from '@arcblock/ux/lib/Datatable';
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
-
import
|
|
4
|
+
import { Status, api, formatTime } from '@blocklet/payment-react';
|
|
5
|
+
import type { TPaymentIntentExpanded } from '@blocklet/payment-types';
|
|
5
6
|
import { Alert, CircularProgress, ToggleButton, ToggleButtonGroup, Typography } from '@mui/material';
|
|
6
7
|
import { fromUnitToToken } from '@ocap/util';
|
|
7
8
|
import { useRequest } from 'ahooks';
|
|
8
9
|
import { useEffect, useState } from 'react';
|
|
9
10
|
import { useNavigate } from 'react-router-dom';
|
|
10
11
|
|
|
11
|
-
import
|
|
12
|
-
import { formatTime, getPaymentIntentStatusColor } from '../../libs/util';
|
|
13
|
-
import Status from '../status';
|
|
12
|
+
import { getPaymentIntentStatusColor } from '../../libs/util';
|
|
14
13
|
import Table from '../table';
|
|
15
14
|
import PaymentIntentActions from './actions';
|
|
16
15
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import
|
|
3
|
+
import { api, formatError } from '@blocklet/payment-react';
|
|
4
|
+
import type { TPaymentLinkExpanded } from '@blocklet/payment-types';
|
|
4
5
|
import { useSetState } from 'ahooks';
|
|
5
6
|
import Copy from 'copy-to-clipboard';
|
|
6
7
|
import type { LiteralUnion } from 'type-fest';
|
|
7
8
|
import { joinURL } from 'ufo';
|
|
8
9
|
|
|
9
|
-
import api from '../../libs/api';
|
|
10
|
-
import { formatError } from '../../libs/util';
|
|
11
10
|
import Actions from '../actions';
|
|
12
11
|
import ClickBoundary from '../click-boundary';
|
|
13
12
|
import ConfirmDialog from '../confirm';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
-
import
|
|
3
|
+
import { api, formatError, formatPrice, usePaymentContext } from '@blocklet/payment-react';
|
|
4
|
+
import type { TPrice, TProduct, TProductExpanded } from '@blocklet/payment-types';
|
|
4
5
|
import { Box, Checkbox, FormControlLabel, FormLabel, Stack, TextField, Typography } from '@mui/material';
|
|
5
6
|
import { useSetState } from 'ahooks';
|
|
6
7
|
import { Controller, useFormContext, useWatch } from 'react-hook-form';
|
|
7
8
|
|
|
8
|
-
import { useSettingsContext } from '../../contexts/settings';
|
|
9
|
-
import api from '../../libs/api';
|
|
10
|
-
import { formatError, formatPrice } from '../../libs/util';
|
|
11
9
|
import Actions from '../actions';
|
|
12
10
|
import ClickBoundary from '../click-boundary';
|
|
13
11
|
import InfoCard from '../info-card';
|
|
@@ -24,7 +22,7 @@ type Props = {
|
|
|
24
22
|
export default function LineItem({ prefix, product, valid, onUpdate, onRemove }: Props) {
|
|
25
23
|
const { t } = useLocaleContext();
|
|
26
24
|
const getFieldName = (name: string) => (prefix ? `${prefix}.${name}` : name);
|
|
27
|
-
const { settings } =
|
|
25
|
+
const { settings } = usePaymentContext();
|
|
28
26
|
const { control, setValue } = useFormContext();
|
|
29
27
|
const [state, setState] = useSetState({ editing: false, loading: false });
|
|
30
28
|
const adjustable = useWatch({ control, name: getFieldName('adjustable_quantity.enabled') });
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import
|
|
2
|
+
import { formatPrice, getPriceCurrencyOptions, usePaymentContext } from '@blocklet/payment-react';
|
|
3
|
+
import type { TProductExpanded } from '@blocklet/payment-types';
|
|
3
4
|
import { AddOutlined } from '@mui/icons-material';
|
|
4
5
|
import { Avatar, Box, ListSubheader, MenuItem, Select, Stack, Typography } from '@mui/material';
|
|
5
6
|
import cloneDeep from 'lodash/cloneDeep';
|
|
@@ -7,8 +8,6 @@ import { useState } from 'react';
|
|
|
7
8
|
import type { LiteralUnion } from 'type-fest';
|
|
8
9
|
|
|
9
10
|
import { useProductsContext } from '../../contexts/products';
|
|
10
|
-
import { useSettingsContext } from '../../contexts/settings';
|
|
11
|
-
import { formatPrice, getPriceCurrencyOptions } from '../../libs/util';
|
|
12
11
|
|
|
13
12
|
type Props = {
|
|
14
13
|
mode: LiteralUnion<'waiting' | 'selecting', string>;
|
|
@@ -29,7 +28,7 @@ const filterProducts = (products: TProductExpanded[], hasSelected: (price: any)
|
|
|
29
28
|
export default function ProductSelect({ mode: initialMode, hasSelected, onSelect }: Props) {
|
|
30
29
|
const { t } = useLocaleContext();
|
|
31
30
|
const { products } = useProductsContext();
|
|
32
|
-
const { settings } =
|
|
31
|
+
const { settings } = usePaymentContext();
|
|
33
32
|
const [mode, setMode] = useState(initialMode);
|
|
34
33
|
|
|
35
34
|
const handleSelect = (e: any) => {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import
|
|
3
|
+
import { FormInput } from '@blocklet/payment-react';
|
|
4
|
+
import type { TPaymentLink } from '@blocklet/payment-types';
|
|
4
5
|
import { Button, CircularProgress, Stack } from '@mui/material';
|
|
5
6
|
import type { EventHandler } from 'react';
|
|
6
7
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
7
8
|
|
|
8
|
-
import TextInput from '../input';
|
|
9
|
-
|
|
10
9
|
export default function RenamePaymentLink({
|
|
11
10
|
data,
|
|
12
11
|
loading,
|
|
@@ -54,7 +53,7 @@ export default function RenamePaymentLink({
|
|
|
54
53
|
</Stack>
|
|
55
54
|
}>
|
|
56
55
|
<FormProvider {...methods}>
|
|
57
|
-
<
|
|
56
|
+
<FormInput
|
|
58
57
|
name="name"
|
|
59
58
|
rules={{ required: true }}
|
|
60
59
|
label={t('admin.paymentLink.name.label')}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
|
|
4
|
-
import FormInput from '../input';
|
|
3
|
+
import { FormInput } from '@blocklet/payment-react';
|
|
5
4
|
|
|
6
5
|
export default function ArcBlockMethodForm() {
|
|
7
6
|
const { t } = useLocaleContext();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
|
|
4
|
-
import FormInput from '../input';
|
|
3
|
+
import { FormInput } from '@blocklet/payment-react';
|
|
5
4
|
|
|
6
5
|
export default function BitcoinMethodForm() {
|
|
7
6
|
const { t } = useLocaleContext();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
|
|
4
|
-
import FormInput from '../input';
|
|
3
|
+
import { FormInput } from '@blocklet/payment-react';
|
|
5
4
|
|
|
6
5
|
export default function EthereumMethodForm() {
|
|
7
6
|
const { t } = useLocaleContext();
|