@arcblock/ux 2.9.67 → 2.9.69
Sign up to get free protection for your applications and to get access to all the features.
- package/es/Button/wrap.js +1 -1
- package/es/Colors/themes/temp.js +2 -1
- package/es/Dialog/types.d.ts +3 -0
- package/es/Dialog/use-confirm.js +18 -4
- package/es/Layout/dashboard/index.js +0 -2
- package/es/SessionUser/components/session-user-item.js +14 -4
- package/es/Tabs/index.js +1 -1
- package/es/Util/constant.js +26 -0
- package/es/Util/federated.js +12 -0
- package/es/WalletOSIcon/index.js +5 -3
- package/lib/Button/wrap.js +1 -1
- package/lib/Colors/themes/temp.js +2 -1
- package/lib/Dialog/types.d.ts +3 -0
- package/lib/Dialog/use-confirm.js +22 -4
- package/lib/Layout/dashboard/index.js +1 -1
- package/lib/SessionUser/components/session-user-item.js +13 -3
- package/lib/Tabs/index.js +1 -1
- package/lib/Util/constant.js +27 -1
- package/lib/Util/federated.js +13 -0
- package/lib/WalletOSIcon/index.js +6 -3
- package/package.json +8 -8
- package/src/Button/wrap.js +1 -1
- package/src/Colors/themes/temp.js +2 -0
- package/src/Dialog/types.d.ts +3 -0
- package/src/Dialog/use-confirm.jsx +16 -2
- package/src/Layout/dashboard/index.js +0 -2
- package/src/SessionUser/components/session-user-item.jsx +19 -2
- package/src/Tabs/index.jsx +1 -1
- package/src/Util/constant.js +28 -0
- package/src/Util/federated.js +13 -0
- package/src/WalletOSIcon/index.jsx +5 -3
- /package/src/ErrorBoundary/{fallback.js → fallback.jsx} +0 -0
- /package/src/ErrorBoundary/{index.js → index.jsx} +0 -0
package/es/Button/wrap.js
CHANGED
@@ -34,7 +34,7 @@ const extendedColors = {
|
|
34
34
|
* @typedef {{
|
35
35
|
* rounded?: boolean,
|
36
36
|
* loading?: boolean,
|
37
|
-
* forwardedRef
|
37
|
+
* forwardedRef?: import('react').ForwardedRef<any>,
|
38
38
|
* color?: 'default' | 'inherit' | 'primary' | 'secondary' | 'danger' | 'warning' | 'reverse' | 'did'
|
39
39
|
* } & import('@mui/material').ButtonProps} ButtonProps
|
40
40
|
*/
|
package/es/Colors/themes/temp.js
CHANGED
@@ -35,6 +35,7 @@ const colors = {
|
|
35
35
|
buttonsButtonNeutralHover: 'rgba(243, 244, 246, 1)',
|
36
36
|
buttonsButtonInverted: 'rgba(3, 7, 18, 1)',
|
37
37
|
buttonsButtonInvertedHover: 'rgba(17, 24, 39, 1)',
|
38
|
-
buttonsButtonDanger: 'rgba(225, 29, 72, 1)'
|
38
|
+
buttonsButtonDanger: 'rgba(225, 29, 72, 1)',
|
39
|
+
red: '#FF6369'
|
39
40
|
};
|
40
41
|
export default colors;
|
package/es/Dialog/types.d.ts
CHANGED
@@ -10,5 +10,8 @@ export type OpenConfirmProps = {
|
|
10
10
|
cancelButtonText: string;
|
11
11
|
};
|
12
12
|
|
13
|
+
export type UpdateConfirmProps = Partial<Pick<OpenConfirmProps, 'title' | 'content'>>;
|
14
|
+
|
13
15
|
export type OpenConfirm = (params: OpenConfirmProps) => void;
|
14
16
|
export type CloseConfirm = () => void;
|
17
|
+
export type UpdateConfirm = (params: UpdateConfirmProps) => void;
|
package/es/Dialog/use-confirm.js
CHANGED
@@ -44,6 +44,10 @@ const ConfirmHolder = /*#__PURE__*/forwardRef((props, ref) => {
|
|
44
44
|
reset();
|
45
45
|
}, 300);
|
46
46
|
});
|
47
|
+
const update = useMemoizedFn(params => {
|
48
|
+
if (params.title) setTitle(params.title);
|
49
|
+
if (params.content) setContent(params.content);
|
50
|
+
});
|
47
51
|
const onCancel = useMemoizedFn((e, reason) => {
|
48
52
|
close();
|
49
53
|
state?.onCancel(e, reason);
|
@@ -59,9 +63,10 @@ const ConfirmHolder = /*#__PURE__*/forwardRef((props, ref) => {
|
|
59
63
|
useImperativeHandle(ref, () => {
|
60
64
|
return {
|
61
65
|
open,
|
62
|
-
close
|
66
|
+
close,
|
67
|
+
update
|
63
68
|
};
|
64
|
-
}, [open, close]);
|
69
|
+
}, [open, close, update]);
|
65
70
|
return /*#__PURE__*/_jsx(Confirm, {
|
66
71
|
...props,
|
67
72
|
open: state.show,
|
@@ -99,15 +104,24 @@ export default function useConfirm(props = {}) {
|
|
99
104
|
confirmRef.current?.open(...args);
|
100
105
|
});
|
101
106
|
/**
|
102
|
-
*
|
107
|
+
* 关闭一个弹窗
|
103
108
|
* @type {import('./types').CloseConfirm}
|
104
109
|
*/
|
105
110
|
const close = useMemoizedFn((...args) => {
|
106
111
|
confirmRef.current?.close(...args);
|
107
112
|
});
|
113
|
+
|
114
|
+
/**
|
115
|
+
* 更新弹窗的 title 和 content
|
116
|
+
* @type {import('./types').UpdateConfirm}
|
117
|
+
*/
|
118
|
+
const update = useMemoizedFn((...args) => {
|
119
|
+
confirmRef.current?.update(...args);
|
120
|
+
});
|
108
121
|
const confirmApi = {
|
109
122
|
open,
|
110
|
-
close
|
123
|
+
close,
|
124
|
+
update
|
111
125
|
};
|
112
126
|
return {
|
113
127
|
confirmHolder: /*#__PURE__*/_jsx(ConfirmHolder, {
|
@@ -240,8 +240,6 @@ const Wrapper = styled('div', {
|
|
240
240
|
.header-logo {
|
241
241
|
display: flex;
|
242
242
|
justify-content: center;
|
243
|
-
/* logo 与 sidebar 中的 icon 垂直对齐, sidebarWidth - 24 * 2 */
|
244
|
-
min-width: ${props => props.sidebarWidth - 24 * 2}px;
|
245
243
|
}
|
246
244
|
&.dashboard-dense {
|
247
245
|
.header-logo {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import { forwardRef } from 'react';
|
3
|
-
import { Box, IconButton, Typography } from '@mui/material';
|
3
|
+
import { Box, IconButton, Tooltip, Typography } from '@mui/material';
|
4
4
|
import { Icon } from '@iconify/react';
|
5
5
|
import LensIcon from '@iconify-icons/material-symbols/lens';
|
6
6
|
import WalletOSIcon from '../../WalletOSIcon';
|
@@ -34,6 +34,7 @@ const SessionUserItem = /*#__PURE__*/forwardRef(({
|
|
34
34
|
display: 'flex',
|
35
35
|
alignItems: 'center',
|
36
36
|
gap: 0.5,
|
37
|
+
overflow: 'hidden',
|
37
38
|
'& .did-address-avatar': {
|
38
39
|
display: 'none !important'
|
39
40
|
},
|
@@ -63,11 +64,20 @@ const SessionUserItem = /*#__PURE__*/forwardRef(({
|
|
63
64
|
sx: {
|
64
65
|
lineHeight: 1
|
65
66
|
}
|
66
|
-
}) : sessionItem.user.email && /*#__PURE__*/_jsx(
|
67
|
+
}) : sessionItem.user.email && /*#__PURE__*/_jsx(Tooltip, {
|
68
|
+
title: sessionItem.user.email,
|
67
69
|
sx: {
|
68
|
-
|
70
|
+
zIndex: 1600
|
69
71
|
},
|
70
|
-
|
72
|
+
placement: "top",
|
73
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
74
|
+
sx: {
|
75
|
+
fontSize: 14,
|
76
|
+
overflow: 'hidden',
|
77
|
+
textOverflow: 'ellipsis'
|
78
|
+
},
|
79
|
+
children: sessionItem.user.email
|
80
|
+
})
|
71
81
|
})]
|
72
82
|
}), statusContent || active && /*#__PURE__*/_jsx(IconButton, {
|
73
83
|
size: "small",
|
package/es/Tabs/index.js
CHANGED
package/es/Util/constant.js
CHANGED
@@ -12,4 +12,30 @@ export const DID_PREFIX = 'did:abt:';
|
|
12
12
|
export const PASSPORT_STATUS = {
|
13
13
|
VALID: 'valid',
|
14
14
|
REVOKED: 'revoked'
|
15
|
+
};
|
16
|
+
export const LOGIN_PROVIDER = {
|
17
|
+
// EMAIL: 'Email',
|
18
|
+
AUTH0: 'auth0',
|
19
|
+
APPLE: 'apple',
|
20
|
+
GITHUB: 'github',
|
21
|
+
GOOGLE: 'google',
|
22
|
+
WALLET: 'wallet',
|
23
|
+
NFT: 'nft'
|
24
|
+
};
|
25
|
+
export const LOGIN_PROVIDER_NAME = {
|
26
|
+
// [LOGIN_PROVIDER.EMAIL]: 'Email',
|
27
|
+
[LOGIN_PROVIDER.AUTH0]: 'Email',
|
28
|
+
[LOGIN_PROVIDER.APPLE]: 'Apple',
|
29
|
+
[LOGIN_PROVIDER.GITHUB]: 'Github',
|
30
|
+
[LOGIN_PROVIDER.GOOGLE]: 'Google',
|
31
|
+
[LOGIN_PROVIDER.WALLET]: 'DID Wallet',
|
32
|
+
[LOGIN_PROVIDER.NFT]: 'NFT'
|
33
|
+
};
|
34
|
+
|
35
|
+
// HACK: 目前这里的键值不能使用 [LOGIN_PROVIDER.AUTH0] 形式,否则会影响 ts 的 keyof typeof OAUTH_PROVIDER 来获取键值作为类型的判断
|
36
|
+
export const OAUTH_PROVIDER = {
|
37
|
+
auth0: 'Email',
|
38
|
+
apple: 'Apple',
|
39
|
+
github: 'Github',
|
40
|
+
google: 'Google'
|
15
41
|
};
|
package/es/Util/federated.js
CHANGED
@@ -76,4 +76,16 @@ export function getApps(blocklet) {
|
|
76
76
|
}
|
77
77
|
// NOTICE: masterApp 应该排在前面
|
78
78
|
return appList.reverse();
|
79
|
+
}
|
80
|
+
export async function getBlockletData(appUrl) {
|
81
|
+
try {
|
82
|
+
const url = new URL('__blocklet__.js', appUrl);
|
83
|
+
url.searchParams.set('type', 'json');
|
84
|
+
const res = await fetch(url.href);
|
85
|
+
const jsonData = await res.json();
|
86
|
+
return jsonData;
|
87
|
+
} catch (err) {
|
88
|
+
console.error(`Failed to get blocklet data: ${appUrl}`, err);
|
89
|
+
return null;
|
90
|
+
}
|
79
91
|
}
|
package/es/WalletOSIcon/index.js
CHANGED
@@ -5,7 +5,9 @@ import IOSRoundedIcon from '@iconify-icons/material-symbols/ios-rounded';
|
|
5
5
|
import LanguageIcon from '@iconify-icons/material-symbols/language';
|
6
6
|
import AndroidIcon from '@iconify-icons/material-symbols/android';
|
7
7
|
import QuestionMarkRoundedIcon from '@iconify-icons/material-symbols/question-mark-rounded';
|
8
|
-
import Auth0Icon from '@iconify-icons/logos/auth0-icon';
|
8
|
+
// import Auth0Icon from '@iconify-icons/logos/auth0-icon';
|
9
|
+
import MailOutlineRoundedIcon from '@iconify-icons/material-symbols/mail-outline-rounded';
|
10
|
+
import { LOGIN_PROVIDER } from '../../es/Util/constant';
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
12
|
export default function WalletOSIcon({
|
11
13
|
loading,
|
@@ -21,9 +23,9 @@ export default function WalletOSIcon({
|
|
21
23
|
}
|
22
24
|
});
|
23
25
|
}
|
24
|
-
if (provider ===
|
26
|
+
if (provider === LOGIN_PROVIDER.AUTH0) {
|
25
27
|
return /*#__PURE__*/_jsx(Icon, {
|
26
|
-
icon:
|
28
|
+
icon: MailOutlineRoundedIcon,
|
27
29
|
style: {
|
28
30
|
color,
|
29
31
|
transform: 'scale(0.85)'
|
package/lib/Button/wrap.js
CHANGED
@@ -48,7 +48,7 @@ const extendedColors = {
|
|
48
48
|
* @typedef {{
|
49
49
|
* rounded?: boolean,
|
50
50
|
* loading?: boolean,
|
51
|
-
* forwardedRef
|
51
|
+
* forwardedRef?: import('react').ForwardedRef<any>,
|
52
52
|
* color?: 'default' | 'inherit' | 'primary' | 'secondary' | 'danger' | 'warning' | 'reverse' | 'did'
|
53
53
|
* } & import('@mui/material').ButtonProps} ButtonProps
|
54
54
|
*/
|
@@ -41,6 +41,7 @@ const colors = {
|
|
41
41
|
buttonsButtonNeutralHover: 'rgba(243, 244, 246, 1)',
|
42
42
|
buttonsButtonInverted: 'rgba(3, 7, 18, 1)',
|
43
43
|
buttonsButtonInvertedHover: 'rgba(17, 24, 39, 1)',
|
44
|
-
buttonsButtonDanger: 'rgba(225, 29, 72, 1)'
|
44
|
+
buttonsButtonDanger: 'rgba(225, 29, 72, 1)',
|
45
|
+
red: '#FF6369'
|
45
46
|
};
|
46
47
|
var _default = exports.default = colors;
|
package/lib/Dialog/types.d.ts
CHANGED
@@ -10,5 +10,8 @@ export type OpenConfirmProps = {
|
|
10
10
|
cancelButtonText: string;
|
11
11
|
};
|
12
12
|
|
13
|
+
export type UpdateConfirmProps = Partial<Pick<OpenConfirmProps, 'title' | 'content'>>;
|
14
|
+
|
13
15
|
export type OpenConfirm = (params: OpenConfirmProps) => void;
|
14
16
|
export type CloseConfirm = () => void;
|
17
|
+
export type UpdateConfirm = (params: UpdateConfirmProps) => void;
|
@@ -58,6 +58,10 @@ const ConfirmHolder = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
58
58
|
reset();
|
59
59
|
}, 300);
|
60
60
|
});
|
61
|
+
const update = (0, _ahooks.useMemoizedFn)(params => {
|
62
|
+
if (params.title) setTitle(params.title);
|
63
|
+
if (params.content) setContent(params.content);
|
64
|
+
});
|
61
65
|
const onCancel = (0, _ahooks.useMemoizedFn)((e, reason) => {
|
62
66
|
close();
|
63
67
|
state === null || state === void 0 ? void 0 : state.onCancel(e, reason);
|
@@ -73,9 +77,10 @@ const ConfirmHolder = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
73
77
|
(0, _react.useImperativeHandle)(ref, () => {
|
74
78
|
return {
|
75
79
|
open,
|
76
|
-
close
|
80
|
+
close,
|
81
|
+
update
|
77
82
|
};
|
78
|
-
}, [open, close]);
|
83
|
+
}, [open, close, update]);
|
79
84
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, _objectSpread(_objectSpread({}, props), {}, {
|
80
85
|
open: state.show,
|
81
86
|
title: title,
|
@@ -117,7 +122,7 @@ function useConfirm() {
|
|
117
122
|
(_confirmRef$current = confirmRef.current) === null || _confirmRef$current === void 0 ? void 0 : _confirmRef$current.open(...args);
|
118
123
|
});
|
119
124
|
/**
|
120
|
-
*
|
125
|
+
* 关闭一个弹窗
|
121
126
|
* @type {import('./types').CloseConfirm}
|
122
127
|
*/
|
123
128
|
const close = (0, _ahooks.useMemoizedFn)(function () {
|
@@ -127,9 +132,22 @@ function useConfirm() {
|
|
127
132
|
}
|
128
133
|
(_confirmRef$current2 = confirmRef.current) === null || _confirmRef$current2 === void 0 ? void 0 : _confirmRef$current2.close(...args);
|
129
134
|
});
|
135
|
+
|
136
|
+
/**
|
137
|
+
* 更新弹窗的 title 和 content
|
138
|
+
* @type {import('./types').UpdateConfirm}
|
139
|
+
*/
|
140
|
+
const update = (0, _ahooks.useMemoizedFn)(function () {
|
141
|
+
var _confirmRef$current3;
|
142
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
143
|
+
args[_key3] = arguments[_key3];
|
144
|
+
}
|
145
|
+
(_confirmRef$current3 = confirmRef.current) === null || _confirmRef$current3 === void 0 ? void 0 : _confirmRef$current3.update(...args);
|
146
|
+
});
|
130
147
|
const confirmApi = {
|
131
148
|
open,
|
132
|
-
close
|
149
|
+
close,
|
150
|
+
update
|
133
151
|
};
|
134
152
|
return {
|
135
153
|
confirmHolder: /*#__PURE__*/(0, _jsxRuntime.jsx)(ConfirmHolder, _objectSpread(_objectSpread({}, props), {}, {
|
@@ -212,7 +212,7 @@ Dashboard.defaultProps = {
|
|
212
212
|
};
|
213
213
|
const Wrapper = (0, _Theme.styled)('div', {
|
214
214
|
shouldForwardProp: prop => prop !== 'sidebarWidth'
|
215
|
-
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.dashboard {\n display: flex;\n flex-direction: column;\n height: 100vh;\n }\n .dashboard-body {\n overflow: hidden;\n flex: 1;\n }\n .dashboard-sidebar {\n box-sizing: border-box;\n flex: 0 0 auto;\n width: ", "px;\n overflow: hidden;\n &:hover {\n overflow-y: auto;\n }\n }\n .dashboard-sidebar-container {\n width: ", "px;\n }\n .dashboard-main {\n display: flex;\n flex-direction: column;\n overflow: auto;\n flex: 1;\n position: relative;\n }\n .dashboard-content {\n flex: 1;\n }\n &.dashboard-dense {\n .dashboard-header {\n border-bottom: 1px solid #eee;\n }\n .dashboard-sidebar {\n width: 256px;\n border-right: 1px solid #eee;\n }\n }\n ", " {\n .header-logo {\n display: flex;\n justify-content: center;\n
|
215
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.dashboard {\n display: flex;\n flex-direction: column;\n height: 100vh;\n }\n .dashboard-body {\n overflow: hidden;\n flex: 1;\n }\n .dashboard-sidebar {\n box-sizing: border-box;\n flex: 0 0 auto;\n width: ", "px;\n overflow: hidden;\n &:hover {\n overflow-y: auto;\n }\n }\n .dashboard-sidebar-container {\n width: ", "px;\n }\n .dashboard-main {\n display: flex;\n flex-direction: column;\n overflow: auto;\n flex: 1;\n position: relative;\n }\n .dashboard-content {\n flex: 1;\n }\n &.dashboard-dense {\n .dashboard-header {\n border-bottom: 1px solid #eee;\n }\n .dashboard-sidebar {\n width: 256px;\n border-right: 1px solid #eee;\n }\n }\n ", " {\n .header-logo {\n display: flex;\n justify-content: center;\n }\n &.dashboard-dense {\n .header-logo {\n /* dense = true \u65F6 logo \u4E0E sidenav icons \u4E0D\u9700\u8981\u5BF9\u9F50 */\n width: auto;\n }\n }\n }\n"])), props => props.sidebarWidth, props => props.sidebarWidth, props => props.theme.breakpoints.up('md'));
|
216
216
|
const StyledUxHeader = (0, _Theme.styled)(_Header.ResponsiveHeader)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .header-container {\n max-width: 100%;\n }\n"])));
|
217
217
|
|
218
218
|
// 兼容旧版 dashboard
|
@@ -48,6 +48,7 @@ const SessionUserItem = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
48
48
|
display: 'flex',
|
49
49
|
alignItems: 'center',
|
50
50
|
gap: 0.5,
|
51
|
+
overflow: 'hidden',
|
51
52
|
'& .did-address-avatar': {
|
52
53
|
display: 'none !important'
|
53
54
|
},
|
@@ -77,11 +78,20 @@ const SessionUserItem = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
77
78
|
sx: {
|
78
79
|
lineHeight: 1
|
79
80
|
}
|
80
|
-
}) : sessionItem.user.email && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.
|
81
|
+
}) : sessionItem.user.email && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
82
|
+
title: sessionItem.user.email,
|
81
83
|
sx: {
|
82
|
-
|
84
|
+
zIndex: 1600
|
83
85
|
},
|
84
|
-
|
86
|
+
placement: "top",
|
87
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
88
|
+
sx: {
|
89
|
+
fontSize: 14,
|
90
|
+
overflow: 'hidden',
|
91
|
+
textOverflow: 'ellipsis'
|
92
|
+
},
|
93
|
+
children: sessionItem.user.email
|
94
|
+
})
|
85
95
|
})]
|
86
96
|
}), statusContent || active && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
87
97
|
size: "small",
|
package/lib/Tabs/index.js
CHANGED
package/lib/Util/constant.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.SESSION_TOKEN_STORAGE_KEY = exports.RELAY_SOCKET_PREFIX = exports.REFRESH_TOKEN_STORAGE_KEY = exports.PROFILE_URL = exports.PASSPORT_STATUS = exports.NAVIGATION_URL = exports.DID_PREFIX = exports.DEFAULT_WINDOW_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DASHBOARD_URL = exports.AUTH_SERVICE_PREFIX = exports.API_DID_PREFIX = void 0;
|
6
|
+
exports.SESSION_TOKEN_STORAGE_KEY = exports.RELAY_SOCKET_PREFIX = exports.REFRESH_TOKEN_STORAGE_KEY = exports.PROFILE_URL = exports.PASSPORT_STATUS = exports.OAUTH_PROVIDER = exports.NAVIGATION_URL = exports.LOGIN_PROVIDER_NAME = exports.LOGIN_PROVIDER = exports.DID_PREFIX = exports.DEFAULT_WINDOW_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DASHBOARD_URL = exports.AUTH_SERVICE_PREFIX = exports.API_DID_PREFIX = void 0;
|
7
7
|
const DEFAULT_TIMEOUT = exports.DEFAULT_TIMEOUT = 5 * 60;
|
8
8
|
const DEFAULT_WINDOW_TIMEOUT = exports.DEFAULT_WINDOW_TIMEOUT = 30 * 60;
|
9
9
|
const AUTH_SERVICE_PREFIX = exports.AUTH_SERVICE_PREFIX = '/.well-known/service';
|
@@ -18,4 +18,30 @@ const DID_PREFIX = exports.DID_PREFIX = 'did:abt:';
|
|
18
18
|
const PASSPORT_STATUS = exports.PASSPORT_STATUS = {
|
19
19
|
VALID: 'valid',
|
20
20
|
REVOKED: 'revoked'
|
21
|
+
};
|
22
|
+
const LOGIN_PROVIDER = exports.LOGIN_PROVIDER = {
|
23
|
+
// EMAIL: 'Email',
|
24
|
+
AUTH0: 'auth0',
|
25
|
+
APPLE: 'apple',
|
26
|
+
GITHUB: 'github',
|
27
|
+
GOOGLE: 'google',
|
28
|
+
WALLET: 'wallet',
|
29
|
+
NFT: 'nft'
|
30
|
+
};
|
31
|
+
const LOGIN_PROVIDER_NAME = exports.LOGIN_PROVIDER_NAME = {
|
32
|
+
// [LOGIN_PROVIDER.EMAIL]: 'Email',
|
33
|
+
[LOGIN_PROVIDER.AUTH0]: 'Email',
|
34
|
+
[LOGIN_PROVIDER.APPLE]: 'Apple',
|
35
|
+
[LOGIN_PROVIDER.GITHUB]: 'Github',
|
36
|
+
[LOGIN_PROVIDER.GOOGLE]: 'Google',
|
37
|
+
[LOGIN_PROVIDER.WALLET]: 'DID Wallet',
|
38
|
+
[LOGIN_PROVIDER.NFT]: 'NFT'
|
39
|
+
};
|
40
|
+
|
41
|
+
// HACK: 目前这里的键值不能使用 [LOGIN_PROVIDER.AUTH0] 形式,否则会影响 ts 的 keyof typeof OAUTH_PROVIDER 来获取键值作为类型的判断
|
42
|
+
const OAUTH_PROVIDER = exports.OAUTH_PROVIDER = {
|
43
|
+
auth0: 'Email',
|
44
|
+
apple: 'Apple',
|
45
|
+
github: 'Github',
|
46
|
+
google: 'Google'
|
21
47
|
};
|
package/lib/Util/federated.js
CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getApps = getApps;
|
7
|
+
exports.getBlockletData = getBlockletData;
|
7
8
|
exports.getConfig = getConfig;
|
8
9
|
exports.getCurrentApp = getCurrentApp;
|
9
10
|
exports.getFederatedApp = getFederatedApp;
|
@@ -97,4 +98,16 @@ function getApps(blocklet) {
|
|
97
98
|
}
|
98
99
|
// NOTICE: masterApp 应该排在前面
|
99
100
|
return appList.reverse();
|
101
|
+
}
|
102
|
+
async function getBlockletData(appUrl) {
|
103
|
+
try {
|
104
|
+
const url = new URL('__blocklet__.js', appUrl);
|
105
|
+
url.searchParams.set('type', 'json');
|
106
|
+
const res = await fetch(url.href);
|
107
|
+
const jsonData = await res.json();
|
108
|
+
return jsonData;
|
109
|
+
} catch (err) {
|
110
|
+
console.error("Failed to get blocklet data: ".concat(appUrl), err);
|
111
|
+
return null;
|
112
|
+
}
|
100
113
|
}
|
@@ -11,9 +11,12 @@ var _iosRounded = _interopRequireDefault(require("@iconify-icons/material-symbol
|
|
11
11
|
var _language = _interopRequireDefault(require("@iconify-icons/material-symbols/language"));
|
12
12
|
var _android = _interopRequireDefault(require("@iconify-icons/material-symbols/android"));
|
13
13
|
var _questionMarkRounded = _interopRequireDefault(require("@iconify-icons/material-symbols/question-mark-rounded"));
|
14
|
-
var
|
14
|
+
var _mailOutlineRounded = _interopRequireDefault(require("@iconify-icons/material-symbols/mail-outline-rounded"));
|
15
|
+
var _constant = require("../../es/Util/constant");
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
16
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
|
+
// import Auth0Icon from '@iconify-icons/logos/auth0-icon';
|
19
|
+
|
17
20
|
function WalletOSIcon(_ref) {
|
18
21
|
let {
|
19
22
|
loading,
|
@@ -29,9 +32,9 @@ function WalletOSIcon(_ref) {
|
|
29
32
|
}
|
30
33
|
});
|
31
34
|
}
|
32
|
-
if (provider ===
|
35
|
+
if (provider === _constant.LOGIN_PROVIDER.AUTH0) {
|
33
36
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
|
34
|
-
icon:
|
37
|
+
icon: _mailOutlineRounded.default,
|
35
38
|
style: {
|
36
39
|
color,
|
37
40
|
transform: 'scale(0.85)'
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.9.
|
3
|
+
"version": "2.9.69",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -355,15 +355,16 @@
|
|
355
355
|
},
|
356
356
|
"peerDependencies": {
|
357
357
|
"@mui/icons-material": ">=5.15.0",
|
358
|
-
"@mui/material": "
|
359
|
-
"react": ">=18.2.0"
|
358
|
+
"@mui/material": ">=5.15.0",
|
359
|
+
"react": ">=18.2.0",
|
360
|
+
"react-router-dom": ">=6.22.3"
|
360
361
|
},
|
361
|
-
"gitHead": "
|
362
|
+
"gitHead": "375716410d5c6dc796fbd8dcd3240b846a5e1b33",
|
362
363
|
"dependencies": {
|
363
364
|
"@arcblock/did-motif": "^1.1.13",
|
364
|
-
"@arcblock/icons": "^2.9.
|
365
|
-
"@arcblock/nft-display": "^2.9.
|
366
|
-
"@arcblock/react-hooks": "^2.9.
|
365
|
+
"@arcblock/icons": "^2.9.69",
|
366
|
+
"@arcblock/nft-display": "^2.9.69",
|
367
|
+
"@arcblock/react-hooks": "^2.9.69",
|
367
368
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
368
369
|
"@emotion/react": "^11.10.4",
|
369
370
|
"@emotion/styled": "^11.10.4",
|
@@ -399,7 +400,6 @@
|
|
399
400
|
"react-intersection-observer": "^8.34.0",
|
400
401
|
"react-lottie-player": "^1.4.3",
|
401
402
|
"react-player": "^1.15.3",
|
402
|
-
"react-router-dom": "^6.4.2",
|
403
403
|
"react-shadow": "^19.0.3",
|
404
404
|
"react-svg": "^16.1.18",
|
405
405
|
"react-use": "^17.4.0",
|
package/src/Button/wrap.js
CHANGED
@@ -22,7 +22,7 @@ const extendedColors = {
|
|
22
22
|
* @typedef {{
|
23
23
|
* rounded?: boolean,
|
24
24
|
* loading?: boolean,
|
25
|
-
* forwardedRef
|
25
|
+
* forwardedRef?: import('react').ForwardedRef<any>,
|
26
26
|
* color?: 'default' | 'inherit' | 'primary' | 'secondary' | 'danger' | 'warning' | 'reverse' | 'did'
|
27
27
|
* } & import('@mui/material').ButtonProps} ButtonProps
|
28
28
|
*/
|
package/src/Dialog/types.d.ts
CHANGED
@@ -10,5 +10,8 @@ export type OpenConfirmProps = {
|
|
10
10
|
cancelButtonText: string;
|
11
11
|
};
|
12
12
|
|
13
|
+
export type UpdateConfirmProps = Partial<Pick<OpenConfirmProps, 'title' | 'content'>>;
|
14
|
+
|
13
15
|
export type OpenConfirm = (params: OpenConfirmProps) => void;
|
14
16
|
export type CloseConfirm = () => void;
|
17
|
+
export type UpdateConfirm = (params: UpdateConfirmProps) => void;
|
@@ -46,6 +46,10 @@ const ConfirmHolder = forwardRef((props, ref) => {
|
|
46
46
|
reset();
|
47
47
|
}, 300);
|
48
48
|
});
|
49
|
+
const update = useMemoizedFn((params) => {
|
50
|
+
if (params.title) setTitle(params.title);
|
51
|
+
if (params.content) setContent(params.content);
|
52
|
+
});
|
49
53
|
const onCancel = useMemoizedFn((e, reason) => {
|
50
54
|
close();
|
51
55
|
state?.onCancel(e, reason);
|
@@ -64,9 +68,10 @@ const ConfirmHolder = forwardRef((props, ref) => {
|
|
64
68
|
return {
|
65
69
|
open,
|
66
70
|
close,
|
71
|
+
update,
|
67
72
|
};
|
68
73
|
},
|
69
|
-
[open, close]
|
74
|
+
[open, close, update]
|
70
75
|
);
|
71
76
|
|
72
77
|
return (
|
@@ -109,15 +114,24 @@ export default function useConfirm(props = {}) {
|
|
109
114
|
confirmRef.current?.open(...args);
|
110
115
|
});
|
111
116
|
/**
|
112
|
-
*
|
117
|
+
* 关闭一个弹窗
|
113
118
|
* @type {import('./types').CloseConfirm}
|
114
119
|
*/
|
115
120
|
const close = useMemoizedFn((...args) => {
|
116
121
|
confirmRef.current?.close(...args);
|
117
122
|
});
|
123
|
+
|
124
|
+
/**
|
125
|
+
* 更新弹窗的 title 和 content
|
126
|
+
* @type {import('./types').UpdateConfirm}
|
127
|
+
*/
|
128
|
+
const update = useMemoizedFn((...args) => {
|
129
|
+
confirmRef.current?.update(...args);
|
130
|
+
});
|
118
131
|
const confirmApi = {
|
119
132
|
open,
|
120
133
|
close,
|
134
|
+
update,
|
121
135
|
};
|
122
136
|
|
123
137
|
return {
|
@@ -207,8 +207,6 @@ const Wrapper = styled('div', {
|
|
207
207
|
.header-logo {
|
208
208
|
display: flex;
|
209
209
|
justify-content: center;
|
210
|
-
/* logo 与 sidebar 中的 icon 垂直对齐, sidebarWidth - 24 * 2 */
|
211
|
-
min-width: ${(props) => props.sidebarWidth - 24 * 2}px;
|
212
210
|
}
|
213
211
|
&.dashboard-dense {
|
214
212
|
.header-logo {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import { forwardRef } from 'react';
|
3
|
-
import { Box, IconButton, Typography } from '@mui/material';
|
3
|
+
import { Box, IconButton, Tooltip, Typography } from '@mui/material';
|
4
4
|
import { Icon } from '@iconify/react';
|
5
5
|
import LensIcon from '@iconify-icons/material-symbols/lens';
|
6
6
|
|
@@ -31,6 +31,7 @@ const SessionUserItem = forwardRef(({ sessionItem, statusContent, active, ...res
|
|
31
31
|
display: 'flex',
|
32
32
|
alignItems: 'center',
|
33
33
|
gap: 0.5,
|
34
|
+
overflow: 'hidden',
|
34
35
|
'& .did-address-avatar': {
|
35
36
|
display: 'none !important',
|
36
37
|
},
|
@@ -49,7 +50,23 @@ const SessionUserItem = forwardRef(({ sessionItem, statusContent, active, ...res
|
|
49
50
|
{isRawWalletAccount ? (
|
50
51
|
<DID did={sessionItem.userDid} copyable={false} size={14} responsive={false} compact sx={{ lineHeight: 1 }} />
|
51
52
|
) : (
|
52
|
-
sessionItem.user.email &&
|
53
|
+
sessionItem.user.email && (
|
54
|
+
<Tooltip
|
55
|
+
title={sessionItem.user.email}
|
56
|
+
sx={{
|
57
|
+
zIndex: 1600,
|
58
|
+
}}
|
59
|
+
placement="top">
|
60
|
+
<Typography
|
61
|
+
sx={{
|
62
|
+
fontSize: 14,
|
63
|
+
overflow: 'hidden',
|
64
|
+
textOverflow: 'ellipsis',
|
65
|
+
}}>
|
66
|
+
{sessionItem.user.email}
|
67
|
+
</Typography>
|
68
|
+
</Tooltip>
|
69
|
+
)
|
53
70
|
)}
|
54
71
|
</Box>
|
55
72
|
{statusContent ||
|
package/src/Tabs/index.jsx
CHANGED
package/src/Util/constant.js
CHANGED
@@ -17,3 +17,31 @@ export const PASSPORT_STATUS = {
|
|
17
17
|
VALID: 'valid',
|
18
18
|
REVOKED: 'revoked',
|
19
19
|
};
|
20
|
+
|
21
|
+
export const LOGIN_PROVIDER = {
|
22
|
+
// EMAIL: 'Email',
|
23
|
+
AUTH0: 'auth0',
|
24
|
+
APPLE: 'apple',
|
25
|
+
GITHUB: 'github',
|
26
|
+
GOOGLE: 'google',
|
27
|
+
WALLET: 'wallet',
|
28
|
+
NFT: 'nft',
|
29
|
+
};
|
30
|
+
|
31
|
+
export const LOGIN_PROVIDER_NAME = {
|
32
|
+
// [LOGIN_PROVIDER.EMAIL]: 'Email',
|
33
|
+
[LOGIN_PROVIDER.AUTH0]: 'Email',
|
34
|
+
[LOGIN_PROVIDER.APPLE]: 'Apple',
|
35
|
+
[LOGIN_PROVIDER.GITHUB]: 'Github',
|
36
|
+
[LOGIN_PROVIDER.GOOGLE]: 'Google',
|
37
|
+
[LOGIN_PROVIDER.WALLET]: 'DID Wallet',
|
38
|
+
[LOGIN_PROVIDER.NFT]: 'NFT',
|
39
|
+
};
|
40
|
+
|
41
|
+
// HACK: 目前这里的键值不能使用 [LOGIN_PROVIDER.AUTH0] 形式,否则会影响 ts 的 keyof typeof OAUTH_PROVIDER 来获取键值作为类型的判断
|
42
|
+
export const OAUTH_PROVIDER = {
|
43
|
+
auth0: 'Email',
|
44
|
+
apple: 'Apple',
|
45
|
+
github: 'Github',
|
46
|
+
google: 'Google',
|
47
|
+
};
|
package/src/Util/federated.js
CHANGED
@@ -88,3 +88,16 @@ export function getApps(blocklet) {
|
|
88
88
|
// NOTICE: masterApp 应该排在前面
|
89
89
|
return appList.reverse();
|
90
90
|
}
|
91
|
+
|
92
|
+
export async function getBlockletData(appUrl) {
|
93
|
+
try {
|
94
|
+
const url = new URL('__blocklet__.js', appUrl);
|
95
|
+
url.searchParams.set('type', 'json');
|
96
|
+
const res = await fetch(url.href);
|
97
|
+
const jsonData = await res.json();
|
98
|
+
return jsonData;
|
99
|
+
} catch (err) {
|
100
|
+
console.error(`Failed to get blocklet data: ${appUrl}`, err);
|
101
|
+
return null;
|
102
|
+
}
|
103
|
+
}
|
@@ -5,15 +5,17 @@ import IOSRoundedIcon from '@iconify-icons/material-symbols/ios-rounded';
|
|
5
5
|
import LanguageIcon from '@iconify-icons/material-symbols/language';
|
6
6
|
import AndroidIcon from '@iconify-icons/material-symbols/android';
|
7
7
|
import QuestionMarkRoundedIcon from '@iconify-icons/material-symbols/question-mark-rounded';
|
8
|
-
import Auth0Icon from '@iconify-icons/logos/auth0-icon';
|
8
|
+
// import Auth0Icon from '@iconify-icons/logos/auth0-icon';
|
9
|
+
import MailOutlineRoundedIcon from '@iconify-icons/material-symbols/mail-outline-rounded';
|
10
|
+
import { LOGIN_PROVIDER } from '../../es/Util/constant';
|
9
11
|
|
10
12
|
export default function WalletOSIcon({ loading, walletOS, provider, color }) {
|
11
13
|
if (loading) {
|
12
14
|
return <Icon icon={QuestionMarkRoundedIcon} style={{ color: 'transparent' }} />;
|
13
15
|
}
|
14
16
|
|
15
|
-
if (provider ===
|
16
|
-
return <Icon icon={
|
17
|
+
if (provider === LOGIN_PROVIDER.AUTH0) {
|
18
|
+
return <Icon icon={MailOutlineRoundedIcon} style={{ color, transform: 'scale(0.85)' }} />;
|
17
19
|
}
|
18
20
|
if (walletOS === 'ios') {
|
19
21
|
return <Icon icon={IOSRoundedIcon} style={{ color, transform: 'scale(1.1)' }} />;
|
File without changes
|
File without changes
|