@blocklet/ui-react 3.0.9 → 3.0.10

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 (51) hide show
  1. package/lib/BlockletStudio/index.js +70 -71
  2. package/lib/ComponentInstaller/index.js +85 -88
  3. package/lib/ComponentInstaller/installer-item.js +47 -53
  4. package/lib/ComponentInstaller/use-component-installed.js +32 -38
  5. package/lib/ComponentManager/components/add-component.js +47 -50
  6. package/lib/ComponentManager/components/publish-component.js +30 -31
  7. package/lib/ComponentManager/components/resource-dialog.js +28 -30
  8. package/lib/Dashboard/index.d.ts +1 -1
  9. package/lib/Dashboard/index.js +59 -61
  10. package/lib/Footer/index.js +51 -52
  11. package/lib/Footer/internal-footer.js +43 -47
  12. package/lib/Footer/layout/standard.js +11 -12
  13. package/lib/Footer/links.js +25 -28
  14. package/lib/Footer/social-media.js +17 -17
  15. package/lib/Header/index.js +81 -83
  16. package/lib/Notifications/Snackbar.js +76 -77
  17. package/lib/Notifications/hooks/use-title.js +34 -34
  18. package/lib/Notifications/utils.js +56 -60
  19. package/lib/UserCenter/components/config-inviter.js +17 -18
  20. package/lib/UserCenter/components/danger-zone.js +49 -52
  21. package/lib/UserCenter/components/nft.js +44 -45
  22. package/lib/UserCenter/components/notification.js +92 -99
  23. package/lib/UserCenter/components/passport.js +22 -22
  24. package/lib/UserCenter/components/privacy.js +6 -6
  25. package/lib/UserCenter/components/settings.js +40 -43
  26. package/lib/UserCenter/components/status-dialog/date-picker.js +7 -8
  27. package/lib/UserCenter/components/status-dialog/index.js +112 -114
  28. package/lib/UserCenter/components/status-selector/duration-menu.js +35 -36
  29. package/lib/UserCenter/components/status-selector/index.js +13 -13
  30. package/lib/UserCenter/components/storage/action.js +21 -22
  31. package/lib/UserCenter/components/storage/delete.js +24 -24
  32. package/lib/UserCenter/components/third-party-login/index.js +53 -53
  33. package/lib/UserCenter/components/third-party-login/third-party-item.js +87 -89
  34. package/lib/UserCenter/components/user-center.js +198 -207
  35. package/lib/UserCenter/components/user-info/metadata.js +343 -353
  36. package/lib/UserCenter/components/user-info/switch-role.js +17 -20
  37. package/lib/UserCenter/components/user-info/user-basic-info.js +79 -82
  38. package/lib/UserCenter/components/user-info/user-info.js +40 -40
  39. package/lib/UserCenter/components/user-info/user-status.js +97 -99
  40. package/lib/UserCenter/components/user-info/utils.js +34 -35
  41. package/lib/UserSessions/components/user-session-info.js +25 -28
  42. package/lib/UserSessions/components/user-sessions.js +169 -181
  43. package/lib/blocklets.js +62 -72
  44. package/lib/common/domain-warning.js +31 -31
  45. package/lib/common/header-addons.d.ts +1 -1
  46. package/lib/common/header-addons.js +49 -53
  47. package/lib/common/notification-addon.js +29 -32
  48. package/lib/common/ws.js +17 -18
  49. package/lib/contexts/config-user-space.js +16 -19
  50. package/lib/utils.js +44 -48
  51. package/package.json +6 -6
