@blocklet/ui-react 3.3.9 → 3.4.0
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/Dashboard/app-shell/badges/app-badge-default.d.ts +1 -1
- package/lib/Dashboard/index.d.ts +2 -2
- package/lib/Footer/links.d.ts +1 -1
- package/lib/Notifications/utils.js +29 -29
- package/lib/UserCenter/components/config-inviter.js +12 -12
- package/lib/UserCenter/components/config-profile.js +22 -22
- package/lib/UserCenter/components/nft-preview.js +1 -1
- package/lib/UserCenter/components/notification.js +59 -59
- package/lib/UserCenter/components/privacy.js +16 -16
- package/lib/UserCenter/components/settings.js +34 -34
- package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg.js +2 -2
- package/lib/UserCenter/components/user-center.js +68 -68
- package/lib/UserCenter/components/user-info/user-basic-info.js +52 -52
- package/lib/UserSessions/components/user-sessions.js +36 -36
- package/lib/blocklets.d.ts +1 -1
- package/lib/common/header-addons.d.ts +1 -1
- package/lib/common/org-switch/create.js +22 -26
- package/lib/common/org-switch/use-org.js +16 -16
- package/lib/hooks/use-follow.js +21 -21
- package/package.json +8 -8
- package/src/Dashboard/app-shell/badges/app-badge-default.tsx +1 -2
- package/src/Notifications/utils.ts +2 -1
- package/src/UserCenter/components/config-inviter.tsx +2 -1
- package/src/UserCenter/components/config-profile.tsx +2 -1
- package/src/UserCenter/components/nft-preview.tsx +1 -1
- package/src/UserCenter/components/notification.tsx +2 -1
- package/src/UserCenter/components/privacy.tsx +2 -1
- package/src/UserCenter/components/settings.tsx +3 -1
- package/src/UserCenter/components/storage/icons/empty-spaces-nft.svg +1 -58
- package/src/UserCenter/components/user-center.tsx +2 -2
- package/src/UserCenter/components/user-info/user-basic-info.tsx +2 -1
- package/src/UserSessions/components/user-sessions.tsx +2 -2
- package/src/common/org-switch/create.jsx +2 -6
- package/src/common/org-switch/use-org.jsx +2 -1
- package/src/hooks/use-follow.tsx +2 -1
- package/lib/libs/client.d.ts +0 -2
- package/lib/libs/client.js +0 -5
- package/src/libs/client.ts +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { BoxProps } from '@mui/material';
|
|
1
2
|
import { TBox } from '@arcblock/ux/lib/MuiWrap';
|
|
2
|
-
import { BoxProps } from '@mui/material/Box';
|
|
3
3
|
export declare const isExternal: (to?: string) => boolean;
|
|
4
4
|
export declare const isSameOrigin: (to: string) => boolean;
|
|
5
5
|
export declare const StateIcon: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & {
|
package/lib/Dashboard/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddon
|
|
|
15
15
|
showRole: boolean;
|
|
16
16
|
onLogout: () => void;
|
|
17
17
|
} | undefined;
|
|
18
|
-
links?:
|
|
18
|
+
links?: never[] | undefined;
|
|
19
19
|
showDomainWarningDialog?: boolean | undefined;
|
|
20
20
|
appPath?: undefined;
|
|
21
21
|
appTab?: undefined;
|
|
@@ -27,7 +27,7 @@ declare namespace Dashboard {
|
|
|
27
27
|
export { BlockletMetaProps as meta };
|
|
28
28
|
export let fallbackUrl: PropTypes.Requireable<string>;
|
|
29
29
|
export let invalidPathFallback: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
|
-
export let headerAddons: PropTypes.Requireable<NonNullable<((...args: any[]) => any)
|
|
30
|
+
export let headerAddons: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
|
|
31
31
|
export { SessionManagerProps as sessionManagerProps };
|
|
32
32
|
export let links: PropTypes.Requireable<NonNullable<any[] | ((...args: any[]) => any) | null | undefined>>;
|
|
33
33
|
export let showDomainWarningDialog: PropTypes.Requireable<boolean>;
|
package/lib/Footer/links.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { default as PropTypes } from 'prop-types';
|
|
|
4
4
|
*/
|
|
5
5
|
declare function Links({ links, flowLayout, minColumns, maxColumns, ...rest }: {
|
|
6
6
|
[x: string]: any;
|
|
7
|
-
links?:
|
|
7
|
+
links?: never[] | undefined;
|
|
8
8
|
flowLayout?: boolean | undefined;
|
|
9
9
|
minColumns?: number | undefined;
|
|
10
10
|
maxColumns?: number | undefined;
|
|
@@ -2,40 +2,40 @@ import h from "lodash/isEmpty";
|
|
|
2
2
|
import m from "dompurify";
|
|
3
3
|
import { toTextList as v, Link as f, getLink as p } from "@abtnode/util/lib/notification-preview/highlight";
|
|
4
4
|
import { isSameAddr as d } from "@abtnode/util/lib/notification-preview/func";
|
|
5
|
-
import {
|
|
5
|
+
import { getBlockletSDK as T } from "@blocklet/js-sdk";
|
|
6
6
|
const b = (t) => {
|
|
7
7
|
if (!t || !t.length)
|
|
8
8
|
return [];
|
|
9
9
|
const e = [];
|
|
10
|
-
let r = null,
|
|
11
|
-
if (t.forEach((
|
|
12
|
-
if (!
|
|
13
|
-
r && (
|
|
10
|
+
let r = null, s = [];
|
|
11
|
+
if (t.forEach((a) => {
|
|
12
|
+
if (!a.activity || !a.activity.type || !r) {
|
|
13
|
+
r && (s.length === 1 ? e.push(s[0]) : (r.items = s, e.push(r))), a.activity && a.activity.type ? (r = a, s = [a]) : (e.push(a), r = null, s = []);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
const n =
|
|
16
|
+
const n = s[0].activity, c = n?.type, l = n?.target?.type, i = n?.target?.id, u = a.activity.type, o = a.activity.target?.type, y = a.activity.target?.id;
|
|
17
17
|
if (
|
|
18
18
|
// activity.type 必须相同且不为null或undefined
|
|
19
19
|
c && u && c === u && // 如果都没有target,可以合并
|
|
20
|
-
(!n?.target && !
|
|
21
|
-
n?.target &&
|
|
20
|
+
(!n?.target && !a.activity.target || // 如果都有target,则target.type和target.id都必须相同
|
|
21
|
+
n?.target && a.activity.target && l === o && i === y)
|
|
22
22
|
)
|
|
23
|
-
|
|
23
|
+
s.push(a);
|
|
24
24
|
else {
|
|
25
|
-
if (
|
|
26
|
-
e.push(
|
|
25
|
+
if (s.length === 1)
|
|
26
|
+
e.push(s[0]);
|
|
27
27
|
else {
|
|
28
|
-
const g = Object.assign({}, r, { items:
|
|
28
|
+
const g = Object.assign({}, r, { items: s });
|
|
29
29
|
e.push(g);
|
|
30
30
|
}
|
|
31
|
-
r =
|
|
31
|
+
r = a, s = [a];
|
|
32
32
|
}
|
|
33
33
|
}), r)
|
|
34
|
-
if (
|
|
35
|
-
e.push(
|
|
34
|
+
if (s.length === 1)
|
|
35
|
+
e.push(s[0]);
|
|
36
36
|
else {
|
|
37
|
-
const
|
|
38
|
-
e.push(
|
|
37
|
+
const a = Object.assign({}, r, { items: s });
|
|
38
|
+
e.push(a);
|
|
39
39
|
}
|
|
40
40
|
return e;
|
|
41
41
|
}, j = (t) => !h(t.activity) && !!t.activity?.type && !!t.activity?.actor, O = (t) => {
|
|
@@ -49,23 +49,23 @@ const b = (t) => {
|
|
|
49
49
|
metaLink: e?.id,
|
|
50
50
|
targetLink: r?.id
|
|
51
51
|
};
|
|
52
|
-
},
|
|
52
|
+
}, k = async (t, e) => {
|
|
53
53
|
try {
|
|
54
|
-
return await T.user.getProfileUrl({ did: t, locale: e });
|
|
54
|
+
return await T().user.getProfileUrl({ did: t, locale: e });
|
|
55
55
|
} catch (r) {
|
|
56
56
|
console.error(r);
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
},
|
|
60
|
-
const { type: r, did:
|
|
61
|
-
return d(r, "did") ? await
|
|
62
|
-
},
|
|
63
|
-
const
|
|
59
|
+
}, L = async (t, e) => {
|
|
60
|
+
const { type: r, did: s } = t;
|
|
61
|
+
return d(r, "did") ? await k(s, e) || p(t) : p(t);
|
|
62
|
+
}, D = async (t, e, r = !0) => {
|
|
63
|
+
const s = v(t);
|
|
64
64
|
return await Promise.all(
|
|
65
|
-
|
|
65
|
+
s.map(async (n) => {
|
|
66
66
|
if (n instanceof f) {
|
|
67
67
|
if (r) {
|
|
68
|
-
const c = await
|
|
68
|
+
const c = await L(n, e), { type: l, chainId: i, did: u } = n;
|
|
69
69
|
return d(l, "dapp") ? `<em class="dapp" data-type="${l}" data-chain-id="${i}" data-did="${u}">${n.text}</em>` : c ? `<a target="_blank" rel="noopener noreferrer" class="link" href="${c}">${n.text}</a>` : `<em class="common" data-type="${l}" data-chain-id="${i}" data-did="${u}">${n.text}</em>`;
|
|
70
70
|
}
|
|
71
71
|
return n.text;
|
|
@@ -73,7 +73,7 @@ const b = (t) => {
|
|
|
73
73
|
return n;
|
|
74
74
|
})
|
|
75
75
|
).then((n) => n.join(""));
|
|
76
|
-
},
|
|
76
|
+
}, E = (t) => m.sanitize(t, {
|
|
77
77
|
ALLOWED_ATTR: ["href", "target", "rel", "class", "id", "style"]
|
|
78
78
|
});
|
|
79
79
|
export {
|
|
@@ -81,6 +81,6 @@ export {
|
|
|
81
81
|
P as getActivityLink,
|
|
82
82
|
j as isIncludeActivity,
|
|
83
83
|
b as mergeAdjacentNotifications,
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
E as sanitize,
|
|
85
|
+
D as toClickableSpan
|
|
86
86
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { Box as
|
|
3
|
-
import { useReactive as
|
|
2
|
+
import { Box as l, TextField as s } from "@mui/material";
|
|
3
|
+
import { useReactive as f, useMemoizedFn as c } from "ahooks";
|
|
4
4
|
import v from "@arcblock/ux/lib/Toast";
|
|
5
|
-
import {
|
|
6
|
-
import { formatAxiosError as
|
|
7
|
-
function
|
|
8
|
-
const e =
|
|
5
|
+
import { getBlockletSDK as m } from "@blocklet/js-sdk";
|
|
6
|
+
import { formatAxiosError as d } from "../libs/utils.js";
|
|
7
|
+
function C({ user: i }) {
|
|
8
|
+
const e = f({
|
|
9
9
|
inviter: i?.inviter,
|
|
10
10
|
loading: !1
|
|
11
|
-
}), n =
|
|
11
|
+
}), n = m(), o = c(async (a) => {
|
|
12
12
|
try {
|
|
13
|
-
const { value: t } =
|
|
14
|
-
e.loading = !0, await
|
|
13
|
+
const { value: t } = a.target;
|
|
14
|
+
e.loading = !0, await n.user.saveProfile({ inviter: t }), e.inviter = t;
|
|
15
15
|
} catch (t) {
|
|
16
|
-
v.error(
|
|
16
|
+
v.error(d(t));
|
|
17
17
|
} finally {
|
|
18
18
|
e.loading = !1;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
return !i || !!!window.blocklet?.settings?.invite?.enabled || !!i.inviter ? "-" : /* @__PURE__ */ r(
|
|
21
|
+
return !i || !!!window.blocklet?.settings?.invite?.enabled || !!i.inviter ? "-" : /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(s, { size: "small", fullWidth: !0, label: "", value: e.inviter, onChange: o }) });
|
|
22
22
|
}
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
C as default
|
|
25
25
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { Box as n, LinearProgress as
|
|
3
|
-
import { useMemoizedFn as l, useReactive as
|
|
4
|
-
import { translate as
|
|
5
|
-
import { useLocaleContext as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { formatAxiosError as
|
|
2
|
+
import { Box as n, LinearProgress as h, Select as u, MenuItem as p } from "@mui/material";
|
|
3
|
+
import { useMemoizedFn as l, useReactive as x } from "ahooks";
|
|
4
|
+
import { translate as v } from "@arcblock/ux/lib/Locale/util";
|
|
5
|
+
import { useLocaleContext as w } from "@arcblock/ux/lib/Locale/context";
|
|
6
|
+
import C from "@arcblock/ux/lib/Toast";
|
|
7
|
+
import y from "@arcblock/icons/lib/ArrowDown";
|
|
8
|
+
import { getBlockletSDK as I } from "@blocklet/js-sdk";
|
|
9
|
+
import { translations as b } from "../libs/locales.js";
|
|
10
|
+
import { formatAxiosError as S } from "../libs/utils.js";
|
|
11
11
|
const z = [
|
|
12
12
|
{ name: "English", code: "en" },
|
|
13
13
|
{ name: "中文", code: "zh" }
|
|
14
14
|
];
|
|
15
|
-
function
|
|
16
|
-
const { locale:
|
|
15
|
+
function T({ user: a, onSave: c }) {
|
|
16
|
+
const { locale: s, changeLocale: m } = w(), d = I(), f = l((e, o = {}) => v(b, e, s, "en", o)), t = x({
|
|
17
17
|
locale: a.locale,
|
|
18
18
|
loading: !1
|
|
19
|
-
}),
|
|
19
|
+
}), g = l(async (e) => {
|
|
20
20
|
try {
|
|
21
21
|
const { value: o } = e.target;
|
|
22
|
-
t.loading = !0, await
|
|
22
|
+
t.loading = !0, await d.user.saveProfile({
|
|
23
23
|
locale: o
|
|
24
|
-
}), await
|
|
24
|
+
}), await c("profile"), m(o), t.locale = o;
|
|
25
25
|
} catch (o) {
|
|
26
|
-
|
|
26
|
+
C.error(S(o));
|
|
27
27
|
} finally {
|
|
28
28
|
t.loading = !1;
|
|
29
29
|
}
|
|
@@ -41,10 +41,10 @@ function B({ user: a, onSave: s }) {
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
children: [
|
|
44
|
-
/* @__PURE__ */ r(n, { children:
|
|
44
|
+
/* @__PURE__ */ r(n, { children: f("commonSetting.locale") }),
|
|
45
45
|
/* @__PURE__ */ i(n, { children: [
|
|
46
46
|
t.loading ? /* @__PURE__ */ r(
|
|
47
|
-
|
|
47
|
+
h,
|
|
48
48
|
{
|
|
49
49
|
color: "primary",
|
|
50
50
|
sx: {
|
|
@@ -61,12 +61,12 @@ function B({ user: a, onSave: s }) {
|
|
|
61
61
|
}
|
|
62
62
|
),
|
|
63
63
|
/* @__PURE__ */ r(
|
|
64
|
-
|
|
64
|
+
u,
|
|
65
65
|
{
|
|
66
66
|
value: t.locale,
|
|
67
|
-
onChange:
|
|
67
|
+
onChange: g,
|
|
68
68
|
size: "small",
|
|
69
|
-
IconComponent: (e) => /* @__PURE__ */ r(
|
|
69
|
+
IconComponent: (e) => /* @__PURE__ */ r(y, { ...e, width: 20, height: 20 }),
|
|
70
70
|
sx: {
|
|
71
71
|
minWidth: 200,
|
|
72
72
|
"&:hover": {
|
|
@@ -78,7 +78,7 @@ function B({ user: a, onSave: s }) {
|
|
|
78
78
|
borderColor: "divider"
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
|
-
children: (window.blocklet.languages || z).map((e) => /* @__PURE__ */ r(
|
|
81
|
+
children: (window.blocklet.languages || z).map((e) => /* @__PURE__ */ r(p, { value: e.code, children: e.name }, e.code))
|
|
82
82
|
}
|
|
83
83
|
)
|
|
84
84
|
] })
|
|
@@ -87,5 +87,5 @@ function B({ user: a, onSave: s }) {
|
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
export {
|
|
90
|
-
|
|
90
|
+
T as default
|
|
91
91
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o, jsxs as h } from "react/jsx-runtime";
|
|
2
|
-
import { Alert as z, Box as w, CircularProgress as R, Typography as
|
|
3
|
-
import { useMemoizedFn as
|
|
4
|
-
import { Icon as
|
|
2
|
+
import { Alert as z, Box as w, CircularProgress as R, Typography as D, Stack as T } from "@mui/material";
|
|
3
|
+
import { useMemoizedFn as s, useReactive as j, useRequest as B, useCreation as v } from "ahooks";
|
|
4
|
+
import { Icon as F } from "@iconify/react";
|
|
5
5
|
import E from "@iconify-icons/material-symbols/add-rounded";
|
|
6
6
|
import G from "@arcblock/ux/lib/Switch";
|
|
7
7
|
import L from "@arcblock/ux/lib/Button";
|
|
@@ -10,19 +10,19 @@ import { getWalletDid as C } from "@arcblock/ux/lib/SessionUser/libs/utils";
|
|
|
10
10
|
import { translate as M } from "@arcblock/ux/lib/Locale/util";
|
|
11
11
|
import { useLocaleContext as P } from "@arcblock/ux/lib/Locale/context";
|
|
12
12
|
import U from "@arcblock/ux/lib/DID";
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
13
|
+
import { getBlockletSDK as _ } from "@blocklet/js-sdk";
|
|
14
|
+
import { translations as $ } from "../libs/locales.js";
|
|
15
|
+
import S from "./webhook-item.js";
|
|
16
|
+
import { formatAxiosError as b } from "../libs/utils.js";
|
|
17
17
|
function y({
|
|
18
18
|
title: i = void 0,
|
|
19
19
|
description: n = void 0,
|
|
20
20
|
value: m,
|
|
21
|
-
onChange:
|
|
22
|
-
isMobile:
|
|
21
|
+
onChange: l,
|
|
22
|
+
isMobile: a
|
|
23
23
|
}) {
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const c = s((r) => {
|
|
25
|
+
r.stopPropagation();
|
|
26
26
|
});
|
|
27
27
|
return /* @__PURE__ */ h(
|
|
28
28
|
w,
|
|
@@ -33,20 +33,20 @@ function y({
|
|
|
33
33
|
gap: 1
|
|
34
34
|
},
|
|
35
35
|
children: [
|
|
36
|
-
/* @__PURE__ */ o(G, { checked: m, size: "small", onChange:
|
|
36
|
+
/* @__PURE__ */ o(G, { checked: m, size: "small", onChange: l }),
|
|
37
37
|
/* @__PURE__ */ h(
|
|
38
|
-
|
|
38
|
+
D,
|
|
39
39
|
{
|
|
40
40
|
component: "div",
|
|
41
|
-
onClick:
|
|
41
|
+
onClick: c,
|
|
42
42
|
sx: {
|
|
43
43
|
color: "text.primary",
|
|
44
44
|
fontSize: 14,
|
|
45
45
|
display: "flex",
|
|
46
|
-
flexWrap:
|
|
46
|
+
flexWrap: a ? "wrap" : "nowrap",
|
|
47
47
|
columnGap: 1,
|
|
48
48
|
flex: 1,
|
|
49
|
-
whiteSpace:
|
|
49
|
+
whiteSpace: a ? "normal" : "nowrap"
|
|
50
50
|
},
|
|
51
51
|
children: [
|
|
52
52
|
i,
|
|
@@ -58,51 +58,51 @@ function y({
|
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const { locale: m } = P(), a =
|
|
61
|
+
function nt({ user: i, isMobile: n }) {
|
|
62
|
+
const { locale: m } = P(), l = _(), a = s((t, e = {}) => M($, t, m, "en", e)), c = j({
|
|
63
63
|
showAdd: !1
|
|
64
|
-
}), r =
|
|
65
|
-
async () => await
|
|
64
|
+
}), r = B(
|
|
65
|
+
async () => await l.user.getUserNotificationConfig(),
|
|
66
66
|
{
|
|
67
67
|
refreshDeps: [i],
|
|
68
68
|
loadingDelay: 300
|
|
69
69
|
}
|
|
70
|
-
),
|
|
70
|
+
), x = v(() => ({
|
|
71
71
|
wallet: !0,
|
|
72
72
|
email: !0,
|
|
73
73
|
phone: !1,
|
|
74
74
|
push: !0,
|
|
75
75
|
...r?.data?.notifications || {}
|
|
76
|
-
}), [r?.data?.notifications]), p = v(() => r?.data?.webhooks || [], [r?.data?.webhooks]), u =
|
|
76
|
+
}), [r?.data?.notifications]), p = v(() => r?.data?.webhooks || [], [r?.data?.webhooks]), u = s(async (t) => {
|
|
77
77
|
try {
|
|
78
|
-
await
|
|
79
|
-
} catch (
|
|
80
|
-
f.error(
|
|
78
|
+
await l.user.saveUserNotificationConfig(t), f.success(a("saveSuccess")), r.run();
|
|
79
|
+
} catch (e) {
|
|
80
|
+
f.error(b(e));
|
|
81
81
|
}
|
|
82
|
-
}),
|
|
82
|
+
}), g = s(async (t, e) => {
|
|
83
83
|
await u({
|
|
84
84
|
notifications: {
|
|
85
|
-
[
|
|
85
|
+
[t]: e
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
}), k = async (
|
|
88
|
+
}), k = async (t) => {
|
|
89
89
|
try {
|
|
90
|
-
await
|
|
91
|
-
} catch (
|
|
92
|
-
f.error(
|
|
90
|
+
await l.user.testNotificationWebhook(t), f.success(a("webhookTested"));
|
|
91
|
+
} catch (e) {
|
|
92
|
+
f.error(b(e));
|
|
93
93
|
}
|
|
94
|
-
},
|
|
94
|
+
}, A = s(async (t) => {
|
|
95
95
|
await u({
|
|
96
|
-
webhooks: p.filter((
|
|
96
|
+
webhooks: p.filter((e, d) => d !== t)
|
|
97
97
|
});
|
|
98
|
-
}), I =
|
|
98
|
+
}), I = s(async (t, e) => {
|
|
99
99
|
await u({
|
|
100
|
-
webhooks: p.map((d, N) => N ===
|
|
100
|
+
webhooks: p.map((d, N) => N === t ? e : d)
|
|
101
101
|
});
|
|
102
|
-
}), W =
|
|
102
|
+
}), W = s(async (t) => {
|
|
103
103
|
await u({
|
|
104
|
-
webhooks: [...p,
|
|
105
|
-
}),
|
|
104
|
+
webhooks: [...p, t]
|
|
105
|
+
}), c.showAdd = !1;
|
|
106
106
|
});
|
|
107
107
|
return r.error ? /* @__PURE__ */ o(z, { severity: "error", children: r.error.message }) : r.loading || !r.data ? /* @__PURE__ */ o(
|
|
108
108
|
w,
|
|
@@ -155,10 +155,10 @@ function ie({ user: i, isMobile: n }) {
|
|
|
155
155
|
/* @__PURE__ */ o(
|
|
156
156
|
y,
|
|
157
157
|
{
|
|
158
|
-
value:
|
|
158
|
+
value: x.wallet,
|
|
159
159
|
isMobile: n,
|
|
160
160
|
title: a("walletNotification"),
|
|
161
|
-
onChange: (
|
|
161
|
+
onChange: (t) => g("wallet", t.target.checked),
|
|
162
162
|
description: C(i) && /* @__PURE__ */ o(
|
|
163
163
|
U,
|
|
164
164
|
{
|
|
@@ -177,12 +177,12 @@ function ie({ user: i, isMobile: n }) {
|
|
|
177
177
|
/* @__PURE__ */ o(
|
|
178
178
|
y,
|
|
179
179
|
{
|
|
180
|
-
value:
|
|
180
|
+
value: x.email,
|
|
181
181
|
isMobile: n,
|
|
182
|
-
onChange: (
|
|
182
|
+
onChange: (t) => g("email", t.target.checked),
|
|
183
183
|
title: a("emailNotification"),
|
|
184
184
|
description: i?.email && /* @__PURE__ */ o(
|
|
185
|
-
|
|
185
|
+
D,
|
|
186
186
|
{
|
|
187
187
|
component: "span",
|
|
188
188
|
sx: {
|
|
@@ -198,9 +198,9 @@ function ie({ user: i, isMobile: n }) {
|
|
|
198
198
|
y,
|
|
199
199
|
{
|
|
200
200
|
isMobile: n,
|
|
201
|
-
value:
|
|
201
|
+
value: x.push,
|
|
202
202
|
title: a("pushNotification"),
|
|
203
|
-
onChange: (
|
|
203
|
+
onChange: (t) => g("push", t.target.checked)
|
|
204
204
|
}
|
|
205
205
|
)
|
|
206
206
|
]
|
|
@@ -216,26 +216,26 @@ function ie({ user: i, isMobile: n }) {
|
|
|
216
216
|
alignItems: "start"
|
|
217
217
|
},
|
|
218
218
|
children: [
|
|
219
|
-
p.map((
|
|
220
|
-
|
|
219
|
+
p.map((t, e) => /* @__PURE__ */ o(
|
|
220
|
+
S,
|
|
221
221
|
{
|
|
222
222
|
onTest: k,
|
|
223
|
-
onDelete: () =>
|
|
224
|
-
onSave: (...d) => I(
|
|
225
|
-
type:
|
|
226
|
-
url:
|
|
223
|
+
onDelete: () => A(e),
|
|
224
|
+
onSave: (...d) => I(e, ...d),
|
|
225
|
+
type: t.type,
|
|
226
|
+
url: t.url,
|
|
227
227
|
edit: !1
|
|
228
228
|
},
|
|
229
|
-
`${
|
|
229
|
+
`${e}_${t.url}`
|
|
230
230
|
)),
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
c.showAdd && /* @__PURE__ */ o(
|
|
232
|
+
S,
|
|
233
233
|
{
|
|
234
234
|
onTest: k,
|
|
235
235
|
onCancel: () => {
|
|
236
|
-
|
|
236
|
+
c.showAdd = !1;
|
|
237
237
|
},
|
|
238
|
-
onSave: (...
|
|
238
|
+
onSave: (...t) => W(...t),
|
|
239
239
|
edit: !0
|
|
240
240
|
},
|
|
241
241
|
"add"
|
|
@@ -254,9 +254,9 @@ function ie({ user: i, isMobile: n }) {
|
|
|
254
254
|
py: 0.5,
|
|
255
255
|
borderRadius: 1
|
|
256
256
|
},
|
|
257
|
-
startIcon: /* @__PURE__ */ o(
|
|
257
|
+
startIcon: /* @__PURE__ */ o(F, { icon: E }),
|
|
258
258
|
onClick: () => {
|
|
259
|
-
|
|
259
|
+
c.showAdd = !0;
|
|
260
260
|
},
|
|
261
261
|
children: a("addWebhook")
|
|
262
262
|
}
|
|
@@ -267,5 +267,5 @@ function ie({ user: i, isMobile: n }) {
|
|
|
267
267
|
] });
|
|
268
268
|
}
|
|
269
269
|
export {
|
|
270
|
-
|
|
270
|
+
nt as default
|
|
271
271
|
};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { Box as
|
|
3
|
-
import
|
|
4
|
-
import { useState as
|
|
2
|
+
import { Box as x, Typography as d } from "@mui/material";
|
|
3
|
+
import w from "@arcblock/ux/lib/Switch";
|
|
4
|
+
import { useState as y } from "react";
|
|
5
5
|
import { useMemoizedFn as l } from "ahooks";
|
|
6
|
-
import { translate as
|
|
7
|
-
import { useLocaleContext as
|
|
6
|
+
import { translate as S } from "@arcblock/ux/lib/Locale/util";
|
|
7
|
+
import { useLocaleContext as g } from "@arcblock/ux/lib/Locale/context";
|
|
8
8
|
import c from "@arcblock/ux/lib/Toast";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { formatAxiosError as
|
|
9
|
+
import { getBlockletSDK as v } from "@blocklet/js-sdk";
|
|
10
|
+
import { translations as b } from "../libs/locales.js";
|
|
11
|
+
import { formatAxiosError as k } from "../libs/utils.js";
|
|
12
12
|
function A({
|
|
13
13
|
configList: n,
|
|
14
14
|
onSave: m
|
|
15
15
|
}) {
|
|
16
|
-
const [i,
|
|
16
|
+
const u = v(), [i, p] = y(n), { locale: h } = g(), s = l((r, t = {}) => S(b, r, h, "en", t)), f = l(async (r, t) => {
|
|
17
17
|
try {
|
|
18
|
-
const e = await
|
|
18
|
+
const e = await u.user.saveUserPrivacyConfig({
|
|
19
19
|
[r]: !t
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
p(
|
|
22
22
|
i.map((o) => ({
|
|
23
23
|
...o,
|
|
24
24
|
value: e?.[o.key] ?? o.value
|
|
25
25
|
}))
|
|
26
26
|
), c.success(s("saveSuccess")), m("privacy");
|
|
27
27
|
} catch (e) {
|
|
28
|
-
c.error(
|
|
28
|
+
c.error(k(e));
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
return /* @__PURE__ */ a(
|
|
32
|
-
|
|
32
|
+
x,
|
|
33
33
|
{
|
|
34
34
|
sx: {
|
|
35
35
|
display: "flex",
|
|
@@ -64,12 +64,12 @@ function A({
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
children: i.map((r) => r.isPrivate ? null : /* @__PURE__ */ a(
|
|
67
|
-
|
|
67
|
+
w,
|
|
68
68
|
{
|
|
69
69
|
checked: !r.value,
|
|
70
70
|
labelProps: {
|
|
71
71
|
label: /* @__PURE__ */ a(
|
|
72
|
-
|
|
72
|
+
d,
|
|
73
73
|
{
|
|
74
74
|
sx: {
|
|
75
75
|
color: "text.primary",
|
|
@@ -84,7 +84,7 @@ function A({
|
|
|
84
84
|
)
|
|
85
85
|
},
|
|
86
86
|
size: "small",
|
|
87
|
-
onChange: (t) =>
|
|
87
|
+
onChange: (t) => f(r.key, t.target.checked)
|
|
88
88
|
},
|
|
89
89
|
r.key
|
|
90
90
|
))
|