@arcblock/did-connect-react 3.4.15 → 3.5.1
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/dist/standalone/did-connect-react.css +1 -0
- package/dist/standalone/index.js +133700 -0
- package/lib/package.json.js +1 -1
- package/package.json +11 -6
- package/.aigne/doc-smith/config.yaml +0 -85
- package/.aigne/doc-smith/history.yaml +0 -6
- package/.aigne/doc-smith/output/structure-plan.json +0 -204
- package/.aigne/doc-smith/translation-cache.yaml +0 -11
- package/.aigne/doc-smith/upload-cache.yaml +0 -213
- package/docs/_sidebar.md +0 -18
- package/docs/advanced-authentication-methods.ja.md +0 -261
- package/docs/advanced-authentication-methods.md +0 -261
- package/docs/advanced-authentication-methods.zh-TW.md +0 -261
- package/docs/advanced-authentication-methods.zh.md +0 -261
- package/docs/advanced-utilities.ja.md +0 -132
- package/docs/advanced-utilities.md +0 -132
- package/docs/advanced-utilities.zh-TW.md +0 -132
- package/docs/advanced-utilities.zh.md +0 -132
- package/docs/advanced.ja.md +0 -95
- package/docs/advanced.md +0 -95
- package/docs/advanced.zh-TW.md +0 -95
- package/docs/advanced.zh.md +0 -95
- package/docs/api-reference.ja.md +0 -178
- package/docs/api-reference.md +0 -178
- package/docs/api-reference.zh-TW.md +0 -178
- package/docs/api-reference.zh.md +0 -178
- package/docs/assets/diagram/core-components-session-provider-01.ja.jpg +0 -0
- package/docs/assets/diagram/core-components-session-provider-01.jpg +0 -0
- package/docs/assets/diagram/core-components-session-provider-01.zh-TW.jpg +0 -0
- package/docs/assets/diagram/core-components-session-provider-01.zh.jpg +0 -0
- package/docs/assets/diagram/did-connect-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/did-connect-diagram-0.jpg +0 -0
- package/docs/assets/diagram/did-connect-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/did-connect-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/overview-01.ja.jpg +0 -0
- package/docs/assets/diagram/overview-01.jpg +0 -0
- package/docs/assets/diagram/overview-01.zh-TW.jpg +0 -0
- package/docs/assets/diagram/overview-01.zh.jpg +0 -0
- package/docs/assets/diagram/use-connect-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/use-connect-diagram-0.jpg +0 -0
- package/docs/assets/diagram/use-connect-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/use-connect-diagram-0.zh.jpg +0 -0
- package/docs/core-components-did-connect.ja.md +0 -166
- package/docs/core-components-did-connect.md +0 -166
- package/docs/core-components-did-connect.zh-TW.md +0 -166
- package/docs/core-components-did-connect.zh.md +0 -166
- package/docs/core-components-session-provider.ja.md +0 -197
- package/docs/core-components-session-provider.md +0 -197
- package/docs/core-components-session-provider.zh-TW.md +0 -197
- package/docs/core-components-session-provider.zh.md +0 -197
- package/docs/core-components.ja.md +0 -16
- package/docs/core-components.md +0 -16
- package/docs/core-components.zh-TW.md +0 -16
- package/docs/core-components.zh.md +0 -16
- package/docs/getting-started.ja.md +0 -138
- package/docs/getting-started.md +0 -138
- package/docs/getting-started.zh-TW.md +0 -138
- package/docs/getting-started.zh.md +0 -138
- package/docs/hooks-use-connect.ja.md +0 -178
- package/docs/hooks-use-connect.md +0 -178
- package/docs/hooks-use-connect.zh-TW.md +0 -178
- package/docs/hooks-use-connect.zh.md +0 -178
- package/docs/hooks-use-did.ja.md +0 -107
- package/docs/hooks-use-did.md +0 -107
- package/docs/hooks-use-did.zh-TW.md +0 -107
- package/docs/hooks-use-did.zh.md +0 -107
- package/docs/hooks-use-oauth-passkey.ja.md +0 -188
- package/docs/hooks-use-oauth-passkey.md +0 -188
- package/docs/hooks-use-oauth-passkey.zh-TW.md +0 -188
- package/docs/hooks-use-oauth-passkey.zh.md +0 -188
- package/docs/hooks.ja.md +0 -23
- package/docs/hooks.md +0 -23
- package/docs/hooks.zh-TW.md +0 -23
- package/docs/hooks.zh.md +0 -23
- package/docs/overview.ja.md +0 -119
- package/docs/overview.md +0 -119
- package/docs/overview.zh-TW.md +0 -119
- package/docs/overview.zh.md +0 -119
- package/docs/ui-components-address.ja.md +0 -121
- package/docs/ui-components-address.md +0 -121
- package/docs/ui-components-address.zh-TW.md +0 -121
- package/docs/ui-components-address.zh.md +0 -121
- package/docs/ui-components-avatar.ja.md +0 -65
- package/docs/ui-components-avatar.md +0 -65
- package/docs/ui-components-avatar.zh-TW.md +0 -65
- package/docs/ui-components-avatar.zh.md +0 -65
- package/docs/ui-components-button.ja.md +0 -99
- package/docs/ui-components-button.md +0 -99
- package/docs/ui-components-button.zh-TW.md +0 -99
- package/docs/ui-components-button.zh.md +0 -99
- package/docs/ui-components-logo.ja.md +0 -52
- package/docs/ui-components-logo.md +0 -52
- package/docs/ui-components-logo.zh-TW.md +0 -52
- package/docs/ui-components-logo.zh.md +0 -52
- package/docs/ui-components.ja.md +0 -57
- package/docs/ui-components.md +0 -57
- package/docs/ui-components.zh-TW.md +0 -57
- package/docs/ui-components.zh.md +0 -57
- package/glossary.md +0 -1
- package/src/Address/index.jsx +0 -2
- package/src/Avatar/index.jsx +0 -2
- package/src/Button/Button.stories.jsx +0 -7
- package/src/Button/index.jsx +0 -21
- package/src/Connect/Connect.stories.jsx +0 -34
- package/src/Connect/assets/locale.js +0 -149
- package/src/Connect/assets/login-bg.png +0 -0
- package/src/Connect/assets/login-slogan.js +0 -7
- package/src/Connect/components/action-button.jsx +0 -22
- package/src/Connect/components/app-tips.jsx +0 -156
- package/src/Connect/components/auto-height.jsx +0 -38
- package/src/Connect/components/back-button.jsx +0 -24
- package/src/Connect/components/connect-status.jsx +0 -259
- package/src/Connect/components/did-connect-title.jsx +0 -107
- package/src/Connect/components/download-tips.jsx +0 -55
- package/src/Connect/components/loading.jsx +0 -25
- package/src/Connect/components/login-item/connect-choose-list.jsx +0 -328
- package/src/Connect/components/login-item/connect-provider-list.jsx +0 -473
- package/src/Connect/components/login-item/login-method-item.jsx +0 -139
- package/src/Connect/components/login-item/mobile-login-item.jsx +0 -184
- package/src/Connect/components/login-item/passkey-login-item.jsx +0 -56
- package/src/Connect/components/login-item/wallet-login-options.jsx +0 -129
- package/src/Connect/components/login-item/web-login-item.jsx +0 -159
- package/src/Connect/components/mask-overlay.jsx +0 -32
- package/src/Connect/components/refresh-overlay.jsx +0 -52
- package/src/Connect/components/switch-app.jsx +0 -69
- package/src/Connect/connect.jsx +0 -635
- package/src/Connect/contexts/state.jsx +0 -235
- package/src/Connect/fallback-connect.jsx +0 -47
- package/src/Connect/fullpage.jsx +0 -3
- package/src/Connect/hooks/auth-url.js +0 -31
- package/src/Connect/hooks/method-list.js +0 -121
- package/src/Connect/hooks/page-show.js +0 -24
- package/src/Connect/hooks/provider-list.js +0 -168
- package/src/Connect/hooks/security.js +0 -40
- package/src/Connect/hooks/token.js +0 -627
- package/src/Connect/hooks/use-apps.js +0 -69
- package/src/Connect/hooks/use-quick-connect.js +0 -119
- package/src/Connect/index.jsx +0 -21
- package/src/Connect/landing-page.jsx +0 -3
- package/src/Connect/plugins/email/index.jsx +0 -85
- package/src/Connect/plugins/email/list-item.jsx +0 -35
- package/src/Connect/plugins/email/placeholder.jsx +0 -372
- package/src/Connect/plugins/index.js +0 -2
- package/src/Connect/use-connect.jsx +0 -321
- package/src/Connect/with-blocklet.jsx +0 -26
- package/src/Connect/with-bridge-call.jsx +0 -138
- package/src/Federated/context.jsx +0 -93
- package/src/Federated/index.jsx +0 -1
- package/src/Logo/index.jsx +0 -2
- package/src/OAuth/bind-conflict-alert.jsx +0 -37
- package/src/OAuth/context.jsx +0 -407
- package/src/OAuth/guest.svg +0 -20
- package/src/OAuth/index.jsx +0 -1
- package/src/OAuth/passport-switcher.jsx +0 -2
- package/src/Passkey/actions.jsx +0 -217
- package/src/Passkey/constants.js +0 -2
- package/src/Passkey/context.jsx +0 -395
- package/src/Passkey/dialog.jsx +0 -401
- package/src/Passkey/icon.jsx +0 -10
- package/src/Passkey/index.jsx +0 -2
- package/src/Service/index.jsx +0 -96
- package/src/Session/assets/did-spaces-guide-cover.svg +0 -1
- package/src/Session/assets/did-spaces-guide-icon.svg +0 -7
- package/src/Session/context.jsx +0 -7
- package/src/Session/did-spaces-guide.jsx +0 -173
- package/src/Session/handler.jsx +0 -98
- package/src/Session/hooks/use-federated.js +0 -91
- package/src/Session/hooks/use-mobile.jsx +0 -6
- package/src/Session/hooks/use-protected-routes.js +0 -16
- package/src/Session/hooks/use-session-token.js +0 -400
- package/src/Session/hooks/use-verify.jsx +0 -76
- package/src/Session/index.jsx +0 -1789
- package/src/Session/libs/constants.js +0 -17
- package/src/Session/libs/did-spaces.js +0 -38
- package/src/Session/libs/federated.js +0 -82
- package/src/Session/libs/index.js +0 -5
- package/src/Session/libs/locales.js +0 -160
- package/src/Session/libs/login-mobile.js +0 -80
- package/src/Session/window-focus-aware.jsx +0 -28
- package/src/SessionManager/index.jsx +0 -2
- package/src/Storage/engine/cookie.js +0 -25
- package/src/Storage/engine/local-storage.js +0 -57
- package/src/Storage/index.js +0 -25
- package/src/User/index.js +0 -4
- package/src/User/use-did.js +0 -80
- package/src/User/wrap-did.jsx +0 -18
- package/src/WebWalletSWKeeper/index.jsx +0 -3
- package/src/components/PassportSwitcher.jsx +0 -160
- package/src/constant.js +0 -27
- package/src/error.js +0 -6
- package/src/hooks/use-locale.jsx +0 -6
- package/src/index.js +0 -32
- package/src/locales/en.jsx +0 -15
- package/src/locales/index.jsx +0 -13
- package/src/locales/zh.jsx +0 -15
- package/src/types.d.ts +0 -355
- package/src/utils.js +0 -413
- package/vite.config.mjs +0 -29
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import { Box } from '@mui/material';
|
|
3
|
-
import { useSize } from 'ahooks';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export default function AutoHeight({ children, initHeight = 0, slotProps = {} }) {
|
|
7
|
-
const [maxHeight, setMaxHeight] = useState(initHeight);
|
|
8
|
-
|
|
9
|
-
const contentRef = useRef(null);
|
|
10
|
-
const contentSize = useSize(contentRef);
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (contentSize?.height) {
|
|
14
|
-
setMaxHeight(contentSize.height);
|
|
15
|
-
}
|
|
16
|
-
}, [contentSize?.height]);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Box
|
|
20
|
-
{...slotProps?.root}
|
|
21
|
-
sx={{
|
|
22
|
-
height: maxHeight,
|
|
23
|
-
overflow: 'hidden',
|
|
24
|
-
transition: 'height 0.2s ease-in-out',
|
|
25
|
-
...slotProps?.root?.sx,
|
|
26
|
-
}}>
|
|
27
|
-
<Box {...slotProps?.container} ref={contentRef}>
|
|
28
|
-
{children}
|
|
29
|
-
</Box>
|
|
30
|
-
</Box>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
AutoHeight.propTypes = {
|
|
35
|
-
initHeight: PropTypes.number,
|
|
36
|
-
children: PropTypes.node.isRequired,
|
|
37
|
-
slotProps: PropTypes.object,
|
|
38
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
|
|
3
|
-
import translations from '../assets/locale';
|
|
4
|
-
import { useStateContext } from '../contexts/state';
|
|
5
|
-
import ActionButton from './action-button';
|
|
6
|
-
|
|
7
|
-
export default function BackButton({ onClick, ...rest }) {
|
|
8
|
-
const { locale } = useStateContext();
|
|
9
|
-
const translation = translations[locale] || translations.en;
|
|
10
|
-
return (
|
|
11
|
-
<ActionButton
|
|
12
|
-
onClick={onClick}
|
|
13
|
-
sx={{
|
|
14
|
-
color: 'text.secondary',
|
|
15
|
-
}}
|
|
16
|
-
{...rest}>
|
|
17
|
-
{translation.back}
|
|
18
|
-
</ActionButton>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
BackButton.propTypes = {
|
|
23
|
-
onClick: PropTypes.func.isRequired,
|
|
24
|
-
};
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { isValidElement } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Box, Tooltip, Typography, useTheme } from '@mui/material';
|
|
4
|
-
import { Icon } from '@iconify/react';
|
|
5
|
-
import closeRoundedIcon from '@iconify-icons/material-symbols/close-rounded';
|
|
6
|
-
import hourglassEmptyRoundedIcon from '@iconify-icons/material-symbols/hourglass-empty-rounded';
|
|
7
|
-
import ruleSettingsRoundedIcon from '@iconify-icons/material-symbols/rule-settings-rounded';
|
|
8
|
-
import LoadingMask from '@arcblock/ux/lib/LoadingMask';
|
|
9
|
-
import Success from '@arcblock/ux/lib/Success';
|
|
10
|
-
import noop from 'lodash/noop';
|
|
11
|
-
import { useMemoizedFn } from 'ahooks';
|
|
12
|
-
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
13
|
-
import ProviderIcon from '@arcblock/ux/lib/DIDConnect/provider-icon';
|
|
14
|
-
import { LOGIN_PROVIDER } from '@arcblock/ux/lib/Util/constant';
|
|
15
|
-
|
|
16
|
-
import translations from '../assets/locale';
|
|
17
|
-
import ActionButton from './action-button';
|
|
18
|
-
import BackButton from './back-button';
|
|
19
|
-
|
|
20
|
-
function BaseStatus({ icon = null, title = '', color = '', description = '', extraContent = null, actions = null }) {
|
|
21
|
-
const { palette } = useTheme();
|
|
22
|
-
const fgColor = color || palette.grey[700];
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<Box
|
|
26
|
-
sx={{
|
|
27
|
-
display: 'flex',
|
|
28
|
-
flexDirection: 'column',
|
|
29
|
-
alignItems: 'center',
|
|
30
|
-
justifyContent: 'center',
|
|
31
|
-
gap: 1.5,
|
|
32
|
-
}}>
|
|
33
|
-
{isValidElement(icon) ? (
|
|
34
|
-
icon
|
|
35
|
-
) : (
|
|
36
|
-
<Box
|
|
37
|
-
sx={{
|
|
38
|
-
backgroundColor: fgColor,
|
|
39
|
-
borderRadius: '100%',
|
|
40
|
-
fontSize: 0,
|
|
41
|
-
}}>
|
|
42
|
-
<Icon
|
|
43
|
-
icon={icon}
|
|
44
|
-
fontSize={52}
|
|
45
|
-
style={{
|
|
46
|
-
transform: 'scale(0.7)',
|
|
47
|
-
color: palette.primary.contrastText,
|
|
48
|
-
}}
|
|
49
|
-
/>
|
|
50
|
-
</Box>
|
|
51
|
-
)}
|
|
52
|
-
|
|
53
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
54
|
-
<Typography
|
|
55
|
-
variant="h6"
|
|
56
|
-
sx={{
|
|
57
|
-
fontWeight: 500,
|
|
58
|
-
color: fgColor,
|
|
59
|
-
}}>
|
|
60
|
-
{title}
|
|
61
|
-
</Typography>
|
|
62
|
-
<Tooltip title={description} placement="top">
|
|
63
|
-
<Typography
|
|
64
|
-
variant="body2"
|
|
65
|
-
sx={{
|
|
66
|
-
color: 'text.secondary',
|
|
67
|
-
overflow: 'hidden',
|
|
68
|
-
display: '-webkit-box',
|
|
69
|
-
'-webkit-box-orient': 'vertical',
|
|
70
|
-
'-webkit-line-clamp': '3',
|
|
71
|
-
whiteSpace: 'pre-wrap',
|
|
72
|
-
wordBreak: 'break-word',
|
|
73
|
-
}}>
|
|
74
|
-
{description}
|
|
75
|
-
</Typography>
|
|
76
|
-
</Tooltip>
|
|
77
|
-
</Box>
|
|
78
|
-
{extraContent}
|
|
79
|
-
<Box>{actions}</Box>
|
|
80
|
-
</Box>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
BaseStatus.propTypes = {
|
|
85
|
-
icon: PropTypes.any,
|
|
86
|
-
title: PropTypes.string,
|
|
87
|
-
color: PropTypes.string,
|
|
88
|
-
description: PropTypes.string,
|
|
89
|
-
extraContent: PropTypes.node,
|
|
90
|
-
actions: PropTypes.node,
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
function MfaCode({ title = '', mfaCode = 0 }) {
|
|
94
|
-
return (
|
|
95
|
-
<Box
|
|
96
|
-
className="status-mfa"
|
|
97
|
-
sx={{
|
|
98
|
-
display: 'flex',
|
|
99
|
-
flexDirection: 'column',
|
|
100
|
-
justifyContent: 'center',
|
|
101
|
-
alignItems: 'center',
|
|
102
|
-
border: '1px solid',
|
|
103
|
-
borderColor: 'grey.200',
|
|
104
|
-
borderRadius: 1,
|
|
105
|
-
maxWidth: '360px',
|
|
106
|
-
backgroundColor: 'transparent',
|
|
107
|
-
p: 1,
|
|
108
|
-
}}>
|
|
109
|
-
<Box
|
|
110
|
-
className="status-mfa-tip"
|
|
111
|
-
sx={{
|
|
112
|
-
textAlign: 'center',
|
|
113
|
-
textWrap: 'balance',
|
|
114
|
-
}}>
|
|
115
|
-
{title}
|
|
116
|
-
</Box>
|
|
117
|
-
<Typography
|
|
118
|
-
className="status-mfa-code"
|
|
119
|
-
sx={{
|
|
120
|
-
mt: 1,
|
|
121
|
-
lineHeight: 1,
|
|
122
|
-
fontSize: '36px',
|
|
123
|
-
fontWeight: 700,
|
|
124
|
-
letterSpacing: 1,
|
|
125
|
-
}}>
|
|
126
|
-
{mfaCode}
|
|
127
|
-
</Typography>
|
|
128
|
-
</Box>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
MfaCode.propTypes = {
|
|
132
|
-
title: PropTypes.string,
|
|
133
|
-
mfaCode: PropTypes.number,
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Status (scanned/succeed/error/busy)
|
|
138
|
-
*/
|
|
139
|
-
export default function ConnectStatus({
|
|
140
|
-
status = '',
|
|
141
|
-
nextWorkflow = '',
|
|
142
|
-
mfaCode = 0,
|
|
143
|
-
onCancel = noop,
|
|
144
|
-
onRetry = noop,
|
|
145
|
-
onClose = noop,
|
|
146
|
-
messages,
|
|
147
|
-
locale = 'en',
|
|
148
|
-
isFullScreen = false,
|
|
149
|
-
loadingIcon = null,
|
|
150
|
-
chooseMethod = 'DID Wallet',
|
|
151
|
-
hideRetry = false,
|
|
152
|
-
hideBack = false,
|
|
153
|
-
...rest
|
|
154
|
-
}) {
|
|
155
|
-
const t = useMemoizedFn((key, data = {}) => {
|
|
156
|
-
return translate(translations, key, locale, 'en', data);
|
|
157
|
-
});
|
|
158
|
-
const { palette } = useTheme();
|
|
159
|
-
const closeButton = (
|
|
160
|
-
<ActionButton sx={{ color: 'text.secondary' }} onClick={onClose}>
|
|
161
|
-
{t('close')}
|
|
162
|
-
</ActionButton>
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
return (
|
|
166
|
-
<Box
|
|
167
|
-
{...rest}
|
|
168
|
-
sx={{
|
|
169
|
-
p: 2,
|
|
170
|
-
minHeight: 200,
|
|
171
|
-
...rest.sx,
|
|
172
|
-
}}>
|
|
173
|
-
{status === 'scanned' && !nextWorkflow && (
|
|
174
|
-
<BaseStatus
|
|
175
|
-
icon={
|
|
176
|
-
<LoadingMask size={52} borderRadius={12}>
|
|
177
|
-
{loadingIcon || <ProviderIcon provider={LOGIN_PROVIDER.DID_WALLET} width="100%" height="100%" />}
|
|
178
|
-
</LoadingMask>
|
|
179
|
-
}
|
|
180
|
-
title={t('requestConnect')}
|
|
181
|
-
description={t('continueInWallet', { method: chooseMethod })}
|
|
182
|
-
extraContent={mfaCode > 0 && <MfaCode mfaCode={mfaCode} title={t('mfaCode')} />}
|
|
183
|
-
actions={hideBack ? closeButton : <BackButton onClick={onCancel} />}
|
|
184
|
-
/>
|
|
185
|
-
)}
|
|
186
|
-
{status === 'scanned' && !!nextWorkflow && (
|
|
187
|
-
<BaseStatus
|
|
188
|
-
color={palette.secondary.main}
|
|
189
|
-
icon={hourglassEmptyRoundedIcon}
|
|
190
|
-
title={t('wait')}
|
|
191
|
-
description={t('waiting')}
|
|
192
|
-
extraContent={mfaCode > 0 && <MfaCode mfaCode={mfaCode} title={t('mfaCode')} />}
|
|
193
|
-
actions={hideBack ? closeButton : <BackButton onClick={onCancel} />}
|
|
194
|
-
/>
|
|
195
|
-
)}
|
|
196
|
-
{status === 'succeed' && (
|
|
197
|
-
<BaseStatus
|
|
198
|
-
color="success.light"
|
|
199
|
-
icon={<Success size={52} borderWidth={3} />}
|
|
200
|
-
title={t('success')}
|
|
201
|
-
description={messages.success}
|
|
202
|
-
actions={isFullScreen ? null : closeButton}
|
|
203
|
-
/>
|
|
204
|
-
)}
|
|
205
|
-
{status === 'error' && (
|
|
206
|
-
<BaseStatus
|
|
207
|
-
color={palette.error.main}
|
|
208
|
-
icon={closeRoundedIcon}
|
|
209
|
-
title={t('failed')}
|
|
210
|
-
description={messages.error || t('error')}
|
|
211
|
-
actions={
|
|
212
|
-
<Box sx={{ display: 'flex', gap: 1 }}>
|
|
213
|
-
{hideBack ? closeButton : <BackButton onClick={onCancel} />}
|
|
214
|
-
{hideRetry ? null : (
|
|
215
|
-
<ActionButton
|
|
216
|
-
onClick={onRetry}
|
|
217
|
-
sx={{
|
|
218
|
-
color: 'primary.main',
|
|
219
|
-
borderColor: 'primary.light',
|
|
220
|
-
}}>
|
|
221
|
-
{t('retry')}
|
|
222
|
-
</ActionButton>
|
|
223
|
-
)}
|
|
224
|
-
</Box>
|
|
225
|
-
}
|
|
226
|
-
/>
|
|
227
|
-
)}
|
|
228
|
-
{status === 'busy' && (
|
|
229
|
-
<BaseStatus
|
|
230
|
-
color="warning.main"
|
|
231
|
-
icon={ruleSettingsRoundedIcon}
|
|
232
|
-
title={t('busyTitle')}
|
|
233
|
-
description={messages.error || t('busyDesc')}
|
|
234
|
-
actions={hideBack ? closeButton : <BackButton onClick={onCancel} />}
|
|
235
|
-
/>
|
|
236
|
-
)}
|
|
237
|
-
</Box>
|
|
238
|
-
);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
ConnectStatus.propTypes = {
|
|
242
|
-
status: PropTypes.string,
|
|
243
|
-
nextWorkflow: PropTypes.string,
|
|
244
|
-
mfaCode: PropTypes.number,
|
|
245
|
-
onCancel: PropTypes.func,
|
|
246
|
-
onRetry: PropTypes.func,
|
|
247
|
-
onClose: PropTypes.func,
|
|
248
|
-
messages: PropTypes.shape({
|
|
249
|
-
confirm: PropTypes.string.isRequired,
|
|
250
|
-
success: PropTypes.any.isRequired,
|
|
251
|
-
error: PropTypes.any.isRequired,
|
|
252
|
-
}).isRequired,
|
|
253
|
-
locale: PropTypes.oneOf(['en', 'zh']),
|
|
254
|
-
isFullScreen: PropTypes.bool,
|
|
255
|
-
loadingIcon: PropTypes.any,
|
|
256
|
-
chooseMethod: PropTypes.string,
|
|
257
|
-
hideRetry: PropTypes.bool,
|
|
258
|
-
hideBack: PropTypes.bool,
|
|
259
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { Icon } from '@iconify/react';
|
|
3
|
-
import { Box, Tooltip, Typography } from '@mui/material';
|
|
4
|
-
import infoOutlineRoundedIcon from '@iconify-icons/material-symbols/info-outline-rounded';
|
|
5
|
-
import swapHorizRoundedIcon from '@iconify-icons/material-symbols/swap-horiz-rounded';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import SwitchApp from './switch-app';
|
|
8
|
-
|
|
9
|
-
export default function DIDConnectTitle({ title, description, extraContent = null, disableSwitchApp = false }) {
|
|
10
|
-
const [showSwitch, setShowSwitch] = useState(false);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<Box
|
|
14
|
-
sx={{
|
|
15
|
-
display: 'flex',
|
|
16
|
-
flexDirection: 'column',
|
|
17
|
-
gap: 0.5,
|
|
18
|
-
}}>
|
|
19
|
-
<Typography
|
|
20
|
-
component="h1"
|
|
21
|
-
variant="h4"
|
|
22
|
-
sx={{
|
|
23
|
-
color: 'text.primary',
|
|
24
|
-
fontWeight: 700,
|
|
25
|
-
fontFamily: 'Lexend',
|
|
26
|
-
display: 'flex',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
gap: 0.5,
|
|
29
|
-
}}
|
|
30
|
-
onClick={(e) => {
|
|
31
|
-
if (disableSwitchApp) return;
|
|
32
|
-
// HACK: 连续点击三次才触发
|
|
33
|
-
if (e.detail > 2) {
|
|
34
|
-
setShowSwitch(true);
|
|
35
|
-
}
|
|
36
|
-
}}>
|
|
37
|
-
{title}
|
|
38
|
-
<SwitchApp
|
|
39
|
-
sx={{
|
|
40
|
-
fontSize: 0,
|
|
41
|
-
display: showSwitch ? 'block' : 'none',
|
|
42
|
-
}}>
|
|
43
|
-
<Icon
|
|
44
|
-
icon={swapHorizRoundedIcon}
|
|
45
|
-
style={{
|
|
46
|
-
fontSize: '14px',
|
|
47
|
-
}}
|
|
48
|
-
/>
|
|
49
|
-
</SwitchApp>
|
|
50
|
-
</Typography>
|
|
51
|
-
<Typography
|
|
52
|
-
variant="body2"
|
|
53
|
-
sx={{
|
|
54
|
-
color: 'text.secondary',
|
|
55
|
-
fontFamily: 'Lexend',
|
|
56
|
-
fontSize: 13,
|
|
57
|
-
}}>
|
|
58
|
-
{description}
|
|
59
|
-
{extraContent ? (
|
|
60
|
-
<Tooltip
|
|
61
|
-
title={extraContent}
|
|
62
|
-
arrow
|
|
63
|
-
slotProps={{
|
|
64
|
-
tooltip: {
|
|
65
|
-
sx: {
|
|
66
|
-
'&>.MuiTypography-root': {
|
|
67
|
-
color: 'primary.contrastText',
|
|
68
|
-
fontFamily: 'Lexend',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
popper: {
|
|
73
|
-
modifiers: [
|
|
74
|
-
{
|
|
75
|
-
name: 'offset',
|
|
76
|
-
options: {
|
|
77
|
-
offset: [0, -8],
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
}}>
|
|
83
|
-
<Box
|
|
84
|
-
component={Icon}
|
|
85
|
-
icon={infoOutlineRoundedIcon}
|
|
86
|
-
sx={{
|
|
87
|
-
fontSize: 14,
|
|
88
|
-
display: 'inline-block',
|
|
89
|
-
verticalAlign: 'middle',
|
|
90
|
-
ml: 0.5,
|
|
91
|
-
cursor: 'pointer',
|
|
92
|
-
transform: 'translateY(-1px)',
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
|
-
</Tooltip>
|
|
96
|
-
) : null}
|
|
97
|
-
</Typography>
|
|
98
|
-
</Box>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
DIDConnectTitle.propTypes = {
|
|
103
|
-
title: PropTypes.string.isRequired,
|
|
104
|
-
description: PropTypes.string.isRequired,
|
|
105
|
-
extraContent: PropTypes.any,
|
|
106
|
-
disableSwitchApp: PropTypes.bool,
|
|
107
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Box, Tooltip } from '@mui/material';
|
|
2
|
-
import { useCreation } from 'ahooks';
|
|
3
|
-
import { mergeSx } from '@arcblock/ux/lib/Util/style';
|
|
4
|
-
|
|
5
|
-
import { useStateContext } from '../contexts/state';
|
|
6
|
-
|
|
7
|
-
export default function DownloadTips({ ...rest }) {
|
|
8
|
-
const { t, locale } = useStateContext();
|
|
9
|
-
const downloadUrl = useCreation(() => {
|
|
10
|
-
if (['zh', 'en'].includes) {
|
|
11
|
-
return `https://www.didwallet.io/${locale}`;
|
|
12
|
-
}
|
|
13
|
-
return 'https://www.didwallet.io/en';
|
|
14
|
-
}, [locale]);
|
|
15
|
-
|
|
16
|
-
const tips = t('downloadTips');
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Tooltip
|
|
20
|
-
title={tips}
|
|
21
|
-
arrow
|
|
22
|
-
placement="top"
|
|
23
|
-
slotProps={{
|
|
24
|
-
popper: {
|
|
25
|
-
modifiers: [
|
|
26
|
-
{
|
|
27
|
-
name: 'offset',
|
|
28
|
-
options: {
|
|
29
|
-
offset: [0, -8],
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
}}>
|
|
35
|
-
<Box
|
|
36
|
-
component="a"
|
|
37
|
-
href={downloadUrl}
|
|
38
|
-
target="_blank"
|
|
39
|
-
rel="noopener"
|
|
40
|
-
{...rest}
|
|
41
|
-
sx={mergeSx(
|
|
42
|
-
{
|
|
43
|
-
color: 'primary.main',
|
|
44
|
-
textDecoration: 'none',
|
|
45
|
-
'&:hover': {
|
|
46
|
-
textDecoration: 'dashed underline',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
rest?.sx
|
|
50
|
-
)}>
|
|
51
|
-
DID Wallet
|
|
52
|
-
</Box>
|
|
53
|
-
</Tooltip>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/require-default-props */
|
|
2
|
-
import { Box, CircularProgress } from '@mui/material';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
// HACK: 默认的 size 是精心调整过的,不要随意更改
|
|
6
|
-
export default function Loading({ size = 92.5, loadingSize = 30 }) {
|
|
7
|
-
return (
|
|
8
|
-
<Box
|
|
9
|
-
sx={{
|
|
10
|
-
height: '100%',
|
|
11
|
-
minWidth: size,
|
|
12
|
-
minHeight: size,
|
|
13
|
-
display: 'flex',
|
|
14
|
-
justifyContent: 'center',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
}}>
|
|
17
|
-
<CircularProgress size={loadingSize} sx={{ color: 'secondary.main' }} />
|
|
18
|
-
</Box>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Loading.propTypes = {
|
|
23
|
-
size: PropTypes.number,
|
|
24
|
-
loadingSize: PropTypes.number,
|
|
25
|
-
};
|