@blocklet/ui-react 3.4.13 → 3.4.15

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.
@@ -1,26 +1,26 @@
1
- import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
- import { use as ke, useMemo as Pe, isValidElement as ie, cloneElement as oe, Children as Se } from "react";
3
- import { Box as a, Typography as B, CircularProgress as Me, Divider as De } from "@mui/material";
4
- import { useMemoizedFn as P, useCreation as d, useRequest as ne } from "ahooks";
5
- import Fe from "p-wait-for";
1
+ import { jsx as r, jsxs as h } from "react/jsx-runtime";
2
+ import { use as Pe, useMemo as Se, isValidElement as ie, cloneElement as oe, Children as Me } from "react";
3
+ import { Box as a, Typography as B, CircularProgress as De, Divider as Fe } from "@mui/material";
4
+ import { useMemoizedFn as S, useCreation as c, useRequest as ne } from "ahooks";
5
+ import Te from "p-wait-for";
6
6
  import se from "react-helmet";
7
- import { SessionContext as Te } from "@arcblock/did-connect-react/lib/Session";
8
- import ze from "@arcblock/ux/lib/Tabs";
7
+ import { SessionContext as ze } from "@arcblock/did-connect-react/lib/Session";
8
+ import We from "@arcblock/ux/lib/Tabs";
9
9
  import I from "@arcblock/ux/lib/Empty";
10
- import We from "@arcblock/ux/lib/Button";
11
- import Ae from "@arcblock/ux/lib/Result";
12
- import { useConfirm as Le } from "@arcblock/ux/lib/Dialog";
13
- import { translate as Ue } from "@arcblock/ux/lib/Locale/util";
14
- import { useLocaleContext as Be } from "@arcblock/ux/lib/Locale/context";
15
- import { ErrorFallback as Ie } from "@arcblock/ux/lib/ErrorBoundary";
16
- import { styled as pe } from "@arcblock/ux/lib/Theme";
17
- import Ne from "lodash/cloneDeep";
18
- import { joinURL as S, getQuery as je, withoutTrailingSlash as le, withQuery as ae } from "ufo";
19
- import { getBlockletSDK as He } from "@blocklet/js-sdk";
20
- import { isSupportFollow as Ee } from "@arcblock/ux/lib/Util";
21
- import { PROFILE_URL as M } from "@arcblock/ux/lib/Util/constant";
10
+ import Ae from "@arcblock/ux/lib/Button";
11
+ import Le from "@arcblock/ux/lib/Result";
12
+ import { useConfirm as Ue } from "@arcblock/ux/lib/Dialog";
13
+ import { translate as Be } from "@arcblock/ux/lib/Locale/util";
14
+ import { useLocaleContext as Ie } from "@arcblock/ux/lib/Locale/context";
15
+ import { ErrorFallback as Ne } from "@arcblock/ux/lib/ErrorBoundary";
16
+ import { styled as me } from "@arcblock/ux/lib/Theme";
17
+ import je from "lodash/cloneDeep";
18
+ import { joinURL as M, getQuery as He, parseURL as le, withoutTrailingSlash as ae, withQuery as ue } from "ufo";
19
+ import { getBlockletSDK as Ee } from "@blocklet/js-sdk";
20
+ import { isSupportFollow as Re } from "@arcblock/ux/lib/Util";
21
+ import { PROFILE_URL as D } from "@arcblock/ux/lib/Util/constant";
22
22
  import _e from "../../Footer/index.js";
23
- import ue from "../../Header/index.js";
23
+ import ce from "../../Header/index.js";
24
24
  import { translations as Oe } from "../libs/locales.js";
25
25
  import de from "./user-info/user-basic-info.js";
26
26
  import "@mui/icons-material";
@@ -33,20 +33,20 @@ import "@iconify-icons/material-symbols/settings-input-antenna-rounded";
33
33
  import "@arcblock/ux/lib/RelativeTime";
34
34
  import "@arcblock/ux/lib/UserCard/Content/shorten-label";
35
35
  import "./user-info/switch-role.js";
