@getauthui/core 0.1.13 → 0.1.15
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 +3 -3
- package/dist/{authui-user-button-BSOjgJ6h.js → authui-user-button-CV2B_0j5.js} +295 -253
- package/dist/authui.cdn.js +161 -122
- package/dist/authui.cdn.mjs +739 -697
- package/dist/authui.js +2 -2
- package/dist/components/authui-sign-in.d.ts.map +1 -1
- package/dist/react/index.d.ts +6 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react.js +61 -44
- package/dist/styles/base.d.ts.map +1 -1
- package/dist/styles/tokens.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { state as c, property as m, customElement as
|
|
2
|
-
import { css as T, LitElement as
|
|
3
|
-
import { Client as
|
|
4
|
-
const
|
|
1
|
+
import { state as c, property as m, customElement as D, query as nt } from "lit/decorators.js";
|
|
2
|
+
import { css as T, LitElement as ot, nothing as n, html as r, svg as u } from "lit";
|
|
3
|
+
import { Client as dt, Account as ht, Teams as Ct, ID as G, Avatars as St } from "appwrite";
|
|
4
|
+
const At = {
|
|
5
5
|
signIn: "Sign in",
|
|
6
6
|
dialogSignIn: "Sign in",
|
|
7
7
|
signUp: "Sign up",
|
|
@@ -175,13 +175,13 @@ const St = {
|
|
|
175
175
|
acceptLegal: "I agree to the",
|
|
176
176
|
errorLegalRequired: "Accept the terms to continue."
|
|
177
177
|
};
|
|
178
|
-
function
|
|
178
|
+
function Pt(e, t = {}) {
|
|
179
179
|
return e.replace(
|
|
180
180
|
/\{(\w+)\}/g,
|
|
181
181
|
(i, s) => s in t ? String(t[s]) : `{${s}}`
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const Ut = {
|
|
185
185
|
amazon: "Amazon",
|
|
186
186
|
apple: "Apple",
|
|
187
187
|
appwrite: "Appwrite",
|
|
@@ -232,10 +232,10 @@ const Pt = {
|
|
|
232
232
|
zoho: "Zoho",
|
|
233
233
|
zoom: "Zoom"
|
|
234
234
|
};
|
|
235
|
-
function
|
|
236
|
-
return
|
|
235
|
+
function B(e) {
|
|
236
|
+
return Ut[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
237
237
|
}
|
|
238
|
-
const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), P = () => (/* @__PURE__ */ new Date()).toISOString(), M = (e) => new Date(Date.now() - e * 6e4).toISOString(),
|
|
238
|
+
const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), P = () => (/* @__PURE__ */ new Date()).toISOString(), M = (e) => new Date(Date.now() - e * 6e4).toISOString(), Y = [
|
|
239
239
|
"amber",
|
|
240
240
|
"brave",
|
|
241
241
|
"calm",
|
|
@@ -248,13 +248,13 @@ const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }),
|
|
|
248
248
|
"juniper",
|
|
249
249
|
"kite",
|
|
250
250
|
"lumen"
|
|
251
|
-
],
|
|
251
|
+
], ut = () => `${Y[Math.floor(Math.random() * Y.length)]}-${Y[Math.floor(Math.random() * Y.length)]}`, z = () => Math.random().toString(36).slice(2, 12), pt = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), It = {
|
|
252
252
|
name: "Ada Lovelace",
|
|
253
253
|
email: "ada@example.com",
|
|
254
254
|
phone: "+15550100"
|
|
255
255
|
};
|
|
256
|
-
class
|
|
257
|
-
constructor(t =
|
|
256
|
+
class Et {
|
|
257
|
+
constructor(t = It) {
|
|
258
258
|
this.seed = t, this.user = null, this.mfaPending = !1, this.mfaEnabled = !1, this.totpEnrolled = !1, this.recoveryCodes = [], this.lastChallenge = 0, this.sessions = [], this.identities = [], this.logs = [], this.tokens = /* @__PURE__ */ new Map(), this.pendingAuthenticator = null;
|
|
259
259
|
}
|
|
260
260
|
// ───────────────────────── helpers ─────────────────────────
|
|
@@ -318,7 +318,7 @@ class It {
|
|
|
318
318
|
},
|
|
319
319
|
{
|
|
320
320
|
...i,
|
|
321
|
-
$id:
|
|
321
|
+
$id: z(),
|
|
322
322
|
$createdAt: M(300),
|
|
323
323
|
provider: t,
|
|
324
324
|
ip: "198.51.100.7",
|
|
@@ -335,7 +335,7 @@ class It {
|
|
|
335
335
|
},
|
|
336
336
|
{
|
|
337
337
|
...i,
|
|
338
|
-
$id:
|
|
338
|
+
$id: z(),
|
|
339
339
|
$createdAt: M(1440 * 3),
|
|
340
340
|
provider: "oauth2",
|
|
341
341
|
ip: "192.0.2.90",
|
|
@@ -436,26 +436,26 @@ class It {
|
|
|
436
436
|
}
|
|
437
437
|
async createMagicURLToken(t, i) {
|
|
438
438
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
439
|
-
$id:
|
|
439
|
+
$id: z(),
|
|
440
440
|
$createdAt: P(),
|
|
441
441
|
userId: t,
|
|
442
442
|
secret: "",
|
|
443
443
|
expire: "",
|
|
444
|
-
phrase:
|
|
444
|
+
phrase: ut()
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
447
|
async createEmailToken(t, i) {
|
|
448
448
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
449
|
-
$id:
|
|
449
|
+
$id: z(),
|
|
450
450
|
$createdAt: P(),
|
|
451
451
|
userId: t,
|
|
452
452
|
secret: "",
|
|
453
453
|
expire: "",
|
|
454
|
-
phrase:
|
|
454
|
+
phrase: ut()
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
457
|
async createPhoneToken(t, i) {
|
|
458
|
-
return this.tokens.set(t, { phone: i }), this.delay({ $id:
|
|
458
|
+
return this.tokens.set(t, { phone: i }), this.delay({ $id: z(), $createdAt: P(), userId: t, secret: "", expire: "", phrase: "" });
|
|
459
459
|
}
|
|
460
460
|
async createSession(t) {
|
|
461
461
|
return this.delay(() => {
|
|
@@ -547,7 +547,7 @@ class It {
|
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
async createMFAChallenge() {
|
|
550
|
-
return this.delay({ $id:
|
|
550
|
+
return this.delay({ $id: z(), $createdAt: P(), userId: "preview-user", expire: "" });
|
|
551
551
|
}
|
|
552
552
|
async updateMFAChallenge() {
|
|
553
553
|
return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
|
|
@@ -577,21 +577,21 @@ class It {
|
|
|
577
577
|
return this.delay(() => {
|
|
578
578
|
if (this.recoveryCodes.length > 0)
|
|
579
579
|
throw K("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
|
|
580
|
-
return this.recoveryCodes = Array.from({ length: 6 },
|
|
580
|
+
return this.recoveryCodes = Array.from({ length: 6 }, pt), { recoveryCodes: this.recoveryCodes };
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
async getMFARecoveryCodes() {
|
|
584
584
|
return this.delay(() => (this.requireRecentChallenge(), { recoveryCodes: this.recoveryCodes }));
|
|
585
585
|
}
|
|
586
586
|
async updateMFARecoveryCodes() {
|
|
587
|
-
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 },
|
|
587
|
+
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, pt), { recoveryCodes: this.recoveryCodes }));
|
|
588
588
|
}
|
|
589
589
|
/** Forget everything, as a sign out would. */
|
|
590
590
|
reset() {
|
|
591
591
|
this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function Mt(e) {
|
|
595
595
|
let t = 2166136261;
|
|
596
596
|
const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
|
|
597
597
|
for (const g of e) t = (t ^ g.charCodeAt(0)) * 16777619;
|
|
@@ -639,7 +639,7 @@ const v = {
|
|
|
639
639
|
targetAlreadyExists: "user_target_already_exists",
|
|
640
640
|
argumentInvalid: "general_argument_invalid"
|
|
641
641
|
};
|
|
642
|
-
function
|
|
642
|
+
function V(e) {
|
|
643
643
|
if (e && typeof e == "object") {
|
|
644
644
|
const t = e;
|
|
645
645
|
let i = typeof t.message == "string" ? t.message : "Unknown error";
|
|
@@ -651,11 +651,11 @@ function q(e) {
|
|
|
651
651
|
}
|
|
652
652
|
return { message: String(e), type: "", code: 0 };
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
return
|
|
654
|
+
function H(e, t) {
|
|
655
|
+
return V(e).type === t;
|
|
656
656
|
}
|
|
657
|
-
function
|
|
658
|
-
const s =
|
|
657
|
+
function Z(e, t, i = "link") {
|
|
658
|
+
const s = V(e);
|
|
659
659
|
switch (s.type) {
|
|
660
660
|
case v.invalidCredentials:
|
|
661
661
|
return i === "password" ? t.errorCurrentPassword : t.errorInvalidCredentials;
|
|
@@ -697,73 +697,73 @@ function Y(e, t, i = "link") {
|
|
|
697
697
|
}
|
|
698
698
|
return s.type === v.projectNotFound || s.type === v.unknownOrigin ? t.errorConfig : s.type === v.routeNotFound ? t.errorConfigEndpoint : s.code === 0 && /fetch|network/i.test(s.message) ? t.errorNetwork : /Invalid `\w+` param/i.test(s.message) ? t.errorGeneric : s.message ? s.message || t.errorGeneric : s.code === 404 || s.type === v.routeNotFound ? t.errorConfigEndpoint : t.errorGeneric;
|
|
699
699
|
}
|
|
700
|
-
function
|
|
701
|
-
const t =
|
|
700
|
+
function Ot(e) {
|
|
701
|
+
const t = V(e);
|
|
702
702
|
return !!(t.type === v.projectNotFound || t.type === v.unknownOrigin || t.type === v.routeNotFound || !t.message && t.code === 404 || t.code === 0 && /fetch|network|load failed|failed to fetch/i.test(t.message));
|
|
703
703
|
}
|
|
704
|
-
const
|
|
705
|
-
function
|
|
704
|
+
const it = (e) => `authui:active-team:${e}`;
|
|
705
|
+
function ft(e) {
|
|
706
706
|
if (typeof localStorage > "u" || !e) return null;
|
|
707
707
|
try {
|
|
708
|
-
return localStorage.getItem(
|
|
708
|
+
return localStorage.getItem(it(e));
|
|
709
709
|
} catch {
|
|
710
710
|
return null;
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function Ft(e, t) {
|
|
714
714
|
if (!(typeof localStorage > "u" || !e))
|
|
715
715
|
try {
|
|
716
|
-
t ? localStorage.setItem(
|
|
716
|
+
t ? localStorage.setItem(it(e), t) : localStorage.removeItem(it(e));
|
|
717
717
|
} catch {
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
|
-
const
|
|
721
|
-
function
|
|
720
|
+
const lt = "authui:last-method";
|
|
721
|
+
function q(e) {
|
|
722
722
|
if (!(typeof localStorage > "u")) {
|
|
723
723
|
if (!e || e === "mfa" || e === "sign-up")
|
|
724
724
|
if (e === "sign-up") e = "email-password";
|
|
725
725
|
else return;
|
|
726
726
|
try {
|
|
727
|
-
localStorage.setItem(
|
|
727
|
+
localStorage.setItem(lt, e);
|
|
728
728
|
} catch {
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function _() {
|
|
733
733
|
if (typeof localStorage > "u") return null;
|
|
734
734
|
try {
|
|
735
|
-
return localStorage.getItem(
|
|
735
|
+
return localStorage.getItem(lt);
|
|
736
736
|
} catch {
|
|
737
737
|
return null;
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function ce() {
|
|
741
741
|
if (!(typeof localStorage > "u"))
|
|
742
742
|
try {
|
|
743
|
-
localStorage.removeItem(
|
|
743
|
+
localStorage.removeItem(lt);
|
|
744
744
|
} catch {
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
|
-
const
|
|
748
|
-
function
|
|
747
|
+
const X = "authui:pending-oauth";
|
|
748
|
+
function Rt(e) {
|
|
749
749
|
if (!(typeof sessionStorage > "u"))
|
|
750
750
|
try {
|
|
751
|
-
sessionStorage.setItem(
|
|
751
|
+
sessionStorage.setItem(X, e);
|
|
752
752
|
} catch {
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
|
-
function
|
|
755
|
+
function xt() {
|
|
756
756
|
if (!(typeof sessionStorage > "u"))
|
|
757
757
|
try {
|
|
758
|
-
const e = sessionStorage.getItem(
|
|
759
|
-
sessionStorage.removeItem(
|
|
758
|
+
const e = sessionStorage.getItem(X);
|
|
759
|
+
sessionStorage.removeItem(X), e && q(`oauth:${e}`);
|
|
760
760
|
} catch {
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function mt() {
|
|
764
764
|
if (!(typeof sessionStorage > "u"))
|
|
765
765
|
try {
|
|
766
|
-
sessionStorage.removeItem(
|
|
766
|
+
sessionStorage.removeItem(X);
|
|
767
767
|
} catch {
|
|
768
768
|
}
|
|
769
769
|
}
|
|
@@ -777,7 +777,7 @@ function A(e, t, i) {
|
|
|
777
777
|
new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
|
|
778
778
|
);
|
|
779
779
|
}
|
|
780
|
-
const
|
|
780
|
+
const st = "authui", gt = ["userId", "secret", "expire", "project", "error", st], vt = () => ({
|
|
781
781
|
status: "loading",
|
|
782
782
|
user: null,
|
|
783
783
|
mfaFactors: null,
|
|
@@ -787,7 +787,7 @@ const it = "authui", mt = ["userId", "secret", "expire", "project", "error", it]
|
|
|
787
787
|
});
|
|
788
788
|
class Tt {
|
|
789
789
|
constructor() {
|
|
790
|
-
this.client = null, this.account = null, this.config = null, this.state =
|
|
790
|
+
this.client = null, this.account = null, this.config = null, this.state = vt(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null, this.teams = null, this.activeTeamId = null;
|
|
791
791
|
}
|
|
792
792
|
// ───────────────────────────── configuration ─────────────────────────────
|
|
793
793
|
/** Configure the Appwrite client. Safe to call more than once; the last call wins. */
|
|
@@ -795,7 +795,7 @@ class Tt {
|
|
|
795
795
|
const i = t.endpoint.trim().replace(/\/+$/, "");
|
|
796
796
|
i && !i.endsWith("/v1") && console.warn(
|
|
797
797
|
`[authui] endpoint should end with /v1 (got "${t.endpoint}"). Without it Appwrite returns HTML 404 pages.`
|
|
798
|
-
), this.config = t, this.client = new
|
|
798
|
+
), this.config = t, this.client = new dt().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new Et() : null, this.account = this.preview ? this.preview : new ht(this.client), this.teams = null, this.activeTeamId = ft(t.project), this.setState({ configured: !0, status: "loading", configError: null }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
|
|
799
799
|
}
|
|
800
800
|
/**
|
|
801
801
|
* Called by <authui-config> when it is on the page but missing endpoint or project.
|
|
@@ -841,7 +841,7 @@ class Tt {
|
|
|
841
841
|
/** List teams the signed-in user belongs to. Empty in preview or when signed out. */
|
|
842
842
|
async listTeams() {
|
|
843
843
|
if (this.preview || !this.client || this.state.status !== "signed-in") return [];
|
|
844
|
-
this.teams ??= new
|
|
844
|
+
this.teams ??= new Ct(this.client);
|
|
845
845
|
try {
|
|
846
846
|
return (await this.teams.list()).teams ?? [];
|
|
847
847
|
} catch (t) {
|
|
@@ -851,7 +851,7 @@ class Tt {
|
|
|
851
851
|
getActiveTeamId() {
|
|
852
852
|
if (this.activeTeamId) return this.activeTeamId;
|
|
853
853
|
const t = this.config?.project;
|
|
854
|
-
return t ? (this.activeTeamId =
|
|
854
|
+
return t ? (this.activeTeamId = ft(t), this.activeTeamId) : null;
|
|
855
855
|
}
|
|
856
856
|
/**
|
|
857
857
|
* Remember the active team locally and emit `active-team`.
|
|
@@ -859,10 +859,10 @@ class Tt {
|
|
|
859
859
|
*/
|
|
860
860
|
setActiveTeam(t) {
|
|
861
861
|
const i = this.config?.project;
|
|
862
|
-
i &&
|
|
862
|
+
i && Ft(i, t?.$id ?? null), this.activeTeamId = t?.$id ?? null, this.emit("active-team", { teamId: this.activeTeamId, team: t });
|
|
863
863
|
}
|
|
864
864
|
getStrings() {
|
|
865
|
-
return { ...
|
|
865
|
+
return { ...At, ...this.config?.strings ?? {} };
|
|
866
866
|
}
|
|
867
867
|
getState() {
|
|
868
868
|
return { ...this.state };
|
|
@@ -888,7 +888,7 @@ class Tt {
|
|
|
888
888
|
this.state = { ...this.state, ...t }, this.emit("change", this.getState());
|
|
889
889
|
}
|
|
890
890
|
fail(t) {
|
|
891
|
-
const i =
|
|
891
|
+
const i = V(t);
|
|
892
892
|
throw this.emit("error", i), t;
|
|
893
893
|
}
|
|
894
894
|
acct() {
|
|
@@ -908,7 +908,7 @@ class Tt {
|
|
|
908
908
|
const i = await this.account.get();
|
|
909
909
|
this.setState({ status: "signed-in", user: i, mfaFactors: null, configError: null }), t || this.emit("signed-in", i);
|
|
910
910
|
} catch (i) {
|
|
911
|
-
if (
|
|
911
|
+
if (H(i, v.moreFactorsRequired)) {
|
|
912
912
|
let s = null;
|
|
913
913
|
try {
|
|
914
914
|
s = await A(
|
|
@@ -919,7 +919,7 @@ class Tt {
|
|
|
919
919
|
} catch {
|
|
920
920
|
}
|
|
921
921
|
this.setState({ status: "mfa-required", user: null, mfaFactors: s });
|
|
922
|
-
} else if (
|
|
922
|
+
} else if (H(i, v.userBlocked))
|
|
923
923
|
await this.purgeLocalSession(), this.setState({
|
|
924
924
|
status: "signed-out",
|
|
925
925
|
user: null,
|
|
@@ -930,12 +930,12 @@ class Tt {
|
|
|
930
930
|
message: this.getStrings().errorUserBlocked
|
|
931
931
|
}
|
|
932
932
|
}), t && this.emit("signed-out", void 0);
|
|
933
|
-
else if (!t &&
|
|
934
|
-
const a =
|
|
933
|
+
else if (!t && Ot(i)) {
|
|
934
|
+
const a = Z(i, this.getStrings()) || this.getStrings().errorConfig;
|
|
935
935
|
console.warn(
|
|
936
936
|
`[authui] ${a} (endpoint=${this.config?.endpoint ?? "?"}, project=${this.config?.project ?? "?"})`
|
|
937
937
|
);
|
|
938
|
-
const h =
|
|
938
|
+
const h = V(i);
|
|
939
939
|
this.emit("error", { message: a, type: h.type, code: h.code }), this.setState({
|
|
940
940
|
status: "signed-out",
|
|
941
941
|
user: null,
|
|
@@ -980,7 +980,7 @@ class Tt {
|
|
|
980
980
|
localStorage.removeItem("cookieFallback");
|
|
981
981
|
} catch {
|
|
982
982
|
}
|
|
983
|
-
this.config && !this.preview && (this.client = new
|
|
983
|
+
this.config && !this.preview && (this.client = new dt().setEndpoint(this.config.endpoint).setProject(this.config.project), this.account = new ht(this.client));
|
|
984
984
|
}
|
|
985
985
|
// ─────────────────────────────── sign in ───────────────────────────────
|
|
986
986
|
async signInWithEmailPassword(t, i) {
|
|
@@ -993,7 +993,7 @@ class Tt {
|
|
|
993
993
|
}
|
|
994
994
|
async signUp(t, i, s) {
|
|
995
995
|
try {
|
|
996
|
-
await this.acct().create(
|
|
996
|
+
await this.acct().create(G.unique(), t.trim(), i, s?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
|
|
997
997
|
} catch (a) {
|
|
998
998
|
this.fail(a);
|
|
999
999
|
}
|
|
@@ -1036,7 +1036,7 @@ class Tt {
|
|
|
1036
1036
|
async sendMagicUrl(t) {
|
|
1037
1037
|
try {
|
|
1038
1038
|
return await this.acct().createMagicURLToken(
|
|
1039
|
-
|
|
1039
|
+
G.unique(),
|
|
1040
1040
|
t.trim(),
|
|
1041
1041
|
this.redirectUrl("magic-url"),
|
|
1042
1042
|
this.config?.securityPhrase ?? !0
|
|
@@ -1048,7 +1048,7 @@ class Tt {
|
|
|
1048
1048
|
async sendEmailOtp(t) {
|
|
1049
1049
|
try {
|
|
1050
1050
|
return await this.acct().createEmailToken(
|
|
1051
|
-
|
|
1051
|
+
G.unique(),
|
|
1052
1052
|
t.trim(),
|
|
1053
1053
|
this.config?.securityPhrase ?? !0
|
|
1054
1054
|
);
|
|
@@ -1058,7 +1058,7 @@ class Tt {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
async sendPhoneOtp(t) {
|
|
1060
1060
|
try {
|
|
1061
|
-
return await this.acct().createPhoneToken(
|
|
1061
|
+
return await this.acct().createPhoneToken(G.unique(), t.replace(/[\s()-]/g, ""));
|
|
1062
1062
|
} catch (i) {
|
|
1063
1063
|
return this.fail(i);
|
|
1064
1064
|
}
|
|
@@ -1332,8 +1332,8 @@ class Tt {
|
|
|
1332
1332
|
/** Build the URL Appwrite should send the user back to for a given flow. */
|
|
1333
1333
|
redirectUrl(t) {
|
|
1334
1334
|
const i = this.config?.redirectUrl ?? (typeof window < "u" ? window.location.origin + window.location.pathname : ""), s = new URL(i, typeof window < "u" ? window.location.href : void 0);
|
|
1335
|
-
for (const a of
|
|
1336
|
-
return s.searchParams.set(
|
|
1335
|
+
for (const a of gt) s.searchParams.delete(a);
|
|
1336
|
+
return s.searchParams.set(st, t), s.toString();
|
|
1337
1337
|
}
|
|
1338
1338
|
setPending(t) {
|
|
1339
1339
|
this.setState({ pending: t });
|
|
@@ -1344,7 +1344,7 @@ class Tt {
|
|
|
1344
1344
|
*/
|
|
1345
1345
|
async handleRedirect() {
|
|
1346
1346
|
if (typeof window > "u") return !1;
|
|
1347
|
-
const t = new URLSearchParams(window.location.search), i = t.get(
|
|
1347
|
+
const t = new URLSearchParams(window.location.search), i = t.get(st);
|
|
1348
1348
|
if (!i) return !1;
|
|
1349
1349
|
const s = t.get("userId") ?? "", a = t.get("secret") ?? "";
|
|
1350
1350
|
this.cleanUrl();
|
|
@@ -1361,10 +1361,10 @@ class Tt {
|
|
|
1361
1361
|
switch (i) {
|
|
1362
1362
|
case "oauth":
|
|
1363
1363
|
case "magic-url":
|
|
1364
|
-
s && a ? (await this.acct().createSession(s, a), i === "oauth" ?
|
|
1364
|
+
s && a ? (await this.acct().createSession(s, a), i === "oauth" ? xt() : q("magic-url")) : (i === "oauth" && mt(), h());
|
|
1365
1365
|
break;
|
|
1366
1366
|
case "oauth-failed":
|
|
1367
|
-
|
|
1367
|
+
mt(), this.setState({
|
|
1368
1368
|
pending: {
|
|
1369
1369
|
type: "notice",
|
|
1370
1370
|
tone: "error",
|
|
@@ -1390,23 +1390,23 @@ class Tt {
|
|
|
1390
1390
|
break;
|
|
1391
1391
|
}
|
|
1392
1392
|
} catch (d) {
|
|
1393
|
-
const g =
|
|
1393
|
+
const g = V(d), y = Z(d, this.getStrings(), "link");
|
|
1394
1394
|
this.emit("error", g), this.setState({ pending: { type: "notice", message: y, tone: "error" } });
|
|
1395
1395
|
}
|
|
1396
1396
|
return !0;
|
|
1397
1397
|
}
|
|
1398
1398
|
cleanUrl() {
|
|
1399
1399
|
const t = new URL(window.location.href);
|
|
1400
|
-
for (const i of
|
|
1400
|
+
for (const i of gt) t.searchParams.delete(i);
|
|
1401
1401
|
window.history.replaceState(window.history.state, "", t.toString());
|
|
1402
1402
|
}
|
|
1403
1403
|
/** Test helper. */
|
|
1404
1404
|
reset() {
|
|
1405
|
-
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state =
|
|
1405
|
+
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state = vt(), this.listeners.clear();
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
const l = new Tt();
|
|
1409
|
-
class
|
|
1409
|
+
class Lt {
|
|
1410
1410
|
constructor() {
|
|
1411
1411
|
this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
|
|
1412
1412
|
const t = this.isDark("auto");
|
|
@@ -1434,14 +1434,14 @@ class Rt {
|
|
|
1434
1434
|
this.observer?.disconnect(), this.observer = null, this.media?.removeEventListener?.("change", this.notify), this.media = null;
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
|
-
const
|
|
1437
|
+
const bt = new Lt(), yt = {
|
|
1438
1438
|
none: "0px",
|
|
1439
1439
|
sm: "0.25rem",
|
|
1440
1440
|
md: "0.625rem",
|
|
1441
1441
|
lg: "0.875rem",
|
|
1442
1442
|
xl: "1.125rem",
|
|
1443
1443
|
full: "1.5rem"
|
|
1444
|
-
},
|
|
1444
|
+
}, Dt = T`
|
|
1445
1445
|
:host {
|
|
1446
1446
|
/* Light theme (matches :root in the console) */
|
|
1447
1447
|
--authui-background: oklch(1 0 0);
|
|
@@ -1462,7 +1462,8 @@ const vt = new Rt(), bt = {
|
|
|
1462
1462
|
--authui-destructive-foreground: oklch(0.577 0.245 27.325);
|
|
1463
1463
|
--authui-border: oklch(0.93 0.0035 286.32);
|
|
1464
1464
|
--authui-input: oklch(0.93 0.0035 286.32);
|
|
1465
|
-
|
|
1465
|
+
/* Raised on white for WCAG 1.4.11 / 2.4.7 (~3:1+) UI contrast; zinc-500 */
|
|
1466
|
+
--authui-ring: #71717a;
|
|
1466
1467
|
--authui-brand: #fd366e;
|
|
1467
1468
|
--authui-brand-foreground: #ffffff;
|
|
1468
1469
|
--authui-success: oklch(0.696 0.17 162.48);
|
|
@@ -1520,7 +1521,7 @@ const vt = new Rt(), bt = {
|
|
|
1520
1521
|
--authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
|
|
1521
1522
|
color-scheme: dark;
|
|
1522
1523
|
}
|
|
1523
|
-
`,
|
|
1524
|
+
`, zt = T`
|
|
1524
1525
|
*,
|
|
1525
1526
|
*::before,
|
|
1526
1527
|
*::after {
|
|
@@ -1720,6 +1721,32 @@ const vt = new Rt(), bt = {
|
|
|
1720
1721
|
justify-content: space-between;
|
|
1721
1722
|
gap: 8px;
|
|
1722
1723
|
}
|
|
1724
|
+
/* Forgot after password in DOM (tab order); grid keeps it visually beside the label */
|
|
1725
|
+
.field-with-forgot {
|
|
1726
|
+
display: grid;
|
|
1727
|
+
grid-template-columns: 1fr auto;
|
|
1728
|
+
grid-template-areas:
|
|
1729
|
+
"label forgot"
|
|
1730
|
+
"input input"
|
|
1731
|
+
"meta meta";
|
|
1732
|
+
column-gap: 8px;
|
|
1733
|
+
row-gap: 6px;
|
|
1734
|
+
align-items: center;
|
|
1735
|
+
}
|
|
1736
|
+
.field-with-forgot > .label {
|
|
1737
|
+
grid-area: label;
|
|
1738
|
+
}
|
|
1739
|
+
.field-with-forgot > .field-forgot {
|
|
1740
|
+
grid-area: forgot;
|
|
1741
|
+
justify-self: end;
|
|
1742
|
+
}
|
|
1743
|
+
.field-with-forgot > .input-wrap {
|
|
1744
|
+
grid-area: input;
|
|
1745
|
+
}
|
|
1746
|
+
.field-with-forgot > .hint,
|
|
1747
|
+
.field-with-forgot > .strength {
|
|
1748
|
+
grid-area: meta;
|
|
1749
|
+
}
|
|
1723
1750
|
.label {
|
|
1724
1751
|
font-size: 14px;
|
|
1725
1752
|
line-height: 1;
|
|
@@ -2547,12 +2574,12 @@ const vt = new Rt(), bt = {
|
|
|
2547
2574
|
}
|
|
2548
2575
|
}
|
|
2549
2576
|
`;
|
|
2550
|
-
var
|
|
2577
|
+
var _t = Object.defineProperty, qt = (e, t, i, s) => {
|
|
2551
2578
|
for (var a = void 0, h = e.length - 1, d; h >= 0; h--)
|
|
2552
2579
|
(d = e[h]) && (a = d(t, i, a) || a);
|
|
2553
|
-
return a &&
|
|
2580
|
+
return a && _t(t, i, a), a;
|
|
2554
2581
|
}, O;
|
|
2555
|
-
const
|
|
2582
|
+
const kt = (O = class extends ot {
|
|
2556
2583
|
constructor() {
|
|
2557
2584
|
super(...arguments), this.auth = l.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null, this.stopKeys = (t) => t.stopPropagation();
|
|
2558
2585
|
}
|
|
@@ -2561,7 +2588,7 @@ const xt = (O = class extends nt {
|
|
|
2561
2588
|
for (const t of O.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
|
|
2562
2589
|
this.auth = l.getState(), this.unsubscribeStore = l.on("change", (t) => {
|
|
2563
2590
|
this.auth = t, this.applyBranding();
|
|
2564
|
-
}), this.unsubscribeTheme =
|
|
2591
|
+
}), this.unsubscribeTheme = bt.subscribe(() => this.applyBranding()), this.applyBranding();
|
|
2565
2592
|
}
|
|
2566
2593
|
disconnectedCallback() {
|
|
2567
2594
|
super.disconnectedCallback();
|
|
@@ -2573,7 +2600,7 @@ const xt = (O = class extends nt {
|
|
|
2573
2600
|
}
|
|
2574
2601
|
/** Translate a string key with optional `{placeholders}`. */
|
|
2575
2602
|
t(t, i) {
|
|
2576
|
-
return
|
|
2603
|
+
return Pt(this.strings[t], i);
|
|
2577
2604
|
}
|
|
2578
2605
|
get config() {
|
|
2579
2606
|
return l.getConfig();
|
|
@@ -2583,27 +2610,27 @@ const xt = (O = class extends nt {
|
|
|
2583
2610
|
}
|
|
2584
2611
|
/** Push theme and branding from config onto the host element. */
|
|
2585
2612
|
applyBranding() {
|
|
2586
|
-
const t = this.config?.branding, i =
|
|
2613
|
+
const t = this.config?.branding, i = bt.isDark(t?.theme ?? "auto");
|
|
2587
2614
|
this.setAttribute("data-theme", i ? "dark" : "light"), t?.primary && (this.style.setProperty("--authui-primary", t.primary), this.style.setProperty(
|
|
2588
2615
|
"--authui-primary-foreground",
|
|
2589
2616
|
t.primaryForeground ?? "#ffffff"
|
|
2590
|
-
)), t?.radius &&
|
|
2617
|
+
)), t?.radius && yt[t.radius] && this.style.setProperty("--authui-radius", yt[t.radius]);
|
|
2591
2618
|
}
|
|
2592
2619
|
/** Emit a composed custom event from this element. */
|
|
2593
2620
|
fire(t, i) {
|
|
2594
2621
|
this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
|
|
2595
2622
|
}
|
|
2596
|
-
}, O.styles = [
|
|
2597
|
-
|
|
2623
|
+
}, O.styles = [Dt, zt], O.KEY_EVENTS = ["keydown", "keyup", "keypress"], O);
|
|
2624
|
+
qt([
|
|
2598
2625
|
c()
|
|
2599
|
-
],
|
|
2600
|
-
let E =
|
|
2601
|
-
var
|
|
2602
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2626
|
+
], kt.prototype, "auth");
|
|
2627
|
+
let E = kt;
|
|
2628
|
+
var Vt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, x = (e, t, i, s) => {
|
|
2629
|
+
for (var a = s > 1 ? void 0 : s ? Nt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
2603
2630
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
2604
|
-
return s && a &&
|
|
2631
|
+
return s && a && Vt(t, i, a), a;
|
|
2605
2632
|
};
|
|
2606
|
-
let w = class extends
|
|
2633
|
+
let w = class extends ot {
|
|
2607
2634
|
constructor() {
|
|
2608
2635
|
super(...arguments), this.endpoint = "", this.project = "", this.redirectUrl = "", this.successUrl = "", this.methods = "email-password", this.signUp = "true", this.requireName = "true", this.mfa = "true", this.securityPhrase = "true", this.name = "", this.logo = "", this.theme = "auto", this.radius = "", this.primary = "", this.primaryForeground = "", this.termsUrl = "", this.privacyUrl = "", this.requireAcceptance = "", this.oauthLayout = "", this.preview = "";
|
|
2609
2636
|
}
|
|
@@ -2720,42 +2747,42 @@ x([
|
|
|
2720
2747
|
m({ type: String })
|
|
2721
2748
|
], w.prototype, "preview", 2);
|
|
2722
2749
|
w = x([
|
|
2723
|
-
|
|
2750
|
+
D("authui-config")
|
|
2724
2751
|
], w);
|
|
2725
|
-
var
|
|
2726
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2752
|
+
var Bt = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, J = (e, t, i, s) => {
|
|
2753
|
+
for (var a = s > 1 ? void 0 : s ? jt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
2727
2754
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
2728
|
-
return s && a &&
|
|
2755
|
+
return s && a && Bt(t, i, a), a;
|
|
2729
2756
|
};
|
|
2730
|
-
const
|
|
2731
|
-
let
|
|
2732
|
-
function
|
|
2733
|
-
if (!(typeof document > "u" ||
|
|
2734
|
-
|
|
2757
|
+
const wt = "authui-show:not([ready]){display:none}", de = "authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";
|
|
2758
|
+
let $t = !1;
|
|
2759
|
+
function Ht() {
|
|
2760
|
+
if (!(typeof document > "u" || $t)) {
|
|
2761
|
+
$t = !0;
|
|
2735
2762
|
try {
|
|
2736
2763
|
if (typeof CSSStyleSheet < "u" && "adoptedStyleSheets" in Document.prototype) {
|
|
2737
2764
|
const e = new CSSStyleSheet();
|
|
2738
|
-
e.replaceSync(
|
|
2765
|
+
e.replaceSync(wt), document.adoptedStyleSheets = [...document.adoptedStyleSheets, e];
|
|
2739
2766
|
return;
|
|
2740
2767
|
}
|
|
2741
2768
|
} catch {
|
|
2742
2769
|
}
|
|
2743
2770
|
if (!document.getElementById("authui-fouc")) {
|
|
2744
2771
|
const e = document.createElement("style");
|
|
2745
|
-
e.id = "authui-fouc", e.textContent =
|
|
2772
|
+
e.id = "authui-fouc", e.textContent = wt, document.head.appendChild(e);
|
|
2746
2773
|
}
|
|
2747
2774
|
}
|
|
2748
2775
|
}
|
|
2749
|
-
|
|
2750
|
-
const
|
|
2751
|
-
function
|
|
2752
|
-
return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) =>
|
|
2776
|
+
Ht();
|
|
2777
|
+
const Wt = ["loading", "signed-out", "signed-in", "mfa-required"];
|
|
2778
|
+
function rt(e) {
|
|
2779
|
+
return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Wt.includes(t)) : [];
|
|
2753
2780
|
}
|
|
2754
|
-
function
|
|
2755
|
-
const s =
|
|
2781
|
+
function Gt(e, t, i) {
|
|
2782
|
+
const s = rt(t), a = rt(i);
|
|
2756
2783
|
return !(e === "loading" && !s.includes("loading") || s.length > 0 && !s.includes(e) || a.includes(e));
|
|
2757
2784
|
}
|
|
2758
|
-
let
|
|
2785
|
+
let W = class extends ot {
|
|
2759
2786
|
constructor() {
|
|
2760
2787
|
super(...arguments), this.when = "", this.unless = "", this.status = l.getState().status, this.unsubscribe = null;
|
|
2761
2788
|
}
|
|
@@ -2767,27 +2794,27 @@ let H = class extends nt {
|
|
|
2767
2794
|
}
|
|
2768
2795
|
/** Whether the current status satisfies `when` and `unless`. */
|
|
2769
2796
|
get visible() {
|
|
2770
|
-
return
|
|
2797
|
+
return Gt(this.status, this.when, this.unless);
|
|
2771
2798
|
}
|
|
2772
2799
|
updated() {
|
|
2773
|
-
(this.status !== "loading" ||
|
|
2800
|
+
(this.status !== "loading" || rt(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
|
|
2774
2801
|
}
|
|
2775
2802
|
render() {
|
|
2776
2803
|
return this.visible ? r`<slot></slot>` : n;
|
|
2777
2804
|
}
|
|
2778
2805
|
};
|
|
2779
|
-
|
|
2806
|
+
J([
|
|
2780
2807
|
m({ type: String })
|
|
2781
|
-
],
|
|
2782
|
-
|
|
2808
|
+
], W.prototype, "when", 2);
|
|
2809
|
+
J([
|
|
2783
2810
|
m({ type: String })
|
|
2784
|
-
],
|
|
2785
|
-
|
|
2811
|
+
], W.prototype, "unless", 2);
|
|
2812
|
+
J([
|
|
2786
2813
|
c()
|
|
2787
|
-
],
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
],
|
|
2814
|
+
], W.prototype, "status", 2);
|
|
2815
|
+
W = J([
|
|
2816
|
+
D("authui-show")
|
|
2817
|
+
], W);
|
|
2791
2818
|
const Kt = T`
|
|
2792
2819
|
:host {
|
|
2793
2820
|
display: block;
|
|
@@ -2935,7 +2962,7 @@ const Kt = T`
|
|
|
2935
2962
|
qr: b(
|
|
2936
2963
|
u`<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>`
|
|
2937
2964
|
)
|
|
2938
|
-
}, S = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`,
|
|
2965
|
+
}, S = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, Yt = {
|
|
2939
2966
|
google: S(
|
|
2940
2967
|
u`<path fill="#4285F4" d="M23.49 12.27c0-.79-.07-1.54-.19-2.27H12v4.51h6.47a5.57 5.57 0 0 1-2.4 3.58v3h3.86c2.26-2.09 3.56-5.17 3.56-8.82z"/><path fill="#34A853" d="M12 24c3.24 0 5.95-1.08 7.93-2.91l-3.86-3c-1.08.72-2.45 1.16-4.07 1.16-3.13 0-5.78-2.11-6.73-4.96H1.29v3.09A11.99 11.99 0 0 0 12 24z"/><path fill="#FBBC05" d="M5.27 14.29A7.2 7.2 0 0 1 4.89 12c0-.8.14-1.57.38-2.29V6.62H1.29A11.97 11.97 0 0 0 0 12c0 1.94.46 3.77 1.29 5.38l3.98-3.09z"/><path fill="#EA4335" d="M12 4.75c1.77 0 3.35.61 4.6 1.8l3.42-3.42C17.95 1.19 15.24 0 12 0 7.31 0 3.26 2.69 1.29 6.62l3.98 3.09C6.22 6.86 8.87 4.75 12 4.75z"/>`
|
|
2941
2968
|
),
|
|
@@ -2991,22 +3018,22 @@ const Kt = T`
|
|
|
2991
3018
|
u`<path fill="#003087" d="M7.076 21.337H2.47a.641.641 0 0 1-.633-.74L4.944.901C5.026.382 5.474 0 5.998 0h7.46c2.57 0 4.578.543 5.69 1.81 1.01 1.15 1.304 2.42 1.012 4.287-.023.143-.047.288-.077.437-.983 5.05-4.349 6.797-8.647 6.797h-2.19c-.524 0-.968.382-1.05.9l-1.12 7.106zm14.146-14.42a3.35 3.35 0 0 0-.607-.541c-.013.076-.026.175-.041.254-.93 4.778-4.005 7.201-9.138 7.201h-2.19a.563.563 0 0 0-.556.479l-1.187 7.527h-.506l-.24 1.516a.56.56 0 0 0 .554.647h3.882c.46 0 .85-.334.922-.788.06-.26.76-4.852.816-5.09a.932.932 0 0 1 .923-.788h.58c3.76 0 6.705-1.528 7.565-5.946.36-1.847.174-3.388-.777-4.471z"/>`
|
|
2992
3019
|
)
|
|
2993
3020
|
};
|
|
2994
|
-
function
|
|
2995
|
-
return
|
|
3021
|
+
function j(e) {
|
|
3022
|
+
return Yt[e] ?? o.globe;
|
|
2996
3023
|
}
|
|
2997
|
-
function
|
|
3024
|
+
function ct(e) {
|
|
2998
3025
|
const t = (e.trim()[0] ?? "?").toUpperCase();
|
|
2999
3026
|
return /[A-Z0-9]/i.test(t) ? t : o.user;
|
|
3000
3027
|
}
|
|
3001
|
-
function
|
|
3028
|
+
function Q(e) {
|
|
3002
3029
|
typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
|
|
3003
3030
|
window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
|
|
3004
3031
|
}));
|
|
3005
3032
|
}
|
|
3006
|
-
function
|
|
3033
|
+
function he() {
|
|
3007
3034
|
typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
|
|
3008
3035
|
}
|
|
3009
|
-
function
|
|
3036
|
+
function at(e) {
|
|
3010
3037
|
const t = {
|
|
3011
3038
|
length: e.length >= 8,
|
|
3012
3039
|
long: e.length >= 12,
|
|
@@ -3022,24 +3049,25 @@ function rt(e) {
|
|
|
3022
3049
|
let s, a;
|
|
3023
3050
|
return !t.length || i <= 1 ? (s = 1, a = "passwordStrengthTooWeak") : i === 2 ? (s = 2, a = "passwordStrengthWeak") : i === 3 ? (s = 3, a = "passwordStrengthFair") : i >= 5 && t.long && t.lower && t.upper && t.number && t.symbol ? (s = 4, a = "passwordStrengthVeryStrong") : (s = 4, a = "passwordStrengthStrong"), { level: s, percent: s * 25, labelKey: a, checks: t };
|
|
3024
3051
|
}
|
|
3025
|
-
var
|
|
3026
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
3052
|
+
var Zt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, k = (e, t, i, s) => {
|
|
3053
|
+
for (var a = s > 1 ? void 0 : s ? Xt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
3027
3054
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
3028
|
-
return s && a &&
|
|
3055
|
+
return s && a && Zt(t, i, a), a;
|
|
3029
3056
|
};
|
|
3057
|
+
const R = "authui-error";
|
|
3030
3058
|
let $ = class extends E {
|
|
3031
3059
|
constructor() {
|
|
3032
3060
|
super(...arguments), this.view = "sign-in", this.embedded = !1, this.step = "sign-in", this.busy = !1, this.error = "", this.notice = null, this.showPassword = !1, this.showPasswordConfirm = !1, this.expandedOAuth = null, this.token = null, this.focusOnStep = !1, this.resendCooldownUntil = 0, this.challenge = null, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, this.onSignIn = (e) => {
|
|
3033
3061
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
3034
|
-
await l.signInWithEmailPassword(this.email, this.password), this.password = "",
|
|
3062
|
+
await l.signInWithEmailPassword(this.email, this.password), this.password = "", q("email-password"), this.fire("authui-success", { method: "email-password" });
|
|
3035
3063
|
});
|
|
3036
3064
|
}, this.onSignUp = (e) => {
|
|
3037
3065
|
e.preventDefault(), this.requireValid(e) && (this.legalErrorFromOAuth = !1, this.ensureLegalAccepted() && this.run(async () => {
|
|
3038
|
-
await l.signUp(this.email, this.password, this.name), this.password = "",
|
|
3066
|
+
await l.signUp(this.email, this.password, this.name), this.password = "", q("email-password"), this.fire("authui-success", { method: "sign-up" });
|
|
3039
3067
|
}));
|
|
3040
3068
|
}, this.onGuest = () => {
|
|
3041
3069
|
this.run(async () => {
|
|
3042
|
-
await l.signInAnonymously(),
|
|
3070
|
+
await l.signInAnonymously(), q("anonymous"), this.fire("authui-success", { method: "anonymous" });
|
|
3043
3071
|
});
|
|
3044
3072
|
}, this.onOAuth = (e) => {
|
|
3045
3073
|
if (this.step === "sign-up" && !this.ensureLegalAccepted()) {
|
|
@@ -3047,8 +3075,8 @@ let $ = class extends E {
|
|
|
3047
3075
|
return;
|
|
3048
3076
|
}
|
|
3049
3077
|
this.legalErrorFromOAuth = !1, this.run(async () => {
|
|
3050
|
-
if (
|
|
3051
|
-
|
|
3078
|
+
if (Rt(e), await l.signInWithOAuth(e), l.isPreview) {
|
|
3079
|
+
xt(), this.fire("authui-success", { method: "oauth" });
|
|
3052
3080
|
return;
|
|
3053
3081
|
}
|
|
3054
3082
|
await new Promise((t) => setTimeout(t, 4e3));
|
|
@@ -3096,7 +3124,7 @@ let $ = class extends E {
|
|
|
3096
3124
|
if (e.preventDefault(), !this.requireValid(e)) return;
|
|
3097
3125
|
const t = this.token;
|
|
3098
3126
|
t && this.run(async () => {
|
|
3099
|
-
await l.signInWithToken(t.userId, this.code), this.code = "", this.token = null,
|
|
3127
|
+
await l.signInWithToken(t.userId, this.code), this.code = "", this.token = null, q(t.kind), this.fire("authui-success", { method: t.kind });
|
|
3100
3128
|
}, "code");
|
|
3101
3129
|
}, this.onChooseFactor = (e) => {
|
|
3102
3130
|
this.run(async () => {
|
|
@@ -3114,7 +3142,7 @@ let $ = class extends E {
|
|
|
3114
3142
|
try {
|
|
3115
3143
|
await l.signOut();
|
|
3116
3144
|
} catch (e) {
|
|
3117
|
-
if (!
|
|
3145
|
+
if (!H(e, v.sessionNotFound)) throw e;
|
|
3118
3146
|
}
|
|
3119
3147
|
this.go("sign-in");
|
|
3120
3148
|
});
|
|
@@ -3155,7 +3183,7 @@ let $ = class extends E {
|
|
|
3155
3183
|
try {
|
|
3156
3184
|
await e();
|
|
3157
3185
|
} catch (i) {
|
|
3158
|
-
this.error =
|
|
3186
|
+
this.error = Z(i, this.strings, t);
|
|
3159
3187
|
} finally {
|
|
3160
3188
|
this.busy = !1;
|
|
3161
3189
|
}
|
|
@@ -3237,7 +3265,7 @@ let $ = class extends E {
|
|
|
3237
3265
|
`;
|
|
3238
3266
|
}
|
|
3239
3267
|
renderError() {
|
|
3240
|
-
return this.error ? r`<div class="alert alert-error" role="alert">
|
|
3268
|
+
return this.error ? r`<div class="alert alert-error" role="alert" id=${R}>
|
|
3241
3269
|
${o.alert}
|
|
3242
3270
|
<div class="alert-body">${this.error}</div>
|
|
3243
3271
|
</div>` : n;
|
|
@@ -3248,19 +3276,10 @@ let $ = class extends E {
|
|
|
3248
3276
|
</button>`;
|
|
3249
3277
|
}
|
|
3250
3278
|
passwordField(e) {
|
|
3251
|
-
const t = this[e.field], i = e.field === "passwordConfirm" ? this.showPasswordConfirm : this.showPassword, s = e.meter ?
|
|
3279
|
+
const t = this[e.field], i = e.field === "passwordConfirm" ? this.showPasswordConfirm : this.showPassword, s = e.meter ? at(t) : null;
|
|
3252
3280
|
return r`
|
|
3253
|
-
<div class="field">
|
|
3254
|
-
<
|
|
3255
|
-
<label class="label" for=${e.id}>${e.label}</label>
|
|
3256
|
-
${e.forgot ? r`<button
|
|
3257
|
-
type="button"
|
|
3258
|
-
class="btn btn-link small"
|
|
3259
|
-
@click=${() => this.go("forgot-password")}
|
|
3260
|
-
>
|
|
3261
|
-
${this.t("forgotPassword")}
|
|
3262
|
-
</button>` : n}
|
|
3263
|
-
</div>
|
|
3281
|
+
<div class="field${e.forgot ? " field-with-forgot" : ""}">
|
|
3282
|
+
<label class="label" for=${e.id}>${e.label}</label>
|
|
3264
3283
|
<div class="input-wrap">
|
|
3265
3284
|
<input
|
|
3266
3285
|
class="input"
|
|
@@ -3271,6 +3290,8 @@ let $ = class extends E {
|
|
|
3271
3290
|
minlength="8"
|
|
3272
3291
|
.value=${t}
|
|
3273
3292
|
@input=${this.bind(e.field)}
|
|
3293
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3294
|
+
aria-describedby=${this.error ? R : n}
|
|
3274
3295
|
/>
|
|
3275
3296
|
<button
|
|
3276
3297
|
type="button"
|
|
@@ -3283,6 +3304,13 @@ let $ = class extends E {
|
|
|
3283
3304
|
${i ? o.eyeOff : o.eye}
|
|
3284
3305
|
</button>
|
|
3285
3306
|
</div>
|
|
3307
|
+
${e.forgot ? r`<button
|
|
3308
|
+
type="button"
|
|
3309
|
+
class="btn btn-link small field-forgot"
|
|
3310
|
+
@click=${() => this.go("forgot-password")}
|
|
3311
|
+
>
|
|
3312
|
+
${this.t("forgotPassword")}
|
|
3313
|
+
</button>` : n}
|
|
3286
3314
|
${s && t ? r`<div class="strength" aria-live="polite">
|
|
3287
3315
|
<div
|
|
3288
3316
|
class="strength-meter"
|
|
@@ -3314,6 +3342,8 @@ let $ = class extends E {
|
|
|
3314
3342
|
inputmode="email"
|
|
3315
3343
|
.value=${this.email}
|
|
3316
3344
|
@input=${this.bind("email")}
|
|
3345
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3346
|
+
aria-describedby=${this.error ? R : n}
|
|
3317
3347
|
/>
|
|
3318
3348
|
</div>
|
|
3319
3349
|
`;
|
|
@@ -3333,6 +3363,8 @@ let $ = class extends E {
|
|
|
3333
3363
|
required
|
|
3334
3364
|
.value=${this.code}
|
|
3335
3365
|
@input=${this.bind("code")}
|
|
3366
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3367
|
+
aria-describedby=${this.error ? R : n}
|
|
3336
3368
|
/>
|
|
3337
3369
|
</div>
|
|
3338
3370
|
`;
|
|
@@ -3356,16 +3388,20 @@ let $ = class extends E {
|
|
|
3356
3388
|
}
|
|
3357
3389
|
/** Required acceptance checkbox on sign-up when legal.requireAcceptance is set. */
|
|
3358
3390
|
legalAcceptField() {
|
|
3359
|
-
|
|
3391
|
+
if (!this.needsLegalAcceptance()) return n;
|
|
3392
|
+
const e = this.error === this.t("errorLegalRequired");
|
|
3393
|
+
return r`<label class="legal-accept">
|
|
3360
3394
|
<input
|
|
3361
3395
|
type="checkbox"
|
|
3362
3396
|
.checked=${this.legalAccepted}
|
|
3363
|
-
|
|
3364
|
-
|
|
3397
|
+
aria-invalid=${e ? "true" : n}
|
|
3398
|
+
aria-describedby=${e ? R : n}
|
|
3399
|
+
@change=${(t) => {
|
|
3400
|
+
this.legalAccepted = t.target.checked, this.legalAccepted && this.error === this.t("errorLegalRequired") && (this.error = "", this.legalErrorFromOAuth = !1);
|
|
3365
3401
|
}}
|
|
3366
3402
|
/>
|
|
3367
3403
|
<span>${this.t("acceptLegal")} ${this.legalLinks()}.</span>
|
|
3368
|
-
</label
|
|
3404
|
+
</label>`;
|
|
3369
3405
|
}
|
|
3370
3406
|
backLink(e = "sign-in") {
|
|
3371
3407
|
return r`<div class="links">
|
|
@@ -3413,7 +3449,7 @@ let $ = class extends E {
|
|
|
3413
3449
|
<div class="stack">
|
|
3414
3450
|
<div class="row">
|
|
3415
3451
|
<div class="inline">
|
|
3416
|
-
<span class="avatar">${
|
|
3452
|
+
<span class="avatar">${ct(t)}</span>
|
|
3417
3453
|
<div class="row-main">
|
|
3418
3454
|
<span class="row-title" title=${t}>${t}</span>
|
|
3419
3455
|
${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` : n}
|
|
@@ -3428,7 +3464,7 @@ let $ = class extends E {
|
|
|
3428
3464
|
<button
|
|
3429
3465
|
class="btn btn-outline btn-block"
|
|
3430
3466
|
@click=${() => {
|
|
3431
|
-
this.embedded ? this.fire("authui-open", { view: "account" }) :
|
|
3467
|
+
this.embedded ? this.fire("authui-open", { view: "account" }) : Q("account");
|
|
3432
3468
|
}}
|
|
3433
3469
|
>
|
|
3434
3470
|
${o.settings} ${this.t("manageAccount")}
|
|
@@ -3443,16 +3479,16 @@ let $ = class extends E {
|
|
|
3443
3479
|
renderProviders() {
|
|
3444
3480
|
const e = [...this.config?.methods?.oauth ?? []];
|
|
3445
3481
|
if (e.length === 0) return n;
|
|
3446
|
-
const t =
|
|
3482
|
+
const t = _(), i = e.find((d) => t === `oauth:${d}`) ?? null, s = this.config?.methods?.oauthLayout, a = s === "horizontal" || s === "icon" ? "icon" : s === "stack" || s === "accordion" ? s : e.length <= 2 ? "stack" : "accordion";
|
|
3447
3483
|
if (a === "icon") {
|
|
3448
3484
|
const d = [...e].sort((g, y) => {
|
|
3449
|
-
const C = t === `oauth:${g}` ? 0 : 1,
|
|
3450
|
-
return C -
|
|
3485
|
+
const C = t === `oauth:${g}` ? 0 : 1, et = t === `oauth:${y}` ? 0 : 1;
|
|
3486
|
+
return C - et;
|
|
3451
3487
|
});
|
|
3452
3488
|
return r`
|
|
3453
3489
|
<div class="providers icon">
|
|
3454
3490
|
${d.map((g) => {
|
|
3455
|
-
const y = t === `oauth:${g}`, C = this.t("continueWith", { provider:
|
|
3491
|
+
const y = t === `oauth:${g}`, C = this.t("continueWith", { provider: B(g) });
|
|
3456
3492
|
return r`<button
|
|
3457
3493
|
type="button"
|
|
3458
3494
|
class="btn btn-outline ${y ? "last-used" : ""}"
|
|
@@ -3461,7 +3497,7 @@ let $ = class extends E {
|
|
|
3461
3497
|
aria-label=${y ? `${C}. ${this.t("lastUsed")}` : C}
|
|
3462
3498
|
title=${C}
|
|
3463
3499
|
>
|
|
3464
|
-
${
|
|
3500
|
+
${j(g)}
|
|
3465
3501
|
${y ? r`<span class="oauth-last-used-dot" aria-hidden="true"></span>` : n}
|
|
3466
3502
|
</button>`;
|
|
3467
3503
|
})}
|
|
@@ -3470,13 +3506,13 @@ let $ = class extends E {
|
|
|
3470
3506
|
}
|
|
3471
3507
|
if (a === "stack") {
|
|
3472
3508
|
const d = [...e].sort((g, y) => {
|
|
3473
|
-
const C = t === `oauth:${g}` ? 0 : 1,
|
|
3474
|
-
return C -
|
|
3509
|
+
const C = t === `oauth:${g}` ? 0 : 1, et = t === `oauth:${y}` ? 0 : 1;
|
|
3510
|
+
return C - et;
|
|
3475
3511
|
});
|
|
3476
3512
|
return r`
|
|
3477
3513
|
<div class="providers">
|
|
3478
3514
|
${d.map((g) => {
|
|
3479
|
-
const y = t === `oauth:${g}`, C = this.t("continueWith", { provider:
|
|
3515
|
+
const y = t === `oauth:${g}`, C = this.t("continueWith", { provider: B(g) });
|
|
3480
3516
|
return r`<button
|
|
3481
3517
|
type="button"
|
|
3482
3518
|
class="btn btn-outline ${y ? "last-used" : ""}"
|
|
@@ -3484,7 +3520,7 @@ let $ = class extends E {
|
|
|
3484
3520
|
?disabled=${this.busy}
|
|
3485
3521
|
aria-label=${y ? `${C}. ${this.t("lastUsed")}` : C}
|
|
3486
3522
|
>
|
|
3487
|
-
${
|
|
3523
|
+
${j(g)}
|
|
3488
3524
|
<span>${C}</span>
|
|
3489
3525
|
${y ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3490
3526
|
</button>`;
|
|
@@ -3501,7 +3537,7 @@ let $ = class extends E {
|
|
|
3501
3537
|
}}
|
|
3502
3538
|
>
|
|
3503
3539
|
${e.map((d) => {
|
|
3504
|
-
const g = t === `oauth:${d}`, y = h === d, C = this.t("continueWith", { provider:
|
|
3540
|
+
const g = t === `oauth:${d}`, y = h === d, C = this.t("continueWith", { provider: B(d) });
|
|
3505
3541
|
return r`<div
|
|
3506
3542
|
class="provider-slot ${y ? "is-expanded" : ""}"
|
|
3507
3543
|
@mouseenter=${() => {
|
|
@@ -3518,7 +3554,7 @@ let $ = class extends E {
|
|
|
3518
3554
|
?disabled=${this.busy}
|
|
3519
3555
|
aria-label=${g ? `${C}. ${this.t("lastUsed")}` : C}
|
|
3520
3556
|
>
|
|
3521
|
-
${
|
|
3557
|
+
${j(d)}
|
|
3522
3558
|
<span class="provider-label"
|
|
3523
3559
|
><span><span class="provider-label-text">${C}</span></span></span
|
|
3524
3560
|
>
|
|
@@ -3543,11 +3579,11 @@ let $ = class extends E {
|
|
|
3543
3579
|
${this.renderProviders()}
|
|
3544
3580
|
${i && (t || s.length > 0) ? r`<div class="separator-text">${this.t("or")}</div>` : n}
|
|
3545
3581
|
${t ? r`<form
|
|
3546
|
-
class="form ${
|
|
3582
|
+
class="form ${_() === "email-password" ? "last-used-form" : ""}"
|
|
3547
3583
|
@submit=${this.onSignIn}
|
|
3548
3584
|
novalidate
|
|
3549
3585
|
>
|
|
3550
|
-
${
|
|
3586
|
+
${_() === "email-password" ? r`<p class="hint">
|
|
3551
3587
|
<span class="last-used-badge">${this.t("lastUsed")}</span>
|
|
3552
3588
|
</p>` : n}
|
|
3553
3589
|
${this.emailField()}
|
|
@@ -3556,7 +3592,7 @@ let $ = class extends E {
|
|
|
3556
3592
|
</form>` : this.renderError()}
|
|
3557
3593
|
${s.length > 0 ? r`<div class="stack-sm">
|
|
3558
3594
|
${s.map((a) => {
|
|
3559
|
-
const h =
|
|
3595
|
+
const h = _() === a.step;
|
|
3560
3596
|
return r`<button
|
|
3561
3597
|
type="button"
|
|
3562
3598
|
class="btn btn-secondary btn-block ${h ? "last-used" : ""}"
|
|
@@ -3570,12 +3606,12 @@ let $ = class extends E {
|
|
|
3570
3606
|
</div>` : n}
|
|
3571
3607
|
${e.anonymous ? r`<button
|
|
3572
3608
|
type="button"
|
|
3573
|
-
class="btn btn-ghost btn-block ${
|
|
3609
|
+
class="btn btn-ghost btn-block ${_() === "anonymous" ? "last-used" : ""}"
|
|
3574
3610
|
@click=${this.onGuest}
|
|
3575
3611
|
?disabled=${this.busy}
|
|
3576
3612
|
>
|
|
3577
3613
|
${o.ghost} ${this.t("continueAsGuest")}
|
|
3578
|
-
${
|
|
3614
|
+
${_() === "anonymous" ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3579
3615
|
</button>` : n}
|
|
3580
3616
|
${t && this.config?.signUp !== !1 ? r`<div class="links">
|
|
3581
3617
|
<span>${this.t("noAccount")}</span>
|
|
@@ -3604,6 +3640,8 @@ let $ = class extends E {
|
|
|
3604
3640
|
required
|
|
3605
3641
|
.value=${this.name}
|
|
3606
3642
|
@input=${this.bind("name")}
|
|
3643
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3644
|
+
aria-describedby=${this.error ? R : n}
|
|
3607
3645
|
/>
|
|
3608
3646
|
</div>` : n}
|
|
3609
3647
|
${this.emailField()}
|
|
@@ -3772,6 +3810,8 @@ let $ = class extends E {
|
|
|
3772
3810
|
required
|
|
3773
3811
|
.value=${this.phone}
|
|
3774
3812
|
@input=${this.bind("phone")}
|
|
3813
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3814
|
+
aria-describedby=${this.error ? R : n}
|
|
3775
3815
|
/>
|
|
3776
3816
|
</div>
|
|
3777
3817
|
${this.renderError()} ${this.submitButton(this.t("sendCode"))}
|
|
@@ -3846,6 +3886,8 @@ let $ = class extends E {
|
|
|
3846
3886
|
required
|
|
3847
3887
|
.value=${this.code}
|
|
3848
3888
|
@input=${this.bind("code")}
|
|
3889
|
+
aria-invalid=${this.error ? "true" : n}
|
|
3890
|
+
aria-describedby=${this.error ? R : n}
|
|
3849
3891
|
/>
|
|
3850
3892
|
</div>` : this.codeField()}
|
|
3851
3893
|
${this.renderError()} ${this.submitButton(this.t("verifyCode"))}
|
|
@@ -3904,7 +3946,7 @@ k([
|
|
|
3904
3946
|
c()
|
|
3905
3947
|
], $.prototype, "recovery", 2);
|
|
3906
3948
|
k([
|
|
3907
|
-
|
|
3949
|
+
nt("form input:not([type=hidden])")
|
|
3908
3950
|
], $.prototype, "firstInput", 2);
|
|
3909
3951
|
k([
|
|
3910
3952
|
c()
|
|
@@ -3919,12 +3961,12 @@ k([
|
|
|
3919
3961
|
c()
|
|
3920
3962
|
], $.prototype, "legalErrorFromOAuth", 2);
|
|
3921
3963
|
$ = k([
|
|
3922
|
-
|
|
3964
|
+
D("authui-sign-in")
|
|
3923
3965
|
], $);
|
|
3924
|
-
var
|
|
3925
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
3966
|
+
var Qt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, f = (e, t, i, s) => {
|
|
3967
|
+
for (var a = s > 1 ? void 0 : s ? Jt(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
3926
3968
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
3927
|
-
return s && a &&
|
|
3969
|
+
return s && a && Qt(t, i, a), a;
|
|
3928
3970
|
};
|
|
3929
3971
|
let p = class extends E {
|
|
3930
3972
|
constructor() {
|
|
@@ -4032,7 +4074,7 @@ let p = class extends E {
|
|
|
4032
4074
|
try {
|
|
4033
4075
|
this.recoveryCodes = await l.createRecoveryCodes();
|
|
4034
4076
|
} catch (e) {
|
|
4035
|
-
if (!
|
|
4077
|
+
if (!H(e, v.recoveryCodesExist)) throw e;
|
|
4036
4078
|
this.recoveryCodes = await l.getRecoveryCodes();
|
|
4037
4079
|
}
|
|
4038
4080
|
await this.loadFactors();
|
|
@@ -4155,9 +4197,9 @@ let p = class extends E {
|
|
|
4155
4197
|
try {
|
|
4156
4198
|
await t(), i && this.setNotice("success", i);
|
|
4157
4199
|
} catch (s) {
|
|
4158
|
-
|
|
4200
|
+
H(s, v.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
|
|
4159
4201
|
...this.errors,
|
|
4160
|
-
[e]:
|
|
4202
|
+
[e]: Z(
|
|
4161
4203
|
s,
|
|
4162
4204
|
this.strings,
|
|
4163
4205
|
e.includes("code") ? "code" : e === "password" ? "password" : "link"
|
|
@@ -4312,7 +4354,7 @@ let p = class extends E {
|
|
|
4312
4354
|
return r`
|
|
4313
4355
|
<div class="between">
|
|
4314
4356
|
<div class="identity">
|
|
4315
|
-
<span class="avatar">${
|
|
4357
|
+
<span class="avatar">${ct(t)}</span>
|
|
4316
4358
|
<div class="row-main">
|
|
4317
4359
|
<span class="row-title" title=${t}>
|
|
4318
4360
|
${t}
|
|
@@ -4437,7 +4479,7 @@ let p = class extends E {
|
|
|
4437
4479
|
autocomplete="new-password"
|
|
4438
4480
|
/>
|
|
4439
4481
|
${this.emailPassword ? (() => {
|
|
4440
|
-
const t =
|
|
4482
|
+
const t = at(this.emailPassword);
|
|
4441
4483
|
return r`<div class="strength" aria-live="polite">
|
|
4442
4484
|
<div
|
|
4443
4485
|
class="strength-meter"
|
|
@@ -4732,7 +4774,7 @@ let p = class extends E {
|
|
|
4732
4774
|
</button>
|
|
4733
4775
|
</div>
|
|
4734
4776
|
${this.newPassword ? (() => {
|
|
4735
|
-
const i =
|
|
4777
|
+
const i = at(this.newPassword);
|
|
4736
4778
|
return r`<div class="strength" aria-live="polite">
|
|
4737
4779
|
<div
|
|
4738
4780
|
class="strength-meter"
|
|
@@ -4791,7 +4833,7 @@ let p = class extends E {
|
|
|
4791
4833
|
</div>`;
|
|
4792
4834
|
}
|
|
4793
4835
|
renderMfaCard() {
|
|
4794
|
-
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? l.isPreview ?
|
|
4836
|
+
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? l.isPreview ? Mt(this.authenticator.uri) : new St(l.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
|
|
4795
4837
|
return this.card(
|
|
4796
4838
|
this.t("twoFactor"),
|
|
4797
4839
|
this.t("twoFactorDescription"),
|
|
@@ -5135,9 +5177,9 @@ let p = class extends E {
|
|
|
5135
5177
|
) : e.map(
|
|
5136
5178
|
(i) => r`<div class="row">
|
|
5137
5179
|
<div class="inline">
|
|
5138
|
-
<span class="device">${
|
|
5180
|
+
<span class="device">${j(i.provider)}</span>
|
|
5139
5181
|
<div class="row-main">
|
|
5140
|
-
<span class="row-title">${
|
|
5182
|
+
<span class="row-title">${B(i.provider)}</span>
|
|
5141
5183
|
<span class="row-sub">${i.providerEmail || i.providerUid}</span>
|
|
5142
5184
|
</div>
|
|
5143
5185
|
</div>
|
|
@@ -5180,8 +5222,8 @@ let p = class extends E {
|
|
|
5180
5222
|
}}
|
|
5181
5223
|
?disabled=${!!this.busy}
|
|
5182
5224
|
>
|
|
5183
|
-
${this.spinner(`connect-${i}`)} ${
|
|
5184
|
-
${this.t("connectProvider", { provider:
|
|
5225
|
+
${this.spinner(`connect-${i}`)} ${j(i)}
|
|
5226
|
+
${this.t("connectProvider", { provider: B(i) })}
|
|
5185
5227
|
</button>`
|
|
5186
5228
|
)}` : void 0
|
|
5187
5229
|
)}
|
|
@@ -5426,12 +5468,12 @@ f([
|
|
|
5426
5468
|
c()
|
|
5427
5469
|
], p.prototype, "verifyPhoneCooldownUntil", 2);
|
|
5428
5470
|
p = f([
|
|
5429
|
-
|
|
5471
|
+
D("authui-account")
|
|
5430
5472
|
], p);
|
|
5431
|
-
var
|
|
5432
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5473
|
+
var te = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, L = (e, t, i, s) => {
|
|
5474
|
+
for (var a = s > 1 ? void 0 : s ? ee(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
5433
5475
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5434
|
-
return s && a &&
|
|
5476
|
+
return s && a && te(t, i, a), a;
|
|
5435
5477
|
};
|
|
5436
5478
|
let I = class extends E {
|
|
5437
5479
|
constructor() {
|
|
@@ -5625,13 +5667,13 @@ I.styles = [
|
|
|
5625
5667
|
}
|
|
5626
5668
|
`
|
|
5627
5669
|
];
|
|
5628
|
-
|
|
5670
|
+
L([
|
|
5629
5671
|
m({ type: Boolean, reflect: !0 })
|
|
5630
5672
|
], I.prototype, "open", 2);
|
|
5631
|
-
|
|
5673
|
+
L([
|
|
5632
5674
|
m({ type: String })
|
|
5633
5675
|
], I.prototype, "view", 2);
|
|
5634
|
-
|
|
5676
|
+
L([
|
|
5635
5677
|
m({
|
|
5636
5678
|
attribute: "close-on-success",
|
|
5637
5679
|
reflect: !0,
|
|
@@ -5647,27 +5689,27 @@ R([
|
|
|
5647
5689
|
}
|
|
5648
5690
|
})
|
|
5649
5691
|
], I.prototype, "closeOnSuccess", 2);
|
|
5650
|
-
|
|
5692
|
+
L([
|
|
5651
5693
|
c()
|
|
5652
5694
|
], I.prototype, "handledPending", 2);
|
|
5653
|
-
|
|
5695
|
+
L([
|
|
5654
5696
|
c()
|
|
5655
5697
|
], I.prototype, "scrollCue", 2);
|
|
5656
|
-
|
|
5657
|
-
|
|
5698
|
+
L([
|
|
5699
|
+
nt("dialog")
|
|
5658
5700
|
], I.prototype, "dialog", 2);
|
|
5659
|
-
|
|
5660
|
-
|
|
5701
|
+
L([
|
|
5702
|
+
nt(".body")
|
|
5661
5703
|
], I.prototype, "bodyEl", 2);
|
|
5662
|
-
I =
|
|
5663
|
-
|
|
5704
|
+
I = L([
|
|
5705
|
+
D("authui-modal")
|
|
5664
5706
|
], I);
|
|
5665
|
-
var
|
|
5666
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5707
|
+
var ie = Object.defineProperty, se = Object.getOwnPropertyDescriptor, tt = (e, t, i, s) => {
|
|
5708
|
+
for (var a = s > 1 ? void 0 : s ? se(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
5667
5709
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5668
|
-
return s && a &&
|
|
5710
|
+
return s && a && ie(t, i, a), a;
|
|
5669
5711
|
};
|
|
5670
|
-
let
|
|
5712
|
+
let N = class extends E {
|
|
5671
5713
|
constructor() {
|
|
5672
5714
|
super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
|
|
5673
5715
|
}
|
|
@@ -5675,7 +5717,7 @@ let V = class extends E {
|
|
|
5675
5717
|
const e = this.size === "md" ? "" : `btn-${this.size}`;
|
|
5676
5718
|
return r`<button
|
|
5677
5719
|
class="btn btn-${this.variant} ${e}"
|
|
5678
|
-
@click=${() =>
|
|
5720
|
+
@click=${() => Q(this.view)}
|
|
5679
5721
|
part="button"
|
|
5680
5722
|
>
|
|
5681
5723
|
<slot
|
|
@@ -5684,7 +5726,7 @@ let V = class extends E {
|
|
|
5684
5726
|
</button>`;
|
|
5685
5727
|
}
|
|
5686
5728
|
};
|
|
5687
|
-
|
|
5729
|
+
N.styles = [
|
|
5688
5730
|
...E.styles,
|
|
5689
5731
|
T`
|
|
5690
5732
|
:host {
|
|
@@ -5695,22 +5737,22 @@ V.styles = [
|
|
|
5695
5737
|
}
|
|
5696
5738
|
`
|
|
5697
5739
|
];
|
|
5698
|
-
|
|
5740
|
+
tt([
|
|
5699
5741
|
m({ type: String })
|
|
5700
|
-
],
|
|
5701
|
-
|
|
5742
|
+
], N.prototype, "view", 2);
|
|
5743
|
+
tt([
|
|
5702
5744
|
m({ type: String })
|
|
5703
|
-
],
|
|
5704
|
-
|
|
5745
|
+
], N.prototype, "variant", 2);
|
|
5746
|
+
tt([
|
|
5705
5747
|
m({ type: String })
|
|
5706
|
-
],
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
],
|
|
5710
|
-
var
|
|
5711
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5748
|
+
], N.prototype, "size", 2);
|
|
5749
|
+
N = tt([
|
|
5750
|
+
D("authui-button")
|
|
5751
|
+
], N);
|
|
5752
|
+
var re = Object.defineProperty, ae = Object.getOwnPropertyDescriptor, F = (e, t, i, s) => {
|
|
5753
|
+
for (var a = s > 1 ? void 0 : s ? ae(t, i) : t, h = e.length - 1, d; h >= 0; h--)
|
|
5712
5754
|
(d = e[h]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5713
|
-
return s && a &&
|
|
5755
|
+
return s && a && re(t, i, a), a;
|
|
5714
5756
|
};
|
|
5715
5757
|
let U = class extends E {
|
|
5716
5758
|
constructor() {
|
|
@@ -5787,7 +5829,7 @@ let U = class extends E {
|
|
|
5787
5829
|
if (e === "loading" && i)
|
|
5788
5830
|
return r`<span class="avatar"><span class="spinner"></span></span>`;
|
|
5789
5831
|
if (e !== "signed-in" || !t)
|
|
5790
|
-
return r`<button class="btn btn-primary btn-sm" @click=${() =>
|
|
5832
|
+
return r`<button class="btn btn-primary btn-sm" @click=${() => Q("sign-in")}>
|
|
5791
5833
|
<slot>${this.t("signIn")}</slot>
|
|
5792
5834
|
</button>`;
|
|
5793
5835
|
const s = t.name || t.email || t.phone || this.t("guestAccount");
|
|
@@ -5800,7 +5842,7 @@ let U = class extends E {
|
|
|
5800
5842
|
aria-label=${s}
|
|
5801
5843
|
>
|
|
5802
5844
|
<span class="avatar"
|
|
5803
|
-
>${this.src ? r`<img src=${this.src} alt="" />` :
|
|
5845
|
+
>${this.src ? r`<img src=${this.src} alt="" />` : ct(s)}</span
|
|
5804
5846
|
>
|
|
5805
5847
|
</button>
|
|
5806
5848
|
${this.menuOpen ? r`<div class="menu ${this.menuAbove ? "above" : ""}" role="menu">
|
|
@@ -5831,7 +5873,7 @@ let U = class extends E {
|
|
|
5831
5873
|
class="menu-item"
|
|
5832
5874
|
role="menuitem"
|
|
5833
5875
|
@click=${() => {
|
|
5834
|
-
this.menuOpen = !1,
|
|
5876
|
+
this.menuOpen = !1, Q("account");
|
|
5835
5877
|
}}
|
|
5836
5878
|
>
|
|
5837
5879
|
${o.settings} ${this.t("manageAccount")}
|
|
@@ -6032,38 +6074,38 @@ F([
|
|
|
6032
6074
|
c()
|
|
6033
6075
|
], U.prototype, "activeTeamId", 2);
|
|
6034
6076
|
U = F([
|
|
6035
|
-
|
|
6077
|
+
D("authui-user-button")
|
|
6036
6078
|
], U);
|
|
6037
6079
|
export {
|
|
6038
6080
|
Tt as A,
|
|
6039
|
-
|
|
6081
|
+
de as C,
|
|
6040
6082
|
v as E,
|
|
6041
|
-
|
|
6042
|
-
|
|
6083
|
+
wt as F,
|
|
6084
|
+
Et as P,
|
|
6043
6085
|
l as a,
|
|
6044
6086
|
p as b,
|
|
6045
|
-
|
|
6046
|
-
|
|
6087
|
+
he as c,
|
|
6088
|
+
N as d,
|
|
6047
6089
|
w as e,
|
|
6048
6090
|
E as f,
|
|
6049
6091
|
I as g,
|
|
6050
|
-
|
|
6092
|
+
W as h,
|
|
6051
6093
|
$ as i,
|
|
6052
6094
|
U as j,
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6095
|
+
ce as k,
|
|
6096
|
+
mt as l,
|
|
6097
|
+
At as m,
|
|
6098
|
+
Z as n,
|
|
6099
|
+
Q as o,
|
|
6100
|
+
_ as p,
|
|
6101
|
+
ft as q,
|
|
6102
|
+
Ot as r,
|
|
6103
|
+
B as s,
|
|
6104
|
+
q as t,
|
|
6105
|
+
xt as u,
|
|
6106
|
+
at as v,
|
|
6107
|
+
Ft as w,
|
|
6108
|
+
Rt as x,
|
|
6109
|
+
V as y,
|
|
6110
|
+
Gt as z
|
|
6069
6111
|
};
|