@blocklet/ui-react 3.3.4 → 3.3.6

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.
@@ -202,4 +202,5 @@ export type SessionManagerProps = {
202
202
  menuRender?: () => void;
203
203
  dark?: boolean;
204
204
  size?: number;
205
+ profileUrl?: string;
205
206
  };
@@ -1,12 +1,12 @@
1
1
  import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
2
  import { use as ke, useMemo as Pe, isValidElement as te, cloneElement as ie, Children as Se } from "react";
3
- import { Box as l, Typography as U, CircularProgress as Me, Divider as De } from "@mui/material";
4
- import { useMemoizedFn as P, useCreation as u, useRequest as oe } from "ahooks";
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 oe } from "ahooks";
5
5
  import Fe from "p-wait-for";
6
6
  import ne from "react-helmet";
7
7
  import { SessionContext as Te } from "@arcblock/did-connect-react/lib/Session";
8
8
  import ze from "@arcblock/ux/lib/Tabs";
9
- import B from "@arcblock/ux/lib/Empty";
9
+ import I from "@arcblock/ux/lib/Empty";
10
10
  import We from "@arcblock/ux/lib/Button";
11
11
  import Ae from "@arcblock/ux/lib/Result";
12
12
  import { useConfirm as Le } from "@arcblock/ux/lib/Dialog";
@@ -21,7 +21,7 @@ import { PROFILE_URL as M } from "@arcblock/ux/lib/Util/constant";
21
21
  import Ee from "../../Footer/index.js";
22
22
  import ae from "../../Header/index.js";
23
23
  import { translations as _e } from "../libs/locales.js";
24
- import de from "./user-info/user-basic-info.js";
24
+ import ue from "./user-info/user-basic-info.js";
25
25
  import "@mui/icons-material";
26
26
  import "@iconify/react";
27
27
  import "@arcblock/ux/lib/DID";
@@ -32,21 +32,21 @@ import "@iconify-icons/material-symbols/settings-input-antenna-rounded";
32
32
  import "@arcblock/ux/lib/RelativeTime";
33
33
  import "@arcblock/ux/lib/UserCard/Content/shorten-label";
34
34
  import "./user-info/switch-role.js";
35
- import { formatBlockletInfo as Oe, getLink as D, getLocalizedNavigation as Re } from "../../blocklets.js";
35
+ import { formatBlockletInfo as Oe, getLink as F, getLocalizedNavigation as Re } from "../../blocklets.js";
36
36
  import $e from "./passport.js";
37
37
  import qe from "./settings.js";
38
- import { client as ue } from "../../libs/client.js";
38
+ import { client as de } from "../../libs/client.js";
39
39
  import Ge from "../../hooks/use-mobile.js";
40
40
  import { ConfigUserSpaceProvider as Qe } from "../../contexts/config-user-space.js";
41
41
  import Ve from "./storage/index.js";
42
42
  import Je from "./nft.js";
43
43
  import { UserFollowersProvider as ce } from "../../contexts/user-followers.js";
44
44
  import Ke from "./fallback.js";
