payment-kit 1.13.144 → 1.13.145

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 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.13.144
17
+ version: 1.13.145
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.13.144",
3
+ "version": "1.13.145",
4
4
  "scripts": {
5
5
  "dev": "cross-env COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -50,7 +50,7 @@
50
50
  "@arcblock/jwt": "^1.18.110",
51
51
  "@arcblock/ux": "^2.9.29",
52
52
  "@blocklet/logger": "1.16.23",
53
- "@blocklet/payment-react": "1.13.144",
53
+ "@blocklet/payment-react": "1.13.145",
54
54
  "@blocklet/sdk": "1.16.23",
55
55
  "@blocklet/ui-react": "^2.9.29",
56
56
  "@blocklet/uploader": "^0.0.73",
@@ -110,7 +110,7 @@
110
110
  "devDependencies": {
111
111
  "@abtnode/types": "1.16.23",
112
112
  "@arcblock/eslint-config-ts": "^0.2.4",
113
- "@blocklet/payment-types": "1.13.144",
113
+ "@blocklet/payment-types": "1.13.145",
114
114
  "@types/cookie-parser": "^1.4.6",
115
115
  "@types/cors": "^2.8.17",
116
116
  "@types/dotenv-flow": "^3.3.3",
@@ -149,5 +149,5 @@
149
149
  "parser": "typescript"
150
150
  }
151
151
  },
152
- "gitHead": "ffef3d0804ed91778330d90394718922388d3403"
152
+ "gitHead": "9ca5d8a2a30ae0da5630b25c409949f978a93190"
153
153
  }
@@ -1,10 +1,8 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
- import Center from '@arcblock/ux/lib/Center';
3
2
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
4
3
  import Dashboard from '@blocklet/ui-react/lib/Dashboard';
5
- import { Avatar, Button, Stack, Typography } from '@mui/material';
6
4
  import { styled } from '@mui/system';
7
- import { useEffect, useState } from 'react';
5
+ import { useEffect } from 'react';
8
6
 
9
7
  import { useSessionContext } from '../../contexts/session';
10
8
 
@@ -54,42 +52,24 @@ const Root = styled(Dashboard)`
54
52
 
55
53
  export default function Layout(props: any) {
56
54
  const { t } = useLocaleContext();
57
- const { session } = useSessionContext();
58
- const [showLogin, setShowLogin] = useState(false);
55
+ const { session, events } = useSessionContext();
59
56
 
60
57
  useEffect(() => {
61
- const timer = setTimeout(() => {
62
- if (!session.user) {
63
- setShowLogin(true);
64
- }
65
- }, 500);
66
-
67
- return () => clearTimeout(timer);
68
- });
58
+ events.once('logout', () => {
59
+ window.location.href = '/';
60
+ });
61
+ }, []);
69
62
 
70
- const handleLogin = () => {
71
- session.login();
72
- };
63
+ useEffect(() => {
64
+ if (session.initialized && !session.user) {
65
+ // @ts-ignore
66
+ session.login(() => {}, { openMode: 'redirect', redirect: window.location.href });
67
+ }
68
+ }, [session.initialized]);
73
69
 
74
70
  if (session.user) {
75
71
  return <Root {...props} footerProps={{ className: 'dashboard-footer' }} />;
76
72
  }
77
73
 
78
- if (showLogin) {
79
- return (
80
- <Center>
81
- <Stack maxWidth="sm" direction="column" alignItems="center" spacing={3}>
82
- <Avatar src={window.blocklet.appLogo} sx={{ width: 80, height: 80 }} variant="rounded" />
83
- <Stack direction="column" alignItems="center" spacing={3}>
84
- <Typography variant="h4">{window.blocklet.appName}</Typography>
85
- <Button size="large" variant="contained" color="secondary" onClick={handleLogin}>
86
- {t('common.login')}
87
- </Button>
88
- </Stack>
89
- </Stack>
90
- </Center>
91
- );
92
- }
93
-
94
- return null;
74
+ return t('common.redirecting');
95
75
  }
@@ -68,6 +68,7 @@ export default flat({
68
68
  month3: 'every 3 months',
69
69
  month6: 'every 6 months',
70
70
  recurring: 'every {count} {interval}',
71
+ redirecting: 'Redirecting...',
71
72
  hours: 'hours',
72
73
  days: 'days',
73
74
  weeks: 'weeks',
@@ -68,6 +68,7 @@ export default flat({
68
68
  month3: '按季度',
69
69
  month6: '按半年',
70
70
  recurring: '每{count}{interval}',
71
+ redirecting: '跳转中...',
71
72
  hours: '小时',
72
73
  days: '天',
73
74
  weeks: '周',