payment-kit 1.22.4 → 1.22.6

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.
@@ -16,26 +16,36 @@ import { createProductAndPrices } from '../routes/products';
16
16
  import { PaymentCurrency, PaymentLink, Price, Product, nextPriceId } from '../store/models';
17
17
 
18
18
  export async function getPackResource(type: string) {
19
- const resources = await getPackResources({
20
- types: [
21
- {
22
- did: env.componentDid,
23
- type,
24
- },
25
- ],
26
- });
19
+ try {
20
+ const resources = await getPackResources({
21
+ types: [
22
+ {
23
+ did: env.componentDid,
24
+ type,
25
+ },
26
+ ],
27
+ });
27
28
 
28
- if (resources) {
29
- return resources[0] || null;
30
- }
29
+ if (resources) {
30
+ return resources[0] || null;
31
+ }
31
32
 
32
- return null;
33
+ return null;
34
+ } catch (error) {
35
+ console.error(`failed to get ${type} pack resource from ${env.componentDid}`, error);
36
+ return null;
37
+ }
33
38
  }
34
39
 
35
40
  export async function getResourcesByType(type: string) {
36
- const pack = await getPackResource(type);
37
- const resources = await getResources({ types: [{ did: env.componentDid, type }], skipRunningCheck: true });
38
- return pack ? [pack, ...resources] : resources;
41
+ try {
42
+ const pack = await getPackResource(type);
43
+ const resources = await getResources({ types: [{ did: env.componentDid, type }], skipRunningCheck: true });
44
+ return pack ? [pack, ...resources] : resources;
45
+ } catch (error) {
46
+ console.error(`failed to get ${type} resources from ${env.componentDid}`, error);
47
+ return [];
48
+ }
39
49
  }
40
50
 
