@blocklet/ui-react 2.9.90 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/build.config.ts +1 -6
  2. package/lib/@types/index.d.ts +1 -0
  3. package/lib/@types/index.js +0 -1
  4. package/lib/BlockletStudio/index.js +50 -50
  5. package/lib/ComponentInstaller/index.js +122 -202
  6. package/lib/ComponentInstaller/installer-item.js +116 -138
  7. package/lib/ComponentInstaller/locales.js +5 -10
  8. package/lib/ComponentInstaller/use-component-installed.js +37 -41
  9. package/lib/ComponentManager/components/add-component.js +58 -67
  10. package/lib/ComponentManager/components/check-component.js +2 -9
  11. package/lib/ComponentManager/components/publish-component.js +50 -59
  12. package/lib/ComponentManager/components/resource-dialog.js +42 -39
  13. package/lib/ComponentManager/index.js +3 -27
  14. package/lib/ComponentManager/libs/locales.js +2 -8
  15. package/lib/Dashboard/index.js +74 -99
  16. package/lib/Footer/brand.js +21 -43
  17. package/lib/Footer/copyright.js +15 -24
  18. package/lib/Footer/index.js +47 -71
  19. package/lib/Footer/internal-footer.js +72 -100
  20. package/lib/Footer/layout/plain.js +26 -45
  21. package/lib/Footer/layout/row.js +12 -29
  22. package/lib/Footer/layout/standard.js +34 -64
  23. package/lib/Footer/links.js +74 -104
  24. package/lib/Footer/social-media.js +35 -42
  25. package/lib/Header/index.js +69 -117
  26. package/lib/Icon/index.js +18 -53
  27. package/{es/UserCenter/components/notification.d.ts → lib/UserCenter/components/config-profile.d.ts} +1 -1
  28. package/lib/UserCenter/components/config-profile.js +67 -0
  29. package/lib/UserCenter/components/notification.js +203 -186
  30. package/lib/UserCenter/components/passport.js +70 -79
  31. package/lib/UserCenter/components/privacy.js +86 -88
  32. package/lib/UserCenter/components/settings.js +74 -84
  33. package/lib/UserCenter/components/storage/connect-to.js +56 -75
  34. package/lib/UserCenter/components/storage/connected.js +16 -37
  35. package/lib/UserCenter/components/storage/delete.js +42 -51
  36. package/lib/UserCenter/components/storage/disconnect.js +15 -29
  37. package/lib/UserCenter/components/storage/index.js +20 -54
  38. package/lib/UserCenter/components/storage/item.js +94 -122
  39. package/lib/UserCenter/components/storage/preview-nft.js +77 -85
  40. package/lib/UserCenter/components/third-party-login/index.js +49 -61
  41. package/lib/UserCenter/components/third-party-login/third-party-item.js +159 -176
  42. package/lib/UserCenter/components/user-center.js +276 -287
  43. package/lib/UserCenter/components/user-info/index.js +3 -27
  44. package/lib/UserCenter/components/user-info/user-basic-info.js +134 -129
  45. package/lib/UserCenter/components/user-info/user-info-item.js +43 -37
  46. package/lib/UserCenter/components/user-info/user-info.js +41 -74
  47. package/lib/UserCenter/components/webhook-item.js +184 -177
  48. package/lib/UserCenter/index.js +1 -13
  49. package/lib/UserCenter/libs/api.js +4 -16
  50. package/lib/UserCenter/libs/locales.d.ts +10 -0
  51. package/lib/UserCenter/libs/locales.js +12 -8
  52. package/lib/UserCenter/libs/utils.js +7 -17
  53. package/lib/UserSessions/components/user-session-info.js +88 -85
  54. package/lib/UserSessions/components/user-sessions.js +177 -213
  55. package/lib/UserSessions/index.js +1 -13
  56. package/lib/UserSessions/libs/locales.js +2 -8
  57. package/lib/UserSessions/libs/utils.js +4 -11
  58. package/lib/blocklets.js +59 -63
  59. package/lib/common/header-addons.js +44 -60
  60. package/lib/common/link-blocker.js +9 -18
  61. package/lib/common/overridable-theme-provider.js +10 -23
  62. package/lib/common/wallet-hidden-topbar.js +7 -14
  63. package/lib/contexts/config-user-space.js +38 -46
  64. package/lib/hooks/use-mobile.js +5 -13
  65. package/lib/index.js +10 -100
  66. package/lib/libs/client.js +2 -8
  67. package/lib/libs/spaces.js +6 -13
  68. package/lib/types.js +39 -41
  69. package/lib/utils.js +25 -44
  70. package/package.json +8 -38
  71. package/src/@types/index.ts +1 -0
  72. package/src/Footer/brand.jsx +6 -1
  73. package/src/UserCenter/components/config-profile.tsx +70 -0
  74. package/src/UserCenter/components/notification.tsx +63 -47
  75. package/src/UserCenter/components/settings.tsx +6 -0
  76. package/src/UserCenter/libs/locales.ts +10 -0
  77. package/es/@types/index.d.ts +0 -101
  78. package/es/@types/index.js +0 -0
  79. package/es/@types/shims.d.ts +0 -16
  80. package/es/BlockletStudio/index.d.ts +0 -28
  81. package/es/BlockletStudio/index.js +0 -114
  82. package/es/ComponentInstaller/index.d.ts +0 -37
  83. package/es/ComponentInstaller/index.js +0 -200
  84. package/es/ComponentInstaller/installer-item.d.ts +0 -21
  85. package/es/ComponentInstaller/installer-item.js +0 -139
  86. package/es/ComponentInstaller/locales.d.ts +0 -28
  87. package/es/ComponentInstaller/locales.js +0 -22
  88. package/es/ComponentInstaller/use-component-installed.d.ts +0 -12
  89. package/es/ComponentInstaller/use-component-installed.js +0 -88
  90. package/es/ComponentManager/components/add-component.d.ts +0 -16
  91. package/es/ComponentManager/components/add-component.js +0 -114
  92. package/es/ComponentManager/components/check-component.d.ts +0 -2
  93. package/es/ComponentManager/components/check-component.js +0 -2
  94. package/es/ComponentManager/components/publish-component.d.ts +0 -10
  95. package/es/ComponentManager/components/publish-component.js +0 -76
  96. package/es/ComponentManager/components/resource-dialog.d.ts +0 -14
  97. package/es/ComponentManager/components/resource-dialog.js +0 -74
  98. package/es/ComponentManager/index.d.ts +0 -3
  99. package/es/ComponentManager/index.js +0 -3
  100. package/es/ComponentManager/libs/locales.d.ts +0 -14
  101. package/es/ComponentManager/libs/locales.js +0 -14
  102. package/es/Dashboard/index.d.ts +0 -40
  103. package/es/Dashboard/index.js +0 -118
  104. package/es/Footer/brand.d.ts +0 -22
  105. package/es/Footer/brand.js +0 -73
  106. package/es/Footer/copyright.d.ts +0 -18
  107. package/es/Footer/copyright.js +0 -25
  108. package/es/Footer/index.d.ts +0 -6
  109. package/es/Footer/index.js +0 -82
  110. package/es/Footer/internal-footer.d.ts +0 -29
  111. package/es/Footer/internal-footer.js +0 -117
  112. package/es/Footer/layout/plain.d.ts +0 -15
  113. package/es/Footer/layout/plain.js +0 -39
  114. package/es/Footer/layout/row.d.ts +0 -18
  115. package/es/Footer/layout/row.js +0 -41
  116. package/es/Footer/layout/standard.d.ts +0 -15
  117. package/es/Footer/layout/standard.js +0 -53
  118. package/es/Footer/links.d.ts +0 -22
  119. package/es/Footer/links.js +0 -207
  120. package/es/Footer/social-media.d.ts +0 -14
  121. package/es/Footer/social-media.js +0 -60
  122. package/es/Header/index.d.ts +0 -10
  123. package/es/Header/index.js +0 -155
  124. package/es/Icon/index.d.ts +0 -23
  125. package/es/Icon/index.js +0 -55
  126. package/es/UserCenter/assets/banner.png +0 -0
  127. package/es/UserCenter/components/notification.js +0 -248
  128. package/es/UserCenter/components/passport.d.ts +0 -6
  129. package/es/UserCenter/components/passport.js +0 -88
  130. package/es/UserCenter/components/privacy.d.ts +0 -11
  131. package/es/UserCenter/components/privacy.js +0 -99
  132. package/es/UserCenter/components/settings.d.ts +0 -9
  133. package/es/UserCenter/components/settings.js +0 -89
  134. package/es/UserCenter/components/storage/connect-to.d.ts +0 -7
  135. package/es/UserCenter/components/storage/connect-to.js +0 -108
  136. package/es/UserCenter/components/storage/connected.d.ts +0 -7
  137. package/es/UserCenter/components/storage/connected.js +0 -24
  138. package/es/UserCenter/components/storage/delete.d.ts +0 -7
  139. package/es/UserCenter/components/storage/delete.js +0 -62
  140. package/es/UserCenter/components/storage/disconnect.d.ts +0 -3
  141. package/es/UserCenter/components/storage/disconnect.js +0 -23
  142. package/es/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
  143. package/es/UserCenter/components/storage/icons/long-arrow.svg +0 -5
  144. package/es/UserCenter/components/storage/icons/space-connected.svg +0 -3
  145. package/es/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
  146. package/es/UserCenter/components/storage/index.d.ts +0 -3
  147. package/es/UserCenter/components/storage/index.js +0 -27
  148. package/es/UserCenter/components/storage/item.d.ts +0 -9
  149. package/es/UserCenter/components/storage/item.js +0 -158
  150. package/es/UserCenter/components/storage/preview-nft.d.ts +0 -6
  151. package/es/UserCenter/components/storage/preview-nft.js +0 -80
  152. package/es/UserCenter/components/third-party-login/index.d.ts +0 -5
  153. package/es/UserCenter/components/third-party-login/index.js +0 -110
  154. package/es/UserCenter/components/third-party-login/third-party-item.d.ts +0 -13
  155. package/es/UserCenter/components/third-party-login/third-party-item.js +0 -224
  156. package/es/UserCenter/components/user-center.d.ts +0 -15
  157. package/es/UserCenter/components/user-center.js +0 -414
  158. package/es/UserCenter/components/user-info/index.d.ts +0 -3
  159. package/es/UserCenter/components/user-info/index.js +0 -3
  160. package/es/UserCenter/components/user-info/user-basic-info.d.ts +0 -11
  161. package/es/UserCenter/components/user-info/user-basic-info.js +0 -151
  162. package/es/UserCenter/components/user-info/user-info-item.d.ts +0 -11
  163. package/es/UserCenter/components/user-info/user-info-item.js +0 -47
  164. package/es/UserCenter/components/user-info/user-info.d.ts +0 -6
  165. package/es/UserCenter/components/user-info/user-info.js +0 -66
  166. package/es/UserCenter/components/webhook-item.d.ts +0 -3
  167. package/es/UserCenter/components/webhook-item.js +0 -243
  168. package/es/UserCenter/index.d.ts +0 -1
  169. package/es/UserCenter/index.js +0 -1
  170. package/es/UserCenter/libs/api.d.ts +0 -3
  171. package/es/UserCenter/libs/api.js +0 -4
  172. package/es/UserCenter/libs/locales.d.ts +0 -162
  173. package/es/UserCenter/libs/locales.js +0 -162
  174. package/es/UserCenter/libs/utils.d.ts +0 -4
  175. package/es/UserCenter/libs/utils.js +0 -14
  176. package/es/UserSessions/components/user-session-info.d.ts +0 -6
  177. package/es/UserSessions/components/user-session-info.js +0 -92
  178. package/es/UserSessions/components/user-sessions.d.ts +0 -9
  179. package/es/UserSessions/components/user-sessions.js +0 -265
  180. package/es/UserSessions/index.d.ts +0 -1
  181. package/es/UserSessions/index.js +0 -1
  182. package/es/UserSessions/libs/locales.d.ts +0 -58
  183. package/es/UserSessions/libs/locales.js +0 -58
  184. package/es/UserSessions/libs/utils.d.ts +0 -2
  185. package/es/UserSessions/libs/utils.js +0 -73
  186. package/es/blocklets.d.ts +0 -16
  187. package/es/blocklets.js +0 -178
  188. package/es/common/header-addons.d.ts +0 -21
  189. package/es/common/header-addons.js +0 -83
  190. package/es/common/link-blocker.d.ts +0 -7
  191. package/es/common/link-blocker.js +0 -18
  192. package/es/common/overridable-theme-provider.d.ts +0 -18
  193. package/es/common/overridable-theme-provider.js +0 -15
  194. package/es/common/wallet-hidden-topbar.d.ts +0 -1
  195. package/es/common/wallet-hidden-topbar.js +0 -14
  196. package/es/contexts/config-user-space.d.ts +0 -26
  197. package/es/contexts/config-user-space.js +0 -53
  198. package/es/hooks/use-mobile.d.ts +0 -4
  199. package/es/hooks/use-mobile.js +0 -5
  200. package/es/index.d.ts +0 -10
  201. package/es/index.js +0 -10
  202. package/es/libs/client.d.ts +0 -2
  203. package/es/libs/client.js +0 -2
  204. package/es/libs/spaces.d.ts +0 -2
  205. package/es/libs/spaces.js +0 -13
  206. package/es/types.d.ts +0 -2
  207. package/es/types.js +0 -43
  208. package/es/utils.d.ts +0 -8
  209. package/es/utils.js +0 -78
