@blocklet/ui-react 3.3.10 → 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.
Files changed (38) hide show
  1. package/lib/Dashboard/app-shell/badges/app-badge-default.d.ts +1 -1
  2. package/lib/Dashboard/index.d.ts +2 -2
  3. package/lib/Footer/links.d.ts +1 -1
  4. package/lib/Notifications/utils.js +29 -29
  5. package/lib/UserCenter/components/config-inviter.js +12 -12
  6. package/lib/UserCenter/components/config-profile.js +22 -22
  7. package/lib/UserCenter/components/nft-preview.js +1 -1
  8. package/lib/UserCenter/components/notification.js +59 -59
  9. package/lib/UserCenter/components/privacy.js +16 -16
  10. package/lib/UserCenter/components/settings.js +34 -34
  11. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg.js +2 -2
  12. package/lib/UserCenter/components/user-center.js +68 -68
  13. package/lib/UserCenter/components/user-info/user-basic-info.js +52 -52
  14. package/lib/UserSessions/components/user-sessions.js +36 -36
  15. package/lib/blocklets.d.ts +1 -1
  16. package/lib/common/header-addons.d.ts +1 -1
  17. package/lib/common/org-switch/create.js +22 -26
  18. package/lib/common/org-switch/use-org.js +16 -16
  19. package/lib/hooks/use-follow.js +21 -21
  20. package/package.json +8 -8
  21. package/src/Dashboard/app-shell/badges/app-badge-default.tsx +1 -2
  22. package/src/Notifications/utils.ts +2 -1
  23. package/src/UserCenter/components/config-inviter.tsx +2 -1
  24. package/src/UserCenter/components/config-profile.tsx +2 -1
  25. package/src/UserCenter/components/nft-preview.tsx +1 -1
  26. package/src/UserCenter/components/notification.tsx +2 -1
  27. package/src/UserCenter/components/privacy.tsx +2 -1
  28. package/src/UserCenter/components/settings.tsx +3 -1
  29. package/src/UserCenter/components/storage/icons/empty-spaces-nft.svg +1 -58
  30. package/src/UserCenter/components/user-center.tsx +2 -2
  31. package/src/UserCenter/components/user-info/user-basic-info.tsx +2 -1
  32. package/src/UserSessions/components/user-sessions.tsx +2 -2
  33. package/src/common/org-switch/create.jsx +2 -6
  34. package/src/common/org-switch/use-org.jsx +2 -1
  35. package/src/hooks/use-follow.tsx +2 -1
  36. package/lib/libs/client.d.ts +0 -2
  37. package/lib/libs/client.js +0 -5
  38. 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> & {
@@ -15,7 +15,7 @@ declare function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddon
15
15
  showRole: boolean;
16
16
  onLogout: () => void;
17
17
  } | undefined;
18
- links?: any[] | undefined;
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) | PropTypes.ReactNodeLike>>;
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>;
@@ -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?: any[] | undefined;
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 { client as T } from "../libs/client.js";
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, a = [];
11
- if (t.forEach((s) => {
12
- if (!s.activity || !s.activity.type || !r) {
13
- r && (a.length === 1 ? e.push(a[0]) : (r.items = a, e.push(r))), s.activity && s.activity.type ? (r = s, a = [s]) : (e.push(s), r = null, a = []);
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 = a[0].activity, c = n?.type, l = n?.target?.type, i = n?.target?.id, u = s.activity.type, o = s.activity.target?.type, y = s.activity.target?.id;
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 && !s.activity.target || // 如果都有target,则target.type和target.id都必须相同
21
- n?.target && s.activity.target && l === o && i === y)
20
+ (!n?.target && !a.activity.target || // 如果都有target,则target.type和target.id都必须相同
21
+ n?.target && a.activity.target && l === o && i === y)
22
22
  )
23
- a.push(s);
23
+ s.push(a);
24
24
  else {
25
- if (a.length === 1)
26
- e.push(a[0]);
25
+ if (s.length === 1)
26
+ e.push(s[0]);
27
27
  else {
28
- const g = Object.assign({}, r, { items: a });
28
+ const g = Object.assign({}, r, { items: s });
29
29
  e.push(g);
30
30
  }
31
- r = s, a = [s];
31
+ r = a, s = [a];
32
32
  }
33
33
  }), r)
