@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.
- 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
package/lib/Util/index.js
CHANGED
@@ -17,20 +17,20 @@ import L from "dayjs/plugin/localizedFormat";
|
|
17
17
|
import { DID_PREFIX as P, BLOCKLET_SERVICE_PATH_PREFIX as v } from "./constant.js";
|
18
18
|
import { getFederatedEnabled as C } from "./federated.js";
|
19
19
|
let f = null;
|
20
|
-
const
|
21
|
-
function z(
|
22
|
-
if (!
|
20
|
+
const M = /^(\d{1,3}\.){3}\d{1,3}(:\d+)?$/, V = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]), _ = /* @__PURE__ */ new Set(["uk", "au", "cn", "nz", "za", "in", "br", "mx", "fr", "it", "ca"]);
|
21
|
+
function z(t) {
|
22
|
+
if (!t)
|
23
23
|
return !1;
|
24
|
-
const
|
25
|
-
if (
|
26
|
-
const r =
|
27
|
-
return
|
24
|
+
const e = t.split(".");
|
25
|
+
if (e.length < 2) return !1;
|
26
|
+
const r = e[e.length - 2], n = e[e.length - 1];
|
27
|
+
return V.has(r) && _.has(n);
|
28
28
|
}
|
29
|
-
function
|
30
|
-
const { host:
|
31
|
-
if (!
|
29
|
+
function mt() {
|
30
|
+
const { host: t } = window.location;
|
31
|
+
if (!t || M.test(t))
|
32
32
|
return "";
|
33
|
-
const r =
|
33
|
+
const r = t.split(":")[0].split(".");
|
34
34
|
if (r.length === 1)
|
35
35
|
return "";
|
36
36
|
if (r.length > 2) {
|
@@ -40,31 +40,31 @@ function me() {
|
|
40
40
|
}
|
41
41
|
return `.${r.slice(-2).join(".")}`;
|
42
42
|
}
|
43
|
-
function
|
44
|
-
return
|
43
|
+
function dt(t) {
|
44
|
+
return t.replace(/^\?/, "").split("&").map((e) => e.split("=")).filter(([e]) => !!e).reduce((e, r) => {
|
45
45
|
const n = r[0], i = decodeURIComponent(r[1]) || !0;
|
46
|
-
return
|
46
|
+
return e[n] = i, e;
|
47
47
|
}, {});
|
48
48
|
}
|
49
|
-
function
|
50
|
-
return new URLSearchParams(
|
49
|
+
function pt(t = {}) {
|
50
|
+
return new URLSearchParams(t).toString();
|
51
51
|
}
|
52
|
-
function
|
53
|
-
let
|
54
|
-
typeof
|
52
|
+
function ht(t = 1) {
|
53
|
+
let e = t;
|
54
|
+
typeof e == "number" && (e = { expireInDays: e }), e.path === void 0 && (e.path = "/"), e.expireInDays || (e.expireInDays = 1);
|
55
55
|
const r = {
|
56
|
-
expires:
|
57
|
-
path:
|
58
|
-
domain:
|
59
|
-
sameSite:
|
56
|
+
expires: e.expireInDays,
|
57
|
+
path: e.path,
|
58
|
+
domain: e.domain || "",
|
59
|
+
sameSite: e.sameSite || "Lax",
|
60
60
|
// 允许自定义设置为 false,默认是 true
|
61
|
-
secure:
|
61
|
+
secure: e.secure !== !1
|
62
62
|
};
|
63
|
-
return (typeof window > "u" ||
|
63
|
+
return (typeof window > "u" || e.domain || e.returnDomain === !1) && e.returnDomain === !1 && delete r.domain, r;
|
64
64
|
}
|
65
|
-
const
|
66
|
-
function
|
67
|
-
const n = Object.assign({},
|
65
|
+
const gt = (t) => t.color ? t.color : t.dark ? t.theme.palette.common.white : t.theme.palette.text.primary, wt = (t) => t.background ? t.background : t.dark ? t.theme.palette.common.black : t.theme.palette.common.white;
|
66
|
+
function yt(t, e, r = []) {
|
67
|
+
const n = Object.assign({}, t), i = e.defaultProps || {};
|
68
68
|
return Object.keys(i).forEach((o) => {
|
69
69
|
typeof n[o] == "string" && n[o].indexOf("::prop::") === 0 && (n[o] = i[o]);
|
70
70
|
}), Array.isArray(r) && r.forEach((o) => {
|
@@ -77,31 +77,31 @@ function ye(e, t, r = []) {
|
|
77
77
|
typeof n[o] == "string" && n[o].indexOf("::prop::") === 0 && (n[o] = "");
|
78
78
|
}), n;
|
79
79
|
}
|
80
|
-
function
|
81
|
-
const
|
82
|
-
return `${
|
80
|
+
function It(t = 2017) {
|
81
|
+
const e = (/* @__PURE__ */ new Date()).getFullYear();
|
82
|
+
return `${e}` == `${t}` ? `© ArcBlock ${e}` : `© ArcBlock ${t} - ${e}`;
|
83
83
|
}
|
84
|
-
const
|
85
|
-
let
|
86
|
-
for (let n = 0; n <
|
87
|
-
|
84
|
+
const Dt = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "function" && typeof Intl.DateTimeFormat().resolvedOptions == "function" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "", bt = (t) => {
|
85
|
+
let e = 0;
|
86
|
+
for (let n = 0; n < t.length; n++)
|
87
|
+
e = t.charCodeAt(n) + ((e << 5) - e);
|
88
88
|
let r = "#";
|
89
89
|
for (let n = 0; n < 3; n++) {
|
90
|
-
const i =
|
90
|
+
const i = e >> n * 8 & 255;
|
91
91
|
r += `00${i.toString(16)}`.substr(-2);
|
92
92
|
}
|
93
93
|
return r;
|
94
|
-
}, $
|
95
|
-
const
|
94
|
+
}, $t = (t) => {
|
95
|
+
const e = Math.round(t / 1e3), r = Math.floor(e / 3600), n = Math.floor((e - r * 3600) / 60), i = e % 60;
|
96
96
|
return `${u(r, 2, "0")}:${u(n, 2, "0")}:${u(i, 2, "0")}`;
|
97
97
|
};
|
98
|
-
function B(
|
99
|
-
f =
|
98
|
+
function B(t) {
|
99
|
+
f = t;
|
100
100
|
}
|
101
|
-
function
|
101
|
+
function Tt() {
|
102
102
|
return f;
|
103
103
|
}
|
104
|
-
const I = (
|
104
|
+
const I = (t) => (e, { locale: r, tz: n, isUtc: i } = {}) => {
|
105
105
|
if (f === null && (a.extend(L), a.extend(j), a.extend(O), a.extend(W), a.extend(R), a.updateLocale("zh-cn", {
|
106
106
|
// copy with https://github.com/iamkun/dayjs/blob/dev/src/locale/zh-cn.js
|
107
107
|
relativeTime: {
|
@@ -119,29 +119,29 @@ const I = (e) => (t, { locale: r, tz: n, isUtc: i } = {}) => {
|
|
119
119
|
y: "1 年",
|
120
120
|
yy: "%d 年"
|
121
121
|
}
|
122
|
-
}), B(a)), y(
|
122
|
+
}), B(a)), y(e) || e === "")
|
123
123
|
return "-";
|
124
|
-
let o = f(
|
125
|
-
return n && (o = o.tz(n)), i && (o = o.utc()), typeof r < "u" && (o = o.locale(r)), o.format(
|
124
|
+
let o = f(e);
|
125
|
+
return n && (o = o.tz(n)), i && (o = o.utc()), typeof r < "u" && (o = o.locale(r)), o.format(t);
|
126
126
|
};
|
127
|
-
function
|
128
|
-
return I("ll")(
|
127
|
+
function St(t, { locale: e = "en", tz: r } = {}) {
|
128
|
+
return I("ll")(t, { locale: e, tz: r });
|
129
129
|
}
|
130
|
-
function
|
131
|
-
locale:
|
130
|
+
function Et(t, {
|
131
|
+
locale: e = "en",
|
132
132
|
tz: r,
|
133
133
|
isUtc: n = !1,
|
134
134
|
format: i = "lll"
|
135
135
|
} = {}) {
|
136
|
-
return I(i)(
|
136
|
+
return I(i)(t, { locale: e, tz: r, isUtc: n });
|
137
137
|
}
|
138
138
|
function N() {
|
139
|
-
const
|
140
|
-
return
|
139
|
+
const t = window?.ABT_DEV || window.ABT;
|
140
|
+
return t && typeof t.open == "function" ? t : null;
|
141
141
|
}
|
142
|
-
function
|
143
|
-
webWalletUrl:
|
144
|
-
action:
|
142
|
+
function xt({
|
143
|
+
webWalletUrl: t,
|
144
|
+
action: e = "login",
|
145
145
|
locale: r = "en",
|
146
146
|
url: n,
|
147
147
|
windowFeatures: i,
|
@@ -151,7 +151,7 @@ function xe({
|
|
151
151
|
const h = N();
|
152
152
|
if (h)
|
153
153
|
return h.open({
|
154
|
-
action:
|
154
|
+
action: e,
|
155
155
|
locale: r,
|
156
156
|
url: encodeURIComponent(n),
|
157
157
|
appInfo: {
|
@@ -171,7 +171,7 @@ function xe({
|
|
171
171
|
// iphone 8plus size
|
172
172
|
width: 414,
|
173
173
|
height: 736
|
174
|
-
}, b = `${
|
174
|
+
}, b = `${t}?action=${e}&locale=${r}&url=${encodeURIComponent(n)}`, c = Object.assign({}, D, i), $ = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
|
175
175
|
if (!("left" in c)) {
|
176
176
|
const s = $(window.top || window), S = window.screenLeft || window.screenX;
|
177
177
|
c.left = s + S - c.width;
|
@@ -183,53 +183,53 @@ function xe({
|
|
183
183
|
const T = Object.keys(c).map((s) => `${s}=${c[s]}`).join(",");
|
184
184
|
return window.open(b, "targetWindow", T), { type: "web" };
|
185
185
|
}
|
186
|
-
const
|
187
|
-
const
|
188
|
-
return !!/^(0x)?[0-9a-f]{40}$/i.test(
|
189
|
-
}, K = (
|
190
|
-
if (!
|
191
|
-
return
|
186
|
+
const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) => {
|
187
|
+
const e = t.replace(P, "");
|
188
|
+
return !!/^(0x)?[0-9a-f]{40}$/i.test(e);
|
189
|
+
}, K = (t, e) => {
|
190
|
+
if (!e)
|
191
|
+
return t;
|
192
192
|
try {
|
193
|
-
const r = new URL(
|
194
|
-
return Object.keys(
|
195
|
-
r.searchParams.set(n, String(
|
193
|
+
const r = new URL(t, window.location.origin);
|
194
|
+
return Object.keys(e).forEach((n) => {
|
195
|
+
r.searchParams.set(n, String(e[n]));
|
196
196
|
}), r.origin === window.location.origin ? r.pathname + r.search : r.href;
|
197
197
|
} catch {
|
198
|
-
return
|
198
|
+
return t;
|
199
199
|
}
|
200
|
-
},
|
200
|
+
}, At = (t, e = 48) => t && (t.indexOf(v) >= 0 ? K(t, {
|
201
201
|
imageFilter: "resize",
|
202
|
-
w:
|
203
|
-
h:
|
204
|
-
}) :
|
202
|
+
w: e,
|
203
|
+
h: e
|
204
|
+
}) : t), Ft = (t = 0) => new Promise((e) => {
|
205
205
|
setTimeout(() => {
|
206
|
-
|
207
|
-
},
|
208
|
-
}),
|
209
|
-
|
206
|
+
e();
|
207
|
+
}, t);
|
208
|
+
}), Ut = (t) => /^https?:\/\//.test(t), m = "vid", d = "__visitor_id", Q = () => l.get(m) || localStorage.getItem(d), w = (t) => {
|
209
|
+
t === null ? l.remove(m, {
|
210
210
|
sameSite: "None",
|
211
211
|
secure: !0
|
212
|
-
}) : l.set(m,
|
212
|
+
}) : l.set(m, t, {
|
213
213
|
sameSite: "None",
|
214
214
|
secure: !0,
|
215
215
|
expires: 365
|
216
216
|
});
|
217
|
-
},
|
218
|
-
let
|
219
|
-
if (
|
217
|
+
}, jt = () => {
|
218
|
+
let t = localStorage.getItem(d);
|
219
|
+
if (t && (localStorage.removeItem(d), w(t)), !Q()) {
|
220
220
|
if (!C())
|
221
221
|
try {
|
222
222
|
if (window.crypto && typeof window.crypto.randomUUID == "function")
|
223
|
-
|
223
|
+
t = window.crypto.randomUUID();
|
224
224
|
else {
|
225
|
-
const
|
225
|
+
const e = new Uint8Array(16);
|
226
226
|
if (window.crypto && typeof window.crypto.getRandomValues == "function")
|
227
|
-
window.crypto.getRandomValues(
|
227
|
+
window.crypto.getRandomValues(e);
|
228
228
|
else
|
229
229
|
for (let n = 0; n < 16; n++)
|
230
|
-
|
231
|
-
const r = Array.from(
|
232
|
-
|
230
|
+
e[n] = Math.floor(Math.random() * 256);
|
231
|
+
const r = Array.from(e).map((n) => n.toString(16).padStart(2, "0"));
|
232
|
+
t = [
|
233
233
|
r.slice(0, 4).join(""),
|
234
234
|
r.slice(4, 6).join(""),
|
235
235
|
r.slice(6, 8).join(""),
|
@@ -238,83 +238,82 @@ const ke = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", X = (e) =
|
|
238
238
|
].join("-");
|
239
239
|
}
|
240
240
|
} catch {
|
241
|
-
|
241
|
+
t = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
242
242
|
}
|
243
|
-
|
243
|
+
t && w(t);
|
244
244
|
}
|
245
|
-
},
|
246
|
-
if (X(
|
247
|
-
const
|
248
|
-
|
245
|
+
}, Ot = (t) => {
|
246
|
+
if (X(t)) {
|
247
|
+
const e = Uint8Array.from(
|
248
|
+
t.slice(2).match(/.{1,2}/g).map((r) => parseInt(r, 16))
|
249
249
|
).slice(0, 8).reduce((r, n) => r + n, 0) % g.length;
|
250
|
-
return g[
|
250
|
+
return g[e];
|
251
251
|
}
|
252
252
|
try {
|
253
|
-
|
254
|
-
return t == null ? void 0 : t.color;
|
253
|
+
return x(t)?.color;
|
255
254
|
} catch {
|
256
255
|
return null;
|
257
256
|
}
|
258
|
-
},
|
257
|
+
}, Rt = (t, e, r = {}) => {
|
259
258
|
const { fallbackLocale: n = "en", defaultValue: i = "unknown" } = r;
|
260
|
-
if (typeof
|
261
|
-
return
|
259
|
+
if (typeof t == "string")
|
260
|
+
return t;
|
262
261
|
let o;
|
263
|
-
return
|
264
|
-
},
|
262
|
+
return e && (o = t[e]), (!o || typeof o != "string") && (o = t[n]), (!o || typeof o != "string") && (o = i), o;
|
263
|
+
}, Wt = (t) => E(
|
265
264
|
() => A(
|
266
265
|
async () => {
|
267
266
|
try {
|
268
|
-
return await
|
269
|
-
} catch (
|
270
|
-
throw
|
267
|
+
return await t();
|
268
|
+
} catch (e) {
|
269
|
+
throw e instanceof TypeError && !e.message.includes("Failed to fetch") ? e : e instanceof Error ? new Error(e.message) : new Error("Unknown error");
|
271
270
|
}
|
272
271
|
},
|
273
272
|
// 只需要重试两次,加上原本的一次,总共三次
|
274
273
|
{ retries: 2 }
|
275
274
|
)
|
276
|
-
),
|
277
|
-
function
|
278
|
-
const [r, n, i] = F.hex.rgb(
|
279
|
-
return `rgba(${r}, ${n}, ${i}, ${
|
275
|
+
), Lt = (t) => k(t, y);
|
276
|
+
function Pt(t, e = 1) {
|
277
|
+
const [r, n, i] = F.hex.rgb(t);
|
278
|
+
return `rgba(${r}, ${n}, ${i}, ${e})`;
|
280
279
|
}
|
281
|
-
function
|
282
|
-
if (!Array.isArray(
|
280
|
+
function vt(t, e) {
|
281
|
+
if (!Array.isArray(t))
|
283
282
|
throw new Error("First argument should be an array");
|
284
|
-
return
|
283
|
+
return t.length === 0 ? {} : t.length === 1 ? t[0] : t.reduce((r, n) => U(r, n, e));
|
285
284
|
}
|
286
285
|
export {
|
287
286
|
K as appendParams,
|
288
|
-
|
289
|
-
|
287
|
+
Lt as cleanedObj,
|
288
|
+
vt as deepmergeAll,
|
290
289
|
N as detectWalletExtension,
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
$
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
290
|
+
jt as ensureVisitorId,
|
291
|
+
St as formatToDate,
|
292
|
+
Et as formatToDatetime,
|
293
|
+
$t as formatUptime,
|
294
|
+
wt as getBackground,
|
295
|
+
gt as getColor,
|
296
|
+
ht as getCookieOptions,
|
297
|
+
It as getCopyright,
|
298
|
+
Ot as getDIDColor,
|
299
|
+
Tt as getDateTool,
|
300
|
+
kt as getFontSize,
|
301
|
+
Dt as getTimezone,
|
302
|
+
Rt as getTranslation,
|
303
|
+
At as getUserAvatar,
|
305
304
|
Q as getVisitorId,
|
306
|
-
|
305
|
+
Pt as hexToRgba,
|
307
306
|
X as isEthereumDid,
|
308
307
|
z as isTwoSegmentTLD,
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
308
|
+
Ut as isUrl,
|
309
|
+
Wt as lazyRetry,
|
310
|
+
yt as mergeProps,
|
311
|
+
xt as openWebWallet,
|
312
|
+
dt as parseQuery,
|
313
|
+
mt as resolveRootDomain,
|
315
314
|
B as setDateTool,
|
316
315
|
w as setVisitorId,
|
317
|
-
|
318
|
-
|
319
|
-
|
316
|
+
Ft as sleep,
|
317
|
+
bt as str2color,
|
318
|
+
pt as stringifyQuery
|
320
319
|
};
|
package/lib/Util/security.js
CHANGED
@@ -1,34 +1,33 @@
|
|
1
1
|
class i extends Error {
|
2
2
|
}
|
3
|
-
function
|
3
|
+
function h(t, {
|
4
4
|
throwOnError: r = !0,
|
5
|
-
returnRaw:
|
5
|
+
returnRaw: a = !1,
|
6
6
|
// 根据 URL 的规范,protocol 以 : 结尾
|
7
7
|
allowProtocols: l = ["https:", "http:"],
|
8
8
|
// host 中可能会携带端口号,需要使用 hostname 来获取干净的域名
|
9
9
|
allowDomains: n = void 0
|
10
10
|
} = {}) {
|
11
|
-
|
12
|
-
n === void 0 && (n = ((s = window.blocklet) == null ? void 0 : s.domainAliases) || [], n.push(window.location.href));
|
11
|
+
n === void 0 && (n = window.blocklet?.domainAliases || [], n.push(window.location.href));
|
13
12
|
try {
|
14
13
|
let o;
|
15
14
|
t.startsWith("/") ? o = window.location.origin : t.startsWith("./") && (o = window.location.href);
|
16
|
-
const e = new URL(t, o),
|
15
|
+
const e = new URL(t, o), s = n && n.map((c) => {
|
17
16
|
try {
|
18
|
-
return new URL(
|
17
|
+
return new URL(c).hostname;
|
19
18
|
} catch {
|
20
|
-
return new URL(`https://${
|
19
|
+
return new URL(`https://${c}`).hostname;
|
21
20
|
}
|
22
21
|
});
|
23
22
|
if (l !== null && !l.includes(e.protocol)) {
|
24
23
|
if (console.error(`Invalid protocol: ${e.protocol}`), r) throw new i(`Invalid protocol: ${e.protocol}`);
|
25
24
|
return null;
|
26
25
|
}
|
27
|
-
if (
|
26
|
+
if (s !== null && !s.includes(e.hostname)) {
|
28
27
|
if (console.error(`Invalid host: ${e.hostname}`), r) throw new i(`Invalid host: ${e.hostname}`);
|
29
28
|
return null;
|
30
29
|
}
|
31
|
-
return
|
30
|
+
return a ? t : e.href;
|
32
31
|
} catch (o) {
|
33
32
|
if (o instanceof i) {
|
34
33
|
if (r) throw o;
|
@@ -39,5 +38,5 @@ function f(t, {
|
|
39
38
|
}
|
40
39
|
}
|
41
40
|
export {
|
42
|
-
|
41
|
+
h as getSafeUrl
|
43
42
|
};
|
package/lib/Util/wallet.js
CHANGED
@@ -1,15 +1,12 @@
|
|
1
|
-
const l = "wallet_url", c = () => {
|
2
|
-
|
3
|
-
|
4
|
-
}, w = (o) => {
|
5
|
-
const { protocol: t } = window.location;
|
6
|
-
let e = "";
|
1
|
+
const l = "wallet_url", c = () => window.localStorage.getItem(l) || window.env?.webWalletUrl || window.blocklet?.webWalletUrl || "https://web.abtwallet.io/", w = (t) => {
|
2
|
+
const { protocol: e } = window.location;
|
3
|
+
let o = "";
|
7
4
|
try {
|
8
|
-
|
5
|
+
o = new URL(t).protocol;
|
9
6
|
} catch {
|
10
|
-
|
7
|
+
o = "";
|
11
8
|
}
|
12
|
-
return
|
9
|
+
return e === o;
|
13
10
|
};
|
14
11
|
export {
|
15
12
|
w as checkSameProtocol,
|
@@ -1,23 +1,23 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { useEffect as
|
3
|
-
import { Box as
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import { mergeSx as
|
7
|
-
const
|
8
|
-
function
|
9
|
-
length:
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
2
|
+
import { useEffect as s } from "react";
|
3
|
+
import { Box as c, TextField as l } from "@mui/material";
|
4
|
+
import p from "lodash/trim";
|
5
|
+
import m from "lodash/noop";
|
6
|
+
import { mergeSx as g } from "../Util/style.js";
|
7
|
+
const y = 6;
|
8
|
+
function B({
|
9
|
+
length: r = y,
|
10
10
|
code: e,
|
11
|
-
onChange: u =
|
12
|
-
onComplete:
|
13
|
-
sx:
|
11
|
+
onChange: u = m,
|
12
|
+
onComplete: a = m,
|
13
|
+
sx: f = {}
|
14
14
|
}) {
|
15
|
-
return
|
16
|
-
e.length ===
|
17
|
-
}, [e,
|
18
|
-
|
15
|
+
return s(() => {
|
16
|
+
e.length === r && a?.(e);
|
17
|
+
}, [e, r]), /* @__PURE__ */ i(
|
18
|
+
c,
|
19
19
|
{
|
20
|
-
sx:
|
20
|
+
sx: g(
|
21
21
|
{
|
22
22
|
width: "100%",
|
23
23
|
maxWidth: 360,
|
@@ -25,22 +25,20 @@ function j({
|
|
25
25
|
justifyContent: "space-between",
|
26
26
|
gap: 1.5
|
27
27
|
},
|
28
|
-
|
28
|
+
f
|
29
29
|
),
|
30
|
-
children: [...Array(
|
31
|
-
|
30
|
+
children: [...Array(r)].map((b, t) => /* @__PURE__ */ i(
|
31
|
+
l,
|
32
32
|
{
|
33
33
|
id: `code-input-${t}`,
|
34
|
-
value:
|
34
|
+
value: p(e[t]) || "",
|
35
35
|
type: "number",
|
36
36
|
onChange: (o) => {
|
37
|
-
|
38
|
-
|
39
|
-
r[t] = o.target.value, u == null || u(r.join("")), o.target.value && t < 5 && ((m = document.getElementById(`code-input-${t + 1}`)) == null || m.focus());
|
37
|
+
const n = e.split("");
|
38
|
+
n[t] = o.target.value, u?.(n.join("")), o.target.value && t < 5 && document.getElementById(`code-input-${t + 1}`)?.focus();
|
40
39
|
},
|
41
40
|
onKeyDown: (o) => {
|
42
|
-
|
43
|
-
o.key === "Backspace" && !n(e[t]) && t > 0 && ((r = document.getElementById(`code-input-${t - 1}`)) == null || r.focus());
|
41
|
+
o.key === "Backspace" && !p(e[t]) && t > 0 && document.getElementById(`code-input-${t - 1}`)?.focus();
|
44
42
|
},
|
45
43
|
required: !0,
|
46
44
|
autoComplete: "off",
|
@@ -67,6 +65,6 @@ function j({
|
|
67
65
|
);
|
68
66
|
}
|
69
67
|
export {
|
70
|
-
|
71
|
-
|
68
|
+
y as VERIFY_CODE_LENGTH,
|
69
|
+
B as default
|
72
70
|
};
|
@@ -1,23 +1,20 @@
|
|
1
|
-
import { useCreation as
|
1
|
+
import { useCreation as g } from "ahooks";
|
2
2
|
import { useTheme as u } from "@mui/material";
|
3
3
|
import "../Theme/theme.js";
|
4
4
|
import "../Theme/theme-provider.js";
|
5
5
|
import f from "./use-mobile.js";
|
6
|
-
function
|
7
|
-
key:
|
8
|
-
meta:
|
6
|
+
function M({
|
7
|
+
key: l = "sm",
|
8
|
+
meta: o = {},
|
9
9
|
theme: t = {},
|
10
|
-
square:
|
10
|
+
square: e
|
11
11
|
} = {}) {
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
const { appLogo: o, appLogoDark: s, appLogoRect: r, appLogoRectDark: m } = Object.assign({}, window.blocklet ?? {}, p), g = e === "dark", i = (g ? s : o) || o;
|
18
|
-
return c || n ? i : (g ? m || s : r) || r || i || "";
|
19
|
-
}, [e, p, c, n]);
|
12
|
+
const p = f({ key: l }), r = u(), n = g(() => t?.palette?.mode || r.palette.mode, [r, t]);
|
13
|
+
return g(() => {
|
14
|
+
const { appLogo: c, appLogoDark: s, appLogoRect: a, appLogoRectDark: L } = Object.assign({}, window.blocklet ?? {}, o), i = n === "dark", m = (i ? s : c) || c;
|
15
|
+
return p || e ? m : (i ? L || s : a) || a || m || "";
|
16
|
+
}, [n, o, p, e]);
|
20
17
|
}
|
21
18
|
export {
|
22
|
-
|
19
|
+
M as default
|
23
20
|
};
|