@arcblock/ux 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.
- package/lib/Address/did-address.js +47 -49
- package/lib/Address/responsive-did-address.js +53 -57
- package/lib/Avatar/index.js +16 -16
- package/lib/BlockletV2/blocklet.js +64 -64
- package/lib/BlockletV2/components/tooltip-icon.js +26 -27
- package/lib/CardSelector/index.js +1 -2
- package/lib/ClickToCopy/hook.js +10 -11
- package/lib/ClickToCopy/index.js +16 -16
- package/lib/Config/theme-mode-toggle.js +7 -8
- package/lib/DID/index.js +131 -133
- package/lib/DIDConnect/app-info-item.js +18 -18
- package/lib/DIDConnect/auth-apps/index.js +83 -84
- package/lib/DIDConnect/did-connect-container.js +89 -90
- package/lib/DIDConnect/did-connect-footer.js +25 -25
- package/lib/DIDConnect/landing-page.js +17 -17
- package/lib/DIDConnect/powered-by.js +11 -11
- package/lib/DIDConnect/request-storage-access-api-dialog.js +36 -37
- package/lib/DIDConnect/with-container.js +66 -68
- package/lib/Dialog/use-confirm.js +40 -43
- package/lib/Earth/index.js +21 -22
- package/lib/Footer/index.js +15 -16
- package/lib/Header/responsive-header.js +23 -24
- package/lib/Layout/dashboard/index.js +63 -72
- package/lib/Layout/dashboard/sidebar.js +20 -21
- package/lib/Layout/dashboard-legacy/index.js +52 -52
- package/lib/Locale/context.js +36 -37
- package/lib/Locale/selector.js +40 -42
- package/lib/NFTDisplay/index.js +114 -118
- package/lib/NFTDisplay/render-svg.js +12 -12
- package/lib/NavMenu/nav-menu.js +159 -161
- package/lib/NavMenu/sub-container.js +25 -26
- package/lib/PageScroller/index.js +28 -32
- package/lib/Passport/passport.js +11 -11
- package/lib/PhoneInput/country-select.js +38 -38
- package/lib/PhoneInput/index.js +65 -66
- package/lib/Screenshot/index.js +26 -27
- package/lib/SessionBlocklet/index.js +87 -93
- package/lib/SessionPermission/index.js +5 -9
- package/lib/SessionUser/components/did-space.js +24 -25
- package/lib/SessionUser/components/logged-in.js +122 -127
- package/lib/SessionUser/components/quick-login-item.js +41 -42
- package/lib/SessionUser/components/session-user-item.js +35 -36
- package/lib/SessionUser/components/session-user-switch.js +81 -85
- package/lib/SessionUser/components/un-login.js +41 -41
- package/lib/SessionUser/components/user-info.js +43 -47
- package/lib/SessionUser/index.js +1 -1
- package/lib/SessionUser/libs/utils.js +24 -30
- package/lib/SharedBridge/index.js +35 -35
- package/lib/Theme/index.js +16 -16
- package/lib/Theme/theme.js +42 -43
- package/lib/Toast/index.js +24 -25
- package/lib/Typography/index.js +42 -42
- package/lib/UserCard/Content/basic.js +91 -93
- package/lib/UserCard/Content/shorten-label.js +9 -9
- package/lib/UserCard/components.js +15 -15
- package/lib/Util/deprecate.js +1 -1
- package/lib/Util/federated.js +28 -32
- package/lib/Util/iframe.js +9 -10
- package/lib/Util/index.js +134 -135
- package/lib/Util/security.js +9 -10
- package/lib/Util/wallet.js +6 -9
- package/lib/VerificationCode/index.js +26 -28
- package/lib/hooks/use-blocklet-logo.js +11 -14
- package/lib/ux.css +1 -1
- package/lib/withTracker/index.js +13 -14
- package/package.json +9 -10
@@ -1,41 +1,41 @@
|
|
1
|
-
import { jsxs as y, jsx as
|
2
|
-
import { Typography as g, Box as
|
3
|
-
import { useCreation as
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import { Icon as
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import { withoutProtocol as
|
14
|
-
import { useCallback as
|
15
|
-
import
|
16
|
-
const
|
17
|
-
timezone:
|
18
|
-
email:
|
19
|
-
phone:
|
20
|
-
location:
|
21
|
-
link:
|
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
|
24
|
-
return
|
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
|
31
|
+
const p = {
|
32
32
|
width: 16,
|
33
33
|
height: 16
|
34
34
|
};
|
35
|
-
function
|
35
|
+
function H({ value: e }) {
|
36
36
|
const a = k().palette.mode === "dark";
|
37
37
|
return /* @__PURE__ */ y(
|
38
|
-
|
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__ */
|
48
|
-
/* @__PURE__ */
|
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
|
53
|
+
function J({ value: e }) {
|
54
54
|
const a = k().palette.mode === "dark";
|
55
|
-
return /* @__PURE__ */ y(
|
56
|
-
/* @__PURE__ */
|
57
|
-
/* @__PURE__ */
|
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:
|
69
|
+
children: q(e)
|
70
70
|
}
|
71
71
|
) })
|
72
72
|
] });
|
73
73
|
}
|
74
|
-
function
|
75
|
-
const
|
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
|
-
|
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
|
-
|
87
|
-
/* @__PURE__ */
|
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
|
94
|
-
|
95
|
-
|
96
|
-
|
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:
|
99
|
+
phoneNumber: e?.phone ?? ""
|
101
100
|
}
|
102
|
-
}, [e]),
|
103
|
-
(
|
104
|
-
|
105
|
-
|
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
|
106
|
+
return e.metadata?.bio || "";
|
109
107
|
case "email":
|
110
108
|
return l.email || e.email || "";
|
111
109
|
case "phone":
|
112
|
-
return
|
110
|
+
return l.phone?.phoneNumber || e.phone || "";
|
113
111
|
case "location":
|
114
|
-
return
|
112
|
+
return u?.city || l.location || "";
|
115
113
|
case "timezone":
|
116
114
|
return l.timezone || "";
|
117
115
|
case "link":
|
118
|
-
return
|
116
|
+
return l.links?.map((i) => i.url).filter(Boolean) || [];
|
119
117
|
default:
|
120
|
-
return e[
|
118
|
+
return e[r] || "";
|
121
119
|
}
|
122
120
|
},
|
123
|
-
[e, l,
|
124
|
-
), { effectiveRenderCount:
|
125
|
-
const
|
126
|
-
if (
|
127
|
-
const o = c(
|
128
|
-
return o == null || o === "" ? !1 :
|
129
|
-
}), i =
|
130
|
-
const
|
131
|
-
return
|
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:
|
134
|
-
}, [a, c]),
|
135
|
-
(
|
136
|
-
), I =
|
137
|
-
const
|
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
|
141
|
-
|
142
|
-
b(o) &&
|
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}-${
|
143
|
+
key: `${i}-${f}`
|
146
144
|
});
|
147
|
-
}) : b(
|
145
|
+
}) : b(n) && r.push({
|
148
146
|
field: i,
|
149
|
-
value:
|
147
|
+
value: n,
|
150
148
|
key: i
|
151
149
|
}));
|
152
|
-
}),
|
150
|
+
}), r;
|
153
151
|
}, [a, c, b]);
|
154
152
|
if (a.length === 0)
|
155
153
|
return null;
|
156
|
-
const z = (
|
157
|
-
const { field: i, value:
|
154
|
+
const z = (r) => {
|
155
|
+
const { field: i, value: n, key: o } = r;
|
158
156
|
switch (i) {
|
159
157
|
case "link":
|
160
|
-
return /* @__PURE__ */
|
158
|
+
return /* @__PURE__ */ t(J, { value: n }, o);
|
161
159
|
case "timezone":
|
162
|
-
return /* @__PURE__ */
|
160
|
+
return /* @__PURE__ */ t(H, { value: n }, o);
|
163
161
|
case "email":
|
164
|
-
return /* @__PURE__ */
|
165
|
-
|
162
|
+
return /* @__PURE__ */ t(
|
163
|
+
N,
|
166
164
|
{
|
167
165
|
field: i,
|
168
|
-
value:
|
169
|
-
children: /* @__PURE__ */
|
166
|
+
value: n,
|
167
|
+
children: /* @__PURE__ */ t(
|
170
168
|
g,
|
171
169
|
{
|
172
170
|
component: "a",
|
173
|
-
href: `mailto:${
|
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:
|
179
|
+
children: n
|
182
180
|
}
|
183
181
|
)
|
184
182
|
}
|
185
183
|
);
|
186
184
|
default:
|
187
|
-
return /* @__PURE__ */
|
185
|
+
return /* @__PURE__ */ t(N, { field: i, value: n }, o);
|
188
186
|
}
|
189
187
|
};
|
190
188
|
return /* @__PURE__ */ y(
|
191
|
-
|
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
|
-
|
202
|
-
|
203
|
-
|
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((
|
208
|
+
children: I.map((r) => z(r))
|
211
209
|
}
|
212
210
|
)
|
213
211
|
]
|
214
212
|
}
|
215
213
|
);
|
216
214
|
}
|
217
|
-
const v =
|
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
|
-
|
226
|
+
le as default
|
229
227
|
};
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { Typography as
|
3
|
-
import { useMemo as
|
4
|
-
function
|
5
|
-
return
|
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
|
8
|
-
const
|
9
|
-
return
|
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
|
-
|
12
|
+
s as default
|
13
13
|
};
|
@@ -1,25 +1,25 @@
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
2
|
-
import { Box as
|
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
|
6
|
-
const
|
7
|
-
e
|
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:
|
10
|
+
const i = u(r), { className: s, style: d, alt: m } = n || {};
|
11
11
|
return /* @__PURE__ */ a(
|
12
12
|
f,
|
13
13
|
{
|
14
|
-
onClick:
|
15
|
-
className:
|
16
|
-
style:
|
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:
|
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
|
-
|
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:
|
43
|
+
cursor: c || e ? "pointer" : "default"
|
44
44
|
},
|
45
|
-
onClick:
|
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
|
-
},
|
53
|
+
}, _ = (r, t = 120) => r ? /* @__PURE__ */ a(l, { sx: { maxWidth: t }, className: "user-card__top-right-content", children: r() }) : null;
|
54
54
|
export {
|
55
|
-
|
56
|
-
|
55
|
+
N as renderAvatar,
|
56
|
+
_ as renderTopRight
|
57
57
|
};
|
package/lib/Util/deprecate.js
CHANGED
@@ -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
|
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);
|
package/lib/Util/federated.js
CHANGED
@@ -1,24 +1,20 @@
|
|
1
|
-
import
|
2
|
-
const
|
3
|
-
function
|
4
|
-
|
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
|
-
|
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
|
-
|
13
|
-
return (p == null ? void 0 : p.status) === "approved";
|
10
|
+
return d(e)?.status === "approved";
|
14
11
|
}
|
15
|
-
function
|
16
|
-
|
17
|
-
return p == null ? void 0 : p.appPid;
|
12
|
+
function w(e = window.blocklet) {
|
13
|
+
return o(e)?.appPid;
|
18
14
|
}
|
19
|
-
function
|
20
|
-
const p =
|
21
|
-
return !
|
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
|
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 = [],
|
64
|
-
return
|
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
|
67
|
-
if (!p &&
|
68
|
-
return
|
62
|
+
async function l(e, p = !1) {
|
63
|
+
if (!p && a[e])
|
64
|
+
return a[e];
|
69
65
|
try {
|
70
|
-
const
|
71
|
-
|
72
|
-
const
|
73
|
-
return
|
74
|
-
} catch (
|
75
|
-
return console.error(`Failed to get blocklet data: ${e}`,
|
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
|
-
|
76
|
+
l as getBlockletData,
|
81
77
|
d as getConfig,
|
82
|
-
|
83
|
-
|
78
|
+
u as getCurrentApp,
|
79
|
+
c as getFederatedApp,
|
84
80
|
s as getFederatedEnabled,
|
85
|
-
|
86
|
-
|
81
|
+
o as getMaster,
|
82
|
+
w as getSourceAppPid
|
87
83
|
};
|
package/lib/Util/iframe.js
CHANGED
@@ -1,17 +1,16 @@
|
|
1
|
-
function i(
|
2
|
-
return `callback_${
|
1
|
+
function i(e, n) {
|
2
|
+
return `callback_${n}_${e}`;
|
3
3
|
}
|
4
|
-
async function
|
5
|
-
|
6
|
-
|
7
|
-
|
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",
|
9
|
+
window.addEventListener("message", s);
|
11
10
|
});
|
12
|
-
return
|
11
|
+
return e?.contentWindow?.postMessage({ action: n, callback: t }, "*"), a;
|
13
12
|
}
|
14
13
|
export {
|
15
|
-
|
14
|
+
l as callIframe,
|
16
15
|
i as getCallbackAction
|
17
16
|
};
|