34
- if (a.length === 1)
35
- e.push(a[0]);
34
+ if (s.length === 1)
35
+ e.push(s[0]);
36
36
  else {
37
- const s = Object.assign({}, r, { items: a });
38
- e.push(s);
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
- }, L = async (t, e) => {
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
- }, $ = async (t, e) => {
60
- const { type: r, did: a } = t;
61
- return d(r, "did") ? await L(a, e) || p(t) : p(t);
62
- }, E = async (t, e, r = !0) => {
63
- const a = v(t);
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
- a.map(async (n) => {
65
+ s.map(async (n) => {
66
66
  if (n instanceof f) {
67
67
  if (r) {
68
- const c = await $(n, e), { type: l, chainId: i, did: u } = n;
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
- }, M = (t) => m.sanitize(t, {
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
- M as sanitize,
85
- E as toClickableSpan
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 a, TextField as l } from "@mui/material";
3
- import { useReactive as s, useMemoizedFn as f } from "ahooks";
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 { client as m } from "../../libs/client.js";
6
- import { formatAxiosError as c } from "../libs/utils.js";
7
- function y({ user: i }) {
8
- const e = s({
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 = f(async (o) => {
11
+ }), n = m(), o = c(async (a) => {
12
12
  try {
13
- const { value: t } = o.target;
14
- e.loading = !0, await m.user.saveProfile({ inviter: t }), e.inviter = t;
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(c(t));
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(a, { children: /* @__PURE__ */ r(l, { size: "small", fullWidth: !0, label: "", value: e.inviter, onChange: n }) });
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
- y as default
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 g, Select as h, MenuItem as u } from "@mui/material";
3
- import { useMemoizedFn as l, useReactive as p } from "ahooks";
4
- import { translate as x } from "@arcblock/ux/lib/Locale/util";
5
- import { useLocaleContext as v } from "@arcblock/ux/lib/Locale/context";
6
- import w from "@arcblock/ux/lib/Toast";
7
- import C from "@arcblock/icons/lib/ArrowDown";
8
- import { translations as y } from "../libs/locales.js";
9
- import { client as I } from "../../libs/client.js";
10
- import { formatAxiosError as b } from "../libs/utils.js";
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 B({ user: a, onSave: s }) {
16
- const { locale: c, changeLocale: m } = v(), d = l((e, o = {}) => x(y, e, c, "en", o)), t = p({
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
- }), f = l(async (e) => {
19
+ }), g = l(async (e) => {
20
20
  try {
21
21
  const { value: o } = e.target;
22
- t.loading = !0, await I.user.saveProfile({
22
+ t.loading = !0, await d.user.saveProfile({
23
23
  locale: o
24
- }), await s("profile"), m(o), t.locale = o;
24
+ }), await c("profile"), m(o), t.locale = o;
25
25
  } catch (o) {
26
- w.error(b(o));
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: d("commonSetting.locale") }),
44
+ /* @__PURE__ */ r(n, { children: f("commonSetting.locale") }),
45
45
  /* @__PURE__ */ i(n, { children: [
46
46
  t.loading ? /* @__PURE__ */ r(
47
- g,
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
- h,
64
+ u,
65
65
  {
66
66
  value: t.locale,
67
- onChange: f,
67
+ onChange: g,
68
68
  size: "small",
69
- IconComponent: (e) => /* @__PURE__ */ r(C, { ...e, width: 20, height: 20 }),
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(u, { value: e.code, children: e.name }, e.code))
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
- B as default
90
+ T as default
91
91
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import n from "@mui/material/Modal";
2
+ import { Modal as n } from "@mui/material";
3
3
  import r from "@emotion/styled";
4
4
  import a, { getNFTData as s } from "@arcblock/ux/lib/NFTDisplay";
5
5
  function f({
@@ -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 A, Stack as T } from "@mui/material";
3
- import { useMemoizedFn as c, useReactive as j, useRequest as F, useCreation as v } from "ahooks";
4
- import { Icon as B } from "@iconify/react";
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 { translations as _ } from "../libs/locales.js";
14
- import b from "./webhook-item.js";
15
- import { formatAxiosError as S } from "../libs/utils.js";
16
- import { client as g } from "../../libs/client.js";
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: a,
22
- isMobile: s
21
+ onChange: l,
22
+ isMobile: a
23
23
  }) {
24
- const r = c((l) => {
25
- l.stopPropagation();
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: a }),
36
+ /* @__PURE__ */ o(G, { checked: m, size: "small", onChange: l }),
37
37
  /* @__PURE__ */ h(
38
- A,
38
+ D,
39
39
  {
40
40
  component: "div",
41
- onClick: r,
41
+ onClick: c,
42
42
  sx: {
43
43
  color: "text.primary",
44
44
  fontSize: 14,
45
45
  display: "flex",
46
- flexWrap: s ? "wrap" : "nowrap",
46
+ flexWrap: a ? "wrap" : "nowrap",
47
47
  columnGap: 1,
48
48
  flex: 1,
49
- whiteSpace: s ? "normal" : "nowrap"
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 ie({ user: i, isMobile: n }) {
62
- const { locale: m } = P(), a = c((e, t = {}) => M(_, e, m, "en", t)), s = j({
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 = F(
65
- async () => await g.user.getUserNotificationConfig(),
64
+ }), r = B(
65
+ async () => await l.user.getUserNotificationConfig(),
66
66
  {
67
67
  refreshDeps: [i],
68
68
  loadingDelay: 300
69
69
  }
70
- ), l = v(() => ({
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 = c(async (e) => {
76
+ }), [r?.data?.notifications]), p = v(() => r?.data?.webhooks || [], [r?.data?.webhooks]), u = s(async (t) => {
77
77
  try {
78
- await g.user.saveUserNotificationConfig(e), f.success(a("saveSuccess")), r.run();
79
- } catch (t) {
80
- f.error(S(t));
78
+ await l.user.saveUserNotificationConfig(t), f.success(a("saveSuccess")), r.run();
79
+ } catch (e) {
80
+ f.error(b(e));
81
81
  }
82
- }), x = c(async (e, t) => {
82
+ }), g = s(async (t, e) => {
83
83
  await u({
84
84
  notifications: {
85
- [e]: t
85
+ [t]: e
86
86
  }
87
87
  });
88
- }), k = async (e) => {
88
+ }), k = async (t) => {
89
89
  try {
90
- await g.user.testNotificationWebhook(e), f.success(a("webhookTested"));
91
- } catch (t) {
92
- f.error(S(t));
90
+ await l.user.testNotificationWebhook(t), f.success(a("webhookTested"));
91
+ } catch (e) {
92
+ f.error(b(e));
93
93
  }
94
- }, D = c(async (e) => {
94
+ }, A = s(async (t) => {
95
95
  await u({
96
- webhooks: p.filter((t, d) => d !== e)
96
+ webhooks: p.filter((e, d) => d !== t)
97
97
  });
98
- }), I = c(async (e, t) => {
98
+ }), I = s(async (t, e) => {
99
99
  await u({
100
- webhooks: p.map((d, N) => N === e ? t : d)
100
+ webhooks: p.map((d, N) => N === t ? e : d)
101
101
  });
102
- }), W = c(async (e) => {
102
+ }), W = s(async (t) => {
103
103
  await u({
104
- webhooks: [...p, e]
105
- }), s.showAdd = !1;
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: l.wallet,
158
+ value: x.wallet,
159
159
  isMobile: n,
160
160
  title: a("walletNotification"),
161
- onChange: (e) => x("wallet", e.target.checked),
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: l.email,
180
+ value: x.email,
181
181
  isMobile: n,
182
- onChange: (e) => x("email", e.target.checked),
182
+ onChange: (t) => g("email", t.target.checked),
183
183
  title: a("emailNotification"),
184
184
  description: i?.email && /* @__PURE__ */ o(
185
- A,
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: l.push,
201
+ value: x.push,
202
202
  title: a("pushNotification"),
203
- onChange: (e) => x("push", e.target.checked)
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((e, t) => /* @__PURE__ */ o(
220
- b,
219
+ p.map((t, e) => /* @__PURE__ */ o(
220
+ S,
221
221
  {
222
222
  onTest: k,
223
- onDelete: () => D(t),
224
- onSave: (...d) => I(t, ...d),
225
- type: e.type,
226
- url: e.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
- `${t}_${e.url}`
229
+ `${e}_${t.url}`
230
230
  )),
231
- s.showAdd && /* @__PURE__ */ o(
232
- b,
231
+ c.showAdd && /* @__PURE__ */ o(
232
+ S,
233
233
  {
234
234
  onTest: k,
235
235
  onCancel: () => {
236
- s.showAdd = !1;
236
+ c.showAdd = !1;
237
237
  },
238
- onSave: (...e) => W(...e),
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(B, { icon: E }),
257
+ startIcon: /* @__PURE__ */ o(F, { icon: E }),
258
258
  onClick: () => {
259
- s.showAdd = !0;
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
- ie as default
270
+ nt as default
271
271
  };
@@ -1,35 +1,35 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { Box as f, Typography as x } from "@mui/material";
3
- import d from "@arcblock/ux/lib/Switch";
4
- import { useState as w } from "react";
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 y } from "@arcblock/ux/lib/Locale/util";
7
- import { useLocaleContext as v } from "@arcblock/ux/lib/Locale/context";
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 { translations as S } from "../libs/locales.js";
10
- import { client as g } from "../../libs/client.js";
11
- import { formatAxiosError as b } from "../libs/utils.js";
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, u] = w(n), { locale: p } = v(), s = l((r, t = {}) => y(S, r, p, "en", t)), h = l(async (r, t) => {
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 g.user.saveUserPrivacyConfig({
18
+ const e = await u.user.saveUserPrivacyConfig({
19
19
  [r]: !t
20
20
  });
21
- u(
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(b(e));
28
+ c.error(k(e));
29
29
  }
30
30
  });
31
31
  return /* @__PURE__ */ a(
32
- f,
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
- d,
67
+ w,
68
68
  {
69
69
  checked: !r.value,
70
70
  labelProps: {
71
71
  label: /* @__PURE__ */ a(
72
- x,
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) => h(r.key, t.target.checked)
87
+ onChange: (t) => f(r.key, t.target.checked)
88
88
  },
89
89
  r.key
90
90
  ))