@blocklet/ui-react 3.1.48 → 3.1.49

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 (98) hide show
  1. package/.aigne/doc-smith/config.yaml +76 -0
  2. package/.aigne/doc-smith/history.yaml +9 -0
  3. package/.aigne/doc-smith/output/structure-plan.json +249 -0
  4. package/.aigne/doc-smith/upload-cache.yaml +528 -0
  5. package/docs/_sidebar.md +19 -0
  6. package/docs/components-component-management-blocklet-studio.ja.md +194 -0
  7. package/docs/components-component-management-blocklet-studio.md +194 -0
  8. package/docs/components-component-management-blocklet-studio.zh-TW.md +194 -0
  9. package/docs/components-component-management-blocklet-studio.zh.md +194 -0
  10. package/docs/components-component-management-component-installer.ja.md +256 -0
  11. package/docs/components-component-management-component-installer.md +256 -0
  12. package/docs/components-component-management-component-installer.zh-TW.md +256 -0
  13. package/docs/components-component-management-component-installer.zh.md +256 -0
  14. package/docs/components-component-management.ja.md +59 -0
  15. package/docs/components-component-management.md +59 -0
  16. package/docs/components-component-management.zh-TW.md +59 -0
  17. package/docs/components-component-management.zh.md +59 -0
  18. package/docs/components-layout-dashboard.ja.md +231 -0
  19. package/docs/components-layout-dashboard.md +231 -0
  20. package/docs/components-layout-dashboard.zh-TW.md +231 -0
  21. package/docs/components-layout-dashboard.zh.md +231 -0
  22. package/docs/components-layout-footer.ja.md +165 -0
  23. package/docs/components-layout-footer.md +165 -0
  24. package/docs/components-layout-footer.zh-TW.md +165 -0
  25. package/docs/components-layout-footer.zh.md +165 -0
  26. package/docs/components-layout-header.ja.md +233 -0
  27. package/docs/components-layout-header.md +233 -0
  28. package/docs/components-layout-header.zh-TW.md +233 -0
  29. package/docs/components-layout-header.zh.md +233 -0
  30. package/docs/components-layout.ja.md +50 -0
  31. package/docs/components-layout.md +50 -0
  32. package/docs/components-layout.zh-TW.md +50 -0
  33. package/docs/components-layout.zh.md +50 -0
  34. package/docs/components-notifications.ja.md +173 -0
  35. package/docs/components-notifications.md +173 -0
  36. package/docs/components-notifications.zh-TW.md +174 -0
  37. package/docs/components-notifications.zh.md +173 -0
  38. package/docs/components-user-management-user-center.ja.md +183 -0
  39. package/docs/components-user-management-user-center.md +183 -0
  40. package/docs/components-user-management-user-center.zh-TW.md +183 -0
  41. package/docs/components-user-management-user-center.zh.md +183 -0
  42. package/docs/components-user-management-user-sessions.ja.md +164 -0
  43. package/docs/components-user-management-user-sessions.md +164 -0
  44. package/docs/components-user-management-user-sessions.zh-TW.md +164 -0
  45. package/docs/components-user-management-user-sessions.zh.md +164 -0
  46. package/docs/components-user-management.ja.md +76 -0
  47. package/docs/components-user-management.md +76 -0
  48. package/docs/components-user-management.zh-TW.md +76 -0
  49. package/docs/components-user-management.zh.md +76 -0
  50. package/docs/components-utilities-icon.ja.md +106 -0
  51. package/docs/components-utilities-icon.md +106 -0
  52. package/docs/components-utilities-icon.zh-TW.md +106 -0
  53. package/docs/components-utilities-icon.zh.md +106 -0
  54. package/docs/components-utilities.ja.md +136 -0
  55. package/docs/components-utilities.md +136 -0
  56. package/docs/components-utilities.zh-TW.md +136 -0
  57. package/docs/components-utilities.zh.md +136 -0
  58. package/docs/components.ja.md +27 -0
  59. package/docs/components.md +27 -0
  60. package/docs/components.zh-TW.md +27 -0
  61. package/docs/components.zh.md +27 -0
  62. package/docs/core-concepts.ja.md +164 -0
  63. package/docs/core-concepts.md +164 -0
  64. package/docs/core-concepts.zh-TW.md +164 -0
  65. package/docs/core-concepts.zh.md +164 -0
  66. package/docs/getting-started.ja.md +132 -0
  67. package/docs/getting-started.md +132 -0
  68. package/docs/getting-started.zh-TW.md +132 -0
  69. package/docs/getting-started.zh.md +132 -0
  70. package/docs/hooks-api.ja.md +214 -0
  71. package/docs/hooks-api.md +214 -0
  72. package/docs/hooks-api.zh-TW.md +214 -0
  73. package/docs/hooks-api.zh.md +214 -0
  74. package/docs/how-to-guides.ja.md +413 -0
  75. package/docs/how-to-guides.md +413 -0
  76. package/docs/how-to-guides.zh-TW.md +413 -0
  77. package/docs/how-to-guides.zh.md +413 -0
  78. package/docs/overview.ja.md +91 -0
  79. package/docs/overview.md +91 -0
  80. package/docs/overview.zh-TW.md +91 -0
  81. package/docs/overview.zh.md +91 -0
  82. package/glossary.md +12 -0
  83. package/lib/Dashboard/index.js +46 -42
  84. package/lib/Footer/index.js +51 -36
  85. package/lib/Header/index.js +48 -44
  86. package/lib/UserCenter/components/settings.js +1 -0
  87. package/lib/UserCenter/components/user-center.js +133 -133
  88. package/lib/blocklets.d.ts +13 -2
  89. package/lib/blocklets.js +40 -40
  90. package/lib/common/header-addons.js +37 -33
  91. package/package.json +7 -7
  92. package/src/Dashboard/index.jsx +8 -3
  93. package/src/Footer/index.jsx +22 -4
  94. package/src/Header/index.tsx +7 -2
  95. package/src/UserCenter/components/settings.tsx +1 -0
  96. package/src/UserCenter/components/user-center.tsx +6 -6
  97. package/src/blocklets.js +18 -9
  98. package/src/common/header-addons.jsx +7 -2
