@blocklet/ui-react 2.9.13 → 2.9.14
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/build.config.ts +29 -0
- package/es/@types/index.d.ts +63 -0
- package/es/@types/index.js +0 -0
- package/es/@types/shims.d.ts +12 -0
- package/es/Dashboard/index.d.ts +41 -0
- package/es/Dashboard/index.js +63 -97
- package/es/Footer/brand.d.ts +22 -0
- package/es/Footer/brand.js +20 -37
- package/es/Footer/copyright.d.ts +18 -0
- package/es/Footer/copyright.js +14 -16
- package/es/Footer/index.d.ts +6 -0
- package/es/Footer/index.js +30 -56
- package/es/Footer/internal-footer.d.ts +29 -0
- package/es/Footer/internal-footer.js +67 -94
- package/es/Footer/layout/plain.d.ts +15 -0
- package/es/Footer/layout/plain.js +19 -37
- package/es/Footer/layout/row.d.ts +18 -0
- package/es/Footer/layout/row.js +9 -19
- package/es/Footer/layout/standard.d.ts +15 -0
- package/es/Footer/layout/standard.js +29 -57
- package/es/Footer/links.d.ts +22 -0
- package/es/Footer/links.js +72 -104
- package/es/Footer/social-media.d.ts +14 -0
- package/es/Footer/social-media.js +35 -35
- package/es/Header/index.d.ts +9 -0
- package/es/Header/index.js +55 -100
- package/es/Icon/index.d.ts +23 -0
- package/es/Icon/index.js +23 -58
- package/es/UserCenter/assets/banner.png +0 -0
- package/es/UserCenter/components/notification.d.ts +5 -0
- package/es/UserCenter/components/notification.js +276 -0
- package/es/UserCenter/components/passport.d.ts +6 -0
- package/es/UserCenter/components/passport.js +69 -0
- package/es/UserCenter/components/privacy.d.ts +11 -0
- package/es/UserCenter/components/privacy.js +99 -0
- package/es/UserCenter/components/settings.d.ts +10 -0
- package/es/UserCenter/components/settings.js +68 -0
- package/es/UserCenter/components/user-basic-info.d.ts +8 -0
- package/es/UserCenter/components/user-basic-info.js +66 -0
- package/es/UserCenter/components/user-center.d.ts +9 -0
- package/es/UserCenter/components/user-center.js +397 -0
- package/es/UserCenter/components/user-info-item.d.ts +10 -0
- package/es/UserCenter/components/user-info-item.js +54 -0
- package/es/UserCenter/components/user-info.d.ts +6 -0
- package/es/UserCenter/components/user-info.js +68 -0
- package/es/UserCenter/components/webhook-item.d.ts +3 -0
- package/es/UserCenter/components/webhook-item.js +243 -0
- package/es/UserCenter/index.d.ts +1 -0
- package/es/UserCenter/index.js +1 -0
- package/es/UserCenter/libs/client.d.ts +2 -0
- package/es/UserCenter/libs/client.js +2 -0
- package/es/UserCenter/libs/locales.d.ts +72 -0
- package/es/UserCenter/libs/locales.js +72 -0
- package/es/UserCenter/libs/utils.d.ts +4 -0
- package/es/UserCenter/libs/utils.js +14 -0
- package/es/blocklets.d.ts +16 -0
- package/es/blocklets.js +56 -45
- package/es/common/header-addons.d.ts +22 -0
- package/es/common/header-addons.js +41 -59
- package/es/common/link-blocker.d.ts +7 -0
- package/es/common/link-blocker.js +10 -17
- package/es/common/overridable-theme-provider.d.ts +18 -0
- package/es/common/overridable-theme-provider.js +6 -16
- package/es/common/wallet-hidden-topbar.d.ts +1 -0
- package/es/common/wallet-hidden-topbar.js +12 -10
- package/es/index.d.ts +5 -0
- package/es/index.js +5 -0
- package/es/types.d.ts +2 -0
- package/es/types.js +17 -11
- package/es/utils.d.ts +8 -0
- package/es/utils.js +21 -26
- package/lib/@types/index.d.ts +63 -0
- package/lib/@types/index.js +1 -0
- package/lib/@types/shims.d.ts +12 -0
- package/lib/Dashboard/index.d.ts +41 -0
- package/lib/Dashboard/index.js +44 -71
- package/lib/Footer/brand.d.ts +22 -0
- package/lib/Footer/brand.js +65 -30
- package/lib/Footer/copyright.d.ts +18 -0
- package/lib/Footer/copyright.js +18 -23
- package/lib/Footer/index.d.ts +6 -0
- package/lib/Footer/index.js +33 -42
- package/lib/Footer/internal-footer.d.ts +29 -0
- package/lib/Footer/internal-footer.js +43 -59
- package/lib/Footer/layout/plain.d.ts +15 -0
- package/lib/Footer/layout/plain.js +25 -30
- package/lib/Footer/layout/row.d.ts +18 -0
- package/lib/Footer/layout/row.js +34 -23
- package/lib/Footer/layout/standard.d.ts +15 -0
- package/lib/Footer/layout/standard.js +35 -41
- package/lib/Footer/links.d.ts +22 -0
- package/lib/Footer/links.js +163 -60
- package/lib/Footer/social-media.d.ts +14 -0
- package/lib/Footer/social-media.js +31 -25
- package/lib/Header/index.d.ts +9 -0
- package/lib/Header/index.js +83 -76
- package/lib/Icon/index.d.ts +23 -0
- package/lib/Icon/index.js +37 -51
- package/lib/UserCenter/assets/banner.png +0 -0
- package/lib/UserCenter/components/notification.d.ts +5 -0
- package/lib/UserCenter/components/notification.js +261 -0
- package/lib/UserCenter/components/passport.d.ts +6 -0
- package/lib/UserCenter/components/passport.js +86 -0
- package/lib/UserCenter/components/privacy.d.ts +11 -0
- package/lib/UserCenter/components/privacy.js +101 -0
- package/lib/UserCenter/components/settings.d.ts +10 -0
- package/lib/UserCenter/components/settings.js +81 -0
- package/lib/UserCenter/components/user-basic-info.d.ts +8 -0
- package/lib/UserCenter/components/user-basic-info.js +67 -0
- package/lib/UserCenter/components/user-center.d.ts +9 -0
- package/lib/UserCenter/components/user-center.js +376 -0
- package/lib/UserCenter/components/user-info-item.d.ts +10 -0
- package/lib/UserCenter/components/user-info-item.js +46 -0
- package/lib/UserCenter/components/user-info.d.ts +6 -0
- package/lib/UserCenter/components/user-info.js +94 -0
- package/lib/UserCenter/components/webhook-item.d.ts +3 -0
- package/lib/UserCenter/components/webhook-item.js +236 -0
- package/lib/UserCenter/index.d.ts +1 -0
- package/lib/UserCenter/index.js +13 -0
- package/lib/UserCenter/libs/client.d.ts +2 -0
- package/lib/UserCenter/libs/client.js +8 -0
- package/lib/UserCenter/libs/locales.d.ts +72 -0
- package/lib/UserCenter/libs/locales.js +78 -0
- package/lib/UserCenter/libs/utils.d.ts +4 -0
- package/lib/UserCenter/libs/utils.js +25 -0
- package/lib/blocklets.d.ts +16 -0
- package/lib/blocklets.js +28 -36
- package/lib/common/header-addons.d.ts +22 -0
- package/lib/common/header-addons.js +24 -36
- package/lib/common/link-blocker.d.ts +7 -0
- package/lib/common/link-blocker.js +10 -18
- package/lib/common/overridable-theme-provider.d.ts +18 -0
- package/lib/common/overridable-theme-provider.js +9 -14
- package/lib/common/wallet-hidden-topbar.d.ts +1 -0
- package/lib/common/wallet-hidden-topbar.js +1 -3
- package/lib/index.d.ts +5 -0
- package/lib/index.js +52 -0
- package/lib/types.d.ts +2 -0
- package/lib/types.js +3 -5
- package/lib/utils.d.ts +8 -0
- package/lib/utils.js +16 -23
- package/package.json +17 -11
- package/src/@types/index.ts +70 -0
- package/src/@types/shims.d.ts +12 -0
- package/src/UserCenter/assets/banner.png +0 -0
- package/src/UserCenter/components/notification.tsx +275 -0
- package/src/UserCenter/components/passport.tsx +83 -0
- package/src/UserCenter/components/privacy.tsx +107 -0
- package/src/UserCenter/components/settings.tsx +78 -0
- package/src/UserCenter/components/user-basic-info.tsx +70 -0
- package/src/UserCenter/components/user-center.tsx +410 -0
- package/src/UserCenter/components/user-info-item.tsx +50 -0
- package/src/UserCenter/components/user-info.tsx +85 -0
- package/src/UserCenter/components/webhook-item.tsx +243 -0
- package/src/UserCenter/index.tsx +1 -0
- package/src/UserCenter/libs/client.ts +3 -0
- package/src/UserCenter/libs/locales.ts +72 -0
- package/src/UserCenter/libs/utils.ts +21 -0
- package/src/blocklets.js +2 -0
- package/src/index.ts +9 -0
- /package/src/common/{link-blocker.js → link-blocker.jsx} +0 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// import PropTypes from 'prop-types';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
CircularProgress,
|
|
5
|
+
IconButton,
|
|
6
|
+
InputAdornment,
|
|
7
|
+
MenuItem,
|
|
8
|
+
Select,
|
|
9
|
+
Stack,
|
|
10
|
+
TextField,
|
|
11
|
+
Typography,
|
|
12
|
+
} from '@mui/material';
|
|
13
|
+
import { useCreation, useMemoizedFn, useReactive } from 'ahooks';
|
|
14
|
+
import noop from 'lodash/noop';
|
|
15
|
+
import isUrl from 'is-url';
|
|
16
|
+
import { temp as colors } from '@arcblock/ux/lib/Colors';
|
|
17
|
+
import { Icon } from '@iconify/react';
|
|
18
|
+
import CloseRoundedIcon from '@iconify-icons/material-symbols/close-rounded';
|
|
19
|
+
import CheckIcon from '@iconify-icons/material-symbols/check';
|
|
20
|
+
import SendRoundedIcon from '@iconify-icons/material-symbols/send-rounded';
|
|
21
|
+
import EditSquareOutlineRoundedIcon from '@iconify-icons/material-symbols/edit-square-outline-rounded';
|
|
22
|
+
import DeleteOutlineRoundedIcon from '@iconify-icons/material-symbols/delete-outline-rounded';
|
|
23
|
+
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
24
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
25
|
+
|
|
26
|
+
import { translations } from '../libs/locales';
|
|
27
|
+
import { WebhookItemData, WebhookItemProps, WebhookType } from '../../@types';
|
|
28
|
+
|
|
29
|
+
export default function WebhookItem({
|
|
30
|
+
onTest = noop,
|
|
31
|
+
onDelete = noop,
|
|
32
|
+
onSave = noop,
|
|
33
|
+
onCancel = noop,
|
|
34
|
+
type = 'slack',
|
|
35
|
+
url = '',
|
|
36
|
+
edit = false,
|
|
37
|
+
}: WebhookItemProps) {
|
|
38
|
+
const { locale } = useLocaleContext();
|
|
39
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
40
|
+
return translate(translations, key, locale, 'en', data);
|
|
41
|
+
});
|
|
42
|
+
const currentState = useReactive<
|
|
43
|
+
WebhookItemData & {
|
|
44
|
+
edit: boolean;
|
|
45
|
+
error: string;
|
|
46
|
+
loading: boolean;
|
|
47
|
+
}
|
|
48
|
+
>({
|
|
49
|
+
type: type || 'slack',
|
|
50
|
+
url: url || '',
|
|
51
|
+
edit: edit ?? false,
|
|
52
|
+
error: '',
|
|
53
|
+
loading: false,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const checkUrl = useMemoizedFn(() => {
|
|
57
|
+
if (!currentState.url) {
|
|
58
|
+
currentState.error = t('common.required');
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (!isUrl(currentState.url)) {
|
|
62
|
+
currentState.error = t('common.invalid');
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
currentState.error = '';
|
|
66
|
+
return true;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const handleClose = useMemoizedFn(() => {
|
|
70
|
+
currentState.edit = false;
|
|
71
|
+
currentState.url = url || '';
|
|
72
|
+
currentState.type = type || 'slack';
|
|
73
|
+
currentState.error = '';
|
|
74
|
+
currentState.loading = false;
|
|
75
|
+
onCancel();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const _onTest = useMemoizedFn(async (data) => {
|
|
79
|
+
currentState.loading = true;
|
|
80
|
+
await onTest(data);
|
|
81
|
+
currentState.loading = false;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const onSubmit = useMemoizedFn((fn: (params: WebhookItemData) => void) => {
|
|
85
|
+
return () => {
|
|
86
|
+
if (checkUrl()) {
|
|
87
|
+
fn({
|
|
88
|
+
type: currentState.type,
|
|
89
|
+
url: currentState.url,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const inputAdornment = useCreation(() => {
|
|
96
|
+
if (currentState.error) {
|
|
97
|
+
return (
|
|
98
|
+
<Typography component="span" color="error">
|
|
99
|
+
{currentState.error}
|
|
100
|
+
</Typography>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (currentState.edit) {
|
|
105
|
+
if (currentState.loading) {
|
|
106
|
+
return <CircularProgress size={16} />;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<IconButton
|
|
111
|
+
size="small"
|
|
112
|
+
onClick={onSubmit(_onTest)}
|
|
113
|
+
sx={{
|
|
114
|
+
mr: -1,
|
|
115
|
+
}}>
|
|
116
|
+
<Icon icon={SendRoundedIcon} />
|
|
117
|
+
</IconButton>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
return null;
|
|
121
|
+
}, [currentState.error, currentState.edit, currentState.loading]);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<Box
|
|
125
|
+
sx={{
|
|
126
|
+
display: 'flex',
|
|
127
|
+
gap: 1.5,
|
|
128
|
+
width: '100%',
|
|
129
|
+
alignItems: {
|
|
130
|
+
xs: 'flex-start',
|
|
131
|
+
md: 'center',
|
|
132
|
+
},
|
|
133
|
+
flexDirection: {
|
|
134
|
+
xs: 'column',
|
|
135
|
+
md: 'row',
|
|
136
|
+
},
|
|
137
|
+
}}>
|
|
138
|
+
<Select
|
|
139
|
+
sx={{
|
|
140
|
+
borderRadius: 2,
|
|
141
|
+
'&.Mui-disabled': {
|
|
142
|
+
backgroundColor: colors.backgroundsBgField,
|
|
143
|
+
},
|
|
144
|
+
}}
|
|
145
|
+
disabled={!currentState.edit || currentState.loading}
|
|
146
|
+
size="small"
|
|
147
|
+
value={currentState.type}
|
|
148
|
+
onChange={(e) => {
|
|
149
|
+
currentState.type = e.target.value as WebhookType;
|
|
150
|
+
}}>
|
|
151
|
+
<MenuItem value="api">{t('webhook.url')}</MenuItem>
|
|
152
|
+
<MenuItem value="slack">{t('webhook.slack')}</MenuItem>
|
|
153
|
+
</Select>
|
|
154
|
+
<Box
|
|
155
|
+
sx={{
|
|
156
|
+
display: 'flex',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
gap: 0.5,
|
|
159
|
+
width: '100%',
|
|
160
|
+
}}>
|
|
161
|
+
<TextField
|
|
162
|
+
sx={{
|
|
163
|
+
flex: 1,
|
|
164
|
+
'.MuiInputBase-root': {
|
|
165
|
+
borderRadius: 2,
|
|
166
|
+
'&.Mui-disabled': {
|
|
167
|
+
backgroundColor: colors.backgroundsBgField,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
}}
|
|
171
|
+
disabled={!currentState.edit || currentState.loading}
|
|
172
|
+
fullWidth
|
|
173
|
+
size="small"
|
|
174
|
+
required
|
|
175
|
+
value={currentState.url}
|
|
176
|
+
onChange={(e) => {
|
|
177
|
+
currentState.url = e.target.value;
|
|
178
|
+
checkUrl();
|
|
179
|
+
}}
|
|
180
|
+
error={!!currentState.error}
|
|
181
|
+
InputProps={{
|
|
182
|
+
endAdornment: <InputAdornment position="end">{inputAdornment}</InputAdornment>,
|
|
183
|
+
}}
|
|
184
|
+
/>
|
|
185
|
+
|
|
186
|
+
<Box sx={{ display: 'flex', gap: 0.5 }}>
|
|
187
|
+
{currentState.edit ? (
|
|
188
|
+
<>
|
|
189
|
+
<IconButton
|
|
190
|
+
color="success"
|
|
191
|
+
onClick={onSubmit((...args) => {
|
|
192
|
+
onSave(...args);
|
|
193
|
+
currentState.edit = false;
|
|
194
|
+
})}
|
|
195
|
+
sx={{
|
|
196
|
+
borderRadius: 2,
|
|
197
|
+
border: `1px solid ${colors.strokeBorderBase}`,
|
|
198
|
+
}}>
|
|
199
|
+
<Icon icon={CheckIcon} />
|
|
200
|
+
</IconButton>
|
|
201
|
+
<IconButton
|
|
202
|
+
color="error"
|
|
203
|
+
onClick={handleClose}
|
|
204
|
+
sx={{
|
|
205
|
+
borderRadius: 2,
|
|
206
|
+
border: `1px solid ${colors.strokeBorderBase}`,
|
|
207
|
+
}}>
|
|
208
|
+
<Icon icon={CloseRoundedIcon} />
|
|
209
|
+
</IconButton>
|
|
210
|
+
</>
|
|
211
|
+
) : (
|
|
212
|
+
<>
|
|
213
|
+
<IconButton
|
|
214
|
+
onClick={() => {
|
|
215
|
+
currentState.edit = true;
|
|
216
|
+
}}
|
|
217
|
+
sx={{
|
|
218
|
+
borderRadius: 2,
|
|
219
|
+
border: `1px solid ${colors.strokeBorderBase}`,
|
|
220
|
+
}}>
|
|
221
|
+
<Icon icon={EditSquareOutlineRoundedIcon} />
|
|
222
|
+
</IconButton>
|
|
223
|
+
<IconButton
|
|
224
|
+
color="error"
|
|
225
|
+
onClick={() => {
|
|
226
|
+
onDelete({
|
|
227
|
+
type: currentState.type,
|
|
228
|
+
url: currentState.url,
|
|
229
|
+
});
|
|
230
|
+
}}
|
|
231
|
+
sx={{
|
|
232
|
+
borderRadius: 2,
|
|
233
|
+
border: `1px solid ${colors.strokeBorderBase}`,
|
|
234
|
+
}}>
|
|
235
|
+
<Icon icon={DeleteOutlineRoundedIcon} />
|
|
236
|
+
</IconButton>
|
|
237
|
+
</>
|
|
238
|
+
)}
|
|
239
|
+
</Box>
|
|
240
|
+
</Box>
|
|
241
|
+
</Box>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as UserCenter } from './components/user-center';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export const translations = {
|
|
2
|
+
zh: {
|
|
3
|
+
settings: '设置',
|
|
4
|
+
noPassport: '暂无通行证',
|
|
5
|
+
passport: '通行证',
|
|
6
|
+
notification: '通知',
|
|
7
|
+
email: '邮箱地址',
|
|
8
|
+
lastLogin: '上次登录',
|
|
9
|
+
createdAt: '创建时间',
|
|
10
|
+
registerFrom: '注册来源',
|
|
11
|
+
unknown: '未知',
|
|
12
|
+
walletNotification: '钱包通知',
|
|
13
|
+
emailNotification: '邮件通知',
|
|
14
|
+
phoneNotification: '短信通知',
|
|
15
|
+
addWebhook: '新增外部通知',
|
|
16
|
+
saveSuccess: '保存成功',
|
|
17
|
+
saveFailed: '保存失败',
|
|
18
|
+
webhookTested: '测试消息已经发送',
|
|
19
|
+
done: '完成',
|
|
20
|
+
emptyField: '未填写',
|
|
21
|
+
emptyContent: '暂无内容',
|
|
22
|
+
underProtected: '用户已设置隐私保护',
|
|
23
|
+
noUserFound: '未找到指定的用户',
|
|
24
|
+
notificationManagement: '通知管理',
|
|
25
|
+
privacyManagement: '隐私管理',
|
|
26
|
+
webhook: {
|
|
27
|
+
url: '自定义URL',
|
|
28
|
+
slack: 'Slack',
|
|
29
|
+
},
|
|
30
|
+
common: {
|
|
31
|
+
required: '必填的',
|
|
32
|
+
invalid: '无效',
|
|
33
|
+
},
|
|
34
|
+
toPublic: '公开 “{name}” 页面',
|
|
35
|
+
currentPassport: '当前使用的通行证',
|
|
36
|
+
},
|
|
37
|
+
en: {
|
|
38
|
+
settings: 'Settings',
|
|
39
|
+
noPassport: 'No passport founded',
|
|
40
|
+
passport: 'Passport',
|
|
41
|
+
notification: 'Notification',
|
|
42
|
+
email: 'Email',
|
|
43
|
+
lastLogin: 'Last Login & IP',
|
|
44
|
+
createdAt: 'Created At',
|
|
45
|
+
registerFrom: 'Register From',
|
|
46
|
+
unknown: 'Unknown',
|
|
47
|
+
walletNotification: 'DID Wallet notification',
|
|
48
|
+
emailNotification: 'Email notification',
|
|
49
|
+
phoneNotification: 'SMS notification',
|
|
50
|
+
addWebhook: 'Add external notification',
|
|
51
|
+
saveSuccess: 'Save succeed',
|
|
52
|
+
saveFailed: 'Save failed',
|
|
53
|
+
webhookTested: 'Test message sent',
|
|
54
|
+
done: 'Done',
|
|
55
|
+
emptyField: 'Empty field',
|
|
56
|
+
notificationManagement: 'Notification',
|
|
57
|
+
privacyManagement: 'Privacy',
|
|
58
|
+
emptyContent: 'Empty',
|
|
59
|
+
underProtected: 'This page has protected privacy',
|
|
60
|
+
noUserFound: 'No user found',
|
|
61
|
+
webhook: {
|
|
62
|
+
url: 'Custom url',
|
|
63
|
+
slack: 'Slack',
|
|
64
|
+
},
|
|
65
|
+
common: {
|
|
66
|
+
required: 'Required',
|
|
67
|
+
invalid: 'Invalid',
|
|
68
|
+
},
|
|
69
|
+
toPublic: 'Public "{name}" page',
|
|
70
|
+
currentPassport: 'Passport currently in use',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AxiosError } from 'axios';
|
|
2
|
+
import joinURL from 'url-join';
|
|
3
|
+
import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
4
|
+
import { createPassportSvg as _createPassportSvg } from '@arcblock/ux/lib/Util/passport';
|
|
5
|
+
import { CreatePassportProps } from '../../@types';
|
|
6
|
+
|
|
7
|
+
export const formatAxiosError = (err: AxiosError) => {
|
|
8
|
+
const { response } = err;
|
|
9
|
+
|
|
10
|
+
if (response) {
|
|
11
|
+
return `Request failed: ${response.status} ${response.statusText}: ${JSON.stringify(response.data)}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return err.message;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const createPassportSvg = (props: CreatePassportProps) =>
|
|
18
|
+
_createPassportSvg({
|
|
19
|
+
...props,
|
|
20
|
+
issuerAvatarUrl: joinURL(window.location.origin, WELLKNOWN_SERVICE_PATH_PREFIX, '/blocklet/logo'),
|
|
21
|
+
});
|
package/src/blocklets.js
CHANGED
|
@@ -63,6 +63,7 @@ export const getLocalizedNavigation = (navigation, locale = 'en') => {
|
|
|
63
63
|
title: getTitle(item.title, locale),
|
|
64
64
|
// 仅对叶结点进行处理
|
|
65
65
|
link: !item.items?.length ? getLink(item.link, locale) : item.link,
|
|
66
|
+
_rawLink: item.link,
|
|
66
67
|
};
|
|
67
68
|
},
|
|
68
69
|
'items'
|
|
@@ -108,6 +109,7 @@ export const parseNavigation = (navigation) => {
|
|
|
108
109
|
dashboard: [],
|
|
109
110
|
// session manager menus
|
|
110
111
|
sessionManager: [],
|
|
112
|
+
userCenter: [],
|
|
111
113
|
};
|
|
112
114
|
|
|
113
115
|
// 对 navigation 顶层元素按 section 分组
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
export { default as Header } from './Header';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
export { default as Footer } from './Footer';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
export { default as Dashboard } from './Dashboard';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
export { default as Icon } from './Icon';
|
|
9
|
+
export * from './UserCenter';
|
|
File without changes
|