@arcblock/ux 3.0.8 → 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 (66) hide show
  1. package/lib/Address/did-address.js +47 -49
  2. package/lib/Address/responsive-did-address.js +53 -57
  3. package/lib/Avatar/index.js +16 -16
  4. package/lib/BlockletV2/blocklet.js +64 -64
  5. package/lib/BlockletV2/components/tooltip-icon.js +26 -27
  6. package/lib/CardSelector/index.js +1 -2
  7. package/lib/ClickToCopy/hook.js +10 -11
  8. package/lib/ClickToCopy/index.js +16 -16
  9. package/lib/Config/theme-mode-toggle.js +7 -8
  10. package/lib/DID/index.js +131 -133
  11. package/lib/DIDConnect/app-info-item.js +18 -18
  12. package/lib/DIDConnect/auth-apps/index.js +83 -84
  13. package/lib/DIDConnect/did-connect-container.js +89 -90
  14. package/lib/DIDConnect/did-connect-footer.js +25 -25
  15. package/lib/DIDConnect/landing-page.js +17 -17
  16. package/lib/DIDConnect/powered-by.js +11 -11
  17. package/lib/DIDConnect/request-storage-access-api-dialog.js +36 -37
  18. package/lib/DIDConnect/with-container.js +66 -68
  19. package/lib/Dialog/use-confirm.js +40 -43
  20. package/lib/Earth/index.js +21 -22
  21. package/lib/Footer/index.js +15 -16
  22. package/lib/Header/responsive-header.js +23 -24
  23. package/lib/Layout/dashboard/index.js +63 -72
  24. package/lib/Layout/dashboard/sidebar.js +20 -21
  25. package/lib/Layout/dashboard-legacy/index.js +52 -52
  26. package/lib/Locale/context.js +36 -37
  27. package/lib/Locale/selector.js +40 -42
  28. package/lib/NFTDisplay/index.js +114 -118
  29. package/lib/NFTDisplay/render-svg.js +12 -12
  30. package/lib/NavMenu/nav-menu.js +159 -161
  31. package/lib/NavMenu/sub-container.js +25 -26
  32. package/lib/PageScroller/index.js +28 -32
  33. package/lib/Passport/passport.js +11 -11
  34. package/lib/PhoneInput/country-select.js +38 -38
  35. package/lib/PhoneInput/index.js +65 -66
  36. package/lib/Screenshot/index.js +26 -27
  37. package/lib/SessionBlocklet/index.js +87 -93
  38. package/lib/SessionPermission/index.js +5 -9
  39. package/lib/SessionUser/components/did-space.js +24 -25
  40. package/lib/SessionUser/components/logged-in.js +122 -127
  41. package/lib/SessionUser/components/quick-login-item.js +41 -42
  42. package/lib/SessionUser/components/session-user-item.js +35 -36
  43. package/lib/SessionUser/components/session-user-switch.js +81 -85
  44. package/lib/SessionUser/components/un-login.js +41 -41
  45. package/lib/SessionUser/components/user-info.js +43 -47
  46. package/lib/SessionUser/index.js +1 -1
  47. package/lib/SessionUser/libs/utils.js +24 -30
  48. package/lib/SharedBridge/index.js +35 -35
  49. package/lib/Theme/index.js +16 -16
  50. package/lib/Theme/theme.js +42 -43
  51. package/lib/Toast/index.js +24 -25
  52. package/lib/Typography/index.js +42 -42
  53. package/lib/UserCard/Content/basic.js +91 -93
  54. package/lib/UserCard/Content/shorten-label.js +9 -9
  55. package/lib/UserCard/components.js +15 -15
  56. package/lib/Util/deprecate.js +1 -1
  57. package/lib/Util/federated.js +28 -32
  58. package/lib/Util/iframe.js +9 -10
  59. package/lib/Util/index.js +134 -135
  60. package/lib/Util/security.js +9 -10
  61. package/lib/Util/wallet.js +6 -9
  62. package/lib/VerificationCode/index.js +26 -28
  63. package/lib/hooks/use-blocklet-logo.js +11 -14
  64. package/lib/ux.css +1 -1
  65. package/lib/withTracker/index.js +13 -14
  66. package/package.json +9 -10
