@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,6 +1,6 @@
1
- import { jsx as n, jsxs as s, Fragment as A } from "react/jsx-runtime";
2
- import $ from "@arcblock/ux/lib/Datatable";
3
- import { useReactive as z, useMemoizedFn as v, useMount as J, useRequest as K, useCreation as w } from "ahooks";
1
+ import { jsx as n, jsxs as s, Fragment as k } from "react/jsx-runtime";
2
+ import K from "@arcblock/ux/lib/Datatable";
3
+ import { useReactive as z, useMemoizedFn as v, useMount as $, useRequest as J, useCreation as w } from "ahooks";
4
4
  import { translate as X } from "@arcblock/ux/lib/Locale/util";
5
5
  import { useLocaleContext as O } from "@arcblock/ux/lib/Locale/context";
6
6
  import T from "@arcblock/ux/lib/RelativeTime";
@@ -9,30 +9,30 @@ import { getVisitorId as Y } from "@arcblock/ux/lib/Util";
9
9
  import { useConfirm as Z } from "@arcblock/ux/lib/Dialog";
10
10
  import _ from "@arcblock/ux/lib/DID";
11
11
  import ee from "p-queue";
12
- import { Box as d, Typography as a, CircularProgress as te, useMediaQuery as oe, Tooltip as ne, Button as k, RadioGroup as re, FormControlLabel as B, Radio as C } from "@mui/material";
12
+ import { Box as d, Typography as a, CircularProgress as te, useMediaQuery as oe, Tooltip as ne, Button as P, RadioGroup as re, FormControlLabel as B, Radio as C } from "@mui/material";
13
13
  import { memo as ie, useEffect as se } from "react";