@@ -1,27 +1,27 @@
1
1
  import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
- import { use as we, useMemo as ye, isValidElement as X, cloneElement as Y, Children as ke } from "react";
3
- import { Box as d, Typography as Ce, CircularProgress as Pe, Divider as Se } from "@mui/material";
4
- import { useMemoizedFn as k, useCreation as c, useRequest as Z } from "ahooks";
5
- import Me from "p-wait-for";
6
- import ee from "react-helmet";
7
- import { SessionContext as De } from "@arcblock/did-connect-react/lib/Session";
8
- import Te from "@arcblock/ux/lib/Tabs";
9
- import re from "@arcblock/ux/lib/Empty";
10
- import Fe from "@arcblock/ux/lib/Button";
11
- import ze from "@arcblock/ux/lib/Result";
12
- import { useConfirm as We } from "@arcblock/ux/lib/Dialog";
13
- import { translate as Ae } from "@arcblock/ux/lib/Locale/util";
2
+ import { use as ye, useMemo as ke, isValidElement as Y, cloneElement as Z, Children as Ce } from "react";
3
+ import { Box as d, Typography as Pe, CircularProgress as Se, Divider as Me } from "@mui/material";
4
+ import { useMemoizedFn as C, useCreation as c, useRequest as ee } from "ahooks";
5
+ import De from "p-wait-for";
6
+ import re from "react-helmet";
7
+ import { SessionContext as Te } from "@arcblock/did-connect-react/lib/Session";
8
+ import Fe from "@arcblock/ux/lib/Tabs";
9
+ import te from "@arcblock/ux/lib/Empty";
10
+ import ze from "@arcblock/ux/lib/Button";
11
+ import We from "@arcblock/ux/lib/Result";
12
+ import { useConfirm as Ae } from "@arcblock/ux/lib/Dialog";
13
+ import { translate as Le } from "@arcblock/ux/lib/Locale/util";
14
14
  import { useLocaleContext as Ue } from "@arcblock/ux/lib/Locale/context";
