@blocklet/ui-react 2.10.30 → 2.10.32
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/lib/@types/index.d.ts +5 -1
- package/lib/UserCenter/components/config-inviter.d.ts +4 -0
- package/lib/UserCenter/components/config-inviter.js +36 -0
- package/lib/UserCenter/components/config-profile.js +10 -10
- package/lib/UserCenter/components/user-info/user-info-item.d.ts +2 -1
- package/lib/UserCenter/components/user-info/user-info-item.js +16 -12
- package/lib/UserCenter/components/user-info/user-info.js +10 -2
- package/lib/UserCenter/libs/locales.d.ts +2 -0
- package/lib/UserCenter/libs/locales.js +4 -2
- package/lib/UserCenter/libs/utils.js +14 -5
- package/package.json +4 -4
- package/src/@types/index.ts +5 -1
- package/src/UserCenter/components/config-inviter.tsx +47 -0
- package/src/UserCenter/components/config-profile.tsx +11 -12
- package/src/UserCenter/components/user-info/user-info-item.tsx +14 -9
- package/src/UserCenter/components/user-info/user-info.tsx +9 -1
- package/src/UserCenter/libs/locales.ts +4 -2
- package/src/UserCenter/libs/utils.ts +12 -3
package/lib/@types/index.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export type User = UserPublicInfo & {
|
|
|
53
53
|
locale?: string;
|
|
54
54
|
url: string;
|
|
55
55
|
inviter?: string;
|
|
56
|
+
emailVerified?: boolean;
|
|
57
|
+
phoneVerified?: boolean;
|
|
56
58
|
};
|
|
57
59
|
export type UserCenterTab = {
|
|
58
60
|
value: string;
|
|
@@ -95,13 +97,15 @@ export type CreatePassportProps = {
|
|
|
95
97
|
issuerDid: string;
|
|
96
98
|
issuerAvatarUrl: string;
|
|
97
99
|
ownerDid: string;
|
|
98
|
-
ownerName
|
|
100
|
+
ownerName?: string;
|
|
99
101
|
ownerAvatarUrl: string;
|
|
100
102
|
preferredColor?: string;
|
|
101
103
|
revoked?: boolean;
|
|
102
104
|
isDataUrl?: boolean;
|
|
103
105
|
width?: string;
|
|
104
106
|
height?: string;
|
|
107
|
+
scope?: string;
|
|
108
|
+
role?: string;
|
|
105
109
|
};
|
|
106
110
|
export type BlockletMetaProps = {
|
|
107
111
|
appLogo?: React.ReactNode;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, TextField } from "@mui/material";
|
|
3
|
+
import { useMemoizedFn, useReactive } from "ahooks";
|
|
4
|
+
import Toast from "@arcblock/ux/lib/Toast";
|
|
5
|
+
import { client } from "../../libs/client.js";
|
|
6
|
+
import { formatAxiosError } from "../libs/utils.js";
|
|
7
|
+
export default function ConfigInviter({ user }) {
|
|
8
|
+
const currentState = useReactive({
|
|
9
|
+
inviter: user?.inviter,
|
|
10
|
+
loading: false
|
|
11
|
+
});
|
|
12
|
+
const handleChange = useMemoizedFn(async (e) => {
|
|
13
|
+
try {
|
|
14
|
+
const { value } = e.target;
|
|
15
|
+
currentState.loading = true;
|
|
16
|
+
await client.user.saveProfile({ inviter: value });
|
|
17
|
+
currentState.inviter = value;
|
|
18
|
+
} catch (err) {
|
|
19
|
+
Toast.error(formatAxiosError(err));
|
|
20
|
+
} finally {
|
|
21
|
+
currentState.loading = false;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
if (!user) {
|
|
25
|
+
return "-";
|
|
26
|
+
}
|
|
27
|
+
const inviteEnabled = !!window.blocklet?.settings?.invite?.enabled;
|
|
28
|
+
if (!inviteEnabled) {
|
|
29
|
+
return "-";
|
|
30
|
+
}
|
|
31
|
+
const hasInviter = !!user.inviter;
|
|
32
|
+
if (hasInviter) {
|
|
33
|
+
return "-";
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(TextField, { size: "small", fullWidth: true, label: "", value: currentState.inviter, onChange: handleChange }) });
|
|
36
|
+
}
|
|
@@ -3,12 +3,13 @@ import { Box, MenuItem, Select, LinearProgress } from "@mui/material";
|
|
|
3
3
|
import { useMemoizedFn, useReactive } from "ahooks";
|
|
4
4
|
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
5
5
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
6
|
-
import
|
|
6
|
+
import Toast from "@arcblock/ux/lib/Toast";
|
|
7
7
|
import { translations } from "../libs/locales.js";
|
|
8
8
|
import { client } from "../../libs/client.js";
|
|
9
|
+
import { formatAxiosError } from "../libs/utils.js";
|
|
9
10
|
const languages = [
|
|
10
|
-
{
|
|
11
|
-
{
|
|
11
|
+
{ name: "English", code: "en" },
|
|
12
|
+
{ name: "\u4E2D\u6587", code: "zh" }
|
|
12
13
|
];
|
|
13
14
|
export default function ConfigProfile({ user, onSave }) {
|
|
14
15
|
const { locale, changeLocale } = useLocaleContext();
|
|
@@ -23,15 +24,14 @@ export default function ConfigProfile({ user, onSave }) {
|
|
|
23
24
|
try {
|
|
24
25
|
const { value } = e.target;
|
|
25
26
|
currentState.loading = true;
|
|
26
|
-
await
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}),
|
|
30
|
-
sleep(350)
|
|
31
|
-
]);
|
|
27
|
+
await client.user.saveProfile({
|
|
28
|
+
locale: value
|
|
29
|
+
});
|
|
32
30
|
await onSave("profile");
|
|
33
31
|
changeLocale(value);
|
|
34
32
|
currentState.locale = value;
|
|
33
|
+
} catch (err) {
|
|
34
|
+
Toast.error(formatAxiosError(err));
|
|
35
35
|
} finally {
|
|
36
36
|
currentState.loading = false;
|
|
37
37
|
}
|
|
@@ -61,7 +61,7 @@ export default function ConfigProfile({ user, onSave }) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
/* @__PURE__ */ jsx(Select, { fullWidth: true, value: currentState.locale, onChange: handleChange, size: "small", children: languages.map((x) => /* @__PURE__ */ jsx(MenuItem, { value: x.
|
|
64
|
+
/* @__PURE__ */ jsx(Select, { fullWidth: true, value: currentState.locale, onChange: handleChange, size: "small", children: (window.blocklet.languages || languages).map((x) => /* @__PURE__ */ jsx(MenuItem, { value: x.code, children: x.name })) })
|
|
65
65
|
] })
|
|
66
66
|
]
|
|
67
67
|
}
|
|
@@ -5,6 +5,7 @@ type TUserInfoItemProps = {
|
|
|
5
5
|
title: string;
|
|
6
6
|
content: any;
|
|
7
7
|
};
|
|
8
|
+
verified?: boolean;
|
|
8
9
|
};
|
|
9
|
-
export default function UserInfoItem({ data, ...rest }: TUserInfoItemProps & BoxProps): import("react").JSX.Element;
|
|
10
|
+
export default function UserInfoItem({ data, verified, ...rest }: TUserInfoItemProps & BoxProps): import("react").JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Typography } from "@mui/material";
|
|
3
|
+
import VerifiedIcon from "@mui/icons-material/Verified";
|
|
3
4
|
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
4
|
-
export default function UserInfoItem({ data, ...rest }) {
|
|
5
|
+
export default function UserInfoItem({ data, verified, ...rest }) {
|
|
5
6
|
return /* @__PURE__ */ jsxs(
|
|
6
7
|
Box,
|
|
7
8
|
{
|
|
@@ -30,17 +31,20 @@ export default function UserInfoItem({ data, ...rest }) {
|
|
|
30
31
|
]
|
|
31
32
|
}
|
|
32
33
|
),
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
Typography,
|
|
37
|
+
{
|
|
38
|
+
sx: {
|
|
39
|
+
color: colors.textSubtitle,
|
|
40
|
+
whiteSpace: "pre-wrap",
|
|
41
|
+
fontSize: "14px"
|
|
42
|
+
},
|
|
43
|
+
children: data.content
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
verified && /* @__PURE__ */ jsx(VerifiedIcon, { color: "success", style: { fontSize: 16, marginLeft: 4 } })
|
|
47
|
+
] })
|
|
44
48
|
]
|
|
45
49
|
}
|
|
46
50
|
);
|
|
@@ -4,6 +4,7 @@ import { Icon } from "@iconify/react";
|
|
|
4
4
|
import { useMemoizedFn, useCreation } from "ahooks";
|
|
5
5
|
import DID from "@arcblock/ux/lib/DID";
|
|
6
6
|
import MailOutlineRoundedIcon from "@iconify-icons/material-symbols/mail-outline-rounded";
|
|
7
|
+
import PhoneOutlineRoundedIcon from "@iconify-icons/material-symbols/phone-android-outline-rounded";
|
|
7
8
|
import ScheduleOutlineRoundedIcon from "@iconify-icons/material-symbols/schedule-outline-rounded";
|
|
8
9
|
import MoreTimeRoundedIcon from "@iconify-icons/material-symbols/more-time-rounded";
|
|
9
10
|
import CaptivePortalRoundedIcon from "@iconify-icons/material-symbols/captive-portal-rounded";
|
|
@@ -31,7 +32,14 @@ export default function UserInfo({
|
|
|
31
32
|
userInfoListData.push({
|
|
32
33
|
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: MailOutlineRoundedIcon }),
|
|
33
34
|
title: t("email"),
|
|
34
|
-
content: user?.email || t("emptyField")
|
|
35
|
+
content: user?.email || t("emptyField"),
|
|
36
|
+
verified: user?.emailVerified
|
|
37
|
+
});
|
|
38
|
+
userInfoListData.push({
|
|
39
|
+
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: PhoneOutlineRoundedIcon }),
|
|
40
|
+
title: t("phone"),
|
|
41
|
+
content: user?.phone || t("emptyField"),
|
|
42
|
+
verified: user?.phoneVerified
|
|
35
43
|
});
|
|
36
44
|
userInfoListData.push({
|
|
37
45
|
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: ScheduleOutlineRoundedIcon }),
|
|
@@ -75,7 +83,7 @@ export default function UserInfo({
|
|
|
75
83
|
gap: 1.5,
|
|
76
84
|
...rest?.sx
|
|
77
85
|
},
|
|
78
|
-
children: userInfoListData.map((item) => /* @__PURE__ */ jsx(UserInfoItem, { data: item, sx: { flex: 1 } }, item.title))
|
|
86
|
+
children: userInfoListData.map((item) => /* @__PURE__ */ jsx(UserInfoItem, { data: item, sx: { flex: 1 }, verified: item.verified }, item.title))
|
|
79
87
|
}
|
|
80
88
|
);
|
|
81
89
|
}
|
|
@@ -5,6 +5,7 @@ export declare const translations: {
|
|
|
5
5
|
passport: string;
|
|
6
6
|
notification: string;
|
|
7
7
|
email: string;
|
|
8
|
+
phone: string;
|
|
8
9
|
lastLogin: string;
|
|
9
10
|
lastLoginAt: string;
|
|
10
11
|
lastLoginIp: string;
|
|
@@ -96,6 +97,7 @@ export declare const translations: {
|
|
|
96
97
|
passport: string;
|
|
97
98
|
notification: string;
|
|
98
99
|
email: string;
|
|
100
|
+
phone: string;
|
|
99
101
|
lastLogin: string;
|
|
100
102
|
lastLoginAt: string;
|
|
101
103
|
lastLoginIp: string;
|
|
@@ -5,6 +5,7 @@ export const translations = {
|
|
|
5
5
|
passport: "\u901A\u884C\u8BC1",
|
|
6
6
|
notification: "\u901A\u77E5",
|
|
7
7
|
email: "\u90AE\u7BB1\u5730\u5740",
|
|
8
|
+
phone: "\u7535\u8BDD\u53F7\u7801",
|
|
8
9
|
lastLogin: "\u4E0A\u6B21\u767B\u5F55",
|
|
9
10
|
lastLoginAt: "\u4E0A\u6B21\u767B\u5F55\u65F6\u95F4",
|
|
10
11
|
lastLoginIp: "\u4E0A\u6B21\u767B\u5F55\u5730\u5740",
|
|
@@ -92,10 +93,11 @@ export const translations = {
|
|
|
92
93
|
},
|
|
93
94
|
en: {
|
|
94
95
|
settings: "Settings",
|
|
95
|
-
noPassport: "No passport
|
|
96
|
+
noPassport: "No passport yet",
|
|
96
97
|
passport: "Passport",
|
|
97
98
|
notification: "Notification",
|
|
98
99
|
email: "Email",
|
|
100
|
+
phone: "Phone",
|
|
99
101
|
lastLogin: "Last Login & IP",
|
|
100
102
|
lastLoginAt: "Last Login",
|
|
101
103
|
lastLoginIp: "Last IP",
|
|
@@ -112,7 +114,7 @@ export const translations = {
|
|
|
112
114
|
saveFailed: "Save failed",
|
|
113
115
|
webhookTested: "Test message sent",
|
|
114
116
|
done: "Done",
|
|
115
|
-
emptyField: "
|
|
117
|
+
emptyField: "None",
|
|
116
118
|
notificationManagement: "Notification",
|
|
117
119
|
privacyManagement: "Privacy",
|
|
118
120
|
storageManagement: "Storage",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { joinURL } from "ufo";
|
|
2
|
-
import { createPassportSvg as _createPassportSvg } from "@arcblock/ux/lib/Util/passport";
|
|
2
|
+
import { createPassportSvg as _createPassportSvg, createKycSvg as _createKycSvg } from "@arcblock/ux/lib/Util/passport";
|
|
3
3
|
import { AUTH_SERVICE_PREFIX } from "@arcblock/ux/lib/Util/constant";
|
|
4
4
|
export const formatAxiosError = (err) => {
|
|
5
5
|
const { response } = err;
|
|
@@ -8,7 +8,16 @@ export const formatAxiosError = (err) => {
|
|
|
8
8
|
}
|
|
9
9
|
return err.message;
|
|
10
10
|
};
|
|
11
|
-
export const createPassportSvg = (props) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
export const createPassportSvg = (props) => {
|
|
12
|
+
if (props.scope === "kyc") {
|
|
13
|
+
return _createKycSvg({
|
|
14
|
+
...props,
|
|
15
|
+
issuerAvatarUrl: joinURL(window.location.origin, AUTH_SERVICE_PREFIX, "/blocklet/logo"),
|
|
16
|
+
type: props.role
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return _createPassportSvg({
|
|
20
|
+
...props,
|
|
21
|
+
issuerAvatarUrl: joinURL(window.location.origin, AUTH_SERVICE_PREFIX, "/blocklet/logo")
|
|
22
|
+
});
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.32",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"url": "https://github.com/ArcBlock/ux/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@arcblock/bridge": "^2.10.
|
|
36
|
-
"@arcblock/react-hooks": "^2.10.
|
|
35
|
+
"@arcblock/bridge": "^2.10.32",
|
|
36
|
+
"@arcblock/react-hooks": "^2.10.32",
|
|
37
37
|
"@iconify-icons/logos": "^1.2.36",
|
|
38
38
|
"@iconify-icons/material-symbols": "^1.2.58",
|
|
39
39
|
"@iconify/react": "^4.1.1",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"jest": "^28.1.3",
|
|
80
80
|
"unbuild": "^2.0.0"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "0da245771d21b08f036d4c8f872b61995538c411"
|
|
83
83
|
}
|
package/src/@types/index.ts
CHANGED
|
@@ -59,6 +59,8 @@ export type User = UserPublicInfo & {
|
|
|
59
59
|
locale?: string;
|
|
60
60
|
url: string;
|
|
61
61
|
inviter?: string;
|
|
62
|
+
emailVerified?: boolean;
|
|
63
|
+
phoneVerified?: boolean;
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
export type UserCenterTab = {
|
|
@@ -108,13 +110,15 @@ export type CreatePassportProps = {
|
|
|
108
110
|
issuerDid: string;
|
|
109
111
|
issuerAvatarUrl: string;
|
|
110
112
|
ownerDid: string;
|
|
111
|
-
ownerName
|
|
113
|
+
ownerName?: string;
|
|
112
114
|
ownerAvatarUrl: string;
|
|
113
115
|
preferredColor?: string;
|
|
114
116
|
revoked?: boolean;
|
|
115
117
|
isDataUrl?: boolean;
|
|
116
118
|
width?: string;
|
|
117
119
|
height?: string;
|
|
120
|
+
scope?: string;
|
|
121
|
+
role?: string;
|
|
118
122
|
};
|
|
119
123
|
|
|
120
124
|
export type BlockletMetaProps = {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Box, TextField } from '@mui/material';
|
|
2
|
+
import { useMemoizedFn, useReactive } from 'ahooks';
|
|
3
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
4
|
+
|
|
5
|
+
import { client } from '../../libs/client';
|
|
6
|
+
import { User } from '../../@types';
|
|
7
|
+
import { formatAxiosError } from '../libs/utils';
|
|
8
|
+
|
|
9
|
+
export default function ConfigInviter({ user }: { user: User }) {
|
|
10
|
+
const currentState = useReactive({
|
|
11
|
+
inviter: user?.inviter,
|
|
12
|
+
loading: false,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const handleChange = useMemoizedFn(async (e) => {
|
|
16
|
+
try {
|
|
17
|
+
const { value } = e.target;
|
|
18
|
+
currentState.loading = true;
|
|
19
|
+
await client.user.saveProfile({ inviter: value });
|
|
20
|
+
currentState.inviter = value;
|
|
21
|
+
} catch (err) {
|
|
22
|
+
Toast.error(formatAxiosError(err as any));
|
|
23
|
+
} finally {
|
|
24
|
+
currentState.loading = false;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (!user) {
|
|
29
|
+
return '-';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const inviteEnabled = !!window.blocklet?.settings?.invite?.enabled;
|
|
33
|
+
if (!inviteEnabled) {
|
|
34
|
+
return '-';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const hasInviter = !!user.inviter;
|
|
38
|
+
if (hasInviter) {
|
|
39
|
+
return '-';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Box>
|
|
44
|
+
<TextField size="small" fullWidth label="" value={currentState.inviter} onChange={handleChange} />
|
|
45
|
+
</Box>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -2,16 +2,16 @@ import { Box, MenuItem, Select, SelectChangeEvent, LinearProgress } from '@mui/m
|
|
|
2
2
|
import { useMemoizedFn, useReactive } from 'ahooks';
|
|
3
3
|
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
4
4
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
|
-
import
|
|
5
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
6
6
|
|
|
7
7
|
import { translations } from '../libs/locales';
|
|
8
8
|
import { client } from '../../libs/client';
|
|
9
9
|
import { User } from '../../@types';
|
|
10
|
+
import { formatAxiosError } from '../libs/utils';
|
|
10
11
|
|
|
11
|
-
// FIXME: @zhanghan 目前仅支持中英文,后续需要支持更多语言(从 blocklet.languages 中获取)
|
|
12
12
|
const languages = [
|
|
13
|
-
{
|
|
14
|
-
{
|
|
13
|
+
{ name: 'English', code: 'en' },
|
|
14
|
+
{ name: '中文', code: 'zh' },
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
export default function ConfigProfile({ user, onSave }: { user: User; onSave: (type: 'profile') => void }) {
|
|
@@ -28,15 +28,14 @@ export default function ConfigProfile({ user, onSave }: { user: User; onSave: (t
|
|
|
28
28
|
try {
|
|
29
29
|
const { value } = e.target;
|
|
30
30
|
currentState.loading = true;
|
|
31
|
-
await
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}),
|
|
35
|
-
sleep(350),
|
|
36
|
-
]);
|
|
31
|
+
await client.user.saveProfile({
|
|
32
|
+
locale: value,
|
|
33
|
+
});
|
|
37
34
|
await onSave('profile');
|
|
38
35
|
changeLocale(value);
|
|
39
36
|
currentState.locale = value;
|
|
37
|
+
} catch (err) {
|
|
38
|
+
Toast.error(formatAxiosError(err as any));
|
|
40
39
|
} finally {
|
|
41
40
|
currentState.loading = false;
|
|
42
41
|
}
|
|
@@ -62,8 +61,8 @@ export default function ConfigProfile({ user, onSave }: { user: User; onSave: (t
|
|
|
62
61
|
}}
|
|
63
62
|
/>
|
|
64
63
|
<Select fullWidth value={currentState.locale} onChange={handleChange} size="small">
|
|
65
|
-
{languages.map((x) => (
|
|
66
|
-
<MenuItem value={x.
|
|
64
|
+
{(window.blocklet.languages || languages).map((x: { name: string; code: string }) => (
|
|
65
|
+
<MenuItem value={x.code}>{x.name}</MenuItem>
|
|
67
66
|
))}
|
|
68
67
|
</Select>
|
|
69
68
|
</Box>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Box, BoxProps, Typography } from '@mui/material';
|
|
2
|
+
import VerifiedIcon from '@mui/icons-material/Verified';
|
|
2
3
|
import { temp as colors } from '@arcblock/ux/lib/Colors';
|
|
3
4
|
|
|
4
5
|
type TUserInfoItemProps = {
|
|
@@ -7,9 +8,10 @@ type TUserInfoItemProps = {
|
|
|
7
8
|
title: string;
|
|
8
9
|
content: any;
|
|
9
10
|
};
|
|
11
|
+
verified?: boolean;
|
|
10
12
|
};
|
|
11
13
|
|
|
12
|
-
export default function UserInfoItem({ data, ...rest }: TUserInfoItemProps & BoxProps) {
|
|
14
|
+
export default function UserInfoItem({ data, verified, ...rest }: TUserInfoItemProps & BoxProps) {
|
|
13
15
|
return (
|
|
14
16
|
<Box
|
|
15
17
|
{...rest}
|
|
@@ -31,14 +33,17 @@ export default function UserInfoItem({ data, ...rest }: TUserInfoItemProps & Box
|
|
|
31
33
|
{data.icon}
|
|
32
34
|
{data.title}
|
|
33
35
|
</Typography>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
<Box display="flex" flexDirection="row" alignItems="center">
|
|
37
|
+
<Typography
|
|
38
|
+
sx={{
|
|
39
|
+
color: colors.textSubtitle,
|
|
40
|
+
whiteSpace: 'pre-wrap',
|
|
41
|
+
fontSize: '14px',
|
|
42
|
+
}}>
|
|
43
|
+
{data.content}
|
|
44
|
+
</Typography>
|
|
45
|
+
{verified && <VerifiedIcon color="success" style={{ fontSize: 16, marginLeft: 4 }} />}
|
|
46
|
+
</Box>
|
|
42
47
|
</Box>
|
|
43
48
|
);
|
|
44
49
|
}
|
|
@@ -4,6 +4,7 @@ import { Icon } from '@iconify/react';
|
|
|
4
4
|
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
5
5
|
import DID from '@arcblock/ux/lib/DID';
|
|
6
6
|
import MailOutlineRoundedIcon from '@iconify-icons/material-symbols/mail-outline-rounded';
|
|
7
|
+
import PhoneOutlineRoundedIcon from '@iconify-icons/material-symbols/phone-android-outline-rounded';
|
|
7
8
|
import ScheduleOutlineRoundedIcon from '@iconify-icons/material-symbols/schedule-outline-rounded';
|
|
8
9
|
import MoreTimeRoundedIcon from '@iconify-icons/material-symbols/more-time-rounded';
|
|
9
10
|
import CaptivePortalRoundedIcon from '@iconify-icons/material-symbols/captive-portal-rounded';
|
|
@@ -40,6 +41,13 @@ export default function UserInfo({
|
|
|
40
41
|
icon: <Icon fontSize={16} icon={MailOutlineRoundedIcon} />,
|
|
41
42
|
title: t('email'),
|
|
42
43
|
content: user?.email || t('emptyField'),
|
|
44
|
+
verified: user?.emailVerified,
|
|
45
|
+
});
|
|
46
|
+
userInfoListData.push({
|
|
47
|
+
icon: <Icon fontSize={16} icon={PhoneOutlineRoundedIcon} />,
|
|
48
|
+
title: t('phone'),
|
|
49
|
+
content: user?.phone || t('emptyField'),
|
|
50
|
+
verified: user?.phoneVerified,
|
|
43
51
|
});
|
|
44
52
|
userInfoListData.push({
|
|
45
53
|
icon: <Icon fontSize={16} icon={ScheduleOutlineRoundedIcon} />,
|
|
@@ -86,7 +94,7 @@ export default function UserInfo({
|
|
|
86
94
|
...rest?.sx,
|
|
87
95
|
}}>
|
|
88
96
|
{userInfoListData.map((item) => (
|
|
89
|
-
<UserInfoItem key={item.title} data={item} sx={{ flex: 1 }} />
|
|
97
|
+
<UserInfoItem key={item.title} data={item} sx={{ flex: 1 }} verified={item.verified} />
|
|
90
98
|
))}
|
|
91
99
|
</Box>
|
|
92
100
|
);
|
|
@@ -5,6 +5,7 @@ export const translations = {
|
|
|
5
5
|
passport: '通行证',
|
|
6
6
|
notification: '通知',
|
|
7
7
|
email: '邮箱地址',
|
|
8
|
+
phone: '电话号码',
|
|
8
9
|
lastLogin: '上次登录',
|
|
9
10
|
lastLoginAt: '上次登录时间',
|
|
10
11
|
lastLoginIp: '上次登录地址',
|
|
@@ -93,10 +94,11 @@ export const translations = {
|
|
|
93
94
|
},
|
|
94
95
|
en: {
|
|
95
96
|
settings: 'Settings',
|
|
96
|
-
noPassport: 'No passport
|
|
97
|
+
noPassport: 'No passport yet',
|
|
97
98
|
passport: 'Passport',
|
|
98
99
|
notification: 'Notification',
|
|
99
100
|
email: 'Email',
|
|
101
|
+
phone: 'Phone',
|
|
100
102
|
lastLogin: 'Last Login & IP',
|
|
101
103
|
lastLoginAt: 'Last Login',
|
|
102
104
|
lastLoginIp: 'Last IP',
|
|
@@ -113,7 +115,7 @@ export const translations = {
|
|
|
113
115
|
saveFailed: 'Save failed',
|
|
114
116
|
webhookTested: 'Test message sent',
|
|
115
117
|
done: 'Done',
|
|
116
|
-
emptyField: '
|
|
118
|
+
emptyField: 'None',
|
|
117
119
|
notificationManagement: 'Notification',
|
|
118
120
|
privacyManagement: 'Privacy',
|
|
119
121
|
storageManagement: 'Storage',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxiosError } from 'axios';
|
|
2
2
|
import { joinURL } from 'ufo';
|
|
3
|
-
import { createPassportSvg as _createPassportSvg } from '@arcblock/ux/lib/Util/passport';
|
|
3
|
+
import { createPassportSvg as _createPassportSvg, createKycSvg as _createKycSvg } from '@arcblock/ux/lib/Util/passport';
|
|
4
4
|
import { AUTH_SERVICE_PREFIX } from '@arcblock/ux/lib/Util/constant';
|
|
5
5
|
import { CreatePassportProps } from '../../@types';
|
|
6
6
|
|
|
@@ -14,8 +14,17 @@ export const formatAxiosError = (err: AxiosError) => {
|
|
|
14
14
|
return err.message;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const createPassportSvg = (props: CreatePassportProps) =>
|
|
18
|
-
|
|
17
|
+
export const createPassportSvg = (props: CreatePassportProps) => {
|
|
18
|
+
if (props.scope === 'kyc') {
|
|
19
|
+
return _createKycSvg({
|
|
20
|
+
...props,
|
|
21
|
+
issuerAvatarUrl: joinURL(window.location.origin, AUTH_SERVICE_PREFIX, '/blocklet/logo'),
|
|
22
|
+
type: props.role,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return _createPassportSvg({
|
|
19
27
|
...props,
|
|
20
28
|
issuerAvatarUrl: joinURL(window.location.origin, AUTH_SERVICE_PREFIX, '/blocklet/logo'),
|
|
21
29
|
});
|
|
30
|
+
};
|