@@ -1,41 +1,41 @@
1
- import { jsxs as y, jsx as r } from "react/jsx-runtime";
2
- import { Typography as g, Box as f, Grid as _, useTheme as k } from "@mui/material";
3
- import { useCreation as p, useMemoizedFn as T } from "ahooks";
4
- import $ from "@emotion/styled";
5
- import D from "lodash/isArray";
6
- import { Icon as j } from "@iconify/react";
7
- import E from "@iconify-icons/tabler/info-circle";
8
- import A from "@arcblock/icons/lib/Link";
9
- import M from "@arcblock/icons/lib/Phone";
10
- import P from "@arcblock/icons/lib/Location";
11
- import V from "@arcblock/icons/lib/Email";
12
- import B from "@arcblock/icons/lib/Timezone";
13
- import { withoutProtocol as R } from "ufo";
14
- import { useCallback as G, useMemo as N } from "react";
15
- import Z from "./clock.js";
16
- const q = {
17
- timezone: B,
18
- email: V,
19
- phone: M,
20
- location: P,
21
- link: A
1
+ import { jsxs as y, jsx as t } from "react/jsx-runtime";
2
+ import { Typography as g, Box as m, Grid as C, useTheme as k } from "@mui/material";
3
+ import { useCreation as h, useMemoizedFn as L } from "ahooks";
4
+ import T from "@emotion/styled";
5
+ import _ from "lodash/isArray";
6
+ import { Icon as $ } from "@iconify/react";
7
+ import j from "@iconify-icons/tabler/info-circle";
8
+ import S from "@arcblock/icons/lib/Link";
9
+ import E from "@arcblock/icons/lib/Phone";
10
+ import M from "@arcblock/icons/lib/Location";
11
+ import P from "@arcblock/icons/lib/Email";
12
+ import A from "@arcblock/icons/lib/Timezone";
13
+ import { withoutProtocol as V } from "ufo";
14
+ import { useCallback as R, useMemo as D } from "react";
15
+ import G from "./clock.js";
16
+ const Z = {
17
+ timezone: A,
18
+ email: P,
19
+ phone: E,
20
+ location: M,
21
+ link: S
22
22
  };
23
- function H(e) {
24
- return R(e);
23
+ function q(e) {
24
+ return V(e);
25
25
  }
26
26
  function x(e) {
27
27
  return e ? {
28
28
  filter: "brightness(0) saturate(100%) invert(1)"
29
29
  } : {};
30
30
  }
31
- const u = {
31
+ const p = {
32
32
  width: 16,
33
33
  height: 16
34
34
  };
35
- function J({ value: e }) {
35
+ function H({ value: e }) {
36
36
  const a = k().palette.mode === "dark";
37
37
  return /* @__PURE__ */ y(
38
- f,
38
+ m,
39
39
  {
40
40
  className: "user-card__timezone-field",
41
41
  sx: {
@@ -44,17 +44,17 @@ function J({ value: e }) {
44
44
  gap: 1
45
45
  },
46
46
  children: [
47
- /* @__PURE__ */ r(B, { ...u, style: x(a) }),
48
- /* @__PURE__ */ r(Z, { value: e, variant: "body2", color: "grey.800" })
47
+ /* @__PURE__ */ t(A, { ...p, style: x(a) }),
48
+ /* @__PURE__ */ t(G, { value: e, variant: "body2", color: "grey.800" })
49
49
  ]
50
50
  }
51
51
  );
52
52
  }
53
- function K({ value: e }) {
53
+ function J({ value: e }) {
54
54
  const a = k().palette.mode === "dark";
55
- return /* @__PURE__ */ y(f, { display: "flex", alignItems: "center", gap: 1, className: "user-card__link-field", children: [
56
- /* @__PURE__ */ r(A, { ...u, style: x(a) }),
57
- /* @__PURE__ */ r(v, { variant: "body2", color: "grey.800", children: /* @__PURE__ */ r(
55
+ return /* @__PURE__ */ y(m, { display: "flex", alignItems: "center", gap: 1, className: "user-card__link-field", children: [
56
+ /* @__PURE__ */ t(S, { ...p, style: x(a) }),
57
+ /* @__PURE__ */ t(v, { variant: "body2", color: "grey.800", children: /* @__PURE__ */ t(
58
58
  g,
59
59
  {
60
60
  component: "a",
@@ -66,15 +66,15 @@ function K({ value: e }) {
66
66
  sx: {
67
67
  color: "grey.800"
68
68
  },
69
- children: H(e)
69
+ children: q(e)
70
70
  }
71
71
  ) })
72
72
  ] });
73
73
  }
74
- function S({ field: e, value: s, children: a = null }) {
75
- const h = q[e], m = k().palette.mode === "dark", c = x(m);
74
+ function N({ field: e, value: s, children: a = null }) {
75
+ const d = Z[e], u = k().palette.mode === "dark", c = x(u);
76
76
  return /* @__PURE__ */ y(
77
- f,
77
+ m,
78
78
  {
79
79
  className: `user-card__${e}-field`,
80
80
  sx: {
@@ -83,94 +83,92 @@ function S({ field: e, value: s, children: a = null }) {
83
83
  gap: 1
84
84
  },
85
85
  children: [
86
- h ? /* @__PURE__ */ r(h, { ...u, style: c }) : /* @__PURE__ */ r(j, { icon: E, ...u, ...c }),
87
- /* @__PURE__ */ r(v, { variant: "body2", color: "grey.800", children: a ?? s })
86
+ d ? /* @__PURE__ */ t(d, { ...p, style: c }) : /* @__PURE__ */ t($, { icon: j, ...p, ...c }),
87
+ /* @__PURE__ */ t(v, { variant: "body2", color: "grey.800", children: a ?? s })
88
88
  ]
89
89
  },
90
90
  e
91
91
  );
92
92
  }
93
- function se({ user: e, renderFields: s = void 0 }) {
94
- var w;
95
- const a = p(() => s ?? ["bio", "email", "phone", "location", "timezone", "link"], [s]), h = p(() => a.includes("bio"), [a]), l = p(() => e.metadata ?? {
96
- joinedAt: e == null ? void 0 : e.createdAt,
97
- email: e == null ? void 0 : e.email,
93
+ function le({ user: e, renderFields: s = void 0 }) {
94
+ const a = h(() => s ?? ["bio", "email", "phone", "location", "timezone", "link"], [s]), d = h(() => a.includes("bio"), [a]), l = h(() => e.metadata ?? {
95
+ joinedAt: e?.createdAt,
96
+ email: e?.email,
98
97
  phone: {
99
98
  country: "cn",
100
- phoneNumber: (e == null ? void 0 : e.phone) ?? ""
99
+ phoneNumber: e?.phone ?? ""
101
100
  }
102
- }, [e]), m = p(() => e.address, [e.address]), c = G(
103
- (n) => {
104
- var i, t, o;
105
- if (!n) return "";
106
- switch (n) {
101
+ }, [e]), u = h(() => e.address, [e.address]), c = R(
102
+ (r) => {
103
+ if (!r) return "";
104
+ switch (r) {
107
105
  case "bio":
108
- return ((i = e.metadata) == null ? void 0 : i.bio) || "";
106
+ return e.metadata?.bio || "";
109
107
  case "email":
110
108
  return l.email || e.email || "";
111
109
  case "phone":
112
- return ((t = l.phone) == null ? void 0 : t.phoneNumber) || e.phone || "";
110
+ return l.phone?.phoneNumber || e.phone || "";
113
111
  case "location":
114
- return (m == null ? void 0 : m.city) || l.location || "";
112
+ return u?.city || l.location || "";
115
113
  case "timezone":
116
114
  return l.timezone || "";
117
115
  case "link":
118
- return ((o = l.links) == null ? void 0 : o.map((d) => d.url).filter(Boolean)) || [];
116
+ return l.links?.map((i) => i.url).filter(Boolean) || [];
119
117
  default:
120
- return e[n] || "";
118
+ return e[r] || "";
121
119
  }
122
120
  },
123
- [e, l, m]
124
- ), { effectiveRenderCount: F } = N(() => {
125
- const n = a.filter((t) => {
126
- if (t === "bio") return !1;
127
- const o = c(t);
128
- return o == null || o === "" ? !1 : D(o) ? o.length > 0 : String(o).trim().length > 0;
129
- }), i = n.reduce((t, o) => {
130
- const d = c(o);
131
- return t + (Array.isArray(d) ? d.filter((C) => C && String(C).trim()).length : 1);
121
+ [e, l, u]
122
+ ), { effectiveRenderCount: B } = D(() => {
123
+ const r = a.filter((n) => {
124
+ if (n === "bio") return !1;
125
+ const o = c(n);
126
+ return o == null || o === "" ? !1 : _(o) ? o.length > 0 : String(o).trim().length > 0;
127
+ }), i = r.reduce((n, o) => {
128
+ const f = c(o);
129
+ return n + (Array.isArray(f) ? f.filter((w) => w && String(w).trim()).length : 1);
132
130
  }, 0);
133
- return { visibleFields: n, effectiveRenderCount: i };
134
- }, [a, c]), L = F > 4, b = T(
135
- (n) => n != null && String(n).trim().length > 0
136
- ), I = N(() => {
137
- const n = [];
131
+ return { visibleFields: r, effectiveRenderCount: i };
132
+ }, [a, c]), F = B > 4, b = L(
133
+ (r) => r != null && String(r).trim().length > 0
134
+ ), I = D(() => {
135
+ const r = [];
138
136
  return a.forEach((i) => {
139
137
  if (i === "bio") return;
140
- const t = c(i);
141
- t && (D(t) ? t.forEach((o, d) => {
142
- b(o) && n.push({
138
+ const n = c(i);
139
+ n && (_(n) ? n.forEach((o, f) => {
140
+ b(o) && r.push({
143
141
  field: i,
144
142
  value: o,
145
- key: `${i}-${d}`
143
+ key: `${i}-${f}`
146
144
  });
147
- }) : b(t) && n.push({
145
+ }) : b(n) && r.push({
148
146
  field: i,
149
- value: t,
147
+ value: n,
150
148
  key: i
151
149
  }));
152
- }), n;
150
+ }), r;
153
151
  }, [a, c, b]);
154
152
  if (a.length === 0)
155
153
  return null;
156
- const z = (n) => {
157
- const { field: i, value: t, key: o } = n;
154
+ const z = (r) => {
155
+ const { field: i, value: n, key: o } = r;
158
156
  switch (i) {
159
157
  case "link":
160
- return /* @__PURE__ */ r(K, { value: t }, o);
158
+ return /* @__PURE__ */ t(J, { value: n }, o);
161
159
  case "timezone":
162
- return /* @__PURE__ */ r(J, { value: t }, o);
160
+ return /* @__PURE__ */ t(H, { value: n }, o);
163
161
  case "email":
164
- return /* @__PURE__ */ r(
165
- S,
162
+ return /* @__PURE__ */ t(
163
+ N,
166
164
  {
167
165
  field: i,
168
- value: t,
169
- children: /* @__PURE__ */ r(
166
+ value: n,
167
+ children: /* @__PURE__ */ t(
170
168
  g,
171
169
  {
172
170
  component: "a",
173
- href: `mailto:${t}`,
171
+ href: `mailto:${n}`,
174
172
  rel: "noopener noreferrer",
175
173
  referrerPolicy: "no-referrer",
176
174
  style: {
@@ -178,17 +176,17 @@ function se({ user: e, renderFields: s = void 0 }) {
178
176
  textDecoration: "none",
179
177
  fontSize: "inherit"
180
178
  },
181
- children: t
179
+ children: n
182
180
  }
183
181
  )
184
182
  }
185
183
  );
186
184
  default:
187
- return /* @__PURE__ */ r(S, { field: i, value: t }, o);
185
+ return /* @__PURE__ */ t(N, { field: i, value: n }, o);
188
186
  }
189
187
  };
190
188
  return /* @__PURE__ */ y(
191
- f,
189
+ m,
192
190
  {
193
191
  className: "user-card__basic-content",
194
192
  sx: {
@@ -198,23 +196,23 @@ function se({ user: e, renderFields: s = void 0 }) {
198
196
  gap: 1.5
199
197
  },
200
198
  children: [
201
- h && ((w = e.metadata) == null ? void 0 : w.bio) && /* @__PURE__ */ r(v, { variant: "body2", color: "grey.800", className: "user-card__bio-field", children: e.metadata.bio }),
202
- L ? /* @__PURE__ */ r(_, { container: !0, spacing: 0.5, children: I.map((n) => /* @__PURE__ */ r(_, { size: 6, children: z(n) }, n.key)) }) : /* @__PURE__ */ r(
203
- f,
199
+ d && e.metadata?.bio && /* @__PURE__ */ t(v, { variant: "body2", color: "grey.800", className: "user-card__bio-field", children: e.metadata.bio }),
200
+ F ? /* @__PURE__ */ t(C, { container: !0, spacing: 0.5, children: I.map((r) => /* @__PURE__ */ t(C, { size: 6, children: z(r) }, r.key)) }) : /* @__PURE__ */ t(
201
+ m,
204
202
  {
205
203
  sx: {
206
204
  display: "flex",
207
205
  flexDirection: "column",
208
206
  gap: 0.5
209
207
  },
210
- children: I.map((n) => z(n))
208
+ children: I.map((r) => z(r))
211
209
  }
212
210
  )
213
211
  ]
214
212
  }
215
213
  );
216
214
  }
217
- const v = $(g)`
215
+ const v = T(g)`
218
216
  flex: 1;
219
217
  display: -webkit-box;
220
218
  line-height: 1.5;
@@ -225,5 +223,5 @@ const v = $(g)`
225
223
  word-break: break-word;
226
224
  `;
227
225
  export {
228
- se as default
226
+ le as default
229
227
  };
@@ -1,13 +1,13 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { Typography as f, Tooltip as u } from "@mui/material";
3
- import { useMemo as p } from "react";
4
- function l(o, t = 10) {
5
- return o ? o.length <= t ? o : `${o.slice(0, t - 1)}...${o.slice(-2)}` : "";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { Typography as i, Tooltip as u } from "@mui/material";
3
+ import { useMemo as l } from "react";
4
+ function p(e, o = 10) {
5
+ return e ? e.length <= o ? e : `${e.slice(0, o - 1)}...${e.slice(-2)}` : "";
6
6
  }
7
- function T({ children: o, maxLength: t = 10, sx: r = void 0, hiddenTip: n = !1 }) {
8
- const i = p(() => l(o, t), [o, t]);
9
- return (o == null ? void 0 : o.length) <= t ? /* @__PURE__ */ e(f, { sx: r, children: o }) : n ? /* @__PURE__ */ e(f, { sx: r, children: i }) : /* @__PURE__ */ e(u, { title: o, placement: "top", children: /* @__PURE__ */ e(f, { sx: r, children: i }) });
7
+ function s({ children: e, maxLength: o = 10, sx: t = void 0, hiddenTip: f = !1 }) {
8
+ const n = l(() => p(e, o), [e, o]);
9
+ return e?.length <= o ? /* @__PURE__ */ r(i, { sx: t, children: e }) : f ? /* @__PURE__ */ r(i, { sx: t, children: n }) : /* @__PURE__ */ r(u, { title: e, placement: "top", children: /* @__PURE__ */ r(i, { sx: t, children: n }) });
10
10
  }
11
11
  export {
12
- T as default
12
+ s as default
13
13
  };
@@ -1,25 +1,25 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { Box as o, Avatar as f } from "@mui/material";
2
+ import { Box as l, Avatar as f } from "@mui/material";
3
3
  import p from "../Avatar/index.js";
4
4
  import { createNameOnlyAvatar as u } from "./utils.js";
5
- const _ = (r, t = 48, n = void 0, e = void 0, s = !1) => {
6
- const c = (i) => {
7
- e == null || e(r, i);
5
+ const N = (r, t = 48, n = void 0, e = void 0, c = !1) => {
6
+ const o = (i) => {
7
+ e?.(r, i);
8
8
  };
9
9
  if (!r.avatar) {
10
- const i = u(r), { className: d, style: l, alt: m } = n || {};
10
+ const i = u(r), { className: s, style: d, alt: m } = n || {};
11
11
  return /* @__PURE__ */ a(
12
12
  f,
13
13
  {
14
- onClick: c,
15
- className: d,
16
- style: l,
14
+ onClick: o,
15
+ className: s,
16
+ style: d,
17
17
  alt: m,
18
18
  sx: {
19
19
  width: t,
20
20
  height: t,
21
21
  fontSize: t * 0.4,
22
- cursor: s || e ? "pointer" : "default"
22
+ cursor: c || e ? "pointer" : "default"
23
23
  },
24
24
  variant: "circular",
25
25
  children: i
@@ -27,7 +27,7 @@ const _ = (r, t = 48, n = void 0, e = void 0, s = !1) => {
27
27
  );
28
28
  }
29
29
  return /* @__PURE__ */ a(
30
- o,
30
+ l,
31
31
  {
32
32
  className: "user-card__avatar",
33
33
  sx: {
@@ -40,9 +40,9 @@ const _ = (r, t = 48, n = void 0, e = void 0, s = !1) => {
40
40
  did: r.did,
41
41
  variant: "circle",
42
42
  style: {
43
- cursor: s || e ? "pointer" : "default"
43
+ cursor: c || e ? "pointer" : "default"
44
44
  },
45
- onClick: c,
45
+ onClick: o,
46
46
  src: r.avatar,
47
47
  alt: r.fullName || "",
48
48
  ...n || {}
@@ -50,8 +50,8 @@ const _ = (r, t = 48, n = void 0, e = void 0, s = !1) => {
50
50
  )
51
51
  }
52
52
  );
53
- }, g = (r, t = 120) => r ? /* @__PURE__ */ a(o, { sx: { maxWidth: t }, className: "user-card__top-right-content", children: r() }) : null;
53
+ }, _ = (r, t = 120) => r ? /* @__PURE__ */ a(l, { sx: { maxWidth: t }, className: "user-card__top-right-content", children: r() }) : null;
54
54
  export {
55
- _ as renderAvatar,
56
- g as renderTopRight
55
+ N as renderAvatar,
56
+ _ as renderTopRight
57
57
  };
@@ -1,7 +1,7 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { useEffect as c } from "react";
3
3
  const s = (e, r) => {
4
- process.env.NODE_ENV !== "production" && typeof (console == null ? void 0 : console.warn) == "function" && console.warn(r ? `DEPRECATED: ${e} is deprecated, use ${r} instead.` : `DEPRECATED: ${e} is deprecated.`);
4
+ process.env.NODE_ENV !== "production" && typeof console?.warn == "function" && console.warn(r ? `DEPRECATED: ${e} is deprecated, use ${r} instead.` : `DEPRECATED: ${e} is deprecated.`);
5
5
  }, E = (e, { name: r, alternative: o }) => function(n) {
6
6
  return c(() => {
7
7
  s(r, o);
@@ -1,24 +1,20 @@
1
- import o from "lodash/isEmpty";
2
- const t = {};
3
- function i(e = window.blocklet) {
4
- var n;
5
- return (((n = e == null ? void 0 : e.settings) == null ? void 0 : n.federated) || {}).master;
1
+ import i from "lodash/isEmpty";
2
+ const a = {};
3
+ function o(e = window.blocklet) {
4
+ return (e?.settings?.federated || {}).master;
6
5
  }
7
6
  function d(e = window.blocklet) {
8
- var n;
9
- return (((n = e == null ? void 0 : e.settings) == null ? void 0 : n.federated) || {}).config;
7
+ return (e?.settings?.federated || {}).config;
10
8
  }
11
9
  function s(e = window.blocklet) {
12
- const p = d(e);
13
- return (p == null ? void 0 : p.status) === "approved";
10
+ return d(e)?.status === "approved";
14
11
  }
15
- function f(e = window.blocklet) {
16
- const p = i(e);
17
- return p == null ? void 0 : p.appPid;
12
+ function w(e = window.blocklet) {
13
+ return o(e)?.appPid;
18
14
  }
19
- function u(e = window.blocklet) {
20
- const p = i(e);
21
- return !o(p) ? {
15
+ function c(e = window.blocklet) {
16
+ const p = o(e);
17
+ return !i(p) ? {
22
18
  appId: p.appId,
23
19
  appName: p.appName,
24
20
  appDescription: p.appDescription,
@@ -30,7 +26,7 @@ function u(e = window.blocklet) {
30
26
  provider: "wallet"
31
27
  } : null;
32
28
  }
33
- function c(e = window.blocklet) {
29
+ function u(e = window.blocklet) {
34
30
  return e ? {
35
31
  appId: e.appId,
36
32
  appName: e.appName,
@@ -60,28 +56,28 @@ function c(e = window.blocklet) {
60
56
  }) : null;
61
57
  }
62
58
  function g(e) {
63
- const p = [], n = u(e), r = c(e), a = s(e);
64
- return r && p.push(r), n && (n == null ? void 0 : n.appId) !== (r == null ? void 0 : r.appId) && a && p.push(n), p.reverse();
59
+ const p = [], r = c(e), t = u(e), n = s(e);
60
+ return t && p.push(t), r && r?.appId !== t?.appId && n && p.push(r), p.reverse();
65
61
  }
66
- async function v(e, p = !1) {
67
- if (!p && t[e])
68
- return t[e];
62
+ async function l(e, p = !1) {
63
+ if (!p && a[e])
64
+ return a[e];
69
65
  try {
70
- const n = new URL("__blocklet__.js", e);
71
- n.searchParams.set("type", "json");
72
- const a = await (await fetch(n.href)).json();
73
- return t[e] = a, a;
74
- } catch (n) {
75
- return console.error(`Failed to get blocklet data: ${e}`, n), null;
66
+ const r = new URL("__blocklet__.js", e);
67
+ r.searchParams.set("type", "json");
68
+ const n = await (await fetch(r.href)).json();
69
+ return a[e] = n, n;
70
+ } catch (r) {
71
+ return console.error(`Failed to get blocklet data: ${e}`, r), null;
76
72
  }
77
73
  }
78
74
  export {
79
75
  g as getApps,
80
- v as getBlockletData,
76
+ l as getBlockletData,
81
77
  d as getConfig,
82
- c as getCurrentApp,
83
- u as getFederatedApp,
78
+ u as getCurrentApp,
79
+ c as getFederatedApp,
84
80
  s as getFederatedEnabled,
85
- i as getMaster,
86
- f as getSourceAppPid
81
+ o as getMaster,
82
+ w as getSourceAppPid
87
83
  };
@@ -1,17 +1,16 @@
1
- function i(n, e) {
2
- return `callback_${e}_${n}`;
1
+ function i(e, n) {
2
+ return `callback_${n}_${e}`;
3
3
  }
4
- async function d(n, e) {
5
- var s;
6
- const t = i(n.dataset.id, e), a = new Promise((l) => {
7
- const c = ({ data: o }) => {
8
- o.action === t && (window.removeEventListener("message", c), l(o));
4
+ async function l(e, n) {
5
+ const t = i(e.dataset.id, n), a = new Promise((o) => {
6
+ const s = ({ data: c }) => {
7
+ c.action === t && (window.removeEventListener("message", s), o(c));
9
8
  };
10
- window.addEventListener("message", c);
9
+ window.addEventListener("message", s);
11
10
  });
12
- return (s = n == null ? void 0 : n.contentWindow) == null || s.postMessage({ action: e, callback: t }, "*"), a;
11
+ return e?.contentWindow?.postMessage({ action: n, callback: t }, "*"), a;
13
12
  }
14
13
  export {
15
- d as callIframe,
14
+ l as callIframe,
16
15
  i as getCallbackAction
17
16
  };