15
- import { ErrorFallback as Le } from "@arcblock/ux/lib/ErrorBoundary";
16
- import { styled as ce } from "@arcblock/ux/lib/Theme";
17
- import Be from "lodash/cloneDeep";
18
- import { joinURL as C, getQuery as Ie, withoutTrailingSlash as te, withQuery as ie } from "ufo";
19
- import { isSupportFollow as je } from "@arcblock/ux/lib/Util";
20
- import { PROFILE_URL as P } from "@arcblock/ux/lib/Util/constant";
21
- import He from "../../Footer/index.js";
22
- import oe from "../../Header/index.js";
23
- import { translations as Ne } from "../libs/locales.js";
24
- import ne from "./user-info/user-basic-info.js";
15
+ import { ErrorFallback as Be } from "@arcblock/ux/lib/ErrorBoundary";
16
+ import { styled as de } from "@arcblock/ux/lib/Theme";
17
+ import Ie from "lodash/cloneDeep";
18
+ import { joinURL as P, getQuery as je, withoutTrailingSlash as ie, withQuery as oe } from "ufo";
19
+ import { isSupportFollow as He } from "@arcblock/ux/lib/Util";
20
+ import { PROFILE_URL as S } from "@arcblock/ux/lib/Util/constant";
21
+ import Ne from "../../Footer/index.js";
22
+ import ne from "../../Header/index.js";
23
+ import { translations as Ee } from "../libs/locales.js";
24
+ import se 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,17 +32,17 @@ 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 Ee, getLink as S, getLocalizedNavigation as _e } from "../../blocklets.js";
36
- import Oe from "./passport.js";
37
- import Re from "./settings.js";
38
- import { client as se } from "../../libs/client.js";
39
- import $e from "../../hooks/use-mobile.js";
40
- import { ConfigUserSpaceProvider as qe } from "../../contexts/config-user-space.js";
41
- import Ge from "./storage/index.js";
42
- import Qe from "./nft.js";
43
- import { UserFollowersProvider as le } from "../../contexts/user-followers.js";
44
- import Ve from "./fallback.js";
45
- const T = C(P, "/nfts"), F = C(P, "/settings"), z = C(P, "/did-spaces"), ae = C(P, "/user-followers"), ue = ce(d)(({ theme: v }) => ({
35
+ import { formatBlockletInfo as _e, getLink as M, getLocalizedNavigation as Oe } from "../../blocklets.js";
36
+ import Re from "./passport.js";
37
+ import $e from "./settings.js";
38
+ import { client as le } from "../../libs/client.js";
39
+ import qe from "../../hooks/use-mobile.js";
40
+ import { ConfigUserSpaceProvider as Ge } from "../../contexts/config-user-space.js";
41
+ import Qe from "./storage/index.js";
42
+ import Ve from "./nft.js";
43
+ import { UserFollowersProvider as ae } from "../../contexts/user-followers.js";
44
+ import Je from "./fallback.js";
45
+ const F = P(S, "/nfts"), z = P(S, "/settings"), W = P(S, "/did-spaces"), ue = P(S, "/user-followers"), ce = de(d)(({ theme: v }) => ({
46
46
  flex: 1,
47
47
  boxSizing: "border-box",
48
48
  padding: "0 16px",
@@ -56,7 +56,7 @@ const T = C(P, "/nfts"), F = C(P, "/settings"), z = C(P, "/did-spaces"), ae = C(
56
56
  [v.breakpoints.up("md")]: {
57
57
  flexDirection: "row"
58
58
  }
59
- })), W = ce(d)(({ theme: v }) => ({
59
+ })), A = de(d)(({ theme: v }) => ({
60
60
  overflow: "hidden",
61
61
  flex: "revert",
62
62
  [v.breakpoints.up("md")]: {
@@ -68,45 +68,45 @@ const T = C(P, "/nfts"), F = C(P, "/settings"), z = C(P, "/did-spaces"), ae = C(
68
68
  }
69
69
  }
70
70
  }));
71
- function _r({
71
+ function Or({
72
72
  children: v,
73
- notLoginContent: A = null,
73
+ notLoginContent: L = null,
74
74
  currentTab: b,
75
75
  contentProps: U = {},
76
- disableAutoRedirect: L = !1,
77
- hideFooter: de = !1,
78
- headerProps: fe = {},
79
- footerProps: pe = {},
80
- userDid: M = void 0,
81
- stickySidebar: B = !1,
82
- embed: I = !1,
76
+ disableAutoRedirect: B = !1,
77
+ hideFooter: fe = !1,
78
+ headerProps: pe = {},
79
+ footerProps: me = {},
80
+ userDid: D = void 0,
81
+ stickySidebar: I = !1,
82
+ embed: j = !1,
83
83
  onlyProfile: y = !1,
84
84
  // 只显示 profile 页面,用于 ArcSphere 只需要显示 Profile 的内容
85
- onDestroySelf: me = void 0
85
+ onDestroySelf: he = void 0
86
86
  }) {
87
- const { locale: h } = Ue(), l = $e({ key: "md" }), p = k((e, t = {}) => Ae(Ne, e, h, "en", t)), o = we(De)?.session, x = c(() => {
88
- if (M)
89
- return M;
90
- const e = window.location.href, t = Ie(e);
87
+ const { locale: h, defaultLocale: k } = Ue(), l = qe({ key: "md" }), p = C((e, t = {}) => Le(Ee, e, h, "en", t)), o = ye(Te)?.session, x = c(() => {
88
+ if (D)
89
+ return D;
90
+ const e = window.location.href, t = je(e);
91
91
  return t?.did ? Array.isArray(t.did) ? t.did[0] : t.did : o?.user?.did;
92
- }, [o?.user?.did, M]), i = c(() => o?.user ? x === o?.user?.did : !1, [x, o?.user?.did]), w = ye(() => je(), []), n = Z(
92
+ }, [o?.user?.did, D]), i = c(() => o?.user ? x === o?.user?.did : !1, [x, o?.user?.did]), w = ke(() => He(), []), n = ee(
93
93
  // eslint-disable-next-line consistent-return
94
94
  async () => {
95
- if (await Me(() => o?.initialized), i)
95
+ if (await De(() => o?.initialized), i)
96
96
  return o.user;
97
97
  if (x)
98
- return se.user.getUserPublicInfo({ did: x });
98
+ return le.user.getUserPublicInfo({ did: x });
99
99
  },
100
100
  {
101
101
  refreshDeps: [x, i, o?.initialized, o?.user]
102
102
  }
103
- ), j = k(() => i ? o.refresh() : n.refresh()), g = Z(
104
- async () => n.data && b ? await se.user.getUserPrivacyConfig({ did: x }) : null,
103
+ ), H = C(() => i ? o.refresh() : n.refresh()), g = ee(
104
+ async () => n.data && b ? await le.user.getUserPrivacyConfig({ did: x }) : null,
105
105
  {
106
106
  refreshDeps: [x, n.data, b],
107
107
  loadingDelay: 300
108
108
  }
109
- ), { confirmHolder: H } = We({
109
+ ), { confirmHolder: N } = Ae({
110
110
  fullScreen: l,
111
111
  sx: {
112
112
  ".MuiDialog-paper": {
@@ -126,27 +126,27 @@ function _r({
126
126
  }
127
127
  }
128
128
  }
129
- }), N = c(() => {
130
- const e = Be(window.blocklet);
129
+ }), E = c(() => {
130
+ const e = Ie(window.blocklet);
131
131
  try {
132
- return Ee(e);
132
+ return _e(e);
133
133
  } catch (t) {
134
134
  return console.error("Failed to format blocklet info", t, e), e;
135
135
  }
136
- }, []), E = c(() => {
136
+ }, []), _ = c(() => {
137
137
  const e = {
138
138
  label: p("common.nft"),
139
139
  protected: !1,
140
140
  isPrivate: !1,
141
141
  // true: 隐私数据,仅自己可见
142
- value: T,
143
- url: S(T, h)
142
+ value: F,
143
+ url: M(F, h, k)
144
144
  }, t = {
145
145
  label: p("userFollowers"),
146
146
  protected: !1,
147
147
  isPrivate: !1,
148
- value: ae,
149
- url: S(ae, h)
148
+ value: ue,
149
+ url: M(ue, h, k)
150
150
  };
151
151
  let f = w ? [e, t] : [e];
152
152
  if (i) {
@@ -156,29 +156,29 @@ function _r({
156
156
  label: p("common.setting"),
157
157
  protected: !0,
158
158
  isPrivate: !0,
159
- value: F,
160
- url: S(F, h)
159
+ value: z,
160
+ url: M(z, h, k)
161
161
  },
162
162
  {
163
163
  label: p("storageManagement"),
164
164
  protected: !0,
165
165
  isPrivate: !0,
166
- value: z,
167
- url: S(z, h)
166
+ value: W,
167
+ url: M(W, h, k)
168
168
  }
169
169
  ];
170
170
  f = w ? [...u, t] : u;
171
171
  }
172
172
  return f;
173
173
  }, [i, h, w]), a = c(() => {
174
- const e = N?.navigation?.userCenter || [];
175
- return (_e(e, h) || []).concat(E).map((u) => {
176
- const K = u.value ?? u._rawLink ?? u.link ?? u.url;
174
+ const e = E?.navigation?.userCenter || [];
175
+ return (Oe({ navigation: e, locale: h, defaultLocale: k }) || []).concat(_).map((u) => {
176
+ const X = u.value ?? u._rawLink ?? u.link ?? u.url;
177
177
  return {
178
- value: K,
178
+ value: X,
179
179
  label: u.title || u.label,
180
180
  url: u.link || u.url,
181
- protected: g?.data?.[K] ?? !1,
181
+ protected: g?.data?.[X] ?? !1,
182
182
  isPrivate: u.isPrivate || u.private || (u?._rawLink?.includes("/customer") ?? !1),
183
183
  // FIXME: HACK: 隐藏 /customer 菜单, 需要一个通用的解决方案,在嵌入的时候就决定是否是私有的
184
184
  followersOnly: u.component === "did-comments"
@@ -186,32 +186,32 @@ function _r({
186
186
  // icon: x.icon,
187
187
  };
188
188
  }).filter((u) => i || !u.isPrivate);
189
- }, [N, n.data, g?.data, h, E, i]), s = c(() => a.find((e) => te(e.value) === te(b)), [a]), _ = c(() => {
189
+ }, [E, n.data, g?.data, h, _, i]), s = c(() => a.find((e) => ie(e.value) === ie(b)), [a]), O = c(() => {
190
190
  const e = window.blocklet?.appName, f = [s?.label, p("userCenter.title")].filter(Boolean).join("-");
191
191
  return e ? `${f} | ${e}` : f;
192
- }, [s, p]), he = k((e) => e && (X(e) ? Y(e, {
192
+ }, [s, p]), xe = C((e) => e && (Y(e) ? Z(e, {
193
193
  ...e.props || {},
194
194
  userCenterTabs: a
195
- }) : ke.map(e, (t) => X(t) ? Y(t, {
195
+ }) : Ce.map(e, (t) => Y(t) ? Z(t, {
196
196
  ...t.props || {},
197
197
  userCenterTabs: a
198
- }) : t))), xe = k((e) => {
198
+ }) : t))), ge = C((e) => {
199
199
  const t = a.find((f) => f.value === e);
200
- t && (window.location.href = ie(t.url, {
200
+ t && (window.location.href = oe(t.url, {
201
201
  did: i ? void 0 : x
202
202
  }));
203
- }), O = c(() => /* @__PURE__ */ r(
204
- Re,
203
+ }), R = c(() => /* @__PURE__ */ r(
204
+ $e,
205
205
  {
206
206
  user: n.data,
207
207
  settings: { userCenterTabs: a },
208
208
  onSave: async (e) => e === "privacy" ? (await g.runAsync(), g.data) : (e === "profile" && await o.refresh(), null),
209
209
  isMobile: l,
210
- onDestroySelf: me
210
+ onDestroySelf: he
211
211
  }
212
- ), [n.data, a, g.data, g.runAsync]), R = c(() => s && s?.value === F, [s]), $ = c(() => s && s?.value === C(P, "/profile") || s?.value === T, [s]), ge = c(() => s && s?.value === z, [s]), be = o.useOAuth(), ve = o.usePasskey(), q = k(() => {
213
- o?.user?.sourceProvider === "passkey" ? ve.switchPassport(o.user) : ["google", "apple", "email", "github"].includes(o?.user?.sourceProvider ?? "") ? be.switchOAuthPassport(o.user) : o && o.switchPassport();
214
- }), D = c(() => $ ? /* @__PURE__ */ m(
212
+ ), [n.data, a, g.data, g.runAsync]), $ = c(() => s && s?.value === z, [s]), q = c(() => s && s?.value === P(S, "/profile") || s?.value === F, [s]), be = c(() => s && s?.value === W, [s]), ve = o.useOAuth(), we = o.usePasskey(), G = C(() => {
213
+ o?.user?.sourceProvider === "passkey" ? we.switchPassport(o.user) : ["google", "apple", "email", "github"].includes(o?.user?.sourceProvider ?? "") ? ve.switchOAuthPassport(o.user) : o && o.switchPassport();
214
+ }), T = c(() => q ? /* @__PURE__ */ m(
215
215
  d,
216
216
  {
217
217
  sx: {
@@ -222,7 +222,7 @@ function _r({
222
222
  children: [
223
223
  i ? /* @__PURE__ */ m(d, { sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, p: 2 }, children: [
224
224
  /* @__PURE__ */ r(
225
- Ce,
225
+ Pe,
226
226
  {
227
227
  sx: {
228
228
  color: "text.primary",
@@ -232,12 +232,12 @@ function _r({
232
232
  children: p("passport")
233
233
  }
234
234
  ),
235
- /* @__PURE__ */ r(Oe, { user: n.data })
235
+ /* @__PURE__ */ r(Re, { user: n.data })
236
236
  ] }) : null,
237
- /* @__PURE__ */ r(Qe, { user: n.data })
237
+ /* @__PURE__ */ r(Ve, { user: n.data })
238
238
  ]
239
239
  }
240
- ) : R && i ? O : ge && i ? /* @__PURE__ */ r(qe, { children: /* @__PURE__ */ r(Ge, {}) }) : null, [R, $, n, i, B, O]), G = c(() => /* @__PURE__ */ r(
240
+ ) : $ && i ? R : be && i ? /* @__PURE__ */ r(Ge, { children: /* @__PURE__ */ r(Qe, {}) }) : null, [$, q, n, i, I, R]), Q = c(() => /* @__PURE__ */ r(
241
241
  d,
242
242
  {
243
243
  sx: {
@@ -247,9 +247,9 @@ function _r({
247
247
  },
248
248
  py: 3
249
249
  },
250
- children: /* @__PURE__ */ r(re, { children: p("emptyContent") })
250
+ children: /* @__PURE__ */ r(te, { children: p("emptyContent") })
251
251
  }
252
- ), [i, h]), Q = c(() => !g.data || g.loading ? /* @__PURE__ */ r(
252
+ ), [i, h]), V = c(() => !g.data || g.loading ? /* @__PURE__ */ r(
253
253
  d,
254
254
  {
255
255
  sx: {
@@ -261,28 +261,28 @@ function _r({
261
261
  alignItems: "center",
262
262
  flex: 1
263
263
  },
264
- children: /* @__PURE__ */ r(Pe, {})
264
+ children: /* @__PURE__ */ r(Se, {})
265
265
  }
266
266
  ) : /* @__PURE__ */ r(d, { sx: { flex: 1 }, children: /* @__PURE__ */ r(
267
- Ve,
267
+ Je,
268
268
  {
269
269
  isSupportFollow: w,
270
270
  currentActiveTab: s,
271
271
  isMyself: i,
272
- children: v ? /* @__PURE__ */ r(d, { ...U, children: he(v) }) : D
272
+ children: v ? /* @__PURE__ */ r(d, { ...U, children: xe(v) }) : T
273
273
  }
274
- ) }), [g, s, i, v, U, D, h]), V = c(() => {
274
+ ) }), [g, s, i, v, U, T, h]), J = c(() => {
275
275
  if (n.loading || o.loading)
276
276
  return null;
277
277
  if (n.error) {
278
278
  if (n.error?.response?.status === 404)
279
- return /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ r(ze, { status: 404, description: p("noUserFound") }) });
279
+ return /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ r(We, { status: 404, description: p("noUserFound") }) });
280
280
  const f = {
281
281
  message: n.error.response?.data?.error || n.error.message || "error occurred"
282
282
  };
283
- return /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Le, { error: f }) });
283
+ return /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Be, { error: f }) });
284
284
  }
285
- return !x && !n.data ? A || /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ m(
285
+ return !x && !n.data ? L || /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ m(
286
286
  d,
287
287
  {
288
288
  sx: {
@@ -293,11 +293,11 @@ function _r({
293
293
  gap: 1
294
294
  },
295
295
  children: [
296
- /* @__PURE__ */ r(re, { children: p("viewAfterLogin") }),
297
- /* @__PURE__ */ r(Fe, { size: "small", variant: "contained", onClick: () => o.login(), children: p("loginNow") })
296
+ /* @__PURE__ */ r(te, { children: p("viewAfterLogin") }),
297
+ /* @__PURE__ */ r(ze, { size: "small", variant: "contained", onClick: () => o.login(), children: p("loginNow") })
298
298
  ]
299
299
  }
300
- ) }) : I ? /* @__PURE__ */ m(W, { children: [
300
+ ) }) : j ? /* @__PURE__ */ m(A, { children: [
301
301
  a.length > 0 && b ? /* @__PURE__ */ r(
302
302
  d,
303
303
  {
@@ -307,22 +307,22 @@ function _r({
307
307
  overflow: "auto",
308
308
  padding: "1px"
309
309
  },
310
- children: Q
310
+ children: V
311
311
  }
312
312
  ) : null,
313
- a.length === 0 && G
314
- ] }) : y ? /* @__PURE__ */ r(W, { display: "flex", flexDirection: l ? "column" : "row", children: /* @__PURE__ */ r(
315
- ne,
313
+ a.length === 0 && Q
314
+ ] }) : y ? /* @__PURE__ */ r(A, { display: "flex", flexDirection: l ? "column" : "row", children: /* @__PURE__ */ r(
315
+ se,
316
316
  {
317
317
  isMobile: l,
318
318
  order: l ? 1 : "unset",
319
319
  isMyself: i,
320
- switchPassport: q,
320
+ switchPassport: G,
321
321
  switchProfile: o.switchProfile,
322
322
  user: n.data,
323
323
  showFullDid: !1,
324
324
  onlyProfile: y,
325
- refreshProfile: j,
325
+ refreshProfile: H,
326
326
  isShowSocialActions: w,
327
327
  sx: {
328
328
  padding: l ? "16px 0 0 0" : "40px 24px 24px 40px",
@@ -330,7 +330,7 @@ function _r({
330
330
  boxSizing: "content-box"
331
331
  }
332
332
  }
333
- ) }) : /* @__PURE__ */ m(W, { display: "flex", flexDirection: l ? "column" : "row", children: [
333
+ ) }) : /* @__PURE__ */ m(A, { display: "flex", flexDirection: l ? "column" : "row", children: [
334
334
  /* @__PURE__ */ m(
335
335
  d,
336
336
  {
@@ -353,13 +353,13 @@ function _r({
353
353
  },
354
354
  children: [
355
355
  /* @__PURE__ */ r(
356
- Te,
356
+ Fe,
357
357
  {
358
358
  orientation: "horizontal",
359
359
  variant: "line",
360
360
  tabs: a,
361
361
  current: s?.value ?? b,
362
- onChange: xe,
362
+ onChange: ge,
363
363
  enableTabClick: !0,
364
364
  sx: {
365
365
  mb: (e) => `${e.spacing(3)} !important`,
@@ -396,25 +396,25 @@ function _r({
396
396
  }
397
397
  }
398
398
  ),
399
- Q
399
+ V
400
400
  ]
401
401
  }
402
402
  ) : null,
403
- a.length === 0 && G
403
+ a.length === 0 && Q
404
404
  ]
405
405
  }
406
406
  ),
407
- !l && /* @__PURE__ */ r(Se, { orientation: "vertical", sx: { ml: 5 } }),
407
+ !l && /* @__PURE__ */ r(Me, { orientation: "vertical", sx: { ml: 5 } }),
408
408
  /* @__PURE__ */ r(
409
- ne,
409
+ se,
410
410
  {
411
411
  isMobile: l,
412
412
  order: l ? 1 : "unset",
413
413
  isMyself: i,
414
- switchPassport: q,
414
+ switchPassport: G,
415
415
  switchProfile: o.switchProfile,
416
416
  user: n.data,
417
- refreshProfile: j,
417
+ refreshProfile: H,
418
418
  showFullDid: !1,
419
419
  isShowSocialActions: w,
420
420
  sx: {
@@ -432,23 +432,23 @@ function _r({
432
432
  s,
433
433
  g,
434
434
  b,
435
- B,
436
- D
437
- ]), J = c(() => i ? !1 : s?.isPrivate, [i, s]);
438
- if (c(() => y ? !1 : !L && !b && a?.length > 0 || !s || J, [L, b, a, s, J, y])) {
435
+ I,
436
+ T
437
+ ]), K = c(() => i ? !1 : s?.isPrivate, [i, s]);
438
+ if (c(() => y ? !1 : !B && !b && a?.length > 0 || !s || K, [B, b, a, s, K, y])) {
439
439
  const e = a[0]?.url, t = a.find((f) => f.value === e);
440
440
  return e && !t?.isPrivate && window.location.replace(
441
- ie(e, {
441
+ oe(e, {
442
442
  did: i ? void 0 : x
443
443
  })
444
444
  ), null;
445
445
  }
446
- return I || y ? /* @__PURE__ */ m(d, { children: [
447
- /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ r("title", { children: _ }) }),
448
- /* @__PURE__ */ r(oe, { style: { display: "none" } }),
449
- /* @__PURE__ */ m(ue, { children: [
450
- /* @__PURE__ */ r(le, { isMySelf: i, userDid: n.data?.did ?? "", children: V }),
451
- H
446
+ return j || y ? /* @__PURE__ */ m(d, { children: [
447
+ /* @__PURE__ */ r(re, { children: /* @__PURE__ */ r("title", { children: O }) }),
448
+ /* @__PURE__ */ r(ne, { style: { display: "none" } }),
449
+ /* @__PURE__ */ m(ce, { children: [
450
+ /* @__PURE__ */ r(ae, { isMySelf: i, userDid: n.data?.did ?? "", children: J }),
451
+ N
452
452
  ] })
453
453
  ] }) : /* @__PURE__ */ m(
454
454
  d,
@@ -459,17 +459,17 @@ function _r({
459
459
  flexDirection: "column"
460
460
  },
461
461
  children: [
462
- /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ r("title", { children: _ }) }),
463
- /* @__PURE__ */ r(oe, { bordered: !0, ...fe, maxWidth: "100%" }),
464
- /* @__PURE__ */ m(ue, { children: [
465
- /* @__PURE__ */ r(le, { isMySelf: i, userDid: n.data?.did ?? "", children: V }),
466
- H
462
+ /* @__PURE__ */ r(re, { children: /* @__PURE__ */ r("title", { children: O }) }),
463
+ /* @__PURE__ */ r(ne, { bordered: !0, ...pe, maxWidth: "100%" }),
464
+ /* @__PURE__ */ m(ce, { children: [
465
+ /* @__PURE__ */ r(ae, { isMySelf: i, userDid: n.data?.did ?? "", children: J }),
466
+ N
467
467
  ] }),
468
- de ? null : /* @__PURE__ */ r(
469
- He,
468
+ fe ? null : /* @__PURE__ */ r(
469
+ Ne,
470
470
  {
471
471
  bordered: !0,
472
- ...pe,
472
+ ...me,
473
473
  sx: {
474
474
  ".MuiContainer-root": {
475
475
  maxWidth: 1600
@@ -482,5 +482,5 @@ function _r({
482
482
  );
483
483
  }
484
484
  export {
485
- _r as default
485
+ Or as default
486
486
  };
@@ -1,7 +1,18 @@
1
1
  export const publicPath: any;
2
2
  export function formatTheme(theme: any): any;
3
- export function getLink(link: any, locale?: string): any;
4
- export function getLocalizedNavigation(navigation: any[], locale?: string, section?: "header" | "footer"): any;
3
+ export function getLink(link: any, locale?: string, defaultLocale?: string): any;
4
+ export function getLocalizedNavigation({ navigation, locale, defaultLocale, section }: {
5
+ navigation: Array<{
6
+ title?: string | Record<string, string>;
7
+ description?: string | Record<string, string>;
8
+ link?: string | Record<string, string>;
9
+ items?: any[];
10
+ [key: string]: any;
11
+ }>;
12
+ locale: string;
13
+ defaultLocale: string;
14
+ section?: "footer" | "header" | undefined;
15
+ }): any[];
5
16
  export function formatNavigation(navigation: any): any;
6
17
  export function parseNavigation(navigation: any): {
7
18
  header: never[];
package/lib/blocklets.js CHANGED
@@ -1,51 +1,51 @@
1
- import { getUTMUrl as i } from "@arcblock/ux/lib/withTracker/libs/utm";
2
- import { mapRecursive as s, filterRecursive as a, isUrl as c, isMailProtocol as u } from "./utils.js";
3
- const w = window?.blocklet?.groupPrefix || window?.blocklet?.prefix || "/", l = (e) => {
1
+ import { getUTMUrl as c } from "@arcblock/ux/lib/withTracker/libs/utm";
2
+ import { mapRecursive as a, filterRecursive as i, isUrl as u, isMailProtocol as l } from "./utils.js";
3
+ const v = window?.blocklet?.groupPrefix || window?.blocklet?.prefix || "/", d = (e) => {
4
4
  const r = { ...e }, t = e?.background;
5
5
  return typeof t == "string" ? r.background = { header: t, footer: t, default: t } : t && typeof t == "object" && (r.background = {
6
6
  header: t.header || t.default,
7
7
  footer: t.footer || t.default,
8
8
  default: t.default
9
9
  }), r;
10
- }, d = (e, r = "en") => {
10
+ }, h = (e, r = "en", t = "en") => {
11
11
  if (typeof e == "string") {
12
- if (c(e)) {
13
- const n = new URL(e);
14
- return n.searchParams.set("locale", r), n.href;
12
+ if (u(e)) {
13
+ const s = new URL(e);
14
+ return s.searchParams.set("locale", r), s.href;
15
15
  }
16
- if (u(e))
16
+ if (l(e))
17
17
  return e;
18
- const t = new URL(e, window.location.origin);
19
- return t.searchParams.set("locale", r), t.pathname + t.search;
18
+ const o = new URL(e, window.location.origin);
19
+ return o.searchParams.set("locale", r), o.pathname + o.search;
20
20
  }
21
- return typeof e == "object" ? e[r] || e?.en || e?.zh : e;
22
- }, v = (e, r = "en", t = "header") => {
21
+ return typeof e == "object" ? e[r] || e[t] || e.en : e;
22
+ }, N = ({ navigation: e, locale: r, defaultLocale: t, section: o = "header" }) => {
23
23
  if (!e?.length)
24
24
  return e;
25
- const n = (o, f) => o && typeof o == "object" ? o[f] || o?.en || o?.zh : o;
26
- return s(
25
+ const s = (n, f) => n && typeof n == "object" ? n[f] || n[t] || n.en : n;
26
+ return a(
27
27
  e,
28
- (o) => ({
29
- ...o,
30
- title: n(o.title, r),
31
- description: n(o.description, r),
28
+ (n) => ({
29
+ ...n,
30
+ title: s(n.title, r),
31
+ description: s(n.description, r),
32
32
  // 仅对叶结点进行处理
33
- link: i(o.items?.length ? o.link : d(o.link, r), t),
34
- _rawLink: o.link
33
+ link: c(n.items?.length ? n.link : h(n.link, r, t), o),
34
+ _rawLink: n.link
35
35
  }),
36
36
  "items"
37
37
  );
38
- }, h = (e) => s(
38
+ }, g = (e) => a(
39
39
  e,
40
40
  (r) => r.role ? {
41
41
  ...r,
42
42
  role: Array.isArray(r.role) ? r.role : [r.role]
43
43
  } : r,
44
44
  "items"
45
- ), g = (e) => {
45
+ ), p = (e) => {
46
46
  if (!e?.length)
47
47
  return null;
48
- const r = h(e), t = {
48
+ const r = g(e), t = {
49
49
  header: [],
50
50
  footer: [],
51
51
  // 对应 footer social media
@@ -58,32 +58,32 @@ const w = window?.blocklet?.groupPrefix || window?.blocklet?.prefix || "/", l =
58
58
  sessionManager: [],
59
59
  userCenter: []
60
60
  };
61
- return r.forEach((n) => {
62
- n.section ? Array.isArray(n.section) ? n.section.forEach((o) => {
63
- t[o]?.push(n);
64
- }) : typeof n.section == "string" && t[n.section]?.push(n) : t.header.push(n);
61
+ return r.forEach((o) => {
62
+ o.section ? Array.isArray(o.section) ? o.section.forEach((s) => {
63
+ t[s]?.push(o);
64
+ }) : typeof o.section == "string" && t[o.section]?.push(o) : t.header.push(o);
65
65
  }), t;
66
66
  }, L = (e) => {
67
67
  if (!e)
68
68
  return null;
69
69
  const r = { ...e };
70
- return r.theme = l(r.theme), r.navigation = g(p(r.navigation)), r;
71
- }, p = (e = []) => a(e, (r, t) => !!r.link || t.filteredChildren?.length, "items"), N = (e, r) => a(
70
+ return r.theme = d(r.theme), r.navigation = p(b(r.navigation)), r;
71
+ }, b = (e = []) => i(e, (r, t) => !!r.link || t.filteredChildren?.length, "items"), P = (e, r) => i(
72
72
  e,
73
- (t, n) => {
74
- const o = !t.role || r && (t.role.includes(r) || t.role.includes("guest"));
75
- return n.isLeaf ? o : o && n.filteredChildren?.length;
73
+ (t, o) => {
74
+ const s = !t.role || r && (t.role.includes(r) || t.role.includes("guest"));
75
+ return o.isLeaf ? s : s && o.filteredChildren?.length;
76
76
  },
77
77
  "items"
78
78
  );
79
79
  export {
80
- N as filterNavByRole,
81
- p as filterValidNavItems,
80
+ P as filterNavByRole,
81
+ b as filterValidNavItems,
82
82
  L as formatBlockletInfo,
83
- h as formatNavigation,
84
- l as formatTheme,
85
- d as getLink,
86
- v as getLocalizedNavigation,
87
- g as parseNavigation,
88
- w as publicPath
83
+ g as formatNavigation,
84
+ d as formatTheme,
85
+ h as getLink,
86
+ N as getLocalizedNavigation,
87
+ p as parseNavigation,
88
+ v as publicPath
89
89
  };