payment-kit 1.14.21 → 1.14.22
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/blocklet.yml +1 -1
- package/package.json +19 -19
- package/src/app.tsx +13 -12
- package/src/components/balance-list.tsx +12 -2
- package/src/components/copyable.tsx +3 -2
- package/src/components/customer/edit.tsx +25 -21
- package/src/components/customer/form.tsx +18 -28
- package/src/components/customer/link.tsx +1 -2
- package/src/components/date-range-picker.tsx +21 -0
- package/src/components/drawer-form.tsx +27 -4
- package/src/components/event/list.tsx +3 -2
- package/src/components/filter-toolbar.tsx +11 -4
- package/src/components/info-card.tsx +4 -2
- package/src/components/info-metric.tsx +2 -2
- package/src/components/info-row.tsx +33 -26
- package/src/components/invoice/list.tsx +2 -2
- package/src/components/invoice/table.tsx +148 -85
- package/src/components/invoice-pdf/pdf.tsx +5 -1
- package/src/components/layout/admin.tsx +8 -2
- package/src/components/metadata/editor.tsx +25 -18
- package/src/components/metadata/form.tsx +83 -25
- package/src/components/metadata/list.tsx +22 -6
- package/src/components/payment-intent/list.tsx +3 -3
- package/src/components/payment-link/preview.tsx +42 -24
- package/src/components/payouts/list.tsx +2 -3
- package/src/components/price/form.tsx +27 -12
- package/src/components/price/upsell.tsx +1 -4
- package/src/components/pricing-table/preview.tsx +42 -23
- package/src/components/product/cross-sell-select.tsx +1 -1
- package/src/components/product/cross-sell.tsx +3 -4
- package/src/components/product/edit-price.tsx +0 -1
- package/src/components/refund/list.tsx +9 -4
- package/src/components/section/header.tsx +11 -4
- package/src/components/subscription/description.tsx +10 -6
- package/src/components/subscription/items/index.tsx +28 -6
- package/src/components/subscription/list.tsx +2 -2
- package/src/components/subscription/metrics.tsx +10 -8
- package/src/components/subscription/portal/actions.tsx +37 -11
- package/src/components/subscription/portal/list.tsx +131 -70
- package/src/components/subscription/status.tsx +9 -3
- package/src/global.css +1 -1
- package/src/hooks/mobile.ts +3 -3
- package/src/libs/util.ts +6 -2
- package/src/locales/en.tsx +37 -1
- package/src/locales/zh.tsx +37 -1
- package/src/pages/admin/billing/index.tsx +24 -4
- package/src/pages/admin/billing/invoices/detail.tsx +302 -147
- package/src/pages/admin/billing/subscriptions/detail.tsx +259 -134
- package/src/pages/admin/customers/customers/detail.tsx +358 -175
- package/src/pages/admin/customers/customers/index.tsx +8 -5
- package/src/pages/admin/customers/index.tsx +22 -5
- package/src/pages/admin/developers/webhooks/index.tsx +2 -2
- package/src/pages/admin/index.tsx +24 -10
- package/src/pages/admin/overview.tsx +1 -1
- package/src/pages/admin/payments/index.tsx +22 -7
- package/src/pages/admin/payments/intents/detail.tsx +263 -121
- package/src/pages/admin/payments/payouts/detail.tsx +235 -102
- package/src/pages/admin/payments/refunds/detail.tsx +286 -133
- package/src/pages/admin/products/index.tsx +28 -12
- package/src/pages/admin/products/links/create.tsx +16 -6
- package/src/pages/admin/products/links/detail.tsx +280 -176
- package/src/pages/admin/products/links/index.tsx +4 -7
- package/src/pages/admin/products/passports/index.tsx +6 -3
- package/src/pages/admin/products/prices/detail.tsx +260 -139
- package/src/pages/admin/products/prices/list.tsx +7 -3
- package/src/pages/admin/products/pricing-tables/create.tsx +17 -5
- package/src/pages/admin/products/pricing-tables/detail.tsx +221 -121
- package/src/pages/admin/products/pricing-tables/index.tsx +1 -2
- package/src/pages/admin/products/products/detail.tsx +262 -119
- package/src/pages/admin/products/products/index.tsx +1 -2
- package/src/pages/admin/settings/index.tsx +27 -7
- package/src/pages/customer/index.tsx +431 -143
- package/src/pages/customer/invoice/detail.tsx +138 -26
- package/src/pages/customer/refund/list.tsx +193 -4
- package/src/pages/customer/subscription/change-payment.tsx +20 -20
- package/src/pages/customer/subscription/detail.tsx +168 -34
- package/src/pages/customer/subscription/embed.tsx +22 -19
- package/src/pages/home.tsx +7 -1
- package/src/components/table.tsx +0 -93
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.22",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -43,29 +43,29 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@abtnode/cron": "1.16.28",
|
|
46
|
-
"@arcblock/did": "^1.18.
|
|
46
|
+
"@arcblock/did": "^1.18.128",
|
|
47
47
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
48
|
-
"@arcblock/did-connect": "^2.10.
|
|
49
|
-
"@arcblock/did-util": "^1.18.
|
|
50
|
-
"@arcblock/jwt": "^1.18.
|
|
51
|
-
"@arcblock/ux": "^2.10.
|
|
52
|
-
"@arcblock/validator": "^1.18.
|
|
48
|
+
"@arcblock/did-connect": "^2.10.16",
|
|
49
|
+
"@arcblock/did-util": "^1.18.128",
|
|
50
|
+
"@arcblock/jwt": "^1.18.128",
|
|
51
|
+
"@arcblock/ux": "^2.10.16",
|
|
52
|
+
"@arcblock/validator": "^1.18.128",
|
|
53
53
|
"@blocklet/js-sdk": "1.16.28",
|
|
54
54
|
"@blocklet/logger": "1.16.28",
|
|
55
|
-
"@blocklet/payment-react": "1.14.
|
|
55
|
+
"@blocklet/payment-react": "1.14.22",
|
|
56
56
|
"@blocklet/sdk": "1.16.28",
|
|
57
|
-
"@blocklet/ui-react": "^2.10.
|
|
57
|
+
"@blocklet/ui-react": "^2.10.16",
|
|
58
58
|
"@blocklet/uploader": "^0.1.20",
|
|
59
59
|
"@mui/icons-material": "^5.16.6",
|
|
60
60
|
"@mui/lab": "^5.0.0-alpha.173",
|
|
61
61
|
"@mui/material": "^5.16.6",
|
|
62
62
|
"@mui/styles": "^5.16.6",
|
|
63
63
|
"@mui/system": "^5.16.6",
|
|
64
|
-
"@ocap/asset": "^1.18.
|
|
65
|
-
"@ocap/client": "^1.18.
|
|
66
|
-
"@ocap/mcrypto": "^1.18.
|
|
67
|
-
"@ocap/util": "^1.18.
|
|
68
|
-
"@ocap/wallet": "^1.18.
|
|
64
|
+
"@ocap/asset": "^1.18.128",
|
|
65
|
+
"@ocap/client": "^1.18.128",
|
|
66
|
+
"@ocap/mcrypto": "^1.18.128",
|
|
67
|
+
"@ocap/util": "^1.18.128",
|
|
68
|
+
"@ocap/wallet": "^1.18.128",
|
|
69
69
|
"@react-pdf/renderer": "^3.4.4",
|
|
70
70
|
"@stripe/react-stripe-js": "^2.7.3",
|
|
71
71
|
"@stripe/stripe-js": "^2.4.0",
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"p-all": "3.0.0",
|
|
98
98
|
"p-wait-for": "3",
|
|
99
99
|
"pretty-ms-i18n": "^1.0.3",
|
|
100
|
-
"react": "
|
|
101
|
-
"react-dom": "
|
|
100
|
+
"react": "18.2.0",
|
|
101
|
+
"react-dom": "18.2.0",
|
|
102
102
|
"react-error-boundary": "^4.0.13",
|
|
103
103
|
"react-hook-form": "^7.52.1",
|
|
104
104
|
"react-international-phone": "^3.1.2",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@abtnode/types": "1.16.28",
|
|
120
120
|
"@arcblock/eslint-config-ts": "^0.3.2",
|
|
121
|
-
"@blocklet/payment-types": "1.14.
|
|
121
|
+
"@blocklet/payment-types": "1.14.22",
|
|
122
122
|
"@types/cookie-parser": "^1.4.7",
|
|
123
123
|
"@types/cors": "^2.8.17",
|
|
124
124
|
"@types/debug": "^4.1.12",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"typescript": "^4.9.5",
|
|
145
145
|
"vite": "^5.3.5",
|
|
146
146
|
"vite-node": "^2.0.4",
|
|
147
|
-
"vite-plugin-blocklet": "^0.8.
|
|
147
|
+
"vite-plugin-blocklet": "^0.8.16",
|
|
148
148
|
"vite-plugin-node-polyfills": "^0.21.0",
|
|
149
149
|
"vite-plugin-svgr": "^4.2.0",
|
|
150
150
|
"vite-tsconfig-paths": "^4.3.2",
|
|
@@ -160,5 +160,5 @@
|
|
|
160
160
|
"parser": "typescript"
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
|
-
"gitHead": "
|
|
163
|
+
"gitHead": "1fabd8f359e12e8ac68b20bd2d0d04b7928d16f3"
|
|
164
164
|
}
|
package/src/app.tsx
CHANGED
|
@@ -2,11 +2,12 @@ import './global.css';
|
|
|
2
2
|
|
|
3
3
|
import Center from '@arcblock/ux/lib/Center';
|
|
4
4
|
import { LocaleProvider } from '@arcblock/ux/lib/Locale/context';
|
|
5
|
-
import {
|
|
5
|
+
// import { createTheme } from '@arcblock/ux/lib/Theme';
|
|
6
6
|
import { ToastProvider } from '@arcblock/ux/lib/Toast';
|
|
7
7
|
import { CircularProgress } from '@mui/material';
|
|
8
8
|
import React, { Suspense } from 'react';
|
|
9
9
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
10
|
+
import { PaymentThemeProvider } from '@blocklet/payment-react';
|
|
10
11
|
import { Navigate, Route, BrowserRouter as Router, Routes } from 'react-router-dom';
|
|
11
12
|
import { joinURL } from 'ufo';
|
|
12
13
|
|
|
@@ -27,18 +28,18 @@ const CustomerSubscriptionEmbed = React.lazy(() => import('./pages/customer/subs
|
|
|
27
28
|
const CustomerSubscriptionChangePlan = React.lazy(() => import('./pages/customer/subscription/change-plan'));
|
|
28
29
|
const CustomerSubscriptionChangePayment = React.lazy(() => import('./pages/customer/subscription/change-payment'));
|
|
29
30
|
|
|
30
|
-
const theme = createTheme({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
31
|
+
// const theme = createTheme({
|
|
32
|
+
// typography: {
|
|
33
|
+
// fontSize: 14,
|
|
34
|
+
// allVariants: {
|
|
35
|
+
// textTransform: 'none',
|
|
36
|
+
// },
|
|
37
|
+
// },
|
|
38
|
+
// });
|
|
38
39
|
|
|
39
40
|
function App() {
|
|
40
41
|
return (
|
|
41
|
-
<
|
|
42
|
+
<PaymentThemeProvider>
|
|
42
43
|
<TransitionProvider>
|
|
43
44
|
<LocaleProvider translations={translations} fallbackLocale="en">
|
|
44
45
|
<ErrorBoundary FallbackComponent={ErrorFallback} onReset={window.location.reload}>
|
|
@@ -59,7 +60,7 @@ function App() {
|
|
|
59
60
|
key="customer-home"
|
|
60
61
|
path="/customer"
|
|
61
62
|
element={
|
|
62
|
-
<Layout>
|
|
63
|
+
<Layout padding="0">
|
|
63
64
|
<CustomerHome />
|
|
64
65
|
</Layout>
|
|
65
66
|
}
|
|
@@ -128,7 +129,7 @@ function App() {
|
|
|
128
129
|
</ErrorBoundary>
|
|
129
130
|
</LocaleProvider>
|
|
130
131
|
</TransitionProvider>
|
|
131
|
-
</
|
|
132
|
+
</PaymentThemeProvider>
|
|
132
133
|
);
|
|
133
134
|
}
|
|
134
135
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import { formatBNStr, usePaymentContext } from '@blocklet/payment-react';
|
|
3
3
|
import type { GroupedBN } from '@blocklet/payment-types';
|
|
4
|
-
import { Stack, Typography } from '@mui/material';
|
|
4
|
+
import { Avatar, Stack, Typography } from '@mui/material';
|
|
5
5
|
import flatten from 'lodash/flatten';
|
|
6
6
|
import isEmpty from 'lodash/isEmpty';
|
|
7
7
|
|
|
8
8
|
type Props = {
|
|
9
9
|
data?: GroupedBN;
|
|
10
|
+
showLogo?: boolean;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export default function BalanceList(props: Props) {
|
|
@@ -26,7 +27,15 @@ export default function BalanceList(props: Props) {
|
|
|
26
27
|
return null;
|
|
27
28
|
}
|
|
28
29
|
return (
|
|
29
|
-
<Stack
|
|
30
|
+
<Stack
|
|
31
|
+
key={currencyId}
|
|
32
|
+
sx={{ width: '100%', maxWidth: '200px' }}
|
|
33
|
+
direction="row"
|
|
34
|
+
spacing={1}
|
|
35
|
+
alignItems="center">
|
|
36
|
+
{props?.showLogo && (
|
|
37
|
+
<Avatar src={currency.logo} alt={currency.symbol} style={{ width: '18px', height: '18px' }} />
|
|
38
|
+
)}
|
|
30
39
|
<Typography sx={{ width: '32px' }} color="text.secondary">
|
|
31
40
|
{currency.symbol}
|
|
32
41
|
</Typography>
|
|
@@ -42,4 +51,5 @@ export default function BalanceList(props: Props) {
|
|
|
42
51
|
|
|
43
52
|
BalanceList.defaultProps = {
|
|
44
53
|
data: {},
|
|
54
|
+
showLogo: false,
|
|
45
55
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CopyButton } from '@arcblock/ux/lib/ClickToCopy';
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import { Stack, Typography } from '@mui/material';
|
|
3
|
+
import { Box, Stack, Typography } from '@mui/material';
|
|
4
4
|
|
|
5
5
|
export default function Copyable({ text, children, style }: { text: string; children?: React.ReactNode; style?: any }) {
|
|
6
6
|
const { locale } = useLocaleContext();
|
|
@@ -13,6 +13,7 @@ export default function Copyable({ text, children, style }: { text: string; chil
|
|
|
13
13
|
<Stack ref={containerRef} direction="row" alignItems="center" color="text.secondary">
|
|
14
14
|
{children || (
|
|
15
15
|
<Typography
|
|
16
|
+
className="copyable-text"
|
|
16
17
|
component="span"
|
|
17
18
|
sx={{
|
|
18
19
|
mr: 0.5,
|
|
@@ -25,7 +26,7 @@ export default function Copyable({ text, children, style }: { text: string; chil
|
|
|
25
26
|
{text}
|
|
26
27
|
</Typography>
|
|
27
28
|
)}
|
|
28
|
-
{copyButton}
|
|
29
|
+
<Box sx={{ height: '1em', mt: '-0.4em' }}>{copyButton}</Box>
|
|
29
30
|
</Stack>
|
|
30
31
|
)}
|
|
31
32
|
/>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-nested-ternary */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import { isValidCountry } from '@blocklet/payment-react';
|
|
4
|
-
import
|
|
5
|
-
import { Button, CircularProgress, Stack } from '@mui/material';
|
|
6
|
-
import type { EventHandler } from 'react';
|
|
4
|
+
import { AddOutlined } from '@mui/icons-material';
|
|
7
5
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
6
|
+
import { Button, CircularProgress } from '@mui/material';
|
|
7
|
+
import type { EventHandler } from 'react';
|
|
8
|
+
import type { TCustomer } from '@blocklet/payment-types';
|
|
9
|
+
|
|
10
|
+
import DrawerForm from '../drawer-form';
|
|
8
11
|
|
|
9
12
|
import CustomerForm from './form';
|
|
10
13
|
|
|
@@ -20,6 +23,7 @@ export default function EditCustomer({
|
|
|
20
23
|
onCancel: EventHandler<any>;
|
|
21
24
|
}) {
|
|
22
25
|
const { t } = useLocaleContext();
|
|
26
|
+
|
|
23
27
|
const methods = useForm<TCustomer>({
|
|
24
28
|
defaultValues: {
|
|
25
29
|
name: data.name || '',
|
|
@@ -49,27 +53,27 @@ export default function EditCustomer({
|
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
return (
|
|
52
|
-
<
|
|
56
|
+
<DrawerForm
|
|
57
|
+
icon={<AddOutlined />}
|
|
58
|
+
text={t('payment.customer.update')}
|
|
59
|
+
width={520}
|
|
60
|
+
addons={null}
|
|
53
61
|
open
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<Button variant="contained" color="primary" size="small" disabled={loading} onClick={onSubmit}>
|
|
66
|
-
{loading && <CircularProgress size="small" />} {t('common.save')}
|
|
67
|
-
</Button>
|
|
68
|
-
</Stack>
|
|
62
|
+
hideLiveMode
|
|
63
|
+
onClose={onCancel}
|
|
64
|
+
footer={
|
|
65
|
+
<Button
|
|
66
|
+
variant="contained"
|
|
67
|
+
color="primary"
|
|
68
|
+
disabled={loading}
|
|
69
|
+
onClick={onSubmit}
|
|
70
|
+
sx={{ width: '100%', mt: 2.5 }}>
|
|
71
|
+
{loading && <CircularProgress size="small" />} {t('common.save')}
|
|
72
|
+
</Button>
|
|
69
73
|
}>
|
|
70
74
|
<FormProvider {...methods}>
|
|
71
75
|
<CustomerForm />
|
|
72
76
|
</FormProvider>
|
|
73
|
-
</
|
|
77
|
+
</DrawerForm>
|
|
74
78
|
);
|
|
75
79
|
}
|
|
@@ -1,24 +1,29 @@
|
|
|
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';
|
|
5
|
-
import {
|
|
4
|
+
import { FormInput, PhoneInput, CountrySelect } from '@blocklet/payment-react';
|
|
5
|
+
import { FormLabel, Stack } from '@mui/material';
|
|
6
6
|
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
7
7
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
8
|
-
import { CountrySelector } from 'react-international-phone';
|
|
9
8
|
import isEmail from 'validator/es/lib/isEmail';
|
|
10
9
|
|
|
11
10
|
const phoneUtil = PhoneNumberUtil.getInstance();
|
|
12
11
|
|
|
13
12
|
export default function CustomerForm() {
|
|
14
13
|
const { t } = useLocaleContext();
|
|
15
|
-
const { control
|
|
14
|
+
const { control } = useFormContext();
|
|
16
15
|
|
|
17
16
|
return (
|
|
18
|
-
<Stack
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
<Stack
|
|
18
|
+
direction="column"
|
|
19
|
+
spacing={1}
|
|
20
|
+
sx={{
|
|
21
|
+
'.MuiFormLabel-root': {
|
|
22
|
+
color: 'text.primary',
|
|
23
|
+
mt: 1,
|
|
24
|
+
mb: 0.5,
|
|
25
|
+
},
|
|
26
|
+
}}>
|
|
22
27
|
<FormInput
|
|
23
28
|
name="name"
|
|
24
29
|
variant="outlined"
|
|
@@ -26,9 +31,7 @@ export default function CustomerForm() {
|
|
|
26
31
|
rules={{
|
|
27
32
|
required: t('payment.checkout.required'),
|
|
28
33
|
}}
|
|
29
|
-
|
|
30
|
-
startAdornment: <InputAdornment position="start">{t('payment.checkout.customer.name')}</InputAdornment>,
|
|
31
|
-
}}
|
|
34
|
+
label={t('payment.checkout.customer.name')}
|
|
32
35
|
/>
|
|
33
36
|
<FormInput
|
|
34
37
|
name="email"
|
|
@@ -38,10 +41,9 @@ export default function CustomerForm() {
|
|
|
38
41
|
required: t('payment.checkout.required'),
|
|
39
42
|
validate: (x) => (isEmail(x) ? true : t('payment.checkout.invalid')),
|
|
40
43
|
}}
|
|
41
|
-
|
|
42
|
-
startAdornment: <InputAdornment position="start">{t('payment.checkout.customer.email')}</InputAdornment>,
|
|
43
|
-
}}
|
|
44
|
+
label={t('payment.checkout.customer.email')}
|
|
44
45
|
/>
|
|
46
|
+
<FormLabel className="base-label">{t('payment.checkout.customer.phone')}</FormLabel>
|
|
45
47
|
<PhoneInput
|
|
46
48
|
name="phone"
|
|
47
49
|
variant="outlined"
|
|
@@ -62,20 +64,8 @@ export default function CustomerForm() {
|
|
|
62
64
|
}}
|
|
63
65
|
/>
|
|
64
66
|
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
</Typography>
|
|
68
|
-
<Controller
|
|
69
|
-
name="address.country"
|
|
70
|
-
control={control}
|
|
71
|
-
render={({ field }) => (
|
|
72
|
-
<CountrySelector
|
|
73
|
-
selectedCountry={field.value}
|
|
74
|
-
onSelect={({ iso2 }) => setValue(field.name, iso2)}
|
|
75
|
-
buttonStyle={{}}
|
|
76
|
-
/>
|
|
77
|
-
)}
|
|
78
|
-
/>
|
|
67
|
+
<FormLabel className="base-label">{t('payment.checkout.billing.required')}</FormLabel>
|
|
68
|
+
<Controller name="address.country" control={control} render={({ field }) => <CountrySelect {...field} />} />
|
|
79
69
|
<FormInput
|
|
80
70
|
name="address.state"
|
|
81
71
|
variant="outlined"
|
|
@@ -7,7 +7,6 @@ export default function CustomerLink({ customer, linked }: { customer: TCustomer
|
|
|
7
7
|
if (!customer) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
if (linked) {
|
|
12
11
|
return (
|
|
13
12
|
<Link to={`/admin/customers/${customer.id}`}>
|
|
@@ -24,7 +23,7 @@ export default function CustomerLink({ customer, linked }: { customer: TCustomer
|
|
|
24
23
|
<InfoCard
|
|
25
24
|
logo={`/.well-known/service/user/avatar/${customer.did}?imageFilter=resize&w=48&h=48`}
|
|
26
25
|
name={customer.email}
|
|
27
|
-
description={customer
|
|
26
|
+
description={<span style={{ wordBreak: 'break-all' }}>{customer?.did}</span>}
|
|
28
27
|
/>
|
|
29
28
|
);
|
|
30
29
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DateRangePicker as DatePicker } from 'mui-daterange-picker';
|
|
2
|
+
import type { DateRangePickerWrapperProps } from 'mui-daterange-picker/dist/components/DateRangePickerWrapper';
|
|
3
|
+
import { ThemeProvider, useTheme } from '@mui/material/styles';
|
|
4
|
+
import { create } from '@arcblock/ux/lib/Theme';
|
|
5
|
+
|
|
6
|
+
export default function DateRangePicker(props: DateRangePickerWrapperProps) {
|
|
7
|
+
const theme = useTheme();
|
|
8
|
+
const merged = create({
|
|
9
|
+
...theme,
|
|
10
|
+
palette: {
|
|
11
|
+
primary: {
|
|
12
|
+
main: '#0086FF',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
return (
|
|
17
|
+
<ThemeProvider theme={merged}>
|
|
18
|
+
<DatePicker {...props} wrapperClassName="date-range-picker" />
|
|
19
|
+
</ThemeProvider>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -15,6 +15,8 @@ type Props = {
|
|
|
15
15
|
open?: boolean;
|
|
16
16
|
style?: Record<string, any>;
|
|
17
17
|
onClose?: Function;
|
|
18
|
+
hideLiveMode?: boolean;
|
|
19
|
+
footer?: React.ReactNode;
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
DrawerForm.defaultProps = {
|
|
@@ -22,6 +24,8 @@ DrawerForm.defaultProps = {
|
|
|
22
24
|
open: false,
|
|
23
25
|
width: 960,
|
|
24
26
|
onClose: noop,
|
|
27
|
+
hideLiveMode: false,
|
|
28
|
+
footer: null,
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
export default function DrawerForm(props: Props) {
|
|
@@ -55,17 +59,18 @@ export default function DrawerForm(props: Props) {
|
|
|
55
59
|
direction="row"
|
|
56
60
|
alignItems="center"
|
|
57
61
|
justifyContent="space-between"
|
|
58
|
-
|
|
62
|
+
className="drawer-form-header-wrapper"
|
|
63
|
+
sx={{ pl: 3, pr: 3, pb: 2, pt: 2, borderBottom: '1px solid var(--stroke-sep, #EFF1F5)' }}>
|
|
59
64
|
<Stack direction="row" alignItems="center">
|
|
60
65
|
<Typography className="drawer-form-header" variant="h6" sx={{ fontWeight: 600 }}>
|
|
61
66
|
{props.text}
|
|
62
67
|
</Typography>
|
|
63
|
-
{!settings.livemode && <Livemode />}
|
|
68
|
+
{!settings.livemode && !props.hideLiveMode && <Livemode />}
|
|
64
69
|
</Stack>
|
|
65
70
|
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
|
66
71
|
<Close
|
|
67
72
|
sx={{ mr: props.addons ? 1 : 0, color: 'text.secondary', cursor: 'pointer' }}
|
|
68
|
-
onClick={
|
|
73
|
+
onClick={handleClose}
|
|
69
74
|
/>
|
|
70
75
|
{props.addons && <Divider orientation="vertical" flexItem sx={{ mr: 2 }} />}
|
|
71
76
|
{props.addons}
|
|
@@ -74,6 +79,7 @@ export default function DrawerForm(props: Props) {
|
|
|
74
79
|
<Box className="drawer-form-body" sx={{ mx: 3, my: 2 }}>
|
|
75
80
|
{props.children}
|
|
76
81
|
</Box>
|
|
82
|
+
<Box className="drawer-form-footer">{props.footer}</Box>
|
|
77
83
|
</Container>
|
|
78
84
|
</>
|
|
79
85
|
);
|
|
@@ -81,8 +87,25 @@ export default function DrawerForm(props: Props) {
|
|
|
81
87
|
|
|
82
88
|
const Container = styled<any>(Drawer)`
|
|
83
89
|
> .MuiPaper-root {
|
|
84
|
-
width:
|
|
90
|
+
width: 100%;
|
|
85
91
|
min-width: 360px;
|
|
86
92
|
max-width: ${(props) => props.width}px;
|
|
87
93
|
}
|
|
94
|
+
.drawer-form-footer {
|
|
95
|
+
padding: 0 20px 24px;
|
|
96
|
+
background: #fff;
|
|
97
|
+
}
|
|
98
|
+
@media (max-width: ${({ theme }) => theme.breakpoints.values.sm}px) {
|
|
99
|
+
.drawer-form-header-wrapper {
|
|
100
|
+
position: sticky;
|
|
101
|
+
top: 0;
|
|
102
|
+
background: #fff;
|
|
103
|
+
z-index: 999;
|
|
104
|
+
}
|
|
105
|
+
.drawer-form-footer {
|
|
106
|
+
position: sticky;
|
|
107
|
+
bottom: 0;
|
|
108
|
+
z-index: 999;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
88
111
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { api, formatTime } from '@blocklet/payment-react';
|
|
4
|
+
import { api, formatTime, Table } from '@blocklet/payment-react';
|
|
5
5
|
import type { TEventExpanded } from '@blocklet/payment-types';
|
|
6
6
|
import { Alert, CircularProgress, Typography } from '@mui/material';
|
|
7
7
|
import { useRequest } from 'ahooks';
|
|
@@ -9,7 +9,6 @@ import { useEffect, useState } from 'react';
|
|
|
9
9
|
import { useNavigate } from 'react-router-dom';
|
|
10
10
|
|
|
11
11
|
import { useTransitionContext } from '../progress-bar';
|
|
12
|
-
import Table from '../table';
|
|
13
12
|
|
|
14
13
|
const fetchData = (params: Record<string, any> = {}): Promise<{ list: TEventExpanded[]; count: number }> => {
|
|
15
14
|
const search = new URLSearchParams();
|
|
@@ -177,6 +176,7 @@ export default function EventList({ type, object_id, features }: ListProps) {
|
|
|
177
176
|
{
|
|
178
177
|
label: t('common.createdAt'),
|
|
179
178
|
name: 'created_at',
|
|
179
|
+
minWidth: 100,
|
|
180
180
|
options: {
|
|
181
181
|
customBodyRender: (e: string) => {
|
|
182
182
|
return formatTime(e);
|
|
@@ -213,6 +213,7 @@ export default function EventList({ type, object_id, features }: ListProps) {
|
|
|
213
213
|
},
|
|
214
214
|
}}
|
|
215
215
|
toolbar={features?.toolbar}
|
|
216
|
+
emptyNodeText={t('empty.events')}
|
|
216
217
|
/>
|
|
217
218
|
);
|
|
218
219
|
}
|
|
@@ -39,10 +39,11 @@ type Props = {
|
|
|
39
39
|
currency?: boolean;
|
|
40
40
|
setSearch: (x: any) => void;
|
|
41
41
|
donation?: string[];
|
|
42
|
+
formatStatus?: (x: string) => string;
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
export default function FilterToolbar(props: Props) {
|
|
45
|
-
const { setSearch, search, status, currency, donation } = props;
|
|
46
|
+
const { setSearch, search, status, currency, donation, formatStatus = (v) => v } = props;
|
|
46
47
|
const isProduct = window.location.pathname.includes('product');
|
|
47
48
|
const handleSearch = (obj: any) => {
|
|
48
49
|
setSearch({
|
|
@@ -54,7 +55,7 @@ export default function FilterToolbar(props: Props) {
|
|
|
54
55
|
return (
|
|
55
56
|
<Root>
|
|
56
57
|
<Box className="table-toolbar-left">
|
|
57
|
-
<SearchStatus setSearch={handleSearch} search={search} status={status} />
|
|
58
|
+
<SearchStatus setSearch={handleSearch} search={search} status={status} formatStatus={formatStatus} />
|
|
58
59
|
{Array.isArray(donation) && donation.length > 0 && (
|
|
59
60
|
<SearchDonation setSearch={handleSearch} search={search} donation={donation} />
|
|
60
61
|
)}
|
|
@@ -78,6 +79,7 @@ const defaultProps = {
|
|
|
78
79
|
status: [],
|
|
79
80
|
currency: false,
|
|
80
81
|
donation: [],
|
|
82
|
+
formatStatus: (v: string) => v,
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
FilterToolbar.defaultProps = defaultProps;
|
|
@@ -87,7 +89,12 @@ SearchProducts.defaultProps = defaultProps;
|
|
|
87
89
|
SearchCustomers.defaultProps = defaultProps;
|
|
88
90
|
SearchDonation.defaultProps = defaultProps;
|
|
89
91
|
|
|
90
|
-
function SearchStatus({
|
|
92
|
+
function SearchStatus({
|
|
93
|
+
status = [],
|
|
94
|
+
search,
|
|
95
|
+
setSearch,
|
|
96
|
+
formatStatus,
|
|
97
|
+
}: Pick<Props, 'status' | 'search' | 'setSearch' | 'formatStatus'>) {
|
|
91
98
|
const [show, setShow] = useState(null);
|
|
92
99
|
const { t } = useLocaleContext();
|
|
93
100
|
return (
|
|
@@ -131,7 +138,7 @@ function SearchStatus({ status = [], search, setSearch }: Pick<Props, 'status' |
|
|
|
131
138
|
setShow(null);
|
|
132
139
|
}}
|
|
133
140
|
key={x}>
|
|
134
|
-
{x}
|
|
141
|
+
{formatStatus ? formatStatus(x) : x}
|
|
135
142
|
</MenuItem>
|
|
136
143
|
))}
|
|
137
144
|
</Menu>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Avatar, Stack, Typography } from '@mui/material';
|
|
1
|
+
import { Avatar, Stack, SxProps, Typography } from '@mui/material';
|
|
2
2
|
import type { LiteralUnion } from 'type-fest';
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
@@ -7,11 +7,12 @@ type Props = {
|
|
|
7
7
|
description: any;
|
|
8
8
|
size?: number;
|
|
9
9
|
variant?: LiteralUnion<'square' | 'rounded' | 'circular', string>;
|
|
10
|
+
sx?: SxProps;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
// FIXME: @wangshijun add image filter for logo
|
|
13
14
|
export default function InfoCard(props: Props) {
|
|
14
|
-
const dimensions = { width: props.size, height: props.size };
|
|
15
|
+
const dimensions = { width: props.size, height: props.size, ...props.sx };
|
|
15
16
|
return (
|
|
16
17
|
<Stack direction="row" alignItems="center" spacing={1}>
|
|
17
18
|
{props.logo ? (
|
|
@@ -37,4 +38,5 @@ InfoCard.defaultProps = {
|
|
|
37
38
|
logo: '',
|
|
38
39
|
size: 40,
|
|
39
40
|
variant: 'rounded',
|
|
41
|
+
sx: {},
|
|
40
42
|
};
|
|
@@ -12,7 +12,7 @@ export default function InfoMetric(props: Props) {
|
|
|
12
12
|
return (
|
|
13
13
|
<>
|
|
14
14
|
<Stack direction="column" alignItems="flex-start">
|
|
15
|
-
<Typography component="div" variant="body1" mb={1} color="text.
|
|
15
|
+
<Typography component="div" variant="body1" mb={1} color="text.primary" sx={{ fontWeight: 500 }}>
|
|
16
16
|
{props.label}
|
|
17
17
|
{!!props.tip && (
|
|
18
18
|
<Tooltip title={props.tip}>
|
|
@@ -20,7 +20,7 @@ export default function InfoMetric(props: Props) {
|
|
|
20
20
|
</Tooltip>
|
|
21
21
|
)}
|
|
22
22
|
</Typography>
|
|
23
|
-
<Typography component="div" variant="body1" color="text.
|
|
23
|
+
<Typography component="div" variant="body1" color="text.secondary" sx={{ width: '100%' }}>
|
|
24
24
|
{props.value}
|
|
25
25
|
</Typography>
|
|
26
26
|
</Stack>
|