@blocklet/ui-react 3.1.59 → 3.1.60

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.
@@ -84,26 +84,26 @@ function Or({
84
84
  // 只显示 profile 页面,用于 ArcSphere 只需要显示 Profile 的内容
85
85
  onDestroySelf: xe = void 0
86
86
  }) {
87
- const { locale: h, defaultLocale: k } = Ue(), a = qe({ key: "md" }), f = C((e, t = {}) => Le(Ee, e, h, "en", t)), o = ke(Fe)?.session, x = u(() => {
87
+ const { locale: x, defaultLocale: k } = Ue(), a = qe({ key: "md" }), f = C((e, t = {}) => Le(Ee, e, x, "en", t)), o = ke(Fe)?.session, h = u(() => {
88
88
  if (D)
89
89
  return D;
90
90
  const e = window.location.href, t = Ne(e);
91
91
  return t?.did ? Array.isArray(t.did) ? t.did[0] : t.did : o?.user?.did;
92
- }, [o?.user?.did, D]), i = u(() => o?.user ? x === o?.user?.did : !1, [x, o?.user?.did]), w = Ce(() => je(), []), n = te(
92
+ }, [o?.user?.did, D]), i = u(() => o?.user ? h === o?.user?.did : !1, [h, o?.user?.did]), w = Ce(() => je(), []), n = te(
93
93
  // eslint-disable-next-line consistent-return
94
94
  async () => {
95
95
  if (await De(() => o?.initialized), i)
96
96
  return o.user;
97
- if (x)
98
- return ae.user.getUserPublicInfo({ did: x });
97
+ if (h)
98
+ return ae.user.getUserPublicInfo({ did: h });
99
99
  },
100
100
  {
101
- refreshDeps: [x, i, o?.initialized, o?.user]
101
+ refreshDeps: [h, i, o?.initialized, o?.user]
102
102
  }
103
103
  ), E = C(() => i ? o.refresh() : n.refresh()), g = te(
104
- async () => n.data && b ? await ae.user.getUserPrivacyConfig({ did: x }) : null,
104
+ async () => n.data && b ? await ae.user.getUserPrivacyConfig({ did: h }) : null,
105
105
  {
106
- refreshDeps: [x, n.data, b],
106
+ refreshDeps: [h, n.data, b],
107
107
  loadingDelay: 300
108
108
  }
109
109
  ), { confirmHolder: _ } = Ae({
@@ -140,13 +140,13 @@ function Or({
140
140
  isPrivate: !1,
141
141
  // true: 隐私数据,仅自己可见
142
142
  value: W,
143
- url: M(W, h, k)
143
+ url: M(W, x, k)
144
144
  }, t = {
145
145
  label: f("userFollowers"),
146
146
  protected: !1,
147
147
  isPrivate: !1,
148
148
  value: ce,
149
- url: M(ce, h, k)
149
+ url: M(ce, x, k)
150
150
  };
151
151
  let p = w ? [e, t] : [e];
152
152
  if (i) {
@@ -157,22 +157,22 @@ function Or({
157
157
  protected: !0,
158
158
  isPrivate: !0,
159
159
  value: A,
160
- url: M(A, h, k)
160
+ url: M(A, x, k)
161
161
  },
162
162
  {
163
163
  label: f("storageManagement"),
164
164
  protected: !0,
165
165
  isPrivate: !0,
166
166
  value: L,
167
- url: M(L, h, k)
167
+ url: M(L, x, k)
168
168
  }
169
169
  ];
170
170
  p = w ? [...c, t] : c;
171
171
  }
172
172
  return p;
173
- }, [i, h, w]), d = u(() => {
173
+ }, [i, x, w]), d = u(() => {
174
174
  const e = O?.navigation?.userCenter || [];
175
- return (Oe({ navigation: e, locale: h, defaultLocale: k }) || []).concat(R).map((c) => {
175
+ return (Oe({ navigation: e, locale: x, defaultLocale: k }) || []).concat(R).map((c) => {
176
176
  const Z = c.value ?? c._rawLink ?? c.link ?? c.url;
177
177
  return {
178
178
  value: Z,
@@ -186,7 +186,7 @@ function Or({
186
186
  // icon: x.icon,
187
187
  };
188
188
  }).filter((c) => i || !c.isPrivate);
189
- }, [O, n.data, g?.data, h, R, i]), s = u(() => d.find((e) => oe(e.value) === oe(b)), [d]), $ = u(() => {
189
+ }, [O, n.data, g?.data, x, R, i]), s = u(() => d.find((e) => oe(e.value) === oe(b)), [d]), $ = u(() => {
190
190
  const e = window.blocklet?.appName, p = [s?.label, f("userCenter.title")].filter(Boolean).join("-");
191
191
  return e ? `${p} | ${e}` : p;
192
192
  }, [s, f]), ge = C((e) => e && (ee(e) ? re(e, {
@@ -198,7 +198,7 @@ function Or({
198
198
  }) : t))), be = C((e) => {
199
199
  const t = d.find((p) => p.value === e);
200
200
  t && (window.location.href = ne(t.url, {
201
- did: i ? void 0 : x
201
+ did: i ? void 0 : h
202
202
  }));
203
203
  }), q = u(() => /* @__PURE__ */ r(
204
204
  $e,
@@ -249,7 +249,7 @@ function Or({
249
249
  },
250
250
  children: /* @__PURE__ */ r(z, { children: f("emptyContent") })
251
251
  }
252
- ), [i, h]), K = u(() => !g.data || g.loading ? /* @__PURE__ */ r(
252
+ ), [i, x]), K = u(() => !g.data || g.loading ? /* @__PURE__ */ r(
253
253
  l,
254
254
  {
255
255
  sx: {
@@ -271,14 +271,9 @@ function Or({
271
271
  isMyself: i,
272
272
  children: v ? /* @__PURE__ */ r(l, { ...I, children: ge(v) }) : F
273
273
  }
274
- ) }), [g, s, i, v, I, F, h]), X = u(() => {
274
+ ) }), [g, s, i, v, I, F, x]), X = u(() => {
275
275
  if (n.loading || o.loading)
276
276
  return null;
277
- if (!n.data && !n.loading)
278
- return /* @__PURE__ */ r(z, { style: { width: "100%", paddingTop: 16 }, children: /* @__PURE__ */ m(l, { sx: { textAlign: "center", width: "100%" }, children: [
279
- /* @__PURE__ */ r(T, { variant: "body1", sx: { fontSize: 18, fontWeight: 500 }, children: f("userNotFound") }),
280
- /* @__PURE__ */ r(T, { variant: "body1", color: "text.secondary", children: f("userNotFoundDescription") })
281
- ] }) });
282
277
  if (n.error) {
283
278
  if (n.error?.response?.status === 404)
284
279
  return /* @__PURE__ */ r(l, { sx: { width: "100%" }, children: /* @__PURE__ */ r(We, { status: 404, description: f("noUserFound") }) });
@@ -287,7 +282,7 @@ function Or({
287
282
  };
288
283
  return /* @__PURE__ */ r(l, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Be, { error: p }) });
289
284
  }
290
- return !x && !n.data ? B || /* @__PURE__ */ r(l, { sx: { width: "100%" }, children: /* @__PURE__ */ m(
285
+ return !h && !n.data ? B || /* @__PURE__ */ r(l, { sx: { width: "100%" }, children: /* @__PURE__ */ m(
291
286
  l,
292
287
  {
293
288
  sx: {
@@ -302,7 +297,10 @@ function Or({
302
297
  /* @__PURE__ */ r(ze, { size: "small", variant: "contained", onClick: () => o.login(), children: f("loginNow") })
303
298
  ]
304
299
  }
305
- ) }) : H ? /* @__PURE__ */ m(U, { children: [
300
+ ) }) : h && !n.data && !n.loading ? /* @__PURE__ */ r(z, { style: { width: "100%", paddingTop: 16 }, children: /* @__PURE__ */ m(l, { sx: { textAlign: "center", width: "100%" }, children: [
301
+ /* @__PURE__ */ r(T, { variant: "body1", sx: { fontSize: 18, fontWeight: 500 }, children: f("userNotFound") }),
302
+ /* @__PURE__ */ r(T, { variant: "body1", color: "text.secondary", children: f("userNotFoundDescription") })
303
+ ] }) }) : H ? /* @__PURE__ */ m(U, { children: [
306
304
  d.length > 0 && b ? /* @__PURE__ */ r(
307
305
  l,
308
306
  {
@@ -444,7 +442,7 @@ function Or({
444
442
  const e = d[0]?.url, t = d.find((p) => p.value === e);
445
443
  return e && !t?.isPrivate && window.location.replace(
446
444
  ne(e, {
447
- did: i ? void 0 : x
445
+ did: i ? void 0 : h
448
446
  })
449
447
  ), null;
450
448
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "3.1.59",
3
+ "version": "3.1.60",
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.0-beta-20251104-112713-e947b159",
37
37
  "@abtnode/util": "1.17.0-beta-20251104-112713-e947b159",
38
- "@arcblock/bridge": "3.1.59",
39
- "@arcblock/icons": "3.1.59",
40
- "@arcblock/react-hooks": "3.1.59",
38
+ "@arcblock/bridge": "3.1.60",
39
+ "@arcblock/icons": "3.1.60",
40
+ "@arcblock/react-hooks": "3.1.60",
41
41
  "@arcblock/ws": "^1.27.2",
42
42
  "@blocklet/constant": "1.17.0-beta-20251104-112713-e947b159",
43
43
  "@blocklet/did-space-react": "^1.2.0",
@@ -83,7 +83,7 @@
83
83
  "access": "public"
84
84
  },
85
85
  "devDependencies": {
86
- "@arcblock/did-connect-react": "3.1.59",
86
+ "@arcblock/did-connect-react": "3.1.60",
87
87
  "@types/dompurify": "^3.2.0",
88
88
  "@types/ua-parser-js": "^0.7.39",
89
89
  "@types/validator": "^13.15.2",
@@ -91,5 +91,5 @@
91
91
  "jest": "^29.7.0",
92
92
  "unbuild": "^2.0.0"
93
93
  },
94
- "gitHead": "40bce7b0f6ed43f138bdd0c0d73f365533e66c80"
94
+ "gitHead": "d1747930d04d6c0951c6c6c3fa73707787c425bd"
95
95
  }
@@ -462,21 +462,6 @@ export default function UserCenter({
462
462
  return null;
463
463
  }
464
464
 
465
- if (!userState.data && !userState.loading) {
466
- return (
467
- <Empty style={{ width: '100%', paddingTop: 16 }}>
468
- <Box sx={{ textAlign: 'center', width: '100%' }}>
469
- <Typography variant="body1" sx={{ fontSize: 18, fontWeight: 500 }}>
470
- {t('userNotFound')}
471
- </Typography>
472
- <Typography variant="body1" color="text.secondary">
473
- {t('userNotFoundDescription')}
474
- </Typography>
475
- </Box>
476
- </Empty>
477
- );
478
- }
479
-
480
465
  if (userState.error) {
481
466
  const errorStatus = (userState.error as AxiosError<{ error: string }>)?.response?.status;
482
467
  if (errorStatus === 404) {
@@ -525,6 +510,21 @@ export default function UserCenter({
525
510
  );
526
511
  }
527
512
 
513
+ if (currentDid && !userState.data && !userState.loading) {
514
+ return (
515
+ <Empty style={{ width: '100%', paddingTop: 16 }}>
516
+ <Box sx={{ textAlign: 'center', width: '100%' }}>
517
+ <Typography variant="body1" sx={{ fontSize: 18, fontWeight: 500 }}>
518
+ {t('userNotFound')}
519
+ </Typography>
520
+ <Typography variant="body1" color="text.secondary">
521
+ {t('userNotFoundDescription')}
522
+ </Typography>
523
+ </Box>
524
+ </Empty>
525
+ );
526
+ }
527
+
528
528
  // 嵌入时,只显示 tabContent
529
529
  if (embed) {
530
530
  return (