@@ -1,35 +1,28 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- module.exports = UserCenter;
7
- var _jsxRuntime = require("react/jsx-runtime");
8
- var _react = require("react");
9
- var _material = require("@mui/material");
10
- var _ahooks = require("ahooks");
11
- var _pWaitFor = _interopRequireDefault(require("p-wait-for"));
12
- var _Session = require("@arcblock/did-connect/lib/Session");
13
- var _Tabs = _interopRequireDefault(require("@arcblock/ux/lib/Tabs"));
14
- var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
15
- var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
16
- var _Colors = require("@arcblock/ux/lib/Colors");
17
- var _Dialog = require("@arcblock/ux/lib/Dialog");
18
- var _util = require("@arcblock/ux/lib/Locale/util");
19
- var _context = require("@arcblock/ux/lib/Locale/context");
20
- var _ErrorBoundary = require("@arcblock/ux/lib/ErrorBoundary");
21
- var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
22
- var _ufo = require("ufo");
23
- var _Footer = _interopRequireDefault(require("../../Footer"));
24
- var _Header = _interopRequireDefault(require("../../Header"));
25
- var _locales = require("../libs/locales");
26
- var _userInfo = require("./user-info");
27
- var _blocklets = require("../../blocklets");
28
- var _passport = _interopRequireDefault(require("./passport"));
29
- var _settings = _interopRequireDefault(require("./settings"));
30
- var _client = require("../../libs/client");
31
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
- function UserCenter({
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useContext } from "react";
3
+ import { Box, CircularProgress, Typography } from "@mui/material";
4
+ import { useCreation, useMemoizedFn, useMount, useRequest, useUpdateEffect } from "ahooks";
5
+ import pWaitFor from "p-wait-for";
6
+ import { SessionContext } from "@arcblock/did-connect/lib/Session";
7
+ import Tabs from "@arcblock/ux/lib/Tabs";
8
+ import Empty from "@arcblock/ux/lib/Empty";
9
+ import Button from "@arcblock/ux/lib/Button";
10
+ import { temp as colors } from "@arcblock/ux/lib/Colors";
11
+ import { useConfirm } from "@arcblock/ux/lib/Dialog";
12
+ import { translate } from "@arcblock/ux/lib/Locale/util";
13
+ import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
14
+ import { ErrorFallback } from "@arcblock/ux/lib/ErrorBoundary";
15
+ import cloneDeep from "lodash/cloneDeep";
16
+ import { getQuery, withQuery } from "ufo";
17
+ import Footer from "../../Footer/index.js";
18
+ import Header from "../../Header/index.js";
19
+ import { translations } from "../libs/locales.js";
20
+ import { UserInfo, UserBasicInfo } from "./user-info/index.js";
21
+ import { formatBlockletInfo, getLocalizedNavigation } from "../../blocklets.js";
22
+ import Passport from "./passport.js";
23
+ import Settings from "./settings.js";
24
+ import { client } from "../../libs/client.js";
25
+ export default function UserCenter({
33
26
  children,
34
27
  notLoginContent = null,
35
28
  currentTab,
@@ -42,20 +35,18 @@ function UserCenter({
42
35
  userDid = void 0,
43
36
  stickySidebar = false
44
37
  }) {
45
- const {
46
- locale
47
- } = (0, _context.useLocaleContext)();
48
- const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
49
- return (0, _util.translate)(_locales.translations, key, locale, "en", data);
38
+ const { locale } = useLocaleContext();
39
+ const t = useMemoizedFn((key, data = {}) => {
40
+ return translate(translations, key, locale, "en", data);
50
41
  });
51
- const sessionCtx = (0, _react.useContext)(_Session.SessionContext);
42
+ const sessionCtx = useContext(SessionContext);
52
43
  const session = sessionCtx?.session;
53
- const currentDid = (0, _ahooks.useCreation)(() => {
44
+ const currentDid = useCreation(() => {
54
45
  if (userDid) {
55
46
  return userDid;
56
47
  }
57
48
  const currentUrl = window.location.href;
58
- const query = (0, _ufo.getQuery)(currentUrl);
49
+ const query = getQuery(currentUrl);
59
50
  if (query?.did) {
60
51
  if (Array.isArray(query.did)) {
61
52
  return query.did[0];
@@ -64,43 +55,41 @@ function UserCenter({
64
55
  }
65
56
  return session?.user?.did;
66
57
  }, [session?.user?.did, userDid]);
67
- const isMyself = (0, _ahooks.useCreation)(() => {
58
+ const isMyself = useCreation(() => {
68
59
  if (session?.user) {
69
60
  return currentDid === session?.user?.did;
70
61
  }
71
62
  return false;
72
63
  }, [currentDid, session?.user?.did]);
73
- const userState = (0, _ahooks.useRequest)(
74
- // eslint-disable-next-line consistent-return
75
- async () => {
76
- await (0, _pWaitFor.default)(() => session?.initialized);
77
- if (isMyself) {
78
- return session.user;
79
- }
80
- if (currentDid) {
81
- return _client.client.user.getUserPublicInfo({
82
- did: currentDid
83
- });
64
+ const userState = useRequest(
65
+ // eslint-disable-next-line consistent-return
66
+ async () => {
67
+ await pWaitFor(() => session?.initialized);
68
+ if (isMyself) {
69
+ return session.user;
70
+ }
71
+ if (currentDid) {
72
+ return client.user.getUserPublicInfo({ did: currentDid });
73
+ }
74
+ },
75
+ {
76
+ refreshDeps: [currentDid, isMyself, session?.initialized, session?.user]
84
77
  }
85
- }, {
86
- refreshDeps: [currentDid, isMyself, session?.initialized, session?.user]
87
- });
88
- const privacyState = (0, _ahooks.useRequest)(async () => {
89
- if (userState.data && currentTab) {
90
- const config = await _client.client.user.getUserPrivacyConfig({
91
- did: currentDid
92
- });
93
- return config;
78
+ );
79
+ const privacyState = useRequest(
80
+ async () => {
81
+ if (userState.data && currentTab) {
82
+ const config = await client.user.getUserPrivacyConfig({ did: currentDid });
83
+ return config;
84
+ }
85
+ return null;
86
+ },
87
+ {
88
+ refreshDeps: [currentDid, userState.data, currentTab],
89
+ loadingDelay: 300
94
90
  }
95
- return null;
96
- }, {
97
- refreshDeps: [currentDid, userState.data, currentTab],
98
- loadingDelay: 300
99
- });
100
- const {
101
- confirmHolder,
102
- confirmApi
103
- } = (0, _Dialog.useConfirm)({
91
+ );
92
+ const { confirmHolder, confirmApi } = useConfirm({
104
93
  sx: {
105
94
  ".MuiDialog-paper": {
106
95
  borderRadius: 2,
@@ -120,19 +109,19 @@ function UserCenter({
120
109
  }
121
110
  }
122
111
  });
123
- const formattedBlocklet = (0, _ahooks.useCreation)(() => {
124
- const blocklet = (0, _cloneDeep.default)(window.blocklet);
112
+ const formattedBlocklet = useCreation(() => {
113
+ const blocklet = cloneDeep(window.blocklet);
125
114
  try {
126
- return (0, _blocklets.formatBlockletInfo)(blocklet);
115
+ return formatBlockletInfo(blocklet);
127
116
  } catch (e) {
128
117
  console.error("Failed to format blocklet info", e, blocklet);
129
118
  return blocklet;
130
119
  }
131
120
  }, []);
132
- const userCenterTabs = (0, _ahooks.useCreation)(() => {
121
+ const userCenterTabs = useCreation(() => {
133
122
  const menus = formattedBlocklet?.navigation?.userCenter || [];
134
- const localizedMenus = (0, _blocklets.getLocalizedNavigation)(menus, locale) || [];
135
- return localizedMenus.map(x => {
123
+ const localizedMenus = getLocalizedNavigation(menus, locale) || [];
124
+ return localizedMenus.map((x) => {
136
125
  const value = x._rawLink ?? x.link;
137
126
  return {
138
127
  value,
@@ -143,30 +132,31 @@ function UserCenter({
143
132
  };
144
133
  });
145
134
  }, [formattedBlocklet, userState.data, privacyState?.data, locale]);
146
- const currentActiveTab = (0, _ahooks.useCreation)(() => {
147
- return userCenterTabs.find(x => x.value === currentTab);
135
+ const currentActiveTab = useCreation(() => {
136
+ return userCenterTabs.find((x) => x.value === currentTab);
148
137
  }, [userCenterTabs]);
149
- const handleChangeTab = (0, _ahooks.useMemoizedFn)(value => {
150
- const findTab = userCenterTabs.find(x => x.value === value);
138
+ const handleChangeTab = useMemoizedFn((value) => {
139
+ const findTab = userCenterTabs.find((x) => x.value === value);
151
140
  if (findTab) {
152
- window.location.href = (0, _ufo.withQuery)(findTab.url, {
141
+ window.location.href = withQuery(findTab.url, {
153
142
  did: isMyself ? void 0 : currentDid
154
143
  });
155
144
  }
156
145
  });
157
- const settingContent = (0, _ahooks.useCreation)(() => {
158
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_settings.default, {
159
- user: userState.data,
160
- settings: {
161
- userCenterTabs
162
- },
163
- onSave: async () => {
164
- await privacyState.runAsync();
165
- return privacyState.data;
146
+ const settingContent = useCreation(() => {
147
+ return /* @__PURE__ */ jsx(
148
+ Settings,
149
+ {
150
+ user: userState.data,
151
+ settings: { userCenterTabs },
152
+ onSave: async () => {
153
+ await privacyState.runAsync();
154
+ return privacyState.data;
155
+ }
166
156
  }
167
- });
157
+ );
168
158
  }, [userState.data]);
169
- const openSettings = (0, _ahooks.useMemoizedFn)(() => {
159
+ const openSettings = useMemoizedFn(() => {
170
160
  confirmApi.open({
171
161
  title: t("settings"),
172
162
  content: settingContent,
@@ -175,17 +165,17 @@ function UserCenter({
175
165
  onConfirm: confirmApi.close
176
166
  });
177
167
  });
178
- (0, _ahooks.useUpdateEffect)(() => {
168
+ useUpdateEffect(() => {
179
169
  confirmApi.update({
180
170
  content: settingContent
181
171
  });
182
172
  }, [settingContent]);
183
- (0, _ahooks.useMount)(() => {
173
+ useMount(() => {
184
174
  if (autoPopupSetting) {
185
175
  openSettings();
186
176
  }
187
177
  });
188
- const content = (0, _ahooks.useCreation)(() => {
178
+ const content = useCreation(() => {
189
179
  if (userState.loading || session.loading) {
190
180
  return null;
191
181
  }
@@ -194,24 +184,15 @@ function UserCenter({
194
184
  const formatError = {
195
185
  message: errorMessage
196
186
  };
197
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
198
- sx: {
199
- width: "100%"
200
- },
201
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_ErrorBoundary.ErrorFallback, {
202
- error: formatError
203
- })
204
- });
187
+ return /* @__PURE__ */ jsx(Box, { sx: { width: "100%" }, children: /* @__PURE__ */ jsx(ErrorFallback, { error: formatError }) });
205
188
  }
206
189
  if (!currentDid && !userState.data) {
207
190
  if (notLoginContent) {
208
191
  return notLoginContent;
209
192
  }
210
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
211
- sx: {
212
- width: "100%"
213
- },
214
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
193
+ return /* @__PURE__ */ jsx(Box, { sx: { width: "100%" }, children: /* @__PURE__ */ jsxs(
194
+ Box,
195
+ {
215
196
  sx: {
216
197
  display: "flex",
217
198
  flexDirection: "column",
@@ -219,207 +200,215 @@ function UserCenter({
219
200
  alignItems: "center",
220
201
  gap: 1
221
202
  },
222
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Empty.default, {
223
- children: t("viewAfterLogin")
224
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_Button.default, {
225
- size: "small",
226
- variant: "contained",
227
- onClick: () => session.login(),
228
- children: t("loginNow")
229
- })]
230
- })
231
- });
203
+ children: [
204
+ /* @__PURE__ */ jsx(Empty, { children: t("viewAfterLogin") }),
205
+ /* @__PURE__ */ jsx(Button, { size: "small", variant: "contained", onClick: () => session.login(), children: t("loginNow") })
206
+ ]
207
+ }
208
+ ) });
232
209
  }
233
- return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
234
- children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
235
- sx: {
236
- flex: 1,
237
- overflow: "hidden"
238
- },
239
- children: [userState?.data?.fullName ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
240
- variant: "h4",
241
- sx: {
242
- py: 1.5,
243
- fontWeight: 700,
244
- display: {
245
- xs: "none",
246
- md: "block"
247
- }
248
- },
249
- children: userState.data.fullName
250
- }) : null, /* @__PURE__ */(0, _jsxRuntime.jsx)(_userInfo.UserBasicInfo, {
251
- isMyself,
252
- switchPassport: session.switchPassport,
253
- switchProfile: session.switchProfile,
254
- openSettings,
255
- user: userState.data,
256
- showFullDid: false,
257
- sx: {
258
- display: {
259
- md: "none",
260
- xs: "block"
210
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
211
+ /* @__PURE__ */ jsxs(Box, { sx: { flex: 1, overflow: "hidden" }, children: [
212
+ userState?.data?.fullName ? /* @__PURE__ */ jsx(
213
+ Typography,
214
+ {
215
+ variant: "h4",
216
+ sx: {
217
+ py: 1.5,
218
+ fontWeight: 700,
219
+ display: {
220
+ xs: "none",
221
+ md: "block"
222
+ }
261
223
  },
262
- mb: 1.5
224
+ children: userState.data.fullName
263
225
  }
264
- }), userCenterTabs.length > 0 && currentTab ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
265
- sx: {
266
- overflow: "auto",
267
- padding: "1px"
268
- },
269
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Tabs.default, {
270
- variant: "line",
271
- tabs: userCenterTabs,
272
- current: currentTab,
273
- onChange: handleChangeTab,
226
+ ) : null,
227
+ /* @__PURE__ */ jsx(
228
+ UserBasicInfo,
229
+ {
230
+ isMyself,
231
+ switchPassport: session.switchPassport,
232
+ switchProfile: session.switchProfile,
233
+ openSettings,
234
+ user: userState.data,
235
+ showFullDid: false,
274
236
  sx: {
237
+ display: {
238
+ md: "none",
239
+ xs: "block"
240
+ },
275
241
  mb: 1.5
276
242
  }
277
- }), !privacyState.data || privacyState.loading ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
243
+ }
244
+ ),
245
+ userCenterTabs.length > 0 && currentTab ? /* @__PURE__ */ jsxs(
246
+ Box,
247
+ {
278
248
  sx: {
279
- height: "100%",
280
- minWidth: "160px",
281
- minHeight: "160px",
282
- display: "flex",
283
- justifyContent: "center",
284
- alignItems: "center"
249
+ overflow: "auto",
250
+ padding: "1px"
285
251
  },
286
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.CircularProgress, {
287
- sx: {
288
- color: _Colors.temp.primary100
289
- }
290
- })
291
- }) :
292
- // eslint-disable-next-line react/jsx-no-useless-fragment
293
- /* @__PURE__ */
294
- (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
295
- children: currentActiveTab?.protected && !isMyself ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
296
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Empty.default, {
297
- children: t("underProtected")
298
- })
299
- }) :
300
- // eslint-disable-next-line react/jsx-no-useless-fragment
301
- /* @__PURE__ */
302
- (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
303
- children: children && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
304
- ...contentProps,
305
- children
306
- })
307
- })
308
- })]
309
- }) : null, userCenterTabs.length === 0 ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
252
+ children: [
253
+ /* @__PURE__ */ jsx(
254
+ Tabs,
255
+ {
256
+ variant: "line",
257
+ tabs: userCenterTabs,
258
+ current: currentTab,
259
+ onChange: handleChangeTab,
260
+ sx: { mb: 1.5 }
261
+ }
262
+ ),
263
+ !privacyState.data || privacyState.loading ? /* @__PURE__ */ jsx(
264
+ Box,
265
+ {
266
+ sx: {
267
+ height: "100%",
268
+ minWidth: "160px",
269
+ minHeight: "160px",
270
+ display: "flex",
271
+ justifyContent: "center",
272
+ alignItems: "center"
273
+ },
274
+ children: /* @__PURE__ */ jsx(CircularProgress, { sx: { color: colors.primary100 } })
275
+ }
276
+ ) : (
277
+ // eslint-disable-next-line react/jsx-no-useless-fragment
278
+ /* @__PURE__ */ jsx(Fragment, { children: currentActiveTab?.protected && !isMyself ? /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Empty, { children: t("underProtected") }) }) : (
279
+ // eslint-disable-next-line react/jsx-no-useless-fragment
280
+ /* @__PURE__ */ jsx(Fragment, { children: children && /* @__PURE__ */ jsx(Box, { ...contentProps, children }) })
281
+ ) })
282
+ )
283
+ ]
284
+ }
285
+ ) : null,
286
+ userCenterTabs.length === 0 ? /* @__PURE__ */ jsx(
287
+ Box,
288
+ {
289
+ sx: {
290
+ display: {
291
+ xs: isMyself ? "none" : "block",
292
+ md: "block"
293
+ },
294
+ py: 3
295
+ },
296
+ children: /* @__PURE__ */ jsx(Empty, { children: t("emptyContent") })
297
+ }
298
+ ) : null
299
+ ] }),
300
+ /* @__PURE__ */ jsx(
301
+ Box,
302
+ {
310
303
  sx: {
311
304
  display: {
312
- xs: isMyself ? "none" : "block",
305
+ xs: "none",
313
306
  md: "block"
314
307
  },
315
- py: 3
316
- },
317
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Empty.default, {
318
- children: t("emptyContent")
319
- })
320
- }) : null]
321
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
322
- sx: {
323
- display: {
324
- xs: "none",
325
- md: "block"
326
- },
327
- width: "1px",
328
- my: -3,
329
- backgroundColor: _Colors.temp.strokeSep
308
+ width: "1px",
309
+ my: -3,
310
+ backgroundColor: colors.strokeSep
311
+ }
330
312
  }
331
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
332
- sx: {
333
- width: {
334
- sx: "100%",
335
- md: 420
336
- },
337
- maxWidth: "100%",
338
- position: "relative"
339
- },
340
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
313
+ ),
314
+ /* @__PURE__ */ jsx(
315
+ Box,
316
+ {
341
317
  sx: {
342
- display: "flex",
343
- flexDirection: "column",
344
- gap: 2.5,
345
- position: {
346
- xs: "static",
347
- md: stickySidebar ? "sticky" : "static"
318
+ width: {
319
+ sx: "100%",
320
+ md: 420
348
321
  },
349
- top: theme => stickySidebar ? theme.spacing(3) : "unset"
322
+ maxWidth: "100%",
323
+ position: "relative"
350
324
  },
351
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_userInfo.UserBasicInfo, {
352
- isMyself,
353
- switchPassport: session.switchPassport,
354
- switchProfile: session.switchProfile,
355
- openSettings,
356
- user: userState.data,
357
- sx: {
358
- display: {
359
- xs: "none",
360
- md: "block"
361
- }
362
- }
363
- }), isMyself ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
364
- children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
365
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
366
- sx: {
367
- fontWeight: 600,
368
- mb: 1.5
369
- },
370
- children: t("myInfo")
371
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_userInfo.UserInfo, {
372
- user: userState.data
373
- })]
374
- }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
375
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
376
- sx: {
377
- fontWeight: 600,
378
- mb: 1.5
325
+ children: /* @__PURE__ */ jsxs(
326
+ Box,
327
+ {
328
+ sx: {
329
+ display: "flex",
330
+ flexDirection: "column",
331
+ gap: 2.5,
332
+ position: {
333
+ xs: "static",
334
+ md: stickySidebar ? "sticky" : "static"
379
335
  },
380
- children: t("passport")
381
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_passport.default, {
382
- user: userState.data
383
- })]
384
- })]
385
- }) : null]
386
- })
387
- })]
388
- });
336
+ top: (theme) => stickySidebar ? theme.spacing(3) : "unset"
337
+ },
338
+ children: [
339
+ /* @__PURE__ */ jsx(
340
+ UserBasicInfo,
341
+ {
342
+ isMyself,
343
+ switchPassport: session.switchPassport,
344
+ switchProfile: session.switchProfile,
345
+ openSettings,
346
+ user: userState.data,
347
+ sx: {
348
+ display: {
349
+ xs: "none",
350
+ md: "block"
351
+ }
352
+ }
353
+ }
354
+ ),
355
+ isMyself ? /* @__PURE__ */ jsxs(Fragment, { children: [
356
+ /* @__PURE__ */ jsxs(Box, { children: [
357
+ /* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 600, mb: 1.5 }, children: t("myInfo") }),
358
+ /* @__PURE__ */ jsx(UserInfo, { user: userState.data })
359
+ ] }),
360
+ /* @__PURE__ */ jsxs(Box, { children: [
361
+ /* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 600, mb: 1.5 }, children: t("passport") }),
362
+ /* @__PURE__ */ jsx(Passport, { user: userState.data })
363
+ ] })
364
+ ] }) : null
365
+ ]
366
+ }
367
+ )
368
+ }
369
+ )
370
+ ] });
389
371
  }, [userState, userCenterTabs, isMyself, currentActiveTab, privacyState, currentTab, stickySidebar]);
