@singlebase/elements 0.6.0 → 0.8.0
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/dist/authui-display-C2o9gApg.cjs +961 -0
- package/dist/authui-display-C2o9gApg.cjs.map +1 -0
- package/dist/{authui-display-CKfGK5va.js → authui-display-CRUABt43.js} +1034 -913
- package/dist/authui-display-CRUABt43.js.map +1 -0
- package/dist/authui.cjs +1 -1
- package/dist/authui.js +2 -2
- package/dist/{chat-C-gsskho.cjs → chat-BWcGH9lr.cjs} +310 -287
- package/dist/chat-BWcGH9lr.cjs.map +1 -0
- package/dist/chat-messages.d.ts +8 -1
- package/dist/{chat-CEh6RygY.js → chat-t4o5FsxM.js} +796 -656
- package/dist/chat-t4o5FsxM.js.map +1 -0
- package/dist/chat.cjs +1 -1
- package/dist/chat.d.ts +1 -1
- package/dist/chat.js +1 -1
- package/dist/elements/authui-account.d.ts +0 -1
- package/dist/elements/authui-buttons.d.ts +1 -1
- package/dist/elements/authui.d.ts +25 -5
- package/dist/elements/chat.d.ts +46 -8
- package/dist/elements/uploader.d.ts +0 -6
- package/dist/files-4T62wkwj.cjs +77 -0
- package/dist/files-4T62wkwj.cjs.map +1 -0
- package/dist/{files-DDJWPzZW.js → files-DS-H-3yN.js} +56 -57
- package/dist/files-DS-H-3yN.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/messages.d.ts +34 -5
- package/dist/singlebase-elements.min.js +2555 -2292
- package/dist/singlebase-elements.min.js.map +1 -1
- package/dist/upload-messages.d.ts +0 -1
- package/dist/{uploader-660JIgIN.cjs → uploader-C57vgFME.cjs} +33 -7
- package/dist/uploader-C57vgFME.cjs.map +1 -0
- package/dist/{uploader-vfczkX51.js → uploader-Cz9yfzfV.js} +261 -262
- package/dist/uploader-Cz9yfzfV.js.map +1 -0
- package/dist/uploader.cjs +1 -1
- package/dist/uploader.js +2 -2
- package/dist/utils/auth-errors.d.ts +7 -0
- package/dist/utils/branding.d.ts +5 -5
- package/dist/utils/oauth.d.ts +24 -0
- package/dist/utils/password.d.ts +16 -0
- package/package.json +3 -3
- package/dist/authui-display-CKfGK5va.js.map +0 -1
- package/dist/authui-display-aWNht0cW.cjs +0 -956
- package/dist/authui-display-aWNht0cW.cjs.map +0 -1
- package/dist/chat-C-gsskho.cjs.map +0 -1
- package/dist/chat-CEh6RygY.js.map +0 -1
- package/dist/files-DDJWPzZW.js.map +0 -1
- package/dist/files-DyxcjZsx.cjs +0 -75
- package/dist/files-DyxcjZsx.cjs.map +0 -1
- package/dist/uploader-660JIgIN.cjs.map +0 -1
- package/dist/uploader-vfczkX51.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var us = Object.defineProperty;
|
|
2
|
+
var qe = (a) => {
|
|
3
|
+
throw TypeError(a);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var b = (
|
|
7
|
-
var
|
|
8
|
-
import { LitElement as
|
|
9
|
-
import { property as p, state as m, customElement as
|
|
10
|
-
import { ifDefined as
|
|
11
|
-
import { SinglebaseAuthError as
|
|
12
|
-
import { s as
|
|
13
|
-
import { t as
|
|
14
|
-
import { getDefaultClient as
|
|
15
|
-
class
|
|
5
|
+
var ps = (a, t, e) => t in a ? us(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
6
|
+
var b = (a, t, e) => ps(a, typeof t != "symbol" ? t + "" : t, e), je = (a, t, e) => t.has(a) || qe("Cannot " + e);
|
|
7
|
+
var n = (a, t, e) => (je(a, t, "read from private field"), e ? e.call(a) : t.get(a)), o = (a, t, e) => t.has(a) ? qe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, e), l = (a, t, e, s) => (je(a, t, "write to private field"), s ? s.call(a, e) : t.set(a, e), e);
|
|
8
|
+
import { LitElement as gs, nothing as d, html as r, css as ts } from "lit";
|
|
9
|
+
import { property as p, state as m, customElement as Te } from "lit/decorators.js";
|
|
10
|
+
import { ifDefined as A } from "lit/directives/if-defined.js";
|
|
11
|
+
import { SinglebaseAuthError as Ne, mapErrorToHint as ms, createFilesUploadApi as bs, resolveScreen as fs } from "@singlebase/singlebase-sdk";
|
|
12
|
+
import { s as vs, r as ws } from "./uploader-Cz9yfzfV.js";
|
|
13
|
+
import { t as $s, b as ys, j as Es } from "./files-DS-H-3yN.js";
|
|
14
|
+
import { getDefaultClient as Ss, AUTHUI_PROP_KEYS as Cs, authUIAttributeFor as Ps, matchesPredicate as _s, validatePredicate as ks, getPath as Ke } from "@singlebase/core";
|
|
15
|
+
class Ts {
|
|
16
16
|
constructor(t) {
|
|
17
17
|
b(this, "host");
|
|
18
18
|
b(this, "client", null);
|
|
@@ -31,7 +31,7 @@ class ws {
|
|
|
31
31
|
(t = this.unsubscribe) == null || t.call(this), this.unsubscribe = null;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const Ve = {
|
|
35
35
|
signInTitle: "Sign in",
|
|
36
36
|
signUpTitle: "Create your account",
|
|
37
37
|
forgotTitle: "Reset your password",
|
|
@@ -61,7 +61,7 @@ const Ie = {
|
|
|
61
61
|
emailMethodMetaSignUp: "Create with an address",
|
|
62
62
|
emailMethodMetaOtp: "One-time code",
|
|
63
63
|
oauthMethodTitle: "Single sign-on",
|
|
64
|
-
oauthMethodMeta: "
|
|
64
|
+
oauthMethodMeta: "Use an account you already have",
|
|
65
65
|
fullNameLabel: "Full name",
|
|
66
66
|
fullNamePlaceholder: "Ada Lovelace",
|
|
67
67
|
emailLabel: "Email",
|
|
@@ -69,10 +69,17 @@ const Ie = {
|
|
|
69
69
|
passwordLabel: "Password",
|
|
70
70
|
passwordPlaceholder: "••••••••",
|
|
71
71
|
newPasswordLabel: "New password",
|
|
72
|
-
newPasswordPlaceholder: "At least
|
|
72
|
+
newPasswordPlaceholder: "At least {min} characters",
|
|
73
|
+
newPasswordPlaceholderPlain: "Choose a password",
|
|
74
|
+
passwordRulesLabel: "Password requirements",
|
|
75
|
+
passwordRuleLength: "{min}–{max} characters",
|
|
76
|
+
passwordRuleMinLength: "At least {min} characters",
|
|
77
|
+
passwordRuleLowercase: "A lowercase letter",
|
|
78
|
+
passwordRuleUppercase: "An uppercase letter",
|
|
79
|
+
passwordRuleNumber: "A number",
|
|
80
|
+
passwordRuleSymbol: "A symbol",
|
|
73
81
|
confirmPasswordLabel: "Confirm password",
|
|
74
82
|
confirmPasswordPlaceholder: "Repeat it",
|
|
75
|
-
currentPasswordLabel: "Current password",
|
|
76
83
|
firstNameLabel: "First name",
|
|
77
84
|
firstNamePlaceholder: "Ada",
|
|
78
85
|
lastNameLabel: "Last name",
|
|
@@ -88,7 +95,6 @@ const Ie = {
|
|
|
88
95
|
footActionSignUp: "Sign in",
|
|
89
96
|
resendQuestion: "Did not get it?",
|
|
90
97
|
resendCta: "Resend code",
|
|
91
|
-
oauthPrimaryLabel: "Continue with Google",
|
|
92
98
|
oauthContinueWith: "Continue with",
|
|
93
99
|
blockedTitleDisabled: "Sign-in is turned off",
|
|
94
100
|
blockedTitleUnavailable: "Sign-in unavailable",
|
|
@@ -136,14 +142,32 @@ const Ie = {
|
|
|
136
142
|
newUsernameLabel: "New username",
|
|
137
143
|
changeUsernameCta: "Send verification code",
|
|
138
144
|
genericErrorMessage: "Something went wrong. Please try again.",
|
|
139
|
-
rateLimitedMessage: "Too many attempts.
|
|
145
|
+
rateLimitedMessage: "Too many attempts. Wait a few minutes, then try again.",
|
|
140
146
|
codeSentNeutral: "If an eligible account exists, a code has been sent.",
|
|
141
147
|
invalidEmailError: "Enter a valid email address.",
|
|
142
148
|
requiredError: "This cannot be empty.",
|
|
143
|
-
|
|
149
|
+
passwordTooShortError: "Use at least {min} characters.",
|
|
150
|
+
passwordTooLongError: "Use at most {max} characters.",
|
|
151
|
+
passwordNeedsLowercaseError: "Include a lowercase letter.",
|
|
152
|
+
passwordNeedsUppercaseError: "Include an uppercase letter.",
|
|
153
|
+
passwordNeedsNumberError: "Include a number.",
|
|
154
|
+
passwordNeedsSymbolError: "Include a symbol.",
|
|
155
|
+
invalidPasswordMessage: "That password doesn't meet the requirements.",
|
|
144
156
|
passwordMatchError: "Both passwords must match.",
|
|
157
|
+
invalidCodeError: "That code is not valid. Check it and try again.",
|
|
158
|
+
invalidCredentialsError: "That email and password do not match.",
|
|
159
|
+
codeResentNotice: "New code sent.",
|
|
160
|
+
confirmNewPasswordLabel: "Confirm new password",
|
|
161
|
+
notSignedInNote: "Not signed in.",
|
|
162
|
+
connectProviderLabel: "Connect {name}",
|
|
163
|
+
digitLabel: "Digit {n}",
|
|
164
|
+
accountCreatedNotice: "Account created. Sign in to continue.",
|
|
165
|
+
inviteCodeLabel: "Invite code",
|
|
166
|
+
submittingStatus: "Submitting…",
|
|
167
|
+
doneStatus: "Done.",
|
|
145
168
|
codeIncompleteError: "Enter all six digits.",
|
|
146
169
|
invalidPhoneError: "Enter a valid phone number.",
|
|
170
|
+
firstNameRequiredError: "Enter your first name.",
|
|
147
171
|
notYetSupported: "Not yet supported",
|
|
148
172
|
alreadySignedInTitle: "You are already signed in",
|
|
149
173
|
alreadySignedInSub: "Continue where you left off, or sign out to use another account.",
|
|
@@ -161,68 +185,74 @@ const Ie = {
|
|
|
161
185
|
changeEmailElsewhereHint: "Your email is changed below, with a verification step.",
|
|
162
186
|
confirmChangeCta: "Confirm change",
|
|
163
187
|
codeLabel: "Verification code",
|
|
164
|
-
brandingLabel: "Auth by Singlebase",
|
|
165
188
|
linkRequiresSignIn: "Sign in first, then link a provider.",
|
|
166
189
|
oauthCallbackTitle: "Finishing sign-in",
|
|
167
190
|
oauthCallbackSub: "One moment while we complete your sign-in.",
|
|
168
|
-
oauthDenied: "Sign-in was cancelled or denied."
|
|
191
|
+
oauthDenied: "Sign-in was cancelled or denied.",
|
|
192
|
+
oauthRetryMessage: "We couldn't finish signing you in with that provider. Please try again.",
|
|
193
|
+
oauthUnavailableMessage: "This sign-in option isn't available right now.",
|
|
194
|
+
oauthVerifiedEmailMessage: "Your provider account needs a verified email address. Verify it with the provider, then try again.",
|
|
195
|
+
providerConnectedNotice: "{name} is now connected to your account.",
|
|
196
|
+
signInToLinkMessage: "An account with this email already exists. Sign in first, then connect the provider from your account.",
|
|
197
|
+
providerAlreadyLinkedMessage: "That provider account is already connected to another account.",
|
|
198
|
+
oauthNoAccountMessage: "There's no account for that provider yet. Create an account first, or sign in another way."
|
|
169
199
|
};
|
|
170
|
-
function
|
|
171
|
-
return
|
|
200
|
+
function Os(a) {
|
|
201
|
+
return a ? { ...Ve, ...a } : Ve;
|
|
172
202
|
}
|
|
173
|
-
var
|
|
174
|
-
for (var i =
|
|
175
|
-
(c =
|
|
176
|
-
return i &&
|
|
177
|
-
},
|
|
178
|
-
class
|
|
203
|
+
var Ns = Object.defineProperty, As = Object.getOwnPropertyDescriptor, L = (a, t, e, s) => {
|
|
204
|
+
for (var i = As(t, e), h = a.length - 1, c; h >= 0; h--)
|
|
205
|
+
(c = a[h]) && (i = c(t, e, i) || i);
|
|
206
|
+
return i && Ns(t, e, i), i;
|
|
207
|
+
}, D, B, H, q, j, K;
|
|
208
|
+
class y extends gs {
|
|
179
209
|
constructor() {
|
|
180
210
|
super(...arguments);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
b(this, "auth", new
|
|
211
|
+
o(this, D, null);
|
|
212
|
+
o(this, B, {});
|
|
213
|
+
o(this, H);
|
|
214
|
+
o(this, q);
|
|
215
|
+
o(this, j);
|
|
216
|
+
o(this, K);
|
|
217
|
+
b(this, "auth", new Ts(this));
|
|
188
218
|
/** Config keys already applied, so a later render does not fight the host. */
|
|
189
219
|
b(this, "appliedConfig", /* @__PURE__ */ new Set());
|
|
190
220
|
}
|
|
191
221
|
get client() {
|
|
192
|
-
return
|
|
222
|
+
return n(this, D);
|
|
193
223
|
}
|
|
194
224
|
set client(e) {
|
|
195
|
-
|
|
225
|
+
l(this, D, e);
|
|
196
226
|
}
|
|
197
227
|
get messages() {
|
|
198
|
-
return
|
|
228
|
+
return n(this, B);
|
|
199
229
|
}
|
|
200
230
|
set messages(e) {
|
|
201
|
-
|
|
231
|
+
l(this, B, e);
|
|
202
232
|
}
|
|
203
233
|
get theme() {
|
|
204
|
-
return
|
|
234
|
+
return n(this, H);
|
|
205
235
|
}
|
|
206
236
|
set theme(e) {
|
|
207
|
-
|
|
237
|
+
l(this, H, e);
|
|
208
238
|
}
|
|
209
239
|
get density() {
|
|
210
|
-
return
|
|
240
|
+
return n(this, q);
|
|
211
241
|
}
|
|
212
242
|
set density(e) {
|
|
213
|
-
|
|
243
|
+
l(this, q, e);
|
|
214
244
|
}
|
|
215
245
|
get fieldStyle() {
|
|
216
|
-
return
|
|
246
|
+
return n(this, j);
|
|
217
247
|
}
|
|
218
248
|
set fieldStyle(e) {
|
|
219
|
-
|
|
249
|
+
l(this, j, e);
|
|
220
250
|
}
|
|
221
251
|
get radius() {
|
|
222
|
-
return
|
|
252
|
+
return n(this, K);
|
|
223
253
|
}
|
|
224
254
|
set radius(e) {
|
|
225
|
-
|
|
255
|
+
l(this, K, e);
|
|
226
256
|
}
|
|
227
257
|
/**
|
|
228
258
|
* Resolution order: an explicit `.client`, then the page's default
|
|
@@ -238,7 +268,7 @@ class $ extends rs {
|
|
|
238
268
|
*/
|
|
239
269
|
get resolvedClient() {
|
|
240
270
|
var e;
|
|
241
|
-
return this.client ? this.client : ((e =
|
|
271
|
+
return this.client ? this.client : ((e = Ss()) == null ? void 0 : e.auth) ?? null;
|
|
242
272
|
}
|
|
243
273
|
/** Page-wide UI config from SinglebaseClient({ authui }), if there is one. */
|
|
244
274
|
get uiConfig() {
|
|
@@ -252,7 +282,7 @@ class $ extends rs {
|
|
|
252
282
|
get msg() {
|
|
253
283
|
var s;
|
|
254
284
|
const e = (s = this.uiConfig) == null ? void 0 : s.messages;
|
|
255
|
-
return
|
|
285
|
+
return Os(e ? { ...e, ...this.messages } : this.messages);
|
|
256
286
|
}
|
|
257
287
|
/**
|
|
258
288
|
* Copies the page-wide config onto this element.
|
|
@@ -266,9 +296,9 @@ class $ extends rs {
|
|
|
266
296
|
applyUIConfig() {
|
|
267
297
|
const e = this.uiConfig;
|
|
268
298
|
if (e) {
|
|
269
|
-
for (const s of
|
|
299
|
+
for (const s of Cs) {
|
|
270
300
|
const i = e[s];
|
|
271
|
-
i !== void 0 && s in this && (this.hasAttribute(
|
|
301
|
+
i !== void 0 && s in this && (this.hasAttribute(Ps(s)) || this.appliedConfig.has(s) || (this.appliedConfig.add(s), this[s] = i));
|
|
272
302
|
}
|
|
273
303
|
for (const [s, i] of Object.entries(e.tokens ?? {}))
|
|
274
304
|
s.startsWith("--") && (this.style.getPropertyValue(s) || this.style.setProperty(s, i));
|
|
@@ -295,26 +325,26 @@ class $ extends rs {
|
|
|
295
325
|
super.willUpdate(e), this.auth.bind(this.resolvedClient), this.applyUIConfig();
|
|
296
326
|
}
|
|
297
327
|
}
|
|
298
|
-
|
|
299
|
-
|
|
328
|
+
D = new WeakMap(), B = new WeakMap(), H = new WeakMap(), q = new WeakMap(), j = new WeakMap(), K = new WeakMap(), b(y, "styles", [$s, vs]);
|
|
329
|
+
L([
|
|
300
330
|
p({ attribute: !1 })
|
|
301
|
-
],
|
|
302
|
-
|
|
331
|
+
], y.prototype, "client");
|
|
332
|
+
L([
|
|
303
333
|
p({ attribute: !1 })
|
|
304
|
-
],
|
|
305
|
-
|
|
334
|
+
], y.prototype, "messages");
|
|
335
|
+
L([
|
|
306
336
|
p({ reflect: !0 })
|
|
307
|
-
],
|
|
308
|
-
|
|
337
|
+
], y.prototype, "theme");
|
|
338
|
+
L([
|
|
309
339
|
p({ reflect: !0 })
|
|
310
|
-
],
|
|
311
|
-
|
|
340
|
+
], y.prototype, "density");
|
|
341
|
+
L([
|
|
312
342
|
p({ reflect: !0, attribute: "field-style" })
|
|
313
|
-
],
|
|
314
|
-
|
|
343
|
+
], y.prototype, "fieldStyle");
|
|
344
|
+
L([
|
|
315
345
|
p({ reflect: !0 })
|
|
316
|
-
],
|
|
317
|
-
class
|
|
346
|
+
], y.prototype, "radius");
|
|
347
|
+
class De {
|
|
318
348
|
constructor(t) {
|
|
319
349
|
b(this, "host");
|
|
320
350
|
b(this, "client", null);
|
|
@@ -340,7 +370,7 @@ class ke {
|
|
|
340
370
|
});
|
|
341
371
|
}
|
|
342
372
|
}
|
|
343
|
-
const
|
|
373
|
+
const Ls = [
|
|
344
374
|
"load",
|
|
345
375
|
"success",
|
|
346
376
|
"error",
|
|
@@ -355,7 +385,7 @@ const Ss = [
|
|
|
355
385
|
"expired",
|
|
356
386
|
"navigate",
|
|
357
387
|
"goto"
|
|
358
|
-
],
|
|
388
|
+
], xs = {
|
|
359
389
|
load: "auth:ready",
|
|
360
390
|
signin: "auth:signin",
|
|
361
391
|
signup: "auth:signup",
|
|
@@ -365,31 +395,31 @@ const Ss = [
|
|
|
365
395
|
error: "auth:error",
|
|
366
396
|
navigate: "auth:navigate"
|
|
367
397
|
};
|
|
368
|
-
function
|
|
369
|
-
return "on" +
|
|
398
|
+
function Ge(a) {
|
|
399
|
+
return "on" + a.replace(/(^|-)([a-z])/g, (t, e, s) => s.toUpperCase());
|
|
370
400
|
}
|
|
371
|
-
class
|
|
401
|
+
class Us {
|
|
372
402
|
constructor(t) {
|
|
373
403
|
b(this, "unsubscribes", []);
|
|
374
404
|
b(this, "client", null);
|
|
375
405
|
this.host = t, t.addController(this);
|
|
376
406
|
}
|
|
377
407
|
bind(t) {
|
|
378
|
-
t !== this.client && (this.release(), this.client = t, t && (this.unsubscribes =
|
|
408
|
+
t !== this.client && (this.release(), this.client = t, t && (this.unsubscribes = Ls.map(
|
|
379
409
|
(e) => t.on(e, (s) => this.publish(e, s))
|
|
380
410
|
)));
|
|
381
411
|
}
|
|
382
412
|
publish(t, e) {
|
|
383
|
-
const s = this.host[
|
|
413
|
+
const s = this.host[Ge(t)];
|
|
384
414
|
if (typeof s == "function")
|
|
385
415
|
try {
|
|
386
416
|
s.call(this.host, e);
|
|
387
417
|
} catch (c) {
|
|
388
|
-
console.error(`[singlebase] ${
|
|
418
|
+
console.error(`[singlebase] ${Ge(t)} threw:`, c);
|
|
389
419
|
}
|
|
390
420
|
const i = { detail: e, bubbles: !0, composed: !0 };
|
|
391
421
|
this.host.dispatchEvent(new CustomEvent(`singlebase-${t}`, i));
|
|
392
|
-
const h =
|
|
422
|
+
const h = xs[t];
|
|
393
423
|
h && this.host.dispatchEvent(new CustomEvent(h, i));
|
|
394
424
|
}
|
|
395
425
|
release() {
|
|
@@ -399,36 +429,112 @@ class Ps {
|
|
|
399
429
|
this.release(), this.client = null;
|
|
400
430
|
}
|
|
401
431
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
432
|
+
const Ae = (a) => `${a}:link`, Ms = { google: "G", github: "GH", linkedin: "in", facebook: "f" };
|
|
433
|
+
function es(a) {
|
|
434
|
+
var e;
|
|
435
|
+
const t = a == null ? void 0 : a.oauth_settings;
|
|
436
|
+
return !!(t != null && t.enabled) && !!((e = t.redirect_url) != null && e.trim());
|
|
437
|
+
}
|
|
438
|
+
function Is(a, t) {
|
|
439
|
+
return t === "signin" && (a != null && a.oauth_settings.allow_signup) ? "signup" : t;
|
|
440
|
+
}
|
|
441
|
+
function R(a, t) {
|
|
442
|
+
if (!a || !es(a)) return [];
|
|
443
|
+
const e = a.oauth_settings;
|
|
444
|
+
return t === "signin" && !e.allow_signin ? [] : t === "signup" && !e.allow_signup ? [] : Object.entries(a.oauth_providers ?? {}).filter(([, s]) => s.enabled).map(([s, i]) => ({
|
|
445
|
+
id: s,
|
|
446
|
+
name: i.provider_name,
|
|
447
|
+
mark: Ms[s] ?? i.provider_name.slice(0, 2)
|
|
448
|
+
}));
|
|
449
|
+
}
|
|
450
|
+
function Fe(a, t) {
|
|
451
|
+
if (!(a instanceof Ne)) return t.genericErrorMessage;
|
|
452
|
+
switch (ms(a.code)) {
|
|
453
|
+
case "disable_retry_show_rate_limited":
|
|
454
|
+
return t.rateLimitedMessage;
|
|
455
|
+
case "show_password_requirements":
|
|
456
|
+
return t.invalidPasswordMessage;
|
|
457
|
+
case "expired_or_invalid_code_message":
|
|
458
|
+
return t.invalidCodeError;
|
|
459
|
+
case "explain_verified_email_required":
|
|
460
|
+
return t.oauthVerifiedEmailMessage;
|
|
461
|
+
case "restart_oauth":
|
|
462
|
+
case "restart_oauth_new_nonce":
|
|
463
|
+
return t.oauthRetryMessage;
|
|
464
|
+
case "ask_signin_then_link":
|
|
465
|
+
return t.signInToLinkMessage;
|
|
466
|
+
case "provider_already_linked":
|
|
467
|
+
return t.providerAlreadyLinkedMessage;
|
|
468
|
+
case "hide_oauth":
|
|
469
|
+
case "remove_oauth_from_signin":
|
|
470
|
+
case "remove_oauth_from_signup":
|
|
471
|
+
case "refresh_settings_hide_provider":
|
|
472
|
+
return t.oauthUnavailableMessage;
|
|
473
|
+
case "show_integrator_config_error":
|
|
474
|
+
return console.warn(`[singlebase] Auth is misconfigured for this project (${a.code}).`), a.code === "MISSING_OAUTH_CREDENTIALS" ? t.oauthUnavailableMessage : t.genericErrorMessage;
|
|
475
|
+
default:
|
|
476
|
+
return t.genericErrorMessage;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function ss(a, t) {
|
|
480
|
+
var s;
|
|
481
|
+
const e = (s = a == null ? void 0 : a.LENGTH) == null ? void 0 : s[0];
|
|
482
|
+
return e ? t.newPasswordPlaceholder.replace("{min}", String(e)) : t.newPasswordPlaceholderPlain;
|
|
483
|
+
}
|
|
484
|
+
function is(a, t, e) {
|
|
485
|
+
if (!a) return e.requiredError;
|
|
486
|
+
if (!t) return "";
|
|
487
|
+
const [s, i] = t.LENGTH ?? [0, 0];
|
|
488
|
+
return s && a.length < s ? e.passwordTooShortError.replace("{min}", String(s)) : i && a.length > i ? e.passwordTooLongError.replace("{max}", String(i)) : t.LOWERCASE && !/[a-z]/.test(a) ? e.passwordNeedsLowercaseError : t.UPPERCASE && !/[A-Z]/.test(a) ? e.passwordNeedsUppercaseError : t.NUMBERS && !/\d/.test(a) ? e.passwordNeedsNumberError : t.SYMBOLS && !/[^A-Za-z0-9\s]/.test(a) ? e.passwordNeedsSymbolError : "";
|
|
489
|
+
}
|
|
490
|
+
function Rs(a, t) {
|
|
491
|
+
if (!a) return [];
|
|
492
|
+
const [e, s] = a.LENGTH ?? [0, 0], i = [];
|
|
493
|
+
if (e || s) {
|
|
494
|
+
const h = s ? t.passwordRuleLength.replace("{min}", String(e || 1)).replace("{max}", String(s)) : t.passwordRuleMinLength.replace("{min}", String(e));
|
|
495
|
+
i.push({ label: h });
|
|
496
|
+
}
|
|
497
|
+
return a.LOWERCASE && i.push({ label: t.passwordRuleLowercase }), a.UPPERCASE && i.push({ label: t.passwordRuleUppercase }), a.NUMBERS && i.push({ label: t.passwordRuleNumber }), a.SYMBOLS && i.push({ label: t.passwordRuleSymbol }), i;
|
|
498
|
+
}
|
|
499
|
+
function as(a, t) {
|
|
500
|
+
const e = Rs(a, t);
|
|
501
|
+
return e.length === 0 ? d : r`<details class="pw-rules" part="password-rules">
|
|
502
|
+
<summary>${t.passwordRulesLabel}</summary>
|
|
503
|
+
<ul>
|
|
504
|
+
${e.map((s) => r`<li>${s.label}</li>`)}
|
|
505
|
+
</ul>
|
|
506
|
+
</details>`;
|
|
507
|
+
}
|
|
508
|
+
var Fs = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, Be = (a, t, e, s) => {
|
|
509
|
+
for (var i = Ds(t, e), h = a.length - 1, c; h >= 0; h--)
|
|
510
|
+
(c = a[h]) && (i = c(t, e, i) || i);
|
|
511
|
+
return i && Fs(t, e, i), i;
|
|
512
|
+
}, V, G, W;
|
|
513
|
+
class Oe extends y {
|
|
408
514
|
constructor() {
|
|
409
515
|
super(...arguments);
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
516
|
+
o(this, V, "idle");
|
|
517
|
+
o(this, G, "");
|
|
518
|
+
o(this, W, "");
|
|
413
519
|
b(this, "abortController", null);
|
|
414
520
|
}
|
|
415
521
|
get phase() {
|
|
416
|
-
return
|
|
522
|
+
return n(this, V);
|
|
417
523
|
}
|
|
418
524
|
set phase(e) {
|
|
419
|
-
|
|
525
|
+
l(this, V, e);
|
|
420
526
|
}
|
|
421
527
|
get formError() {
|
|
422
|
-
return
|
|
528
|
+
return n(this, G);
|
|
423
529
|
}
|
|
424
530
|
set formError(e) {
|
|
425
|
-
|
|
531
|
+
l(this, G, e);
|
|
426
532
|
}
|
|
427
533
|
get noticeMessage() {
|
|
428
|
-
return
|
|
534
|
+
return n(this, W);
|
|
429
535
|
}
|
|
430
536
|
set noticeMessage(e) {
|
|
431
|
-
|
|
537
|
+
l(this, W, e);
|
|
432
538
|
}
|
|
433
539
|
disconnectedCallback() {
|
|
434
540
|
var e;
|
|
@@ -452,88 +558,83 @@ class Ee extends $ {
|
|
|
452
558
|
return e instanceof DOMException && e.name === "AbortError";
|
|
453
559
|
}
|
|
454
560
|
describeError(e) {
|
|
455
|
-
|
|
456
|
-
const s = ns(e.code);
|
|
457
|
-
return s === "disable_retry_show_rate_limited" ? this.msg.rateLimitedMessage : s === "generic_credentials_message" ? this.msg.genericErrorMessage : this.msg.genericErrorMessage;
|
|
458
|
-
}
|
|
459
|
-
return this.msg.genericErrorMessage;
|
|
561
|
+
return Fe(e, this.msg);
|
|
460
562
|
}
|
|
461
563
|
get submitting() {
|
|
462
564
|
return this.phase === "submitting";
|
|
463
565
|
}
|
|
464
566
|
/** aria-live region for async status — spec requires one per form. */
|
|
465
567
|
renderStatus() {
|
|
466
|
-
return
|
|
568
|
+
return r`
|
|
467
569
|
<div
|
|
468
570
|
role="status"
|
|
469
571
|
aria-live="polite"
|
|
470
572
|
style="position:absolute;width:1px;height:1px;overflow:hidden;"
|
|
471
573
|
>
|
|
472
|
-
${this.phase === "submitting" ?
|
|
473
|
-
${this.phase === "success" ?
|
|
574
|
+
${this.phase === "submitting" ? this.msg.submittingStatus : ""}
|
|
575
|
+
${this.phase === "success" ? this.msg.doneStatus : ""}
|
|
474
576
|
</div>
|
|
475
|
-
${this.formError ?
|
|
476
|
-
${this.noticeMessage ?
|
|
577
|
+
${this.formError ? r`<p class="banner" role="alert">${this.formError}</p>` : null}
|
|
578
|
+
${this.noticeMessage ? r`<p class="notice" role="status">${this.noticeMessage}</p>` : null}
|
|
477
579
|
`;
|
|
478
580
|
}
|
|
479
581
|
}
|
|
480
|
-
|
|
481
|
-
|
|
582
|
+
V = new WeakMap(), G = new WeakMap(), W = new WeakMap();
|
|
583
|
+
Be([
|
|
482
584
|
m()
|
|
483
|
-
],
|
|
484
|
-
|
|
585
|
+
], Oe.prototype, "phase");
|
|
586
|
+
Be([
|
|
485
587
|
m()
|
|
486
|
-
],
|
|
487
|
-
|
|
588
|
+
], Oe.prototype, "formError");
|
|
589
|
+
Be([
|
|
488
590
|
m()
|
|
489
|
-
],
|
|
490
|
-
function
|
|
491
|
-
return [
|
|
591
|
+
], Oe.prototype, "noticeMessage");
|
|
592
|
+
function rs(a) {
|
|
593
|
+
return [a == null ? void 0 : a.first_name, a == null ? void 0 : a.last_name].filter(Boolean).join(" ").trim();
|
|
492
594
|
}
|
|
493
|
-
function
|
|
494
|
-
const t =
|
|
595
|
+
function ns(a) {
|
|
596
|
+
const t = rs(a);
|
|
495
597
|
if (t)
|
|
496
598
|
return t.split(/\s+/).map((s) => s[0]).join("").slice(0, 2).toUpperCase();
|
|
497
|
-
const e = (
|
|
599
|
+
const e = (a == null ? void 0 : a.email) ?? "";
|
|
498
600
|
return e ? e[0].toUpperCase() : "·";
|
|
499
601
|
}
|
|
500
|
-
var
|
|
501
|
-
for (var i = s > 1 ? void 0 : s ?
|
|
502
|
-
(c =
|
|
503
|
-
return s && i &&
|
|
602
|
+
var Bs = Object.defineProperty, Hs = Object.getOwnPropertyDescriptor, w = (a, t, e, s) => {
|
|
603
|
+
for (var i = s > 1 ? void 0 : s ? Hs(t, e) : t, h = a.length - 1, c; h >= 0; h--)
|
|
604
|
+
(c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
|
|
605
|
+
return s && i && Bs(t, e, i), i;
|
|
504
606
|
};
|
|
505
|
-
const
|
|
506
|
-
var
|
|
507
|
-
let
|
|
607
|
+
const qs = { profile_photo: !0 }, js = ".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp";
|
|
608
|
+
var Y, z, J, Z, Q, X, tt, et, st, it, at, rt, nt, ot, lt, ht, dt, ct, ut, pt, gt, mt, bt, ft, vt, ze;
|
|
609
|
+
let v = (ze = class extends Oe {
|
|
508
610
|
constructor() {
|
|
509
611
|
super(...arguments);
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
b(this, "settingsCtl", new ke(this));
|
|
612
|
+
o(this, Y, "");
|
|
613
|
+
o(this, z, "");
|
|
614
|
+
o(this, J, null);
|
|
615
|
+
o(this, Z, "singlebase-oauth-nonce");
|
|
616
|
+
o(this, Q, "");
|
|
617
|
+
o(this, X, "");
|
|
618
|
+
o(this, tt, !1);
|
|
619
|
+
o(this, et, "");
|
|
620
|
+
o(this, st, "");
|
|
621
|
+
o(this, it, "");
|
|
622
|
+
o(this, at, "");
|
|
623
|
+
o(this, rt, "");
|
|
624
|
+
o(this, nt, 0);
|
|
625
|
+
o(this, ot, "");
|
|
626
|
+
o(this, lt, "");
|
|
627
|
+
o(this, ht, "");
|
|
628
|
+
o(this, dt, "");
|
|
629
|
+
o(this, ct, "");
|
|
630
|
+
o(this, ut, "request");
|
|
631
|
+
o(this, pt, "");
|
|
632
|
+
o(this, gt, "");
|
|
633
|
+
o(this, mt, "");
|
|
634
|
+
o(this, bt, "");
|
|
635
|
+
o(this, ft, "");
|
|
636
|
+
o(this, vt, "");
|
|
637
|
+
b(this, "settingsCtl", new De(this));
|
|
537
638
|
b(this, "flashTimer");
|
|
538
639
|
b(this, "uidBase", `sb-acct-${Math.random().toString(36).slice(2, 8)}`);
|
|
539
640
|
// ── profile photo ─────────────────────────────────────────
|
|
@@ -563,160 +664,154 @@ let f = (Re = class extends Ee {
|
|
|
563
664
|
});
|
|
564
665
|
}
|
|
565
666
|
get logoText() {
|
|
566
|
-
return
|
|
667
|
+
return n(this, Y);
|
|
567
668
|
}
|
|
568
669
|
set logoText(t) {
|
|
569
|
-
|
|
670
|
+
l(this, Y, t);
|
|
570
671
|
}
|
|
571
672
|
get logoUrl() {
|
|
572
|
-
return
|
|
673
|
+
return n(this, z);
|
|
573
674
|
}
|
|
574
675
|
set logoUrl(t) {
|
|
575
|
-
|
|
676
|
+
l(this, z, t);
|
|
576
677
|
}
|
|
577
678
|
get settings() {
|
|
578
|
-
return
|
|
679
|
+
return n(this, J);
|
|
579
680
|
}
|
|
580
681
|
set settings(t) {
|
|
581
|
-
|
|
682
|
+
l(this, J, t);
|
|
582
683
|
}
|
|
583
684
|
get nonceStorageKey() {
|
|
584
|
-
return
|
|
685
|
+
return n(this, Z);
|
|
585
686
|
}
|
|
586
687
|
set nonceStorageKey(t) {
|
|
587
|
-
|
|
688
|
+
l(this, Z, t);
|
|
588
689
|
}
|
|
589
690
|
get editMode() {
|
|
590
|
-
return
|
|
691
|
+
return n(this, Q);
|
|
591
692
|
}
|
|
592
693
|
set editMode(t) {
|
|
593
|
-
|
|
694
|
+
l(this, Q, t);
|
|
594
695
|
}
|
|
595
696
|
get toast() {
|
|
596
|
-
return
|
|
697
|
+
return n(this, X);
|
|
597
698
|
}
|
|
598
699
|
set toast(t) {
|
|
599
|
-
|
|
700
|
+
l(this, X, t);
|
|
600
701
|
}
|
|
601
702
|
get photoBusy() {
|
|
602
|
-
return
|
|
703
|
+
return n(this, tt);
|
|
603
704
|
}
|
|
604
705
|
set photoBusy(t) {
|
|
605
|
-
|
|
706
|
+
l(this, tt, t);
|
|
606
707
|
}
|
|
607
708
|
get photoFailed() {
|
|
608
|
-
return
|
|
709
|
+
return n(this, et);
|
|
609
710
|
}
|
|
610
711
|
set photoFailed(t) {
|
|
611
|
-
|
|
712
|
+
l(this, et, t);
|
|
612
713
|
}
|
|
613
714
|
get profileSaved() {
|
|
614
|
-
return
|
|
715
|
+
return n(this, st);
|
|
615
716
|
}
|
|
616
717
|
set profileSaved(t) {
|
|
617
|
-
|
|
718
|
+
l(this, st, t);
|
|
618
719
|
}
|
|
619
720
|
get passSaved() {
|
|
620
|
-
return
|
|
721
|
+
return n(this, it);
|
|
621
722
|
}
|
|
622
723
|
set passSaved(t) {
|
|
623
|
-
|
|
724
|
+
l(this, it, t);
|
|
624
725
|
}
|
|
625
726
|
get profileError() {
|
|
626
|
-
return
|
|
727
|
+
return n(this, at);
|
|
627
728
|
}
|
|
628
729
|
set profileError(t) {
|
|
629
|
-
|
|
730
|
+
l(this, at, t);
|
|
630
731
|
}
|
|
631
732
|
get newPassError() {
|
|
632
|
-
return
|
|
733
|
+
return n(this, rt);
|
|
633
734
|
}
|
|
634
735
|
set newPassError(t) {
|
|
635
|
-
|
|
736
|
+
l(this, rt, t);
|
|
636
737
|
}
|
|
637
738
|
get deleteStage() {
|
|
638
|
-
return
|
|
739
|
+
return n(this, nt);
|
|
639
740
|
}
|
|
640
741
|
set deleteStage(t) {
|
|
641
|
-
|
|
742
|
+
l(this, nt, t);
|
|
642
743
|
}
|
|
643
744
|
get confirmText() {
|
|
644
|
-
return
|
|
745
|
+
return n(this, ot);
|
|
645
746
|
}
|
|
646
747
|
set confirmText(t) {
|
|
647
|
-
|
|
748
|
+
l(this, ot, t);
|
|
648
749
|
}
|
|
649
750
|
get dFirst() {
|
|
650
|
-
return
|
|
751
|
+
return n(this, lt);
|
|
651
752
|
}
|
|
652
753
|
set dFirst(t) {
|
|
653
|
-
|
|
754
|
+
l(this, lt, t);
|
|
654
755
|
}
|
|
655
756
|
get dLast() {
|
|
656
|
-
return
|
|
757
|
+
return n(this, ht);
|
|
657
758
|
}
|
|
658
759
|
set dLast(t) {
|
|
659
|
-
|
|
760
|
+
l(this, ht, t);
|
|
660
761
|
}
|
|
661
762
|
get dPhone() {
|
|
662
|
-
return
|
|
763
|
+
return n(this, dt);
|
|
663
764
|
}
|
|
664
765
|
set dPhone(t) {
|
|
665
|
-
|
|
766
|
+
l(this, dt, t);
|
|
666
767
|
}
|
|
667
768
|
get dEmail() {
|
|
668
|
-
return
|
|
769
|
+
return n(this, ct);
|
|
669
770
|
}
|
|
670
771
|
set dEmail(t) {
|
|
671
|
-
|
|
772
|
+
l(this, ct, t);
|
|
672
773
|
}
|
|
673
774
|
get emailStep() {
|
|
674
|
-
return
|
|
775
|
+
return n(this, ut);
|
|
675
776
|
}
|
|
676
777
|
set emailStep(t) {
|
|
677
|
-
|
|
778
|
+
l(this, ut, t);
|
|
678
779
|
}
|
|
679
780
|
get dNewEmail() {
|
|
680
|
-
return
|
|
781
|
+
return n(this, pt);
|
|
681
782
|
}
|
|
682
783
|
set dNewEmail(t) {
|
|
683
|
-
|
|
784
|
+
l(this, pt, t);
|
|
684
785
|
}
|
|
685
786
|
get emailCode() {
|
|
686
|
-
return
|
|
787
|
+
return n(this, gt);
|
|
687
788
|
}
|
|
688
789
|
set emailCode(t) {
|
|
689
|
-
|
|
790
|
+
l(this, gt, t);
|
|
690
791
|
}
|
|
691
792
|
get emailError() {
|
|
692
|
-
return
|
|
793
|
+
return n(this, mt);
|
|
693
794
|
}
|
|
694
795
|
set emailError(t) {
|
|
695
|
-
|
|
796
|
+
l(this, mt, t);
|
|
696
797
|
}
|
|
697
798
|
get emailSaved() {
|
|
698
|
-
return
|
|
799
|
+
return n(this, bt);
|
|
699
800
|
}
|
|
700
801
|
set emailSaved(t) {
|
|
701
|
-
|
|
702
|
-
}
|
|
703
|
-
get curPass() {
|
|
704
|
-
return r(this, lt);
|
|
705
|
-
}
|
|
706
|
-
set curPass(t) {
|
|
707
|
-
o(this, lt, t);
|
|
802
|
+
l(this, bt, t);
|
|
708
803
|
}
|
|
709
804
|
get newPass() {
|
|
710
|
-
return
|
|
805
|
+
return n(this, ft);
|
|
711
806
|
}
|
|
712
807
|
set newPass(t) {
|
|
713
|
-
|
|
808
|
+
l(this, ft, t);
|
|
714
809
|
}
|
|
715
810
|
get confirmPass() {
|
|
716
|
-
return
|
|
811
|
+
return n(this, vt);
|
|
717
812
|
}
|
|
718
813
|
set confirmPass(t) {
|
|
719
|
-
|
|
814
|
+
l(this, vt, t);
|
|
720
815
|
}
|
|
721
816
|
uid(t) {
|
|
722
817
|
return `${this.uidBase}-${t}`;
|
|
@@ -734,22 +829,22 @@ let f = (Re = class extends Ee {
|
|
|
734
829
|
}
|
|
735
830
|
/** Matches the guest screens: image when given one, else the text label. */
|
|
736
831
|
renderLogo() {
|
|
737
|
-
return this.logoUrl ?
|
|
832
|
+
return this.logoUrl ? r`<img
|
|
738
833
|
part="logo"
|
|
739
834
|
src=${this.logoUrl}
|
|
740
835
|
alt=${this.logoText}
|
|
741
836
|
style="display:block;align-self:flex-start;height:var(--sb-logo-height,20px);width:auto;max-width:100%"
|
|
742
|
-
/>` : this.logoText ?
|
|
837
|
+
/>` : this.logoText ? r`<div class="logo-dot" part="logo">${this.logoText}</div>` : d;
|
|
743
838
|
}
|
|
744
839
|
get user() {
|
|
745
840
|
const t = this.auth.state;
|
|
746
841
|
return t.status === "authenticated" ? t.user : null;
|
|
747
842
|
}
|
|
748
843
|
get fullName() {
|
|
749
|
-
return
|
|
844
|
+
return rs(this.user);
|
|
750
845
|
}
|
|
751
846
|
get initials() {
|
|
752
|
-
return
|
|
847
|
+
return ns(this.user);
|
|
753
848
|
}
|
|
754
849
|
/**
|
|
755
850
|
* The upload API bound to the same dispatcher as this widget's auth client,
|
|
@@ -758,7 +853,7 @@ let f = (Re = class extends Ee {
|
|
|
758
853
|
*/
|
|
759
854
|
get uploadClient() {
|
|
760
855
|
const t = this.resolvedClient;
|
|
761
|
-
return t ? (this.uploadClientFor !== t && (this.uploadClientFor = t, this.uploadClientCache = { files:
|
|
856
|
+
return t ? (this.uploadClientFor !== t && (this.uploadClientFor = t, this.uploadClientCache = { files: bs(t.dispatcher) }), this.uploadClientCache) : null;
|
|
762
857
|
}
|
|
763
858
|
startProfileEdit() {
|
|
764
859
|
const t = this.user;
|
|
@@ -766,45 +861,43 @@ let f = (Re = class extends Ee {
|
|
|
766
861
|
}
|
|
767
862
|
async onSaveProfile() {
|
|
768
863
|
const t = this.resolvedClient;
|
|
769
|
-
if (t)
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
await this.run(async () => {
|
|
779
|
-
await t.updateAccount(
|
|
780
|
-
{ first_name: this.dFirst, last_name: this.dLast, phone: this.dPhone },
|
|
781
|
-
this.signal
|
|
782
|
-
), this.editMode = "", this.flash("profileSaved", this.msg.savedNote);
|
|
783
|
-
});
|
|
864
|
+
if (!t) return;
|
|
865
|
+
const e = this.dFirst.trim(), s = this.dLast.trim(), i = this.dPhone.trim();
|
|
866
|
+
if (!e) {
|
|
867
|
+
this.profileError = this.msg.firstNameRequiredError;
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
if (i && i.replace(/\D/g, "").length < 7) {
|
|
871
|
+
this.profileError = this.msg.invalidPhoneError;
|
|
872
|
+
return;
|
|
784
873
|
}
|
|
874
|
+
const h = this.user, c = {};
|
|
875
|
+
if (e !== ((h == null ? void 0 : h.first_name) ?? "") && (c.first_name = e), s !== ((h == null ? void 0 : h.last_name) ?? "") && (c.last_name = s), i !== ((h == null ? void 0 : h.phone) ?? "") && (c.phone = i), Object.keys(c).length === 0) {
|
|
876
|
+
this.editMode = "";
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
await this.run(async () => {
|
|
880
|
+
await t.updateAccount(c, this.signal), this.editMode = "", this.flash("profileSaved", this.msg.savedNote);
|
|
881
|
+
});
|
|
785
882
|
}
|
|
786
883
|
startPassEdit() {
|
|
787
|
-
this.
|
|
884
|
+
this.newPass = "", this.confirmPass = "", this.newPassError = "", this.passSaved = "", this.profileSaved = "", this.toast = "", this.editMode = "password";
|
|
788
885
|
}
|
|
789
886
|
async onChangePass() {
|
|
790
887
|
const t = this.resolvedClient;
|
|
791
|
-
if (t)
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
if (this.newPass !== this.confirmPass) {
|
|
801
|
-
this.newPassError = this.msg.passwordMatchError;
|
|
802
|
-
return;
|
|
803
|
-
}
|
|
804
|
-
await this.run(async () => {
|
|
805
|
-
await t.changePassword({ password: this.newPass }, this.signal), this.editMode = "", this.curPass = "", this.newPass = "", this.confirmPass = "", this.flash("passSaved", this.msg.passwordUpdatedNote);
|
|
806
|
-
});
|
|
888
|
+
if (!t) return;
|
|
889
|
+
const e = this.settings ?? this.settingsCtl.settings, s = is(this.newPass, e == null ? void 0 : e.auth_settings.password_policy, this.msg);
|
|
890
|
+
if (s) {
|
|
891
|
+
this.newPassError = s;
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
if (this.newPass !== this.confirmPass) {
|
|
895
|
+
this.newPassError = this.msg.passwordMatchError;
|
|
896
|
+
return;
|
|
807
897
|
}
|
|
898
|
+
await this.run(async () => {
|
|
899
|
+
await t.changePassword({ password: this.newPass }, this.signal), this.editMode = "", this.newPass = "", this.confirmPass = "", this.flash("passSaved", this.msg.passwordUpdatedNote);
|
|
900
|
+
});
|
|
808
901
|
}
|
|
809
902
|
// ── email change ─────────────────────────────────────────
|
|
810
903
|
startEmailEdit() {
|
|
@@ -850,15 +943,15 @@ let f = (Re = class extends Ee {
|
|
|
850
943
|
renderEmailSection() {
|
|
851
944
|
var s;
|
|
852
945
|
const t = this.editMode !== "email", e = this.editMode !== "" && this.editMode !== "email";
|
|
853
|
-
return
|
|
946
|
+
return r`
|
|
854
947
|
<div class="rule"></div>
|
|
855
948
|
<div class="section">
|
|
856
949
|
<h3 class="sec-title">${this.msg.changeEmailTitle}</h3>
|
|
857
|
-
${t ?
|
|
950
|
+
${t ? r`
|
|
858
951
|
<div class="between">
|
|
859
952
|
<p class="hint">${((s = this.user) == null ? void 0 : s.email) ?? ""}</p>
|
|
860
953
|
<div class="btn-row-end">
|
|
861
|
-
${this.emailSaved ?
|
|
954
|
+
${this.emailSaved ? r`<span role="status" class="saved-note">${this.emailSaved}</span>` : d}
|
|
862
955
|
<button
|
|
863
956
|
type="button"
|
|
864
957
|
class="edit-link"
|
|
@@ -869,7 +962,7 @@ let f = (Re = class extends Ee {
|
|
|
869
962
|
</button>
|
|
870
963
|
</div>
|
|
871
964
|
</div>
|
|
872
|
-
` : this.emailStep === "request" ?
|
|
965
|
+
` : this.emailStep === "request" ? r`
|
|
873
966
|
<div class="edit-card">
|
|
874
967
|
<div class="field">
|
|
875
968
|
<label for=${this.uid("newemail")}>${this.msg.newEmailLabel}</label>
|
|
@@ -887,7 +980,7 @@ let f = (Re = class extends Ee {
|
|
|
887
980
|
/>
|
|
888
981
|
<p class="hint">${this.msg.changeEmailHint}</p>
|
|
889
982
|
</div>
|
|
890
|
-
${this.emailError ?
|
|
983
|
+
${this.emailError ? r`<p class="err">${this.emailError}</p>` : d}
|
|
891
984
|
<div class="edit-actions">
|
|
892
985
|
<button
|
|
893
986
|
type="button"
|
|
@@ -895,7 +988,7 @@ let f = (Re = class extends Ee {
|
|
|
895
988
|
?disabled=${this.submitting}
|
|
896
989
|
@click=${this.onRequestEmailCode}
|
|
897
990
|
>
|
|
898
|
-
${this.submitting ?
|
|
991
|
+
${this.submitting ? r`<span class="spinner"></span>` : d}
|
|
899
992
|
<span>${this.msg.changeEmailCta}</span>
|
|
900
993
|
</button>
|
|
901
994
|
<button
|
|
@@ -909,7 +1002,7 @@ let f = (Re = class extends Ee {
|
|
|
909
1002
|
</button>
|
|
910
1003
|
</div>
|
|
911
1004
|
</div>
|
|
912
|
-
` :
|
|
1005
|
+
` : r`
|
|
913
1006
|
<div class="edit-card">
|
|
914
1007
|
<p class="hint">${this.msg.codeSentNeutral}</p>
|
|
915
1008
|
<div class="field">
|
|
@@ -930,7 +1023,7 @@ let f = (Re = class extends Ee {
|
|
|
930
1023
|
/>
|
|
931
1024
|
<p class="hint">${this.msg.changeEmailConfirmHint} ${this.dNewEmail}</p>
|
|
932
1025
|
</div>
|
|
933
|
-
${this.emailError ?
|
|
1026
|
+
${this.emailError ? r`<p class="err">${this.emailError}</p>` : d}
|
|
934
1027
|
<div class="edit-actions">
|
|
935
1028
|
<button
|
|
936
1029
|
type="button"
|
|
@@ -938,7 +1031,7 @@ let f = (Re = class extends Ee {
|
|
|
938
1031
|
?disabled=${this.submitting}
|
|
939
1032
|
@click=${this.onConfirmEmailChange}
|
|
940
1033
|
>
|
|
941
|
-
${this.submitting ?
|
|
1034
|
+
${this.submitting ? r`<span class="spinner"></span>` : d}
|
|
942
1035
|
<span>${this.msg.confirmChangeCta}</span>
|
|
943
1036
|
</button>
|
|
944
1037
|
<button
|
|
@@ -965,9 +1058,9 @@ let f = (Re = class extends Ee {
|
|
|
965
1058
|
async onConnectProvider(t) {
|
|
966
1059
|
const e = this.resolvedClient, s = this.auth.state;
|
|
967
1060
|
!e || s.status !== "authenticated" || await this.run(async () => {
|
|
968
|
-
var c;
|
|
1061
|
+
var c, f;
|
|
969
1062
|
const i = await e.createOAuthNonce(this.signal);
|
|
970
|
-
(c = globalThis.sessionStorage) == null || c.setItem(this.nonceStorageKey, i);
|
|
1063
|
+
(c = globalThis.sessionStorage) == null || c.setItem(this.nonceStorageKey, i), (f = globalThis.sessionStorage) == null || f.setItem(Ae(this.nonceStorageKey), t);
|
|
971
1064
|
const { oauth_redirect_url: h } = await e.startOAuth(
|
|
972
1065
|
{
|
|
973
1066
|
provider: t,
|
|
@@ -982,29 +1075,17 @@ let f = (Re = class extends Ee {
|
|
|
982
1075
|
});
|
|
983
1076
|
}
|
|
984
1077
|
get availableProviders() {
|
|
985
|
-
|
|
986
|
-
if (!t || !t.oauth_settings.enabled) return [];
|
|
987
|
-
const e = {
|
|
988
|
-
google: "G",
|
|
989
|
-
github: "GH",
|
|
990
|
-
linkedin: "in",
|
|
991
|
-
facebook: "f"
|
|
992
|
-
};
|
|
993
|
-
return Object.entries(t.oauth_providers).filter(([, s]) => s.enabled).map(([s, i]) => ({
|
|
994
|
-
id: s,
|
|
995
|
-
name: i.provider_name,
|
|
996
|
-
mark: e[s] ?? i.provider_name.slice(0, 2)
|
|
997
|
-
}));
|
|
1078
|
+
return R(this.settings ?? this.settingsCtl.settings, "link");
|
|
998
1079
|
}
|
|
999
1080
|
// ── sections ──────────────────────────────────────────────
|
|
1000
1081
|
renderIdentity() {
|
|
1001
1082
|
const t = this.user, e = this.editMode !== "" && this.editMode !== "avatar", s = t != null && t.profile_photo && t.profile_photo !== this.photoFailed ? t.profile_photo : "";
|
|
1002
|
-
return
|
|
1083
|
+
return r`
|
|
1003
1084
|
<div class="acct-nav">
|
|
1004
1085
|
<div class="acct-who">
|
|
1005
1086
|
<div class="avatar-col">
|
|
1006
1087
|
<div class="avatar ${s ? "has-photo" : ""}" part="avatar">
|
|
1007
|
-
${s ?
|
|
1088
|
+
${s ? r`<img
|
|
1008
1089
|
src=${s}
|
|
1009
1090
|
alt=""
|
|
1010
1091
|
part="avatar-image"
|
|
@@ -1025,9 +1106,9 @@ let f = (Re = class extends Ee {
|
|
|
1025
1106
|
view="button"
|
|
1026
1107
|
max-files="1"
|
|
1027
1108
|
branding="false"
|
|
1028
|
-
accept=${
|
|
1109
|
+
accept=${js}
|
|
1029
1110
|
.client=${this.uploadClient}
|
|
1030
|
-
.options=${
|
|
1111
|
+
.options=${qs}
|
|
1031
1112
|
@singlebase-upload-selected=${this.onPhotoSelected}
|
|
1032
1113
|
@singlebase-upload-complete=${this.onPhotoUploaded}
|
|
1033
1114
|
@singlebase-upload-error=${this.onPhotoProblem}
|
|
@@ -1054,12 +1135,12 @@ let f = (Re = class extends Ee {
|
|
|
1054
1135
|
[this.msg.phoneLabel, t.phone || "—"],
|
|
1055
1136
|
[this.msg.emailLabel, t.email || "—"]
|
|
1056
1137
|
];
|
|
1057
|
-
return
|
|
1138
|
+
return r`
|
|
1058
1139
|
<div class="section">
|
|
1059
|
-
${e ?
|
|
1140
|
+
${e ? r`
|
|
1060
1141
|
<div class="sum-list">
|
|
1061
1142
|
${i.map(
|
|
1062
|
-
([h, c]) =>
|
|
1143
|
+
([h, c]) => r`
|
|
1063
1144
|
<div class="sum-row">
|
|
1064
1145
|
<span class="sum-label">${h}</span>
|
|
1065
1146
|
<span class="sum-value">${c}</span>
|
|
@@ -1068,7 +1149,7 @@ let f = (Re = class extends Ee {
|
|
|
1068
1149
|
)}
|
|
1069
1150
|
</div>
|
|
1070
1151
|
<div class="btn-row-end">
|
|
1071
|
-
${this.profileSaved ?
|
|
1152
|
+
${this.profileSaved ? r`<span role="status" class="saved-note">${this.profileSaved}</span>` : d}
|
|
1072
1153
|
<button
|
|
1073
1154
|
type="button"
|
|
1074
1155
|
class="edit-link"
|
|
@@ -1078,7 +1159,7 @@ let f = (Re = class extends Ee {
|
|
|
1078
1159
|
${this.msg.editAccountCta}
|
|
1079
1160
|
</button>
|
|
1080
1161
|
</div>
|
|
1081
|
-
` :
|
|
1162
|
+
` : r`
|
|
1082
1163
|
<div class="edit-card">
|
|
1083
1164
|
<div class="two-up">
|
|
1084
1165
|
<div class="field">
|
|
@@ -1136,7 +1217,7 @@ let f = (Re = class extends Ee {
|
|
|
1136
1217
|
/>
|
|
1137
1218
|
<p class="hint">${this.msg.changeEmailElsewhereHint}</p>
|
|
1138
1219
|
</div>
|
|
1139
|
-
${this.profileError ?
|
|
1220
|
+
${this.profileError ? r`<p class="err">${this.profileError}</p>` : d}
|
|
1140
1221
|
<div class="edit-actions">
|
|
1141
1222
|
<button
|
|
1142
1223
|
type="button"
|
|
@@ -1144,7 +1225,7 @@ let f = (Re = class extends Ee {
|
|
|
1144
1225
|
?disabled=${this.submitting}
|
|
1145
1226
|
@click=${this.onSaveProfile}
|
|
1146
1227
|
>
|
|
1147
|
-
${this.submitting ?
|
|
1228
|
+
${this.submitting ? r`<span class="spinner"></span>` : d}
|
|
1148
1229
|
<span>${this.msg.saveChangesCta}</span>
|
|
1149
1230
|
</button>
|
|
1150
1231
|
<button
|
|
@@ -1163,16 +1244,17 @@ let f = (Re = class extends Ee {
|
|
|
1163
1244
|
`;
|
|
1164
1245
|
}
|
|
1165
1246
|
renderPasswordSection() {
|
|
1247
|
+
var s, i;
|
|
1166
1248
|
const t = this.editMode !== "password", e = this.editMode !== "" && this.editMode !== "password";
|
|
1167
|
-
return
|
|
1249
|
+
return r`
|
|
1168
1250
|
<div class="rule"></div>
|
|
1169
1251
|
<div class="section">
|
|
1170
1252
|
<h3 class="sec-title">${this.msg.passwordSectionTitle}</h3>
|
|
1171
|
-
${t ?
|
|
1253
|
+
${t ? r`
|
|
1172
1254
|
<div class="between">
|
|
1173
1255
|
<p class="hint">${this.msg.passwordChangedHint}</p>
|
|
1174
1256
|
<div class="btn-row-end">
|
|
1175
|
-
${this.passSaved ?
|
|
1257
|
+
${this.passSaved ? r`<span role="status" class="saved-note">${this.passSaved}</span>` : d}
|
|
1176
1258
|
<button
|
|
1177
1259
|
type="button"
|
|
1178
1260
|
class="edit-link"
|
|
@@ -1183,22 +1265,8 @@ let f = (Re = class extends Ee {
|
|
|
1183
1265
|
</button>
|
|
1184
1266
|
</div>
|
|
1185
1267
|
</div>
|
|
1186
|
-
` :
|
|
1268
|
+
` : r`
|
|
1187
1269
|
<div class="edit-card">
|
|
1188
|
-
<div class="field">
|
|
1189
|
-
<label for=${this.uid("curpass")}>${this.msg.currentPasswordLabel}</label>
|
|
1190
|
-
<input
|
|
1191
|
-
id=${this.uid("curpass")}
|
|
1192
|
-
type="password"
|
|
1193
|
-
part="input"
|
|
1194
|
-
.value=${this.curPass}
|
|
1195
|
-
placeholder=${this.msg.passwordPlaceholder}
|
|
1196
|
-
?disabled=${this.submitting}
|
|
1197
|
-
@input=${(s) => {
|
|
1198
|
-
this.curPass = s.target.value, this.newPassError = "";
|
|
1199
|
-
}}
|
|
1200
|
-
/>
|
|
1201
|
-
</div>
|
|
1202
1270
|
<div class="field">
|
|
1203
1271
|
<label for=${this.uid("newpass")}>${this.msg.newPasswordLabel}</label>
|
|
1204
1272
|
<input
|
|
@@ -1206,16 +1274,21 @@ let f = (Re = class extends Ee {
|
|
|
1206
1274
|
type="password"
|
|
1207
1275
|
part="input"
|
|
1208
1276
|
.value=${this.newPass}
|
|
1209
|
-
placeholder=${
|
|
1277
|
+
placeholder=${ss(
|
|
1278
|
+
(s = this.settings ?? this.settingsCtl.settings) == null ? void 0 : s.auth_settings.password_policy,
|
|
1279
|
+
this.msg
|
|
1280
|
+
)}
|
|
1210
1281
|
aria-invalid=${this.newPassError ? "true" : "false"}
|
|
1211
1282
|
?disabled=${this.submitting}
|
|
1212
|
-
@input=${(
|
|
1213
|
-
this.newPass =
|
|
1283
|
+
@input=${(h) => {
|
|
1284
|
+
this.newPass = h.target.value, this.newPassError = "";
|
|
1214
1285
|
}}
|
|
1215
1286
|
/>
|
|
1216
1287
|
</div>
|
|
1217
1288
|
<div class="field">
|
|
1218
|
-
<label for=${this.uid("confirmpass")}
|
|
1289
|
+
<label for=${this.uid("confirmpass")}
|
|
1290
|
+
>${this.msg.confirmNewPasswordLabel}</label
|
|
1291
|
+
>
|
|
1219
1292
|
<input
|
|
1220
1293
|
id=${this.uid("confirmpass")}
|
|
1221
1294
|
type="password"
|
|
@@ -1224,11 +1297,12 @@ let f = (Re = class extends Ee {
|
|
|
1224
1297
|
placeholder=${this.msg.confirmPasswordPlaceholder}
|
|
1225
1298
|
aria-invalid=${this.newPassError ? "true" : "false"}
|
|
1226
1299
|
?disabled=${this.submitting}
|
|
1227
|
-
@input=${(
|
|
1228
|
-
this.confirmPass =
|
|
1300
|
+
@input=${(h) => {
|
|
1301
|
+
this.confirmPass = h.target.value, this.newPassError = "";
|
|
1229
1302
|
}}
|
|
1230
1303
|
/>
|
|
1231
|
-
${this.
|
|
1304
|
+
${as((i = this.settings ?? this.settingsCtl.settings) == null ? void 0 : i.auth_settings.password_policy, this.msg)}
|
|
1305
|
+
${this.newPassError ? r`<p class="err">${this.newPassError}</p>` : d}
|
|
1232
1306
|
</div>
|
|
1233
1307
|
<div class="edit-actions">
|
|
1234
1308
|
<button
|
|
@@ -1237,7 +1311,7 @@ let f = (Re = class extends Ee {
|
|
|
1237
1311
|
?disabled=${this.submitting}
|
|
1238
1312
|
@click=${this.onChangePass}
|
|
1239
1313
|
>
|
|
1240
|
-
${this.submitting ?
|
|
1314
|
+
${this.submitting ? r`<span class="spinner"></span>` : d}
|
|
1241
1315
|
<span>${this.msg.updatePasswordCta}</span>
|
|
1242
1316
|
</button>
|
|
1243
1317
|
<button type="button" class="ghost-sm" @click=${() => this.editMode = ""}>
|
|
@@ -1251,7 +1325,7 @@ let f = (Re = class extends Ee {
|
|
|
1251
1325
|
}
|
|
1252
1326
|
/** Layout preserved from the mock; no enrolment operation exists yet. */
|
|
1253
1327
|
renderTwoFactorSection() {
|
|
1254
|
-
return
|
|
1328
|
+
return r`
|
|
1255
1329
|
<div class="rule"></div>
|
|
1256
1330
|
<div class="section">
|
|
1257
1331
|
<div class="between">
|
|
@@ -1278,7 +1352,7 @@ let f = (Re = class extends Ee {
|
|
|
1278
1352
|
}
|
|
1279
1353
|
renderConnectedSection() {
|
|
1280
1354
|
const t = this.availableProviders;
|
|
1281
|
-
return t.length === 0 ? d :
|
|
1355
|
+
return t.length === 0 ? d : r`
|
|
1282
1356
|
<div class="rule"></div>
|
|
1283
1357
|
<div class="section">
|
|
1284
1358
|
<h3 class="sec-title">${this.msg.connectedTitle}</h3>
|
|
@@ -1286,11 +1360,11 @@ let f = (Re = class extends Ee {
|
|
|
1286
1360
|
<span class="sub-label">${this.msg.addAnotherLabel}</span>
|
|
1287
1361
|
<div class="tile-grid">
|
|
1288
1362
|
${t.map(
|
|
1289
|
-
(e) =>
|
|
1363
|
+
(e) => r`
|
|
1290
1364
|
<button
|
|
1291
1365
|
type="button"
|
|
1292
1366
|
class="tile"
|
|
1293
|
-
aria-label=${
|
|
1367
|
+
aria-label=${this.msg.connectProviderLabel.replace("{name}", e.name)}
|
|
1294
1368
|
?disabled=${this.submitting}
|
|
1295
1369
|
@click=${() => this.onConnectProvider(e.id)}
|
|
1296
1370
|
>
|
|
@@ -1301,18 +1375,14 @@ let f = (Re = class extends Ee {
|
|
|
1301
1375
|
`
|
|
1302
1376
|
)}
|
|
1303
1377
|
</div>
|
|
1304
|
-
<p class="disabled-note">
|
|
1305
|
-
${this.msg.notYetSupported} — listing or disconnecting linked providers is not part of the
|
|
1306
|
-
current API.
|
|
1307
|
-
</p>
|
|
1308
1378
|
</div>
|
|
1309
1379
|
`;
|
|
1310
1380
|
}
|
|
1311
1381
|
renderDangerSection() {
|
|
1312
|
-
return
|
|
1382
|
+
return r`
|
|
1313
1383
|
<div class="rule"></div>
|
|
1314
1384
|
<div class="section">
|
|
1315
|
-
${this.deleteStage === 0 ?
|
|
1385
|
+
${this.deleteStage === 0 ? r`<button
|
|
1316
1386
|
type="button"
|
|
1317
1387
|
class="danger-link"
|
|
1318
1388
|
disabled
|
|
@@ -1327,12 +1397,12 @@ let f = (Re = class extends Ee {
|
|
|
1327
1397
|
`;
|
|
1328
1398
|
}
|
|
1329
1399
|
render() {
|
|
1330
|
-
return this.user ?
|
|
1400
|
+
return this.user ? r`
|
|
1331
1401
|
<div class="acct-root">
|
|
1332
1402
|
${this.renderLogo()} ${this.renderIdentity()}
|
|
1333
1403
|
<div class="acct-body">
|
|
1334
|
-
${this.toast ?
|
|
1335
|
-
${this.formError ?
|
|
1404
|
+
${this.toast ? r`<div class="notice" role="status">${this.toast}</div>` : d}
|
|
1405
|
+
${this.formError ? r`<div class="banner" role="alert">${this.formError}</div>` : d}
|
|
1336
1406
|
${this.renderProfileSection()} ${this.renderEmailSection()}
|
|
1337
1407
|
${this.renderPasswordSection()}
|
|
1338
1408
|
${d}
|
|
@@ -1340,171 +1410,155 @@ let f = (Re = class extends Ee {
|
|
|
1340
1410
|
${d}
|
|
1341
1411
|
</div>
|
|
1342
1412
|
</div>
|
|
1343
|
-
` :
|
|
1413
|
+
` : r`<p class="disabled-note">${this.msg.notSignedInNote}</p>`;
|
|
1344
1414
|
}
|
|
1345
|
-
},
|
|
1346
|
-
|
|
1415
|
+
}, Y = new WeakMap(), z = new WeakMap(), J = new WeakMap(), Z = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), st = new WeakMap(), it = new WeakMap(), at = new WeakMap(), rt = new WeakMap(), nt = new WeakMap(), ot = new WeakMap(), lt = new WeakMap(), ht = new WeakMap(), dt = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), mt = new WeakMap(), bt = new WeakMap(), ft = new WeakMap(), vt = new WeakMap(), ze);
|
|
1416
|
+
w([
|
|
1347
1417
|
p({ attribute: "logo-text" })
|
|
1348
|
-
],
|
|
1349
|
-
|
|
1418
|
+
], v.prototype, "logoText", 1);
|
|
1419
|
+
w([
|
|
1350
1420
|
p({ attribute: "logo-url" })
|
|
1351
|
-
],
|
|
1352
|
-
|
|
1421
|
+
], v.prototype, "logoUrl", 1);
|
|
1422
|
+
w([
|
|
1353
1423
|
p({ attribute: !1 })
|
|
1354
|
-
],
|
|
1355
|
-
|
|
1424
|
+
], v.prototype, "settings", 1);
|
|
1425
|
+
w([
|
|
1356
1426
|
p({ attribute: "nonce-storage-key" })
|
|
1357
|
-
],
|
|
1358
|
-
|
|
1359
|
-
m()
|
|
1360
|
-
], f.prototype, "editMode", 1);
|
|
1361
|
-
v([
|
|
1427
|
+
], v.prototype, "nonceStorageKey", 1);
|
|
1428
|
+
w([
|
|
1362
1429
|
m()
|
|
1363
|
-
],
|
|
1364
|
-
|
|
1430
|
+
], v.prototype, "editMode", 1);
|
|
1431
|
+
w([
|
|
1365
1432
|
m()
|
|
1366
|
-
],
|
|
1367
|
-
|
|
1433
|
+
], v.prototype, "toast", 1);
|
|
1434
|
+
w([
|
|
1368
1435
|
m()
|
|
1369
|
-
],
|
|
1370
|
-
|
|
1436
|
+
], v.prototype, "photoBusy", 1);
|
|
1437
|
+
w([
|
|
1371
1438
|
m()
|
|
1372
|
-
],
|
|
1373
|
-
|
|
1439
|
+
], v.prototype, "photoFailed", 1);
|
|
1440
|
+
w([
|
|
1374
1441
|
m()
|
|
1375
|
-
],
|
|
1376
|
-
|
|
1442
|
+
], v.prototype, "profileSaved", 1);
|
|
1443
|
+
w([
|
|
1377
1444
|
m()
|
|
1378
|
-
],
|
|
1379
|
-
|
|
1445
|
+
], v.prototype, "passSaved", 1);
|
|
1446
|
+
w([
|
|
1380
1447
|
m()
|
|
1381
|
-
],
|
|
1382
|
-
|
|
1448
|
+
], v.prototype, "profileError", 1);
|
|
1449
|
+
w([
|
|
1383
1450
|
m()
|
|
1384
|
-
],
|
|
1385
|
-
|
|
1451
|
+
], v.prototype, "newPassError", 1);
|
|
1452
|
+
w([
|
|
1386
1453
|
m()
|
|
1387
|
-
],
|
|
1388
|
-
|
|
1454
|
+
], v.prototype, "deleteStage", 1);
|
|
1455
|
+
w([
|
|
1389
1456
|
m()
|
|
1390
|
-
],
|
|
1391
|
-
|
|
1457
|
+
], v.prototype, "confirmText", 1);
|
|
1458
|
+
w([
|
|
1392
1459
|
m()
|
|
1393
|
-
],
|
|
1394
|
-
|
|
1460
|
+
], v.prototype, "dFirst", 1);
|
|
1461
|
+
w([
|
|
1395
1462
|
m()
|
|
1396
|
-
],
|
|
1397
|
-
|
|
1463
|
+
], v.prototype, "dLast", 1);
|
|
1464
|
+
w([
|
|
1398
1465
|
m()
|
|
1399
|
-
],
|
|
1400
|
-
|
|
1466
|
+
], v.prototype, "dPhone", 1);
|
|
1467
|
+
w([
|
|
1401
1468
|
m()
|
|
1402
|
-
],
|
|
1403
|
-
|
|
1469
|
+
], v.prototype, "dEmail", 1);
|
|
1470
|
+
w([
|
|
1404
1471
|
m()
|
|
1405
|
-
],
|
|
1406
|
-
|
|
1472
|
+
], v.prototype, "emailStep", 1);
|
|
1473
|
+
w([
|
|
1407
1474
|
m()
|
|
1408
|
-
],
|
|
1409
|
-
|
|
1475
|
+
], v.prototype, "dNewEmail", 1);
|
|
1476
|
+
w([
|
|
1410
1477
|
m()
|
|
1411
|
-
],
|
|
1412
|
-
|
|
1478
|
+
], v.prototype, "emailCode", 1);
|
|
1479
|
+
w([
|
|
1413
1480
|
m()
|
|
1414
|
-
],
|
|
1415
|
-
|
|
1481
|
+
], v.prototype, "emailError", 1);
|
|
1482
|
+
w([
|
|
1416
1483
|
m()
|
|
1417
|
-
],
|
|
1418
|
-
|
|
1484
|
+
], v.prototype, "emailSaved", 1);
|
|
1485
|
+
w([
|
|
1419
1486
|
m()
|
|
1420
|
-
],
|
|
1421
|
-
|
|
1487
|
+
], v.prototype, "newPass", 1);
|
|
1488
|
+
w([
|
|
1422
1489
|
m()
|
|
1423
|
-
],
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
],
|
|
1427
|
-
var
|
|
1428
|
-
for (var i = s > 1 ? void 0 : s ?
|
|
1429
|
-
(c =
|
|
1430
|
-
return s && i &&
|
|
1431
|
-
},
|
|
1432
|
-
let
|
|
1490
|
+
], v.prototype, "confirmPass", 1);
|
|
1491
|
+
v = w([
|
|
1492
|
+
Te("singlebase-authui-account")
|
|
1493
|
+
], v);
|
|
1494
|
+
var Ks = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, _ = (a, t, e, s) => {
|
|
1495
|
+
for (var i = s > 1 ? void 0 : s ? Vs(t, e) : t, h = a.length - 1, c; h >= 0; h--)
|
|
1496
|
+
(c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
|
|
1497
|
+
return s && i && Ks(t, e, i), i;
|
|
1498
|
+
}, wt, $t, yt, Et, St, Ct, Pt, Je;
|
|
1499
|
+
let S = (Je = class extends Oe {
|
|
1433
1500
|
constructor() {
|
|
1434
1501
|
super(...arguments);
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
b(this, "settingsCtl", new
|
|
1502
|
+
o(this, wt, "signout");
|
|
1503
|
+
o(this, $t, "signin");
|
|
1504
|
+
o(this, yt, "");
|
|
1505
|
+
o(this, Et, "");
|
|
1506
|
+
o(this, St, !1);
|
|
1507
|
+
o(this, Ct, null);
|
|
1508
|
+
o(this, Pt, "singlebase-oauth-nonce");
|
|
1509
|
+
b(this, "settingsCtl", new De(this));
|
|
1443
1510
|
}
|
|
1444
1511
|
get type() {
|
|
1445
|
-
return
|
|
1512
|
+
return n(this, wt);
|
|
1446
1513
|
}
|
|
1447
1514
|
set type(t) {
|
|
1448
|
-
|
|
1515
|
+
l(this, wt, t);
|
|
1449
1516
|
}
|
|
1450
1517
|
get intent() {
|
|
1451
|
-
return
|
|
1518
|
+
return n(this, $t);
|
|
1452
1519
|
}
|
|
1453
1520
|
set intent(t) {
|
|
1454
|
-
|
|
1521
|
+
l(this, $t, t);
|
|
1455
1522
|
}
|
|
1456
1523
|
get provider() {
|
|
1457
|
-
return
|
|
1524
|
+
return n(this, yt);
|
|
1458
1525
|
}
|
|
1459
1526
|
set provider(t) {
|
|
1460
|
-
|
|
1527
|
+
l(this, yt, t);
|
|
1461
1528
|
}
|
|
1462
1529
|
get providerName() {
|
|
1463
|
-
return
|
|
1530
|
+
return n(this, Et);
|
|
1464
1531
|
}
|
|
1465
1532
|
set providerName(t) {
|
|
1466
|
-
|
|
1533
|
+
l(this, Et, t);
|
|
1467
1534
|
}
|
|
1468
1535
|
get embedded() {
|
|
1469
|
-
return
|
|
1536
|
+
return n(this, St);
|
|
1470
1537
|
}
|
|
1471
1538
|
set embedded(t) {
|
|
1472
|
-
|
|
1539
|
+
l(this, St, t);
|
|
1473
1540
|
}
|
|
1474
1541
|
get settings() {
|
|
1475
|
-
return
|
|
1542
|
+
return n(this, Ct);
|
|
1476
1543
|
}
|
|
1477
1544
|
set settings(t) {
|
|
1478
|
-
|
|
1545
|
+
l(this, Ct, t);
|
|
1479
1546
|
}
|
|
1480
1547
|
get nonceStorageKey() {
|
|
1481
|
-
return
|
|
1548
|
+
return n(this, Pt);
|
|
1482
1549
|
}
|
|
1483
1550
|
set nonceStorageKey(t) {
|
|
1484
|
-
|
|
1551
|
+
l(this, Pt, t);
|
|
1485
1552
|
}
|
|
1486
1553
|
willUpdate(t) {
|
|
1487
|
-
super.willUpdate(t), this.type
|
|
1554
|
+
super.willUpdate(t), this.type !== "signout" && this.settingsCtl.load(this.resolvedClient, this.settings);
|
|
1488
1555
|
}
|
|
1489
1556
|
get effectiveSettings() {
|
|
1490
1557
|
return this.settings ?? this.settingsCtl.settings;
|
|
1491
1558
|
}
|
|
1492
1559
|
// ── oauth ────────────────────────────────────────────────
|
|
1493
1560
|
get providers() {
|
|
1494
|
-
|
|
1495
|
-
if (!t || !t.oauth_settings.enabled) return [];
|
|
1496
|
-
if (!(this.intent === "signup" ? t.oauth_settings.allow_signup : t.oauth_settings.allow_signin) && this.intent !== "link") return [];
|
|
1497
|
-
const s = {
|
|
1498
|
-
google: "G",
|
|
1499
|
-
github: "GH",
|
|
1500
|
-
linkedin: "in",
|
|
1501
|
-
facebook: "f"
|
|
1502
|
-
};
|
|
1503
|
-
return Object.entries(t.oauth_providers).filter(([, i]) => i.enabled).map(([i, h]) => ({
|
|
1504
|
-
id: i,
|
|
1505
|
-
name: h.provider_name,
|
|
1506
|
-
mark: s[i] ?? h.provider_name.slice(0, 2)
|
|
1507
|
-
}));
|
|
1561
|
+
return R(this.effectiveSettings, this.intent);
|
|
1508
1562
|
}
|
|
1509
1563
|
/** Shared by the oauth and link flows: nonce, start, redirect. */
|
|
1510
1564
|
async startOAuth(t, e, s = !1) {
|
|
@@ -1512,36 +1566,38 @@ let E = (je = class extends Ee {
|
|
|
1512
1566
|
if (!i) return;
|
|
1513
1567
|
let h, c;
|
|
1514
1568
|
if (s) {
|
|
1515
|
-
const
|
|
1516
|
-
if (
|
|
1569
|
+
const f = this.auth.state;
|
|
1570
|
+
if (f.status !== "authenticated") {
|
|
1517
1571
|
this.formError = this.msg.linkRequiresSignIn, this.phase = "error";
|
|
1518
1572
|
return;
|
|
1519
1573
|
}
|
|
1520
|
-
h =
|
|
1574
|
+
h = f.session.id_token, c = f.session.refresh_token;
|
|
1521
1575
|
}
|
|
1522
1576
|
await this.run(async () => {
|
|
1523
|
-
var
|
|
1524
|
-
const
|
|
1525
|
-
(
|
|
1526
|
-
const
|
|
1577
|
+
var C, k, T;
|
|
1578
|
+
const f = await i.createOAuthNonce(this.signal);
|
|
1579
|
+
(C = globalThis.sessionStorage) == null || C.setItem(this.nonceStorageKey, f);
|
|
1580
|
+
const $ = Ae(this.nonceStorageKey);
|
|
1581
|
+
s ? (k = globalThis.sessionStorage) == null || k.setItem($, t) : (T = globalThis.sessionStorage) == null || T.removeItem($);
|
|
1582
|
+
const { oauth_redirect_url: E } = await i.startOAuth(
|
|
1527
1583
|
{
|
|
1528
1584
|
provider: t,
|
|
1529
|
-
nonce:
|
|
1530
|
-
intent: e,
|
|
1585
|
+
nonce: f,
|
|
1586
|
+
intent: Is(this.effectiveSettings, e),
|
|
1531
1587
|
...s ? { id_token: h, refresh_token: c } : {}
|
|
1532
1588
|
},
|
|
1533
1589
|
this.signal
|
|
1534
1590
|
);
|
|
1535
|
-
globalThis.location.assign(
|
|
1591
|
+
globalThis.location.assign(E);
|
|
1536
1592
|
});
|
|
1537
1593
|
}
|
|
1538
1594
|
renderOAuth() {
|
|
1539
1595
|
const t = this.providers;
|
|
1540
1596
|
if (t.length === 0) return d;
|
|
1541
1597
|
const [e, ...s] = t;
|
|
1542
|
-
return
|
|
1598
|
+
return r`
|
|
1543
1599
|
<div class="stack">
|
|
1544
|
-
${this.formError ?
|
|
1600
|
+
${this.formError ? r`<div class="banner" part="banner" role="alert">${this.formError}</div>` : d}
|
|
1545
1601
|
|
|
1546
1602
|
<button
|
|
1547
1603
|
type="button"
|
|
@@ -1554,10 +1610,10 @@ let E = (je = class extends Ee {
|
|
|
1554
1610
|
<span>${this.msg.oauthContinueWith} ${e.name}</span>
|
|
1555
1611
|
</button>
|
|
1556
1612
|
|
|
1557
|
-
${s.length ?
|
|
1613
|
+
${s.length ? r`
|
|
1558
1614
|
<div class="icon-row">
|
|
1559
1615
|
${s.map(
|
|
1560
|
-
(i) =>
|
|
1616
|
+
(i) => r`
|
|
1561
1617
|
<button
|
|
1562
1618
|
type="button"
|
|
1563
1619
|
class="icon-btn"
|
|
@@ -1578,7 +1634,10 @@ let E = (je = class extends Ee {
|
|
|
1578
1634
|
}
|
|
1579
1635
|
// ── link ─────────────────────────────────────────────────
|
|
1580
1636
|
renderLink() {
|
|
1581
|
-
|
|
1637
|
+
const t = this.effectiveSettings, e = R(t, "link").find((i) => i.id === this.provider);
|
|
1638
|
+
if (t && !e) return d;
|
|
1639
|
+
const s = this.providerName || (e == null ? void 0 : e.name) || this.provider;
|
|
1640
|
+
return r`
|
|
1582
1641
|
<div class="stack">
|
|
1583
1642
|
${this.renderStatus()}
|
|
1584
1643
|
<button
|
|
@@ -1588,8 +1647,8 @@ let E = (je = class extends Ee {
|
|
|
1588
1647
|
?disabled=${this.submitting}
|
|
1589
1648
|
@click=${() => this.startOAuth(this.provider, "link", !0)}
|
|
1590
1649
|
>
|
|
1591
|
-
${this.submitting ?
|
|
1592
|
-
<span>${this.msg.oauthContinueWith} ${
|
|
1650
|
+
${this.submitting ? r`<span class="spinner"></span>` : d}
|
|
1651
|
+
<span>${this.msg.oauthContinueWith} ${s}</span>
|
|
1593
1652
|
</button>
|
|
1594
1653
|
</div>
|
|
1595
1654
|
`;
|
|
@@ -1602,7 +1661,7 @@ let E = (je = class extends Ee {
|
|
|
1602
1661
|
});
|
|
1603
1662
|
}
|
|
1604
1663
|
renderSignOut() {
|
|
1605
|
-
return this.embedded ?
|
|
1664
|
+
return this.embedded ? r`<button
|
|
1606
1665
|
type="button"
|
|
1607
1666
|
class="link-sm"
|
|
1608
1667
|
part="button-signout"
|
|
@@ -1610,9 +1669,9 @@ let E = (je = class extends Ee {
|
|
|
1610
1669
|
@click=${this.onSignOut}
|
|
1611
1670
|
>
|
|
1612
1671
|
${this.msg.signOutCta}
|
|
1613
|
-
</button>` :
|
|
1672
|
+
</button>` : r`
|
|
1614
1673
|
<div class="stack">
|
|
1615
|
-
${this.formError ?
|
|
1674
|
+
${this.formError ? r`<p class="banner" role="alert">${this.formError}</p>` : d}
|
|
1616
1675
|
<button
|
|
1617
1676
|
type="button"
|
|
1618
1677
|
class="link-sm"
|
|
@@ -1628,37 +1687,37 @@ let E = (je = class extends Ee {
|
|
|
1628
1687
|
render() {
|
|
1629
1688
|
return this.type === "oauth" ? this.renderOAuth() : this.type === "link" ? this.renderLink() : this.renderSignOut();
|
|
1630
1689
|
}
|
|
1631
|
-
},
|
|
1632
|
-
|
|
1690
|
+
}, wt = new WeakMap(), $t = new WeakMap(), yt = new WeakMap(), Et = new WeakMap(), St = new WeakMap(), Ct = new WeakMap(), Pt = new WeakMap(), Je);
|
|
1691
|
+
_([
|
|
1633
1692
|
p()
|
|
1634
|
-
],
|
|
1635
|
-
|
|
1693
|
+
], S.prototype, "type", 1);
|
|
1694
|
+
_([
|
|
1636
1695
|
p()
|
|
1637
|
-
],
|
|
1638
|
-
|
|
1696
|
+
], S.prototype, "intent", 1);
|
|
1697
|
+
_([
|
|
1639
1698
|
p()
|
|
1640
|
-
],
|
|
1641
|
-
|
|
1699
|
+
], S.prototype, "provider", 1);
|
|
1700
|
+
_([
|
|
1642
1701
|
p({ attribute: "provider-name" })
|
|
1643
|
-
],
|
|
1644
|
-
|
|
1702
|
+
], S.prototype, "providerName", 1);
|
|
1703
|
+
_([
|
|
1645
1704
|
p({ type: Boolean })
|
|
1646
|
-
],
|
|
1647
|
-
|
|
1705
|
+
], S.prototype, "embedded", 1);
|
|
1706
|
+
_([
|
|
1648
1707
|
p({ attribute: !1 })
|
|
1649
|
-
],
|
|
1650
|
-
|
|
1708
|
+
], S.prototype, "settings", 1);
|
|
1709
|
+
_([
|
|
1651
1710
|
p({ attribute: "nonce-storage-key" })
|
|
1652
|
-
],
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
],
|
|
1656
|
-
var
|
|
1657
|
-
for (var i = s > 1 ? void 0 : s ?
|
|
1658
|
-
(c =
|
|
1659
|
-
return s && i &&
|
|
1660
|
-
},
|
|
1661
|
-
const
|
|
1711
|
+
], S.prototype, "nonceStorageKey", 1);
|
|
1712
|
+
S = _([
|
|
1713
|
+
Te("singlebase-authui-buttons")
|
|
1714
|
+
], S);
|
|
1715
|
+
var os = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, Ws = (a, t, e) => t in a ? os(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, g = (a, t, e, s) => {
|
|
1716
|
+
for (var i = s > 1 ? void 0 : s ? Gs(t, e) : t, h = a.length - 1, c; h >= 0; h--)
|
|
1717
|
+
(c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
|
|
1718
|
+
return s && i && os(t, e, i), i;
|
|
1719
|
+
}, Ys = (a, t, e) => Ws(a, t + "", e);
|
|
1720
|
+
const Ie = "oauth_denied", Re = "oauth_error", zs = /^[A-Z][A-Z0-9_]{0,63}$/, ls = [
|
|
1662
1721
|
"signin",
|
|
1663
1722
|
"signup",
|
|
1664
1723
|
"forgot",
|
|
@@ -1666,82 +1725,81 @@ const ze = [
|
|
|
1666
1725
|
"otp",
|
|
1667
1726
|
"newpass",
|
|
1668
1727
|
"invite"
|
|
1669
|
-
],
|
|
1670
|
-
function
|
|
1671
|
-
return
|
|
1728
|
+
], hs = ["account"], Js = [...ls, ...hs, "oauth-callback"];
|
|
1729
|
+
function We(a) {
|
|
1730
|
+
return ls.includes(a);
|
|
1672
1731
|
}
|
|
1673
|
-
function
|
|
1674
|
-
return
|
|
1732
|
+
function Zs(a) {
|
|
1733
|
+
return hs.includes(a);
|
|
1675
1734
|
}
|
|
1676
|
-
function
|
|
1677
|
-
return
|
|
1735
|
+
function Ye(a) {
|
|
1736
|
+
return Js.includes(a);
|
|
1678
1737
|
}
|
|
1679
|
-
const
|
|
1738
|
+
const N = {
|
|
1680
1739
|
// An absent attribute must mean "default" (true), not false. Lit calls
|
|
1681
1740
|
// fromAttribute(null) when an attribute is *removed*, so returning false
|
|
1682
1741
|
// there would make removing `allow-oauth="false"` leave the flag off
|
|
1683
1742
|
// forever instead of restoring the default.
|
|
1684
|
-
fromAttribute: (
|
|
1685
|
-
toAttribute: (
|
|
1743
|
+
fromAttribute: (a) => a === null ? !0 : a !== "false",
|
|
1744
|
+
toAttribute: (a) => a ? null : "false"
|
|
1686
1745
|
};
|
|
1687
|
-
var
|
|
1688
|
-
let u = (
|
|
1746
|
+
var _t, kt, Tt, Ot, Nt, At, Lt, xt, Ut, Mt, It, Rt, Ft, Dt, Bt, Ht, qt, jt, Kt, Vt, Gt, Wt, Yt, zt, Jt, Zt, Qt, Xt, te, ee, se, ie, ae, re, ne, oe, le, he, de, ce, ue, pe, ge, me, be, fe, ve, we, Ze;
|
|
1747
|
+
let u = (Ze = class extends y {
|
|
1689
1748
|
constructor() {
|
|
1690
1749
|
super(...arguments);
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
n(this, ce, !1);
|
|
1739
|
-
b(this, "settingsCtl", new ke(this));
|
|
1740
|
-
b(this, "bridge", new Ps(this));
|
|
1750
|
+
o(this, _t, "signin");
|
|
1751
|
+
o(this, kt, "");
|
|
1752
|
+
o(this, Tt, !1);
|
|
1753
|
+
o(this, Ot, null);
|
|
1754
|
+
o(this, Nt, !0);
|
|
1755
|
+
o(this, At, !0);
|
|
1756
|
+
o(this, Lt, !0);
|
|
1757
|
+
o(this, xt, !0);
|
|
1758
|
+
o(this, Ut, !0);
|
|
1759
|
+
o(this, Mt, !0);
|
|
1760
|
+
o(this, It, "card");
|
|
1761
|
+
o(this, Rt, "bottom");
|
|
1762
|
+
o(this, Ft, !1);
|
|
1763
|
+
o(this, Dt, "");
|
|
1764
|
+
o(this, Bt, "");
|
|
1765
|
+
o(this, Ht, "");
|
|
1766
|
+
o(this, qt, "");
|
|
1767
|
+
o(this, jt, "");
|
|
1768
|
+
o(this, Kt, !0);
|
|
1769
|
+
o(this, Vt, "");
|
|
1770
|
+
o(this, Gt, "");
|
|
1771
|
+
o(this, Wt, "");
|
|
1772
|
+
o(this, Yt, "singlebase-oauth-nonce");
|
|
1773
|
+
o(this, zt, "");
|
|
1774
|
+
o(this, Jt, "");
|
|
1775
|
+
o(this, Zt, "");
|
|
1776
|
+
o(this, Qt, 0);
|
|
1777
|
+
o(this, Xt, "");
|
|
1778
|
+
o(this, te, "");
|
|
1779
|
+
o(this, ee, "");
|
|
1780
|
+
o(this, se, "");
|
|
1781
|
+
o(this, ie, "");
|
|
1782
|
+
o(this, ae, "");
|
|
1783
|
+
o(this, re, "");
|
|
1784
|
+
o(this, ne, "");
|
|
1785
|
+
o(this, oe, "");
|
|
1786
|
+
o(this, le, ["", "", "", "", "", ""]);
|
|
1787
|
+
o(this, he, "signin_code");
|
|
1788
|
+
o(this, de, !1);
|
|
1789
|
+
o(this, ce, "");
|
|
1790
|
+
o(this, ue, "");
|
|
1791
|
+
o(this, pe, "");
|
|
1792
|
+
o(this, ge, "");
|
|
1793
|
+
o(this, me, "");
|
|
1794
|
+
o(this, be, !1);
|
|
1795
|
+
b(this, "settingsCtl", new De(this));
|
|
1796
|
+
b(this, "bridge", new Us(this));
|
|
1741
1797
|
b(this, "uidBase", `sb-${Math.random().toString(36).slice(2, 8)}`);
|
|
1742
1798
|
b(this, "gotoUnsubscribe");
|
|
1743
1799
|
b(this, "gotoClient", null);
|
|
1744
|
-
|
|
1800
|
+
o(this, fe, !1);
|
|
1801
|
+
o(this, ve, "");
|
|
1802
|
+
o(this, we, "");
|
|
1745
1803
|
b(this, "abortController", null);
|
|
1746
1804
|
b(this, "onContinue", () => {
|
|
1747
1805
|
this.followRedirect() || (this.dispatchEvent(
|
|
@@ -1758,292 +1816,274 @@ let u = (He = class extends $ {
|
|
|
1758
1816
|
});
|
|
1759
1817
|
}
|
|
1760
1818
|
get initialScreen() {
|
|
1761
|
-
return
|
|
1819
|
+
return n(this, _t);
|
|
1762
1820
|
}
|
|
1763
1821
|
set initialScreen(t) {
|
|
1764
|
-
|
|
1822
|
+
l(this, _t, t);
|
|
1765
1823
|
}
|
|
1766
1824
|
get screen() {
|
|
1767
|
-
return
|
|
1825
|
+
return n(this, kt);
|
|
1768
1826
|
}
|
|
1769
1827
|
set screen(t) {
|
|
1770
|
-
|
|
1828
|
+
l(this, kt, t);
|
|
1771
1829
|
}
|
|
1772
1830
|
get noAccountView() {
|
|
1773
|
-
return
|
|
1831
|
+
return n(this, Tt);
|
|
1774
1832
|
}
|
|
1775
1833
|
set noAccountView(t) {
|
|
1776
|
-
|
|
1834
|
+
l(this, Tt, t);
|
|
1777
1835
|
}
|
|
1778
1836
|
get settings() {
|
|
1779
|
-
return
|
|
1837
|
+
return n(this, Ot);
|
|
1780
1838
|
}
|
|
1781
1839
|
set settings(t) {
|
|
1782
|
-
|
|
1840
|
+
l(this, Ot, t);
|
|
1783
1841
|
}
|
|
1784
1842
|
get authEnabled() {
|
|
1785
|
-
return
|
|
1843
|
+
return n(this, Nt);
|
|
1786
1844
|
}
|
|
1787
1845
|
set authEnabled(t) {
|
|
1788
|
-
|
|
1846
|
+
l(this, Nt, t);
|
|
1789
1847
|
}
|
|
1790
1848
|
get allowEmailSignin() {
|
|
1791
|
-
return
|
|
1849
|
+
return n(this, At);
|
|
1792
1850
|
}
|
|
1793
1851
|
set allowEmailSignin(t) {
|
|
1794
|
-
|
|
1852
|
+
l(this, At, t);
|
|
1795
1853
|
}
|
|
1796
1854
|
get allowEmailSignup() {
|
|
1797
|
-
return
|
|
1855
|
+
return n(this, Lt);
|
|
1798
1856
|
}
|
|
1799
1857
|
set allowEmailSignup(t) {
|
|
1800
|
-
|
|
1858
|
+
l(this, Lt, t);
|
|
1801
1859
|
}
|
|
1802
1860
|
get allowEmailOtp() {
|
|
1803
|
-
return
|
|
1861
|
+
return n(this, xt);
|
|
1804
1862
|
}
|
|
1805
1863
|
set allowEmailOtp(t) {
|
|
1806
|
-
|
|
1864
|
+
l(this, xt, t);
|
|
1807
1865
|
}
|
|
1808
1866
|
get allowOauth() {
|
|
1809
|
-
return
|
|
1867
|
+
return n(this, Ut);
|
|
1810
1868
|
}
|
|
1811
1869
|
set allowOauth(t) {
|
|
1812
|
-
|
|
1870
|
+
l(this, Ut, t);
|
|
1813
1871
|
}
|
|
1814
1872
|
get allowAccountCreation() {
|
|
1815
|
-
return
|
|
1873
|
+
return n(this, Mt);
|
|
1816
1874
|
}
|
|
1817
1875
|
set allowAccountCreation(t) {
|
|
1818
|
-
|
|
1876
|
+
l(this, Mt, t);
|
|
1819
1877
|
}
|
|
1820
1878
|
get layout() {
|
|
1821
|
-
return
|
|
1879
|
+
return n(this, It);
|
|
1822
1880
|
}
|
|
1823
1881
|
set layout(t) {
|
|
1824
|
-
|
|
1882
|
+
l(this, It, t);
|
|
1825
1883
|
}
|
|
1826
1884
|
get oauthPlacement() {
|
|
1827
|
-
return
|
|
1885
|
+
return n(this, Rt);
|
|
1828
1886
|
}
|
|
1829
1887
|
set oauthPlacement(t) {
|
|
1830
|
-
|
|
1888
|
+
l(this, Rt, t);
|
|
1831
1889
|
}
|
|
1832
1890
|
get stepped() {
|
|
1833
|
-
return
|
|
1891
|
+
return n(this, Ft);
|
|
1834
1892
|
}
|
|
1835
1893
|
set stepped(t) {
|
|
1836
|
-
|
|
1894
|
+
l(this, Ft, t);
|
|
1837
1895
|
}
|
|
1838
1896
|
get logoText() {
|
|
1839
|
-
return
|
|
1897
|
+
return n(this, Dt);
|
|
1840
1898
|
}
|
|
1841
1899
|
set logoText(t) {
|
|
1842
|
-
|
|
1900
|
+
l(this, Dt, t);
|
|
1843
1901
|
}
|
|
1844
1902
|
get logoUrl() {
|
|
1845
|
-
return
|
|
1903
|
+
return n(this, Bt);
|
|
1846
1904
|
}
|
|
1847
1905
|
set logoUrl(t) {
|
|
1848
|
-
|
|
1906
|
+
l(this, Bt, t);
|
|
1849
1907
|
}
|
|
1850
1908
|
get brandLine() {
|
|
1851
|
-
return
|
|
1909
|
+
return n(this, Ht);
|
|
1852
1910
|
}
|
|
1853
1911
|
set brandLine(t) {
|
|
1854
|
-
|
|
1912
|
+
l(this, Ht, t);
|
|
1855
1913
|
}
|
|
1856
1914
|
get brandFoot() {
|
|
1857
|
-
return
|
|
1915
|
+
return n(this, qt);
|
|
1858
1916
|
}
|
|
1859
1917
|
set brandFoot(t) {
|
|
1860
|
-
|
|
1918
|
+
l(this, qt, t);
|
|
1861
1919
|
}
|
|
1862
1920
|
get signInTitle() {
|
|
1863
|
-
return
|
|
1921
|
+
return n(this, jt);
|
|
1864
1922
|
}
|
|
1865
1923
|
set signInTitle(t) {
|
|
1866
|
-
|
|
1924
|
+
l(this, jt, t);
|
|
1867
1925
|
}
|
|
1868
1926
|
get branding() {
|
|
1869
|
-
return
|
|
1927
|
+
return n(this, Kt);
|
|
1870
1928
|
}
|
|
1871
1929
|
set branding(t) {
|
|
1872
|
-
|
|
1873
|
-
}
|
|
1874
|
-
get brandingText() {
|
|
1875
|
-
return r(this, Ft);
|
|
1876
|
-
}
|
|
1877
|
-
set brandingText(t) {
|
|
1878
|
-
o(this, Ft, t);
|
|
1879
|
-
}
|
|
1880
|
-
get brandingUrl() {
|
|
1881
|
-
return r(this, Dt);
|
|
1882
|
-
}
|
|
1883
|
-
set brandingUrl(t) {
|
|
1884
|
-
o(this, Dt, t);
|
|
1930
|
+
l(this, Kt, t);
|
|
1885
1931
|
}
|
|
1886
1932
|
get redirectUrl() {
|
|
1887
|
-
return
|
|
1933
|
+
return n(this, Vt);
|
|
1888
1934
|
}
|
|
1889
1935
|
set redirectUrl(t) {
|
|
1890
|
-
|
|
1936
|
+
l(this, Vt, t);
|
|
1891
1937
|
}
|
|
1892
1938
|
get tosUrl() {
|
|
1893
|
-
return
|
|
1939
|
+
return n(this, Gt);
|
|
1894
1940
|
}
|
|
1895
1941
|
set tosUrl(t) {
|
|
1896
|
-
|
|
1942
|
+
l(this, Gt, t);
|
|
1897
1943
|
}
|
|
1898
1944
|
get privacyUrl() {
|
|
1899
|
-
return
|
|
1945
|
+
return n(this, Wt);
|
|
1900
1946
|
}
|
|
1901
1947
|
set privacyUrl(t) {
|
|
1902
|
-
|
|
1948
|
+
l(this, Wt, t);
|
|
1903
1949
|
}
|
|
1904
1950
|
get nonceStorageKey() {
|
|
1905
|
-
return
|
|
1951
|
+
return n(this, Yt);
|
|
1906
1952
|
}
|
|
1907
1953
|
set nonceStorageKey(t) {
|
|
1908
|
-
|
|
1954
|
+
l(this, Yt, t);
|
|
1909
1955
|
}
|
|
1910
1956
|
get inviteEmail() {
|
|
1911
|
-
return
|
|
1957
|
+
return n(this, zt);
|
|
1912
1958
|
}
|
|
1913
1959
|
set inviteEmail(t) {
|
|
1914
|
-
|
|
1960
|
+
l(this, zt, t);
|
|
1915
1961
|
}
|
|
1916
1962
|
get inviteOrg() {
|
|
1917
|
-
return
|
|
1963
|
+
return n(this, Jt);
|
|
1918
1964
|
}
|
|
1919
1965
|
set inviteOrg(t) {
|
|
1920
|
-
|
|
1966
|
+
l(this, Jt, t);
|
|
1921
1967
|
}
|
|
1922
1968
|
get inviteCode() {
|
|
1923
|
-
return
|
|
1969
|
+
return n(this, Zt);
|
|
1924
1970
|
}
|
|
1925
1971
|
set inviteCode(t) {
|
|
1926
|
-
|
|
1972
|
+
l(this, Zt, t);
|
|
1927
1973
|
}
|
|
1928
1974
|
get step() {
|
|
1929
|
-
return
|
|
1975
|
+
return n(this, Qt);
|
|
1930
1976
|
}
|
|
1931
1977
|
set step(t) {
|
|
1932
|
-
|
|
1978
|
+
l(this, Qt, t);
|
|
1933
1979
|
}
|
|
1934
1980
|
get method() {
|
|
1935
|
-
return
|
|
1981
|
+
return n(this, Xt);
|
|
1936
1982
|
}
|
|
1937
1983
|
set method(t) {
|
|
1938
|
-
|
|
1984
|
+
l(this, Xt, t);
|
|
1939
1985
|
}
|
|
1940
1986
|
get email() {
|
|
1941
|
-
return
|
|
1987
|
+
return n(this, te);
|
|
1942
1988
|
}
|
|
1943
1989
|
set email(t) {
|
|
1944
|
-
|
|
1990
|
+
l(this, te, t);
|
|
1945
1991
|
}
|
|
1946
1992
|
get password() {
|
|
1947
|
-
return
|
|
1993
|
+
return n(this, ee);
|
|
1948
1994
|
}
|
|
1949
1995
|
set password(t) {
|
|
1950
|
-
|
|
1996
|
+
l(this, ee, t);
|
|
1951
1997
|
}
|
|
1952
1998
|
get name() {
|
|
1953
|
-
return
|
|
1999
|
+
return n(this, se);
|
|
1954
2000
|
}
|
|
1955
2001
|
set name(t) {
|
|
1956
|
-
|
|
2002
|
+
l(this, se, t);
|
|
1957
2003
|
}
|
|
1958
2004
|
get firstName() {
|
|
1959
|
-
return
|
|
2005
|
+
return n(this, ie);
|
|
1960
2006
|
}
|
|
1961
2007
|
set firstName(t) {
|
|
1962
|
-
|
|
2008
|
+
l(this, ie, t);
|
|
1963
2009
|
}
|
|
1964
2010
|
get lastName() {
|
|
1965
|
-
return
|
|
2011
|
+
return n(this, ae);
|
|
1966
2012
|
}
|
|
1967
2013
|
set lastName(t) {
|
|
1968
|
-
|
|
2014
|
+
l(this, ae, t);
|
|
1969
2015
|
}
|
|
1970
2016
|
get phone() {
|
|
1971
|
-
return
|
|
2017
|
+
return n(this, re);
|
|
1972
2018
|
}
|
|
1973
2019
|
set phone(t) {
|
|
1974
|
-
|
|
2020
|
+
l(this, re, t);
|
|
1975
2021
|
}
|
|
1976
2022
|
get newPass() {
|
|
1977
|
-
return
|
|
2023
|
+
return n(this, ne);
|
|
1978
2024
|
}
|
|
1979
2025
|
set newPass(t) {
|
|
1980
|
-
|
|
2026
|
+
l(this, ne, t);
|
|
1981
2027
|
}
|
|
1982
2028
|
get confirmPass() {
|
|
1983
|
-
return
|
|
2029
|
+
return n(this, oe);
|
|
1984
2030
|
}
|
|
1985
2031
|
set confirmPass(t) {
|
|
1986
|
-
|
|
2032
|
+
l(this, oe, t);
|
|
1987
2033
|
}
|
|
1988
2034
|
get code() {
|
|
1989
|
-
return
|
|
2035
|
+
return n(this, le);
|
|
1990
2036
|
}
|
|
1991
2037
|
set code(t) {
|
|
1992
|
-
|
|
2038
|
+
l(this, le, t);
|
|
1993
2039
|
}
|
|
1994
2040
|
get verifyNext() {
|
|
1995
|
-
return
|
|
2041
|
+
return n(this, he);
|
|
1996
2042
|
}
|
|
1997
2043
|
set verifyNext(t) {
|
|
1998
|
-
|
|
2044
|
+
l(this, he, t);
|
|
1999
2045
|
}
|
|
2000
2046
|
get loading() {
|
|
2001
|
-
return
|
|
2047
|
+
return n(this, de);
|
|
2002
2048
|
}
|
|
2003
2049
|
set loading(t) {
|
|
2004
|
-
|
|
2050
|
+
l(this, de, t);
|
|
2005
2051
|
}
|
|
2006
2052
|
get banner() {
|
|
2007
|
-
return
|
|
2053
|
+
return n(this, ce);
|
|
2008
2054
|
}
|
|
2009
2055
|
set banner(t) {
|
|
2010
|
-
|
|
2056
|
+
l(this, ce, t);
|
|
2011
2057
|
}
|
|
2012
2058
|
get notice() {
|
|
2013
|
-
return
|
|
2059
|
+
return n(this, ue);
|
|
2014
2060
|
}
|
|
2015
2061
|
set notice(t) {
|
|
2016
|
-
|
|
2062
|
+
l(this, ue, t);
|
|
2017
2063
|
}
|
|
2018
2064
|
get emailError() {
|
|
2019
|
-
return
|
|
2065
|
+
return n(this, pe);
|
|
2020
2066
|
}
|
|
2021
2067
|
set emailError(t) {
|
|
2022
|
-
|
|
2068
|
+
l(this, pe, t);
|
|
2023
2069
|
}
|
|
2024
2070
|
get passError() {
|
|
2025
|
-
return
|
|
2071
|
+
return n(this, ge);
|
|
2026
2072
|
}
|
|
2027
2073
|
set passError(t) {
|
|
2028
|
-
|
|
2074
|
+
l(this, ge, t);
|
|
2029
2075
|
}
|
|
2030
2076
|
get newPassError() {
|
|
2031
|
-
return
|
|
2077
|
+
return n(this, me);
|
|
2032
2078
|
}
|
|
2033
2079
|
set newPassError(t) {
|
|
2034
|
-
|
|
2035
|
-
}
|
|
2036
|
-
get attempts() {
|
|
2037
|
-
return r(this, de);
|
|
2038
|
-
}
|
|
2039
|
-
set attempts(t) {
|
|
2040
|
-
o(this, de, t);
|
|
2080
|
+
l(this, me, t);
|
|
2041
2081
|
}
|
|
2042
2082
|
get needsMfaCode() {
|
|
2043
|
-
return
|
|
2083
|
+
return n(this, be);
|
|
2044
2084
|
}
|
|
2045
2085
|
set needsMfaCode(t) {
|
|
2046
|
-
|
|
2086
|
+
l(this, be, t);
|
|
2047
2087
|
}
|
|
2048
2088
|
uid(t) {
|
|
2049
2089
|
return `${this.uidBase}-${t}`;
|
|
@@ -2065,7 +2105,7 @@ let u = (He = class extends $ {
|
|
|
2065
2105
|
var i;
|
|
2066
2106
|
if (t === this.gotoClient || ((i = this.gotoUnsubscribe) == null || i.call(this), this.gotoUnsubscribe = void 0, this.gotoClient = t, !t)) return;
|
|
2067
2107
|
const e = t.on("goto", ({ screen: h }) => {
|
|
2068
|
-
|
|
2108
|
+
Ye(h) && this.goto(h);
|
|
2069
2109
|
}), s = t.on("signin", () => {
|
|
2070
2110
|
this.followRedirect();
|
|
2071
2111
|
});
|
|
@@ -2093,6 +2133,7 @@ let u = (He = class extends $ {
|
|
|
2093
2133
|
allowEmailSignup: this.allowEmailSignup && this.allowAccountCreation,
|
|
2094
2134
|
allowEmailOtp: this.allowEmailOtp,
|
|
2095
2135
|
allowOauth: this.allowOauth,
|
|
2136
|
+
allowRecovery: this.allowEmailSignin,
|
|
2096
2137
|
mfa: !1
|
|
2097
2138
|
};
|
|
2098
2139
|
const e = t.auth_settings, s = e.second_factor === "email_otp";
|
|
@@ -2101,14 +2142,16 @@ let u = (He = class extends $ {
|
|
|
2101
2142
|
allowEmailSignin: e.allow_signin && this.allowEmailSignin,
|
|
2102
2143
|
allowEmailSignup: e.allow_signup && this.allowEmailSignup && this.allowAccountCreation,
|
|
2103
2144
|
allowEmailOtp: this.allowEmailOtp && e.allow_signin && !s,
|
|
2104
|
-
allowOauth: t
|
|
2145
|
+
allowOauth: es(t) && this.allowOauth,
|
|
2146
|
+
// Email recovery is offered only when the project verifies it by code.
|
|
2147
|
+
allowRecovery: e.allow_signin && this.allowEmailSignin && e.password_recovery_verification === "email_otp",
|
|
2105
2148
|
mfa: s
|
|
2106
2149
|
};
|
|
2107
2150
|
}
|
|
2108
2151
|
/** The screen the host asked for, before any guarding is applied. */
|
|
2109
2152
|
get requestedScreen() {
|
|
2110
2153
|
const t = this.screen || this.initialScreen || "signin";
|
|
2111
|
-
return
|
|
2154
|
+
return Ye(t) ? t : "signin";
|
|
2112
2155
|
}
|
|
2113
2156
|
/**
|
|
2114
2157
|
* Resolves the screen actually rendered.
|
|
@@ -2119,19 +2162,20 @@ let u = (He = class extends $ {
|
|
|
2119
2162
|
* fallbacks below additionally reflect what the project has enabled.
|
|
2120
2163
|
*/
|
|
2121
2164
|
get activeScreen() {
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2165
|
+
const t = this.auth.state.status === "authenticated";
|
|
2166
|
+
if (this.isOAuthCallback || this.callbackPhase === "working" || this.callbackPhase === "failed" && !t) return "oauth-callback";
|
|
2167
|
+
const e = this.requestedScreen;
|
|
2168
|
+
if (Zs(e))
|
|
2125
2169
|
return t ? e : "signin";
|
|
2126
2170
|
if (t)
|
|
2127
2171
|
return this.screen !== "" || this.initialScreen !== "signin" ? e : "account";
|
|
2128
2172
|
const s = this.cfg;
|
|
2129
2173
|
let i = e;
|
|
2130
|
-
return i === "signup" && !s.allowEmailSignup && (i = "signin"), (i === "forgot" || i === "newpass") && !s.
|
|
2174
|
+
return i === "signup" && !s.allowEmailSignup && (i = "signin"), (i === "forgot" || i === "newpass") && !s.allowRecovery && (i = "signin"), i === "otp" && !s.allowEmailOtp && (i = "signin"), i === "signin" && !s.allowEmailSignin && s.allowEmailOtp && (i = "otp"), i;
|
|
2131
2175
|
}
|
|
2132
2176
|
/** True when a signed-in user is sitting on a guest screen (spec: offer continue/sign out). */
|
|
2133
2177
|
get showsSignedInInterstitial() {
|
|
2134
|
-
return this.auth.state.status === "authenticated" &&
|
|
2178
|
+
return this.auth.state.status === "authenticated" && We(this.activeScreen);
|
|
2135
2179
|
}
|
|
2136
2180
|
// ── redirect ──────────────────────────────────────────────
|
|
2137
2181
|
/**
|
|
@@ -2144,7 +2188,7 @@ let u = (He = class extends $ {
|
|
|
2144
2188
|
*/
|
|
2145
2189
|
get redirectTarget() {
|
|
2146
2190
|
var t;
|
|
2147
|
-
return
|
|
2191
|
+
return ws(
|
|
2148
2192
|
this.redirectUrl || this.redirectParam,
|
|
2149
2193
|
(t = globalThis.location) == null ? void 0 : t.href,
|
|
2150
2194
|
(e) => console.warn(`[singlebase] ${e}`)
|
|
@@ -2161,16 +2205,32 @@ let u = (He = class extends $ {
|
|
|
2161
2205
|
const t = this.redirectTarget;
|
|
2162
2206
|
return t ? ((e = globalThis.location) == null || e.assign(t), !0) : !1;
|
|
2163
2207
|
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Only the OAuth return counts: `?access_code=`, `?error=oauth_denied` or
|
|
2210
|
+
* `?oauth_error=<CODE>`. Any other `?error=` belongs to the host page.
|
|
2211
|
+
*/
|
|
2164
2212
|
get isOAuthCallback() {
|
|
2165
2213
|
var e;
|
|
2166
2214
|
const t = new URLSearchParams(((e = globalThis.location) == null ? void 0 : e.search) ?? "");
|
|
2167
|
-
return t.has("access_code") || t.
|
|
2215
|
+
return t.has("access_code") || t.get("error") === Ie || t.has(Re);
|
|
2168
2216
|
}
|
|
2169
2217
|
get callbackDone() {
|
|
2170
|
-
return
|
|
2218
|
+
return n(this, fe);
|
|
2171
2219
|
}
|
|
2172
2220
|
set callbackDone(t) {
|
|
2173
|
-
|
|
2221
|
+
l(this, fe, t);
|
|
2222
|
+
}
|
|
2223
|
+
get callbackPhase() {
|
|
2224
|
+
return n(this, ve);
|
|
2225
|
+
}
|
|
2226
|
+
set callbackPhase(t) {
|
|
2227
|
+
l(this, ve, t);
|
|
2228
|
+
}
|
|
2229
|
+
get linkNotice() {
|
|
2230
|
+
return n(this, we);
|
|
2231
|
+
}
|
|
2232
|
+
set linkNotice(t) {
|
|
2233
|
+
l(this, we, t);
|
|
2174
2234
|
}
|
|
2175
2235
|
/** Strips the provider's parameters so a reload cannot replay the exchange. */
|
|
2176
2236
|
cleanCallbackUrl() {
|
|
@@ -2178,64 +2238,67 @@ let u = (He = class extends $ {
|
|
|
2178
2238
|
const t = (s = globalThis.location) == null ? void 0 : s.href;
|
|
2179
2239
|
if (!t || !globalThis.history) return;
|
|
2180
2240
|
const e = new URL(t);
|
|
2181
|
-
e.searchParams.delete("access_code"), e.searchParams.delete("error"), globalThis.history.replaceState({}, "", e.toString());
|
|
2241
|
+
e.searchParams.delete("access_code"), e.searchParams.delete(Re), e.searchParams.get("error") === Ie && e.searchParams.delete("error"), globalThis.history.replaceState({}, "", e.toString());
|
|
2182
2242
|
}
|
|
2183
2243
|
/**
|
|
2184
2244
|
* Completes the provider round trip. Runs once per landing: the URL is
|
|
2185
2245
|
* cleaned immediately so a refresh cannot resend a single-use access code.
|
|
2186
2246
|
*/
|
|
2187
2247
|
async handleOAuthCallback() {
|
|
2188
|
-
var
|
|
2248
|
+
var E, C, k, T, U, M;
|
|
2189
2249
|
if (this.callbackDone) return;
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
if (s) {
|
|
2193
|
-
this.cleanCallbackUrl(), this.banner = this.msg.oauthDenied;
|
|
2250
|
+
const t = new URLSearchParams(((E = globalThis.location) == null ? void 0 : E.search) ?? ""), e = t.get("access_code"), s = t.get("error") === Ie, i = t.get(Re), h = this.resolvedClient;
|
|
2251
|
+
if (e && !h) return;
|
|
2252
|
+
if (this.callbackDone = !0, s || i || !e || !h) {
|
|
2253
|
+
(C = globalThis.sessionStorage) == null || C.removeItem(this.nonceStorageKey), (k = globalThis.sessionStorage) == null || k.removeItem(Ae(this.nonceStorageKey)), this.cleanCallbackUrl(), this.banner = s ? this.msg.oauthDenied : this.describeOAuthError(i ?? ""), this.callbackPhase = "failed";
|
|
2194
2254
|
return;
|
|
2195
2255
|
}
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
this.banner = this.msg.genericErrorMessage;
|
|
2256
|
+
const c = (T = globalThis.sessionStorage) == null ? void 0 : T.getItem(this.nonceStorageKey), f = Ae(this.nonceStorageKey), $ = (U = globalThis.sessionStorage) == null ? void 0 : U.getItem(f);
|
|
2257
|
+
if ((M = globalThis.sessionStorage) == null || M.removeItem(f), this.cleanCallbackUrl(), !c) {
|
|
2258
|
+
this.banner = this.msg.genericErrorMessage, this.callbackPhase = "failed";
|
|
2200
2259
|
return;
|
|
2201
2260
|
}
|
|
2202
|
-
await this.withLoading(async () => {
|
|
2203
|
-
var
|
|
2204
|
-
await
|
|
2205
|
-
|
|
2261
|
+
this.callbackPhase = "working", await this.withLoading(async () => {
|
|
2262
|
+
var I, O;
|
|
2263
|
+
if (await h.completeOAuth({ access_code: e, nonce: c }, this.signal()), (I = globalThis.sessionStorage) == null || I.removeItem(this.nonceStorageKey), $) {
|
|
2264
|
+
const xe = this.settings ?? this.settingsCtl.settings, Ue = ((O = R(xe, "link").find((Me) => Me.id === $)) == null ? void 0 : O.name) ?? $;
|
|
2265
|
+
this.linkNotice = this.msg.providerConnectedNotice.replace("{name}", Ue);
|
|
2266
|
+
}
|
|
2267
|
+
}), this.callbackPhase = this.banner ? "failed" : "";
|
|
2206
2268
|
}
|
|
2207
2269
|
/** The small logo above a screen title: image when given one, else text. */
|
|
2208
2270
|
renderLogo() {
|
|
2209
|
-
return this.logoUrl ?
|
|
2271
|
+
return this.logoUrl ? r`<img class="logo-img" part="logo" src=${this.logoUrl} alt=${this.logoText} />` : this.logoText ? r`<div class="logo-dot" part="logo">${this.logoText}</div>` : d;
|
|
2210
2272
|
}
|
|
2211
2273
|
/** The larger logo in the split layout's brand panel. */
|
|
2212
2274
|
renderBrandMark() {
|
|
2213
|
-
return this.logoUrl ?
|
|
2275
|
+
return this.logoUrl ? r`<img class="brand-img" part="logo" src=${this.logoUrl} alt=${this.logoText} />` : this.logoText ? r`<div class="brand-mark" part="logo">${this.logoText}</div>` : d;
|
|
2214
2276
|
}
|
|
2215
2277
|
renderBranding() {
|
|
2216
|
-
return
|
|
2217
|
-
this.branding,
|
|
2218
|
-
this.brandingText,
|
|
2219
|
-
this.msg.brandingLabel,
|
|
2220
|
-
this.brandingUrl
|
|
2221
|
-
);
|
|
2278
|
+
return Es(this.branding, "Auth");
|
|
2222
2279
|
}
|
|
2223
2280
|
/** Every screen renders inside this, so the credit appears once and only once. */
|
|
2224
2281
|
panel(t) {
|
|
2225
|
-
return
|
|
2282
|
+
return r`<div class="panel">${t}${this.renderBranding()}</div>`;
|
|
2226
2283
|
}
|
|
2227
2284
|
renderOAuthCallback() {
|
|
2228
|
-
return
|
|
2285
|
+
return r`
|
|
2229
2286
|
<div class="stack">
|
|
2230
2287
|
<div class="head">
|
|
2231
2288
|
${this.renderLogo()}
|
|
2232
2289
|
<h2 class="title" part="title">${this.msg.oauthCallbackTitle}</h2>
|
|
2233
2290
|
<p class="sub">${this.msg.oauthCallbackSub}</p>
|
|
2234
2291
|
</div>
|
|
2235
|
-
${this.banner ?
|
|
2292
|
+
${this.banner ? r`<div class="banner" part="banner" role="alert">${this.banner}</div>` : r`<div class="stack" style="align-items:center;">
|
|
2236
2293
|
<span class="spinner" part="spinner"></span>
|
|
2237
2294
|
</div>`}
|
|
2238
|
-
${this.banner ?
|
|
2295
|
+
${this.banner ? r`<button
|
|
2296
|
+
type="button"
|
|
2297
|
+
class="ghost"
|
|
2298
|
+
@click=${() => {
|
|
2299
|
+
this.callbackPhase = "", this.goto("signin");
|
|
2300
|
+
}}
|
|
2301
|
+
>
|
|
2239
2302
|
<span>${this.msg.backCta}</span>
|
|
2240
2303
|
</button>` : d}
|
|
2241
2304
|
</div>
|
|
@@ -2263,11 +2326,32 @@ let u = (He = class extends $ {
|
|
|
2263
2326
|
}
|
|
2264
2327
|
}
|
|
2265
2328
|
describeError(t) {
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2329
|
+
return Fe(t, this.msg);
|
|
2330
|
+
}
|
|
2331
|
+
/**
|
|
2332
|
+
* The message for a code the backend sent back on the redirect. The code is
|
|
2333
|
+
* only ever looked up, never shown, so a crafted URL can't put text on the page.
|
|
2334
|
+
*/
|
|
2335
|
+
describeOAuthError(t) {
|
|
2336
|
+
return zs.test(t) ? t === "INVALID_CREDENTIALS" ? this.msg.oauthNoAccountMessage : Fe(
|
|
2337
|
+
new Ne({ type: "AUTH_ERROR", status: 400, message: t }),
|
|
2338
|
+
this.msg
|
|
2339
|
+
) : this.msg.genericErrorMessage;
|
|
2340
|
+
}
|
|
2341
|
+
/** The requirements hint under a field that creates a password. */
|
|
2342
|
+
get passwordHint() {
|
|
2343
|
+
const t = this.settings ?? this.settingsCtl.settings;
|
|
2344
|
+
return as(t == null ? void 0 : t.auth_settings.password_policy, this.msg);
|
|
2345
|
+
}
|
|
2346
|
+
/** The placeholder for a field that creates a password. */
|
|
2347
|
+
get newPasswordHint() {
|
|
2348
|
+
const t = this.settings ?? this.settingsCtl.settings;
|
|
2349
|
+
return ss(t == null ? void 0 : t.auth_settings.password_policy, this.msg);
|
|
2350
|
+
}
|
|
2351
|
+
/** The project's password rules, checked wherever a password is created. */
|
|
2352
|
+
checkNewPassword(t) {
|
|
2353
|
+
const e = this.settings ?? this.settingsCtl.settings;
|
|
2354
|
+
return is(t, e == null ? void 0 : e.auth_settings.password_policy, this.msg);
|
|
2271
2355
|
}
|
|
2272
2356
|
get codeValue() {
|
|
2273
2357
|
return this.code.join("");
|
|
@@ -2306,8 +2390,9 @@ let u = (He = class extends $ {
|
|
|
2306
2390
|
return;
|
|
2307
2391
|
}
|
|
2308
2392
|
if (s === "newpass") {
|
|
2309
|
-
|
|
2310
|
-
|
|
2393
|
+
const i = this.checkNewPassword(this.newPass);
|
|
2394
|
+
if (i) {
|
|
2395
|
+
this.newPassError = i;
|
|
2311
2396
|
return;
|
|
2312
2397
|
}
|
|
2313
2398
|
if (this.newPass !== this.confirmPass) {
|
|
@@ -2323,20 +2408,18 @@ let u = (He = class extends $ {
|
|
|
2323
2408
|
return;
|
|
2324
2409
|
}
|
|
2325
2410
|
if (s === "invite") {
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
return;
|
|
2329
|
-
}
|
|
2330
|
-
if (this.phone.replace(/\D/g, "").length < 7) {
|
|
2411
|
+
const i = this.phone.trim();
|
|
2412
|
+
if (i && i.replace(/\D/g, "").length < 7) {
|
|
2331
2413
|
this.banner = this.msg.invalidPhoneError;
|
|
2332
2414
|
return;
|
|
2333
2415
|
}
|
|
2334
|
-
|
|
2335
|
-
|
|
2416
|
+
const h = this.checkNewPassword(this.password);
|
|
2417
|
+
if (h) {
|
|
2418
|
+
this.passError = h;
|
|
2336
2419
|
return;
|
|
2337
2420
|
}
|
|
2338
|
-
const
|
|
2339
|
-
if (
|
|
2421
|
+
const c = this.inviteCode || this.codeValue;
|
|
2422
|
+
if (c.length < 6) {
|
|
2340
2423
|
this.banner = this.msg.codeIncompleteError;
|
|
2341
2424
|
return;
|
|
2342
2425
|
}
|
|
@@ -2346,21 +2429,32 @@ let u = (He = class extends $ {
|
|
|
2346
2429
|
email: this.inviteEmail,
|
|
2347
2430
|
grant_type: "code",
|
|
2348
2431
|
purpose: "invite",
|
|
2349
|
-
code:
|
|
2432
|
+
code: c,
|
|
2350
2433
|
password: this.password,
|
|
2351
|
-
phone:
|
|
2434
|
+
...i ? { phone: i } : {}
|
|
2352
2435
|
},
|
|
2353
2436
|
this.signal()
|
|
2354
2437
|
);
|
|
2438
|
+
const f = this.firstName.trim(), $ = this.lastName.trim();
|
|
2439
|
+
(f || $) && await e.updateAccount(
|
|
2440
|
+
{ ...f ? { first_name: f } : {}, ...$ ? { last_name: $ } : {} },
|
|
2441
|
+
this.signal()
|
|
2442
|
+
).catch(() => {
|
|
2443
|
+
});
|
|
2355
2444
|
});
|
|
2356
2445
|
return;
|
|
2357
2446
|
}
|
|
2358
2447
|
if (this.stepped && (s === "signup" && this.step < 2 || s === "signin" && this.step < 1)) {
|
|
2359
|
-
if (
|
|
2448
|
+
if (s === "signup" && this.step === 0) {
|
|
2449
|
+
if (!this.name.trim()) {
|
|
2450
|
+
this.banner = this.msg.firstNameRequiredError;
|
|
2451
|
+
return;
|
|
2452
|
+
}
|
|
2453
|
+
} else if (!this.email.includes("@")) {
|
|
2360
2454
|
this.emailError = this.msg.invalidEmailError;
|
|
2361
2455
|
return;
|
|
2362
2456
|
}
|
|
2363
|
-
this.step += 1;
|
|
2457
|
+
this.banner = "", this.step += 1;
|
|
2364
2458
|
return;
|
|
2365
2459
|
}
|
|
2366
2460
|
if (!this.email.includes("@")) {
|
|
@@ -2368,35 +2462,41 @@ let u = (He = class extends $ {
|
|
|
2368
2462
|
return;
|
|
2369
2463
|
}
|
|
2370
2464
|
if (s === "signup") {
|
|
2371
|
-
|
|
2372
|
-
|
|
2465
|
+
const [i = "", ...h] = this.name.trim().split(/\s+/);
|
|
2466
|
+
if (!i) {
|
|
2467
|
+
this.banner = this.msg.firstNameRequiredError;
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
const c = this.checkNewPassword(this.password);
|
|
2471
|
+
if (c) {
|
|
2472
|
+
this.passError = c;
|
|
2373
2473
|
return;
|
|
2374
2474
|
}
|
|
2375
|
-
const
|
|
2475
|
+
const f = h.join(" ");
|
|
2376
2476
|
await this.withLoading(async () => {
|
|
2377
|
-
const
|
|
2477
|
+
const $ = await e.signUp(
|
|
2378
2478
|
{
|
|
2379
2479
|
email: this.email,
|
|
2380
2480
|
password: this.password,
|
|
2381
|
-
first_name: i
|
|
2382
|
-
last_name:
|
|
2481
|
+
first_name: i,
|
|
2482
|
+
...f ? { last_name: f } : {}
|
|
2383
2483
|
},
|
|
2384
2484
|
this.signal()
|
|
2385
|
-
),
|
|
2386
|
-
next_action:
|
|
2387
|
-
next_operation:
|
|
2485
|
+
), E = fs({
|
|
2486
|
+
next_action: $.next_action,
|
|
2487
|
+
next_operation: $.next_operation
|
|
2388
2488
|
});
|
|
2389
2489
|
this.setScreen("signin", {
|
|
2390
|
-
notice:
|
|
2490
|
+
notice: this.msg.accountCreatedNotice,
|
|
2391
2491
|
step: 0,
|
|
2392
2492
|
password: "",
|
|
2393
|
-
needsMfaCode:
|
|
2493
|
+
needsMfaCode: E === "signin_with_code"
|
|
2394
2494
|
});
|
|
2395
2495
|
});
|
|
2396
2496
|
return;
|
|
2397
2497
|
}
|
|
2398
|
-
if (this.password
|
|
2399
|
-
this.
|
|
2498
|
+
if (!this.password) {
|
|
2499
|
+
this.passError = this.msg.requiredError;
|
|
2400
2500
|
return;
|
|
2401
2501
|
}
|
|
2402
2502
|
await this.withLoading(async () => {
|
|
@@ -2410,12 +2510,12 @@ let u = (He = class extends $ {
|
|
|
2410
2510
|
this.signal()
|
|
2411
2511
|
), this.step = 0;
|
|
2412
2512
|
} catch (i) {
|
|
2413
|
-
if (i instanceof
|
|
2513
|
+
if (i instanceof Ne && i.code === "CODE_REQUIRED") {
|
|
2414
2514
|
this.needsMfaCode = !0, await e.requestCode({ email: this.email, purpose: "signin" }, this.signal()), this.notice = this.msg.codeSentNeutral;
|
|
2415
2515
|
return;
|
|
2416
2516
|
}
|
|
2417
|
-
if (i instanceof
|
|
2418
|
-
this.
|
|
2517
|
+
if (i instanceof Ne && i.code === "INVALID_CREDENTIALS") {
|
|
2518
|
+
this.banner = this.msg.invalidCredentialsError;
|
|
2419
2519
|
return;
|
|
2420
2520
|
}
|
|
2421
2521
|
throw i;
|
|
@@ -2427,16 +2527,16 @@ let u = (He = class extends $ {
|
|
|
2427
2527
|
return (t = this.abortController) == null || t.abort(), this.abortController = new AbortController(), this.abortController.signal;
|
|
2428
2528
|
}
|
|
2429
2529
|
onCodeInput(t, e) {
|
|
2430
|
-
var
|
|
2530
|
+
var f;
|
|
2431
2531
|
const i = e.target.value.replace(/\D/g, "");
|
|
2432
2532
|
if (i.length > 1) {
|
|
2433
2533
|
this.fillCode(t, i);
|
|
2434
2534
|
return;
|
|
2435
2535
|
}
|
|
2436
2536
|
const h = i.slice(-1), c = this.code.slice();
|
|
2437
|
-
c[t] = h, this.code = c, this.banner = "", h && ((
|
|
2537
|
+
c[t] = h, this.code = c, this.banner = "", h && ((f = this.renderRoot.querySelectorAll(
|
|
2438
2538
|
".code-row input, .code-row-sm input"
|
|
2439
|
-
)[t + 1]) == null ||
|
|
2539
|
+
)[t + 1]) == null || f.focus());
|
|
2440
2540
|
}
|
|
2441
2541
|
onCodePaste(t, e) {
|
|
2442
2542
|
var i;
|
|
@@ -2461,7 +2561,7 @@ let u = (He = class extends $ {
|
|
|
2461
2561
|
if (!t || this.loading) return;
|
|
2462
2562
|
const e = this.verifyNext === "newpass" ? "password_reset" : "signin";
|
|
2463
2563
|
await this.withLoading(async () => {
|
|
2464
|
-
await t.requestCode({ email: this.email, purpose: e }, this.signal()), this.notice =
|
|
2564
|
+
await t.requestCode({ email: this.email, purpose: e }, this.signal()), this.notice = this.msg.codeResentNotice, this.code = ["", "", "", "", "", ""];
|
|
2465
2565
|
});
|
|
2466
2566
|
}
|
|
2467
2567
|
goBack() {
|
|
@@ -2538,15 +2638,15 @@ let u = (He = class extends $ {
|
|
|
2538
2638
|
}
|
|
2539
2639
|
// ── render pieces ─────────────────────────────────────────
|
|
2540
2640
|
renderPrimary(t) {
|
|
2541
|
-
return
|
|
2641
|
+
return r`
|
|
2542
2642
|
<button type="submit" class="primary" part="button-primary" ?disabled=${this.loading}>
|
|
2543
|
-
${this.loading ?
|
|
2643
|
+
${this.loading ? r`<span class="spinner" part="spinner"></span>` : d}
|
|
2544
2644
|
<span>${t}</span>
|
|
2545
2645
|
</button>
|
|
2546
2646
|
`;
|
|
2547
2647
|
}
|
|
2548
2648
|
renderEmailField(t) {
|
|
2549
|
-
return
|
|
2649
|
+
return r`
|
|
2550
2650
|
<div class="field">
|
|
2551
2651
|
<label for=${t}>${this.msg.emailLabel}</label>
|
|
2552
2652
|
<input
|
|
@@ -2561,16 +2661,16 @@ let u = (He = class extends $ {
|
|
|
2561
2661
|
this.email = e.target.value, this.emailError = "", this.banner = "";
|
|
2562
2662
|
}}
|
|
2563
2663
|
/>
|
|
2564
|
-
${this.emailError ?
|
|
2664
|
+
${this.emailError ? r`<p class="err">${this.emailError}</p>` : d}
|
|
2565
2665
|
</div>
|
|
2566
2666
|
`;
|
|
2567
2667
|
}
|
|
2568
|
-
renderPasswordField(t, e) {
|
|
2569
|
-
return
|
|
2668
|
+
renderPasswordField(t, e, s = !1) {
|
|
2669
|
+
return r`
|
|
2570
2670
|
<div class="field">
|
|
2571
2671
|
<div class="label-row">
|
|
2572
2672
|
<label for=${t}>${this.msg.passwordLabel}</label>
|
|
2573
|
-
${e ?
|
|
2673
|
+
${e ? r`<button
|
|
2574
2674
|
type="button"
|
|
2575
2675
|
class="link-sm"
|
|
2576
2676
|
@click=${() => this.setScreen("forgot", { step: 0 })}
|
|
@@ -2583,28 +2683,33 @@ let u = (He = class extends $ {
|
|
|
2583
2683
|
type="password"
|
|
2584
2684
|
part="input"
|
|
2585
2685
|
.value=${this.password}
|
|
2586
|
-
placeholder=${this.msg.passwordPlaceholder}
|
|
2686
|
+
placeholder=${s ? this.newPasswordHint : this.msg.passwordPlaceholder}
|
|
2587
2687
|
aria-invalid=${this.passError ? "true" : "false"}
|
|
2588
2688
|
?disabled=${this.loading}
|
|
2589
|
-
@input=${(
|
|
2590
|
-
this.password =
|
|
2689
|
+
@input=${(i) => {
|
|
2690
|
+
this.password = i.target.value, this.passError = "", this.banner = "";
|
|
2591
2691
|
}}
|
|
2592
2692
|
/>
|
|
2593
|
-
${
|
|
2693
|
+
${s ? this.passwordHint : d}
|
|
2694
|
+
${this.passError ? r`<p class="err">${this.passError}</p>` : d}
|
|
2594
2695
|
</div>
|
|
2595
2696
|
`;
|
|
2596
2697
|
}
|
|
2597
2698
|
renderCodeRow(t = !1) {
|
|
2598
|
-
return
|
|
2599
|
-
<div
|
|
2699
|
+
return r`
|
|
2700
|
+
<div
|
|
2701
|
+
class=${t ? "code-row-sm" : "code-row"}
|
|
2702
|
+
role="group"
|
|
2703
|
+
aria-label=${this.msg.codeLabel}
|
|
2704
|
+
>
|
|
2600
2705
|
${this.code.map(
|
|
2601
|
-
(e, s) =>
|
|
2706
|
+
(e, s) => r`
|
|
2602
2707
|
<input
|
|
2603
2708
|
type="text"
|
|
2604
2709
|
inputmode="numeric"
|
|
2605
2710
|
maxlength="1"
|
|
2606
2711
|
part="code-box"
|
|
2607
|
-
aria-label=${
|
|
2712
|
+
aria-label=${this.msg.digitLabel.replace("{n}", String(s + 1))}
|
|
2608
2713
|
autocomplete=${s === 0 ? "one-time-code" : "off"}
|
|
2609
2714
|
.value=${e}
|
|
2610
2715
|
?disabled=${this.loading}
|
|
@@ -2618,9 +2723,9 @@ let u = (He = class extends $ {
|
|
|
2618
2723
|
}
|
|
2619
2724
|
/** The email/password method accordion body for signin, signup and otp. */
|
|
2620
2725
|
renderEmailMethodBody(t) {
|
|
2621
|
-
const e = this.cfg, s = this.stepped, i = t === "signup" && (!s || this.step === 0), h = t === "signup" && (!s || this.step === 1) || t === "signin" && (!s || this.step === 0) || t === "otp", c = t === "signup" && (!s || this.step === 2) || t === "signin" && (!s || this.step === 1),
|
|
2622
|
-
return
|
|
2623
|
-
${i ?
|
|
2726
|
+
const e = this.cfg, s = this.stepped, i = t === "signup" && (!s || this.step === 0), h = t === "signup" && (!s || this.step === 1) || t === "signin" && (!s || this.step === 0) || t === "otp", c = t === "signup" && (!s || this.step === 2) || t === "signin" && (!s || this.step === 1), f = t === "signin" && e.allowEmailSignin && e.allowEmailOtp && (!s || this.step === 0);
|
|
2727
|
+
return r`
|
|
2728
|
+
${i ? r`
|
|
2624
2729
|
<div class="field">
|
|
2625
2730
|
<label for=${this.uid("name")}>${this.msg.fullNameLabel}</label>
|
|
2626
2731
|
<input
|
|
@@ -2630,20 +2735,24 @@ let u = (He = class extends $ {
|
|
|
2630
2735
|
.value=${this.name}
|
|
2631
2736
|
placeholder=${this.msg.fullNamePlaceholder}
|
|
2632
2737
|
?disabled=${this.loading}
|
|
2633
|
-
@input=${(
|
|
2738
|
+
@input=${($) => this.name = $.target.value}
|
|
2634
2739
|
/>
|
|
2635
2740
|
</div>
|
|
2636
2741
|
` : d}
|
|
2637
2742
|
${h ? this.renderEmailField(this.uid("email")) : d}
|
|
2638
|
-
${c ? this.renderPasswordField(
|
|
2639
|
-
|
|
2743
|
+
${c ? this.renderPasswordField(
|
|
2744
|
+
this.uid("pass"),
|
|
2745
|
+
e.allowRecovery && t === "signin",
|
|
2746
|
+
t === "signup"
|
|
2747
|
+
) : d}
|
|
2748
|
+
${this.needsMfaCode && t === "signin" ? r`
|
|
2640
2749
|
<div class="field">
|
|
2641
|
-
<span class="label"
|
|
2750
|
+
<span class="label">${this.msg.codeLabel}</span>
|
|
2642
2751
|
${this.renderCodeRow(!0)}
|
|
2643
2752
|
</div>
|
|
2644
2753
|
` : d}
|
|
2645
2754
|
${this.renderPrimary(this.ctaFor(t))}
|
|
2646
|
-
${
|
|
2755
|
+
${f ? r`<button
|
|
2647
2756
|
type="button"
|
|
2648
2757
|
class="edit-link"
|
|
2649
2758
|
@click=${() => this.setScreen("otp", { step: 0 })}
|
|
@@ -2653,62 +2762,62 @@ let u = (He = class extends $ {
|
|
|
2653
2762
|
`;
|
|
2654
2763
|
}
|
|
2655
2764
|
renderAccordion(t) {
|
|
2656
|
-
const e = this.cfg, s = t === "signin" && e.allowEmailSignin || t === "signup" && e.allowEmailSignup || t === "otp" && e.allowEmailOtp, i = e.allowOauth;
|
|
2657
|
-
if (!s && !
|
|
2658
|
-
const
|
|
2659
|
-
<div class="acc-item ${
|
|
2660
|
-
${
|
|
2765
|
+
const e = this.cfg, s = t === "signin" && e.allowEmailSignin || t === "signup" && e.allowEmailSignup || t === "otp" && e.allowEmailOtp, i = this.settings ?? this.settingsCtl.settings, h = R(i, t === "signup" ? "signup" : "signin"), c = e.allowOauth && (!i || h.length > 0);
|
|
2766
|
+
if (!s && !c) return d;
|
|
2767
|
+
const f = s && c, $ = s ? c && this.method || "email" : "oauth", E = $ === "email", C = $ === "oauth", k = t === "signup" ? this.msg.emailMethodTitleSignUp : this.msg.emailMethodTitle, T = t === "otp" ? this.msg.emailMethodMetaOtp : t === "signup" ? this.msg.emailMethodMetaSignUp : this.msg.emailMethodMeta, U = (O, xe, Ue, Me, cs, He) => r`
|
|
2768
|
+
<div class="acc-item ${O ? "open" : ""} ${f ? "" : "bare"}" part="acc-item">
|
|
2769
|
+
${f ? r`
|
|
2661
2770
|
<button
|
|
2662
2771
|
type="button"
|
|
2663
2772
|
class="acc-head"
|
|
2664
|
-
aria-expanded=${
|
|
2665
|
-
aria-controls=${this.uid(`acc-${
|
|
2666
|
-
@click=${
|
|
2773
|
+
aria-expanded=${O ? "true" : "false"}
|
|
2774
|
+
aria-controls=${this.uid(`acc-${He}`)}
|
|
2775
|
+
@click=${cs}
|
|
2667
2776
|
>
|
|
2668
2777
|
<span class="chev" aria-hidden="true">›</span>
|
|
2669
|
-
<span class="acc-title">${
|
|
2670
|
-
<span class="acc-meta">${
|
|
2778
|
+
<span class="acc-title">${xe}</span>
|
|
2779
|
+
<span class="acc-meta">${Ue}</span>
|
|
2671
2780
|
</button>
|
|
2672
2781
|
` : d}
|
|
2673
|
-
<div class="acc-body" id=${this.uid(`acc-${
|
|
2782
|
+
<div class="acc-body" id=${this.uid(`acc-${He}`)}>
|
|
2674
2783
|
<div class="acc-clip">
|
|
2675
|
-
<div class="acc-inner">${
|
|
2784
|
+
<div class="acc-inner">${Me}</div>
|
|
2676
2785
|
</div>
|
|
2677
2786
|
</div>
|
|
2678
2787
|
</div>
|
|
2679
|
-
`,
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2788
|
+
`, M = s ? U(
|
|
2789
|
+
E,
|
|
2790
|
+
k,
|
|
2791
|
+
T,
|
|
2683
2792
|
this.renderEmailMethodBody(t),
|
|
2684
|
-
() => this.method =
|
|
2793
|
+
() => this.method = E ? "" : "email",
|
|
2685
2794
|
"email"
|
|
2686
|
-
) : d,
|
|
2687
|
-
|
|
2795
|
+
) : d, I = c ? U(
|
|
2796
|
+
C,
|
|
2688
2797
|
this.msg.oauthMethodTitle,
|
|
2689
|
-
this.msg.oauthMethodMeta,
|
|
2690
|
-
|
|
2798
|
+
h.length ? h.map((O) => O.name).join(", ") : this.msg.oauthMethodMeta,
|
|
2799
|
+
r`<singlebase-authui-buttons
|
|
2691
2800
|
type="oauth"
|
|
2692
2801
|
embedded
|
|
2693
|
-
theme=${
|
|
2694
|
-
density=${
|
|
2695
|
-
field-style=${
|
|
2802
|
+
theme=${A(this.theme)}
|
|
2803
|
+
density=${A(this.density)}
|
|
2804
|
+
field-style=${A(this.fieldStyle)}
|
|
2696
2805
|
.client=${this.resolvedClient}
|
|
2697
2806
|
.messages=${this.messages}
|
|
2698
2807
|
.settings=${this.settings ?? this.settingsCtl.settings}
|
|
2699
2808
|
intent=${t === "signup" ? "signup" : "signin"}
|
|
2700
2809
|
></singlebase-authui-buttons>`,
|
|
2701
|
-
() => this.method =
|
|
2810
|
+
() => this.method = C ? "" : "oauth",
|
|
2702
2811
|
"oauth"
|
|
2703
2812
|
) : d;
|
|
2704
|
-
return
|
|
2813
|
+
return r`
|
|
2705
2814
|
<div class="acc-wrap">
|
|
2706
|
-
${this.oauthPlacement === "top" ?
|
|
2815
|
+
${this.oauthPlacement === "top" ? r`${I}${M}` : r`${M}${I}`}
|
|
2707
2816
|
</div>
|
|
2708
2817
|
`;
|
|
2709
2818
|
}
|
|
2710
2819
|
renderScreenBody(t) {
|
|
2711
|
-
return this.cfg, ["signin", "signup", "otp"].indexOf(t) >= 0 ? this.renderAccordion(t) : t === "forgot" ?
|
|
2820
|
+
return this.cfg, ["signin", "signup", "otp"].indexOf(t) >= 0 ? this.renderAccordion(t) : t === "forgot" ? r`<div class="fields">${this.renderEmailField(this.uid("reset"))}</div>` : t === "verify" ? r`
|
|
2712
2821
|
${this.renderCodeRow()}
|
|
2713
2822
|
<div class="resend-row">
|
|
2714
2823
|
<span class="hint">${this.msg.resendQuestion}</span>
|
|
@@ -2716,7 +2825,7 @@ let u = (He = class extends $ {
|
|
|
2716
2825
|
${this.msg.resendCta}
|
|
2717
2826
|
</button>
|
|
2718
2827
|
</div>
|
|
2719
|
-
` : t === "newpass" ?
|
|
2828
|
+
` : t === "newpass" ? r`
|
|
2720
2829
|
<div class="fields">
|
|
2721
2830
|
<div class="field">
|
|
2722
2831
|
<label for=${this.uid("newpass")}>${this.msg.newPasswordLabel}</label>
|
|
@@ -2725,7 +2834,7 @@ let u = (He = class extends $ {
|
|
|
2725
2834
|
type="password"
|
|
2726
2835
|
part="input"
|
|
2727
2836
|
.value=${this.newPass}
|
|
2728
|
-
placeholder=${this.
|
|
2837
|
+
placeholder=${this.newPasswordHint}
|
|
2729
2838
|
aria-invalid=${this.newPassError ? "true" : "false"}
|
|
2730
2839
|
?disabled=${this.loading}
|
|
2731
2840
|
@input=${(s) => {
|
|
@@ -2747,17 +2856,18 @@ let u = (He = class extends $ {
|
|
|
2747
2856
|
this.confirmPass = s.target.value, this.newPassError = "";
|
|
2748
2857
|
}}
|
|
2749
2858
|
/>
|
|
2750
|
-
${this.
|
|
2859
|
+
${this.passwordHint}
|
|
2860
|
+
${this.newPassError ? r`<p class="err">${this.newPassError}</p>` : d}
|
|
2751
2861
|
</div>
|
|
2752
2862
|
</div>
|
|
2753
|
-
` : t === "invite" ?
|
|
2863
|
+
` : t === "invite" ? r`
|
|
2754
2864
|
<div class="fields">
|
|
2755
2865
|
<div class="invite-box">
|
|
2756
2866
|
<span class="invite-label">${this.msg.invitedEmailLabel}</span>
|
|
2757
2867
|
<span class="invite-email">${this.inviteEmail}</span>
|
|
2758
2868
|
</div>
|
|
2759
|
-
${this.inviteCode ? d :
|
|
2760
|
-
<span class="label"
|
|
2869
|
+
${this.inviteCode ? d : r`<div class="field">
|
|
2870
|
+
<span class="label">${this.msg.inviteCodeLabel}</span>
|
|
2761
2871
|
${this.renderCodeRow(!0)}
|
|
2762
2872
|
</div>`}
|
|
2763
2873
|
<div class="two-up">
|
|
@@ -2805,21 +2915,22 @@ let u = (He = class extends $ {
|
|
|
2805
2915
|
type="password"
|
|
2806
2916
|
part="input"
|
|
2807
2917
|
.value=${this.password}
|
|
2808
|
-
placeholder=${this.
|
|
2918
|
+
placeholder=${this.newPasswordHint}
|
|
2809
2919
|
aria-invalid=${this.passError ? "true" : "false"}
|
|
2810
2920
|
?disabled=${this.loading}
|
|
2811
2921
|
@input=${(s) => {
|
|
2812
2922
|
this.password = s.target.value, this.passError = "";
|
|
2813
2923
|
}}
|
|
2814
2924
|
/>
|
|
2815
|
-
${this.
|
|
2925
|
+
${this.passwordHint}
|
|
2926
|
+
${this.passError ? r`<p class="err">${this.passError}</p>` : d}
|
|
2816
2927
|
</div>
|
|
2817
2928
|
</div>
|
|
2818
2929
|
` : d;
|
|
2819
2930
|
}
|
|
2820
2931
|
renderGuest(t) {
|
|
2821
2932
|
const e = this.cfg, s = ["forgot", "verify", "newpass", "invite"].indexOf(t) >= 0, i = this.stepped && this.step > 0 || ["forgot", "verify", "otp", "newpass"].indexOf(t) >= 0, h = t === "signin" && e.allowEmailSignup || t === "signup" && e.allowEmailSignin, c = this.stepped && (t === "signin" || t === "signup");
|
|
2822
|
-
return
|
|
2933
|
+
return r`
|
|
2823
2934
|
<form class="stack" @submit=${this.onSubmit} novalidate>
|
|
2824
2935
|
<div class="head">
|
|
2825
2936
|
${this.layout !== "split" ? this.renderLogo() : d}
|
|
@@ -2827,21 +2938,21 @@ let u = (He = class extends $ {
|
|
|
2827
2938
|
<p class="sub">${this.subFor(t)}</p>
|
|
2828
2939
|
</div>
|
|
2829
2940
|
|
|
2830
|
-
${c ?
|
|
2941
|
+
${c ? r`<div class="step-bar">
|
|
2831
2942
|
<div class="step-fill" style="width:${this.stepPct()}%"></div>
|
|
2832
2943
|
</div>` : d}
|
|
2833
|
-
${this.banner ?
|
|
2834
|
-
${this.notice ?
|
|
2944
|
+
${this.banner ? r`<div class="banner" part="banner" role="alert">${this.banner}</div>` : d}
|
|
2945
|
+
${this.notice ? r`<div class="notice" part="notice" role="status">${this.notice}</div>` : d}
|
|
2835
2946
|
${this.renderScreenBody(t)}
|
|
2836
|
-
${s || i ?
|
|
2947
|
+
${s || i ? r`
|
|
2837
2948
|
<div class="actions">
|
|
2838
2949
|
${s ? this.renderPrimary(this.ctaFor(t)) : d}
|
|
2839
|
-
${i ?
|
|
2950
|
+
${i ? r`<button type="button" class="ghost" @click=${this.goBack}>
|
|
2840
2951
|
${this.msg.backCta}
|
|
2841
2952
|
</button>` : d}
|
|
2842
2953
|
</div>
|
|
2843
2954
|
` : d}
|
|
2844
|
-
${h ?
|
|
2955
|
+
${h ? r`
|
|
2845
2956
|
<p class="foot">
|
|
2846
2957
|
<span
|
|
2847
2958
|
>${t === "signup" ? this.msg.footTextSignUp : this.msg.footTextSignIn}</span
|
|
@@ -2861,14 +2972,14 @@ let u = (He = class extends $ {
|
|
|
2861
2972
|
${this.renderConsent()}
|
|
2862
2973
|
|
|
2863
2974
|
<span class="sr-only" role="status" aria-live="polite">
|
|
2864
|
-
${this.loading ?
|
|
2975
|
+
${this.loading ? this.msg.submittingStatus : ""}
|
|
2865
2976
|
</span>
|
|
2866
2977
|
</form>
|
|
2867
2978
|
`;
|
|
2868
2979
|
}
|
|
2869
2980
|
renderBlocked() {
|
|
2870
2981
|
const e = !this.cfg.authEnabled;
|
|
2871
|
-
return
|
|
2982
|
+
return r`
|
|
2872
2983
|
<div class="stack">
|
|
2873
2984
|
<div class="head">
|
|
2874
2985
|
${this.layout !== "split" ? this.renderLogo() : d}
|
|
@@ -2890,7 +3001,7 @@ let u = (He = class extends $ {
|
|
|
2890
3001
|
*/
|
|
2891
3002
|
renderSignedIn() {
|
|
2892
3003
|
const t = this.auth.state.status === "authenticated" ? this.auth.state.user : null, e = this.redirectTarget;
|
|
2893
|
-
return
|
|
3004
|
+
return r`
|
|
2894
3005
|
<div class="stack">
|
|
2895
3006
|
<div class="head">
|
|
2896
3007
|
${this.renderLogo()}
|
|
@@ -2909,60 +3020,73 @@ let u = (He = class extends $ {
|
|
|
2909
3020
|
</button>
|
|
2910
3021
|
</div>
|
|
2911
3022
|
|
|
2912
|
-
${e ? d :
|
|
3023
|
+
${e ? d : r`<p class="hint">${this.msg.continueHint}</p>`}
|
|
2913
3024
|
</div>
|
|
2914
3025
|
`;
|
|
2915
3026
|
}
|
|
2916
3027
|
/** The Terms/Privacy consent line, rendered only when the host supplies a link. */
|
|
2917
3028
|
renderConsent() {
|
|
2918
3029
|
if (!this.tosUrl && !this.privacyUrl) return d;
|
|
2919
|
-
const t = this.tosUrl ?
|
|
3030
|
+
const t = this.tosUrl ? r`<a class="link-sm" href=${this.tosUrl} target="_blank" rel="noopener noreferrer"
|
|
2920
3031
|
>${this.msg.termsLabel}</a
|
|
2921
|
-
>` : d, e = this.privacyUrl ?
|
|
3032
|
+
>` : d, e = this.privacyUrl ? r`<a class="link-sm" href=${this.privacyUrl} target="_blank" rel="noopener noreferrer"
|
|
2922
3033
|
>${this.msg.privacyLabel}</a
|
|
2923
3034
|
>` : d;
|
|
2924
|
-
return
|
|
2925
|
-
<p class="hint" part="consent">
|
|
3035
|
+
return r`
|
|
3036
|
+
<p class="hint consent" part="consent">
|
|
2926
3037
|
${this.msg.consentPrefix}
|
|
2927
|
-
${t}${this.tosUrl && this.privacyUrl ?
|
|
3038
|
+
${t}${this.tosUrl && this.privacyUrl ? r` ${this.msg.consentJoin} ` : d}${e}.
|
|
2928
3039
|
</p>
|
|
2929
3040
|
`;
|
|
2930
3041
|
}
|
|
3042
|
+
/**
|
|
3043
|
+
* The OAuth return is handled after the first render, not during it: state
|
|
3044
|
+
* set while rendering is dropped, so the widget wouldn't leave the callback
|
|
3045
|
+
* screen once the URL is cleaned.
|
|
3046
|
+
*/
|
|
3047
|
+
updated(t) {
|
|
3048
|
+
super.updated(t), this.activeScreen === "oauth-callback" && this.handleOAuthCallback();
|
|
3049
|
+
}
|
|
2931
3050
|
render() {
|
|
2932
3051
|
const t = this.activeScreen;
|
|
2933
3052
|
if (t === "oauth-callback")
|
|
2934
|
-
return this.
|
|
2935
|
-
if (t === "account")
|
|
2936
|
-
|
|
3053
|
+
return this.panel(this.renderOAuthCallback());
|
|
3054
|
+
if (t === "account") {
|
|
3055
|
+
if (this.noAccountView) return d;
|
|
3056
|
+
const h = this.callbackPhase === "failed" && this.banner;
|
|
3057
|
+
return this.panel(r`
|
|
3058
|
+
${h ? r`<div class="banner" part="banner" role="alert">${this.banner}</div>` : d}
|
|
3059
|
+
${this.linkNotice ? r`<div class="notice" part="notice" role="status">${this.linkNotice}</div>` : d}
|
|
2937
3060
|
<singlebase-authui-account
|
|
2938
|
-
theme=${
|
|
2939
|
-
density=${
|
|
2940
|
-
field-style=${
|
|
3061
|
+
theme=${A(this.theme)}
|
|
3062
|
+
density=${A(this.density)}
|
|
3063
|
+
field-style=${A(this.fieldStyle)}
|
|
2941
3064
|
.client=${this.resolvedClient}
|
|
2942
3065
|
.messages=${this.messages}
|
|
2943
3066
|
logo-text=${this.logoText}
|
|
2944
3067
|
logo-url=${this.logoUrl}
|
|
2945
3068
|
></singlebase-authui-account>
|
|
2946
3069
|
`);
|
|
3070
|
+
}
|
|
2947
3071
|
if (this.showsSignedInInterstitial)
|
|
2948
3072
|
return this.noAccountView ? d : this.panel(this.renderSignedIn());
|
|
2949
|
-
const e = this.cfg, s = !e.allowEmailSignin && !e.allowEmailOtp && !e.allowOauth, i = !e.authEnabled || s &&
|
|
2950
|
-
return
|
|
2951
|
-
${this.layout === "split" ?
|
|
3073
|
+
const e = this.cfg, s = !e.allowEmailSignin && !e.allowEmailOtp && !e.allowOauth, i = !e.authEnabled || s && We(t);
|
|
3074
|
+
return r`
|
|
3075
|
+
${this.layout === "split" ? r`
|
|
2952
3076
|
<div class="brand-panel">
|
|
2953
3077
|
${this.renderBrandMark()}
|
|
2954
|
-
${this.brandLine ?
|
|
2955
|
-
${this.brandFoot ?
|
|
3078
|
+
${this.brandLine ? r`<div class="brand-copy">${this.brandLine}</div>` : d}
|
|
3079
|
+
${this.brandFoot ? r`<div class="brand-foot">${this.brandFoot}</div>` : d}
|
|
2956
3080
|
</div>
|
|
2957
3081
|
` : d}
|
|
2958
3082
|
${this.panel(i ? this.renderBlocked() : this.renderGuest(t))}
|
|
2959
3083
|
`;
|
|
2960
3084
|
}
|
|
2961
|
-
},
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
3085
|
+
}, _t = new WeakMap(), kt = new WeakMap(), Tt = new WeakMap(), Ot = new WeakMap(), Nt = new WeakMap(), At = new WeakMap(), Lt = new WeakMap(), xt = new WeakMap(), Ut = new WeakMap(), Mt = new WeakMap(), It = new WeakMap(), Rt = new WeakMap(), Ft = new WeakMap(), Dt = new WeakMap(), Bt = new WeakMap(), Ht = new WeakMap(), qt = new WeakMap(), jt = new WeakMap(), Kt = new WeakMap(), Vt = new WeakMap(), Gt = new WeakMap(), Wt = new WeakMap(), Yt = new WeakMap(), zt = new WeakMap(), Jt = new WeakMap(), Zt = new WeakMap(), Qt = new WeakMap(), Xt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), se = new WeakMap(), ie = new WeakMap(), ae = new WeakMap(), re = new WeakMap(), ne = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), he = new WeakMap(), de = new WeakMap(), ce = new WeakMap(), ue = new WeakMap(), pe = new WeakMap(), ge = new WeakMap(), me = new WeakMap(), be = new WeakMap(), fe = new WeakMap(), ve = new WeakMap(), we = new WeakMap(), Ze);
|
|
3086
|
+
Ys(u, "styles", [
|
|
3087
|
+
...y.styles,
|
|
3088
|
+
ys,
|
|
3089
|
+
ts`
|
|
2966
3090
|
/* the mock's root */
|
|
2967
3091
|
:host {
|
|
2968
3092
|
display: flex;
|
|
@@ -3063,22 +3187,22 @@ g([
|
|
|
3063
3187
|
p({ attribute: !1 })
|
|
3064
3188
|
], u.prototype, "settings", 1);
|
|
3065
3189
|
g([
|
|
3066
|
-
p({ converter:
|
|
3190
|
+
p({ converter: N, attribute: "auth-enabled" })
|
|
3067
3191
|
], u.prototype, "authEnabled", 1);
|
|
3068
3192
|
g([
|
|
3069
|
-
p({ converter:
|
|
3193
|
+
p({ converter: N, attribute: "allow-email-signin" })
|
|
3070
3194
|
], u.prototype, "allowEmailSignin", 1);
|
|
3071
3195
|
g([
|
|
3072
|
-
p({ converter:
|
|
3196
|
+
p({ converter: N, attribute: "allow-email-signup" })
|
|
3073
3197
|
], u.prototype, "allowEmailSignup", 1);
|
|
3074
3198
|
g([
|
|
3075
|
-
p({ converter:
|
|
3199
|
+
p({ converter: N, attribute: "allow-email-otp" })
|
|
3076
3200
|
], u.prototype, "allowEmailOtp", 1);
|
|
3077
3201
|
g([
|
|
3078
|
-
p({ converter:
|
|
3202
|
+
p({ converter: N, attribute: "allow-oauth" })
|
|
3079
3203
|
], u.prototype, "allowOauth", 1);
|
|
3080
3204
|
g([
|
|
3081
|
-
p({ converter:
|
|
3205
|
+
p({ converter: N, attribute: "allow-account-creation" })
|
|
3082
3206
|
], u.prototype, "allowAccountCreation", 1);
|
|
3083
3207
|
g([
|
|
3084
3208
|
p()
|
|
@@ -3105,14 +3229,8 @@ g([
|
|
|
3105
3229
|
p({ attribute: "sign-in-title" })
|
|
3106
3230
|
], u.prototype, "signInTitle", 1);
|
|
3107
3231
|
g([
|
|
3108
|
-
p({ converter:
|
|
3232
|
+
p({ converter: N, attribute: "branding" })
|
|
3109
3233
|
], u.prototype, "branding", 1);
|
|
3110
|
-
g([
|
|
3111
|
-
p({ attribute: "branding-text" })
|
|
3112
|
-
], u.prototype, "brandingText", 1);
|
|
3113
|
-
g([
|
|
3114
|
-
p({ attribute: "branding-url" })
|
|
3115
|
-
], u.prototype, "brandingUrl", 1);
|
|
3116
3234
|
g([
|
|
3117
3235
|
p({ attribute: "redirect-url" })
|
|
3118
3236
|
], u.prototype, "redirectUrl", 1);
|
|
@@ -3188,50 +3306,53 @@ g([
|
|
|
3188
3306
|
g([
|
|
3189
3307
|
m()
|
|
3190
3308
|
], u.prototype, "newPassError", 1);
|
|
3191
|
-
g([
|
|
3192
|
-
m()
|
|
3193
|
-
], u.prototype, "attempts", 1);
|
|
3194
3309
|
g([
|
|
3195
3310
|
m()
|
|
3196
3311
|
], u.prototype, "needsMfaCode", 1);
|
|
3197
3312
|
g([
|
|
3198
3313
|
m()
|
|
3199
3314
|
], u.prototype, "callbackDone", 1);
|
|
3315
|
+
g([
|
|
3316
|
+
m()
|
|
3317
|
+
], u.prototype, "callbackPhase", 1);
|
|
3318
|
+
g([
|
|
3319
|
+
m()
|
|
3320
|
+
], u.prototype, "linkNotice", 1);
|
|
3200
3321
|
u = g([
|
|
3201
|
-
|
|
3322
|
+
Te("singlebase-authui")
|
|
3202
3323
|
], u);
|
|
3203
|
-
var
|
|
3204
|
-
for (var i = s > 1 ? void 0 : s ?
|
|
3205
|
-
(c =
|
|
3206
|
-
return s && i &&
|
|
3324
|
+
var Qs = Object.defineProperty, Xs = Object.getOwnPropertyDescriptor, Le = (a, t, e, s) => {
|
|
3325
|
+
for (var i = s > 1 ? void 0 : s ? Xs(t, e) : t, h = a.length - 1, c; h >= 0; h--)
|
|
3326
|
+
(c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
|
|
3327
|
+
return s && i && Qs(t, e, i), i;
|
|
3207
3328
|
};
|
|
3208
|
-
const
|
|
3209
|
-
var
|
|
3210
|
-
let
|
|
3329
|
+
const ti = ["loading", "authenticated", "unauthenticated"];
|
|
3330
|
+
var $e, ye, Ee, Qe;
|
|
3331
|
+
let F = (Qe = class extends y {
|
|
3211
3332
|
constructor() {
|
|
3212
3333
|
super(...arguments);
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3334
|
+
o(this, $e, "");
|
|
3335
|
+
o(this, ye, null);
|
|
3336
|
+
o(this, Ee, "unauthenticated");
|
|
3216
3337
|
b(this, "warnedFor", null);
|
|
3217
3338
|
}
|
|
3218
3339
|
get slot() {
|
|
3219
|
-
return
|
|
3340
|
+
return n(this, $e);
|
|
3220
3341
|
}
|
|
3221
3342
|
set slot(t) {
|
|
3222
|
-
|
|
3343
|
+
l(this, $e, t);
|
|
3223
3344
|
}
|
|
3224
3345
|
get predicate() {
|
|
3225
|
-
return
|
|
3346
|
+
return n(this, ye);
|
|
3226
3347
|
}
|
|
3227
3348
|
set predicate(t) {
|
|
3228
|
-
|
|
3349
|
+
l(this, ye, t);
|
|
3229
3350
|
}
|
|
3230
3351
|
get onMismatch() {
|
|
3231
|
-
return
|
|
3352
|
+
return n(this, Ee);
|
|
3232
3353
|
}
|
|
3233
3354
|
set onMismatch(t) {
|
|
3234
|
-
|
|
3355
|
+
l(this, Ee, t);
|
|
3235
3356
|
}
|
|
3236
3357
|
createRenderRoot() {
|
|
3237
3358
|
return this;
|
|
@@ -3244,100 +3365,100 @@ let x = (qe = class extends $ {
|
|
|
3244
3365
|
if (!this.predicate) return "authenticated";
|
|
3245
3366
|
this.warnOnce(this.predicate);
|
|
3246
3367
|
const e = this.auth.state.user;
|
|
3247
|
-
return
|
|
3368
|
+
return _s(e, this.predicate) ? "authenticated" : this.onMismatch === "hidden" ? "hidden" : "unauthenticated";
|
|
3248
3369
|
}
|
|
3249
3370
|
/** Surfaces a malformed predicate once, rather than silently never matching. */
|
|
3250
3371
|
warnOnce(t) {
|
|
3251
3372
|
const e = JSON.stringify(t);
|
|
3252
3373
|
if (this.warnedFor !== e) {
|
|
3253
3374
|
this.warnedFor = e;
|
|
3254
|
-
for (const s of
|
|
3375
|
+
for (const s of ks(t))
|
|
3255
3376
|
console.warn(`[singlebase] <singlebase-authui-guard> predicate: ${s}`);
|
|
3256
3377
|
}
|
|
3257
3378
|
}
|
|
3258
3379
|
render() {
|
|
3259
3380
|
const t = this.activeState;
|
|
3260
3381
|
if (this.slot) {
|
|
3261
|
-
const e =
|
|
3262
|
-
return this.toggleAttribute("hidden", !e),
|
|
3382
|
+
const e = ti.includes(this.slot) && this.slot === t;
|
|
3383
|
+
return this.toggleAttribute("hidden", !e), r`<slot></slot>`;
|
|
3263
3384
|
}
|
|
3264
3385
|
this.toggleAttribute("hidden", !1);
|
|
3265
3386
|
for (const e of Array.from(this.children)) {
|
|
3266
3387
|
const s = e.getAttribute("slot");
|
|
3267
3388
|
e.toggleAttribute("hidden", s !== t);
|
|
3268
3389
|
}
|
|
3269
|
-
return
|
|
3390
|
+
return r`<slot></slot>`;
|
|
3270
3391
|
}
|
|
3271
|
-
},
|
|
3272
|
-
|
|
3392
|
+
}, $e = new WeakMap(), ye = new WeakMap(), Ee = new WeakMap(), Qe);
|
|
3393
|
+
Le([
|
|
3273
3394
|
p({ reflect: !0 })
|
|
3274
|
-
],
|
|
3275
|
-
|
|
3395
|
+
], F.prototype, "slot", 1);
|
|
3396
|
+
Le([
|
|
3276
3397
|
p({
|
|
3277
3398
|
converter: {
|
|
3278
|
-
fromAttribute: (
|
|
3279
|
-
if (!
|
|
3399
|
+
fromAttribute: (a) => {
|
|
3400
|
+
if (!a) return null;
|
|
3280
3401
|
try {
|
|
3281
|
-
return JSON.parse(
|
|
3402
|
+
return JSON.parse(a);
|
|
3282
3403
|
} catch {
|
|
3283
|
-
return console.error("[singlebase] guard predicate is not valid JSON:",
|
|
3404
|
+
return console.error("[singlebase] guard predicate is not valid JSON:", a), null;
|
|
3284
3405
|
}
|
|
3285
3406
|
},
|
|
3286
|
-
toAttribute: (
|
|
3407
|
+
toAttribute: (a) => a ? JSON.stringify(a) : null
|
|
3287
3408
|
}
|
|
3288
3409
|
})
|
|
3289
|
-
],
|
|
3290
|
-
|
|
3410
|
+
], F.prototype, "predicate", 1);
|
|
3411
|
+
Le([
|
|
3291
3412
|
p({ attribute: "on-mismatch" })
|
|
3292
|
-
],
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
],
|
|
3296
|
-
var
|
|
3297
|
-
for (var i = s > 1 ? void 0 : s ?
|
|
3298
|
-
(c =
|
|
3299
|
-
return s && i &&
|
|
3300
|
-
},
|
|
3301
|
-
const
|
|
3302
|
-
var
|
|
3303
|
-
let
|
|
3413
|
+
], F.prototype, "onMismatch", 1);
|
|
3414
|
+
F = Le([
|
|
3415
|
+
Te("singlebase-authui-guard")
|
|
3416
|
+
], F);
|
|
3417
|
+
var ds = Object.defineProperty, ei = Object.getOwnPropertyDescriptor, si = (a, t, e) => t in a ? ds(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, x = (a, t, e, s) => {
|
|
3418
|
+
for (var i = s > 1 ? void 0 : s ? ei(t, e) : t, h = a.length - 1, c; h >= 0; h--)
|
|
3419
|
+
(c = a[h]) && (i = (s ? c(t, e, i) : c(i)) || i);
|
|
3420
|
+
return s && i && ds(t, e, i), i;
|
|
3421
|
+
}, ii = (a, t, e) => si(a, t + "", e);
|
|
3422
|
+
const ai = "profile_photo";
|
|
3423
|
+
var Se, Ce, Pe, _e, ke, Xe;
|
|
3424
|
+
let P = (Xe = class extends y {
|
|
3304
3425
|
constructor() {
|
|
3305
3426
|
super(...arguments);
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3427
|
+
o(this, Se, "");
|
|
3428
|
+
o(this, Ce, "");
|
|
3429
|
+
o(this, Pe, !1);
|
|
3430
|
+
o(this, _e, "");
|
|
3431
|
+
o(this, ke, !1);
|
|
3311
3432
|
}
|
|
3312
3433
|
get path() {
|
|
3313
|
-
return
|
|
3434
|
+
return n(this, Se);
|
|
3314
3435
|
}
|
|
3315
3436
|
set path(t) {
|
|
3316
|
-
|
|
3437
|
+
l(this, Se, t);
|
|
3317
3438
|
}
|
|
3318
3439
|
get fallback() {
|
|
3319
|
-
return
|
|
3440
|
+
return n(this, Ce);
|
|
3320
3441
|
}
|
|
3321
3442
|
set fallback(t) {
|
|
3322
|
-
|
|
3443
|
+
l(this, Ce, t);
|
|
3323
3444
|
}
|
|
3324
3445
|
get avatar() {
|
|
3325
|
-
return
|
|
3446
|
+
return n(this, Pe);
|
|
3326
3447
|
}
|
|
3327
3448
|
set avatar(t) {
|
|
3328
|
-
|
|
3449
|
+
l(this, Pe, t);
|
|
3329
3450
|
}
|
|
3330
3451
|
get alt() {
|
|
3331
|
-
return
|
|
3452
|
+
return n(this, _e);
|
|
3332
3453
|
}
|
|
3333
3454
|
set alt(t) {
|
|
3334
|
-
|
|
3455
|
+
l(this, _e, t);
|
|
3335
3456
|
}
|
|
3336
3457
|
get imageFailed() {
|
|
3337
|
-
return
|
|
3458
|
+
return n(this, ke);
|
|
3338
3459
|
}
|
|
3339
3460
|
set imageFailed(t) {
|
|
3340
|
-
|
|
3461
|
+
l(this, ke, t);
|
|
3341
3462
|
}
|
|
3342
3463
|
willUpdate(t) {
|
|
3343
3464
|
super.willUpdate(t), (t.has("path") || t.has("avatar")) && (this.imageFailed = !1);
|
|
@@ -3350,41 +3471,41 @@ let S = (Ve = class extends $ {
|
|
|
3350
3471
|
get textValue() {
|
|
3351
3472
|
const t = this.profile;
|
|
3352
3473
|
if (!t || !this.path) return "";
|
|
3353
|
-
const e =
|
|
3474
|
+
const e = Ke(t, this.path);
|
|
3354
3475
|
return e == null || e === "" ? "" : Array.isArray(e) ? e.filter((s) => s != null).join(", ") : typeof e == "object" ? "" : String(e);
|
|
3355
3476
|
}
|
|
3356
3477
|
get avatarSrc() {
|
|
3357
3478
|
const t = this.profile;
|
|
3358
3479
|
if (!t) return "";
|
|
3359
|
-
const e =
|
|
3480
|
+
const e = Ke(t, this.path || ai);
|
|
3360
3481
|
return typeof e == "string" ? e : "";
|
|
3361
3482
|
}
|
|
3362
3483
|
render() {
|
|
3363
3484
|
if (this.auth.state.status === "loading") return d;
|
|
3364
3485
|
if (this.avatar) return this.renderAvatar();
|
|
3365
3486
|
const t = this.textValue;
|
|
3366
|
-
return t ?
|
|
3487
|
+
return t ? r`<span part="text">${t}</span>` : this.fallback ? r`<span part="text">${this.fallback}</span>` : d;
|
|
3367
3488
|
}
|
|
3368
3489
|
renderAvatar() {
|
|
3369
3490
|
const t = this.profile;
|
|
3370
3491
|
if (!t) return d;
|
|
3371
3492
|
const e = this.avatarSrc;
|
|
3372
|
-
return e && !this.imageFailed ?
|
|
3493
|
+
return e && !this.imageFailed ? r`<img
|
|
3373
3494
|
part="avatar-image"
|
|
3374
3495
|
src=${e}
|
|
3375
3496
|
alt=${this.alt}
|
|
3376
3497
|
@error=${() => this.imageFailed = !0}
|
|
3377
|
-
/>` :
|
|
3498
|
+
/>` : r`<span
|
|
3378
3499
|
part="avatar-initials"
|
|
3379
3500
|
class="initials"
|
|
3380
3501
|
aria-hidden=${this.alt ? "false" : "true"}
|
|
3381
|
-
>${
|
|
3502
|
+
>${ns(t)}</span
|
|
3382
3503
|
>`;
|
|
3383
3504
|
}
|
|
3384
|
-
},
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3505
|
+
}, Se = new WeakMap(), Ce = new WeakMap(), Pe = new WeakMap(), _e = new WeakMap(), ke = new WeakMap(), Xe);
|
|
3506
|
+
ii(P, "styles", [
|
|
3507
|
+
...y.styles,
|
|
3508
|
+
ts`
|
|
3388
3509
|
/* Text sits in a sentence; an avatar is a box the host sizes. */
|
|
3389
3510
|
:host {
|
|
3390
3511
|
display: inline;
|
|
@@ -3424,38 +3545,38 @@ Vs(S, "styles", [
|
|
|
3424
3545
|
}
|
|
3425
3546
|
`
|
|
3426
3547
|
]);
|
|
3427
|
-
|
|
3548
|
+
x([
|
|
3428
3549
|
p()
|
|
3429
|
-
],
|
|
3430
|
-
|
|
3550
|
+
], P.prototype, "path", 1);
|
|
3551
|
+
x([
|
|
3431
3552
|
p()
|
|
3432
|
-
],
|
|
3433
|
-
|
|
3553
|
+
], P.prototype, "fallback", 1);
|
|
3554
|
+
x([
|
|
3434
3555
|
p({ type: Boolean, reflect: !0 })
|
|
3435
|
-
],
|
|
3436
|
-
|
|
3556
|
+
], P.prototype, "avatar", 1);
|
|
3557
|
+
x([
|
|
3437
3558
|
p()
|
|
3438
|
-
],
|
|
3439
|
-
|
|
3559
|
+
], P.prototype, "alt", 1);
|
|
3560
|
+
x([
|
|
3440
3561
|
m()
|
|
3441
|
-
],
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
],
|
|
3562
|
+
], P.prototype, "imageFailed", 1);
|
|
3563
|
+
P = x([
|
|
3564
|
+
Te("singlebase-authui-display")
|
|
3565
|
+
], P);
|
|
3445
3566
|
export {
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3567
|
+
Ts as A,
|
|
3568
|
+
De as S,
|
|
3569
|
+
v as a,
|
|
3570
|
+
S as b,
|
|
3571
|
+
P as c,
|
|
3572
|
+
F as d,
|
|
3452
3573
|
u as e,
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3574
|
+
Ve as f,
|
|
3575
|
+
rs as g,
|
|
3576
|
+
We as h,
|
|
3577
|
+
ns as i,
|
|
3578
|
+
Zs as j,
|
|
3579
|
+
Ye as k,
|
|
3580
|
+
Os as r
|
|
3460
3581
|
};
|
|
3461
|
-
//# sourceMappingURL=authui-display-
|
|
3582
|
+
//# sourceMappingURL=authui-display-CRUABt43.js.map
|