@edgespark/web 0.0.1-beta.4 → 0.0.1-beta.6
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/README.md +14 -4
- package/dist/auth/create-auth.d.ts +3 -2
- package/dist/auth/types.d.ts +15 -20
- package/dist/auth-ui/ManagedAuthUI.d.ts +1 -0
- package/dist/client.d.ts +6 -5
- package/dist/index.cjs +63 -63
- package/dist/index.es.js +734 -484
- package/package.json +3 -2
package/dist/index.es.js
CHANGED
|
@@ -1,210 +1,432 @@
|
|
|
1
|
-
import { createAuthClient as
|
|
2
|
-
class
|
|
3
|
-
constructor(e,
|
|
4
|
-
super(
|
|
1
|
+
import { createAuthClient as Ue } from "better-auth/client";
|
|
2
|
+
class ee extends Error {
|
|
3
|
+
constructor(e, s) {
|
|
4
|
+
super(s), this.name = "EdgeSparkError", this.code = e;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
class
|
|
7
|
+
class m extends ee {
|
|
8
8
|
constructor(e) {
|
|
9
9
|
super("CONFIG_ERROR", e), this.name = "EdgeSparkConfigError";
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class Se extends ee {
|
|
13
13
|
constructor(e) {
|
|
14
14
|
super("RUNTIME_ERROR", e), this.name = "EdgeSparkRuntimeError";
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
class
|
|
18
|
-
constructor(e,
|
|
19
|
-
super((
|
|
17
|
+
class y extends ee {
|
|
18
|
+
constructor(e, s) {
|
|
19
|
+
super((s == null ? void 0 : s.code) ?? "AUTH_ERROR", e), this.name = "EdgeSparkAuthError", this.cause = s == null ? void 0 : s.cause, this.status = s == null ? void 0 : s.status;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Pe() {
|
|
23
23
|
if (typeof window > "u" || typeof document > "u")
|
|
24
|
-
throw new
|
|
24
|
+
throw new Se(
|
|
25
25
|
"@edgespark/web is browser-only. Create the client from a real browser runtime."
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function Q() {
|
|
29
|
+
return Pe(), window.location.origin;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function Be(t) {
|
|
32
|
+
return t instanceof URL ? t : typeof t == "string" ? new URL(t, window.location.href) : new URL(t.url, window.location.href);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
if (
|
|
36
|
-
throw new
|
|
37
|
-
`Cross-origin requests are not supported by this SDK. Received ${
|
|
34
|
+
function ke(t) {
|
|
35
|
+
if (t.origin !== Q())
|
|
36
|
+
throw new m(
|
|
37
|
+
`Cross-origin requests are not supported by this SDK. Received ${t.origin}, expected ${Q()}.`
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Me() {
|
|
41
41
|
return {
|
|
42
|
-
async fetch(
|
|
43
|
-
const
|
|
44
|
-
return
|
|
42
|
+
async fetch(t, e) {
|
|
43
|
+
const s = Be(t);
|
|
44
|
+
return ke(s), fetch(t, {
|
|
45
45
|
...e,
|
|
46
46
|
credentials: "include"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
const Ee = "/api/_es/auth", Oe = "edgespark-auth-session", Le = "__edgespark_auth_sync__", S = "__edgespark_auth_pending_sign_in__", _e = Symbol("edgespark.notifyAuthTabs"), Ie = 10 * 60 * 1e3, Ve = /* @__PURE__ */ new Set([
|
|
52
|
+
"signOut",
|
|
53
|
+
"revokeSession",
|
|
54
|
+
"revokeSessions",
|
|
55
|
+
"revokeOtherSessions"
|
|
56
|
+
]);
|
|
57
|
+
class Ne {
|
|
58
|
+
constructor(e) {
|
|
59
|
+
this.value = e;
|
|
60
|
+
}
|
|
61
|
+
deref() {
|
|
62
|
+
return this.value;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const ie = globalThis.WeakRef, ne = globalThis.FinalizationRegistry;
|
|
66
|
+
let z, re = !1;
|
|
67
|
+
const A = /* @__PURE__ */ new Map(), D = ne ? new ne((t) => {
|
|
68
|
+
A.delete(t);
|
|
69
|
+
}) : null;
|
|
70
|
+
function Ce(t) {
|
|
71
|
+
return Ue({
|
|
72
|
+
baseURL: Q(),
|
|
73
|
+
basePath: Ee,
|
|
74
|
+
...t != null && t.disableDefaultRedirectPlugin ? { disableDefaultFetchPlugins: !0 } : {},
|
|
57
75
|
fetchOptions: {
|
|
58
76
|
credentials: "include"
|
|
59
77
|
}
|
|
60
78
|
});
|
|
61
79
|
}
|
|
62
|
-
function
|
|
63
|
-
var e,
|
|
64
|
-
return (
|
|
80
|
+
function T(t) {
|
|
81
|
+
var e, s;
|
|
82
|
+
return (s = (e = t.$store) == null ? void 0 : e.atoms) == null ? void 0 : s.session;
|
|
83
|
+
}
|
|
84
|
+
function Fe(t) {
|
|
85
|
+
return JSON.stringify({
|
|
86
|
+
source: t,
|
|
87
|
+
timestamp: Date.now()
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function ze(t) {
|
|
91
|
+
if (typeof t != "string")
|
|
92
|
+
return null;
|
|
93
|
+
try {
|
|
94
|
+
const e = JSON.parse(t);
|
|
95
|
+
return e && typeof e == "object" ? e : null;
|
|
96
|
+
} catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function X(t) {
|
|
101
|
+
var e;
|
|
102
|
+
try {
|
|
103
|
+
return await ((e = T(t)) == null ? void 0 : e.get().refetch()), !0;
|
|
104
|
+
} catch {
|
|
105
|
+
return !1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function Te() {
|
|
109
|
+
return z === void 0 && (z = typeof BroadcastChannel < "u" ? new BroadcastChannel(Oe) : null), z;
|
|
110
|
+
}
|
|
111
|
+
function oe(t) {
|
|
112
|
+
const e = ze(t);
|
|
113
|
+
if (e)
|
|
114
|
+
for (const [s, i] of A) {
|
|
115
|
+
if (s === e.source)
|
|
116
|
+
continue;
|
|
117
|
+
const n = i.deref();
|
|
118
|
+
if (!n) {
|
|
119
|
+
A.delete(s);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
X(n);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function De() {
|
|
126
|
+
var t;
|
|
127
|
+
re || (re = !0, (t = Te()) == null || t.addEventListener("message", (e) => {
|
|
128
|
+
oe(e.data);
|
|
129
|
+
}), typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
130
|
+
e.key !== Le || e.newValue === null || oe(e.newValue);
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
function qe(t, e) {
|
|
134
|
+
ie ? A.set(t, new ie(e)) : (A.clear(), A.set(t, new Ne(e))), D == null || D.register(e, t), De();
|
|
65
135
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
136
|
+
function _(t) {
|
|
137
|
+
var s;
|
|
138
|
+
const e = Fe(t);
|
|
139
|
+
try {
|
|
140
|
+
(s = Te()) == null || s.postMessage(e);
|
|
141
|
+
} catch {
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
window.localStorage.setItem(Le, e);
|
|
145
|
+
} catch {
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function q(t) {
|
|
149
|
+
if (!(typeof window > "u"))
|
|
150
|
+
try {
|
|
151
|
+
window.sessionStorage.setItem(
|
|
152
|
+
S,
|
|
153
|
+
JSON.stringify({
|
|
154
|
+
path: t,
|
|
155
|
+
createdAt: Date.now()
|
|
156
|
+
})
|
|
157
|
+
);
|
|
158
|
+
} catch {
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function U() {
|
|
162
|
+
if (!(typeof window > "u"))
|
|
163
|
+
try {
|
|
164
|
+
window.sessionStorage.removeItem(S);
|
|
165
|
+
} catch {
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function He(t) {
|
|
169
|
+
return !!(t != null && t.session && (t != null && t.user));
|
|
170
|
+
}
|
|
171
|
+
function ae() {
|
|
172
|
+
if (typeof window > "u")
|
|
173
|
+
return !1;
|
|
174
|
+
try {
|
|
175
|
+
const t = window.sessionStorage.getItem(S);
|
|
176
|
+
if (!t)
|
|
177
|
+
return !1;
|
|
178
|
+
window.sessionStorage.removeItem(S);
|
|
179
|
+
const e = JSON.parse(t);
|
|
180
|
+
return !e || typeof e != "object" || typeof e.createdAt != "number" ? !1 : Date.now() - e.createdAt <= Ie;
|
|
181
|
+
} catch {
|
|
182
|
+
return !1;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function je() {
|
|
186
|
+
if (typeof window > "u")
|
|
187
|
+
return !1;
|
|
188
|
+
try {
|
|
189
|
+
const t = window.sessionStorage.getItem(S);
|
|
190
|
+
if (!t)
|
|
191
|
+
return !1;
|
|
192
|
+
const e = JSON.parse(t);
|
|
193
|
+
return !e || typeof e != "object" || typeof e.createdAt != "number" || Date.now() - e.createdAt > Ie ? (window.sessionStorage.removeItem(S), !1) : !0;
|
|
194
|
+
} catch {
|
|
195
|
+
return !1;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function xe(t) {
|
|
199
|
+
if (!(t && typeof t == "object") || "error" in t && t.error)
|
|
200
|
+
return !1;
|
|
201
|
+
const e = "data" in t ? t.data : t;
|
|
202
|
+
return e && typeof e == "object" ? "token" in e && typeof e.token == "string" && e.token.length > 0 ? !0 : "session" in e && "user" in e && !!e.session && !!e.user : !1;
|
|
203
|
+
}
|
|
204
|
+
function We(t) {
|
|
205
|
+
if (!(t && typeof t == "object") || "error" in t && t.error)
|
|
206
|
+
return !1;
|
|
207
|
+
const e = "data" in t ? t.data : t;
|
|
208
|
+
return e && typeof e == "object" ? "url" in e && typeof e.url == "string" : !1;
|
|
209
|
+
}
|
|
210
|
+
function Ge(t) {
|
|
211
|
+
if (R(t) || !(t && typeof t == "object"))
|
|
212
|
+
return !1;
|
|
213
|
+
const e = "data" in t ? t.data : t;
|
|
214
|
+
return e && typeof e == "object" ? "user" in e && !!e.user && "token" in e && e.token === null && !("url" in e) : !1;
|
|
215
|
+
}
|
|
216
|
+
function Ye(t, e) {
|
|
217
|
+
if (t.length !== 1 || t[0] !== "changePassword")
|
|
218
|
+
return !1;
|
|
219
|
+
const [s] = e;
|
|
220
|
+
return !!(s && typeof s == "object" && "revokeOtherSessions" in s && s.revokeOtherSessions === !0);
|
|
221
|
+
}
|
|
222
|
+
function R(t) {
|
|
223
|
+
return !!(t && typeof t == "object" && "error" in t && t.error);
|
|
224
|
+
}
|
|
225
|
+
function Ke(t) {
|
|
226
|
+
if (R(t) || !(t && typeof t == "object"))
|
|
227
|
+
return !1;
|
|
228
|
+
const e = "data" in t ? t.data : t;
|
|
229
|
+
return e && typeof e == "object" ? "message" in e && e.message === "User deleted" : !1;
|
|
230
|
+
}
|
|
231
|
+
function Je(t) {
|
|
232
|
+
return !!(t && (typeof t == "object" || typeof t == "function") && "then" in t && typeof t.then == "function");
|
|
233
|
+
}
|
|
234
|
+
function H(t) {
|
|
235
|
+
if (t instanceof y)
|
|
236
|
+
return t;
|
|
237
|
+
const e = t;
|
|
238
|
+
return new y(
|
|
71
239
|
(e == null ? void 0 : e.message) || "Failed to load the current session.",
|
|
72
240
|
{
|
|
73
241
|
code: (e == null ? void 0 : e.code) ?? "SESSION_LOOKUP_FAILED",
|
|
74
|
-
cause:
|
|
242
|
+
cause: t,
|
|
75
243
|
status: e == null ? void 0 : e.status
|
|
76
244
|
}
|
|
77
245
|
);
|
|
78
246
|
}
|
|
79
|
-
async function
|
|
80
|
-
var
|
|
81
|
-
|
|
247
|
+
async function Ze(t) {
|
|
248
|
+
var s, i;
|
|
249
|
+
let e = null;
|
|
250
|
+
try {
|
|
251
|
+
await ((s = T(t)) == null ? void 0 : s.get().refetch());
|
|
252
|
+
} catch (n) {
|
|
253
|
+
e = n;
|
|
254
|
+
} finally {
|
|
255
|
+
(i = t[_e]) == null || i.call(t);
|
|
256
|
+
}
|
|
257
|
+
if (e)
|
|
258
|
+
throw e;
|
|
82
259
|
}
|
|
83
|
-
function
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
const
|
|
260
|
+
function Qe() {
|
|
261
|
+
const t = Ce(), e = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
262
|
+
qe(e, t);
|
|
263
|
+
const s = 2, i = 500;
|
|
264
|
+
let n = null, a = !1, h;
|
|
265
|
+
const w = (o) => (h = o, o), P = () => {
|
|
87
266
|
var c;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
267
|
+
const o = (c = T(t)) == null ? void 0 : c.get();
|
|
268
|
+
return o != null && o.error && !o.data && h !== void 0 ? h : (o == null ? void 0 : o.data) ?? h ?? null;
|
|
269
|
+
}, E = () => a ? Promise.resolve(P()) : (n || (n = (async () => {
|
|
270
|
+
var l, u, g;
|
|
271
|
+
let o = !1, c = null;
|
|
272
|
+
try {
|
|
273
|
+
for (let p = 0; p <= s; p++) {
|
|
274
|
+
let d = null;
|
|
275
|
+
try {
|
|
276
|
+
d = await t.getSession();
|
|
277
|
+
} catch (v) {
|
|
278
|
+
c = v;
|
|
279
|
+
}
|
|
280
|
+
const b = ((l = T(t)) == null ? void 0 : l.get().data) ?? null;
|
|
281
|
+
if ((u = d == null ? void 0 : d.data) != null && u.session && ((g = d.data) != null && g.user))
|
|
282
|
+
return a = !0, ae() && _(e), w(d.data);
|
|
283
|
+
if (b != null && b.session && (b != null && b.user))
|
|
284
|
+
return a = !0, ae() && _(e), w(b);
|
|
285
|
+
if (d != null && d.error ? c = d.error : d && (o = !0), d && !d.error && je() && p < s) {
|
|
286
|
+
await new Promise(
|
|
287
|
+
(v) => setTimeout(v, i)
|
|
288
|
+
);
|
|
289
|
+
continue;
|
|
103
290
|
}
|
|
104
|
-
if (!
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
} catch (h) {
|
|
112
|
-
throw i = null, B(h);
|
|
291
|
+
if (d && !d.error) {
|
|
292
|
+
const v = P();
|
|
293
|
+
return a = !0, w(v);
|
|
294
|
+
}
|
|
295
|
+
p < s && await new Promise(
|
|
296
|
+
(v) => setTimeout(v, i)
|
|
297
|
+
);
|
|
113
298
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
299
|
+
if (!o)
|
|
300
|
+
throw n = null, new y("Failed to load the current session.", {
|
|
301
|
+
code: "SESSION_LOOKUP_FAILED",
|
|
302
|
+
cause: c
|
|
303
|
+
});
|
|
304
|
+
const f = P();
|
|
305
|
+
return a = !0, w(f);
|
|
306
|
+
} catch (f) {
|
|
307
|
+
throw n = null, H(f);
|
|
308
|
+
}
|
|
309
|
+
})()), n);
|
|
310
|
+
E().catch(() => {
|
|
117
311
|
});
|
|
118
|
-
const
|
|
119
|
-
var
|
|
312
|
+
const L = async () => {
|
|
313
|
+
var o, c;
|
|
120
314
|
try {
|
|
121
|
-
const l = await
|
|
122
|
-
if ((
|
|
315
|
+
const l = await t.getSession();
|
|
316
|
+
if ((o = l.data) != null && o.session && ((c = l.data) != null && c.user))
|
|
123
317
|
return l.data;
|
|
124
|
-
throw l.error ?
|
|
318
|
+
throw l.error ? H(l.error) : new y("No authenticated session is available.", {
|
|
125
319
|
code: "UNAUTHENTICATED"
|
|
126
320
|
});
|
|
127
321
|
} catch (l) {
|
|
128
|
-
throw
|
|
322
|
+
throw H(l);
|
|
129
323
|
}
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
324
|
+
}, $ = async () => {
|
|
325
|
+
await X(t), _(e);
|
|
326
|
+
}, Re = async () => {
|
|
327
|
+
var l;
|
|
328
|
+
const o = await X(t), c = ((l = T(t)) == null ? void 0 : l.get().data) ?? null;
|
|
329
|
+
He(c) ? (U(), _(e)) : o || _(e);
|
|
330
|
+
}, Ae = (o) => {
|
|
331
|
+
let c = !1, l = !1, u;
|
|
332
|
+
const g = (d) => {
|
|
333
|
+
d !== u && (u = d, o(d));
|
|
134
334
|
};
|
|
135
|
-
|
|
136
|
-
|
|
335
|
+
E().then((d) => {
|
|
336
|
+
c || (l = !0, g(w(d)));
|
|
137
337
|
}).catch(() => {
|
|
138
|
-
|
|
338
|
+
c || (l = !0);
|
|
139
339
|
});
|
|
140
|
-
const
|
|
141
|
-
if (!
|
|
340
|
+
const f = T(t);
|
|
341
|
+
if (!f)
|
|
142
342
|
return () => {
|
|
143
|
-
|
|
343
|
+
c = !0;
|
|
144
344
|
};
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
345
|
+
const p = f.subscribe((d) => {
|
|
346
|
+
if (c || !l || d.error && !d.data)
|
|
147
347
|
return;
|
|
148
|
-
const
|
|
149
|
-
|
|
348
|
+
const b = d.data ?? null;
|
|
349
|
+
g(w(b));
|
|
150
350
|
});
|
|
151
351
|
return () => {
|
|
152
|
-
|
|
352
|
+
c = !0, p();
|
|
153
353
|
};
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
354
|
+
}, $e = async (o, c, l) => {
|
|
355
|
+
const u = o[0], g = o.length >= 2 && u === "emailOtp" && o[1] === "verifyEmail";
|
|
356
|
+
return o.length === 1 && (u === "deleteUser" || u === "deleteUserCallback") ? (U(), Ke(l) && await $(), l) : o.length === 1 && u && Ve.has(u) ? (U(), R(l) || await $(), l) : Ye(o, c) && !R(l) ? (U(), await $(), l) : o.length === 1 && u === "changeEmail" && !R(l) ? (await $(), l) : ((u === "signIn" || u === "signUp" || g) && xe(l) ? (U(), await $()) : (u === "signIn" || u === "signUp") && We(l) || u === "signUp" && Ge(l) ? q(o) : u === "verifyEmail" && !R(l) && (q(o), await Re()), l);
|
|
357
|
+
}, te = /* @__PURE__ */ new WeakMap(), se = (o, c) => {
|
|
358
|
+
if (!o || typeof o != "object" && typeof o != "function")
|
|
359
|
+
return o;
|
|
360
|
+
const l = te.get(o);
|
|
361
|
+
if (l)
|
|
362
|
+
return l;
|
|
363
|
+
const u = new Proxy(o, {
|
|
364
|
+
get(g, f, p) {
|
|
365
|
+
if (c.length === 0) {
|
|
366
|
+
if (f === "requireSession")
|
|
367
|
+
return L;
|
|
368
|
+
if (f === "onSessionChange")
|
|
369
|
+
return Ae;
|
|
370
|
+
if (f === _e)
|
|
371
|
+
return () => {
|
|
372
|
+
_(e);
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
const d = Reflect.get(g, f, p);
|
|
376
|
+
return typeof f != "string" ? d : se(d, [...c, f]);
|
|
377
|
+
},
|
|
378
|
+
apply(g, f, p) {
|
|
379
|
+
const d = Reflect.apply(
|
|
380
|
+
g,
|
|
381
|
+
f,
|
|
382
|
+
p
|
|
383
|
+
);
|
|
384
|
+
return Je(d) ? Promise.resolve(d).then(
|
|
385
|
+
(b) => $e(c, p, b)
|
|
386
|
+
) : d;
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
return te.set(o, u), u;
|
|
164
390
|
};
|
|
165
|
-
return
|
|
166
|
-
get(c, a, l) {
|
|
167
|
-
return a === "requireSession" ? u : a === "onSessionChange" ? w : a === "signOut" ? E : Reflect.get(c, a, l);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
391
|
+
return se(t, []);
|
|
170
392
|
}
|
|
171
|
-
function
|
|
172
|
-
return
|
|
393
|
+
function Xe() {
|
|
394
|
+
return Ce({ disableDefaultRedirectPlugin: !0 });
|
|
173
395
|
}
|
|
174
|
-
function
|
|
396
|
+
function B(t) {
|
|
175
397
|
const e = (() => {
|
|
176
|
-
if (
|
|
177
|
-
return
|
|
178
|
-
const
|
|
179
|
-
if (!
|
|
180
|
-
throw new
|
|
398
|
+
if (t instanceof URL)
|
|
399
|
+
return t;
|
|
400
|
+
const s = t.trim();
|
|
401
|
+
if (!s)
|
|
402
|
+
throw new m("redirectTo must not be an empty string.");
|
|
181
403
|
try {
|
|
182
|
-
return new URL(
|
|
404
|
+
return new URL(s, window.location.href);
|
|
183
405
|
} catch {
|
|
184
|
-
throw new
|
|
185
|
-
`redirectTo must be a valid relative path or URL. Received: ${JSON.stringify(
|
|
406
|
+
throw new m(
|
|
407
|
+
`redirectTo must be a valid relative path or URL. Received: ${JSON.stringify(t)}`
|
|
186
408
|
);
|
|
187
409
|
}
|
|
188
410
|
})();
|
|
189
411
|
if (e.protocol !== "http:" && e.protocol !== "https:")
|
|
190
|
-
throw new
|
|
412
|
+
throw new m(
|
|
191
413
|
`redirectTo must resolve to an http(s) URL. Received protocol: ${e.protocol}`
|
|
192
414
|
);
|
|
193
415
|
return e;
|
|
194
416
|
}
|
|
195
|
-
function
|
|
417
|
+
function et(t, e) {
|
|
196
418
|
return e ? {
|
|
197
|
-
common: { ...
|
|
198
|
-
signIn: { ...
|
|
199
|
-
signUp: { ...
|
|
200
|
-
verifyEmail: { ...
|
|
201
|
-
forgotPassword: { ...
|
|
202
|
-
resetPassword: { ...
|
|
203
|
-
oauth: { ...
|
|
204
|
-
errors: { ...
|
|
205
|
-
} :
|
|
419
|
+
common: { ...t.common, ...e.common },
|
|
420
|
+
signIn: { ...t.signIn, ...e.signIn },
|
|
421
|
+
signUp: { ...t.signUp, ...e.signUp },
|
|
422
|
+
verifyEmail: { ...t.verifyEmail, ...e.verifyEmail },
|
|
423
|
+
forgotPassword: { ...t.forgotPassword, ...e.forgotPassword },
|
|
424
|
+
resetPassword: { ...t.resetPassword, ...e.resetPassword },
|
|
425
|
+
oauth: { ...t.oauth, ...e.oauth },
|
|
426
|
+
errors: { ...t.errors, ...e.errors }
|
|
427
|
+
} : t;
|
|
206
428
|
}
|
|
207
|
-
const
|
|
429
|
+
const F = {
|
|
208
430
|
common: {
|
|
209
431
|
loading: "Loading sign-in…",
|
|
210
432
|
redirecting: "Redirecting…",
|
|
@@ -267,7 +489,7 @@ const U = {
|
|
|
267
489
|
invalidCode: "Enter the 6-digit verification code.",
|
|
268
490
|
generic: "Something went wrong. Please try again."
|
|
269
491
|
}
|
|
270
|
-
},
|
|
492
|
+
}, j = {
|
|
271
493
|
common: {
|
|
272
494
|
loading: "加载中…",
|
|
273
495
|
redirecting: "跳转中…",
|
|
@@ -330,7 +552,7 @@ const U = {
|
|
|
330
552
|
invalidCode: "请输入 6 位验证码",
|
|
331
553
|
generic: "出现错误,请稍后重试"
|
|
332
554
|
}
|
|
333
|
-
},
|
|
555
|
+
}, le = {
|
|
334
556
|
common: {
|
|
335
557
|
loading: "サインインを読み込み中…",
|
|
336
558
|
redirecting: "リダイレクト中…",
|
|
@@ -393,7 +615,7 @@ const U = {
|
|
|
393
615
|
invalidCode: "6桁の認証コードを入力してください",
|
|
394
616
|
generic: "エラーが発生しました。もう一度お試しください"
|
|
395
617
|
}
|
|
396
|
-
},
|
|
618
|
+
}, de = {
|
|
397
619
|
common: {
|
|
398
620
|
loading: "로그인 로딩 중…",
|
|
399
621
|
redirecting: "리디렉션 중…",
|
|
@@ -456,7 +678,7 @@ const U = {
|
|
|
456
678
|
invalidCode: "6자리 인증 코드를 입력해 주세요",
|
|
457
679
|
generic: "문제가 발생했습니다. 다시 시도해 주세요"
|
|
458
680
|
}
|
|
459
|
-
},
|
|
681
|
+
}, x = {
|
|
460
682
|
common: {
|
|
461
683
|
loading: "Cargando inicio de sesión…",
|
|
462
684
|
redirecting: "Redirigiendo…",
|
|
@@ -519,7 +741,7 @@ const U = {
|
|
|
519
741
|
invalidCode: "Ingresa el código de verificación de 6 dígitos.",
|
|
520
742
|
generic: "Algo salió mal. Por favor, inténtalo de nuevo."
|
|
521
743
|
}
|
|
522
|
-
},
|
|
744
|
+
}, ce = {
|
|
523
745
|
common: {
|
|
524
746
|
loading: "Carregando login…",
|
|
525
747
|
redirecting: "Redirecionando…",
|
|
@@ -582,7 +804,7 @@ const U = {
|
|
|
582
804
|
invalidCode: "Insira o código de verificação de 6 dígitos.",
|
|
583
805
|
generic: "Algo deu errado. Por favor, tente novamente."
|
|
584
806
|
}
|
|
585
|
-
},
|
|
807
|
+
}, ue = {
|
|
586
808
|
common: {
|
|
587
809
|
loading: "Chargement de la connexion…",
|
|
588
810
|
redirecting: "Redirection…",
|
|
@@ -645,7 +867,7 @@ const U = {
|
|
|
645
867
|
invalidCode: "Saisissez le code de vérification à 6 chiffres.",
|
|
646
868
|
generic: "Une erreur est survenue. Veuillez réessayer."
|
|
647
869
|
}
|
|
648
|
-
},
|
|
870
|
+
}, he = {
|
|
649
871
|
common: {
|
|
650
872
|
loading: "Anmeldung wird geladen…",
|
|
651
873
|
redirecting: "Weiterleitung…",
|
|
@@ -708,7 +930,7 @@ const U = {
|
|
|
708
930
|
invalidCode: "Geben Sie den 6-stelligen Bestätigungscode ein.",
|
|
709
931
|
generic: "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut."
|
|
710
932
|
}
|
|
711
|
-
},
|
|
933
|
+
}, me = {
|
|
712
934
|
common: {
|
|
713
935
|
loading: "Caricamento accesso…",
|
|
714
936
|
redirecting: "Reindirizzamento…",
|
|
@@ -771,7 +993,7 @@ const U = {
|
|
|
771
993
|
invalidCode: "Inserisci il codice di verifica a 6 cifre.",
|
|
772
994
|
generic: "Qualcosa è andato storto. Riprova."
|
|
773
995
|
}
|
|
774
|
-
},
|
|
996
|
+
}, fe = {
|
|
775
997
|
common: {
|
|
776
998
|
loading: "Загрузка входа…",
|
|
777
999
|
redirecting: "Перенаправление…",
|
|
@@ -834,7 +1056,7 @@ const U = {
|
|
|
834
1056
|
invalidCode: "Введите 6-значный код подтверждения.",
|
|
835
1057
|
generic: "Произошла ошибка. Пожалуйста, попробуйте снова."
|
|
836
1058
|
}
|
|
837
|
-
},
|
|
1059
|
+
}, we = {
|
|
838
1060
|
common: {
|
|
839
1061
|
loading: "جارٍ تحميل تسجيل الدخول…",
|
|
840
1062
|
redirecting: "جارٍ إعادة التوجيه…",
|
|
@@ -897,7 +1119,7 @@ const U = {
|
|
|
897
1119
|
invalidCode: "يرجى إدخال رمز التحقّق المكوّن من 6 أرقام.",
|
|
898
1120
|
generic: "حدث خطأ. يرجى المحاولة مرة أخرى."
|
|
899
1121
|
}
|
|
900
|
-
},
|
|
1122
|
+
}, ge = {
|
|
901
1123
|
common: {
|
|
902
1124
|
loading: "सधाइन की जुलातीअ लोड हो रही है…",
|
|
903
1125
|
redirecting: "रीडायरेक्ट हो रहا है…",
|
|
@@ -960,62 +1182,62 @@ const U = {
|
|
|
960
1182
|
invalidCode: "कृपया 6 अंकों का सत्यापन कोड दर्ज करें।",
|
|
961
1183
|
generic: "कुछ गलत हो गई। कृपया फिर से प्रयास करें।"
|
|
962
1184
|
}
|
|
963
|
-
},
|
|
964
|
-
en:
|
|
965
|
-
"en-US":
|
|
966
|
-
zh:
|
|
967
|
-
"zh-CN":
|
|
968
|
-
"zh-TW":
|
|
969
|
-
ja:
|
|
970
|
-
"ja-JP":
|
|
971
|
-
ko:
|
|
972
|
-
"ko-KR":
|
|
973
|
-
es:
|
|
974
|
-
"es-ES":
|
|
975
|
-
"es-MX":
|
|
976
|
-
pt:
|
|
977
|
-
"pt-BR":
|
|
978
|
-
fr:
|
|
979
|
-
"fr-FR":
|
|
980
|
-
de:
|
|
981
|
-
"de-DE":
|
|
982
|
-
it:
|
|
983
|
-
"it-IT":
|
|
984
|
-
ru:
|
|
985
|
-
"ru-RU":
|
|
986
|
-
ar:
|
|
987
|
-
"ar-SA":
|
|
988
|
-
hi:
|
|
989
|
-
"hi-IN":
|
|
1185
|
+
}, pe = {
|
|
1186
|
+
en: F,
|
|
1187
|
+
"en-US": F,
|
|
1188
|
+
zh: j,
|
|
1189
|
+
"zh-CN": j,
|
|
1190
|
+
"zh-TW": j,
|
|
1191
|
+
ja: le,
|
|
1192
|
+
"ja-JP": le,
|
|
1193
|
+
ko: de,
|
|
1194
|
+
"ko-KR": de,
|
|
1195
|
+
es: x,
|
|
1196
|
+
"es-ES": x,
|
|
1197
|
+
"es-MX": x,
|
|
1198
|
+
pt: ce,
|
|
1199
|
+
"pt-BR": ce,
|
|
1200
|
+
fr: ue,
|
|
1201
|
+
"fr-FR": ue,
|
|
1202
|
+
de: he,
|
|
1203
|
+
"de-DE": he,
|
|
1204
|
+
it: me,
|
|
1205
|
+
"it-IT": me,
|
|
1206
|
+
ru: fe,
|
|
1207
|
+
"ru-RU": fe,
|
|
1208
|
+
ar: we,
|
|
1209
|
+
"ar-SA": we,
|
|
1210
|
+
hi: ge,
|
|
1211
|
+
"hi-IN": ge
|
|
990
1212
|
};
|
|
991
|
-
function
|
|
1213
|
+
function tt() {
|
|
992
1214
|
if (typeof navigator > "u")
|
|
993
|
-
return
|
|
994
|
-
const
|
|
995
|
-
for (const e of
|
|
996
|
-
const
|
|
997
|
-
if (
|
|
1215
|
+
return F;
|
|
1216
|
+
const t = navigator.languages ?? [navigator.language];
|
|
1217
|
+
for (const e of t) {
|
|
1218
|
+
const s = pe[e] ?? pe[e.split("-")[0]];
|
|
1219
|
+
if (s) return s;
|
|
998
1220
|
}
|
|
999
|
-
return
|
|
1221
|
+
return F;
|
|
1000
1222
|
}
|
|
1001
|
-
function
|
|
1002
|
-
if (
|
|
1003
|
-
return
|
|
1004
|
-
if (typeof
|
|
1005
|
-
const
|
|
1006
|
-
return new
|
|
1007
|
-
code:
|
|
1008
|
-
status:
|
|
1009
|
-
cause:
|
|
1223
|
+
function W(t, e = "Authentication failed.") {
|
|
1224
|
+
if (t instanceof y)
|
|
1225
|
+
return t;
|
|
1226
|
+
if (typeof t == "object" && t !== null) {
|
|
1227
|
+
const s = t;
|
|
1228
|
+
return new y(s.message || e, {
|
|
1229
|
+
code: s.code,
|
|
1230
|
+
status: s.status,
|
|
1231
|
+
cause: t
|
|
1010
1232
|
});
|
|
1011
1233
|
}
|
|
1012
|
-
return typeof
|
|
1234
|
+
return typeof t == "string" ? new y(t) : new y(e, { cause: t });
|
|
1013
1235
|
}
|
|
1014
|
-
async function
|
|
1015
|
-
var
|
|
1016
|
-
const e = await
|
|
1236
|
+
async function k(t) {
|
|
1237
|
+
var s, i;
|
|
1238
|
+
const e = await t.getSession();
|
|
1017
1239
|
if (e.error)
|
|
1018
|
-
throw new
|
|
1240
|
+
throw new y(
|
|
1019
1241
|
e.error.message || "Failed to load the current session.",
|
|
1020
1242
|
{
|
|
1021
1243
|
code: e.error.code ?? "SESSION_LOOKUP_FAILED",
|
|
@@ -1023,7 +1245,7 @@ async function _(s) {
|
|
|
1023
1245
|
cause: e.error
|
|
1024
1246
|
}
|
|
1025
1247
|
);
|
|
1026
|
-
return (
|
|
1248
|
+
return (s = e.data) != null && s.user && ((i = e.data) != null && i.session) ? {
|
|
1027
1249
|
user: e.data.user,
|
|
1028
1250
|
session: e.data
|
|
1029
1251
|
} : {
|
|
@@ -1031,7 +1253,7 @@ async function _(s) {
|
|
|
1031
1253
|
session: null
|
|
1032
1254
|
};
|
|
1033
1255
|
}
|
|
1034
|
-
const
|
|
1256
|
+
const st = "data-edgespark-auth", r = "edgespark-auth", G = "es_auth_completion", M = "es_auth_email", be = "oauth", O = "verify-sign-in", I = "verify-sign-up", ye = 200, Y = 2, K = {
|
|
1035
1257
|
google: "Google",
|
|
1036
1258
|
apple: "Apple",
|
|
1037
1259
|
microsoft: "Microsoft",
|
|
@@ -1039,24 +1261,27 @@ const fe = "data-edgespark-auth", n = "edgespark-auth", F = "es_auth_completion"
|
|
|
1039
1261
|
gitlab: "GitLab",
|
|
1040
1262
|
discord: "Discord"
|
|
1041
1263
|
};
|
|
1042
|
-
function
|
|
1043
|
-
return "redirectTo" in
|
|
1264
|
+
function C(t) {
|
|
1265
|
+
return "redirectTo" in t;
|
|
1044
1266
|
}
|
|
1045
|
-
function
|
|
1046
|
-
return "onSuccess" in
|
|
1267
|
+
function J(t) {
|
|
1268
|
+
return "onSuccess" in t && !("redirectTo" in t);
|
|
1047
1269
|
}
|
|
1048
|
-
function
|
|
1049
|
-
return !
|
|
1270
|
+
function Z(t) {
|
|
1271
|
+
return !t || typeof t != "string" ? !1 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim());
|
|
1050
1272
|
}
|
|
1051
|
-
function
|
|
1052
|
-
return /^\d{6}$/.test(
|
|
1273
|
+
function it(t) {
|
|
1274
|
+
return /^\d{6}$/.test(t.trim());
|
|
1053
1275
|
}
|
|
1054
|
-
function
|
|
1055
|
-
return
|
|
1276
|
+
function nt(t) {
|
|
1277
|
+
return t === "email" || t === "name" || t === "password" || t === "confirmPassword" || t === "code" || t === "newPassword";
|
|
1056
1278
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1279
|
+
function rt(t) {
|
|
1280
|
+
return !!(t.error || t.errorDescription);
|
|
1281
|
+
}
|
|
1282
|
+
class ot {
|
|
1283
|
+
constructor(e, s, i, n, a) {
|
|
1284
|
+
if (this.container = e, this.auth = s, this.options = i, this.loadConfig = n, this.runtimeOptions = a, this.state = {
|
|
1060
1285
|
view: "loading",
|
|
1061
1286
|
busy: !0,
|
|
1062
1287
|
busyLabel: void 0,
|
|
@@ -1069,58 +1294,75 @@ class Pe {
|
|
|
1069
1294
|
code: "",
|
|
1070
1295
|
newPassword: ""
|
|
1071
1296
|
}, this.destroyed = !1, this.terminalActionInProgress = !1, this.config = null, this.countdownUntil = null, this.countdownTimer = null, this.pendingFocusSnapshot = null, this.focusRestoreTimer = null, this.verificationCompletionAction = null, !(e instanceof HTMLElement))
|
|
1072
|
-
throw new
|
|
1073
|
-
this.labels =
|
|
1297
|
+
throw new m("authUI.mount(container, options) requires a real HTMLElement container.");
|
|
1298
|
+
this.labels = et(tt(), i.labels), this.root = document.createElement("div"), this.root.setAttribute(st, ""), e.innerHTML = "", e.appendChild(this.root), this.render(), this.initialize();
|
|
1074
1299
|
}
|
|
1075
1300
|
destroy() {
|
|
1076
1301
|
this.destroyed || (this.destroyed = !0, this.clearCountdown(), this.clearFocusRestoreTimer(), this.container.innerHTML = "");
|
|
1077
1302
|
}
|
|
1078
1303
|
async initialize() {
|
|
1304
|
+
const e = this.consumeManagedReturnContext();
|
|
1079
1305
|
try {
|
|
1080
|
-
const
|
|
1306
|
+
const [s, i] = await Promise.allSettled([
|
|
1081
1307
|
this.loadConfig(),
|
|
1082
1308
|
this.readMountSession(e)
|
|
1083
1309
|
]);
|
|
1084
1310
|
if (this.destroyed)
|
|
1085
1311
|
return;
|
|
1086
|
-
if (
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1312
|
+
if (i.status === "rejected") {
|
|
1313
|
+
if (e.marker && !rt(e) && C(this.options)) {
|
|
1314
|
+
this.redirectAfterManagedReturnLookupFailure();
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
} else {
|
|
1318
|
+
const a = i.value;
|
|
1319
|
+
if (a.user && a.session) {
|
|
1320
|
+
switch (e.marker) {
|
|
1321
|
+
case be:
|
|
1322
|
+
case O:
|
|
1323
|
+
await this.completeAuth("sign-in", a);
|
|
1324
|
+
return;
|
|
1325
|
+
case I:
|
|
1326
|
+
await this.completeAuth("sign-up", a);
|
|
1327
|
+
return;
|
|
1328
|
+
default:
|
|
1329
|
+
break;
|
|
1330
|
+
}
|
|
1331
|
+
this.handleExistingSessionOnMount(a);
|
|
1332
|
+
return;
|
|
1097
1333
|
}
|
|
1098
|
-
this.handleExistingSessionOnMount(i);
|
|
1099
|
-
return;
|
|
1100
1334
|
}
|
|
1101
|
-
if (
|
|
1335
|
+
if (s.status === "rejected")
|
|
1336
|
+
throw i.status === "rejected" ? i.reason : s.reason;
|
|
1337
|
+
if (this.config = s.value, this.handleSessionlessManagedReturn(e))
|
|
1102
1338
|
return;
|
|
1339
|
+
if (i.status === "rejected")
|
|
1340
|
+
throw i.reason;
|
|
1341
|
+
const n = i.value;
|
|
1103
1342
|
this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.render();
|
|
1104
|
-
} catch (
|
|
1105
|
-
this.handleError(
|
|
1343
|
+
} catch (s) {
|
|
1344
|
+
this.handleError(s, "Failed to load the authentication UI.");
|
|
1106
1345
|
}
|
|
1107
1346
|
}
|
|
1347
|
+
redirectAfterManagedReturnLookupFailure() {
|
|
1348
|
+
C(this.options) && (this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = this.labels.common.redirecting, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(B(this.options.redirectTo).toString()));
|
|
1349
|
+
}
|
|
1108
1350
|
async readMountSession(e) {
|
|
1109
1351
|
if (!e.marker)
|
|
1110
|
-
return
|
|
1111
|
-
let
|
|
1112
|
-
for (let i = 0; i <=
|
|
1352
|
+
return k(this.auth);
|
|
1353
|
+
let s = null;
|
|
1354
|
+
for (let i = 0; i <= Y; i++) {
|
|
1113
1355
|
try {
|
|
1114
|
-
const
|
|
1115
|
-
if (
|
|
1116
|
-
return
|
|
1117
|
-
} catch (
|
|
1118
|
-
|
|
1356
|
+
const n = await k(this.auth);
|
|
1357
|
+
if (n.user && n.session)
|
|
1358
|
+
return n;
|
|
1359
|
+
} catch (n) {
|
|
1360
|
+
s = n;
|
|
1119
1361
|
}
|
|
1120
|
-
i <
|
|
1362
|
+
i < Y && await new Promise((n) => setTimeout(n, ye));
|
|
1121
1363
|
}
|
|
1122
|
-
if (
|
|
1123
|
-
throw
|
|
1364
|
+
if (s)
|
|
1365
|
+
throw s;
|
|
1124
1366
|
return {
|
|
1125
1367
|
user: null,
|
|
1126
1368
|
session: null
|
|
@@ -1135,8 +1377,8 @@ class Pe {
|
|
|
1135
1377
|
return;
|
|
1136
1378
|
}
|
|
1137
1379
|
this.root.innerHTML = `
|
|
1138
|
-
<div class="${
|
|
1139
|
-
<div class="${
|
|
1380
|
+
<div class="${r}__shell">
|
|
1381
|
+
<div class="${r}__card">
|
|
1140
1382
|
${this.renderStatus()}
|
|
1141
1383
|
${this.renderCurrentView()}
|
|
1142
1384
|
</div>
|
|
@@ -1146,9 +1388,9 @@ class Pe {
|
|
|
1146
1388
|
renderLoading() {
|
|
1147
1389
|
const e = this.renderStatus();
|
|
1148
1390
|
return `
|
|
1149
|
-
<div class="${
|
|
1150
|
-
<div class="${
|
|
1151
|
-
${e || `<div class="${
|
|
1391
|
+
<div class="${r}__shell">
|
|
1392
|
+
<div class="${r}__card">
|
|
1393
|
+
${e || `<div class="${r}__status ${r}__status--info">${this.escape(this.labels.common.loading)}</div>`}
|
|
1152
1394
|
</div>
|
|
1153
1395
|
</div>
|
|
1154
1396
|
`;
|
|
@@ -1156,11 +1398,11 @@ class Pe {
|
|
|
1156
1398
|
renderStatus() {
|
|
1157
1399
|
const e = [];
|
|
1158
1400
|
return this.state.error && e.push(
|
|
1159
|
-
`<div class="${
|
|
1401
|
+
`<div class="${r}__status ${r}__status--error">${this.escape(this.state.error)}</div>`
|
|
1160
1402
|
), this.state.notice && e.push(
|
|
1161
|
-
`<div class="${
|
|
1403
|
+
`<div class="${r}__status ${r}__status--info">${this.escape(this.state.notice)}</div>`
|
|
1162
1404
|
), this.state.busy && this.state.busyLabel && e.push(
|
|
1163
|
-
`<div class="${
|
|
1405
|
+
`<div class="${r}__status ${r}__status--muted">${this.escape(this.state.busyLabel)}</div>`
|
|
1164
1406
|
), e.join("");
|
|
1165
1407
|
}
|
|
1166
1408
|
renderCurrentView() {
|
|
@@ -1177,38 +1419,38 @@ class Pe {
|
|
|
1177
1419
|
return this.renderResetPasswordView();
|
|
1178
1420
|
case "loading":
|
|
1179
1421
|
default:
|
|
1180
|
-
return `<p class="${
|
|
1422
|
+
return `<p class="${r}__copy">${this.escape(this.labels.common.loading)}</p>`;
|
|
1181
1423
|
}
|
|
1182
1424
|
}
|
|
1183
1425
|
renderSignInView() {
|
|
1184
|
-
var i,
|
|
1185
|
-
const e = this.renderOAuthProviders(),
|
|
1426
|
+
var i, n;
|
|
1427
|
+
const e = this.renderOAuthProviders(), s = ((i = this.config) == null ? void 0 : i.emailPasswordEnabled) ?? !0;
|
|
1186
1428
|
return `
|
|
1187
|
-
<section class="${
|
|
1188
|
-
<header class="${
|
|
1189
|
-
<h1 class="${
|
|
1190
|
-
<p class="${
|
|
1429
|
+
<section class="${r}__section">
|
|
1430
|
+
<header class="${r}__header">
|
|
1431
|
+
<h1 class="${r}__title">${this.escape(this.labels.signIn.title)}</h1>
|
|
1432
|
+
<p class="${r}__copy">${this.escape(this.labels.signIn.subtitle)}</p>
|
|
1191
1433
|
</header>
|
|
1192
1434
|
${e}
|
|
1193
|
-
${e &&
|
|
1194
|
-
${
|
|
1195
|
-
<form class="${
|
|
1435
|
+
${e && s ? `<div class="${r}__divider"><span>${this.escape(this.labels.oauth.dividerText)}</span></div>` : ""}
|
|
1436
|
+
${s ? `
|
|
1437
|
+
<form class="${r}__form" data-view="sign-in" novalidate>
|
|
1196
1438
|
${this.renderInput("email", this.labels.signIn.emailLabel, "email", this.state.email, "email")}
|
|
1197
1439
|
${this.renderInput("password", this.labels.signIn.passwordLabel, "password", this.state.password, "current-password")}
|
|
1198
|
-
<button class="${
|
|
1440
|
+
<button class="${r}__button ${r}__button--primary" type="submit" ${this.state.busy ? "disabled" : ""}>
|
|
1199
1441
|
${this.escape(this.labels.signIn.submitButton)}
|
|
1200
1442
|
</button>
|
|
1201
1443
|
</form>
|
|
1202
|
-
<div class="${
|
|
1444
|
+
<div class="${r}__actions">
|
|
1203
1445
|
${this.canUsePasswordResetEmailOtp() ? `
|
|
1204
|
-
<button class="${
|
|
1446
|
+
<button class="${r}__link" type="button" data-action="forgot-password" ${this.state.busy ? "disabled" : ""}>
|
|
1205
1447
|
${this.escape(this.labels.signIn.forgotPassword)}
|
|
1206
1448
|
</button>
|
|
1207
1449
|
` : ""}
|
|
1208
|
-
${(
|
|
1209
|
-
<p class="${
|
|
1450
|
+
${(n = this.config) != null && n.disableSignUp ? "" : `
|
|
1451
|
+
<p class="${r}__meta">
|
|
1210
1452
|
${this.escape(this.labels.signIn.signUpPrompt)}
|
|
1211
|
-
<button class="${
|
|
1453
|
+
<button class="${r}__link" type="button" data-action="switch-sign-up" ${this.state.busy ? "disabled" : ""}>
|
|
1212
1454
|
${this.escape(this.labels.signIn.switchToSignUp)}
|
|
1213
1455
|
</button>
|
|
1214
1456
|
</p>
|
|
@@ -1221,25 +1463,25 @@ class Pe {
|
|
|
1221
1463
|
renderSignUpView() {
|
|
1222
1464
|
const e = this.renderOAuthProviders();
|
|
1223
1465
|
return `
|
|
1224
|
-
<section class="${
|
|
1225
|
-
<header class="${
|
|
1226
|
-
<h1 class="${
|
|
1227
|
-
<p class="${
|
|
1466
|
+
<section class="${r}__section">
|
|
1467
|
+
<header class="${r}__header">
|
|
1468
|
+
<h1 class="${r}__title">${this.escape(this.labels.signUp.title)}</h1>
|
|
1469
|
+
<p class="${r}__copy">${this.escape(this.labels.signUp.subtitle)}</p>
|
|
1228
1470
|
</header>
|
|
1229
1471
|
${e}
|
|
1230
|
-
${e ? `<div class="${
|
|
1231
|
-
<form class="${
|
|
1472
|
+
${e ? `<div class="${r}__divider"><span>${this.escape(this.labels.oauth.dividerText)}</span></div>` : ""}
|
|
1473
|
+
<form class="${r}__form" data-view="sign-up" novalidate>
|
|
1232
1474
|
${this.renderInput("name", this.labels.signUp.nameLabel, "text", this.state.name, "name")}
|
|
1233
1475
|
${this.renderInput("email", this.labels.signUp.emailLabel, "email", this.state.email, "email")}
|
|
1234
1476
|
${this.renderInput("password", this.labels.signUp.passwordLabel, "password", this.state.password, "new-password")}
|
|
1235
1477
|
${this.renderInput("confirmPassword", this.labels.signUp.confirmPasswordLabel, "password", this.state.confirmPassword, "new-password")}
|
|
1236
|
-
<button class="${
|
|
1478
|
+
<button class="${r}__button ${r}__button--primary" type="submit" ${this.state.busy ? "disabled" : ""}>
|
|
1237
1479
|
${this.escape(this.labels.signUp.submitButton)}
|
|
1238
1480
|
</button>
|
|
1239
1481
|
</form>
|
|
1240
|
-
<p class="${
|
|
1482
|
+
<p class="${r}__meta">
|
|
1241
1483
|
${this.escape(this.labels.signUp.signInPrompt)}
|
|
1242
|
-
<button class="${
|
|
1484
|
+
<button class="${r}__link" type="button" data-action="switch-sign-in" ${this.state.busy ? "disabled" : ""}>
|
|
1243
1485
|
${this.escape(this.labels.signUp.switchToSignIn)}
|
|
1244
1486
|
</button>
|
|
1245
1487
|
</p>
|
|
@@ -1252,20 +1494,20 @@ class Pe {
|
|
|
1252
1494
|
this.labels.verifyEmail.resendCountdown
|
|
1253
1495
|
);
|
|
1254
1496
|
return `
|
|
1255
|
-
<section class="${
|
|
1256
|
-
<header class="${
|
|
1257
|
-
<h1 class="${
|
|
1258
|
-
<p class="${
|
|
1497
|
+
<section class="${r}__section">
|
|
1498
|
+
<header class="${r}__header">
|
|
1499
|
+
<h1 class="${r}__title">${this.escape(this.labels.verifyEmail.title)}</h1>
|
|
1500
|
+
<p class="${r}__copy">${this.escape(this.labels.verifyEmail.subtitle)}</p>
|
|
1259
1501
|
</header>
|
|
1260
|
-
<p class="${
|
|
1502
|
+
<p class="${r}__copy">
|
|
1261
1503
|
<strong>${this.escape(this.labels.verifyEmail.sentToLabel)}:</strong>
|
|
1262
1504
|
${this.escape(this.state.email)}
|
|
1263
1505
|
</p>
|
|
1264
|
-
<div class="${
|
|
1265
|
-
<button class="${
|
|
1506
|
+
<div class="${r}__stack">
|
|
1507
|
+
<button class="${r}__button ${r}__button--secondary" type="button" data-action="resend-verification" ${this.state.busy || this.isCountdownActive() ? "disabled" : ""}>
|
|
1266
1508
|
${this.escape(e)}
|
|
1267
1509
|
</button>
|
|
1268
|
-
<button class="${
|
|
1510
|
+
<button class="${r}__link" type="button" data-action="use-different-email" ${this.state.busy ? "disabled" : ""}>
|
|
1269
1511
|
${this.escape(this.labels.verifyEmail.changeEmailButton)}
|
|
1270
1512
|
</button>
|
|
1271
1513
|
</div>
|
|
@@ -1274,18 +1516,18 @@ class Pe {
|
|
|
1274
1516
|
}
|
|
1275
1517
|
renderForgotPasswordView() {
|
|
1276
1518
|
return `
|
|
1277
|
-
<section class="${
|
|
1278
|
-
<header class="${
|
|
1279
|
-
<h1 class="${
|
|
1280
|
-
<p class="${
|
|
1519
|
+
<section class="${r}__section">
|
|
1520
|
+
<header class="${r}__header">
|
|
1521
|
+
<h1 class="${r}__title">${this.escape(this.labels.forgotPassword.title)}</h1>
|
|
1522
|
+
<p class="${r}__copy">${this.escape(this.labels.forgotPassword.subtitle)}</p>
|
|
1281
1523
|
</header>
|
|
1282
|
-
<form class="${
|
|
1524
|
+
<form class="${r}__form" data-view="forgot-password" novalidate>
|
|
1283
1525
|
${this.renderInput("email", this.labels.forgotPassword.emailLabel, "email", this.state.email, "email")}
|
|
1284
|
-
<button class="${
|
|
1526
|
+
<button class="${r}__button ${r}__button--primary" type="submit" ${this.state.busy ? "disabled" : ""}>
|
|
1285
1527
|
${this.escape(this.labels.forgotPassword.submitButton)}
|
|
1286
1528
|
</button>
|
|
1287
1529
|
</form>
|
|
1288
|
-
<button class="${
|
|
1530
|
+
<button class="${r}__link" type="button" data-action="switch-sign-in" ${this.state.busy ? "disabled" : ""}>
|
|
1289
1531
|
${this.escape(this.labels.common.backToSignIn)}
|
|
1290
1532
|
</button>
|
|
1291
1533
|
</section>
|
|
@@ -1297,71 +1539,71 @@ class Pe {
|
|
|
1297
1539
|
this.labels.resetPassword.resendCountdown
|
|
1298
1540
|
);
|
|
1299
1541
|
return `
|
|
1300
|
-
<section class="${
|
|
1301
|
-
<header class="${
|
|
1302
|
-
<h1 class="${
|
|
1303
|
-
<p class="${
|
|
1542
|
+
<section class="${r}__section">
|
|
1543
|
+
<header class="${r}__header">
|
|
1544
|
+
<h1 class="${r}__title">${this.escape(this.labels.resetPassword.title)}</h1>
|
|
1545
|
+
<p class="${r}__copy">${this.escape(this.labels.resetPassword.subtitle)}</p>
|
|
1304
1546
|
</header>
|
|
1305
|
-
<form class="${
|
|
1547
|
+
<form class="${r}__form" data-view="reset-password" novalidate>
|
|
1306
1548
|
${this.renderInput("code", this.labels.resetPassword.codeLabel, "text", this.state.code, "one-time-code")}
|
|
1307
1549
|
${this.renderInput("newPassword", this.labels.resetPassword.newPasswordLabel, "password", this.state.newPassword, "new-password")}
|
|
1308
1550
|
${this.renderInput("confirmPassword", this.labels.resetPassword.confirmPasswordLabel, "password", this.state.confirmPassword, "new-password")}
|
|
1309
|
-
<button class="${
|
|
1551
|
+
<button class="${r}__button ${r}__button--primary" type="submit" ${this.state.busy ? "disabled" : ""}>
|
|
1310
1552
|
${this.escape(this.labels.resetPassword.submitButton)}
|
|
1311
1553
|
</button>
|
|
1312
1554
|
</form>
|
|
1313
|
-
<button class="${
|
|
1555
|
+
<button class="${r}__button ${r}__button--secondary" type="button" data-action="resend-reset-code" ${this.state.busy || this.isCountdownActive() ? "disabled" : ""}>
|
|
1314
1556
|
${this.escape(e)}
|
|
1315
1557
|
</button>
|
|
1316
|
-
<button class="${
|
|
1558
|
+
<button class="${r}__link" type="button" data-action="switch-sign-in" ${this.state.busy ? "disabled" : ""}>
|
|
1317
1559
|
${this.escape(this.labels.common.backToSignIn)}
|
|
1318
1560
|
</button>
|
|
1319
1561
|
</section>
|
|
1320
1562
|
`;
|
|
1321
1563
|
}
|
|
1322
1564
|
renderOAuthProviders() {
|
|
1323
|
-
var
|
|
1324
|
-
const e = ((
|
|
1565
|
+
var s;
|
|
1566
|
+
const e = ((s = this.config) == null ? void 0 : s.oauthProviders) ?? [];
|
|
1325
1567
|
return e.length === 0 ? "" : `
|
|
1326
|
-
<div class="${
|
|
1568
|
+
<div class="${r}__stack">
|
|
1327
1569
|
${e.map((i) => `
|
|
1328
|
-
<button class="${
|
|
1329
|
-
${this.escape(`${this.labels.oauth.continueWith} ${
|
|
1570
|
+
<button class="${r}__button ${r}__button--secondary" type="button" data-action="oauth" data-provider="${i}" ${this.state.busy ? "disabled" : ""}>
|
|
1571
|
+
${this.escape(`${this.labels.oauth.continueWith} ${K[i]}`)}
|
|
1330
1572
|
</button>
|
|
1331
1573
|
`).join("")}
|
|
1332
1574
|
</div>
|
|
1333
1575
|
`;
|
|
1334
1576
|
}
|
|
1335
|
-
renderInput(e,
|
|
1577
|
+
renderInput(e, s, i, n, a) {
|
|
1336
1578
|
return `
|
|
1337
|
-
<label class="${
|
|
1338
|
-
<span class="${
|
|
1579
|
+
<label class="${r}__field">
|
|
1580
|
+
<span class="${r}__label">${this.escape(s)}</span>
|
|
1339
1581
|
<input
|
|
1340
|
-
class="${
|
|
1582
|
+
class="${r}__input"
|
|
1341
1583
|
name="${this.escape(e)}"
|
|
1342
1584
|
type="${this.escape(i)}"
|
|
1343
|
-
value="${this.escape(
|
|
1344
|
-
autocomplete="${this.escape(
|
|
1585
|
+
value="${this.escape(n)}"
|
|
1586
|
+
autocomplete="${this.escape(a)}"
|
|
1345
1587
|
${this.state.busy ? "disabled" : ""}
|
|
1346
1588
|
/>
|
|
1347
1589
|
</label>
|
|
1348
1590
|
`;
|
|
1349
1591
|
}
|
|
1350
1592
|
bindDOM() {
|
|
1351
|
-
this.root.querySelectorAll("form[data-view]").forEach((
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1593
|
+
this.root.querySelectorAll("form[data-view]").forEach((n) => {
|
|
1594
|
+
n.addEventListener("submit", (a) => {
|
|
1595
|
+
a.preventDefault();
|
|
1596
|
+
const h = n.dataset.view;
|
|
1597
|
+
h === "sign-in" && this.handleSignIn(), h === "sign-up" && this.handleSignUp(), h === "forgot-password" && this.handleForgotPassword(), h === "reset-password" && this.handleResetPassword();
|
|
1356
1598
|
});
|
|
1357
|
-
}), this.root.querySelectorAll("input[name]").forEach((
|
|
1358
|
-
|
|
1359
|
-
|
|
1599
|
+
}), this.root.querySelectorAll("input[name]").forEach((n) => {
|
|
1600
|
+
n.addEventListener("input", () => {
|
|
1601
|
+
nt(n.name) && (this.state[n.name] = n.value);
|
|
1360
1602
|
});
|
|
1361
|
-
}), this.root.querySelectorAll("[data-action]").forEach((
|
|
1362
|
-
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1603
|
+
}), this.root.querySelectorAll("[data-action]").forEach((n) => {
|
|
1604
|
+
n.addEventListener("click", () => {
|
|
1605
|
+
const a = n.dataset.action;
|
|
1606
|
+
a === "switch-sign-up" && this.switchView("sign-up"), a === "switch-sign-in" && this.switchView("sign-in"), a === "forgot-password" && this.switchView("forgot-password"), a === "resend-verification" && this.resendVerificationEmail(), a === "use-different-email" && this.switchView(this.verificationCompletionAction === "sign-in" ? "sign-in" : "sign-up"), a === "resend-reset-code" && this.resendResetCode(), a === "oauth" && this.handleOAuthSignIn(n.dataset.provider);
|
|
1365
1607
|
});
|
|
1366
1608
|
});
|
|
1367
1609
|
}
|
|
@@ -1369,7 +1611,7 @@ class Pe {
|
|
|
1369
1611
|
this.clearCountdown(), e !== "verify-email" && (this.verificationCompletionAction = null), this.state.view = e, this.state.error = null, this.state.notice = null, this.state.busy = !1, this.state.busyLabel = void 0, this.terminalActionInProgress = !1, this.render();
|
|
1370
1612
|
}
|
|
1371
1613
|
async handleSignIn() {
|
|
1372
|
-
if (!
|
|
1614
|
+
if (!Z(this.state.email)) {
|
|
1373
1615
|
this.failValidation(this.labels.errors.invalidEmail);
|
|
1374
1616
|
return;
|
|
1375
1617
|
}
|
|
@@ -1381,7 +1623,7 @@ class Pe {
|
|
|
1381
1623
|
const e = await this.auth.signIn.email({
|
|
1382
1624
|
email: this.state.email.trim(),
|
|
1383
1625
|
password: this.state.password,
|
|
1384
|
-
callbackURL: this.getManagedReturnURL(
|
|
1626
|
+
callbackURL: this.getManagedReturnURL(O, this.state.email.trim())
|
|
1385
1627
|
});
|
|
1386
1628
|
if (e.error)
|
|
1387
1629
|
throw e.error;
|
|
@@ -1389,12 +1631,12 @@ class Pe {
|
|
|
1389
1631
|
});
|
|
1390
1632
|
}
|
|
1391
1633
|
async handleSignUp() {
|
|
1392
|
-
var e,
|
|
1634
|
+
var e, s;
|
|
1393
1635
|
if (!this.state.name.trim()) {
|
|
1394
1636
|
this.failValidation(this.labels.errors.requiredField);
|
|
1395
1637
|
return;
|
|
1396
1638
|
}
|
|
1397
|
-
if (!
|
|
1639
|
+
if (!Z(this.state.email)) {
|
|
1398
1640
|
this.failValidation(this.labels.errors.invalidEmail);
|
|
1399
1641
|
return;
|
|
1400
1642
|
}
|
|
@@ -1404,7 +1646,7 @@ class Pe {
|
|
|
1404
1646
|
}
|
|
1405
1647
|
if (this.state.password.length < (((e = this.config) == null ? void 0 : e.minPasswordLength) ?? 8)) {
|
|
1406
1648
|
this.failValidation(
|
|
1407
|
-
this.labels.errors.passwordTooShort.replace("{min}", String(((
|
|
1649
|
+
this.labels.errors.passwordTooShort.replace("{min}", String(((s = this.config) == null ? void 0 : s.minPasswordLength) ?? 8))
|
|
1408
1650
|
);
|
|
1409
1651
|
return;
|
|
1410
1652
|
}
|
|
@@ -1413,16 +1655,16 @@ class Pe {
|
|
|
1413
1655
|
return;
|
|
1414
1656
|
}
|
|
1415
1657
|
await this.runAction("Creating account…", async () => {
|
|
1416
|
-
var
|
|
1658
|
+
var n;
|
|
1417
1659
|
const i = await this.auth.signUp.email({
|
|
1418
1660
|
name: this.state.name.trim(),
|
|
1419
1661
|
email: this.state.email.trim(),
|
|
1420
1662
|
password: this.state.password,
|
|
1421
|
-
callbackURL: this.getManagedReturnURL(
|
|
1663
|
+
callbackURL: this.getManagedReturnURL(I, this.state.email.trim())
|
|
1422
1664
|
});
|
|
1423
1665
|
if (i.error)
|
|
1424
1666
|
throw i.error;
|
|
1425
|
-
if ((
|
|
1667
|
+
if ((n = this.config) != null && n.requireEmailVerification) {
|
|
1426
1668
|
this.verificationCompletionAction = "sign-up", this.state.view = "verify-email", this.state.notice = "Check your inbox to verify your email address.", this.startCountdown();
|
|
1427
1669
|
return;
|
|
1428
1670
|
}
|
|
@@ -1430,28 +1672,28 @@ class Pe {
|
|
|
1430
1672
|
});
|
|
1431
1673
|
}
|
|
1432
1674
|
async handleOAuthSignIn(e) {
|
|
1433
|
-
await this.runAction(`Redirecting to ${
|
|
1434
|
-
const
|
|
1675
|
+
await this.runAction(`Redirecting to ${K[e]}…`, async () => {
|
|
1676
|
+
const s = await this.auth.signIn.social({
|
|
1435
1677
|
provider: e,
|
|
1436
1678
|
callbackURL: this.getManagedReturnURL("oauth"),
|
|
1437
1679
|
errorCallbackURL: this.getManagedReturnURL("oauth")
|
|
1438
1680
|
});
|
|
1439
|
-
if (
|
|
1440
|
-
throw
|
|
1441
|
-
const i = this.extractRedirectURL(
|
|
1681
|
+
if (s.error)
|
|
1682
|
+
throw s.error;
|
|
1683
|
+
const i = this.extractRedirectURL(s.data);
|
|
1442
1684
|
if (!i)
|
|
1443
|
-
throw new
|
|
1444
|
-
this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = `Opening ${
|
|
1685
|
+
throw new m(`OAuth sign-in did not return a redirect URL for provider "${e}".`);
|
|
1686
|
+
this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = `Opening ${K[e]}…`, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(i);
|
|
1445
1687
|
});
|
|
1446
1688
|
}
|
|
1447
1689
|
async handleForgotPassword() {
|
|
1448
1690
|
if (!this.canUsePasswordResetEmailOtp()) {
|
|
1449
1691
|
this.handleError(
|
|
1450
|
-
new
|
|
1692
|
+
new m("Password reset via email OTP is not enabled for this project.")
|
|
1451
1693
|
);
|
|
1452
1694
|
return;
|
|
1453
1695
|
}
|
|
1454
|
-
if (!
|
|
1696
|
+
if (!Z(this.state.email)) {
|
|
1455
1697
|
this.failValidation(this.labels.errors.invalidEmail);
|
|
1456
1698
|
return;
|
|
1457
1699
|
}
|
|
@@ -1468,14 +1710,14 @@ class Pe {
|
|
|
1468
1710
|
this.isCountdownActive() || await this.handleForgotPassword();
|
|
1469
1711
|
}
|
|
1470
1712
|
async handleResetPassword() {
|
|
1471
|
-
var e,
|
|
1713
|
+
var e, s;
|
|
1472
1714
|
if (!this.canUsePasswordResetEmailOtp()) {
|
|
1473
1715
|
this.handleError(
|
|
1474
|
-
new
|
|
1716
|
+
new m("Password reset via email OTP is not enabled for this project.")
|
|
1475
1717
|
);
|
|
1476
1718
|
return;
|
|
1477
1719
|
}
|
|
1478
|
-
if (!
|
|
1720
|
+
if (!it(this.state.code)) {
|
|
1479
1721
|
this.failValidation(this.labels.errors.invalidCode);
|
|
1480
1722
|
return;
|
|
1481
1723
|
}
|
|
@@ -1485,7 +1727,7 @@ class Pe {
|
|
|
1485
1727
|
}
|
|
1486
1728
|
if (this.state.newPassword.length < (((e = this.config) == null ? void 0 : e.minPasswordLength) ?? 8)) {
|
|
1487
1729
|
this.failValidation(
|
|
1488
|
-
this.labels.errors.passwordTooShort.replace("{min}", String(((
|
|
1730
|
+
this.labels.errors.passwordTooShort.replace("{min}", String(((s = this.config) == null ? void 0 : s.minPasswordLength) ?? 8))
|
|
1489
1731
|
);
|
|
1490
1732
|
return;
|
|
1491
1733
|
}
|
|
@@ -1509,89 +1751,95 @@ class Pe {
|
|
|
1509
1751
|
}
|
|
1510
1752
|
async sendVerificationEmail(e) {
|
|
1511
1753
|
!e && this.isCountdownActive() || await this.runAction("Sending verification email…", async () => {
|
|
1512
|
-
const
|
|
1754
|
+
const s = await this.auth.sendVerificationEmail({
|
|
1513
1755
|
email: this.state.email.trim(),
|
|
1514
1756
|
callbackURL: this.getManagedReturnURL(
|
|
1515
|
-
this.verificationCompletionAction === "sign-up" ?
|
|
1757
|
+
this.verificationCompletionAction === "sign-up" ? I : O,
|
|
1516
1758
|
this.state.email.trim()
|
|
1517
1759
|
)
|
|
1518
1760
|
});
|
|
1519
|
-
if (
|
|
1520
|
-
throw
|
|
1761
|
+
if (s.error)
|
|
1762
|
+
throw s.error;
|
|
1521
1763
|
this.handleVerificationEmailSent(this.state.email.trim(), !0);
|
|
1522
1764
|
});
|
|
1523
1765
|
}
|
|
1524
|
-
async completeAuth(e,
|
|
1766
|
+
async completeAuth(e, s) {
|
|
1525
1767
|
const i = await this.retryAuthCompletionDataIfNeeded(
|
|
1526
|
-
|
|
1768
|
+
s ?? await this.resolveAuthCompletionData()
|
|
1527
1769
|
);
|
|
1770
|
+
if (this.destroyed)
|
|
1771
|
+
return;
|
|
1528
1772
|
if (!i.user || !i.session) {
|
|
1529
|
-
if (
|
|
1530
|
-
|
|
1773
|
+
if (this.destroyed)
|
|
1774
|
+
return;
|
|
1775
|
+
if (i.lookupError && C(this.options)) {
|
|
1776
|
+
this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = this.labels.common.redirecting, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(B(this.options.redirectTo).toString());
|
|
1531
1777
|
return;
|
|
1532
1778
|
}
|
|
1533
1779
|
if (e === "sign-in")
|
|
1534
|
-
throw i.lookupError ?? new
|
|
1780
|
+
throw i.lookupError ?? new Se(
|
|
1535
1781
|
"Managed sign-in completed without an authenticated session."
|
|
1536
1782
|
);
|
|
1537
1783
|
this.state.view = "sign-in", this.state.password = "", this.state.confirmPassword = "", this.state.error = null, this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = "Account created. Sign in to continue.", this.render();
|
|
1538
1784
|
return;
|
|
1539
1785
|
}
|
|
1540
|
-
const
|
|
1786
|
+
const n = {
|
|
1541
1787
|
action: e,
|
|
1542
1788
|
user: i.user,
|
|
1543
1789
|
session: i.session
|
|
1544
1790
|
};
|
|
1545
|
-
if (await this.syncPublicSessionBestEffort(),
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1791
|
+
if (await this.syncPublicSessionBestEffort(), !this.destroyed) {
|
|
1792
|
+
if (C(this.options)) {
|
|
1793
|
+
this.terminalActionInProgress = !0, this.invokeRedirectModeSuccessHook(n), this.state.busy = !0, this.state.busyLabel = this.labels.common.redirecting, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(B(this.options.redirectTo).toString());
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
if (J(this.options)) {
|
|
1797
|
+
this.options.onSuccess(n), this.terminalActionInProgress = !0;
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1552
1800
|
}
|
|
1553
1801
|
}
|
|
1554
1802
|
async retryAuthCompletionDataIfNeeded(e) {
|
|
1555
1803
|
if (e.session)
|
|
1556
1804
|
return e;
|
|
1557
|
-
let
|
|
1558
|
-
for (let i = 0; i <
|
|
1559
|
-
await new Promise((
|
|
1805
|
+
let s = e.lookupError;
|
|
1806
|
+
for (let i = 0; i < Y; i++) {
|
|
1807
|
+
await new Promise((n) => setTimeout(n, ye));
|
|
1560
1808
|
try {
|
|
1561
|
-
const
|
|
1562
|
-
if (
|
|
1809
|
+
const n = await k(this.auth);
|
|
1810
|
+
if (n.user && n.session)
|
|
1563
1811
|
return {
|
|
1564
|
-
user:
|
|
1565
|
-
session:
|
|
1812
|
+
user: n.user,
|
|
1813
|
+
session: n.session
|
|
1566
1814
|
};
|
|
1567
|
-
} catch (
|
|
1568
|
-
|
|
1815
|
+
} catch (n) {
|
|
1816
|
+
s = n;
|
|
1569
1817
|
}
|
|
1570
1818
|
}
|
|
1571
1819
|
return {
|
|
1572
1820
|
...e,
|
|
1573
|
-
lookupError:
|
|
1821
|
+
lookupError: s ?? e.lookupError
|
|
1574
1822
|
};
|
|
1575
1823
|
}
|
|
1576
1824
|
async syncPublicSessionBestEffort() {
|
|
1577
|
-
var e,
|
|
1825
|
+
var e, s;
|
|
1578
1826
|
try {
|
|
1579
|
-
await ((
|
|
1827
|
+
await ((s = (e = this.runtimeOptions) == null ? void 0 : e.syncPublicSession) == null ? void 0 : s.call(e));
|
|
1580
1828
|
} catch {
|
|
1581
1829
|
}
|
|
1582
1830
|
}
|
|
1583
1831
|
async resolveAuthCompletionData(e) {
|
|
1584
1832
|
try {
|
|
1585
|
-
const
|
|
1833
|
+
const s = await k(this.auth), i = this.extractUser(e);
|
|
1586
1834
|
return {
|
|
1587
|
-
user:
|
|
1588
|
-
session:
|
|
1835
|
+
user: s.user ?? i,
|
|
1836
|
+
session: s.session
|
|
1589
1837
|
};
|
|
1590
|
-
} catch (
|
|
1838
|
+
} catch (s) {
|
|
1591
1839
|
return {
|
|
1592
1840
|
user: this.extractUser(e),
|
|
1593
1841
|
session: null,
|
|
1594
|
-
lookupError:
|
|
1842
|
+
lookupError: s
|
|
1595
1843
|
};
|
|
1596
1844
|
}
|
|
1597
1845
|
}
|
|
@@ -1601,26 +1849,28 @@ class Pe {
|
|
|
1601
1849
|
user: null,
|
|
1602
1850
|
session: null
|
|
1603
1851
|
};
|
|
1604
|
-
if (
|
|
1605
|
-
|
|
1606
|
-
|
|
1852
|
+
if (await this.syncPublicSessionBestEffort(), !this.destroyed) {
|
|
1853
|
+
if (J(this.options)) {
|
|
1854
|
+
this.clearCountdown(), this.options.onSuccess(e), this.terminalActionInProgress = !0;
|
|
1855
|
+
return;
|
|
1856
|
+
}
|
|
1857
|
+
this.invokeRedirectModeSuccessHook(e), this.clearCountdown(), this.state.view = "sign-in", this.state.password = "", this.state.confirmPassword = "", this.state.newPassword = "", this.state.code = "", this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = null, this.state.notice = "Password updated. Sign in with your new password.", this.render();
|
|
1607
1858
|
}
|
|
1608
|
-
this.invokeRedirectModeSuccessHook(e), this.clearCountdown(), this.state.view = "sign-in", this.state.password = "", this.state.confirmPassword = "", this.state.newPassword = "", this.state.code = "", this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = null, this.state.notice = "Password updated. Sign in with your new password.", this.render();
|
|
1609
1859
|
}
|
|
1610
1860
|
handleExistingSessionOnMount(e) {
|
|
1611
|
-
if (
|
|
1612
|
-
this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = this.labels.common.redirecting, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(
|
|
1861
|
+
if (C(this.options)) {
|
|
1862
|
+
this.terminalActionInProgress = !0, this.state.busy = !0, this.state.busyLabel = this.labels.common.redirecting, this.state.error = null, this.state.notice = null, this.render(), window.location.assign(B(this.options.redirectTo).toString());
|
|
1613
1863
|
return;
|
|
1614
1864
|
}
|
|
1615
|
-
if (
|
|
1616
|
-
throw this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, new
|
|
1865
|
+
if (J(this.options))
|
|
1866
|
+
throw this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, new m(
|
|
1617
1867
|
"authUI.mount(container, { onSuccess }) cannot run while a session already exists. Check es.auth.getSession() before mounting controlled auth UI."
|
|
1618
1868
|
);
|
|
1619
1869
|
}
|
|
1620
|
-
async runAction(e,
|
|
1870
|
+
async runAction(e, s) {
|
|
1621
1871
|
this.state.busy = !0, this.state.busyLabel = e, this.state.error = null, this.state.notice = null, this.render();
|
|
1622
1872
|
try {
|
|
1623
|
-
await
|
|
1873
|
+
await s();
|
|
1624
1874
|
} catch (i) {
|
|
1625
1875
|
if (this.maybeHandleVerificationRequired(i))
|
|
1626
1876
|
return;
|
|
@@ -1630,45 +1880,45 @@ class Pe {
|
|
|
1630
1880
|
!this.destroyed && !this.terminalActionInProgress && (this.state.busy = !1, this.state.busyLabel = void 0, this.render());
|
|
1631
1881
|
}
|
|
1632
1882
|
maybeHandleVerificationRequired(e) {
|
|
1633
|
-
return
|
|
1883
|
+
return W(e).code !== "EMAIL_NOT_VERIFIED" ? !1 : (this.verificationCompletionAction = "sign-in", this.state.view = "verify-email", this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = null, this.state.notice = `Verify your email to finish signing in as ${this.state.email.trim()}.`, this.render(), this.sendVerificationEmail(!0), !0);
|
|
1634
1884
|
}
|
|
1635
|
-
handleVerificationEmailSent(e,
|
|
1636
|
-
this.state.notice =
|
|
1885
|
+
handleVerificationEmailSent(e, s) {
|
|
1886
|
+
this.state.notice = s ? `We sent another verification email to ${e}.` : `We sent a verification email to ${e}.`, this.startCountdown();
|
|
1637
1887
|
}
|
|
1638
1888
|
invokeRedirectModeSuccessHook(e) {
|
|
1639
|
-
var
|
|
1640
|
-
if (!(!
|
|
1889
|
+
var s, i;
|
|
1890
|
+
if (!(!C(this.options) || !this.options.onSuccess))
|
|
1641
1891
|
try {
|
|
1642
1892
|
this.options.onSuccess(e);
|
|
1643
|
-
} catch (
|
|
1644
|
-
const
|
|
1893
|
+
} catch (n) {
|
|
1894
|
+
const a = W(n, "Post-auth callback failed.");
|
|
1645
1895
|
try {
|
|
1646
|
-
(i = (
|
|
1896
|
+
(i = (s = this.options).onError) == null || i.call(s, a);
|
|
1647
1897
|
} catch {
|
|
1648
1898
|
}
|
|
1649
1899
|
}
|
|
1650
1900
|
}
|
|
1651
|
-
handleError(e,
|
|
1652
|
-
var
|
|
1653
|
-
const i =
|
|
1654
|
-
this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = i.message, this.render(), (
|
|
1901
|
+
handleError(e, s) {
|
|
1902
|
+
var n, a;
|
|
1903
|
+
const i = W(e, s);
|
|
1904
|
+
this.state.busy = !1, this.state.busyLabel = void 0, this.state.error = i.message, this.render(), (a = (n = this.options).onError) == null || a.call(n, i);
|
|
1655
1905
|
}
|
|
1656
1906
|
failValidation(e) {
|
|
1657
1907
|
this.state.error = e, this.state.notice = null, this.render();
|
|
1658
1908
|
}
|
|
1659
|
-
getManagedReturnURL(e,
|
|
1909
|
+
getManagedReturnURL(e, s) {
|
|
1660
1910
|
if (!e)
|
|
1661
1911
|
return window.location.href;
|
|
1662
1912
|
const i = new URL(window.location.href);
|
|
1663
|
-
return i.searchParams.set(
|
|
1913
|
+
return i.searchParams.set(G, e), s ? i.searchParams.set(M, s) : i.searchParams.delete(M), i.toString();
|
|
1664
1914
|
}
|
|
1665
1915
|
consumeManagedReturnContext() {
|
|
1666
|
-
const e = new URL(window.location.href),
|
|
1667
|
-
return (
|
|
1668
|
-
marker:
|
|
1916
|
+
const e = new URL(window.location.href), s = e.searchParams.get(G), i = e.searchParams.get(M), n = s ? e.searchParams.get("error") : null, a = s ? e.searchParams.get("error_description") : null;
|
|
1917
|
+
return (s || i) && (e.searchParams.delete(G), e.searchParams.delete(M), s && (e.searchParams.delete("error"), e.searchParams.delete("error_description")), window.history.replaceState(null, "", e.toString())), {
|
|
1918
|
+
marker: s,
|
|
1669
1919
|
email: i,
|
|
1670
|
-
error:
|
|
1671
|
-
errorDescription:
|
|
1920
|
+
error: n,
|
|
1921
|
+
errorDescription: a
|
|
1672
1922
|
};
|
|
1673
1923
|
}
|
|
1674
1924
|
startCountdown(e = 60) {
|
|
@@ -1696,14 +1946,14 @@ class Pe {
|
|
|
1696
1946
|
this.pendingFocusSnapshot && (this.clearFocusRestoreTimer(), this.focusRestoreTimer = window.setTimeout(() => {
|
|
1697
1947
|
if (this.focusRestoreTimer = null, this.destroyed || !this.pendingFocusSnapshot)
|
|
1698
1948
|
return;
|
|
1699
|
-
const e = this.pendingFocusSnapshot,
|
|
1949
|
+
const e = this.pendingFocusSnapshot, s = `input[name="${this.escape(e.name)}"][type="${this.escape(e.type)}"]`, i = this.root.querySelector(s);
|
|
1700
1950
|
if (!(!i || i.disabled)) {
|
|
1701
1951
|
if (i.focus(), e.selectionStart !== null && e.selectionEnd !== null)
|
|
1702
1952
|
try {
|
|
1703
1953
|
i.setSelectionRange(e.selectionStart, e.selectionEnd);
|
|
1704
1954
|
} catch {
|
|
1705
|
-
const
|
|
1706
|
-
i.setSelectionRange(
|
|
1955
|
+
const n = i.value.length;
|
|
1956
|
+
i.setSelectionRange(n, n);
|
|
1707
1957
|
}
|
|
1708
1958
|
this.pendingFocusSnapshot = null;
|
|
1709
1959
|
}
|
|
@@ -1718,24 +1968,24 @@ class Pe {
|
|
|
1718
1968
|
extractRedirectURL(e) {
|
|
1719
1969
|
if (!e || typeof e != "object")
|
|
1720
1970
|
return null;
|
|
1721
|
-
const
|
|
1722
|
-
return
|
|
1971
|
+
const s = e;
|
|
1972
|
+
return s.redirect && typeof s.url == "string" && s.url.length > 0 ? s.url : null;
|
|
1723
1973
|
}
|
|
1724
1974
|
extractUser(e) {
|
|
1725
1975
|
if (!e || typeof e != "object")
|
|
1726
1976
|
return null;
|
|
1727
|
-
const
|
|
1728
|
-
return
|
|
1977
|
+
const s = e;
|
|
1978
|
+
return s.user && typeof s.user == "object" ? s.user : null;
|
|
1729
1979
|
}
|
|
1730
1980
|
canUsePasswordResetEmailOtp() {
|
|
1731
1981
|
var e;
|
|
1732
1982
|
return !!((e = this.config) != null && e.passwordResetEmailOtpEnabled);
|
|
1733
1983
|
}
|
|
1734
1984
|
handleSessionlessManagedReturn(e) {
|
|
1735
|
-
return e.email && (this.state.email = e.email), e.marker ===
|
|
1985
|
+
return e.email && (this.state.email = e.email), e.marker === I && !e.error ? (this.verificationCompletionAction = null, this.clearCountdown(), this.state.view = "sign-in", this.state.password = "", this.state.confirmPassword = "", this.state.error = null, this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = "Account created. Sign in to continue.", this.render(), !0) : e.marker === O || e.marker === I ? (this.verificationCompletionAction = e.marker === I ? "sign-up" : "sign-in", this.state.view = "verify-email", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, e.error || e.errorDescription ? this.handleError(new y(
|
|
1736
1986
|
e.errorDescription ?? "Verification failed. Request a new verification email and try again.",
|
|
1737
1987
|
{ code: e.error ?? "VERIFY_EMAIL_ERROR" }
|
|
1738
|
-
)) : this.render(), !0) : e.marker ===
|
|
1988
|
+
)) : this.render(), !0) : e.marker === be && (e.error || e.errorDescription) ? (this.state.view = "sign-in", this.state.busy = !1, this.state.busyLabel = void 0, this.state.notice = null, this.handleError(new y(
|
|
1739
1989
|
e.errorDescription ?? "OAuth sign-in failed.",
|
|
1740
1990
|
{ code: e.error ?? "OAUTH_ERROR" }
|
|
1741
1991
|
)), !0) : !1;
|
|
@@ -1746,136 +1996,136 @@ class Pe {
|
|
|
1746
1996
|
getCountdownSecondsRemaining() {
|
|
1747
1997
|
return this.countdownUntil ? Math.max(0, Math.ceil((this.countdownUntil - Date.now()) / 1e3)) : 0;
|
|
1748
1998
|
}
|
|
1749
|
-
countdownText(e,
|
|
1999
|
+
countdownText(e, s) {
|
|
1750
2000
|
const i = this.getCountdownSecondsRemaining();
|
|
1751
|
-
return i <= 0 ? e :
|
|
2001
|
+
return i <= 0 ? e : s.replace("{seconds}", String(i));
|
|
1752
2002
|
}
|
|
1753
2003
|
escape(e) {
|
|
1754
2004
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1755
2005
|
}
|
|
1756
2006
|
}
|
|
1757
|
-
function
|
|
1758
|
-
return "data" in
|
|
2007
|
+
function at(t) {
|
|
2008
|
+
return "data" in t && t.data ? t.data : t;
|
|
1759
2009
|
}
|
|
1760
|
-
const
|
|
2010
|
+
const lt = [
|
|
1761
2011
|
{ id: "google", key: "providerGoogle" },
|
|
1762
2012
|
{ id: "apple", key: "providerApple" },
|
|
1763
2013
|
{ id: "microsoft", key: "providerMicrosoft" },
|
|
1764
2014
|
{ id: "github", key: "providerGithub" },
|
|
1765
2015
|
{ id: "gitlab", key: "providerGitlab" },
|
|
1766
2016
|
{ id: "discord", key: "providerDiscord" }
|
|
1767
|
-
],
|
|
1768
|
-
async function
|
|
1769
|
-
const
|
|
2017
|
+
], ve = 2, dt = 500;
|
|
2018
|
+
async function ct() {
|
|
2019
|
+
const t = `${window.location.origin}${Ee}/config`;
|
|
1770
2020
|
let e;
|
|
1771
|
-
for (let
|
|
2021
|
+
for (let s = 0; s <= ve; s++)
|
|
1772
2022
|
try {
|
|
1773
|
-
const i = await fetch(
|
|
2023
|
+
const i = await fetch(t, { method: "GET", credentials: "include" });
|
|
1774
2024
|
if (!i.ok)
|
|
1775
|
-
throw new
|
|
1776
|
-
const
|
|
1777
|
-
return
|
|
2025
|
+
throw new m(`Failed to load auth config: HTTP ${i.status}`);
|
|
2026
|
+
const n = await i.json();
|
|
2027
|
+
return ht(at(n));
|
|
1778
2028
|
} catch (i) {
|
|
1779
|
-
e = i,
|
|
2029
|
+
e = i, s < ve && await new Promise((n) => setTimeout(n, dt));
|
|
1780
2030
|
}
|
|
1781
2031
|
throw e;
|
|
1782
2032
|
}
|
|
1783
|
-
let
|
|
1784
|
-
async function
|
|
1785
|
-
return
|
|
1786
|
-
throw
|
|
1787
|
-
})),
|
|
2033
|
+
let V = null;
|
|
2034
|
+
async function ut() {
|
|
2035
|
+
return V || (V = ct().catch((t) => {
|
|
2036
|
+
throw V = null, t;
|
|
2037
|
+
})), V;
|
|
1788
2038
|
}
|
|
1789
|
-
function
|
|
1790
|
-
var
|
|
1791
|
-
const e =
|
|
1792
|
-
const
|
|
1793
|
-
return typeof
|
|
1794
|
-
}).map(({ id:
|
|
2039
|
+
function ht(t) {
|
|
2040
|
+
var s, i, n, a, h, w, P;
|
|
2041
|
+
const e = lt.filter(({ key: E }) => {
|
|
2042
|
+
const L = t[E];
|
|
2043
|
+
return typeof L == "object" && L !== null && "enabled" in L && !!L.enabled;
|
|
2044
|
+
}).map(({ id: E }) => E);
|
|
1795
2045
|
return {
|
|
1796
|
-
disableSignUp: !!
|
|
1797
|
-
emailPasswordEnabled: !!((
|
|
1798
|
-
minPasswordLength: ((
|
|
1799
|
-
requireEmailVerification: !!((
|
|
1800
|
-
passwordResetEmailOtpEnabled: !!((
|
|
2046
|
+
disableSignUp: !!t.disableSignUp,
|
|
2047
|
+
emailPasswordEnabled: !!((s = t.providerEmailPassword) != null && s.enabled),
|
|
2048
|
+
minPasswordLength: ((n = (i = t.providerEmailPassword) == null ? void 0 : i.config) == null ? void 0 : n.minPasswordLength) ?? 8,
|
|
2049
|
+
requireEmailVerification: !!((h = (a = t.providerEmailPassword) == null ? void 0 : a.config) != null && h.requireEmailVerification),
|
|
2050
|
+
passwordResetEmailOtpEnabled: !!((P = (w = t.providerEmailPassword) == null ? void 0 : w.config) != null && P.requirePasswordResetEmailVerification),
|
|
1801
2051
|
oauthProviders: e
|
|
1802
2052
|
};
|
|
1803
2053
|
}
|
|
1804
|
-
const
|
|
1805
|
-
function
|
|
1806
|
-
if (!
|
|
1807
|
-
throw new
|
|
2054
|
+
const N = /* @__PURE__ */ new WeakMap();
|
|
2055
|
+
function mt(t) {
|
|
2056
|
+
if (!t)
|
|
2057
|
+
throw new m(
|
|
1808
2058
|
"authUI.mount(container, options) requires either { redirectTo } or { onSuccess }."
|
|
1809
2059
|
);
|
|
1810
|
-
const e = "redirectTo" in
|
|
1811
|
-
if (!e && !
|
|
1812
|
-
throw new
|
|
2060
|
+
const e = "redirectTo" in t, s = "onSuccess" in t && typeof t.onSuccess == "function";
|
|
2061
|
+
if (!e && !s)
|
|
2062
|
+
throw new m(
|
|
1813
2063
|
"authUI.mount(container, options) requires either { redirectTo } or { onSuccess }."
|
|
1814
2064
|
);
|
|
1815
|
-
if ("redirectTo" in
|
|
1816
|
-
const i =
|
|
2065
|
+
if ("redirectTo" in t) {
|
|
2066
|
+
const i = t.redirectTo;
|
|
1817
2067
|
if (!(typeof i == "string" || i instanceof URL))
|
|
1818
|
-
throw new
|
|
2068
|
+
throw new m(
|
|
1819
2069
|
"authUI.mount(container, options) expected redirectTo to be a string or URL."
|
|
1820
2070
|
);
|
|
1821
2071
|
}
|
|
1822
|
-
if ("onSuccess" in
|
|
1823
|
-
throw new
|
|
2072
|
+
if ("onSuccess" in t && t.onSuccess !== void 0 && typeof t.onSuccess != "function")
|
|
2073
|
+
throw new m(
|
|
1824
2074
|
"authUI.mount(container, options) expected onSuccess to be a function."
|
|
1825
2075
|
);
|
|
1826
|
-
if ("onError" in
|
|
1827
|
-
throw new
|
|
2076
|
+
if ("onError" in t && t.onError !== void 0 && typeof t.onError != "function")
|
|
2077
|
+
throw new m(
|
|
1828
2078
|
"authUI.mount(container, options) expected onError to be a function."
|
|
1829
2079
|
);
|
|
1830
2080
|
}
|
|
1831
|
-
function
|
|
1832
|
-
if (!(
|
|
1833
|
-
throw new
|
|
2081
|
+
function ft(t) {
|
|
2082
|
+
if (!(t instanceof HTMLElement))
|
|
2083
|
+
throw new m("authUI.mount(container, options) requires a real HTMLElement container.");
|
|
1834
2084
|
}
|
|
1835
|
-
function
|
|
2085
|
+
function wt(t, e) {
|
|
1836
2086
|
return {
|
|
1837
|
-
mount(
|
|
2087
|
+
mount(s, i) {
|
|
1838
2088
|
var w;
|
|
1839
|
-
|
|
1840
|
-
const
|
|
2089
|
+
mt(i), ft(s), (w = N.get(s)) == null || w.destroy();
|
|
2090
|
+
const n = new ot(s, t, i, ut, e), a = n.destroy.bind(n), h = {
|
|
1841
2091
|
destroy() {
|
|
1842
|
-
|
|
2092
|
+
a(), N.get(s) === h && N.delete(s);
|
|
1843
2093
|
}
|
|
1844
2094
|
};
|
|
1845
|
-
return
|
|
2095
|
+
return N.set(s, h), h;
|
|
1846
2096
|
}
|
|
1847
2097
|
};
|
|
1848
2098
|
}
|
|
1849
|
-
function
|
|
1850
|
-
|
|
1851
|
-
const
|
|
2099
|
+
function pt() {
|
|
2100
|
+
Pe();
|
|
2101
|
+
const t = Qe(), e = Xe(), s = Me(), i = wt(e, {
|
|
1852
2102
|
syncPublicSession: async () => {
|
|
1853
|
-
await
|
|
2103
|
+
await Ze(t);
|
|
1854
2104
|
}
|
|
1855
2105
|
});
|
|
1856
2106
|
return {
|
|
1857
|
-
auth:
|
|
1858
|
-
api:
|
|
2107
|
+
auth: t,
|
|
2108
|
+
api: s,
|
|
1859
2109
|
authUI: i
|
|
1860
2110
|
};
|
|
1861
2111
|
}
|
|
1862
2112
|
export {
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
2113
|
+
y as EdgeSparkAuthError,
|
|
2114
|
+
m as EdgeSparkConfigError,
|
|
2115
|
+
ee as EdgeSparkError,
|
|
2116
|
+
Se as EdgeSparkRuntimeError,
|
|
2117
|
+
we as ar,
|
|
2118
|
+
pt as createEdgeSpark,
|
|
2119
|
+
he as de,
|
|
2120
|
+
tt as detectLocale,
|
|
2121
|
+
F as enUS,
|
|
2122
|
+
x as es,
|
|
2123
|
+
ue as fr,
|
|
2124
|
+
ge as hi,
|
|
2125
|
+
me as it,
|
|
2126
|
+
le as ja,
|
|
2127
|
+
de as ko,
|
|
2128
|
+
ce as ptBR,
|
|
2129
|
+
fe as ru,
|
|
2130
|
+
j as zhCN
|
|
1881
2131
|
};
|