41
51
  export async function initPaywallResources() {
package/blocklet.yml CHANGED
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.22.4
17
+ version: 1.22.6
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.22.4",
3
+ "version": "1.22.6",
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.16.54-beta-20251029-055649-a9143beb",
47
+ "@abtnode/cron": "^1.17.0-beta-20251104-112713-e947b159",
48
48
  "@arcblock/did": "^1.26.3",
49
- "@arcblock/did-connect-react": "^3.1.53",
49
+ "@arcblock/did-connect-react": "^3.1.54",
50
50
  "@arcblock/did-connect-storage-nedb": "^1.8.0",
51
- "@arcblock/did-util": "^1.26.3",
52
- "@arcblock/jwt": "^1.26.3",
53
- "@arcblock/ux": "^3.1.53",
54
- "@arcblock/validator": "^1.26.3",
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.16.54-beta-20251029-055649-a9143beb",
58
- "@blocklet/logger": "^1.16.54-beta-20251029-055649-a9143beb",
59
- "@blocklet/payment-broker-client": "1.22.4",
60
- "@blocklet/payment-react": "1.22.4",
61
- "@blocklet/payment-vendor": "1.22.4",
62
- "@blocklet/sdk": "^1.16.54-beta-20251029-055649-a9143beb",
63
- "@blocklet/ui-react": "^3.1.53",
64
- "@blocklet/uploader": "^0.3.2",
65
- "@blocklet/xss": "^0.3.2",
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.6",
61
+ "@blocklet/payment-react": "1.22.6",
62
+ "@blocklet/payment-vendor": "1.22.6",
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.26.3",
71
+ "@ocap/asset": "^1.27.2",
71
72
  "@ocap/client": "^1.26.3",
72
- "@ocap/mcrypto": "^1.26.3",
73
- "@ocap/util": "^1.26.3",
74
- "@ocap/wallet": "^1.26.3",
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.16.54-beta-20251029-055649-a9143beb",
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.4",
132
+ "@blocklet/payment-types": "1.22.6",
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": "fd5b976da43060ffe6eacaab7486cca610404ee8"
179
+ "gitHead": "69c7b775a4fa6ba27b5b317aa76e25db3fd4177f"
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
- <Stack
87
- direction="row"
88
- onClick={handleBack}
89
- alignItems="center"
90
- sx={{ fontWeight: 'normal', cursor: 'pointer' }}>
91
- <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
92
- <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
93
- {t('admin.customer.creditGrants.title')}
94
- </Typography>
95
- </Stack>
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
- <Stack
151
- direction="row"
152
- onClick={() => goBackOrFallback('/customer')}
153
- sx={{
154
- alignItems: 'center',
155
- fontWeight: 'normal',
156
- padding: '10px 0',
157
- cursor: 'pointer',
158
- }}>
159
- <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
160
- <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
161
- {t('common.previous')}
162
- </Typography>
163
- </Stack>
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
- <Stack
119
- direction="row"
120
- onClick={() => goBackOrFallback('/customer')}
121
- sx={{
122
- alignItems: 'center',
123
- fontWeight: 'normal',
124
- cursor: 'pointer',
125
- }}>
126
- <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
127
- <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
128
- {t('common.previous')}
129
- </Typography>
130
- </Stack>
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
- <Stack
71
- direction="row"
72
- onClick={() => goBackOrFallback('/customer/payouts')}
73
- sx={{
74
- alignItems: 'center',
75
- fontWeight: 'normal',
76
- cursor: 'pointer',
77
- }}>
78
- <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
79
- <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
80
- {t('common.previous')}
81
- </Typography>
82
- </Stack>
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
- <Button startIcon={<ArrowBackOutlined />} variant="outlined" onClick={() => goBackOrFallback('/customer')}>
305
- {t('common.previous')}
306
- </Button>
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
- <Button startIcon={<ArrowBackOutlined />} variant="outlined" onClick={() => goBackOrFallback('/customer')}>
316
- {t('common.previous')}
317
- </Button>
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
- <Button
340
- startIcon={<ArrowBackOutlined />}
341
- variant="text"
342
- color="inherit"
343
- onClick={() => goBackOrFallback('/customer')}
344
- sx={{ color: 'text.secondary' }}>
345
- {t('common.previous')}
346
- </Button>
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
- <Stack
265
- direction="row"
266
- onClick={() => goBackOrFallback('/customer')}
267
- sx={{
268
- alignItems: 'center',
269
- fontWeight: 'normal',
270
- cursor: 'pointer',
271
- }}>
272
- <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
273
- <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
274
- {t('common.previous')}
275
- </Typography>
276
- </Stack>
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
- <Stack
237
- direction="row"
238
- onClick={() => goBackOrFallback(`/customer/subscription/${subscription.id}`)}
239
- sx={{
240
- alignItems: 'center',
241
- fontWeight: 'normal',
242
- cursor: 'pointer',
243
- }}>
244
- <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
245
- <SubscriptionDescription subscription={subscription} variant="h5" />
246
- </Stack>
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
- <Stack
249
- direction="row"
250
- onClick={() => goBackOrFallback(`/customer/subscription/${data.subscription.id}`)}
251
- sx={{
252
- alignItems: 'center',
253
- fontWeight: 'normal',
254
- cursor: 'pointer',
255
- }}>
256
- <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
257
- <SubscriptionDescription subscription={data.subscription} variant="h5" />
258
- </Stack>
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
- <Stack
331
- direction="row"
332
- onClick={() => navigate('/customer', { replace: true })}
333
- sx={{
334
- alignItems: 'center',
335
- fontWeight: 'normal',
336
- cursor: 'pointer',
337
- }}>
338
- <ArrowBackOutlined fontSize="small" sx={{ mr: 0.5, color: 'text.secondary' }} />
339
- <Typography variant="h6" sx={{ color: 'text.secondary', fontWeight: 'normal' }}>
340
- {t('payment.customer.subscriptions.title')}
341
- </Typography>
342
- </Stack>
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={{