payment-kit 1.18.37 → 1.18.38
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 +17 -17
- package/src/app.tsx +124 -125
- package/src/components/chart.tsx +19 -5
- package/src/components/customer/notification-preference.tsx +6 -5
- package/src/components/date-range-picker.tsx +1 -16
- package/src/components/drawer-form.tsx +4 -3
- package/src/components/filter-toolbar.tsx +49 -34
- package/src/components/info-card.tsx +9 -7
- package/src/components/invoice-pdf/pdf.tsx +1 -1
- package/src/components/layout/admin.tsx +2 -2
- package/src/components/metadata/form.tsx +3 -2
- package/src/components/metadata/list.tsx +1 -1
- package/src/components/payment-link/chrome.tsx +0 -1
- package/src/components/payment-link/item.tsx +1 -1
- package/src/components/payment-link/preview.tsx +3 -1
- package/src/components/price/currency-select.tsx +1 -1
- package/src/components/pricing-table/payment-settings.tsx +1 -1
- package/src/components/pricing-table/preview.tsx +3 -1
- package/src/components/pricing-table/product-item.tsx +1 -1
- package/src/components/subscription/portal/list.tsx +2 -2
- package/src/components/uploader.tsx +2 -1
- package/src/components/webhook/attempts.tsx +1 -1
- package/src/global.css +0 -7
- package/src/pages/admin/developers/webhooks/detail.tsx +2 -2
- package/src/pages/admin/index.tsx +2 -2
- package/src/pages/admin/overview.tsx +1 -1
- package/src/pages/admin/payments/intents/detail.tsx +1 -1
- package/src/pages/admin/payments/payouts/detail.tsx +1 -1
- package/src/pages/admin/payments/refunds/detail.tsx +1 -1
- package/src/pages/admin/products/prices/list.tsx +7 -2
- package/src/pages/admin/products/pricing-tables/create.tsx +2 -2
- package/src/pages/admin/settings/payment-methods/index.tsx +7 -4
- package/src/pages/admin/settings/vault-config/index.tsx +3 -2
- package/src/pages/checkout/pricing-table.tsx +1 -1
- package/src/pages/customer/index.tsx +4 -3
- package/src/pages/customer/invoice/detail.tsx +1 -1
- package/src/pages/customer/payout/detail.tsx +1 -1
- package/src/pages/customer/recharge/account.tsx +3 -4
- package/src/pages/customer/recharge/subscription.tsx +3 -4
- package/src/pages/customer/subscription/embed.tsx +2 -2
- package/src/pages/integrations/donations/preview.tsx +12 -10
- package/src/pages/integrations/index.tsx +1 -1
- package/src/pages/integrations/overview.tsx +2 -4
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.38",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -45,30 +45,30 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@abtnode/cron": "^1.16.42",
|
|
48
|
-
"@arcblock/did": "^1.20.
|
|
48
|
+
"@arcblock/did": "^1.20.4",
|
|
49
49
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
50
|
-
"@arcblock/did-connect": "^2.13.
|
|
51
|
-
"@arcblock/did-util": "^1.20.
|
|
52
|
-
"@arcblock/jwt": "^1.20.
|
|
53
|
-
"@arcblock/ux": "^2.13.
|
|
54
|
-
"@arcblock/validator": "^1.20.
|
|
50
|
+
"@arcblock/did-connect": "^2.13.18",
|
|
51
|
+
"@arcblock/did-util": "^1.20.4",
|
|
52
|
+
"@arcblock/jwt": "^1.20.4",
|
|
53
|
+
"@arcblock/ux": "^2.13.18",
|
|
54
|
+
"@arcblock/validator": "^1.20.4",
|
|
55
55
|
"@blocklet/did-space-js": "^1.0.48",
|
|
56
56
|
"@blocklet/js-sdk": "^1.16.42",
|
|
57
57
|
"@blocklet/logger": "^1.16.42",
|
|
58
|
-
"@blocklet/payment-react": "1.18.
|
|
58
|
+
"@blocklet/payment-react": "1.18.38",
|
|
59
59
|
"@blocklet/sdk": "^1.16.42",
|
|
60
|
-
"@blocklet/ui-react": "^2.13.
|
|
60
|
+
"@blocklet/ui-react": "^2.13.18",
|
|
61
61
|
"@blocklet/uploader": "^0.1.84",
|
|
62
62
|
"@blocklet/xss": "^0.1.33",
|
|
63
63
|
"@mui/icons-material": "^5.16.6",
|
|
64
64
|
"@mui/lab": "^5.0.0-alpha.173",
|
|
65
65
|
"@mui/material": "^5.16.6",
|
|
66
66
|
"@mui/system": "^5.16.6",
|
|
67
|
-
"@ocap/asset": "^1.20.
|
|
68
|
-
"@ocap/client": "^1.20.
|
|
69
|
-
"@ocap/mcrypto": "^1.20.
|
|
70
|
-
"@ocap/util": "^1.20.
|
|
71
|
-
"@ocap/wallet": "^1.20.
|
|
67
|
+
"@ocap/asset": "^1.20.4",
|
|
68
|
+
"@ocap/client": "^1.20.4",
|
|
69
|
+
"@ocap/mcrypto": "^1.20.4",
|
|
70
|
+
"@ocap/util": "^1.20.4",
|
|
71
|
+
"@ocap/wallet": "^1.20.4",
|
|
72
72
|
"@stripe/react-stripe-js": "^2.7.3",
|
|
73
73
|
"@stripe/stripe-js": "^2.4.0",
|
|
74
74
|
"ahooks": "^3.8.0",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"devDependencies": {
|
|
124
124
|
"@abtnode/types": "^1.16.42",
|
|
125
125
|
"@arcblock/eslint-config-ts": "^0.3.3",
|
|
126
|
-
"@blocklet/payment-types": "1.18.
|
|
126
|
+
"@blocklet/payment-types": "1.18.38",
|
|
127
127
|
"@types/cookie-parser": "^1.4.7",
|
|
128
128
|
"@types/cors": "^2.8.17",
|
|
129
129
|
"@types/debug": "^4.1.12",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"vite": "^5.3.5",
|
|
154
154
|
"vite-node": "^2.0.4",
|
|
155
155
|
"vite-plugin-babel-import": "^2.0.5",
|
|
156
|
-
"vite-plugin-blocklet": "^0.9.
|
|
156
|
+
"vite-plugin-blocklet": "^0.9.32",
|
|
157
157
|
"vite-plugin-node-polyfills": "^0.21.0",
|
|
158
158
|
"vite-plugin-svgr": "^4.2.0",
|
|
159
159
|
"vite-tsconfig-paths": "^4.3.2",
|
|
@@ -169,5 +169,5 @@
|
|
|
169
169
|
"parser": "typescript"
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
|
-
"gitHead": "
|
|
172
|
+
"gitHead": "c273fb068cea55d95017c8b9672f30d5d6c60167"
|
|
173
173
|
}
|
package/src/app.tsx
CHANGED
|
@@ -2,8 +2,7 @@ import './global.css';
|
|
|
2
2
|
|
|
3
3
|
import Center from '@arcblock/ux/lib/Center';
|
|
4
4
|
import withTracker from '@arcblock/ux/lib/withTracker';
|
|
5
|
-
import {
|
|
6
|
-
// import { createTheme } from '@arcblock/ux/lib/Theme';
|
|
5
|
+
import { ConfigProvider } from '@arcblock/ux/lib/Config';
|
|
7
6
|
import { ToastProvider } from '@arcblock/ux/lib/Toast';
|
|
8
7
|
import { CircularProgress } from '@mui/material';
|
|
9
8
|
import React, { Suspense } from 'react';
|
|
@@ -45,118 +44,116 @@ const CustomerBalanceRecharge = React.lazy(() => import('./pages/customer/rechar
|
|
|
45
44
|
function App() {
|
|
46
45
|
return (
|
|
47
46
|
<TransitionProvider>
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
</ErrorBoundary>
|
|
159
|
-
</LocaleProvider>
|
|
47
|
+
<ErrorBoundary FallbackComponent={ErrorFallback} onReset={window.location.reload}>
|
|
48
|
+
<Suspense
|
|
49
|
+
fallback={
|
|
50
|
+
<Center>
|
|
51
|
+
<CircularProgress />
|
|
52
|
+
</Center>
|
|
53
|
+
}>
|
|
54
|
+
<Routes>
|
|
55
|
+
<Route path="/" element={<HomePage />} />
|
|
56
|
+
<Route path="/checkout/:action/:id" element={<CheckoutPage />} />
|
|
57
|
+
<Route key="admin-index" path="/admin" element={<AdminPage />} />,
|
|
58
|
+
<Route key="admin-tabs" path="/admin/:group" element={<AdminPage />} />,
|
|
59
|
+
<Route key="admin-sub" path="/admin/:group/:page" element={<AdminPage />} />,
|
|
60
|
+
<Route key="admin-fallback" path="/admin/*" element={<AdminPage />} />,
|
|
61
|
+
<Route key="integrations-index" path="/integrations" element={<IntegrationsPage />} />
|
|
62
|
+
<Route key="integrations-tabs" path="/integrations/:group" element={<IntegrationsPage />} />
|
|
63
|
+
<Route key="integrations-sub" path="/integrations/:group/:page" element={<IntegrationsPage />} />
|
|
64
|
+
<Route key="integrations-fallback" path="/integrations/*" element={<IntegrationsPage />} />
|
|
65
|
+
<Route
|
|
66
|
+
key="customer-home"
|
|
67
|
+
path="/customer"
|
|
68
|
+
element={
|
|
69
|
+
<UserLayout>
|
|
70
|
+
<CustomerHome />
|
|
71
|
+
</UserLayout>
|
|
72
|
+
}
|
|
73
|
+
/>
|
|
74
|
+
<Route
|
|
75
|
+
key="customer-subscription"
|
|
76
|
+
path="/customer/subscription/:id"
|
|
77
|
+
element={
|
|
78
|
+
<UserLayout>
|
|
79
|
+
<CustomerSubscriptionDetail />
|
|
80
|
+
</UserLayout>
|
|
81
|
+
}
|
|
82
|
+
/>
|
|
83
|
+
<Route
|
|
84
|
+
key="customer-subscription-change-plan"
|
|
85
|
+
path="/customer/subscription/:id/change-plan"
|
|
86
|
+
element={
|
|
87
|
+
<UserLayout>
|
|
88
|
+
<CustomerSubscriptionChangePlan />
|
|
89
|
+
</UserLayout>
|
|
90
|
+
}
|
|
91
|
+
/>
|
|
92
|
+
<Route
|
|
93
|
+
key="customer-subscription-change-payment"
|
|
94
|
+
path="/customer/subscription/:id/change-payment"
|
|
95
|
+
element={
|
|
96
|
+
<UserLayout>
|
|
97
|
+
<CustomerSubscriptionChangePayment />
|
|
98
|
+
</UserLayout>
|
|
99
|
+
}
|
|
100
|
+
/>
|
|
101
|
+
<Route
|
|
102
|
+
key="customer-recharge"
|
|
103
|
+
path="/customer/subscription/:id/recharge"
|
|
104
|
+
element={
|
|
105
|
+
<UserLayout>
|
|
106
|
+
<CustomerRecharge />
|
|
107
|
+
</UserLayout>
|
|
108
|
+
}
|
|
109
|
+
/>
|
|
110
|
+
<Route
|
|
111
|
+
key="customer-balance-recharge"
|
|
112
|
+
path="/customer/recharge/:currencyId"
|
|
113
|
+
element={
|
|
114
|
+
<UserLayout>
|
|
115
|
+
<CustomerBalanceRecharge />
|
|
116
|
+
</UserLayout>
|
|
117
|
+
}
|
|
118
|
+
/>
|
|
119
|
+
<Route key="customer-embed" path="/customer/embed/subscription" element={<CustomerSubscriptionEmbed />} />
|
|
120
|
+
<Route
|
|
121
|
+
key="subscription-embed"
|
|
122
|
+
path="/embed/customer/subscription"
|
|
123
|
+
element={<CustomerSubscriptionEmbed />}
|
|
124
|
+
/>
|
|
125
|
+
<Route
|
|
126
|
+
key="customer-due"
|
|
127
|
+
path="/customer/invoice/past-due"
|
|
128
|
+
element={
|
|
129
|
+
<UserLayout>
|
|
130
|
+
<CustomerInvoicePastDue />
|
|
131
|
+
</UserLayout>
|
|
132
|
+
}
|
|
133
|
+
/>
|
|
134
|
+
<Route
|
|
135
|
+
key="customer-invoice"
|
|
136
|
+
path="/customer/invoice/:id"
|
|
137
|
+
element={
|
|
138
|
+
<UserLayout>
|
|
139
|
+
<CustomerInvoiceDetail />
|
|
140
|
+
</UserLayout>
|
|
141
|
+
}
|
|
142
|
+
/>
|
|
143
|
+
<Route
|
|
144
|
+
key="customer-payout"
|
|
145
|
+
path="/customer/payout/:id"
|
|
146
|
+
element={
|
|
147
|
+
<UserLayout>
|
|
148
|
+
<CustomerPayoutDetail />
|
|
149
|
+
</UserLayout>
|
|
150
|
+
}
|
|
151
|
+
/>
|
|
152
|
+
<Route key="customer-fallback" path="/customer/*" element={<Navigate to="/customer" />} />,
|
|
153
|
+
<Route path="*" element={<Navigate to="/" />} />
|
|
154
|
+
</Routes>
|
|
155
|
+
</Suspense>
|
|
156
|
+
</ErrorBoundary>
|
|
160
157
|
</TransitionProvider>
|
|
161
158
|
);
|
|
162
159
|
}
|
|
@@ -170,16 +167,18 @@ export default function WrappedApp() {
|
|
|
170
167
|
usePreventWheel();
|
|
171
168
|
|
|
172
169
|
return (
|
|
173
|
-
<
|
|
174
|
-
<
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
170
|
+
<ConfigProvider translations={translations} fallbackLocale="en">
|
|
171
|
+
<ToastProvider>
|
|
172
|
+
<PaymentThemeProvider>
|
|
173
|
+
<SessionProvider
|
|
174
|
+
serviceHost={prefix}
|
|
175
|
+
protectedRoutes={['/admin/*', '/customer/*', '/integrations/*'].map((item) => joinURL(prefix, item))}>
|
|
176
|
+
<Router basename={prefix}>
|
|
177
|
+
<AppWithTracker />
|
|
178
|
+
</Router>
|
|
179
|
+
</SessionProvider>
|
|
180
|
+
</PaymentThemeProvider>
|
|
181
|
+
</ToastProvider>
|
|
182
|
+
</ConfigProvider>
|
|
184
183
|
);
|
|
185
184
|
}
|
package/src/components/chart.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/require-default-props */
|
|
2
2
|
import type { TPaymentCurrency, TPaymentMethod } from '@blocklet/payment-types';
|
|
3
|
-
import { Box, Skeleton } from '@mui/material';
|
|
3
|
+
import { Box, Skeleton, useTheme } from '@mui/material';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { Area, AreaChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
|
|
6
6
|
|
|
@@ -18,6 +18,7 @@ export default function Chart({
|
|
|
18
18
|
currencies: TCurrencyMap;
|
|
19
19
|
height?: number;
|
|
20
20
|
}) {
|
|
21
|
+
const theme = useTheme();
|
|
21
22
|
const [series, setSeries] = useState<any>(
|
|
22
23
|
Object.keys(currencies).reduce(
|
|
23
24
|
(acc, key) => {
|
|
@@ -60,8 +61,10 @@ export default function Chart({
|
|
|
60
61
|
left: 0,
|
|
61
62
|
bottom: 0,
|
|
62
63
|
}}>
|
|
63
|
-
<CartesianGrid strokeDasharray="3 3" />
|
|
64
|
-
<Tooltip
|
|
64
|
+
<CartesianGrid strokeDasharray="3 3" stroke={theme.palette.grey[200]} />
|
|
65
|
+
<Tooltip
|
|
66
|
+
contentStyle={{ backgroundColor: theme.palette.background.paper, borderColor: theme.palette.grey[200] }}
|
|
67
|
+
/>
|
|
65
68
|
{Object.keys(currencies).map((x: string, i) => {
|
|
66
69
|
const dataKey = currencies[x]?.symbol as string;
|
|
67
70
|
const color = currencies[x]?.color as string;
|
|
@@ -84,8 +87,19 @@ export default function Chart({
|
|
|
84
87
|
onMouseOver={onMouseOver}
|
|
85
88
|
onMouseOut={onMouseOut}
|
|
86
89
|
/>
|
|
87
|
-
<XAxis
|
|
88
|
-
|
|
90
|
+
<XAxis
|
|
91
|
+
dataKey="timestamp"
|
|
92
|
+
tick={{ fill: theme.palette.text.secondary }}
|
|
93
|
+
stroke={theme.palette.text.secondary}
|
|
94
|
+
/>
|
|
95
|
+
<YAxis
|
|
96
|
+
orientation="left"
|
|
97
|
+
mirror
|
|
98
|
+
tickLine
|
|
99
|
+
tickMargin={2}
|
|
100
|
+
tick={{ fill: theme.palette.text.secondary }}
|
|
101
|
+
stroke={theme.palette.text.secondary}
|
|
102
|
+
/>
|
|
89
103
|
</AreaChart>
|
|
90
104
|
</ResponsiveContainer>
|
|
91
105
|
</Box>
|
|
@@ -79,6 +79,9 @@ function TimeSelector({
|
|
|
79
79
|
size="small"
|
|
80
80
|
sx={{
|
|
81
81
|
minWidth: 'fit-content',
|
|
82
|
+
'& input::-webkit-calendar-picker-indicator': {
|
|
83
|
+
filter: (theme) => (theme.palette.mode === 'dark' ? 'invert(1) brightness(80%)' : 'none'),
|
|
84
|
+
},
|
|
82
85
|
}}
|
|
83
86
|
{...field}
|
|
84
87
|
error={!!fieldState.error}
|
|
@@ -122,18 +125,16 @@ function DaySelector({
|
|
|
122
125
|
display: 'flex',
|
|
123
126
|
alignItems: 'center',
|
|
124
127
|
justifyContent: 'space-between',
|
|
125
|
-
backgroundColor: '
|
|
128
|
+
backgroundColor: 'grey.50',
|
|
126
129
|
'&:hover, &:focus': {
|
|
127
130
|
borderColor: 'primary.main',
|
|
128
131
|
},
|
|
132
|
+
color: 'text.secondary',
|
|
129
133
|
}}
|
|
130
134
|
size="large"
|
|
131
135
|
startIcon={<DateRangeOutlined fontSize="small" color="action" sx={{ fontSize: '1rem !important' }} />}
|
|
132
136
|
endIcon={
|
|
133
|
-
<Typography
|
|
134
|
-
variant="caption"
|
|
135
|
-
color="text.secondary"
|
|
136
|
-
sx={{ fontSize: '0.75rem !important', lineHeight: 'normal' }}>
|
|
137
|
+
<Typography variant="caption" color="action" sx={{ fontSize: '0.75rem !important', lineHeight: 'normal' }}>
|
|
137
138
|
{t('notification.preferences.day')}
|
|
138
139
|
</Typography>
|
|
139
140
|
}>
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { DateRangePicker as DatePicker } from 'mui-daterange-picker';
|
|
2
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
3
|
|
|
6
4
|
export default function DateRangePicker(props: DateRangePickerWrapperProps) {
|
|
7
|
-
|
|
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
|
-
);
|
|
5
|
+
return <DatePicker {...props} wrapperClassName="date-range-picker" />;
|
|
21
6
|
}
|
|
@@ -68,7 +68,8 @@ export default function DrawerForm(props: Props) {
|
|
|
68
68
|
pb: 2,
|
|
69
69
|
pt: 2,
|
|
70
70
|
gap: 1,
|
|
71
|
-
borderBottom: '1px solid
|
|
71
|
+
borderBottom: '1px solid',
|
|
72
|
+
borderColor: 'grey.200',
|
|
72
73
|
'@media (max-width: 600px)': {
|
|
73
74
|
'& > .addons-wrapper': {
|
|
74
75
|
width: '100%',
|
|
@@ -120,13 +121,13 @@ const Container = styled<any>(Drawer)`
|
|
|
120
121
|
}
|
|
121
122
|
.drawer-form-footer {
|
|
122
123
|
padding: 0 20px 24px;
|
|
123
|
-
background:
|
|
124
|
+
background: ${({ theme }) => theme.palette.background.paper};
|
|
124
125
|
}
|
|
125
126
|
@media (max-width: ${({ theme }) => theme.breakpoints.values.sm}px) {
|
|
126
127
|
.drawer-form-header-wrapper {
|
|
127
128
|
position: sticky;
|
|
128
129
|
top: 0;
|
|
129
|
-
background:
|
|
130
|
+
background: ${({ theme }) => theme.palette.background.paper};
|
|
130
131
|
z-index: 999;
|
|
131
132
|
}
|
|
132
133
|
.drawer-form-footer {
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
} from '@blocklet/payment-react';
|
|
10
10
|
import type { TCustomer } from '@blocklet/payment-types';
|
|
11
11
|
import { Add, Close } from '@mui/icons-material';
|
|
12
|
-
import { Button, Menu, MenuItem } from '@mui/material';
|
|
12
|
+
import { Button, Menu, MenuItem, TextField } from '@mui/material';
|
|
13
13
|
import { Box, styled } from '@mui/system';
|
|
14
14
|
import { useEffect, useState } from 'react';
|
|
15
15
|
|
|
16
16
|
import { flatten } from 'lodash';
|
|
17
|
+
import { useRequest } from 'ahooks';
|
|
17
18
|
import { ProductsProvider, useProductsContext } from '../contexts/products';
|
|
18
19
|
import InfoCard from './info-card';
|
|
19
20
|
import ProductSelect from './payment-link/product-select';
|
|
@@ -236,28 +237,43 @@ function SearchCurrency({ setSearch, search }: Pick<Props, 'setSearch' | 'search
|
|
|
236
237
|
function SearchCustomers({ setSearch, search }: Pick<Props, 'setSearch' | 'search'>) {
|
|
237
238
|
const [customers, setCustomers] = useState<TCustomer[]>([]);
|
|
238
239
|
const [show, setShow] = useState(null);
|
|
239
|
-
const [
|
|
240
|
+
const [searchText, setSearchText] = useState('');
|
|
240
241
|
const { t } = useLocaleContext();
|
|
241
242
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
243
|
+
const customerRequest = useRequest(
|
|
244
|
+
(text: string) => {
|
|
245
|
+
return fetchUserData({
|
|
246
|
+
q: {
|
|
247
|
+
'like-name': text,
|
|
248
|
+
'like-email': text,
|
|
249
|
+
'like-did': text,
|
|
250
|
+
'like-metadata': text,
|
|
251
|
+
'like-phone': text,
|
|
252
|
+
},
|
|
253
|
+
page: 1,
|
|
254
|
+
pageSize: 10,
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
onSuccess: (data) => {
|
|
259
|
+
setCustomers(data.list);
|
|
250
260
|
},
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
261
|
+
debounceWait: 500,
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
useEffect(() => {
|
|
266
|
+
customerRequest.run(searchText);
|
|
267
|
+
}, [searchText]);
|
|
257
268
|
|
|
258
269
|
return (
|
|
259
|
-
<section
|
|
260
|
-
<Button
|
|
270
|
+
<section>
|
|
271
|
+
<Button
|
|
272
|
+
className="option-btn"
|
|
273
|
+
variant="text"
|
|
274
|
+
onClick={(e) => {
|
|
275
|
+
setShow(e.currentTarget as any);
|
|
276
|
+
}}>
|
|
261
277
|
{search!.customer_id ? (
|
|
262
278
|
<Close
|
|
263
279
|
sx={{ color: 'text.secondary', cursor: 'pointer', fontSize: '1.05rem' }}
|
|
@@ -283,23 +299,21 @@ function SearchCustomers({ setSearch, search }: Pick<Props, 'setSearch' | 'searc
|
|
|
283
299
|
e.stopPropagation();
|
|
284
300
|
setShow(null);
|
|
285
301
|
}}>
|
|
286
|
-
<
|
|
287
|
-
<
|
|
288
|
-
|
|
302
|
+
<Box sx={{ p: 1 }}>
|
|
303
|
+
<TextField
|
|
304
|
+
placeholder="Search customer"
|
|
305
|
+
size="small"
|
|
306
|
+
sx={{
|
|
289
307
|
width: '100%',
|
|
290
|
-
boxSizing: 'border-box',
|
|
291
|
-
border: '1px solid #eee',
|
|
292
|
-
padding: '5px 10px',
|
|
293
|
-
borderRadius: '20px',
|
|
294
|
-
marginBottom: '10px',
|
|
295
308
|
}}
|
|
296
|
-
|
|
297
|
-
placeholder="Search customer"
|
|
309
|
+
value={searchText}
|
|
298
310
|
onChange={(e) => {
|
|
299
|
-
|
|
311
|
+
setSearchText(e.target.value);
|
|
312
|
+
e.stopPropagation();
|
|
300
313
|
}}
|
|
314
|
+
onClick={(e) => e.stopPropagation()}
|
|
301
315
|
/>
|
|
302
|
-
</
|
|
316
|
+
</Box>
|
|
303
317
|
{customers.map((x: any) => (
|
|
304
318
|
<MenuItem
|
|
305
319
|
key={x.id}
|
|
@@ -484,9 +498,9 @@ const Root = styled(Box)`
|
|
|
484
498
|
display: flex;
|
|
485
499
|
align-items: center;
|
|
486
500
|
border-radius: 25px;
|
|
487
|
-
background:
|
|
501
|
+
background: ${({ theme }) => theme.palette.grey[100]};
|
|
488
502
|
padding: 5px 10px;
|
|
489
|
-
color:
|
|
503
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
490
504
|
font-size: 14px;
|
|
491
505
|
line-height: 14px;
|
|
492
506
|
overflow: visible;
|
|
@@ -505,8 +519,9 @@ const Root = styled(Box)`
|
|
|
505
519
|
0px 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
506
520
|
0px 3px 14px 2px rgba(0, 0, 0, 0.12);
|
|
507
521
|
padding: 0;
|
|
508
|
-
background:
|
|
509
|
-
border: 1px solid
|
|
522
|
+
background: ${({ theme }) => theme.palette.background.paper};
|
|
523
|
+
border: 1px solid;
|
|
524
|
+
border-color: ${({ theme }) => theme.palette.grey[100]};
|
|
510
525
|
z-index: 999999;
|
|
511
526
|
top: 15px;
|
|
512
527
|
display: block;
|