@@ -1,17 +1,17 @@
1
- import { jsxs as n, jsx as r, Fragment as Q } from "react/jsx-runtime";
2
- import { useState as s, useEffect as V, useMemo as G, Suspense as z, createElement as W } from "react";
3
- import { Dialog as H, DialogTitle as J, Typography as g, IconButton as K, DialogContent as U, FormControl as w, InputLabel as M, Select as R, MenuItem as T, ListItemIcon as B, Box as v, DialogActions as X, Button as b } from "@mui/material";
4
- import C from "dayjs";
5
- import { Close as Y } from "@mui/icons-material";
6
- import { translate as Z } from "@arcblock/ux/lib/Locale/util";
7
- import { useMemoizedFn as _ } from "ahooks";
8
- import A from "@arcblock/icons/lib/ArrowDown";
9
- import { useLocaleContext as $ } from "@arcblock/ux/lib/Locale/context";
10
- import { DurationEnum as p } from "../../../@types/index.js";
11
- import { translations as oo } from "../../libs/locales.js";
12
- import io from "./date-picker.js";
13
- import { defaultButtonStyle as E, primaryButtonStyle as ro } from "../user-info/utils.js";
14
- const O = {
1
+ import { jsxs as i, jsx as e, Fragment as P } from "react/jsx-runtime";
2
+ import { useState as c, useEffect as q, useMemo as Q, Suspense as D, createElement as I } from "react";
3
+ import { Dialog as V, DialogTitle as G, Typography as f, IconButton as H, DialogContent as J, FormControl as k, InputLabel as z, Select as W, MenuItem as w, ListItemIcon as M, Box as g, DialogActions as K, Button as v } from "@mui/material";
4
+ import b from "dayjs";
5
+ import { Close as U } from "@mui/icons-material";
6
+ import { translate as X } from "@arcblock/ux/lib/Locale/util";
7
+ import { useMemoizedFn as Y } from "ahooks";
8
+ import R from "@arcblock/icons/lib/ArrowDown";
9
+ import { useLocaleContext as Z } from "@arcblock/ux/lib/Locale/context";
10
+ import { DurationEnum as u } from "../../../@types/index.js";
11
+ import { translations as _ } from "../../libs/locales.js";
12
+ import $ from "./date-picker.js";
13
+ import { defaultButtonStyle as T, primaryButtonStyle as tt } from "../user-info/utils.js";
14
+ const B = {
15
15
  padding: "8px 16px",
16
16
  borderRadius: "8px",
17
17
  "&:hover": {
@@ -29,43 +29,41 @@ const O = {
29
29
  alignItems: "center"
30
30
  }
31
31
  };
32
- function go({
33
- open: j,
34
- onClose: u,
35
- data: m,
36
- selected: i,
37
- onSelect: h,
38
- timezone: F = void 0
32
+ function ht({
33
+ open: A,
34
+ onClose: d,
35
+ data: p,
36
+ selected: n,
37
+ onSelect: m,
38
+ timezone: E = void 0
39
39
  }) {
40
- var I, k;
41
- const { locale: L } = $(), t = _((o, e = {}) => Z(oo, o, L, "en", e)), [l, S] = s((i == null ? void 0 : i.value) || ""), [a, y] = s((i == null ? void 0 : i.duration) || ""), [d, x] = s(((I = i == null ? void 0 : i.dateRange) == null ? void 0 : I[1]) || ""), [N, c] = s(!1);
42
- V(() => {
43
- var o;
44
- S((i == null ? void 0 : i.value) || ""), y((i == null ? void 0 : i.duration) || ""), x(((o = i == null ? void 0 : i.dateRange) == null ? void 0 : o[1]) || "");
45
- }, [i]);
46
- const P = G(() => l && a, [l, a]), f = m.find((o) => o.id === l), q = (o) => {
47
- h({
48
- value: o.id,
49
- ...o.duration ? { duration: o.duration } : {}
50
- }), u();
51
- }, D = (o = !1) => {
52
- if (o)
53
- h(void 0);
40
+ const { locale: O } = Z(), o = Y((t, a = {}) => X(_, t, O, "en", a)), [l, C] = c(n?.value || ""), [r, S] = c(n?.duration || ""), [s, h] = c(n?.dateRange?.[1] || ""), [j, x] = c(!1);
41
+ q(() => {
42
+ C(n?.value || ""), S(n?.duration || ""), h(n?.dateRange?.[1] || "");
43
+ }, [n]);
44
+ const F = Q(() => l && r, [l, r]), L = p.find((t) => t.id === l), N = (t) => {
45
+ m({
46
+ value: t.id,
47
+ ...t.duration ? { duration: t.duration } : {}
48
+ }), d();
49
+ }, y = (t = !1) => {
50
+ if (t)
51
+ m(void 0);
54
52
  else {
55
- const e = C();
56
- h({
53
+ const a = b();
54
+ m({
57
55
  value: l,
58
- ...a ? { duration: a } : {},
59
- ...a === p.Custom && d ? { dateRange: [e.toDate(), C(d).toDate()] } : {}
56
+ ...r ? { duration: r } : {},
57
+ ...r === u.Custom && s ? { dateRange: [a.toDate(), b(s).toDate()] } : {}
60
58
  });
61
59
  }
62
- u();
60
+ d();
63
61
  };
64
- return /* @__PURE__ */ n(
65
- H,
62
+ return /* @__PURE__ */ i(
63
+ V,
66
64
  {
67
- open: j,
68
- onClose: u,
65
+ open: A,
66
+ onClose: d,
69
67
  maxWidth: "xs",
70
68
  fullWidth: !0,
71
69
  PaperProps: {
@@ -74,78 +72,78 @@ function go({
74
72
  }
75
73
  },
76
74
  children: [
77
- /* @__PURE__ */ n(J, { sx: { borderBottom: "1px solid", borderColor: "divider" }, children: [
78
- /* @__PURE__ */ r(g, { variant: "body1", sx: { fontSize: "16px !important", mb: 0 }, children: t("profile.setStatus") }),
79
- /* @__PURE__ */ r(
80
- K,
75
+ /* @__PURE__ */ i(G, { sx: { borderBottom: "1px solid", borderColor: "divider" }, children: [
76
+ /* @__PURE__ */ e(f, { variant: "body1", sx: { fontSize: "16px !important", mb: 0 }, children: o("profile.setStatus") }),
77
+ /* @__PURE__ */ e(
78
+ H,
81
79
  {
82
80
  "aria-label": "close",
83
- onClick: u,
81
+ onClick: d,
84
82
  sx: {
85
83
  position: "absolute",
86
84
  right: 8,
87
85
  top: 8,
88
- color: (o) => o.palette.grey[500]
86
+ color: (t) => t.palette.grey[500]
89
87
  },
90
- children: /* @__PURE__ */ r(Y, {})
88
+ children: /* @__PURE__ */ e(U, {})
91
89
  }
92
90
  )
93
91
  ] }),
94
- /* @__PURE__ */ n(U, { children: [
95
- /* @__PURE__ */ n(w, { fullWidth: !0, sx: { mt: 2 }, children: [
96
- /* @__PURE__ */ r(M, { size: "small", sx: { fontSize: "14px" }, children: t("profile.setStatus") }),
97
- /* @__PURE__ */ r(
98
- R,
92
+ /* @__PURE__ */ i(J, { children: [
93
+ /* @__PURE__ */ i(k, { fullWidth: !0, sx: { mt: 2 }, children: [
94
+ /* @__PURE__ */ e(z, { size: "small", sx: { fontSize: "14px" }, children: o("profile.setStatus") }),
95
+ /* @__PURE__ */ e(
96
+ W,
99
97
  {
100
98
  value: l,
101
- label: t("profile.setStatus"),
102
- onChange: (o) => {
103
- S(o.target.value), c(!0);
99
+ label: o("profile.setStatus"),
100
+ onChange: (t) => {
101
+ C(t.target.value), x(!0);
104
102
  },
105
103
  variant: "outlined",
106
- IconComponent: (o) => /* @__PURE__ */ r(A, { ...o, width: 20, height: 20 }),
107
- sx: O,
108
- children: m.map((o) => /* @__PURE__ */ r(T, { value: o.id, children: /* @__PURE__ */ n(z, { fallback: null, children: [
109
- o.icon && /* @__PURE__ */ r(B, { style: { minWidth: "24px" }, children: W(o.icon, {
104
+ IconComponent: (t) => /* @__PURE__ */ e(R, { ...t, width: 20, height: 20 }),
105
+ sx: B,
106
+ children: p.map((t) => /* @__PURE__ */ e(w, { value: t.id, children: /* @__PURE__ */ i(D, { fallback: null, children: [
107
+ t.icon && /* @__PURE__ */ e(M, { style: { minWidth: "24px" }, children: I(t.icon, {
110
108
  style: { fontSize: "16px", width: "16px", height: "16px" }
111
109
  }) }),
112
- o.name
113
- ] }) }, o.id))
110
+ t.name
111
+ ] }) }, t.id))
114
112
  }
115
113
  )
116
114
  ] }),
117
- l ? /* @__PURE__ */ n(w, { fullWidth: !0, sx: { mt: "24px" }, children: [
118
- /* @__PURE__ */ r(M, { size: "small", sx: { fontSize: "14px" }, children: t("profile.removeStatusAfter") }),
119
- /* @__PURE__ */ r(
120
- R,
115
+ l ? /* @__PURE__ */ i(k, { fullWidth: !0, sx: { mt: "24px" }, children: [
116
+ /* @__PURE__ */ e(z, { size: "small", sx: { fontSize: "14px" }, children: o("profile.removeStatusAfter") }),
117
+ /* @__PURE__ */ e(
118
+ W,
121
119
  {
122
- value: a,
123
- label: t("profile.removeStatusAfter"),
124
- onChange: (o) => {
125
- const { value: e } = o.target;
126
- y(e), e === p.Custom && x(C().toDate()), c(!0);
120
+ value: r,
121
+ label: o("profile.removeStatusAfter"),
122
+ onChange: (t) => {
123
+ const { value: a } = t.target;
124
+ S(a), a === u.Custom && h(b().toDate()), x(!0);
127
125
  },
128
126
  variant: "outlined",
129
- IconComponent: (o) => /* @__PURE__ */ r(A, { ...o, width: 20, height: 20 }),
130
- sx: O,
131
- children: (k = f == null ? void 0 : f.children) == null ? void 0 : k.map((o) => /* @__PURE__ */ r(T, { value: o.id, children: o.name }, o.id))
127
+ IconComponent: (t) => /* @__PURE__ */ e(R, { ...t, width: 20, height: 20 }),
128
+ sx: B,
129
+ children: L?.children?.map((t) => /* @__PURE__ */ e(w, { value: t.id, children: t.name }, t.id))
132
130
  }
133
131
  )
134
- ] }) : /* @__PURE__ */ n(v, { sx: { mt: "24px" }, children: [
135
- /* @__PURE__ */ r(
136
- g,
132
+ ] }) : /* @__PURE__ */ i(g, { sx: { mt: "24px" }, children: [
133
+ /* @__PURE__ */ e(
134
+ f,
137
135
  {
138
136
  variant: "body2",
139
137
  sx: {
140
138
  color: "text.secondary"
141
139
  },
142
- children: t("profile.quickSettings")
140
+ children: o("profile.quickSettings")
143
141
  }
144
142
  ),
145
- m.map((o) => /* @__PURE__ */ r(
146
- v,
143
+ p.map((t) => /* @__PURE__ */ e(
144
+ g,
147
145
  {
148
- onClick: () => q(o),
146
+ onClick: () => N(t),
149
147
  sx: {
150
148
  display: "flex",
151
149
  alignItems: "center",
@@ -157,13 +155,13 @@ function go({
157
155
  bgcolor: "action.hover"
158
156
  }
159
157
  },
160
- children: /* @__PURE__ */ n(z, { fallback: null, children: [
161
- o.icon && /* @__PURE__ */ r(B, { style: { minWidth: "24px" }, children: W(o.icon, {
158
+ children: /* @__PURE__ */ i(D, { fallback: null, children: [
159
+ t.icon && /* @__PURE__ */ e(M, { style: { minWidth: "24px" }, children: I(t.icon, {
162
160
  style: { fontSize: "16px", width: "16px", height: "16px" }
163
161
  }) }),
164
- o.name,
165
- o.durationName && /* @__PURE__ */ n(
166
- g,
162
+ t.name,
163
+ t.durationName && /* @__PURE__ */ i(
164
+ f,
167
165
  {
168
166
  variant: "body2",
169
167
  sx: {
@@ -171,55 +169,55 @@ function go({
171
169
  },
172
170
  children: [
173
171
  "- ",
174
- o.durationName
172
+ t.durationName
175
173
  ]
176
174
  }
177
175
  )
178
176
  ] })
179
177
  },
180
- o.id
178
+ t.id
181
179
  ))
182
180
  ] }),
183
- a === p.Custom && /* @__PURE__ */ r(v, { sx: { mt: "24px" }, children: /* @__PURE__ */ r(
184
- io,
181
+ r === u.Custom && /* @__PURE__ */ e(g, { sx: { mt: "24px" }, children: /* @__PURE__ */ e(
182
+ $,
185
183
  {
186
- value: d,
187
- onChange: (o) => {
188
- x(o), c(!0);
184
+ value: s,
185
+ onChange: (t) => {
186
+ h(t), x(!0);
189
187
  },
190
- label: t("profile.selectEndTime"),
191
- timezone: F,
192
- error: a === p.Custom && !d,
193
- helperText: a === p.Custom && !d ? t("profile.pleaseSelectTime") : void 0
188
+ label: o("profile.selectEndTime"),
189
+ timezone: E,
190
+ error: r === u.Custom && !s,
191
+ helperText: r === u.Custom && !s ? o("profile.pleaseSelectTime") : void 0
194
192
  }
195
193
  ) })
196
194
  ] }),
197
- /* @__PURE__ */ r(X, { sx: { p: "16px 24px", borderTop: "1px solid", borderColor: "divider" }, children: i != null && i.value && !N ? /* @__PURE__ */ r(
198
- b,
195
+ /* @__PURE__ */ e(K, { sx: { p: "16px 24px", borderTop: "1px solid", borderColor: "divider" }, children: n?.value && !j ? /* @__PURE__ */ e(
196
+ v,
199
197
  {
200
- sx: { ...E, minWidth: "54px" },
198
+ sx: { ...T, minWidth: "54px" },
201
199
  size: "small",
202
200
  variant: "outlined",
203
- onClick: () => D(!0),
204
- children: t("profile.cleanStatus")
201
+ onClick: () => y(!0),
202
+ children: o("profile.cleanStatus")
205
203
  }
206
- ) : /* @__PURE__ */ n(Q, { children: [
207
- /* @__PURE__ */ r(b, { size: "small", variant: "outlined", sx: { ...E, minWidth: "54px" }, onClick: u, children: t("common.cancel") }),
208
- /* @__PURE__ */ r(
209
- b,
204
+ ) : /* @__PURE__ */ i(P, { children: [
205
+ /* @__PURE__ */ e(v, { size: "small", variant: "outlined", sx: { ...T, minWidth: "54px" }, onClick: d, children: o("common.cancel") }),
206
+ /* @__PURE__ */ e(
207
+ v,
210
208
  {
211
209
  sx: {
212
- ...ro,
210
+ ...tt,
213
211
  minWidth: "54px",
214
212
  "&.Mui-disabled": {
215
213
  backgroundColor: "rgba(0, 0, 0, 0.12)"
216
214
  }
217
215
  },
218
- disabled: !P,
219
- onClick: () => D(!1),
216
+ disabled: !F,
217
+ onClick: () => y(!1),
220
218
  size: "small",
221
219
  variant: "outlined",
222
- children: t("common.confirm")
220
+ children: o("common.confirm")
223
221
  }
224
222
  )
225
223
  ] }) })
@@ -228,5 +226,5 @@ function go({
228
226
  );
229
227
  }
230
228
  export {
231
- go as default
229
+ ht as default
232
230
  };
@@ -1,30 +1,29 @@
1
- import { jsxs as a, Fragment as g, jsx as i } from "react/jsx-runtime";
2
- import { styled as x, Menu as v, Typography as y } from "@mui/material";
3
- import { useState as z } from "react";
4
- import { useLocaleContext as C } from "@arcblock/ux/lib/Locale/context";
5
- import { useMemoizedFn as b } from "ahooks";
6
- import { translate as k } from "@arcblock/ux/lib/Locale/util";
7
- import { translations as D } from "../../libs/locales.js";
8
- import s, { StyledMenu as j } from "./menu-item.js";
9
- function I({ data: n, selected: r, onSelect: m }) {
10
- var c;
11
- const { locale: p } = C(), f = b((o, t = {}) => k(D, o, p, "en", t)), [e, l] = z(null), h = !!e, S = (o) => {
1
+ import { jsxs as s, Fragment as M, jsx as r } from "react/jsx-runtime";
2
+ import { styled as g, Menu as x, Typography as v } from "@mui/material";
3
+ import { useState as y } from "react";
4
+ import { useLocaleContext as z } from "@arcblock/ux/lib/Locale/context";
5
+ import { useMemoizedFn as C } from "ahooks";
6
+ import { translate as b } from "@arcblock/ux/lib/Locale/util";
7
+ import { translations as k } from "../../libs/locales.js";
8
+ import u, { StyledMenu as D } from "./menu-item.js";
9
+ function B({ data: n, selected: t, onSelect: a }) {
10
+ const { locale: m } = z(), p = C((o, e = {}) => b(k, o, m, "en", e)), [i, l] = y(null), d = !!i, f = (o) => {
12
11
  l(o.currentTarget);
13
- }, u = () => {
12
+ }, c = () => {
14
13
  l(null);
15
- }, d = (o) => {
16
- S(o);
17
- }, M = (o, t) => {
18
- m({
19
- ...r ?? {},
14
+ }, h = (o) => {
15
+ f(o);
16
+ }, S = (o, e) => {
17
+ a({
18
+ ...t ?? {},
20
19
  value: n.id,
21
- duration: t.id
22
- }), u();
20
+ duration: e.id
21
+ }), c();
23
22
  };
24
- return /* @__PURE__ */ a(g, { children: [
25
- /* @__PURE__ */ i(s, { icon: n.icon, selected: (r == null ? void 0 : r.value) === n.id, onClick: d, children: n.name }),
26
- /* @__PURE__ */ a(
27
- j,
23
+ return /* @__PURE__ */ s(M, { children: [
24
+ /* @__PURE__ */ r(u, { icon: n.icon, selected: t?.value === n.id, onClick: h, children: n.name }),
25
+ /* @__PURE__ */ s(
26
+ D,
28
27
  {
29
28
  anchorOrigin: {
30
29
  vertical: "top",
@@ -34,12 +33,12 @@ function I({ data: n, selected: r, onSelect: m }) {
34
33
  vertical: "top",
35
34
  horizontal: "left"
36
35
  },
37
- open: h,
38
- onClose: u,
39
- anchorEl: e,
36
+ open: d,
37
+ onClose: c,
38
+ anchorEl: i,
40
39
  children: [
41
- /* @__PURE__ */ i(
42
- y,
40
+ /* @__PURE__ */ r(
41
+ v,
43
42
  {
44
43
  component: "span",
45
44
  sx: {
@@ -47,14 +46,14 @@ function I({ data: n, selected: r, onSelect: m }) {
47
46
  pl: 2,
48
47
  fontSize: "14px"
49
48
  },
50
- children: f("profile.removeStatusAfter")
49
+ children: p("profile.removeStatusAfter")
51
50
  }
52
51
  ),
53
- (c = n.children) == null ? void 0 : c.map((o) => /* @__PURE__ */ i(
54
- s,
52
+ n.children?.map((o) => /* @__PURE__ */ r(
53
+ u,
55
54
  {
56
- selected: (r == null ? void 0 : r.duration) === o.id,
57
- onClick: (t) => M(t, o),
55
+ selected: t?.duration === o.id,
56
+ onClick: (e) => S(e, o),
58
57
  children: o.name
59
58
  },
60
59
  o.id
@@ -64,7 +63,7 @@ function I({ data: n, selected: r, onSelect: m }) {
64
63
  )
65
64
  ] });
66
65
  }
67
- const $ = x(v)`
66
+ const I = g(x)`
68
67
  .MuiList-root {
69
68
  min-width: 160px;
70
69
  }
@@ -73,6 +72,6 @@ const $ = x(v)`
73
72
  }
74
73
  `;
75
74
  export {
76
- $ as MenuDiv,
77
- I as default
75
+ I as MenuDiv,
76
+ B as default
78
77
  };
@@ -1,27 +1,27 @@
1
- import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
- import { Typography as f } from "@mui/material";
3
- import { translate as d } from "@arcblock/ux/lib/Locale/util";
1
+ import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
+ import { Typography as m } from "@mui/material";
3
+ import { translate as f } from "@arcblock/ux/lib/Locale/util";
4
4
  import { useMemoizedFn as S } from "ahooks";
5
5
  import { useLocaleContext as x } from "@arcblock/ux/lib/Locale/context";
6
6
  import h from "./duration-menu.js";
7
7
  import M, { StyledMenu as y } from "./menu-item.js";
8
8
  import { translations as v } from "../../libs/locales.js";
9
- function L({ data: e, open: a, onSelect: i, anchorEl: u = void 0, selected: r }) {
10
- const { locale: s } = x(), l = S((o, c = {}) => d(v, o, s, "en", c)), n = (o) => {
11
- i(o);
12
- }, p = () => e.map((o) => o.children ? /* @__PURE__ */ t(h, { data: o, selected: r, onSelect: n }, o.id) : /* @__PURE__ */ t(
9
+ function L({ data: e, open: s, onSelect: a, anchorEl: l = void 0, selected: n }) {
10
+ const { locale: c } = x(), i = S((o, p = {}) => f(v, o, c, "en", p)), r = (o) => {
11
+ a(o);
12
+ }, u = () => e.map((o) => o.children ? /* @__PURE__ */ t(h, { data: o, selected: n, onSelect: r }, o.id) : /* @__PURE__ */ t(
13
13
  M,
14
14
  {
15
15
  icon: o.icon,
16
- selected: (r == null ? void 0 : r.value) === o.id,
17
- onClick: () => n({ value: o.id }),
16
+ selected: n?.value === o.id,
17
+ onClick: () => r({ value: o.id }),
18
18
  children: o.name
19
19
  },
20
20
  o.id
21
21
  ));
22
- return /* @__PURE__ */ m(y, { open: a, onClose: () => n(), anchorEl: u, children: [
22
+ return /* @__PURE__ */ d(y, { open: s, onClose: () => r(), anchorEl: l, children: [
23
23
  /* @__PURE__ */ t(
24
- f,
24
+ m,
25
25
  {
26
26
  component: "span",
27
27
  sx: {
@@ -29,10 +29,10 @@ function L({ data: e, open: a, onSelect: i, anchorEl: u = void 0, selected: r })
29
29
  pl: 2,
30
30
  fontSize: "14px"
31
31
  },
32
- children: l("profile.setStatus")
32
+ children: i("profile.setStatus")
33
33
  }
34
34
  ),
35
- p()
35
+ u()
36
36
  ] });
37
37
  }
38
38
  export {
@@ -1,38 +1,37 @@
1
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
- import { DIDSpaceStatus as s, DIDSpaceConnect as u } from "@blocklet/did-space-react";
3
- import { Stack as f, IconButton as l, Link as S } from "@mui/material";
4
- import D from "@arcblock/ux/lib/Toast";
5
- import { OpenInNew as I } from "@mui/icons-material";
6
- import { getSpaceHomeUrl as k } from "../../../libs/spaces.js";
7
- import { formatAxiosError as w } from "../../libs/utils.js";
8
- function y({
1
+ import { jsxs as a, jsx as o } from "react/jsx-runtime";
2
+ import { DIDSpaceStatus as i, DIDSpaceConnect as p } from "@blocklet/did-space-react";
3
+ import { Stack as m, IconButton as d, Link as s } from "@mui/material";
4
+ import u from "@arcblock/ux/lib/Toast";
5
+ import { OpenInNew as f } from "@mui/icons-material";
6
+ import { getSpaceHomeUrl as l } from "../../../libs/spaces.js";
7
+ import { formatAxiosError as S } from "../../libs/utils.js";
8
+ function g({
9
9
  session: r,
10
- spaceGateway: i,
11
- spaceStatus: p,
12
- refresh: m
10
+ spaceGateway: t,
11
+ spaceStatus: n,
12
+ refresh: c
13
13
  }) {
14
- var e, t, n, c;
15
- return /* @__PURE__ */ d(f, { direction: "row", spacing: 1, children: [
16
- p === s.DISCONNECTED && /* @__PURE__ */ o(
17
- u,
14
+ return /* @__PURE__ */ a(m, { direction: "row", spacing: 1, children: [
15
+ n === i.DISCONNECTED && /* @__PURE__ */ o(
16
+ p,
18
17
  {
19
18
  reconnect: !0,
20
19
  variant: "outlined",
21
20
  session: r,
22
- spaceDid: (t = (e = r.user) == null ? void 0 : e.didSpace) == null ? void 0 : t.did,
23
- spaceGatewayUrl: (c = (n = r.user) == null ? void 0 : n.didSpace) == null ? void 0 : c.url,
21
+ spaceDid: r.user?.didSpace?.did,
22
+ spaceGatewayUrl: r.user?.didSpace?.url,
24
23
  connectScope: "user",
25
24
  onSuccess: async () => {
26
- await m();
25
+ await c();
27
26
  },
28
- onError: (a) => {
29
- console.error(a), D.error(w(a));
27
+ onError: (e) => {
28
+ console.error(e), u.error(S(e));
30
29
  }
31
30
  }
32
31
  ),
33
- /* @__PURE__ */ o(l, { size: "small", LinkComponent: S, href: k(i.endpoint), target: "_blank", children: /* @__PURE__ */ o(I, {}) })
32
+ /* @__PURE__ */ o(d, { size: "small", LinkComponent: s, href: l(t.endpoint), target: "_blank", children: /* @__PURE__ */ o(f, {}) })
34
33
  ] });
35
34
  }
36
35
  export {
37
- y as default
36
+ g as default
38
37
  };
@@ -1,55 +1,55 @@
1
- import { jsxs as d, Fragment as u, jsx as e } from "react/jsx-runtime";
2
- import { useState as m } from "react";
1
+ import { jsxs as d, Fragment as u, jsx as n } from "react/jsx-runtime";
2
+ import { useState as c } from "react";
3
3
  import { IconButton as g } from "@mui/material";
4
4
  import { DeleteOutline as x } from "@mui/icons-material";
5
5
  import C from "@arcblock/ux/lib/Dialog/confirm";
6
6
  import { useLocaleContext as h } from "@arcblock/ux/lib/Locale/context";
7
- import D from "@arcblock/ux/lib/Toast";
8
- function S({
9
- spaceGateway: t,
10
- onDeleteSpace: s
7
+ import y from "@arcblock/ux/lib/Toast";
8
+ function P({
9
+ spaceGateway: r,
10
+ onDeleteSpace: l
11
11
  }) {
12
- const { t: n } = h(), [c, i] = m(!1), [f, l] = m(!1), a = (o, r) => {
13
- o == null || o.stopPropagation(), i(r);
14
- }, p = async (o) => {
12
+ const { t: e } = h(), [m, a] = c(!1), [p, i] = c(!1), s = (o, t) => {
13
+ o?.stopPropagation(), a(t);
14
+ }, f = async (o) => {
15
15
  try {
16
- o == null || o.stopPropagation(), l(!0), await s(t), i(!1);
17
- } catch (r) {
18
- console.error(r), D.error(`${n("storage.spaces.gateway.delete.failed")}: ${r.message}`);
16
+ o?.stopPropagation(), i(!0), await l(r), a(!1);
17
+ } catch (t) {
18
+ console.error(t), y.error(`${e("storage.spaces.gateway.delete.failed")}: ${t.message}`);
19
19
  } finally {
20
- l(!1);
20
+ i(!1);
21
21
  }
22
22
  };
23
23
  return /* @__PURE__ */ d(u, { children: [
24
- /* @__PURE__ */ e(g, { size: "small", onClick: (o) => a(o, !0), children: /* @__PURE__ */ e(x, {}) }),
25
- /* @__PURE__ */ e(
24
+ /* @__PURE__ */ n(g, { size: "small", onClick: (o) => s(o, !0), children: /* @__PURE__ */ n(x, {}) }),
25
+ /* @__PURE__ */ n(
26
26
  C,
27
27
  {
28
- title: n("common.delConfirmDescription", {
29
- data: `${t == null ? void 0 : t.name}`
28
+ title: e("common.delConfirmDescription", {
29
+ data: `${r?.name}`
30
30
  }),
31
- open: c,
31
+ open: m,
32
32
  confirmButton: {
33
- text: n("common.confirm"),
33
+ text: e("common.confirm"),
34
34
  props: {
35
35
  variant: "contained",
36
36
  color: "error",
37
- loading: f
37
+ loading: p
38
38
  }
39
39
  },
40
40
  cancelButton: {
41
- text: n("common.cancel"),
41
+ text: e("common.cancel"),
42
42
  props: {
43
43
  variant: "contained",
44
44
  color: "primary"
45
45
  }
46
46
  },
47
- onConfirm: p,
48
- onCancel: (o) => a(o, !1)
47
+ onConfirm: f,
48
+ onCancel: (o) => s(o, !1)
49
49
  }
50
50
  )
51
51
  ] });
52
52
  }
53
53
  export {
54
- S as default
54
+ P as default
55
55
  };