45
- const F = S(M, "/nfts"), T = S(M, "/settings"), z = S(M, "/did-spaces"), N = S(M, "/user-followers"), Xe = (b) => b.some(
45
+ const T = S(M, "/nfts"), z = S(M, "/settings"), W = S(M, "/did-spaces"), j = S(M, "/user-followers"), Xe = (b) => b.some(
46
46
  (y) => ["/userCenter/nfts", "/userCenter/user-followers", "/userCenter/settings", "/userCenter/did-spaces"].includes(
47
47
  y.id
48
- ) || [F, T, z, N].includes(y.link)
49
- ), fe = pe(l)(({ theme: b }) => ({
48
+ ) || [T, z, W, j].includes(y.link)
49
+ ), fe = pe(a)(({ theme: b }) => ({
50
50
  flex: 1,
51
51
  boxSizing: "border-box",
52
52
  padding: "0 16px",
@@ -60,7 +60,7 @@ const F = S(M, "/nfts"), T = S(M, "/settings"), z = S(M, "/did-spaces"), N = S(M
60
60
  [b.breakpoints.up("md")]: {
61
61
  flexDirection: "row"
62
62
  }
63
- })), I = pe(l)(({ theme: b }) => ({
63
+ })), N = pe(a)(({ theme: b }) => ({
64
64
  overflow: "hidden",
65
65
  flex: "revert",
66
66
  [b.breakpoints.up("md")]: {
@@ -76,42 +76,42 @@ function $r({
76
76
  children: b,
77
77
  notLoginContent: y = null,
78
78
  currentTab: v,
79
- contentProps: j = {},
80
- disableAutoRedirect: H = !1,
79
+ contentProps: H = {},
80
+ disableAutoRedirect: E = !1,
81
81
  hideFooter: me = !1,
82
82
  headerProps: he = {},
83
83
  footerProps: xe = {},
84
- userDid: W = void 0,
85
- stickySidebar: E = !1,
86
- embed: _ = !1,
84
+ userDid: A = void 0,
85
+ stickySidebar: _ = !1,
86
+ embed: D = !1,
87
87
  onlyProfile: C = !1,
88
88
  // 只显示 profile 页面,用于 ArcSphere 只需要显示 Profile 的内容
89
89
  onDestroySelf: ge = void 0
90
90
  }) {
91
- const { locale: x, defaultLocale: k } = Be(), a = Ge({ key: "md" }), f = P((e, t = {}) => Ue(_e, e, x, "en", t)), o = ke(Te)?.session, h = u(() => {
92
- if (W)
93
- return W;
94
- const e = window.location.href, t = je(e);
95
- return t?.did ? Array.isArray(t.did) ? t.did[0] : t.did : o?.user?.did;
96
- }, [o?.user?.did, W]), i = u(() => o?.user ? h === o?.user?.did : !1, [h, o?.user?.did]), w = Pe(() => He(), []), n = oe(
91
+ const { locale: x, defaultLocale: k } = Be(), u = Ge({ key: "md" }), f = P((e, i = {}) => Ue(_e, e, x, "en", i)), t = ke(Te)?.session, h = d(() => {
92
+ if (A)
93
+ return A;
94
+ const e = window.location.href, i = je(e);
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 && He(), [t?.user]), n = oe(
97
97
  // eslint-disable-next-line consistent-return
98
98
  async () => {
99
- if (await Fe(() => o?.initialized), i)
100
- return o.user;
99
+ if (await Fe(() => t?.initialized), o)
100
+ return t.user;
101
101
  if (h)
102
- return ue.user.getUserPublicInfo({ did: h });
102
+ return de.user.getUserPublicInfo({ did: h });
103
103
  },
104
104
  {
105
- refreshDeps: [h, i, o?.initialized, o?.user]
105
+ refreshDeps: [h, o, t?.initialized, t?.user]
106
106
  }
107
- ), O = P(() => i ? o.refresh() : n.refresh()), g = oe(
108
- async () => n.data && v ? await ue.user.getUserPrivacyConfig({ did: h }) : null,
107
+ ), O = P(() => o ? t.refresh() : n.refresh()), g = oe(
108
+ async () => n.data && v ? await de.user.getUserPrivacyConfig({ did: h }) : null,
109
109
  {
110
110
  refreshDeps: [h, n.data, v],
111
111
  loadingDelay: 300
112
112
  }
113
113
  ), { confirmHolder: R } = Le({
114
- fullScreen: a,
114
+ fullScreen: u,
115
115
  sx: {
116
116
  ".MuiDialog-paper": {
117
117
  borderRadius: 1,
@@ -130,53 +130,53 @@ function $r({
130
130
  }
131
131
  }
132
132
  }
133
- }), $ = u(() => {
133
+ }), $ = d(() => {
134
134
  const e = Ne(window.blocklet);
135
135
  try {
136
136
  return Oe(e);
137
- } catch (t) {
138
- return console.error("Failed to format blocklet info", t, e), e;
137
+ } catch (i) {
138
+ return console.error("Failed to format blocklet info", i, e), e;
139
139
  }
140
- }, []), q = u(() => {
140
+ }, []), q = d(() => {
141
141
  const e = {
142
142
  label: f("common.nft"),
143
143
  protected: !1,
144
144
  isPrivate: !1,
145
145
  // true: 隐私数据,仅自己可见
146
- value: F,
147
- url: D(F, x, k)
148
- }, t = {
146
+ value: T,
147
+ url: F(T, x, k)
148
+ }, i = {
149
149
  label: f("userFollowers"),
150
150
  protected: !1,
151
151
  isPrivate: !1,
152
- value: N,
153
- url: D(N, x, k)
152
+ value: j,
153
+ url: F(j, x, k)
154
154
  };
155
- let p = w ? [e, t] : [e];
156
- if (i) {
157
- const L = [
155
+ let p = w ? [e, i] : [e];
156
+ if (o) {
157
+ const U = [
158
158
  e,
159
159
  {
160
160
  label: f("common.setting"),
161
161
  protected: !0,
162
162
  isPrivate: !0,
163
- value: T,
164
- url: D(T, x, k)
163
+ value: z,
164
+ url: F(z, x, k)
165
165
  },
166
166
  {
167
167
  label: f("storageManagement"),
168
168
  protected: !0,
169
169
  isPrivate: !0,
170
- value: z,
171
- url: D(z, x, k)
170
+ value: W,
171
+ url: F(W, x, k)
172
172
  }
173
173
  ];
174
- p = w ? [...L, t] : L;
174
+ p = w ? [...U, i] : U;
175
175
  }
176
176
  return p;
177
- }, [i, x, w]), d = u(() => {
178
- const e = $?.navigation?.userCenter || [], t = Xe(e);
179
- return (Re({ navigation: e, locale: x, defaultLocale: k }) || []).concat(t ? [] : q).map((c) => {
177
+ }, [o, x, w]), l = d(() => {
178
+ const e = $?.navigation?.userCenter || [], i = Xe(e);
179
+ return (Re({ navigation: e, locale: x, defaultLocale: k }) || []).concat(i ? [] : q).map((c) => {
180
180
  const re = c.value ?? c._rawLink ?? c.link ?? c.url;
181
181
  return {
182
182
  value: re,
@@ -189,34 +189,34 @@ function $r({
189
189
  // 是否开启仅粉丝可查看的功能,目前只对 discuss kit 开启
190
190
  // icon: x.icon,
191
191
  };
192
- }).filter((c) => i || !c.isPrivate);
193
- }, [$, n.data, g?.data, x, q, i]), s = u(() => d.find((e) => se(e.value) === se(v)), [d]), G = u(() => {
192
+ }).filter((c) => o || !c.isPrivate);
193
+ }, [$, n.data, g?.data, x, q, o]), s = d(() => l.find((e) => se(e.value) === se(v)), [l]), G = d(() => {
194
194
  const e = window.blocklet?.appName, p = [s?.label, f("userCenter.title")].filter(Boolean).join("-");
195
195
  return e ? `${p} | ${e}` : p;
196
196
  }, [s, f]), be = P((e) => e && (te(e) ? ie(e, {
197
197
  ...e.props || {},
198
- userCenterTabs: d
199
- }) : Se.map(e, (t) => te(t) ? ie(t, {
200
- ...t.props || {},
201
- userCenterTabs: d
202
- }) : t))), ve = P((e) => {
203
- const t = d.find((p) => p.value === e);
204
- t && (window.location.href = le(t.url, {
205
- did: i ? void 0 : h
198
+ userCenterTabs: l
199
+ }) : Se.map(e, (i) => te(i) ? ie(i, {
200
+ ...i.props || {},
201
+ userCenterTabs: l
202
+ }) : i))), ve = P((e) => {
203
+ const i = l.find((p) => p.value === e);
204
+ i && (window.location.href = le(i.url, {
205
+ did: o ? void 0 : h
206
206
  }));
207
- }), Q = u(() => /* @__PURE__ */ r(
207
+ }), Q = d(() => /* @__PURE__ */ r(
208
208
  qe,
209
209
  {
210
210
  user: n.data,
211
- settings: { userCenterTabs: d },
212
- onSave: async (e) => e === "privacy" ? (await g.runAsync(), g.data) : (e === "profile" && await o.refresh(), null),
213
- isMobile: a,
211
+ settings: { userCenterTabs: l },
212
+ onSave: async (e) => e === "privacy" ? (await g.runAsync(), g.data) : (e === "profile" && await t.refresh(), null),
213
+ isMobile: u,
214
214
  onDestroySelf: ge
215
215
  }
216
- ), [n.data, d, g.data, g.runAsync]), V = u(() => s && s?.value === T, [s]), J = u(() => s && s?.value === S(M, "/profile") || s?.value === F, [s]), we = u(() => s && s?.value === z, [s]), ye = o.useOAuth(), Ce = o.usePasskey(), K = P(() => {
217
- o?.user?.sourceProvider === "passkey" ? Ce.switchPassport(o.user) : ["google", "apple", "email", "github"].includes(o?.user?.sourceProvider ?? "") ? ye.switchOAuthPassport(o.user) : o && o.switchPassport();
218
- }), A = u(() => J ? /* @__PURE__ */ m(
219
- l,
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(), K = 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(
219
+ a,
220
220
  {
221
221
  sx: {
222
222
  display: "flex",
@@ -224,9 +224,9 @@ function $r({
224
224
  gap: 2.5
225
225
  },
226
226
  children: [
227
- i ? /* @__PURE__ */ m(l, { sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, p: 2 }, children: [
227
+ o ? /* @__PURE__ */ m(a, { sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, p: 2 }, children: [
228
228
  /* @__PURE__ */ r(
229
- U,
229
+ B,
230
230
  {
231
231
  sx: {
232
232
  color: "text.primary",
@@ -241,20 +241,20 @@ function $r({
241
241
  /* @__PURE__ */ r(Je, { user: n.data })
242
242
  ]
243
243
  }
244
- ) : V && i ? Q : we && i ? /* @__PURE__ */ r(Qe, { children: /* @__PURE__ */ r(Ve, {}) }) : null, [V, J, n, i, E, Q]), X = u(() => /* @__PURE__ */ r(
245
- l,
244
+ ) : V && o ? Q : we && o ? /* @__PURE__ */ r(Qe, { children: /* @__PURE__ */ r(Ve, {}) }) : null, [V, J, n, o, _, Q]), X = d(() => /* @__PURE__ */ r(
245
+ a,
246
246
  {
247
247
  sx: {
248
248
  display: {
249
- xs: i ? "none" : "block",
249
+ xs: o ? "none" : "block",
250
250
  md: "block"
251
251
  },
252
252
  py: 3
253
253
  },
254
- children: /* @__PURE__ */ r(B, { children: f("emptyContent") })
254
+ children: /* @__PURE__ */ r(I, { children: f("emptyContent") })
255
255
  }
256
- ), [i, x]), Y = u(() => !g.data || g.loading ? /* @__PURE__ */ r(
257
- l,
256
+ ), [o, x]), Y = d(() => !g.data || g.loading ? /* @__PURE__ */ r(
257
+ a,
258
258
  {
259
259
  sx: {
260
260
  height: "100%",
@@ -267,27 +267,27 @@ function $r({
267
267
  },
268
268
  children: /* @__PURE__ */ r(Me, {})
269
269
  }
270
- ) : /* @__PURE__ */ r(l, { sx: { flex: 1 }, children: /* @__PURE__ */ r(
270
+ ) : /* @__PURE__ */ r(a, { sx: { flex: 1 }, children: /* @__PURE__ */ r(
271
271
  Ke,
272
272
  {
273
273
  isSupportFollow: w,
274
274
  currentActiveTab: s,
275
- isMyself: i,
276
- children: b ? /* @__PURE__ */ r(l, { ...j, children: be(b) }) : A
275
+ isMyself: o,
276
+ children: b ? /* @__PURE__ */ r(a, { ...H, children: be(b) }) : L
277
277
  }
278
- ) }), [g, s, i, b, j, A, x]), Z = u(() => {
279
- if (n.loading || o.loading)
278
+ ) }), [g, s, o, b, H, L, x]), Z = d(() => {
279
+ if (n.loading || t.loading)
280
280
  return null;
281
281
  if (n.error) {
282
282
  if (n.error?.response?.status === 404)
283
- return /* @__PURE__ */ r(l, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ae, { status: 404, description: f("noUserFound") }) });
283
+ return /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ae, { status: 404, description: f("noUserFound") }) });
284
284
  const p = {
285
285
  message: n.error.response?.data?.error || n.error.message || "error occurred"
286
286
  };
287
- return /* @__PURE__ */ r(l, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ie, { error: p }) });
287
+ return /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ie, { error: p }) });
288
288
  }
289
- return !h && !n.data ? y || /* @__PURE__ */ r(l, { sx: { width: "100%" }, children: /* @__PURE__ */ m(
290
- l,
289
+ return !h && !n.data ? y || /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ m(
290
+ a,
291
291
  {
292
292
  sx: {
293
293
  display: "flex",
@@ -297,19 +297,19 @@ function $r({
297
297
  gap: 1
298
298
  },
299
299
  children: [
300
- /* @__PURE__ */ r(B, { children: f("viewAfterLogin") }),
301
- /* @__PURE__ */ r(We, { size: "small", variant: "contained", onClick: () => o.login(), children: f("loginNow") })
300
+ /* @__PURE__ */ r(I, { children: f("viewAfterLogin") }),
301
+ /* @__PURE__ */ r(We, { size: "small", variant: "contained", onClick: () => t.login(), children: f("loginNow") })
302
302
  ]
303
303
  }
304
- ) }) : h && !n.data && !n.loading ? /* @__PURE__ */ r(B, { style: { width: "100%", paddingTop: 16 }, children: /* @__PURE__ */ m(l, { sx: { textAlign: "center", width: "100%" }, children: [
305
- /* @__PURE__ */ r(U, { variant: "body1", sx: { fontSize: 18, fontWeight: 500 }, children: f("userNotFound") }),
306
- /* @__PURE__ */ r(U, { variant: "body1", color: "text.secondary", children: f("userNotFoundDescription") })
307
- ] }) }) : _ ? /* @__PURE__ */ m(I, { children: [
308
- d.length > 0 && v ? /* @__PURE__ */ r(
309
- l,
304
+ ) }) : h && !n.data && !n.loading ? /* @__PURE__ */ r(I, { style: { width: "100%", paddingTop: 16 }, children: /* @__PURE__ */ m(a, { sx: { textAlign: "center", width: "100%" }, children: [
305
+ /* @__PURE__ */ r(B, { variant: "body1", sx: { fontSize: 18, fontWeight: 500 }, children: f("userNotFound") }),
306
+ /* @__PURE__ */ r(B, { variant: "body1", color: "text.secondary", children: f("userNotFoundDescription") })
307
+ ] }) }) : D ? /* @__PURE__ */ m(N, { children: [
308
+ l.length > 0 && v ? /* @__PURE__ */ r(
309
+ a,
310
310
  {
311
311
  sx: {
312
- display: a ? "block" : "flex",
312
+ display: u ? "block" : "flex",
313
313
  height: "100%",
314
314
  overflow: "auto",
315
315
  padding: "1px"
@@ -317,39 +317,39 @@ function $r({
317
317
  children: Y
318
318
  }
319
319
  ) : null,
320
- d.length === 0 && X
321
- ] }) : C ? /* @__PURE__ */ r(I, { display: "flex", flexDirection: a ? "column" : "row", children: /* @__PURE__ */ r(
322
- de,
320
+ l.length === 0 && X
321
+ ] }) : C ? /* @__PURE__ */ r(N, { display: "flex", flexDirection: u ? "column" : "row", children: /* @__PURE__ */ r(
322
+ ue,
323
323
  {
324
- isMobile: a,
325
- order: a ? 1 : "unset",
326
- isMyself: i,
324
+ isMobile: u,
325
+ order: u ? 1 : "unset",
326
+ isMyself: o,
327
327
  switchPassport: K,
328
- switchProfile: o.switchProfile,
328
+ switchProfile: t.switchProfile,
329
329
  user: n.data,
330
330
  showFullDid: !1,
331
331
  onlyProfile: C,
332
332
  refreshProfile: O,
333
333
  isShowSocialActions: w,
334
334
  sx: {
335
- padding: a ? "16px 0 0 0" : "40px 24px 24px 40px",
336
- ...a ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
335
+ padding: u ? "16px 0 0 0" : "40px 24px 24px 40px",
336
+ ...u ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
337
337
  boxSizing: "content-box"
338
338
  }
339
339
  }
340
- ) }) : /* @__PURE__ */ m(I, { display: "flex", flexDirection: a ? "column" : "row", children: [
340
+ ) }) : /* @__PURE__ */ m(N, { display: "flex", flexDirection: u ? "column" : "row", children: [
341
341
  /* @__PURE__ */ m(
342
- l,
342
+ a,
343
343
  {
344
344
  className: "user-center-tabs",
345
345
  sx: {
346
346
  flex: "1",
347
- order: a ? 2 : "unset",
348
- width: a ? "unset" : "calc(100% - 424px)"
347
+ order: u ? 2 : "unset",
348
+ width: u ? "unset" : "calc(100% - 424px)"
349
349
  },
350
350
  children: [
351
- d.length > 0 && v ? /* @__PURE__ */ m(
352
- l,
351
+ l.length > 0 && v ? /* @__PURE__ */ m(
352
+ a,
353
353
  {
354
354
  sx: {
355
355
  display: "flex",
@@ -364,7 +364,7 @@ function $r({
364
364
  {
365
365
  orientation: "horizontal",
366
366
  variant: "line",
367
- tabs: d,
367
+ tabs: l,
368
368
  current: s?.value ?? v,
369
369
  onChange: ve,
370
370
  enableTabClick: !0,
@@ -373,7 +373,7 @@ function $r({
373
373
  ".MuiTabs-flexContainer": {
374
374
  gap: 3,
375
375
  ".MuiButtonBase-root": {
376
- padding: a ? "16px 4px" : "32px 4px 16px 4px",
376
+ padding: u ? "16px 4px" : "32px 4px 16px 4px",
377
377
  fontSize: 16
378
378
  },
379
379
  ".MuiTab-root": {
@@ -407,26 +407,26 @@ function $r({
407
407
  ]
408
408
  }
409
409
  ) : null,
410
- d.length === 0 && X
410
+ l.length === 0 && X
411
411
  ]
412
412
  }
413
413
  ),
414
- !a && /* @__PURE__ */ r(De, { orientation: "vertical", sx: { ml: 5 } }),
414
+ !u && /* @__PURE__ */ r(De, { orientation: "vertical", sx: { ml: 5 } }),
415
415
  /* @__PURE__ */ r(
416
- de,
416
+ ue,
417
417
  {
418
- isMobile: a,
419
- order: a ? 1 : "unset",
420
- isMyself: i,
418
+ isMobile: u,
419
+ order: u ? 1 : "unset",
420
+ isMyself: o,
421
421
  switchPassport: K,
422
- switchProfile: o.switchProfile,
422
+ switchProfile: t.switchProfile,
423
423
  user: n.data,
424
424
  refreshProfile: O,
425
425
  showFullDid: !1,
426
426
  isShowSocialActions: w,
427
427
  sx: {
428
- padding: a ? "16px 0 0 0" : "40px 24px 24px 40px",
429
- ...a ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
428
+ padding: u ? "16px 0 0 0" : "40px 24px 24px 40px",
429
+ ...u ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
430
430
  boxSizing: "content-box"
431
431
  }
432
432
  }
@@ -434,31 +434,40 @@ function $r({
434
434
  ] });
435
435
  }, [
436
436
  n,
437
- d,
438
- i,
437
+ l,
438
+ o,
439
439
  s,
440
440
  g,
441
441
  v,
442
+ _,
443
+ L
444
+ ]), ee = d(() => o ? !1 : s?.isPrivate, [o, s]);
445
+ if (d(() => C || D || !l.length || !t.user ? !1 : !E && !v && l?.length > 0 || !s || ee, [
442
446
  E,
443
- A
444
- ]), ee = u(() => i ? !1 : s?.isPrivate, [i, s]);
445
- if (u(() => C ? !1 : !H && !v && d?.length > 0 || !s || ee, [H, v, d, s, ee, C])) {
446
- const e = d[0]?.url, t = d.find((p) => p.value === e);
447
- return e && !t?.isPrivate && window.location.replace(
447
+ v,
448
+ l,
449
+ s,
450
+ ee,
451
+ C,
452
+ t.user,
453
+ D
454
+ ])) {
455
+ const e = l[0]?.url, i = l.find((p) => p.value === e);
456
+ return e && !i?.isPrivate && window.location.replace(
448
457
  le(e, {
449
- did: i ? void 0 : h
458
+ did: o ? void 0 : h
450
459
  })
451
460
  ), null;
452
461
  }
453
- return _ || C ? /* @__PURE__ */ m(l, { children: [
462
+ return D || C ? /* @__PURE__ */ m(a, { children: [
454
463
  /* @__PURE__ */ r(ne, { children: /* @__PURE__ */ r("title", { children: G }) }),
455
464
  /* @__PURE__ */ r(ae, { style: { display: "none" } }),
456
465
  /* @__PURE__ */ m(fe, { children: [
457
- /* @__PURE__ */ r(ce, { isMySelf: i, userDid: n.data?.did ?? "", children: Z }),
466
+ /* @__PURE__ */ r(ce, { isMySelf: o, userDid: n.data?.did ?? "", children: Z }),
458
467
  R
459
468
  ] })
460
469
  ] }) : /* @__PURE__ */ m(
461
- l,
470
+ a,
462
471
  {
463
472
  sx: {
464
473
  minHeight: "100vh",
@@ -469,7 +478,7 @@ function $r({
469
478
  /* @__PURE__ */ r(ne, { children: /* @__PURE__ */ r("title", { children: G }) }),
470
479
  /* @__PURE__ */ r(ae, { bordered: !0, ...he, maxWidth: "100%" }),
471
480
  /* @__PURE__ */ m(fe, { children: [
472
- /* @__PURE__ */ r(ce, { isMySelf: i, userDid: n.data?.did ?? "", children: Z }),
481
+ /* @__PURE__ */ r(ce, { isMySelf: o, userDid: n.data?.did ?? "", children: Z }),
473
482
  R
474
483
  ] }),
475
484
  me ? null : /* @__PURE__ */ r(
package/lib/types.d.ts CHANGED
@@ -33,4 +33,5 @@ export const SessionManagerProps: PropTypes.Requireable<PropTypes.InferProps<{
33
33
  menuRender: PropTypes.Requireable<(...args: any[]) => any>;
34
34
  dark: PropTypes.Requireable<boolean>;
35
35
  size: PropTypes.Requireable<number>;
36
+ profileUrl: PropTypes.Requireable<string>;
36
37
  }>>;
package/lib/types.js CHANGED
@@ -35,7 +35,8 @@ const n = o.shape({
35
35
  menu: o.array,
36
36
  menuRender: o.func,
37
37
  dark: o.bool,
38
- size: o.number
38
+ size: o.number,
39
+ profileUrl: o.string
39
40
  });
40
41
  export {
41
42
  n as BlockletMetaProps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "3.3.4",
3
+ "version": "3.3.6",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -35,9 +35,9 @@
35
35
  "dependencies": {
36
36
  "@abtnode/constant": "^1.17.6",
37
37
  "@abtnode/util": "^1.17.6",
38
- "@arcblock/bridge": "3.3.4",
39
- "@arcblock/icons": "3.3.4",
40
- "@arcblock/react-hooks": "3.3.4",
38
+ "@arcblock/bridge": "3.3.6",
39
+ "@arcblock/icons": "3.3.6",
40
+ "@arcblock/react-hooks": "3.3.6",
41
41
  "@arcblock/ws": "^1.27.16",
42
42
  "@blocklet/did-space-react": "^1.2.11",
43
43
  "@iconify-icons/logos": "^1.2.36",
@@ -82,7 +82,7 @@
82
82
  "access": "public"
83
83
  },
84
84
  "devDependencies": {
85
- "@arcblock/did-connect-react": "3.3.4",
85
+ "@arcblock/did-connect-react": "3.3.6",
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": "529197d1b0de7d864446ac88452033fd7f541bd2"
99
+ "gitHead": "ee100e9010a13a124962ce7ef38c8378c6deca9b"
100
100
  }
@@ -226,4 +226,5 @@ export type SessionManagerProps = {
226
226
  menuRender?: () => void;
227
227
  dark?: boolean;
228
228
  size?: number;
229
+ profileUrl?: string;
229
230
  };
@@ -154,8 +154,8 @@ export default function UserCenter({
154
154
  }, [currentDid, session?.user?.did]);
155
155
 
156
156
  const isShowSocialActions = useMemo((): boolean => {
157
- return isSupportFollow();
158
- }, []);
157
+ return !!session?.user && isSupportFollow();
158
+ }, [session?.user]);
159
159
 
160
160
  const userState = useRequest<UserPublicInfo | User | undefined, []>(
161
161
  // eslint-disable-next-line consistent-return
@@ -684,7 +684,9 @@ export default function UserCenter({
684
684
  // 判断是否需要重定向到第一个可用的标签页
685
685
  const shouldRedirect = useCreation(() => {
686
686
  // 非 Profile 模式下才考虑重定向
687
- if (onlyProfile) {
687
+ // 非登录状态下不进行重定向
688
+ // 没有可用标签页时不进行重定向
689
+ if (onlyProfile || embed || !userCenterTabs.length || !session.user) {
688
690
  return false;
689
691
  }
690
692
 
@@ -697,7 +699,16 @@ export default function UserCenter({
697
699
  const accessingPrivateTab = isPrivateActive;
698
700
 
699
701
  return noActiveTabButHasTabs || invalidCurrentTab || accessingPrivateTab;
700
- }, [disableAutoRedirect, currentTab, userCenterTabs, currentActiveTab, isPrivateActive, onlyProfile]);
702
+ }, [
703
+ disableAutoRedirect,
704
+ currentTab,
705
+ userCenterTabs,
706
+ currentActiveTab,
707
+ isPrivateActive,
708
+ onlyProfile,
709
+ session.user,
710
+ embed,
711
+ ]);
701
712
 
702
713
  if (shouldRedirect) {
703
714
  // 获取第一个可用的标签页URL
package/src/types.js CHANGED
@@ -40,4 +40,5 @@ export const SessionManagerProps = PropTypes.shape({
40
40
  menuRender: PropTypes.func,
41
41
  dark: PropTypes.bool,
42
42
  size: PropTypes.number,
43
+ profileUrl: PropTypes.string,
43
44
  });