payment-kit 1.22.3 → 1.22.5
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/routes/vendor.ts +1 -1
- package/blocklet.yml +1 -1
- package/package.json +24 -23
- package/src/hooks/browser.ts +11 -0
- package/src/pages/customer/credit-grant/detail.tsx +16 -10
- package/src/pages/customer/invoice/detail.tsx +20 -14
- package/src/pages/customer/invoice/past-due.tsx +19 -13
- package/src/pages/customer/payout/detail.tsx +19 -13
- package/src/pages/customer/recharge/account.tsx +24 -14
- package/src/pages/customer/recharge/subscription.tsx +19 -13
- package/src/pages/customer/subscription/change-payment.tsx +18 -12
- package/src/pages/customer/subscription/change-plan.tsx +18 -12
- package/src/pages/customer/subscription/detail.tsx +19 -13
package/api/src/routes/vendor.ts
CHANGED
|
@@ -351,7 +351,7 @@ async function executeVendorOperation({
|
|
|
351
351
|
shortUrl: boolean;
|
|
352
352
|
appUrl?: string;
|
|
353
353
|
}) {
|
|
354
|
-
if (!vendorId || !orderId
|
|
354
|
+
if (!vendorId || !orderId) {
|
|
355
355
|
return {
|
|
356
356
|
error: 'Bad Request',
|
|
357
357
|
message: `vendorId or orderId is required, vendorId: ${vendorId}, orderId: ${orderId}`,
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.5",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
@@ -44,34 +44,35 @@
|
|
|
44
44
|
]
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@abtnode/cron": "^1.
|
|
47
|
+
"@abtnode/cron": "^1.17.0-beta-20251104-112713-e947b159",
|
|
48
48
|
"@arcblock/did": "^1.26.3",
|
|
49
|
-
"@arcblock/did-connect-react": "^3.1.
|
|
49
|
+
"@arcblock/did-connect-react": "^3.1.54",
|
|
50
50
|
"@arcblock/did-connect-storage-nedb": "^1.8.0",
|
|
51
|
-
"@arcblock/did-util": "^1.
|
|
52
|
-
"@arcblock/jwt": "^1.
|
|
53
|
-
"@arcblock/
|
|
54
|
-
"@arcblock/
|
|
51
|
+
"@arcblock/did-util": "^1.27.2",
|
|
52
|
+
"@arcblock/jwt": "^1.27.2",
|
|
53
|
+
"@arcblock/react-hooks": "^3.1.54",
|
|
54
|
+
"@arcblock/ux": "^3.1.54",
|
|
55
|
+
"@arcblock/validator": "^1.27.2",
|
|
55
56
|
"@blocklet/did-space-js": "^1.1.35",
|
|
56
57
|
"@blocklet/error": "^0.2.5",
|
|
57
|
-
"@blocklet/js-sdk": "^1.
|
|
58
|
-
"@blocklet/logger": "^1.
|
|
59
|
-
"@blocklet/payment-broker-client": "1.22.
|
|
60
|
-
"@blocklet/payment-react": "1.22.
|
|
61
|
-
"@blocklet/payment-vendor": "1.22.
|
|
62
|
-
"@blocklet/sdk": "^1.
|
|
63
|
-
"@blocklet/ui-react": "^3.1.
|
|
64
|
-
"@blocklet/uploader": "^0.3.
|
|
65
|
-
"@blocklet/xss": "^0.3.
|
|
58
|
+
"@blocklet/js-sdk": "^1.17.0-beta-20251104-112713-e947b159",
|
|
59
|
+
"@blocklet/logger": "^1.17.0-beta-20251104-112713-e947b159",
|
|
60
|
+
"@blocklet/payment-broker-client": "1.22.5",
|
|
61
|
+
"@blocklet/payment-react": "1.22.5",
|
|
62
|
+
"@blocklet/payment-vendor": "1.22.5",
|
|
63
|
+
"@blocklet/sdk": "^1.17.0-beta-20251104-112713-e947b159",
|
|
64
|
+
"@blocklet/ui-react": "^3.1.54",
|
|
65
|
+
"@blocklet/uploader": "^0.3.4",
|
|
66
|
+
"@blocklet/xss": "^0.3.4",
|
|
66
67
|
"@mui/icons-material": "^7.1.2",
|
|
67
68
|
"@mui/lab": "7.0.0-beta.14",
|
|
68
69
|
"@mui/material": "^7.1.2",
|
|
69
70
|
"@mui/system": "^7.1.1",
|
|
70
|
-
"@ocap/asset": "^1.
|
|
71
|
+
"@ocap/asset": "^1.27.2",
|
|
71
72
|
"@ocap/client": "^1.26.3",
|
|
72
|
-
"@ocap/mcrypto": "^1.
|
|
73
|
-
"@ocap/util": "^1.
|
|
74
|
-
"@ocap/wallet": "^1.
|
|
73
|
+
"@ocap/mcrypto": "^1.27.2",
|
|
74
|
+
"@ocap/util": "^1.27.2",
|
|
75
|
+
"@ocap/wallet": "^1.27.2",
|
|
75
76
|
"@stripe/react-stripe-js": "^2.9.0",
|
|
76
77
|
"@stripe/stripe-js": "^2.4.0",
|
|
77
78
|
"ahooks": "^3.8.5",
|
|
@@ -126,9 +127,9 @@
|
|
|
126
127
|
"web3": "^4.16.0"
|
|
127
128
|
},
|
|
128
129
|
"devDependencies": {
|
|
129
|
-
"@abtnode/types": "^1.
|
|
130
|
+
"@abtnode/types": "^1.17.0-beta-20251104-112713-e947b159",
|
|
130
131
|
"@arcblock/eslint-config-ts": "^0.3.3",
|
|
131
|
-
"@blocklet/payment-types": "1.22.
|
|
132
|
+
"@blocklet/payment-types": "1.22.5",
|
|
132
133
|
"@types/cookie-parser": "^1.4.9",
|
|
133
134
|
"@types/cors": "^2.8.19",
|
|
134
135
|
"@types/debug": "^4.1.12",
|
|
@@ -175,5 +176,5 @@
|
|
|
175
176
|
"parser": "typescript"
|
|
176
177
|
}
|
|
177
178
|
},
|
|
178
|
-
"gitHead": "
|
|
179
|
+
"gitHead": "8adad1f05716be0bb0bd4fa0423b8bac6c39f568"
|
|
179
180
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import useArcblockBrowser from '@arcblock/react-hooks/lib/useBrowser';
|
|
2
|
+
|
|
3
|
+
export function useArcsphere(): boolean {
|
|
4
|
+
const browser = useArcblockBrowser();
|
|
5
|
+
return browser.arcSphere;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function useBrowser() {
|
|
9
|
+
const browser = useArcblockBrowser();
|
|
10
|
+
return browser;
|
|
11
|
+
}
|
|
@@ -21,6 +21,7 @@ import SectionHeader from '../../../components/section/header';
|
|
|
21
21
|
import CreditGrantItemList from '../../../components/customer/credit-grant-item-list';
|
|
22
22
|
import InfoRow from '../../../components/info-row';
|
|
23
23
|
import InfoRowGroup from '../../../components/info-row-group';
|
|
24
|
+
import { useArcsphere } from '../../../hooks/browser';
|
|
24
25
|
|
|
25
26
|
const fetchData = (id: string | undefined): Promise<TCreditGrantExpanded> => {
|
|
26
27
|
return api.get(`/api/credit-grants/${id}`).then((res: any) => res.data);
|
|
@@ -31,6 +32,7 @@ export default function CustomerCreditGrantDetail() {
|
|
|
31
32
|
const navigate = useNavigate();
|
|
32
33
|
const { t } = useLocaleContext();
|
|
33
34
|
const { session } = useSessionContext();
|
|
35
|
+
const inArcsphere = useArcsphere();
|
|
34
36
|
const { loading, error, data } = useRequest(() => fetchData(id));
|
|
35
37
|
|
|
36
38
|
const handleBack = useCallback(() => {
|
|
@@ -83,16 +85,20 @@ export default function CustomerCreditGrantDetail() {
|
|
|
83
85
|
justifyContent="space-between"
|
|
84
86
|
alignItems="center"
|
|
85
87
|
sx={{ position: 'relative' }}>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
{!inArcsphere ? (
|
|
89
|
+
<Stack
|
|
90
|
+
direction="row"
|
|
91
|
+
onClick={handleBack}
|
|
92
|
+
alignItems="center"
|
|
93
|
+
sx={{ fontWeight: 'normal', cursor: 'pointer' }}>
|
|
94
|
+
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
95
|
+
<Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
|
|
96
|
+
{t('admin.customer.creditGrants.title')}
|
|
97
|
+
</Typography>
|
|
98
|
+
</Stack>
|
|
99
|
+
) : (
|
|
100
|
+
<Box />
|
|
101
|
+
)}
|
|
96
102
|
{data.metadata?.invoice_id && (
|
|
97
103
|
<Button
|
|
98
104
|
variant="outlined"
|
|
@@ -38,6 +38,7 @@ import CustomerRefundList from '../refund/list';
|
|
|
38
38
|
import InfoMetric from '../../../components/info-metric';
|
|
39
39
|
import InfoRowGroup from '../../../components/info-row-group';
|
|
40
40
|
import RelatedCreditGrants from '../../../components/customer/related-credit-grants';
|
|
41
|
+
import { useArcsphere } from '../../../hooks/browser';
|
|
41
42
|
|
|
42
43
|
const fetchData = (
|
|
43
44
|
id: string
|
|
@@ -59,6 +60,7 @@ export default function CustomerInvoiceDetail() {
|
|
|
59
60
|
const { connect } = usePaymentContext();
|
|
60
61
|
const params = useParams<{ id: string }>();
|
|
61
62
|
const muiTheme = useTheme();
|
|
63
|
+
const inArcsphere = useArcsphere();
|
|
62
64
|
const [state, setState] = useSetState({
|
|
63
65
|
downloading: false,
|
|
64
66
|
paying: false,
|
|
@@ -147,20 +149,24 @@ export default function CustomerInvoiceDetail() {
|
|
|
147
149
|
sx={{
|
|
148
150
|
justifyContent: 'space-between',
|
|
149
151
|
}}>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
|
|
163
|
-
|
|
152
|
+
{!inArcsphere ? (
|
|
153
|
+
<Stack
|
|
154
|
+
direction="row"
|
|
155
|
+
onClick={() => goBackOrFallback('/customer')}
|
|
156
|
+
sx={{
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
fontWeight: 'normal',
|
|
159
|
+
padding: '10px 0',
|
|
160
|
+
cursor: 'pointer',
|
|
161
|
+
}}>
|
|
162
|
+
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
163
|
+
<Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
|
|
164
|
+
{t('common.previous')}
|
|
165
|
+
</Typography>
|
|
166
|
+
</Stack>
|
|
167
|
+
) : (
|
|
168
|
+
<Box />
|
|
169
|
+
)}
|
|
164
170
|
<Stack
|
|
165
171
|
direction="row"
|
|
166
172
|
spacing={1}
|
|
@@ -22,6 +22,7 @@ import SectionHeader from '../../../components/section/header';
|
|
|
22
22
|
import { useSessionContext } from '../../../contexts/session';
|
|
23
23
|
import api from '../../../libs/api';
|
|
24
24
|
import { goBackOrFallback } from '../../../libs/util';
|
|
25
|
+
import { useArcsphere } from '../../../hooks/browser';
|
|
25
26
|
|
|
26
27
|
const fetchData = (): Promise<TCustomerExpanded> => {
|
|
27
28
|
return api.get('/api/customers/me').then((res) => res.data);
|
|
@@ -32,6 +33,7 @@ export default function CustomerInvoicePastDue() {
|
|
|
32
33
|
const { events } = useSessionContext();
|
|
33
34
|
const { connect, session } = usePaymentContext();
|
|
34
35
|
const [params] = useSearchParams();
|
|
36
|
+
const inArcsphere = useArcsphere();
|
|
35
37
|
const [hasUnpaidInvoices, setHasUnpaidInvoices] = useState(false);
|
|
36
38
|
const [showOverduePayment, setShowOverduePayment] = useState(false);
|
|
37
39
|
|
|
@@ -115,19 +117,23 @@ export default function CustomerInvoicePastDue() {
|
|
|
115
117
|
alignItems: 'center',
|
|
116
118
|
justifyContent: 'space-between',
|
|
117
119
|
}}>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
{!inArcsphere ? (
|
|
121
|
+
<Stack
|
|
122
|
+
direction="row"
|
|
123
|
+
onClick={() => goBackOrFallback('/customer')}
|
|
124
|
+
sx={{
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
fontWeight: 'normal',
|
|
127
|
+
cursor: 'pointer',
|
|
128
|
+
}}>
|
|
129
|
+
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
130
|
+
<Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
|
|
131
|
+
{t('common.previous')}
|
|
132
|
+
</Typography>
|
|
133
|
+
</Stack>
|
|
134
|
+
) : (
|
|
135
|
+
<Box />
|
|
136
|
+
)}
|
|
131
137
|
</Stack>
|
|
132
138
|
<Root direction="column" spacing={3}>
|
|
133
139
|
{hasUnpaidInvoices && <Alert severity="error">{t('payment.customer.pastDue.warning')}</Alert>}
|
|
@@ -24,6 +24,7 @@ import SectionHeader from '../../../components/section/header';
|
|
|
24
24
|
import { goBackOrFallback } from '../../../libs/util';
|
|
25
25
|
import CustomerLink from '../../../components/customer/link';
|
|
26
26
|
import InfoRowGroup from '../../../components/info-row-group';
|
|
27
|
+
import { useArcsphere } from '../../../hooks/browser';
|
|
27
28
|
|
|
28
29
|
const fetchData = (
|
|
29
30
|
id: string
|
|
@@ -39,6 +40,7 @@ const fetchData = (
|
|
|
39
40
|
export default function PayoutDetail() {
|
|
40
41
|
const { t, locale } = useLocaleContext();
|
|
41
42
|
const { isMobile } = useMobile();
|
|
43
|
+
const inArcsphere = useArcsphere();
|
|
42
44
|
const params = useParams<{ id: string }>();
|
|
43
45
|
const { loading, error, data } = useRequest(() => fetchData(params.id!), {
|
|
44
46
|
ready: !!params.id,
|
|
@@ -67,19 +69,23 @@ export default function PayoutDetail() {
|
|
|
67
69
|
justifyContent: 'space-between',
|
|
68
70
|
alignItems: 'center',
|
|
69
71
|
}}>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
{!inArcsphere ? (
|
|
73
|
+
<Stack
|
|
74
|
+
direction="row"
|
|
75
|
+
onClick={() => goBackOrFallback('/customer/payouts')}
|
|
76
|
+
sx={{
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
fontWeight: 'normal',
|
|
79
|
+
cursor: 'pointer',
|
|
80
|
+
}}>
|
|
81
|
+
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
82
|
+
<Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
|
|
83
|
+
{t('common.previous')}
|
|
84
|
+
</Typography>
|
|
85
|
+
</Stack>
|
|
86
|
+
) : (
|
|
87
|
+
<Box />
|
|
88
|
+
)}
|
|
83
89
|
{paymentLink?.donation_settings?.reference && (
|
|
84
90
|
<Button
|
|
85
91
|
variant="outlined"
|
|
@@ -37,6 +37,7 @@ import RechargeList from '../../../components/invoice/recharge';
|
|
|
37
37
|
import { goBackOrFallback, MAX_SAFE_AMOUNT } from '../../../libs/util';
|
|
38
38
|
import { useSessionContext } from '../../../contexts/session';
|
|
39
39
|
import { formatSmartDuration, TimeUnit } from '../../../libs/dayjs';
|
|
40
|
+
import { useArcsphere } from '../../../hooks/browser';
|
|
40
41
|
|
|
41
42
|
// 扩展PaymentCurrency类型以包含paymentMethod
|
|
42
43
|
interface ExtendedPaymentCurrency extends TPaymentCurrency {
|
|
@@ -78,6 +79,7 @@ export default function BalanceRechargePage() {
|
|
|
78
79
|
const { t, locale } = useLocaleContext();
|
|
79
80
|
const { currencyId } = useParams<{ currencyId: string }>();
|
|
80
81
|
const [searchParams] = useSearchParams();
|
|
82
|
+
const inArcsphere = useArcsphere();
|
|
81
83
|
const rechargeAddress = searchParams.get('rechargeAddress');
|
|
82
84
|
const navigate = useNavigate();
|
|
83
85
|
const { connect } = usePaymentContext();
|
|
@@ -301,9 +303,11 @@ export default function BalanceRechargePage() {
|
|
|
301
303
|
if (!['arcblock', 'ethereum', 'base'].includes(currency?.paymentMethod?.type || '')) {
|
|
302
304
|
return (
|
|
303
305
|
<Box>
|
|
304
|
-
|
|
305
|
-
{
|
|
306
|
-
|
|
306
|
+
{!inArcsphere && (
|
|
307
|
+
<Button startIcon={<ArrowBackOutlined />} variant="outlined" onClick={() => goBackOrFallback('/customer')}>
|
|
308
|
+
{t('common.previous')}
|
|
309
|
+
</Button>
|
|
310
|
+
)}
|
|
307
311
|
<Empty>{t('customer.recharge.unsupported')}</Empty>
|
|
308
312
|
</Box>
|
|
309
313
|
);
|
|
@@ -312,9 +316,11 @@ export default function BalanceRechargePage() {
|
|
|
312
316
|
if (error) {
|
|
313
317
|
return (
|
|
314
318
|
<Box>
|
|
315
|
-
|
|
316
|
-
{
|
|
317
|
-
|
|
319
|
+
{!inArcsphere && (
|
|
320
|
+
<Button startIcon={<ArrowBackOutlined />} variant="outlined" onClick={() => goBackOrFallback('/customer')}>
|
|
321
|
+
{t('common.previous')}
|
|
322
|
+
</Button>
|
|
323
|
+
)}
|
|
318
324
|
<Alert severity="error" sx={{ mt: 2 }}>
|
|
319
325
|
{error}
|
|
320
326
|
</Alert>
|
|
@@ -336,14 +342,18 @@ export default function BalanceRechargePage() {
|
|
|
336
342
|
alignItems: 'center',
|
|
337
343
|
position: 'relative',
|
|
338
344
|
}}>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
{!inArcsphere ? (
|
|
346
|
+
<Button
|
|
347
|
+
startIcon={<ArrowBackOutlined />}
|
|
348
|
+
variant="text"
|
|
349
|
+
color="inherit"
|
|
350
|
+
onClick={() => goBackOrFallback('/customer')}
|
|
351
|
+
sx={{ color: 'text.secondary' }}>
|
|
352
|
+
{t('common.previous')}
|
|
353
|
+
</Button>
|
|
354
|
+
) : (
|
|
355
|
+
<Box />
|
|
356
|
+
)}
|
|
347
357
|
</Stack>
|
|
348
358
|
<Typography variant="h2" gutterBottom>
|
|
349
359
|
{currency?.symbol} {t('customer.recharge.title')}
|
|
@@ -39,6 +39,7 @@ import { goBackOrFallback, MAX_SAFE_AMOUNT } from '../../../libs/util';
|
|
|
39
39
|
import CustomerLink from '../../../components/customer/link';
|
|
40
40
|
import { useSessionContext } from '../../../contexts/session';
|
|
41
41
|
import { formatSmartDuration, TimeUnit } from '../../../libs/dayjs';
|
|
42
|
+
import { useArcsphere } from '../../../hooks/browser';
|
|
42
43
|
|
|
43
44
|
const Root = styled(Stack)(({ theme }) => ({
|
|
44
45
|
marginBottom: theme.spacing(3),
|
|
@@ -60,6 +61,7 @@ export default function RechargePage() {
|
|
|
60
61
|
const { id: subscriptionId } = useParams<{ id: string }>();
|
|
61
62
|
const navigate = useNavigate();
|
|
62
63
|
const { connect } = usePaymentContext();
|
|
64
|
+
const inArcsphere = useArcsphere();
|
|
63
65
|
const [subscription, setSubscription] = useState<TSubscriptionExpanded | null>(null);
|
|
64
66
|
const [amount, setAmount] = useState('');
|
|
65
67
|
const [amountError, setAmountError] = useState('');
|
|
@@ -261,19 +263,23 @@ export default function RechargePage() {
|
|
|
261
263
|
alignItems: 'center',
|
|
262
264
|
position: 'relative',
|
|
263
265
|
}}>
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
{
|
|
275
|
-
|
|
276
|
-
|
|
266
|
+
{!inArcsphere ? (
|
|
267
|
+
<Stack
|
|
268
|
+
direction="row"
|
|
269
|
+
onClick={() => goBackOrFallback('/customer')}
|
|
270
|
+
sx={{
|
|
271
|
+
alignItems: 'center',
|
|
272
|
+
fontWeight: 'normal',
|
|
273
|
+
cursor: 'pointer',
|
|
274
|
+
}}>
|
|
275
|
+
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
276
|
+
<Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
|
|
277
|
+
{t('common.previous')}
|
|
278
|
+
</Typography>
|
|
279
|
+
</Stack>
|
|
280
|
+
) : (
|
|
281
|
+
<Box />
|
|
282
|
+
)}
|
|
277
283
|
<Button variant="outlined" onClick={() => navigate(`/customer/subscription/${subscriptionId}`)}>
|
|
278
284
|
{t('customer.recharge.view')}
|
|
279
285
|
</Button>
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from '@blocklet/payment-react';
|
|
23
23
|
import type { TCustomer, TPaymentCurrency, TPaymentMethod, TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
24
24
|
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
25
|
-
import { Alert, CircularProgress, Stack, Typography } from '@mui/material';
|
|
25
|
+
import { Alert, Box, CircularProgress, Stack, Typography } from '@mui/material';
|
|
26
26
|
import { useRequest, useSetState } from 'ahooks';
|
|
27
27
|
import pWaitFor from 'p-wait-for';
|
|
28
28
|
import { useEffect, useState } from 'react';
|
|
@@ -34,6 +34,7 @@ import SectionHeader from '../../../components/section/header';
|
|
|
34
34
|
import SubscriptionDescription from '../../../components/subscription/description';
|
|
35
35
|
import { goBackOrFallback } from '../../../libs/util';
|
|
36
36
|
import { useUnpaidInvoicesCheckForSubscription } from '../../../hooks/subscription';
|
|
37
|
+
import { useArcsphere } from '../../../hooks/browser';
|
|
37
38
|
|
|
38
39
|
const fetchData = async (id: string): Promise<{ subscription: TSubscriptionExpanded; customer: TCustomer }> => {
|
|
39
40
|
const [subscription, customer] = await Promise.all([
|
|
@@ -81,6 +82,7 @@ function CustomerSubscriptionChangePayment({ subscription, customer, onComplete
|
|
|
81
82
|
const { settings, connect } = usePaymentContext();
|
|
82
83
|
const { checkUnpaidInvoices } = useUnpaidInvoicesCheckForSubscription(subscription.id);
|
|
83
84
|
const { control, setValue, handleSubmit } = useFormContext();
|
|
85
|
+
const inArcsphere = useArcsphere();
|
|
84
86
|
|
|
85
87
|
const [state, setState] = useSetState<{
|
|
86
88
|
submitting: boolean;
|
|
@@ -233,17 +235,21 @@ function CustomerSubscriptionChangePayment({ subscription, customer, onComplete
|
|
|
233
235
|
justifyContent: 'space-between',
|
|
234
236
|
alignItems: 'center',
|
|
235
237
|
}}>
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
238
|
+
{!inArcsphere ? (
|
|
239
|
+
<Stack
|
|
240
|
+
direction="row"
|
|
241
|
+
onClick={() => goBackOrFallback(`/customer/subscription/${subscription.id}`)}
|
|
242
|
+
sx={{
|
|
243
|
+
alignItems: 'center',
|
|
244
|
+
fontWeight: 'normal',
|
|
245
|
+
cursor: 'pointer',
|
|
246
|
+
}}>
|
|
247
|
+
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
248
|
+
<SubscriptionDescription subscription={subscription} variant="h5" />
|
|
249
|
+
</Stack>
|
|
250
|
+
) : (
|
|
251
|
+
<Box />
|
|
252
|
+
)}
|
|
247
253
|
</Stack>
|
|
248
254
|
<Alert severity="info">{t('payment.customer.changePayment.limit')}</Alert>
|
|
249
255
|
<Stack direction="column" spacing={2}>
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from '@blocklet/payment-react';
|
|
14
14
|
import type { TLineItemExpanded, TPricingTableExpanded, TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
15
15
|
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
16
|
-
import { Alert, CircularProgress, Divider, Stack, Typography } from '@mui/material';
|
|
16
|
+
import { Alert, Box, CircularProgress, Divider, Stack, Typography } from '@mui/material';
|
|
17
17
|
import { useRequest, useSetState } from 'ahooks';
|
|
18
18
|
import { useRef } from 'react';
|
|
19
19
|
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
|
@@ -22,6 +22,7 @@ import InfoCard from '../../../components/info-card';
|
|
|
22
22
|
import SectionHeader from '../../../components/section/header';
|
|
23
23
|
import SubscriptionDescription from '../../../components/subscription/description';
|
|
24
24
|
import { goBackOrFallback } from '../../../libs/util';
|
|
25
|
+
import { useArcsphere } from '../../../hooks/browser';
|
|
25
26
|
|
|
26
27
|
const fetchData = async (
|
|
27
28
|
id: string
|
|
@@ -57,6 +58,7 @@ export default function CustomerSubscriptionChangePlan() {
|
|
|
57
58
|
const [searchParams] = useSearchParams();
|
|
58
59
|
const redirectUrl = searchParams.get('redirectUrl');
|
|
59
60
|
const confirmRef = useRef<HTMLButtonElement>(null);
|
|
61
|
+
const inArcsphere = useArcsphere();
|
|
60
62
|
|
|
61
63
|
const { loading, error, data } = useRequest(() => fetchData(id));
|
|
62
64
|
const [state, setState] = useSetState({
|
|
@@ -245,17 +247,21 @@ export default function CustomerSubscriptionChangePlan() {
|
|
|
245
247
|
justifyContent: 'space-between',
|
|
246
248
|
alignItems: 'center',
|
|
247
249
|
}}>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
250
|
+
{!inArcsphere ? (
|
|
251
|
+
<Stack
|
|
252
|
+
direction="row"
|
|
253
|
+
onClick={() => goBackOrFallback(`/customer/subscription/${data.subscription.id}`)}
|
|
254
|
+
sx={{
|
|
255
|
+
alignItems: 'center',
|
|
256
|
+
fontWeight: 'normal',
|
|
257
|
+
cursor: 'pointer',
|
|
258
|
+
}}>
|
|
259
|
+
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
260
|
+
<SubscriptionDescription subscription={data.subscription} variant="h5" />
|
|
261
|
+
</Stack>
|
|
262
|
+
) : (
|
|
263
|
+
<Box />
|
|
264
|
+
)}
|
|
259
265
|
</Stack>
|
|
260
266
|
<Stack direction="column" sx={{ marginTop: 32 }}>
|
|
261
267
|
<SectionHeader title={t('payment.customer.changePlan.config')} />
|
|
@@ -53,6 +53,7 @@ import { usePendingAmountForSubscription, useUnpaidInvoicesCheckForSubscription
|
|
|
53
53
|
import { formatSmartDuration, TimeUnit } from '../../../libs/dayjs';
|
|
54
54
|
import { canChangePaymentMethod } from '../../../libs/util';
|
|
55
55
|
import PaymentMethodInfo from '../../../components/subscription/payment-method-info';
|
|
56
|
+
import { useArcsphere } from '../../../hooks/browser';
|
|
56
57
|
|
|
57
58
|
const fetchData = (id: string | undefined): Promise<TSubscriptionExpanded> => {
|
|
58
59
|
return api.get(`/api/subscriptions/${id}`).then((res) => res.data);
|
|
@@ -77,6 +78,7 @@ export default function CustomerSubscriptionDetail() {
|
|
|
77
78
|
const { t } = useLocaleContext();
|
|
78
79
|
const { isMobile } = useMobile();
|
|
79
80
|
const { session } = useSessionContext();
|
|
81
|
+
const inArcsphere = useArcsphere();
|
|
80
82
|
const { loading, error, data, refresh } = useRequest(() => fetchData(id));
|
|
81
83
|
const { hasUnpaid, checkUnpaidInvoices } = useUnpaidInvoicesCheckForSubscription(id);
|
|
82
84
|
const { hasPendingAmount, pendingAmount } = usePendingAmountForSubscription(id, data?.paymentCurrency);
|
|
@@ -327,19 +329,23 @@ export default function CustomerSubscriptionDetail() {
|
|
|
327
329
|
alignItems: 'center',
|
|
328
330
|
position: 'relative',
|
|
329
331
|
}}>
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
{
|
|
341
|
-
|
|
342
|
-
|
|
332
|
+
{!inArcsphere ? (
|
|
333
|
+
<Stack
|
|
334
|
+
direction="row"
|
|
335
|
+
onClick={() => navigate('/customer', { replace: true })}
|
|
336
|
+
sx={{
|
|
337
|
+
alignItems: 'center',
|
|
338
|
+
fontWeight: 'normal',
|
|
339
|
+
cursor: 'pointer',
|
|
340
|
+
}}>
|
|
341
|
+
<ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
|
|
342
|
+
<Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
|
|
343
|
+
{t('payment.customer.subscriptions.title')}
|
|
344
|
+
</Typography>
|
|
345
|
+
</Stack>
|
|
346
|
+
) : (
|
|
347
|
+
<Box />
|
|
348
|
+
)}
|
|
343
349
|
<Stack
|
|
344
350
|
direction="row"
|
|
345
351
|
sx={{
|