14
- import { mergeSx as P } from "@arcblock/ux/lib/Util/style";
15
- import ae from "../../hooks/use-mobile.js";
16
- import le from "./user-session-info.js";
17
- import { client as M } from "../../libs/client.js";
18
- import { translations as ce } from "../libs/locales.js";
19
- import { ip2Region as de } from "../libs/utils.js";
20
- const W = (p) => new S(p, {
14
+ import { getBlockletSDK as ae } from "@blocklet/js-sdk";
15
+ import { mergeSx as M } from "@arcblock/ux/lib/Util/style";
16
+ import le from "../../hooks/use-mobile.js";
17
+ import ce from "./user-session-info.js";
18
+ import { translations as de } from "../libs/locales.js";
19
+ import { ip2Region as pe } from "../libs/utils.js";
20
+ const D = (p) => new S(p, {
21
21
  // eslint-disable-next-line no-useless-escape
22
22
  browser: [[/(ArcWallet)\/([\w\.]+)/i], [S.BROWSER.NAME, S.BROWSER.VERSION]]
23
- }).getResult(), D = {
23
+ }).getResult(), W = {
24
24
  display: "flex",
25
25
  justifyContent: "flex-end",
26
26
  textAlign: "right"
27
- }, pe = new ee({ concurrency: 1 }), ue = ie(({ userSession: p, isMobile: h = !1 }) => {
27
+ }, ue = new ee({ concurrency: 1 }), me = ie(({ userSession: p, isMobile: h = !1 }) => {
28
28
  const l = z({
29
29
  loading: !0,
30
30
  ipRegion: ""
31
31
  }), { t: f } = O();
32
32
  return se(() => {
33
- pe.add(async () => {
33
+ ue.add(async () => {
34
34
  try {
35
- l.ipRegion = await de(p.lastLoginIp);
35
+ l.ipRegion = await pe(p.lastLoginIp);
36
36
  } finally {
37
37
  l.loading = !1;
38
38
  }
@@ -47,17 +47,17 @@ const W = (p) => new S(p, {
47
47
  gap: 1,
48
48
  flexWrap: "wrap"
49
49
  },
50
- children: l.ipRegion ? /* @__PURE__ */ s(A, { children: [
50
+ children: l.ipRegion ? /* @__PURE__ */ s(k, { children: [
51
51
  /* @__PURE__ */ n(a, { variant: "body2", children: l.ipRegion }),
52
52
  /* @__PURE__ */ n(a, { variant: "body2", color: "grey", children: p.lastLoginIp || f("unknown") })
53
- ] }) : /* @__PURE__ */ s(A, { children: [
53
+ ] }) : /* @__PURE__ */ s(k, { children: [
54
54
  /* @__PURE__ */ n(a, { children: p.lastLoginIp || f("unknown") }),
55
55
  l.loading ? /* @__PURE__ */ n(a, { variant: "body2", color: "grey", sx: { textAlign: "center" }, children: /* @__PURE__ */ n(te, { size: 12, color: "inherit" }) }) : null
56
56
  ] })
57
57
  }
58
58
  );
59
59
  });
60
- function Pe({
60
+ function Me({
61
61
  user: p,
62
62
  showAction: h = !0,
63
63
  showUser: l = !0,
@@ -65,7 +65,7 @@ function Pe({
65
65
  showOffline: I = !1,
66
66
  showAppPid: j = !1
67
67
  }) {
68
- const r = z({
68
+ const L = ae(), r = z({
69
69
  status: "online",
70
70
  page: 1,
71
71
  pageSize: 10
@@ -73,7 +73,7 @@ function Pe({
73
73
  online: 0,
74
74
  expired: 0,
75
75
  offline: 0
76
- }), y = Y(), { locale: b } = O(), m = ae({ key: "md" }), H = oe((e) => e.breakpoints.down("lg")), { confirmApi: R, confirmHolder: E } = Z(), t = v((e, o = {}) => X(ce, e, b, "en", o)), F = v(async () => {
76
+ }), y = Y(), { locale: b } = O(), m = le({ key: "md" }), H = oe((e) => e.breakpoints.down("lg")), { confirmApi: R, confirmHolder: E } = Z(), t = v((e, o = {}) => X(de, e, b, "en", o)), F = v(async () => {
77
77
  const e = await f({
78
78
  page: r.page,
79
79
  pageSize: r.pageSize,
@@ -84,7 +84,7 @@ function Pe({
84
84
  list: e?.list || []
85
85
  };
86
86
  });
87
- J(async () => {
87
+ $(async () => {
88
88
  const e = await f({
89
89
  page: 1,
90
90
  pageSize: 1,
@@ -98,12 +98,12 @@ function Pe({
98
98
  });
99
99
  u.offline = o?.paging?.total || 0;
100
100
  });
101
- const c = K(F, {
101
+ const c = J(F, {
102
102
  refreshDeps: [r.status, r.page, r.pageSize]
103
103
  }), i = w(() => c.data?.list || [], [c.data?.list]), N = w(() => {
104
104
  const e = r.status;
105
105
  return e === "online" ? u[e] <= 1 : u[e] === 0;
106
- }, [i, y]), x = w(() => P({}, m ? D : {}), [m]), U = v(({ visitorId: e }) => {
106
+ }, [i, y]), x = w(() => M({}, m ? W : {}), [m]), U = v(({ visitorId: e }) => {
107
107
  R.open({
108
108
  title: t("logoutThisSession"),
109
109
  content: t("logoutThisSessionConfirm"),
@@ -113,7 +113,7 @@ function Pe({
113
113
  },
114
114
  cancelButtonText: t("cancel"),
115
115
  onConfirm: async () => {
116
- await M.user.logout({
116
+ await L.user.logout({
117
117
  visitorId: e,
118
118
  includeFederated: !0
119
119
  });
@@ -135,15 +135,15 @@ function Pe({
135
135
  },
136
136
  cancelButtonText: t("cancel"),
137
137
  onConfirm: async () => {
138
- await M.user.logout({
138
+ await L.user.logout({
139
139
  status: r.status,
140
140
  visitorId: y,
141
141
  includeFederated: !0
142
142
  }), r.page = 1, c.refresh(), R.close();
143
143
  }
144
144
  });
145
- }), L = [];
146
- h && L.push(
145
+ }), A = [];
146
+ h && A.push(
147
147
  /* @__PURE__ */ n(
148
148
  ne,
149
149
  {
@@ -151,7 +151,7 @@ function Pe({
151
151
  type: t(r.status)
152
152
  }),
153
153
  children: /* @__PURE__ */ n(
154
- k,
154
+ P,
155
155
  {
156
156
  sx: { ml: 0.5 },
157
157
  size: "small",
@@ -186,7 +186,7 @@ function Pe({
186
186
  name: "platform",
187
187
  options: {
188
188
  customBodyRenderLite: (e) => {
189
- const o = i[e], g = W(o?.ua);
189
+ const o = i[e], g = D(o?.ua);
190
190
  return /* @__PURE__ */ n(d, { sx: x, children: [g.os?.name, g.os?.version].filter(Boolean).join("/") || t("unknown") });
191
191
  }
192
192
  }
@@ -196,7 +196,7 @@ function Pe({
196
196
  name: "deviceType",
197
197
  options: {
198
198
  customBodyRenderLite: (e) => {
199
- const o = i[e], g = W(o?.ua);
199
+ const o = i[e], g = D(o?.ua);
200
200
  return /* @__PURE__ */ n(d, { sx: x, children: [g.browser?.name, g.browser?.version].filter(Boolean).join("/") || t("unknown") });
201
201
  }
202
202
  }
@@ -227,7 +227,7 @@ function Pe({
227
227
  options: {
228
228
  customBodyRenderLite: (e) => {
229
229
  const o = i[e];
230
- return /* @__PURE__ */ n(d, { sx: P({ minWidth: 150, maxWidth: 250 }, m ? D : {}), children: /* @__PURE__ */ n(le, { sessionUser: o.user, user: p }) });
230
+ return /* @__PURE__ */ n(d, { sx: M({ minWidth: 150, maxWidth: 250 }, m ? W : {}), children: /* @__PURE__ */ n(ce, { sessionUser: o.user, user: p }) });
231
231
  }
232
232
  }
233
233
  },
@@ -257,7 +257,7 @@ function Pe({
257
257
  options: {
258
258
  customBodyRenderLite: (e) => {
259
259
  const o = i[e];
260
- return /* @__PURE__ */ n(ue, { userSession: o, isMobile: m });
260
+ return /* @__PURE__ */ n(me, { userSession: o, isMobile: m });
261
261
  }
262
262
  }
263
263
  },
@@ -268,7 +268,7 @@ function Pe({
268
268
  customBodyRenderLite: (e) => {
269
269
  const o = i[e];
270
270
  return /* @__PURE__ */ n(d, { sx: x, children: /* @__PURE__ */ n(
271
- k,
271
+ P,
272
272
  {
273
273
  sx: {
274
274
  whiteSpace: "nowrap",
@@ -337,13 +337,13 @@ function Pe({
337
337
  children: [
338
338
  E,
339
339
  /* @__PURE__ */ n(
340
- $,
340
+ K,
341
341
  {
342
342
  count: c.data?.total || 0,
343
343
  locale: b,
344
344
  data: i,
345
345
  columns: Q,
346
- customButtons: L,
346
+ customButtons: A,
347
347
  options: q,
348
348
  loading: c.loading,
349
349
  className: "pc-user-sessions-table",
@@ -414,5 +414,5 @@ function Pe({
414
414
  );
415
415
  }
416
416
  export {
417
- Pe as default
417
+ Me as default
418
418
  };
@@ -11,7 +11,7 @@ export function getLocalizedNavigation({ navigation, locale, defaultLocale, sect
11
11
  }>;
12
12
  locale: string;
13
13
  defaultLocale: string;
14
- section?: "footer" | "header" | undefined;
14
+ section?: "header" | "footer" | undefined;
15
15
  }): any[];
16
16
  export function formatNavigation(navigation: any): any;
17
17
  export function parseNavigation(navigation: any): {
@@ -11,7 +11,7 @@ declare function HeaderAddons({ formattedBlocklet, addons, showDomainWarningDial
11
11
  declare namespace HeaderAddons {
12
12
  namespace propTypes {
13
13
  export let formattedBlocklet: PropTypes.Validator<object>;
14
- export let addons: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactNodeLike>>;
14
+ export let addons: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
15
15
  export { SessionManagerProps as sessionManagerProps };
16
16
  export let showDomainWarningDialog: PropTypes.Requireable<boolean>;
17
17
  }
@@ -1,14 +1,10 @@
1
- import { jsxs as m, jsx as o, Fragment as w } from "react/jsx-runtime";
1
+ import { jsxs as m, jsx as r, Fragment as w } from "react/jsx-runtime";
2
2
  import { useState as f } from "react";
3
3
  import l from "prop-types";
4
- import { useMemoizedFn as S, useReactive as B } from "ahooks";
4
+ import { useMemoizedFn as B, useReactive as D } from "ahooks";
5
5
  import g from "lodash/noop";
6
- import D from "@arcblock/ux/lib/Dialog";
7
- import E from "@mui/material/CircularProgress";
8
- import L from "@mui/material/DialogContentText";
9
- import h from "@mui/material/Typography";
10
- import y from "@mui/material/TextField";
11
- import O from "@mui/material/Alert";
6
+ import E from "@arcblock/ux/lib/Dialog";
7
+ import { Typography as h, TextField as y, DialogContentText as L, Alert as O, CircularProgress as S } from "@mui/material";
12
8
  import W from "@arcblock/ux/lib/Toast";
13
9
  import v from "@arcblock/ux/lib/Button";
14
10
  import { translate as j } from "@arcblock/ux/lib/Locale/util";
@@ -16,36 +12,36 @@ import { formatAxiosError as k } from "../../UserCenter/libs/utils.js";
16
12
  import z from "./use-org.js";
17
13
  import A from "./locales.js";
18
14
  function M({ onSuccess: C = g, onCancel: s = g, locale: T = "en" }) {
19
- const [i, c] = f(!1), [p, r] = f(""), { createOrg: b } = z(), t = S((e, a = {}) => j(A, e, T, "en", a)), n = B({
15
+ const [i, c] = f(!1), [u, o] = f(""), { createOrg: b } = z(), t = B((e, a = {}) => j(A, e, T, "en", a)), n = D({
20
16
  name: "",
21
17
  description: ""
22
18
  }), x = async () => {
23
19
  const e = n.name.trim();
24
20
  if (!e) {
25
- r(t("nameEmpty"));
21
+ o(t("nameEmpty"));
26
22
  return;
27
23
  }
28
24
  if (e.length > 25) {
29
- r(t("nameTooLong", { length: 25 }));
25
+ o(t("nameTooLong", { length: 25 }));
30
26
  return;
31
27
  }
32
28
  const a = n.description.trim();
33
29
  if (a.length > 255) {
34
- r(t("descriptionTooLong", { length: 25 }));
30
+ o(t("descriptionTooLong", { length: 25 }));
35
31
  return;
36
32
  }
37
- r(""), c(!0);
33
+ o(""), c(!0);
38
34
  try {
39
35
  await b({ name: e, description: a }), C();
40
- } catch (u) {
41
- console.error(u);
42
- const d = k(u);
43
- r(d), W.error(d);
36
+ } catch (d) {
37
+ console.error(d);
38
+ const p = k(d);
39
+ o(p), W.error(p);
44
40
  } finally {
45
41
  c(!1);
46
42
  }
47
43
  }, F = /* @__PURE__ */ m("div", { children: [
48
- /* @__PURE__ */ o(h, { component: "div", style: { marginTop: 16 }, children: /* @__PURE__ */ o(
44
+ /* @__PURE__ */ r(h, { component: "div", style: { marginTop: 16 }, children: /* @__PURE__ */ r(
49
45
  y,
50
46
  {
51
47
  label: t("mutate.name"),
@@ -57,12 +53,12 @@ function M({ onSuccess: C = g, onCancel: s = g, locale: T = "en" }) {
57
53
  autoFocus: !0,
58
54
  value: n.name,
59
55
  onChange: (e) => {
60
- r(""), n.name = e.target.value;
56
+ o(""), n.name = e.target.value;
61
57
  },
62
58
  disabled: i
63
59
  }
64
60
  ) }),
65
- /* @__PURE__ */ o(h, { component: "div", style: { marginTop: 16, marginBottom: 16 }, children: /* @__PURE__ */ o(
61
+ /* @__PURE__ */ r(h, { component: "div", style: { marginTop: 16, marginBottom: 16 }, children: /* @__PURE__ */ r(
66
62
  y,
67
63
  {
68
64
  label: t("mutate.description"),
@@ -73,7 +69,7 @@ function M({ onSuccess: C = g, onCancel: s = g, locale: T = "en" }) {
73
69
  fullWidth: !0,
74
70
  value: n.description,
75
71
  onChange: (e) => {
76
- r(""), n.description = e.target.value;
72
+ o(""), n.description = e.target.value;
77
73
  },
78
74
  disabled: i,
79
75
  multiline: !0,
@@ -82,7 +78,7 @@ function M({ onSuccess: C = g, onCancel: s = g, locale: T = "en" }) {
82
78
  ) })
83
79
  ] });
84
80
  return /* @__PURE__ */ m(
85
- D,
81
+ E,
86
82
  {
87
83
  title: t("mutate.title", { mode: t("create") }),
88
84
  fullWidth: !0,
@@ -90,7 +86,7 @@ function M({ onSuccess: C = g, onCancel: s = g, locale: T = "en" }) {
90
86
  onClose: s,
91
87
  showCloseButton: !1,
92
88
  actions: /* @__PURE__ */ m(w, { children: [
93
- /* @__PURE__ */ o(v, { onClick: s, color: "inherit", children: t("cancel") }),
89
+ /* @__PURE__ */ r(v, { onClick: s, color: "inherit", children: t("cancel") }),
94
90
  /* @__PURE__ */ m(
95
91
  v,
96
92
  {
@@ -101,15 +97,15 @@ function M({ onSuccess: C = g, onCancel: s = g, locale: T = "en" }) {
101
97
  variant: "contained",
102
98
  autoFocus: !0,
103
99
  children: [
104
- i && /* @__PURE__ */ o(E, { size: 16 }),
100
+ i && /* @__PURE__ */ r(S, { size: 16 }),
105
101
  t("create")
106
102
  ]
107
103
  }
108
104
  )
109
105
  ] }),
110
106
  children: [
111
- /* @__PURE__ */ o(L, { component: "div", children: F }),
112
- !!p && /* @__PURE__ */ o(O, { severity: "error", style: { width: "100%", margin: 0 }, children: p })
107
+ /* @__PURE__ */ r(L, { component: "div", children: F }),
108
+ !!u && /* @__PURE__ */ r(O, { severity: "error", style: { width: "100%", margin: 0 }, children: u })
113
109
  ]
114
110
  }
115
111
  );
@@ -1,11 +1,11 @@
1
- import { useMemoizedFn as e } from "ahooks";
1
+ import { useMemoizedFn as n } from "ahooks";
2
2
  import i from "@arcblock/ux/lib/Toast";
3
- import { client as n } from "../../libs/client.js";
4
- import { formatAxiosError as m } from "../../UserCenter/libs/utils.js";
5
- function d(a) {
6
- const c = e(async ({ search: t, page: r = 1, pageSize: o = 20 }) => {
3
+ import { getBlockletSDK as m } from "@blocklet/js-sdk";
4
+ import { formatAxiosError as p } from "../../UserCenter/libs/utils.js";
5
+ function w(c) {
6
+ const e = m(), a = n(async ({ search: t, page: r = 1, pageSize: o = 20 }) => {
7
7
  try {
8
- return await n.user.getOrgs({ search: t, page: r, pageSize: o });
8
+ return await e.user.getOrgs({ search: t, page: r, pageSize: o });
9
9
  } catch (s) {
10
10
  return console.error(s), {
11
11
  orgs: [],
@@ -16,32 +16,32 @@ function d(a) {
16
16
  }
17
17
  };
18
18
  }
19
- }), u = e(async ({ name: t, description: r }) => {
19
+ }), u = n(async ({ name: t, description: r }) => {
20
20
  try {
21
- return (await n.user.createOrg({ name: t, description: r })).data;
21
+ return (await e.user.createOrg({ name: t, description: r })).data;
22
22
  } catch (o) {
23
- return console.error(o), i.error(m(o)), null;
23
+ return console.error(o), i.error(p(o)), null;
24
24
  }
25
- }), g = e(async (t) => {
25
+ }), g = n(async (t) => {
26
26
  try {
27
- return await n.user.getOrg(t);
27
+ return await e.user.getOrg(t);
28
28
  } catch (r) {
29
- return a.logout(), console.error(r), null;
29
+ return c.logout(), console.error(r), null;
30
30
  }
31
- }), l = e(async (t) => {
31
+ }), l = n(async (t) => {
32
32
  try {
33
- const r = await n.user.getRole(t);
33
+ const r = await e.user.getRole(t);
34
34
  return r.orgId ? await g(r.orgId) : null;
35
35
  } catch (r) {
36
36
  return console.error(r), null;
37
37
  }
38
38
  });
39
39
  return {
40
- getOrgs: c,
40
+ getOrgs: a,
41
41
  createOrg: u,
42
42
  getCurrentOrg: l
43
43
  };
44
44
  }
45
45
  export {
46
- d as default
46
+ w as default
47
47
  };
@@ -1,47 +1,47 @@
1
1
  import { useState as p, useEffect as F } from "react";
2
2
  import { useMemoizedFn as n } from "ahooks";
3
3
  import c from "@arcblock/ux/lib/Toast";
4
- import { client as l } from "../libs/client.js";
4
+ import { getBlockletSDK as U } from "@blocklet/js-sdk";
5
5
  import { formatAxiosError as u } from "../UserCenter/libs/utils.js";
6
- function E({
7
- userDid: o,
6
+ function _({
7
+ userDid: r,
8
8
  t: a,
9
9
  isMySelf: e
10
10
  }) {
11
- const [i, f] = p(!1), t = n(async () => {
11
+ const l = U(), [i, f] = p(!1), s = n(async () => {
12
12
  try {
13
13
  if (e) {
14
14
  f(!0);
15
15
  return;
16
16
  }
17
- const r = await l.user.isFollowingUser({ userDid: o });
18
- f(r);
19
- } catch (r) {
20
- console.error(r);
17
+ const o = await l.user.isFollowingUser({ userDid: r });
18
+ f(o);
19
+ } catch (o) {
20
+ console.error(o);
21
21
  }
22
- }), m = n(async (r = o) => {
23
- if (!(e && r === o))
22
+ }), m = n(async (o = r) => {
23
+ if (!(e && o === r))
24
24
  try {
25
- await l.user.followUser({ userDid: r }), c.success(a("profile.follow_success")), t();
26
- } catch (s) {
27
- console.error(s), c.error(u(s));
25
+ await l.user.followUser({ userDid: o }), c.success(a("profile.follow_success")), s();
26
+ } catch (t) {
27
+ console.error(t), c.error(u(t));
28
28
  }
29
- }), w = n(async (r = o) => {
30
- if (!(e && r === o))
29
+ }), w = n(async (o = r) => {
30
+ if (!(e && o === r))
31
31
  try {
32
- await l.user.unfollowUser({ userDid: r }), c.success(a("profile.unfollow_success")), t();
33
- } catch (s) {
34
- console.error(s), c.error(u(s));
32
+ await l.user.unfollowUser({ userDid: o }), c.success(a("profile.unfollow_success")), s();
33
+ } catch (t) {
34
+ console.error(t), c.error(u(t));
35
35
  }
36
36
  });
37
37
  return F(() => {
38
- o && !e && t();
39
- }, [t, o, e]), {
38
+ r && !e && s();
39
+ }, [s, r, e]), {
40
40
  followed: i,
41
41
  followUser: m,
42
42
  unfollowUser: w
43
43
  };
44
44
  }
45
45
  export {
46
- E as default
46
+ _ as default
47
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "3.3.10",
3
+ "version": "3.4.0",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -35,11 +35,11 @@
35
35
  "dependencies": {
36
36
  "@abtnode/constant": "^1.17.7",
37
37
  "@abtnode/util": "^1.17.7",
38
- "@arcblock/bridge": "3.3.10",
39
- "@arcblock/icons": "3.3.10",
40
- "@arcblock/react-hooks": "3.3.10",
41
- "@arcblock/ws": "^1.27.16",
42
- "@blocklet/did-space-react": "^1.2.13",
38
+ "@arcblock/bridge": "3.4.0",
39
+ "@arcblock/icons": "3.4.0",
40
+ "@arcblock/react-hooks": "3.4.0",
41
+ "@arcblock/ws": "^1.28.1",
42
+ "@blocklet/did-space-react": "^1.2.14",
43
43
  "@iconify-icons/logos": "^1.2.36",
44
44
  "@iconify-icons/material-symbols": "^1.2.58",
45
45
  "@iconify-icons/tabler": "^1.2.95",
@@ -82,7 +82,7 @@
82
82
  "access": "public"
83
83
  },
84
84
  "devDependencies": {
85
- "@arcblock/did-connect-react": "3.3.10",
85
+ "@arcblock/did-connect-react": "3.4.0",
86
86
  "@babel/preset-env": "^7.28.0",
87
87
  "@babel/preset-react": "^7.27.1",
88
88
  "@babel/preset-typescript": "^7.27.1",
@@ -96,5 +96,5 @@
96
96
  "typescript": "~5.5.4",
97
97
  "unbuild": "^2.0.0"
98
98
  },
99
- "gitHead": "6c98492b766cb7f7486f3a81f3d4e4b0936af163"
99
+ "gitHead": "bbf3a178a14a767aef0da795ea31abe8dfb858c1"
100
100
  }
@@ -1,8 +1,7 @@
1
- import { Box, Skeleton, styled, Typography } from '@mui/material';
1
+ import { Box, BoxProps, Skeleton, styled, Typography } from '@mui/material';
2
2
  import { Icon } from '@iconify/react';
3
3
  import { TBox } from '@arcblock/ux/lib/MuiWrap';
4
4
  import { Link } from 'react-router-dom';
5
- import { BoxProps } from '@mui/material/Box';
6
5
 
7
6
  export const isExternal = (to: string = ''): boolean => {
8
7
  return to.startsWith('http:') || to.startsWith('https:');
@@ -2,7 +2,7 @@ import isEmpty from 'lodash/isEmpty';
2
2
  import DOMPurify from 'dompurify';
3
3
  import { Link, toTextList, getLink as getLinkUtil } from '@abtnode/util/lib/notification-preview/highlight';
4
4
  import { isSameAddr } from '@abtnode/util/lib/notification-preview/func';
5
- import { client } from '../libs/client';
5
+ import { getBlockletSDK } from '@blocklet/js-sdk';
6
6
 
7
7
  /**
8
8
  * 通知对象的活动目标接口
@@ -192,6 +192,7 @@ export const getActivityLink = (
192
192
 
193
193
  const getUserProfileUrl = async (did: string, locale: string) => {
194
194
  try {
195
+ const client = getBlockletSDK();
195
196
  const profileUrl = await client.user.getProfileUrl({ did, locale });
196
197
  return profileUrl;
197
198
  } catch (error) {
@@ -1,8 +1,8 @@
1
1
  import { Box, TextField } from '@mui/material';
2
2
  import { useMemoizedFn, useReactive } from 'ahooks';
3
3
  import Toast from '@arcblock/ux/lib/Toast';
4
+ import { getBlockletSDK } from '@blocklet/js-sdk';
4
5
 
5
- import { client } from '../../libs/client';
6
6
  import { User } from '../../@types';
7
7
  import { formatAxiosError } from '../libs/utils';
8
8
 
@@ -11,6 +11,7 @@ export default function ConfigInviter({ user }: { user: User }) {
11
11
  inviter: user?.inviter,
12
12
  loading: false,
13
13
  });
14
+ const client = getBlockletSDK();
14
15
 
15
16
  const handleChange = useMemoizedFn(async (e) => {
16
17
  try {
@@ -4,9 +4,9 @@ import { translate } from '@arcblock/ux/lib/Locale/util';
4
4
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
5
5
  import Toast from '@arcblock/ux/lib/Toast';
6
6
  import ArrowDownwardIcon from '@arcblock/icons/lib/ArrowDown';
7
+ import { getBlockletSDK } from '@blocklet/js-sdk';
7
8
 
8
9
  import { translations } from '../libs/locales';
9
- import { client } from '../../libs/client';
10
10
  import { User } from '../../@types';
11
11
  import { formatAxiosError } from '../libs/utils';
12
12
 
@@ -17,6 +17,7 @@ const languages = [
17
17
 
18
18
  export default function ConfigProfile({ user, onSave }: { user: User; onSave: (type: 'profile') => void }) {
19
19
  const { locale, changeLocale } = useLocaleContext();
20
+ const client = getBlockletSDK();
20
21
  const t = useMemoizedFn((key, data = {}) => {
21
22
  return translate(translations, key, locale, 'en', data);
22
23
  });
@@ -1,4 +1,4 @@
1
- import Modal from '@mui/material/Modal';
1
+ import { Modal } from '@mui/material';
2
2
  import styled from '@emotion/styled';
3
3
  import NFTDisplay, { getNFTData } from '@arcblock/ux/lib/NFTDisplay';
4
4
 
@@ -11,12 +11,12 @@ import { translate } from '@arcblock/ux/lib/Locale/util';
11
11
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
12
12
  import { AxiosError } from 'axios';
13
13
  import DID from '@arcblock/ux/lib/DID';
14
+ import { getBlockletSDK } from '@blocklet/js-sdk';
14
15
 
15
16
  import { translations } from '../libs/locales';
16
17
  import WebhookItem from './webhook-item';
17
18
  import { User, WebhookItemData } from '../../@types';
18
19
  import { formatAxiosError } from '../libs/utils';
19
- import { client } from '../../libs/client';
20
20
 
21
21
  function NotificationItem({
22
22
  title = undefined,
@@ -64,6 +64,7 @@ function NotificationItem({
64
64
 
65
65
  export default function Notification({ user, isMobile }: { user: User; isMobile: boolean }) {
66
66
  const { locale } = useLocaleContext();
67
+ const client = getBlockletSDK();
67
68
  const t = useMemoizedFn((key, data = {}) => {
68
69
  return translate(translations, key, locale, 'en', data);
69
70
  });
@@ -6,9 +6,9 @@ import { translate } from '@arcblock/ux/lib/Locale/util';
6
6
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
7
7
  import Toast from '@arcblock/ux/lib/Toast';
8
8
  import type { AxiosError } from 'axios';
9
+ import { getBlockletSDK } from '@blocklet/js-sdk';
9
10
 
10
11
  import { translations } from '../libs/locales';
11
- import { client } from '../../libs/client';
12
12
  import { formatAxiosError } from '../libs/utils';
13
13
 
14
14
  type PrivacyConfig = {
@@ -25,6 +25,7 @@ export default function Privacy({
25
25
  configList: PrivacyConfig[];
26
26
  onSave: (type: 'privacy') => void;
27
27
  }) {
28
+ const client = getBlockletSDK();
28
29
  const [dataList, setDataList] = useState(configList);
29
30
  const { locale } = useLocaleContext();
30
31
  const t = useMemoizedFn((key, data = {}) => {