36
- import { formatBlockletInfo as Re, getLink as F, getLocalizedNavigation as $e } from "../../blocklets.js";
37
- import qe from "./passport.js";
38
- import Ge from "./settings.js";
39
- import Qe from "../../hooks/use-mobile.js";
40
- import { ConfigUserSpaceProvider as Ke } from "../../contexts/config-user-space.js";
41
- import Ve from "./storage/index.js";
42
- import Je from "./nft.js";
43
- import { UserFollowersProvider as ce } from "../../contexts/user-followers.js";
44
- import Xe from "./fallback.js";
45
- const T = S(M, "/nfts"), z = S(M, "/settings"), W = S(M, "/did-spaces"), j = S(M, "/user-followers"), Ye = (b) => b.some(
46
- (y) => ["/userCenter/nfts", "/userCenter/user-followers", "/userCenter/settings", "/userCenter/did-spaces"].includes(
47
- y.id
48
- ) || [T, z, W, j].includes(y.link)
49
- ), fe = pe(a)(({ theme: b }) => ({
36
+ import { formatBlockletInfo as $e, getLink as C, getLocalizedNavigation as qe } from "../../blocklets.js";
37
+ import Ge from "./passport.js";
38
+ import Qe from "./settings.js";
39
+ import Ke from "../../hooks/use-mobile.js";
40
+ import { ConfigUserSpaceProvider as Ve } from "../../contexts/config-user-space.js";
41
+ import Je from "./storage/index.js";
42
+ import Xe from "./nft.js";
43
+ import { UserFollowersProvider as fe } from "../../contexts/user-followers.js";
44
+ import Ye from "./fallback.js";
45
+ const T = M(D, "/nfts"), z = M(D, "/settings"), W = M(D, "/did-spaces"), j = M(D, "/user-followers"), Ze = (b) => b.some(
46
+ (k) => ["/userCenter/nfts", "/userCenter/user-followers", "/userCenter/settings", "/userCenter/did-spaces"].includes(
47
+ k.id
48
+ ) || [T, z, W, j].includes(k.link)
49
+ ), pe = me(a)(({ theme: b }) => ({
50
50
  flex: 1,
51
51
  boxSizing: "border-box",
52
52
  padding: "0 16px",
@@ -60,7 +60,7 @@ const T = S(M, "/nfts"), z = S(M, "/settings"), W = S(M, "/did-spaces"), j = S(M
60
60
  [b.breakpoints.up("md")]: {
61
61
  flexDirection: "row"
62
62
  }
63
- })), N = pe(a)(({ theme: b }) => ({
63
+ })), N = me(a)(({ theme: b }) => ({
64
64
  overflow: "hidden",
65
65
  flex: "revert",
66
66
  [b.breakpoints.up("md")]: {
@@ -72,45 +72,45 @@ const T = S(M, "/nfts"), z = S(M, "/settings"), W = S(M, "/did-spaces"), j = S(M
72
72
  }
73
73
  }
74
74
  }));
75
- function qr({
75
+ function Gr({
76
76
  children: b,
77
- notLoginContent: y = null,
77
+ notLoginContent: k = null,
78
78
  currentTab: v,
79
79
  contentProps: H = {},
80
80
  disableAutoRedirect: E = !1,
81
- hideFooter: me = !1,
82
- headerProps: he = {},
83
- footerProps: xe = {},
81
+ hideFooter: he = !1,
82
+ headerProps: xe = {},
83
+ footerProps: ge = {},
84
84
  userDid: A = void 0,
85
- stickySidebar: _ = !1,
86
- embed: D = !1,
87
- onlyProfile: C = !1,
85
+ stickySidebar: R = !1,
86
+ embed: F = !1,
87
+ onlyProfile: P = !1,
88
88
  // 只显示 profile 页面,用于 ArcSphere 只需要显示 Profile 的内容
89
- onDestroySelf: ge = void 0
89
+ onDestroySelf: be = void 0
90
90
  }) {
91
- const O = He(), { locale: x, defaultLocale: k } = Be(), u = Qe({ key: "md" }), f = P((e, i = {}) => Ue(Oe, e, x, "en", i)), t = ke(Te)?.session, h = d(() => {
91
+ const _ = Ee(), { locale: m, defaultLocale: w } = Ie(), u = Ke({ key: "md" }), f = S((e, i = {}) => Be(Oe, e, m, "en", i)), t = Pe(ze)?.session, x = c(() => {
92
92
  if (A)
93
93
  return A;
94
- const e = window.location.href, i = je(e);
94
+ const e = window.location.href, i = He(e);
95
95
  return i?.did ? Array.isArray(i.did) ? i.did[0] : i.did : t?.user?.did;
96
- }, [t?.user?.did, A]), o = d(() => t?.user ? h === t?.user?.did : !1, [h, t?.user?.did]), w = Pe(() => !!t?.user && Ee(), [t?.user]), n = ne(
96
+ }, [t?.user?.did, A]), o = c(() => t?.user ? x === t?.user?.did : !1, [x, t?.user?.did]), y = Se(() => !!t?.user && Re(), [t?.user]), n = ne(
97
97
  // eslint-disable-next-line consistent-return
98
98
  async () => {
99
- if (await Fe(() => t?.initialized), o)
99
+ if (await Te(() => t?.initialized), o)
100
100
  return t.user;
101
- if (h)
102
- return O.user.getUserPublicInfo({ did: h });
101
+ if (x)
102
+ return _.user.getUserPublicInfo({ did: x });
103
103
  },
104
104
  {
105
- refreshDeps: [h, o, t?.initialized, t?.user]
105
+ refreshDeps: [x, o, t?.initialized, t?.user]
106
106
  }
107
- ), R = P(() => o ? t.refresh() : n.refresh()), g = ne(
108
- async () => n.data && v ? await O.user.getUserPrivacyConfig({ did: h }) : null,
107
+ ), O = S(() => o ? t.refresh() : n.refresh()), g = ne(
108
+ async () => n.data && v ? await _.user.getUserPrivacyConfig({ did: x }) : null,
109
109
  {
110
- refreshDeps: [h, n.data, v],
110
+ refreshDeps: [x, n.data, v],
111
111
  loadingDelay: 300
112
112
  }
113
- ), { confirmHolder: $ } = Le({
113
+ ), { confirmHolder: $ } = Ue({
114
114
  fullScreen: u,
115
115
  sx: {
116
116
  ".MuiDialog-paper": {
@@ -130,29 +130,29 @@ function qr({
130
130
  }
131
131
  }
132
132
  }
133
- }), q = d(() => {
134
- const e = Ne(window.blocklet);
133
+ }), q = c(() => {
134
+ const e = je(window.blocklet);
135
135
  try {
136
- return Re(e);
136
+ return $e(e);
137
137
  } catch (i) {
138
138
  return console.error("Failed to format blocklet info", i, e), e;
139
139
  }
140
- }, []), G = d(() => {
140
+ }, []), G = c(() => {
141
141
  const e = {
142
142
  label: f("common.nft"),
143
143
  protected: !1,
144
144
  isPrivate: !1,
145
145
  // true: 隐私数据,仅自己可见
146
146
  value: T,
147
- url: F(T, x, k)
147
+ url: C(T, m, w)
148
148
  }, i = {
149
149
  label: f("userFollowers"),
150
150
  protected: !1,
151
151
  isPrivate: !1,
152
152
  value: j,
153
- url: F(j, x, k)
153
+ url: C(j, m, w)
154
154
  };
155
- let p = w ? [e, i] : [e];
155
+ let p = y ? [e, i] : [e];
156
156
  if (o) {
157
157
  const U = [
158
158
  e,
@@ -161,61 +161,67 @@ function qr({
161
161
  protected: !0,
162
162
  isPrivate: !0,
163
163
  value: z,
164
- url: F(z, x, k)
164
+ url: C(z, m, w)
165
165
  },
166
166
  {
167
167
  label: f("storageManagement"),
168
168
  protected: !0,
169
169
  isPrivate: !0,
170
170
  value: W,
171
- url: F(W, x, k)
171
+ url: C(W, m, w)
172
172
  }
173
173
  ];
174
- p = w ? [...U, i] : U;
174
+ p = y ? [...U, i] : U;
175
175
  }
176
176
  return p;
177
- }, [o, x, w]), l = d(() => {
178
- const e = q?.navigation?.userCenter || [], i = Ye(e);
179
- return ($e({ navigation: e, locale: x, defaultLocale: k }) || []).concat(i ? [] : G).map((c) => {
180
- const te = c.value ?? c._rawLink ?? c.link ?? c.url;
177
+ }, [o, m, y]), l = c(() => {
178
+ const e = q?.navigation?.userCenter || [], i = Ze(e);
179
+ return (qe({ navigation: e, locale: m, defaultLocale: w }) || []).concat(i ? [] : G).map((d) => {
180
+ const te = d.value ?? d._rawLink ?? d.link ?? d.url;
181
181
  return {
182
182
  value: te,
183
- label: c.title || c.label,
184
- url: c.link || c.url,
183
+ label: d.title || d.label,
184
+ url: d.link || d.url,
185
185
  protected: g?.data?.[te] ?? !1,
186
- isPrivate: c.isPrivate || c.private || (c?._rawLink?.includes?.("/customer") ?? !1),
186
+ isPrivate: d.isPrivate || d.private || (C(d._rawLink, m, w)?.includes?.("/customer") ?? !1),
187
187
  // FIXME: HACK: 隐藏 /customer 菜单, 需要一个通用的解决方案,在嵌入的时候就决定是否是私有的
188
- followersOnly: c.component === "did-comments"
188
+ followersOnly: d.component === "did-comments"
189
189
  // 是否开启仅粉丝可查看的功能,目前只对 discuss kit 开启
190
190
  // icon: x.icon,
191
191
  };
192
- }).filter((c) => o || !c.isPrivate);
193
- }, [q, n.data, g?.data, x, G, o]), s = d(() => l.find((e) => le(e.value) === le(v)), [l]), Q = d(() => {
192
+ }).filter((d) => o || !d.isPrivate);
193
+ }, [q, n.data, g?.data, m, G, o]), s = c(() => l.find((e) => {
194
+ try {
195
+ return le(ae(C(e.value, m, w))).pathname === le(ae(v)).pathname;
196
+ } catch {
197
+ return !1;
198
+ }
199
+ }), [l]), Q = c(() => {
194
200
  const e = window.blocklet?.appName, p = [s?.label, f("userCenter.title")].filter(Boolean).join("-");
195
201
  return e ? `${p} | ${e}` : p;
196
- }, [s, f]), be = P((e) => e && (ie(e) ? oe(e, {
202
+ }, [s, f]), ve = S((e) => e && (ie(e) ? oe(e, {
197
203
  ...e.props || {},
198
204
  userCenterTabs: l
199
- }) : Se.map(e, (i) => ie(i) ? oe(i, {
205
+ }) : Me.map(e, (i) => ie(i) ? oe(i, {
200
206
  ...i.props || {},
201
207
  userCenterTabs: l
202
- }) : i))), ve = P((e) => {
208
+ }) : i))), we = S((e) => {
203
209
  const i = l.find((p) => p.value === e);
204
- i && (window.location.href = ae(i.url, {
205
- did: o ? void 0 : h
210
+ i && (window.location.href = ue(i.url, {
211
+ did: o ? void 0 : x
206
212
  }));
207
- }), K = d(() => /* @__PURE__ */ r(
208
- Ge,
213
+ }), K = c(() => /* @__PURE__ */ r(
214
+ Qe,
209
215
  {
210
216
  user: n.data,
211
217
  settings: { userCenterTabs: l },
212
218
  onSave: async (e) => e === "privacy" ? (await g.runAsync(), g.data) : (e === "profile" && await t.refresh(), null),
213
219
  isMobile: u,
214
- onDestroySelf: ge
220
+ onDestroySelf: be
215
221
  }
216
- ), [n.data, l, g.data, g.runAsync]), V = d(() => s && s?.value === z, [s]), J = d(() => s && s?.value === S(M, "/profile") || s?.value === T, [s]), we = d(() => s && s?.value === W, [s]), ye = t.useOAuth(), Ce = t.usePasskey(), X = P(() => {
217
- t?.user?.sourceProvider === "passkey" ? Ce.switchPassport(t.user) : ["google", "apple", "email", "github"].includes(t?.user?.sourceProvider ?? "") ? ye.switchOAuthPassport(t.user) : t && t.switchPassport();
218
- }), L = d(() => J ? /* @__PURE__ */ m(
222
+ ), [n.data, l, g.data, g.runAsync]), V = c(() => s && s?.value === z, [s]), J = c(() => s && s?.value === M(D, "/profile") || s?.value === T, [s]), ye = c(() => s && s?.value === W, [s]), Ce = t.useOAuth(), ke = t.usePasskey(), X = S(() => {
223
+ t?.user?.sourceProvider === "passkey" ? ke.switchPassport(t.user) : ["google", "apple", "email", "github"].includes(t?.user?.sourceProvider ?? "") ? Ce.switchOAuthPassport(t.user) : t && t.switchPassport();
224
+ }), L = c(() => J ? /* @__PURE__ */ h(
219
225
  a,
220
226
  {
221
227
  sx: {
@@ -224,7 +230,7 @@ function qr({
224
230
  gap: 2.5
225
231
  },
226
232
  children: [
227
- o ? /* @__PURE__ */ m(a, { sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, p: 2 }, children: [
233
+ o ? /* @__PURE__ */ h(a, { sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, p: 2 }, children: [
228
234
  /* @__PURE__ */ r(
229
235
  B,
230
236
  {
@@ -236,12 +242,12 @@ function qr({
236
242
  children: f("passport")
237
243
  }
238
244
  ),
239
- /* @__PURE__ */ r(qe, { user: n.data })
245
+ /* @__PURE__ */ r(Ge, { user: n.data })
240
246
  ] }) : null,
241
- /* @__PURE__ */ r(Je, { user: n.data })
247
+ /* @__PURE__ */ r(Xe, { user: n.data })
242
248
  ]
243
249
  }
244
- ) : V && o ? K : we && o ? /* @__PURE__ */ r(Ke, { children: /* @__PURE__ */ r(Ve, {}) }) : null, [V, J, n, o, _, K]), Y = d(() => /* @__PURE__ */ r(
250
+ ) : V && o ? K : ye && o ? /* @__PURE__ */ r(Ve, { children: /* @__PURE__ */ r(Je, {}) }) : null, [V, J, n, o, R, K]), Y = c(() => /* @__PURE__ */ r(
245
251
  a,
246
252
  {
247
253
  sx: {
@@ -253,7 +259,7 @@ function qr({
253
259
  },
254
260
  children: /* @__PURE__ */ r(I, { children: f("emptyContent") })
255
261
  }
256
- ), [o, x]), Z = d(() => !g.data || g.loading ? /* @__PURE__ */ r(
262
+ ), [o, m]), Z = c(() => !g.data || g.loading ? /* @__PURE__ */ r(
257
263
  a,
258
264
  {
259
265
  sx: {
@@ -265,28 +271,28 @@ function qr({
265
271
  alignItems: "center",
266
272
  flex: 1
267
273
  },
268
- children: /* @__PURE__ */ r(Me, {})
274
+ children: /* @__PURE__ */ r(De, {})
269
275
  }
270
276
  ) : /* @__PURE__ */ r(a, { sx: { flex: 1 }, children: /* @__PURE__ */ r(
271
- Xe,
277
+ Ye,
272
278
  {
273
- isSupportFollow: w,
279
+ isSupportFollow: y,
274
280
  currentActiveTab: s,
275
281
  isMyself: o,
276
- children: b ? /* @__PURE__ */ r(a, { ...H, children: be(b) }) : L
282
+ children: b ? /* @__PURE__ */ r(a, { ...H, children: ve(b) }) : L
277
283
  }
278
- ) }), [g, s, o, b, H, L, x]), ee = d(() => {
284
+ ) }), [g, s, o, b, H, L, m]), ee = c(() => {
279
285
  if (n.loading || t.loading)
280
286
  return null;
281
287
  if (n.error) {
282
288
  if (n.error?.response?.status === 404)
283
- return /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ae, { status: 404, description: f("noUserFound") }) });
289
+ return /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Le, { status: 404, description: f("noUserFound") }) });
284
290
  const p = {
285
291
  message: n.error.response?.data?.error || n.error.message || "error occurred"
286
292
  };
287
- return /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ie, { error: p }) });
293
+ return /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ne, { error: p }) });
288
294
  }
289
- return !h && !n.data ? y || /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ m(
295
+ return !x && !n.data ? k || /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ h(
290
296
  a,
291
297
  {
292
298
  sx: {
@@ -298,13 +304,13 @@ function qr({
298
304
  },
299
305
  children: [
300
306
  /* @__PURE__ */ r(I, { children: f("viewAfterLogin") }),
301
- /* @__PURE__ */ r(We, { size: "small", variant: "contained", onClick: () => t.login(), children: f("loginNow") })
307
+ /* @__PURE__ */ r(Ae, { size: "small", variant: "contained", onClick: () => t.login(), children: f("loginNow") })
302
308
  ]
303
309
  }
304
- ) }) : h && !n.data && !n.loading ? /* @__PURE__ */ r(I, { style: { width: "100%", paddingTop: 16 }, children: /* @__PURE__ */ m(a, { sx: { textAlign: "center", width: "100%" }, children: [
310
+ ) }) : x && !n.data && !n.loading ? /* @__PURE__ */ r(I, { style: { width: "100%", paddingTop: 16 }, children: /* @__PURE__ */ h(a, { sx: { textAlign: "center", width: "100%" }, children: [
305
311
  /* @__PURE__ */ r(B, { variant: "body1", sx: { fontSize: 18, fontWeight: 500 }, children: f("userNotFound") }),
306
312
  /* @__PURE__ */ r(B, { variant: "body1", color: "text.secondary", children: f("userNotFoundDescription") })
307
- ] }) }) : D ? /* @__PURE__ */ m(N, { children: [
313
+ ] }) }) : F ? /* @__PURE__ */ h(N, { children: [
308
314
  l.length > 0 && v ? /* @__PURE__ */ r(
309
315
  a,
310
316
  {
@@ -318,7 +324,7 @@ function qr({
318
324
  }
319
325
  ) : null,
320
326
  l.length === 0 && Y
321
- ] }) : C ? /* @__PURE__ */ r(N, { display: "flex", flexDirection: u ? "column" : "row", children: /* @__PURE__ */ r(
327
+ ] }) : P ? /* @__PURE__ */ r(N, { display: "flex", flexDirection: u ? "column" : "row", children: /* @__PURE__ */ r(
322
328
  de,
323
329
  {
324
330
  isMobile: u,
@@ -328,17 +334,17 @@ function qr({
328
334
  switchProfile: t.switchProfile,
329
335
  user: n.data,
330
336
  showFullDid: !1,
331
- onlyProfile: C,
332
- refreshProfile: R,
333
- isShowSocialActions: w,
337
+ onlyProfile: P,
338
+ refreshProfile: O,
339
+ isShowSocialActions: y,
334
340
  sx: {
335
341
  padding: u ? "16px 0 0 0" : "40px 24px 24px 40px",
336
342
  ...u ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
337
343
  boxSizing: "content-box"
338
344
  }
339
345
  }
340
- ) }) : /* @__PURE__ */ m(N, { display: "flex", flexDirection: u ? "column" : "row", children: [
341
- /* @__PURE__ */ m(
346
+ ) }) : /* @__PURE__ */ h(N, { display: "flex", flexDirection: u ? "column" : "row", children: [
347
+ /* @__PURE__ */ h(
342
348
  a,
343
349
  {
344
350
  className: "user-center-tabs",
@@ -348,7 +354,7 @@ function qr({
348
354
  width: u ? "unset" : "calc(100% - 424px)"
349
355
  },
350
356
  children: [
351
- l.length > 0 && v ? /* @__PURE__ */ m(
357
+ l.length > 0 && v ? /* @__PURE__ */ h(
352
358
  a,
353
359
  {
354
360
  sx: {
@@ -360,13 +366,13 @@ function qr({
360
366
  },
361
367
  children: [
362
368
  /* @__PURE__ */ r(
363
- ze,
369
+ We,
364
370
  {
365
371
  orientation: "horizontal",
366
372
  variant: "line",
367
373
  tabs: l,
368
374
  current: s?.value ?? v,
369
- onChange: ve,
375
+ onChange: we,
370
376
  enableTabClick: !0,
371
377
  sx: {
372
378
  mb: (e) => `${e.spacing(3)} !important`,
@@ -411,7 +417,7 @@ function qr({
411
417
  ]
412
418
  }
413
419
  ),
414
- !u && /* @__PURE__ */ r(De, { orientation: "vertical", sx: { ml: 5 } }),
420
+ !u && /* @__PURE__ */ r(Fe, { orientation: "vertical", sx: { ml: 5 } }),
415
421
  /* @__PURE__ */ r(
416
422
  de,
417
423
  {
@@ -421,9 +427,9 @@ function qr({
421
427
  switchPassport: X,
422
428
  switchProfile: t.switchProfile,
423
429
  user: n.data,
424
- refreshProfile: R,
430
+ refreshProfile: O,
425
431
  showFullDid: !1,
426
- isShowSocialActions: w,
432
+ isShowSocialActions: y,
427
433
  sx: {
428
434
  padding: u ? "16px 0 0 0" : "40px 24px 24px 40px",
429
435
  ...u ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
@@ -439,34 +445,34 @@ function qr({
439
445
  s,
440
446
  g,
441
447
  v,
442
- _,
448
+ R,
443
449
  L
444
- ]), re = d(() => o ? !1 : s?.isPrivate, [o, s]);
445
- if (d(() => C || D || !l.length || !t.user ? !1 : !E && !v && l?.length > 0 || !s || re, [
450
+ ]), re = c(() => o ? !1 : s?.isPrivate, [o, s]);
451
+ if (c(() => P || F || !l.length || !t.user ? !1 : !E && !v && l?.length > 0 || !s || re, [
446
452
  E,
447
453
  v,
448
454
  l,
449
455
  s,
450
456
  re,
451
- C,
457
+ P,
452
458
  t.user,
453
- D
459
+ F
454
460
  ])) {
455
461
  const e = l[0]?.url, i = l.find((p) => p.value === e);
456
462
  return e && !i?.isPrivate && window.location.replace(
457
- ae(e, {
458
- did: o ? void 0 : h
463
+ ue(e, {
464
+ did: o ? void 0 : x
459
465
  })
460
466
  ), null;
461
467
  }
462
- return D || C ? /* @__PURE__ */ m(a, { children: [
468
+ return F || P ? /* @__PURE__ */ h(a, { children: [
463
469
  /* @__PURE__ */ r(se, { children: /* @__PURE__ */ r("title", { children: Q }) }),
464
- /* @__PURE__ */ r(ue, { style: { display: "none" } }),
465
- /* @__PURE__ */ m(fe, { children: [
466
- /* @__PURE__ */ r(ce, { isMySelf: o, userDid: n.data?.did ?? "", children: ee }),
470
+ /* @__PURE__ */ r(ce, { style: { display: "none" } }),
471
+ /* @__PURE__ */ h(pe, { children: [
472
+ /* @__PURE__ */ r(fe, { isMySelf: o, userDid: n.data?.did ?? "", children: ee }),
467
473
  $
468
474
  ] })
469
- ] }) : /* @__PURE__ */ m(
475
+ ] }) : /* @__PURE__ */ h(
470
476
  a,
471
477
  {
472
478
  sx: {
@@ -476,16 +482,16 @@ function qr({
476
482
  },
477
483
  children: [
478
484
  /* @__PURE__ */ r(se, { children: /* @__PURE__ */ r("title", { children: Q }) }),
479
- /* @__PURE__ */ r(ue, { bordered: !0, ...he, maxWidth: "100%" }),
480
- /* @__PURE__ */ m(fe, { children: [
481
- /* @__PURE__ */ r(ce, { isMySelf: o, userDid: n.data?.did ?? "", children: ee }),
485
+ /* @__PURE__ */ r(ce, { bordered: !0, ...xe, maxWidth: "100%" }),
486
+ /* @__PURE__ */ h(pe, { children: [
487
+ /* @__PURE__ */ r(fe, { isMySelf: o, userDid: n.data?.did ?? "", children: ee }),
482
488
  $
483
489
  ] }),
484
- me ? null : /* @__PURE__ */ r(
490
+ he ? null : /* @__PURE__ */ r(
485
491
  _e,
486
492
  {
487
493
  bordered: !0,
488
- ...xe,
494
+ ...ge,
489
495
  sx: {
490
496
  ".MuiContainer-root": {
491
497
  maxWidth: 1600
@@ -498,5 +504,5 @@ function qr({
498
504
  );
499
505
  }
500
506
  export {
501
- qr as default
507
+ Gr as default
502
508
  };
@@ -1,3 +1,24 @@
1
- export function create(endpoint?: string): any;
1
+ export function create(endpoint?: string): {
2
+ _logger: ReturnType<(subModule: string, silent?: boolean) => import('@arcblock/ws/esm/logger.mjs').Logger>;
3
+ emitter: import('@arcblock/ws/esm/client/base.mjs').EventEmitterInstance;
4
+ on(event: string, handler: (data: unknown) => void, params?: object): void;
5
+ off(event: string, handler?: (data: unknown) => void): void;
6
+ disconnect(callback?: () => void, code?: number, reason?: string): void;
7
+ ensureJoinChannel(topic: string, params?: object): void;
8
+ ensureLeaveChannel(topic: string): void;
9
+ subscribe(topic: string, params?: object): import('@arcblock/ws/esm/client/base.mjs').Channel;
10
+ unsubscribe(topic: string): void;
11
+ channels: import('@arcblock/ws/esm/client/base.mjs').Channel[];
12
+ connect(): void;
13
+ isConnected(): boolean;
14
+ onOpen(cb: () => void): void;
15
+ onClose(cb: () => void): void;
16
+ onError(cb: (err: {
17
+ error: Error;
18
+ }) => void): void;
19
+ onMessage(cb: (message: unknown) => void): void;
20
+ channel(topic: string, params?: object | (() => object)): import('@arcblock/ws/esm/client/base.mjs').Channel;
21
+ remove(channel: import('@arcblock/ws/esm/client/base.mjs').Channel): void;
22
+ };
2
23
  export default function getWsClient(endpoint?: string): any;
3
24
  export function useListenWsClient(endpoint?: string): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "3.4.13",
3
+ "version": "3.4.15",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -36,10 +36,10 @@
36
36
  "dependencies": {
37
37
  "@abtnode/constant": "^1.17.7",
38
38
  "@abtnode/util": "^1.17.7",
39
- "@arcblock/bridge": "3.4.13",
40
- "@arcblock/icons": "3.4.13",
41
- "@arcblock/react-hooks": "3.4.13",
42
- "@arcblock/ws": "^1.28.8",
39
+ "@arcblock/bridge": "3.4.15",
40
+ "@arcblock/icons": "3.4.15",
41
+ "@arcblock/react-hooks": "3.4.15",
42
+ "@arcblock/ws": "^1.29.4",
43
43
  "@blocklet/did-space-react": "^1.2.15",
44
44
  "@blocklet/uploader": "^0.3.19",
45
45
  "@iconify-icons/logos": "^1.2.36",
@@ -84,7 +84,7 @@
84
84
  "access": "public"
85
85
  },
86
86
  "devDependencies": {
87
- "@arcblock/did-connect-react": "3.4.13",
87
+ "@arcblock/did-connect-react": "3.4.15",
88
88
  "@babel/preset-env": "^7.28.0",
89
89
  "@babel/preset-react": "^7.27.1",
90
90
  "@babel/preset-typescript": "^7.27.1",
@@ -98,5 +98,5 @@
98
98
  "typescript": "~5.5.4",
99
99
  "unbuild": "^2.0.0"
100
100
  },
101
- "gitHead": "0ec0dab9e461171384dbed3e114b805771eb1d88"
101
+ "gitHead": "73039d82d507d9ec5408d8cfc67d9efeffae3e74"
102
102
  }
@@ -16,7 +16,7 @@ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
16
16
  import { ErrorFallback } from '@arcblock/ux/lib/ErrorBoundary';
17
17
  import { styled } from '@arcblock/ux/lib/Theme';
18
18
  import cloneDeep from 'lodash/cloneDeep';
19
- import { getQuery, withQuery, joinURL, withoutTrailingSlash } from 'ufo';
19
+ import { getQuery, withQuery, joinURL, withoutTrailingSlash, parseURL } from 'ufo';
20
20
  import type { AxiosError } from 'axios';
21
21
  import { getBlockletSDK, type UserPublicInfo } from '@blocklet/js-sdk';
22
22
  import { isSupportFollow } from '@arcblock/ux/lib/Util';
@@ -279,7 +279,8 @@ export default function UserCenter({
279
279
  label: x.title || x.label,
280
280
  url: x.link || x.url,
281
281
  protected: privacyState?.data?.[value] ?? false,
282
- isPrivate: x.isPrivate || x.private || (x?._rawLink?.includes?.('/customer') ?? false), // FIXME: HACK: 隐藏 /customer 菜单, 需要一个通用的解决方案,在嵌入的时候就决定是否是私有的
282
+ isPrivate:
283
+ x.isPrivate || x.private || (getLink(x._rawLink, locale, defaultLocale)?.includes?.('/customer') ?? false), // FIXME: HACK: 隐藏 /customer 菜单, 需要一个通用的解决方案,在嵌入的时候就决定是否是私有的
283
284
  followersOnly: x.component === 'did-comments', // 是否开启仅粉丝可查看的功能,目前只对 discuss kit 开启
284
285
  // icon: x.icon,
285
286
  };
@@ -288,7 +289,16 @@ export default function UserCenter({
288
289
  }, [formattedBlocklet, userState.data, privacyState?.data, locale, defaultTabs, isMyself]);
289
290
 
290
291
  const currentActiveTab = useCreation(() => {
291
- return userCenterTabs.find((x) => withoutTrailingSlash(x.value) === withoutTrailingSlash(currentTab));
292
+ return userCenterTabs.find((x) => {
293
+ try {
294
+ return (
295
+ parseURL(withoutTrailingSlash(getLink(x.value, locale, defaultLocale))).pathname ===
296
+ parseURL(withoutTrailingSlash(currentTab)).pathname
297
+ );
298
+ } catch {
299
+ return false;
300
+ }
301
+ });
292
302
  }, [userCenterTabs]);
293
303
 
294
304
  const htmlTitle = useCreation(() => {