390
372
  if (!disableAutoRedirect && !currentTab && formattedBlocklet?.navigation?.userCenter?.length > 0) {
391
373
  window.location.replace(formattedBlocklet?.navigation?.userCenter[0]?.link);
392
374
  return null;
393
375
  }
394
- return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
395
- sx: {
396
- backgroundColor: _Colors.temp.backgroundsBgSubtitle,
397
- minHeight: "100vh",
398
- display: "flex",
399
- flexDirection: "column"
400
- },
401
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Header.default, {
402
- bordered: true,
403
- ...headerProps
404
- }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
405
- flex: 1,
376
+ return /* @__PURE__ */ jsxs(
377
+ Box,
378
+ {
406
379
  sx: {
407
- width: "100%",
408
- maxWidth: 1200,
409
- margin: "0 auto",
410
- p: 3,
380
+ backgroundColor: colors.backgroundsBgSubtitle,
381
+ minHeight: "100vh",
411
382
  display: "flex",
412
- alignItems: "stretch",
413
- flexDirection: {
414
- xs: "column",
415
- md: "row"
416
- },
417
- gap: 2.5
383
+ flexDirection: "column"
418
384
  },
419
- children: [content, confirmHolder]
420
- }), hideFooter ? null : /* @__PURE__ */(0, _jsxRuntime.jsx)(_Footer.default, {
421
- bordered: true,
422
- ...footerProps
423
- })]
424
- });
425
- }
385
+ children: [
386
+ /* @__PURE__ */ jsx(Header, { bordered: true, ...headerProps }),
387
+ /* @__PURE__ */ jsxs(
388
+ Box,
389
+ {
390
+ flex: 1,
391
+ sx: {
392
+ width: "100%",
393
+ maxWidth: 1200,
394
+ margin: "0 auto",
395
+ p: 3,
396
+ display: "flex",
397
+ alignItems: "stretch",
398
+ flexDirection: {
399
+ xs: "column",
400
+ md: "row"
401
+ },
402
+ gap: 2.5
403
+ },
404
+ children: [
405
+ content,
406
+ confirmHolder
407
+ ]
408
+ }
409
+ ),
410
+ hideFooter ? null : /* @__PURE__ */ jsx(Footer, { bordered: true, ...footerProps })
411
+ ]
412
+ }
413
+ );
414
+ }