@authowl/react 0.21.1 → 0.22.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/{TeamsSection-SHXAL64Q.js → TeamsSection-ZQDNMWV3.js} +1 -1
- package/dist/captcha-loader-VNULARCZ.js +68 -0
- package/dist/captcha-providers-STYFL25P.js +71 -0
- package/dist/{chunk-K67DJJHP.js → chunk-PUJV7S6G.js} +9 -6
- package/dist/index.cjs +1108 -926
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +872 -849
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
useT,
|
|
38
38
|
useUser,
|
|
39
39
|
useWaitlist
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-PUJV7S6G.js";
|
|
41
41
|
|
|
42
42
|
// src/project-capabilities.ts
|
|
43
43
|
import {
|
|
@@ -356,104 +356,19 @@ function PasskeyButton({ redirectTo, onSignedIn }) {
|
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
// src/components/ForgotPassword.tsx
|
|
359
|
-
import * as React5 from "react";
|
|
360
|
-
|
|
361
|
-
// src/components/AuthChallenge.tsx
|
|
362
359
|
import * as React4 from "react";
|
|
363
360
|
|
|
364
|
-
// src/components/
|
|
361
|
+
// src/components/AuthChallenge.tsx
|
|
365
362
|
import * as React3 from "react";
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
var
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
function loadTurnstile() {
|
|
372
|
-
if (window.turnstile) return Promise.resolve(window.turnstile);
|
|
373
|
-
if (loader) return loader;
|
|
374
|
-
loader = new Promise((resolve, reject) => {
|
|
375
|
-
const existing = document.querySelector(`script[src="${SCRIPT_URL}"]`);
|
|
376
|
-
const script = existing ?? document.createElement("script");
|
|
377
|
-
const cleanup = () => {
|
|
378
|
-
clearTimeout(timeout);
|
|
379
|
-
script.removeEventListener("load", loaded);
|
|
380
|
-
script.removeEventListener("error", failed);
|
|
381
|
-
};
|
|
382
|
-
const loaded = () => {
|
|
383
|
-
cleanup();
|
|
384
|
-
if (window.turnstile) {
|
|
385
|
-
resolve(window.turnstile);
|
|
386
|
-
} else {
|
|
387
|
-
reject(new Error("Turnstile unavailable"));
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
const failed = () => {
|
|
391
|
-
cleanup();
|
|
392
|
-
if (!existing) script.remove();
|
|
393
|
-
reject(new Error("Turnstile failed to load"));
|
|
394
|
-
};
|
|
395
|
-
const timeout = setTimeout(failed, SCRIPT_LOAD_TIMEOUT_MS);
|
|
396
|
-
script.addEventListener("load", loaded, { once: true });
|
|
397
|
-
script.addEventListener("error", failed, { once: true });
|
|
398
|
-
if (!existing) {
|
|
399
|
-
script.src = SCRIPT_URL;
|
|
400
|
-
script.async = true;
|
|
401
|
-
script.defer = true;
|
|
402
|
-
const nonce = document.querySelector("script[nonce]")?.nonce;
|
|
403
|
-
if (nonce) script.nonce = nonce;
|
|
404
|
-
document.head.appendChild(script);
|
|
405
|
-
}
|
|
406
|
-
}).catch((error) => {
|
|
407
|
-
loader = null;
|
|
408
|
-
throw error;
|
|
409
|
-
});
|
|
410
|
-
return loader;
|
|
411
|
-
}
|
|
412
|
-
function Turnstile({
|
|
413
|
-
siteKey,
|
|
414
|
-
theme,
|
|
415
|
-
onToken,
|
|
416
|
-
onUnavailable
|
|
417
|
-
}) {
|
|
418
|
-
const container = React3.useRef(null);
|
|
419
|
-
const callbacks = React3.useRef({ onToken, onUnavailable });
|
|
420
|
-
callbacks.current = { onToken, onUnavailable };
|
|
421
|
-
React3.useEffect(() => {
|
|
422
|
-
callbacks.current.onToken(null);
|
|
423
|
-
if (!siteKey) {
|
|
424
|
-
callbacks.current.onToken(LOCAL_TURNSTILE_TEST_TOKEN);
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
let active = true;
|
|
428
|
-
let widget = null;
|
|
429
|
-
void loadTurnstile().then((api) => {
|
|
430
|
-
if (!active || !container.current) return;
|
|
431
|
-
const id = api.render(container.current, {
|
|
432
|
-
sitekey: siteKey,
|
|
433
|
-
theme: theme === "system" ? "auto" : theme,
|
|
434
|
-
size: "flexible",
|
|
435
|
-
callback: (token) => callbacks.current.onToken(token),
|
|
436
|
-
"expired-callback": () => callbacks.current.onToken(null),
|
|
437
|
-
"error-callback": () => {
|
|
438
|
-
callbacks.current.onToken(null);
|
|
439
|
-
callbacks.current.onUnavailable();
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
widget = { api, id };
|
|
443
|
-
}).catch(() => {
|
|
444
|
-
if (active) callbacks.current.onUnavailable();
|
|
445
|
-
});
|
|
446
|
-
return () => {
|
|
447
|
-
active = false;
|
|
448
|
-
if (widget) widget.api.remove(widget.id);
|
|
449
|
-
};
|
|
450
|
-
}, [siteKey, theme]);
|
|
451
|
-
if (!siteKey) return null;
|
|
452
|
-
return /* @__PURE__ */ jsx4("div", { className: "ba-turnstile", ref: container, "data-testid": "phoneotp-turnstile" });
|
|
363
|
+
|
|
364
|
+
// src/components/captcha-provider-ids.ts
|
|
365
|
+
var CAPTCHA_PROVIDER_IDS = ["turnstile", "hcaptcha", "recaptcha-v2"];
|
|
366
|
+
function isSupportedCaptchaProvider(provider) {
|
|
367
|
+
return CAPTCHA_PROVIDER_IDS.includes(provider);
|
|
453
368
|
}
|
|
454
369
|
|
|
455
370
|
// src/components/AuthChallenge.tsx
|
|
456
|
-
import { jsx as
|
|
371
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
457
372
|
var AUTH_CHALLENGE_ACTIONS = {
|
|
458
373
|
signUp: "auth_signup",
|
|
459
374
|
signIn: "auth_signin",
|
|
@@ -468,38 +383,53 @@ var challengeError = {
|
|
|
468
383
|
code: "BOT_CHALLENGE_FAILED",
|
|
469
384
|
message: "Human verification failed."
|
|
470
385
|
};
|
|
471
|
-
function
|
|
386
|
+
function captchaTheme(root, fallback) {
|
|
472
387
|
const rendered = root?.dataset.authowlTheme;
|
|
473
388
|
if (rendered === "light" || rendered === "dark") return rendered;
|
|
474
389
|
if (fallback === "light" || fallback === "dark") return fallback;
|
|
475
390
|
return "auto";
|
|
476
391
|
}
|
|
477
392
|
function useAuthChallenge() {
|
|
478
|
-
const { config, isLoading } = usePublicConfig();
|
|
393
|
+
const { config, isLoading, retry } = usePublicConfig();
|
|
479
394
|
const t = useT();
|
|
480
|
-
const container =
|
|
481
|
-
const active =
|
|
482
|
-
const [status, setStatus] =
|
|
483
|
-
const
|
|
484
|
-
const
|
|
395
|
+
const container = React3.useRef(null);
|
|
396
|
+
const active = React3.useRef(null);
|
|
397
|
+
const [status, setStatus] = React3.useState("idle");
|
|
398
|
+
const captcha = config?.captcha ?? null;
|
|
399
|
+
const providerSupported = captcha ? isSupportedCaptchaProvider(captcha.provider) : false;
|
|
400
|
+
const unavailableProvider = captcha && !providerSupported ? captcha.provider : null;
|
|
401
|
+
const refetched = React3.useRef(null);
|
|
402
|
+
const refetchIfConfigMayBeStale = React3.useCallback(() => {
|
|
403
|
+
if (!config || refetched.current === config) return;
|
|
404
|
+
refetched.current = config;
|
|
405
|
+
retry();
|
|
406
|
+
}, [config, retry]);
|
|
407
|
+
const removeActive = React3.useCallback((reason) => {
|
|
485
408
|
const current = active.current;
|
|
486
409
|
active.current = null;
|
|
487
410
|
if (!current) return;
|
|
488
|
-
current.
|
|
411
|
+
current.adapter.teardown(current.api, current.id);
|
|
489
412
|
if (reason) current.reject(reason);
|
|
490
413
|
}, []);
|
|
491
|
-
|
|
492
|
-
() => () => removeActive(new Error("
|
|
414
|
+
React3.useEffect(
|
|
415
|
+
() => () => removeActive(new Error("Captcha challenge was cancelled")),
|
|
493
416
|
[removeActive]
|
|
494
417
|
);
|
|
495
|
-
const tokenFor =
|
|
418
|
+
const tokenFor = React3.useCallback(
|
|
496
419
|
async (action) => {
|
|
497
|
-
if (!
|
|
420
|
+
if (!captcha) return null;
|
|
421
|
+
if (!providerSupported) throw new Error(`Unsupported captcha provider: ${captcha.provider}`);
|
|
498
422
|
setStatus("checking");
|
|
499
|
-
removeActive(new Error("
|
|
423
|
+
removeActive(new Error("Captcha challenge was replaced"));
|
|
500
424
|
try {
|
|
501
|
-
const
|
|
502
|
-
|
|
425
|
+
const [{ loadCaptcha }, { captchaAdapterFor }] = await Promise.all([
|
|
426
|
+
import("./captcha-loader-VNULARCZ.js"),
|
|
427
|
+
import("./captcha-providers-STYFL25P.js")
|
|
428
|
+
]);
|
|
429
|
+
const adapter = captchaAdapterFor(captcha.provider);
|
|
430
|
+
if (!adapter) throw new Error(`Unsupported captcha provider: ${captcha.provider}`);
|
|
431
|
+
const api = await loadCaptcha(adapter);
|
|
432
|
+
if (!container.current) throw new Error("Captcha container unavailable");
|
|
503
433
|
return await new Promise((resolve, reject) => {
|
|
504
434
|
let settled = false;
|
|
505
435
|
const finish = (outcome) => {
|
|
@@ -507,27 +437,29 @@ function useAuthChallenge() {
|
|
|
507
437
|
settled = true;
|
|
508
438
|
const current = active.current;
|
|
509
439
|
active.current = null;
|
|
510
|
-
if (current) current.
|
|
440
|
+
if (current) current.adapter.teardown(current.api, current.id);
|
|
511
441
|
if ("token" in outcome) resolve(outcome.token);
|
|
512
442
|
else reject(outcome.error);
|
|
513
443
|
};
|
|
514
|
-
const fail = () => finish({ error: new Error("
|
|
444
|
+
const fail = () => finish({ error: new Error("Captcha challenge failed") });
|
|
515
445
|
const root = container.current.closest(".authowl-root");
|
|
446
|
+
const optionalFailureCallbacks = captcha.provider === "turnstile" ? {
|
|
447
|
+
"timeout-callback": fail,
|
|
448
|
+
"unsupported-callback": fail
|
|
449
|
+
} : {};
|
|
516
450
|
const id = api.render(container.current, {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
language: root?.dataset.authowlLocale ?? config?.locale,
|
|
451
|
+
...adapter.invisibleRenderOptions({
|
|
452
|
+
siteKey: captcha.siteKey,
|
|
453
|
+
theme: captchaTheme(root, config?.branding?.theme),
|
|
454
|
+
action,
|
|
455
|
+
language: root?.dataset.authowlLocale ?? config?.locale
|
|
456
|
+
}),
|
|
524
457
|
callback: (token) => finish({ token }),
|
|
525
458
|
"expired-callback": fail,
|
|
526
459
|
"error-callback": fail,
|
|
527
|
-
|
|
528
|
-
"unsupported-callback": fail
|
|
460
|
+
...optionalFailureCallbacks
|
|
529
461
|
});
|
|
530
|
-
active.current = { api, id, reject };
|
|
462
|
+
active.current = { adapter, api, id, reject };
|
|
531
463
|
try {
|
|
532
464
|
api.execute(id);
|
|
533
465
|
} catch {
|
|
@@ -538,9 +470,9 @@ function useAuthChallenge() {
|
|
|
538
470
|
setStatus("idle");
|
|
539
471
|
}
|
|
540
472
|
},
|
|
541
|
-
[config?.branding?.theme, config?.locale,
|
|
473
|
+
[captcha, config?.branding?.theme, config?.locale, providerSupported, removeActive]
|
|
542
474
|
);
|
|
543
|
-
const run =
|
|
475
|
+
const run = React3.useCallback(
|
|
544
476
|
async (action, request) => {
|
|
545
477
|
if (isLoading) {
|
|
546
478
|
return {
|
|
@@ -550,37 +482,40 @@ function useAuthChallenge() {
|
|
|
550
482
|
}
|
|
551
483
|
try {
|
|
552
484
|
const token = await tokenFor(action);
|
|
553
|
-
|
|
485
|
+
const result = await request(token ? { authChallengeToken: token } : void 0);
|
|
486
|
+
if (result?.error?.code === challengeError.code) refetchIfConfigMayBeStale();
|
|
487
|
+
return result;
|
|
554
488
|
} catch {
|
|
555
489
|
setStatus("failed");
|
|
490
|
+
refetchIfConfigMayBeStale();
|
|
556
491
|
return {
|
|
557
492
|
data: null,
|
|
558
493
|
error: challengeError
|
|
559
494
|
};
|
|
560
495
|
}
|
|
561
496
|
},
|
|
562
|
-
[isLoading, tokenFor]
|
|
497
|
+
[isLoading, refetchIfConfigMayBeStale, tokenFor]
|
|
563
498
|
);
|
|
564
|
-
const control =
|
|
565
|
-
/* @__PURE__ */
|
|
566
|
-
/* @__PURE__ */
|
|
499
|
+
const control = captcha ? /* @__PURE__ */ jsxs4("div", { className: "ba-auth-challenge", "data-testid": "auth-challenge", children: [
|
|
500
|
+
providerSupported ? /* @__PURE__ */ jsx4("div", { className: "ba-turnstile", ref: container }) : null,
|
|
501
|
+
unavailableProvider ? /* @__PURE__ */ jsx4(FormError, { "data-testid": "auth-challenge-unsupported", children: t("authChallenge.error.unsupportedProvider", { provider: unavailableProvider }) }) : /* @__PURE__ */ jsx4("p", { className: "ba-sr-only", role: "status", "aria-live": "polite", children: status === "checking" ? t("authChallenge.checking") : status === "failed" ? t("authChallenge.error.failed") : "" })
|
|
567
502
|
] }) : null;
|
|
568
503
|
return { run, control, configPending: isLoading };
|
|
569
504
|
}
|
|
570
505
|
|
|
571
506
|
// src/components/ForgotPassword.tsx
|
|
572
|
-
import { jsx as
|
|
507
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
573
508
|
function ForgotPassword({ resetPasswordUrl, onBack }) {
|
|
574
509
|
const t = useT();
|
|
575
510
|
const { requestPasswordReset } = usePasswordReset();
|
|
576
511
|
const { pending, error, run } = useSubmitAction();
|
|
577
512
|
const authChallenge = useAuthChallenge();
|
|
578
|
-
const [email, setEmail] =
|
|
579
|
-
const [sent, setSent] =
|
|
513
|
+
const [email, setEmail] = React4.useState("");
|
|
514
|
+
const [sent, setSent] = React4.useState(false);
|
|
580
515
|
if (sent) {
|
|
581
516
|
return /* @__PURE__ */ jsxs5("div", { className: "ba-fields", "data-testid": "forgot-sent", children: [
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
onBack && /* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ jsx5("p", { className: "ba-muted", children: richMessage(t("forgotPassword.sent"), { email: /* @__PURE__ */ jsx5(Bidi, { children: email }) }) }),
|
|
518
|
+
onBack && /* @__PURE__ */ jsx5("button", { type: "button", className: "ba-link-button", onClick: onBack, children: t("forgotPassword.backToSignIn") })
|
|
584
519
|
] });
|
|
585
520
|
}
|
|
586
521
|
return /* @__PURE__ */ jsxs5(
|
|
@@ -599,7 +534,7 @@ function ForgotPassword({ resetPasswordUrl, onBack }) {
|
|
|
599
534
|
children: [
|
|
600
535
|
/* @__PURE__ */ jsxs5("label", { className: "ba-label", children: [
|
|
601
536
|
t("common.emailLabel"),
|
|
602
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ jsx5(
|
|
603
538
|
"input",
|
|
604
539
|
{
|
|
605
540
|
className: "ba-input",
|
|
@@ -612,25 +547,25 @@ function ForgotPassword({ resetPasswordUrl, onBack }) {
|
|
|
612
547
|
)
|
|
613
548
|
] }),
|
|
614
549
|
authChallenge.control,
|
|
615
|
-
/* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ jsx5(FormError, { children: error }),
|
|
551
|
+
/* @__PURE__ */ jsx5(
|
|
617
552
|
"button",
|
|
618
553
|
{
|
|
619
554
|
className: "ba-button",
|
|
620
555
|
type: "submit",
|
|
621
556
|
disabled: pending || authChallenge.configPending,
|
|
622
557
|
"aria-busy": pending || void 0,
|
|
623
|
-
children: /* @__PURE__ */
|
|
558
|
+
children: /* @__PURE__ */ jsx5(Busy, { busy: pending, label: t("common.sending"), children: t("forgotPassword.submit") })
|
|
624
559
|
}
|
|
625
560
|
),
|
|
626
|
-
onBack && /* @__PURE__ */
|
|
561
|
+
onBack && /* @__PURE__ */ jsx5("button", { type: "button", className: "ba-link-button", onClick: onBack, children: t("forgotPassword.backToSignIn") })
|
|
627
562
|
]
|
|
628
563
|
}
|
|
629
564
|
);
|
|
630
565
|
}
|
|
631
566
|
|
|
632
567
|
// src/components/OtpCodeForm.tsx
|
|
633
|
-
import { jsx as
|
|
568
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
634
569
|
function OtpCodeForm({
|
|
635
570
|
email,
|
|
636
571
|
code,
|
|
@@ -653,8 +588,8 @@ function OtpCodeForm({
|
|
|
653
588
|
},
|
|
654
589
|
children: [
|
|
655
590
|
/* @__PURE__ */ jsxs6("label", { className: "ba-label", children: [
|
|
656
|
-
richMessage(t("emailOtp.codeLabel"), { email: /* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
591
|
+
richMessage(t("emailOtp.codeLabel"), { email: /* @__PURE__ */ jsx6(Bidi, { children: email }) }),
|
|
592
|
+
/* @__PURE__ */ jsx6(
|
|
658
593
|
"input",
|
|
659
594
|
{
|
|
660
595
|
className: "ba-input",
|
|
@@ -667,24 +602,24 @@ function OtpCodeForm({
|
|
|
667
602
|
}
|
|
668
603
|
)
|
|
669
604
|
] }),
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ jsx6(FormError, { children: error }),
|
|
606
|
+
/* @__PURE__ */ jsx6("button", { className: "ba-button", type: "submit", disabled: pending, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx6(Busy, { busy: pending, label: t("common.verifying"), children: t("emailOtp.verifySubmit") }) }),
|
|
607
|
+
/* @__PURE__ */ jsx6("button", { type: "button", className: "ba-link-button", onClick: onChangeEmail, children: t("emailOtp.changeEmail") })
|
|
673
608
|
]
|
|
674
609
|
}
|
|
675
610
|
);
|
|
676
611
|
}
|
|
677
612
|
|
|
678
613
|
// src/components/MFAChallenge.tsx
|
|
679
|
-
import * as
|
|
680
|
-
import { jsx as
|
|
614
|
+
import * as React5 from "react";
|
|
615
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
681
616
|
function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
682
617
|
const t = useT();
|
|
683
618
|
const { verifyTotp, verifyBackupCode, sendOtp, verifyOtp } = useMFA();
|
|
684
619
|
const { pending, error, setError, run } = useSubmitAction();
|
|
685
|
-
const [mode, setMode] =
|
|
686
|
-
const [code, setCode] =
|
|
687
|
-
const [trustDevice, setTrustDevice] =
|
|
620
|
+
const [mode, setMode] = React5.useState("totp");
|
|
621
|
+
const [code, setCode] = React5.useState("");
|
|
622
|
+
const [trustDevice, setTrustDevice] = React5.useState(false);
|
|
688
623
|
const switchMode = (next) => {
|
|
689
624
|
setMode(next);
|
|
690
625
|
setCode("");
|
|
@@ -708,11 +643,11 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
708
643
|
const hint = mode === "totp" ? t("mfa.challenge.totpHint") : mode === "backup" ? t("mfa.challenge.backupHint") : t("mfa.challenge.otpHint");
|
|
709
644
|
const label2 = mode === "totp" ? t("mfa.challenge.totpLabel") : mode === "backup" ? t("mfa.challenge.backupLabel") : t("mfa.challenge.otpLabel");
|
|
710
645
|
return /* @__PURE__ */ jsxs7("form", { method: "post", className: "ba-fields", "data-testid": "mfa-challenge", onSubmit: submit, children: [
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ jsx7("h2", { className: "ba-title", children: t("mfa.challenge.title") }),
|
|
647
|
+
/* @__PURE__ */ jsx7("p", { className: "ba-muted", children: hint }),
|
|
713
648
|
/* @__PURE__ */ jsxs7("label", { className: "ba-label", children: [
|
|
714
649
|
label2,
|
|
715
|
-
/* @__PURE__ */
|
|
650
|
+
/* @__PURE__ */ jsx7(
|
|
716
651
|
"input",
|
|
717
652
|
{
|
|
718
653
|
className: "ba-input",
|
|
@@ -730,24 +665,24 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
730
665
|
] }),
|
|
731
666
|
mode !== "backup" && allowTrustDevice && /* @__PURE__ */ jsxs7("label", { className: "ba-consent ba-consent-centered", children: [
|
|
732
667
|
/* @__PURE__ */ jsxs7("span", { className: "ba-checkbox-control", children: [
|
|
733
|
-
/* @__PURE__ */
|
|
734
|
-
/* @__PURE__ */
|
|
668
|
+
/* @__PURE__ */ jsx7("input", { className: "ba-checkbox", type: "checkbox", checked: trustDevice, onChange: (e) => setTrustDevice(e.target.checked) }),
|
|
669
|
+
/* @__PURE__ */ jsx7("span", { className: "ba-checkbox-visual", "aria-hidden": "true", children: /* @__PURE__ */ jsx7("span", { className: "ba-checkbox-check" }) })
|
|
735
670
|
] }),
|
|
736
|
-
/* @__PURE__ */
|
|
671
|
+
/* @__PURE__ */ jsx7("span", { children: t("mfa.challenge.trustDevice", { days: 30 }) })
|
|
737
672
|
] }),
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
mode !== "totp" && /* @__PURE__ */
|
|
741
|
-
mode !== "backup" && /* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
673
|
+
/* @__PURE__ */ jsx7(FormError, { children: error }),
|
|
674
|
+
/* @__PURE__ */ jsx7("button", { className: "ba-button", type: "submit", disabled: pending || !code, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx7(Busy, { busy: pending, label: t("common.verifying"), children: t("mfa.challenge.submit") }) }),
|
|
675
|
+
mode !== "totp" && /* @__PURE__ */ jsx7("button", { type: "button", className: "ba-link-button", onClick: () => switchMode("totp"), children: t("mfa.challenge.useTotp") }),
|
|
676
|
+
mode !== "backup" && /* @__PURE__ */ jsx7("button", { type: "button", className: "ba-link-button", onClick: () => switchMode("backup"), children: t("mfa.challenge.useBackup") }),
|
|
677
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "ba-link-button", disabled: pending, onClick: requestOtp, children: t(mode === "otp" ? "mfa.challenge.resendOtp" : "mfa.challenge.useEmailOtp") })
|
|
743
678
|
] });
|
|
744
679
|
}
|
|
745
680
|
|
|
746
681
|
// src/components/mfa-enrollment-step.tsx
|
|
747
|
-
import * as
|
|
682
|
+
import * as React8 from "react";
|
|
748
683
|
|
|
749
684
|
// src/components/MFAEnrollment.tsx
|
|
750
|
-
import * as
|
|
685
|
+
import * as React7 from "react";
|
|
751
686
|
|
|
752
687
|
// src/components/mfa-enrollment.ts
|
|
753
688
|
function shouldDiscardSetup(args) {
|
|
@@ -756,12 +691,12 @@ function shouldDiscardSetup(args) {
|
|
|
756
691
|
}
|
|
757
692
|
|
|
758
693
|
// src/components/QrCode.tsx
|
|
759
|
-
import * as
|
|
760
|
-
import { jsx as
|
|
694
|
+
import * as React6 from "react";
|
|
695
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
761
696
|
function QrCode({ value, size = 200 }) {
|
|
762
697
|
const t = useT();
|
|
763
|
-
const [path, setPath] =
|
|
764
|
-
|
|
698
|
+
const [path, setPath] = React6.useState(null);
|
|
699
|
+
React6.useEffect(() => {
|
|
765
700
|
let active = true;
|
|
766
701
|
setPath(null);
|
|
767
702
|
void import("./qr-ZNG4MAV5.js").then(
|
|
@@ -790,15 +725,15 @@ function QrCode({ value, size = 200 }) {
|
|
|
790
725
|
shapeRendering: "crispEdges",
|
|
791
726
|
className: "ba-qr",
|
|
792
727
|
children: [
|
|
793
|
-
/* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ jsx8("rect", { width: dim, height: dim, fill: "#ffffff" }),
|
|
729
|
+
/* @__PURE__ */ jsx8("g", { transform: `translate(${margin} ${margin})`, children: /* @__PURE__ */ jsx8("path", { d: path.d, fill: "#000000" }) })
|
|
795
730
|
]
|
|
796
731
|
}
|
|
797
732
|
);
|
|
798
733
|
}
|
|
799
734
|
|
|
800
735
|
// src/components/MFAEnrollment.tsx
|
|
801
|
-
import { jsx as
|
|
736
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
802
737
|
function secretFromUri(uri) {
|
|
803
738
|
try {
|
|
804
739
|
return new URL(uri).searchParams.get("secret");
|
|
@@ -811,11 +746,11 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
811
746
|
const { enable, verifyTotp } = useMFA();
|
|
812
747
|
const { user, isLoaded } = useUser();
|
|
813
748
|
const { pending, error, run } = useSubmitAction();
|
|
814
|
-
const [password, setPassword] =
|
|
815
|
-
const [setup, setSetup] =
|
|
816
|
-
const [code, setCode] =
|
|
817
|
-
const [done, setDone] =
|
|
818
|
-
const setupOwnerId =
|
|
749
|
+
const [password, setPassword] = React7.useState("");
|
|
750
|
+
const [setup, setSetup] = React7.useState(null);
|
|
751
|
+
const [code, setCode] = React7.useState("");
|
|
752
|
+
const [done, setDone] = React7.useState(false);
|
|
753
|
+
const setupOwnerId = React7.useRef(null);
|
|
819
754
|
const userId = user?.id ?? null;
|
|
820
755
|
const stale = shouldDiscardSetup({
|
|
821
756
|
isLoaded,
|
|
@@ -824,7 +759,7 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
824
759
|
currentUserId: userId
|
|
825
760
|
});
|
|
826
761
|
const activeSetup = stale ? null : setup;
|
|
827
|
-
|
|
762
|
+
React7.useEffect(() => {
|
|
828
763
|
if (stale) {
|
|
829
764
|
setSetup(null);
|
|
830
765
|
setPassword("");
|
|
@@ -833,18 +768,18 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
833
768
|
}, [stale]);
|
|
834
769
|
if (done) {
|
|
835
770
|
return /* @__PURE__ */ jsxs9("div", { className: "ba-fields", "data-testid": "mfa-enroll-done", children: [
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ jsx9("h2", { className: "ba-title", children: t("mfa.enroll.doneTitle") }),
|
|
772
|
+
/* @__PURE__ */ jsx9("p", { className: "ba-muted", children: t("mfa.enroll.doneBody") })
|
|
838
773
|
] });
|
|
839
774
|
}
|
|
840
775
|
if (!activeSetup) {
|
|
841
776
|
if (!isLoaded) {
|
|
842
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ jsx9("div", { className: "ba-fields", "data-testid": "mfa-enroll-loading", "aria-busy": "true", children: /* @__PURE__ */ jsx9("div", { className: "ba-skeleton" }) });
|
|
843
778
|
}
|
|
844
779
|
if (user?.twoFactorEnabled) {
|
|
845
780
|
return /* @__PURE__ */ jsxs9("div", { className: "ba-fields", "data-testid": "mfa-enroll-active", children: [
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ jsx9("h2", { className: "ba-title", children: t("mfa.enroll.activeTitle") }),
|
|
782
|
+
/* @__PURE__ */ jsx9("p", { className: "ba-muted", children: t("mfa.enroll.activeBody") })
|
|
848
783
|
] });
|
|
849
784
|
}
|
|
850
785
|
return /* @__PURE__ */ jsxs9(
|
|
@@ -864,11 +799,11 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
864
799
|
});
|
|
865
800
|
},
|
|
866
801
|
children: [
|
|
867
|
-
title !== null && /* @__PURE__ */
|
|
868
|
-
/* @__PURE__ */
|
|
802
|
+
title !== null && /* @__PURE__ */ jsx9("h2", { className: "ba-title", children: title ?? t("mfa.enroll.title") }),
|
|
803
|
+
/* @__PURE__ */ jsx9("p", { className: "ba-muted", children: t("mfa.enroll.passwordHint") }),
|
|
869
804
|
/* @__PURE__ */ jsxs9("label", { className: "ba-label", children: [
|
|
870
805
|
t("common.passwordLabel"),
|
|
871
|
-
/* @__PURE__ */
|
|
806
|
+
/* @__PURE__ */ jsx9(
|
|
872
807
|
"input",
|
|
873
808
|
{
|
|
874
809
|
className: "ba-input",
|
|
@@ -880,27 +815,27 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
880
815
|
}
|
|
881
816
|
)
|
|
882
817
|
] }),
|
|
883
|
-
/* @__PURE__ */
|
|
884
|
-
/* @__PURE__ */
|
|
818
|
+
/* @__PURE__ */ jsx9(FormError, { children: error }),
|
|
819
|
+
/* @__PURE__ */ jsx9("button", { className: "ba-button", type: "submit", disabled: pending || !password, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx9(Busy, { busy: pending, label: t("mfa.enroll.startPending"), children: t("common.continue") }) })
|
|
885
820
|
]
|
|
886
821
|
}
|
|
887
822
|
);
|
|
888
823
|
}
|
|
889
824
|
const secret = secretFromUri(activeSetup.totpURI);
|
|
890
825
|
return /* @__PURE__ */ jsxs9("div", { className: "ba-fields", "data-testid": "mfa-enroll-verify", children: [
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
894
|
-
secret && /* @__PURE__ */
|
|
895
|
-
secret: /* @__PURE__ */
|
|
826
|
+
/* @__PURE__ */ jsx9("h2", { className: "ba-title", children: t("mfa.enroll.scanQrTitle") }),
|
|
827
|
+
/* @__PURE__ */ jsx9("p", { className: "ba-muted", children: t("mfa.enroll.scanQrHint") }),
|
|
828
|
+
/* @__PURE__ */ jsx9(QrCode, { value: activeSetup.totpURI }),
|
|
829
|
+
secret && /* @__PURE__ */ jsx9("p", { className: "ba-muted", children: richMessage(t("mfa.enroll.manualKey"), {
|
|
830
|
+
secret: /* @__PURE__ */ jsx9("code", { className: "ba-code", children: /* @__PURE__ */ jsx9(Bidi, { children: secret }) })
|
|
896
831
|
}) }),
|
|
897
832
|
/* @__PURE__ */ jsxs9("div", { children: [
|
|
898
833
|
/* @__PURE__ */ jsxs9("p", { className: "ba-muted", children: [
|
|
899
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ jsx9("strong", { children: t("mfa.enroll.backupCodesWarningStrong") }),
|
|
900
835
|
" ",
|
|
901
836
|
t("mfa.enroll.backupCodesWarningRest")
|
|
902
837
|
] }),
|
|
903
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ jsx9("ul", { className: "ba-backup-codes", "data-testid": "mfa-backup-codes", children: activeSetup.backupCodes.map((c) => /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9("code", { className: "ba-code", children: c }) }, c)) })
|
|
904
839
|
] }),
|
|
905
840
|
/* @__PURE__ */ jsxs9(
|
|
906
841
|
"form",
|
|
@@ -922,7 +857,7 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
922
857
|
children: [
|
|
923
858
|
/* @__PURE__ */ jsxs9("label", { className: "ba-label", children: [
|
|
924
859
|
t("mfa.enroll.codeLabel"),
|
|
925
|
-
/* @__PURE__ */
|
|
860
|
+
/* @__PURE__ */ jsx9(
|
|
926
861
|
"input",
|
|
927
862
|
{
|
|
928
863
|
className: "ba-input",
|
|
@@ -934,8 +869,8 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
934
869
|
}
|
|
935
870
|
)
|
|
936
871
|
] }),
|
|
937
|
-
/* @__PURE__ */
|
|
938
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ jsx9(FormError, { children: error }),
|
|
873
|
+
/* @__PURE__ */ jsx9("button", { className: "ba-button", type: "submit", disabled: pending || !code, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx9(Busy, { busy: pending, label: t("common.verifying"), children: t("mfa.enroll.activateSubmit") }) })
|
|
939
874
|
]
|
|
940
875
|
}
|
|
941
876
|
)
|
|
@@ -943,13 +878,13 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
943
878
|
}
|
|
944
879
|
|
|
945
880
|
// src/components/mfa-enrollment-step.tsx
|
|
946
|
-
import { Fragment as Fragment2, jsx as
|
|
881
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
947
882
|
function useConfirmedMfaPending(onUnknown = "pending") {
|
|
948
883
|
const client = useAuthClient();
|
|
949
884
|
const { needsMfaEnrollment } = useUser();
|
|
950
885
|
const { refetch } = useSession();
|
|
951
|
-
const [confirmed, setConfirmed] =
|
|
952
|
-
|
|
886
|
+
const [confirmed, setConfirmed] = React8.useState(null);
|
|
887
|
+
React8.useEffect(() => {
|
|
953
888
|
if (!needsMfaEnrollment) {
|
|
954
889
|
setConfirmed(null);
|
|
955
890
|
return;
|
|
@@ -974,22 +909,22 @@ function MfaEnrollmentStep({ title }) {
|
|
|
974
909
|
const t = useT();
|
|
975
910
|
const { refetch } = useSession();
|
|
976
911
|
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
977
|
-
/* @__PURE__ */
|
|
978
|
-
/* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
912
|
+
/* @__PURE__ */ jsx10("h2", { className: "ba-title", children: title ?? t("mfaGate.title") }),
|
|
913
|
+
/* @__PURE__ */ jsx10("p", { className: "ba-muted", children: t("mfaGate.body") }),
|
|
914
|
+
/* @__PURE__ */ jsx10(MFAEnrollment, { onEnrolled: () => refetch({ query: { disableCookieCache: true } }) })
|
|
980
915
|
] });
|
|
981
916
|
}
|
|
982
917
|
|
|
983
918
|
// src/components/AuthOwlBadge.tsx
|
|
984
|
-
import { jsx as
|
|
919
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
985
920
|
function OwlMark() {
|
|
986
921
|
return /* @__PURE__ */ jsxs11("svg", { className: "ba-badge-mark", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [
|
|
987
|
-
/* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
922
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "11", fill: "#F5B84C" }),
|
|
923
|
+
/* @__PURE__ */ jsx11("circle", { cx: "8.4", cy: "10", r: "3", fill: "#fff" }),
|
|
924
|
+
/* @__PURE__ */ jsx11("circle", { cx: "15.6", cy: "10", r: "3", fill: "#fff" }),
|
|
925
|
+
/* @__PURE__ */ jsx11("circle", { cx: "8.4", cy: "10", r: "1.4", fill: "#1f1300" }),
|
|
926
|
+
/* @__PURE__ */ jsx11("circle", { cx: "15.6", cy: "10", r: "1.4", fill: "#1f1300" }),
|
|
927
|
+
/* @__PURE__ */ jsx11("path", { d: "M12 13.1l1.5 2.1h-3z", fill: "#1f1300" })
|
|
993
928
|
] });
|
|
994
929
|
}
|
|
995
930
|
function AuthOwlBadge({ href = "https://authowl.dev", force } = {}) {
|
|
@@ -1005,9 +940,9 @@ function AuthOwlBadge({ href = "https://authowl.dev", force } = {}) {
|
|
|
1005
940
|
rel: "noopener noreferrer",
|
|
1006
941
|
"data-testid": "authowl-badge",
|
|
1007
942
|
children: [
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
brand: /* @__PURE__ */
|
|
943
|
+
/* @__PURE__ */ jsx11(OwlMark, {}),
|
|
944
|
+
/* @__PURE__ */ jsx11("span", { children: richMessage(t("badge.securedBy"), {
|
|
945
|
+
brand: /* @__PURE__ */ jsx11("span", { className: "ba-badge-brand", children: "AuthOwl" })
|
|
1011
946
|
}) })
|
|
1012
947
|
]
|
|
1013
948
|
}
|
|
@@ -1022,19 +957,19 @@ import {
|
|
|
1022
957
|
} from "@authowl/core";
|
|
1023
958
|
|
|
1024
959
|
// src/components/ConsentDocLinks.tsx
|
|
1025
|
-
import { Fragment as Fragment3, jsx as
|
|
960
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1026
961
|
function ConsentDocLinks({ termsUrl, privacyUrl }) {
|
|
1027
962
|
const t = useT();
|
|
1028
963
|
if (!termsUrl && !privacyUrl) return null;
|
|
1029
964
|
return /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
1030
|
-
termsUrl && /* @__PURE__ */
|
|
965
|
+
termsUrl && /* @__PURE__ */ jsx12("a", { href: termsUrl, target: "_blank", rel: "noopener noreferrer", children: t("consent.termsOfService") }),
|
|
1031
966
|
termsUrl && privacyUrl && t("consent.docJoiner"),
|
|
1032
|
-
privacyUrl && /* @__PURE__ */
|
|
967
|
+
privacyUrl && /* @__PURE__ */ jsx12("a", { href: privacyUrl, target: "_blank", rel: "noopener noreferrer", children: t("consent.privacyPolicy") })
|
|
1033
968
|
] });
|
|
1034
969
|
}
|
|
1035
970
|
|
|
1036
971
|
// src/components/LegalConsentCheckbox.tsx
|
|
1037
|
-
import { jsx as
|
|
972
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1038
973
|
function LegalConsentCheckbox({
|
|
1039
974
|
legal,
|
|
1040
975
|
accepted,
|
|
@@ -1045,7 +980,7 @@ function LegalConsentCheckbox({
|
|
|
1045
980
|
if (!legal.required) return null;
|
|
1046
981
|
return /* @__PURE__ */ jsxs13("label", { className: "ba-consent", "data-testid": testId, children: [
|
|
1047
982
|
/* @__PURE__ */ jsxs13("span", { className: "ba-checkbox-control", children: [
|
|
1048
|
-
/* @__PURE__ */
|
|
983
|
+
/* @__PURE__ */ jsx13(
|
|
1049
984
|
"input",
|
|
1050
985
|
{
|
|
1051
986
|
className: "ba-checkbox",
|
|
@@ -1054,14 +989,69 @@ function LegalConsentCheckbox({
|
|
|
1054
989
|
onChange: (event) => onAcceptedChange(event.target.checked)
|
|
1055
990
|
}
|
|
1056
991
|
),
|
|
1057
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ jsx13("span", { className: "ba-checkbox-visual", "aria-hidden": "true", children: /* @__PURE__ */ jsx13("span", { className: "ba-checkbox-check" }) })
|
|
1058
993
|
] }),
|
|
1059
|
-
/* @__PURE__ */
|
|
1060
|
-
links: /* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ jsx13("span", { children: richMessage(t("signUp.consentLabel"), {
|
|
995
|
+
links: /* @__PURE__ */ jsx13(ConsentDocLinks, { termsUrl: legal.termsUrl, privacyUrl: legal.privacyUrl })
|
|
1061
996
|
}) })
|
|
1062
997
|
] });
|
|
1063
998
|
}
|
|
1064
999
|
|
|
1000
|
+
// src/components/Turnstile.tsx
|
|
1001
|
+
import * as React9 from "react";
|
|
1002
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1003
|
+
var LOCAL_TURNSTILE_TEST_TOKEN = "XXXX.DUMMY.TOKEN.XXXX";
|
|
1004
|
+
async function loadTurnstile() {
|
|
1005
|
+
const [{ loadCaptcha }, { CAPTCHA_ADAPTERS }] = await Promise.all([
|
|
1006
|
+
import("./captcha-loader-VNULARCZ.js"),
|
|
1007
|
+
import("./captcha-providers-STYFL25P.js")
|
|
1008
|
+
]);
|
|
1009
|
+
const adapter = CAPTCHA_ADAPTERS.turnstile;
|
|
1010
|
+
return { api: await loadCaptcha(adapter), adapter };
|
|
1011
|
+
}
|
|
1012
|
+
function Turnstile({
|
|
1013
|
+
siteKey,
|
|
1014
|
+
theme,
|
|
1015
|
+
onToken,
|
|
1016
|
+
onUnavailable
|
|
1017
|
+
}) {
|
|
1018
|
+
const container = React9.useRef(null);
|
|
1019
|
+
const callbacks = React9.useRef({ onToken, onUnavailable });
|
|
1020
|
+
callbacks.current = { onToken, onUnavailable };
|
|
1021
|
+
React9.useEffect(() => {
|
|
1022
|
+
callbacks.current.onToken(null);
|
|
1023
|
+
if (!siteKey) {
|
|
1024
|
+
callbacks.current.onToken(LOCAL_TURNSTILE_TEST_TOKEN);
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
let active = true;
|
|
1028
|
+
let widget = null;
|
|
1029
|
+
void loadTurnstile().then(({ api, adapter }) => {
|
|
1030
|
+
if (!active || !container.current) return;
|
|
1031
|
+
const id = api.render(container.current, {
|
|
1032
|
+
sitekey: siteKey,
|
|
1033
|
+
theme: theme === "system" ? "auto" : theme,
|
|
1034
|
+
size: "flexible",
|
|
1035
|
+
callback: (token) => callbacks.current.onToken(token),
|
|
1036
|
+
"expired-callback": () => callbacks.current.onToken(null),
|
|
1037
|
+
"error-callback": () => {
|
|
1038
|
+
callbacks.current.onToken(null);
|
|
1039
|
+
callbacks.current.onUnavailable();
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
widget = { api, adapter, id };
|
|
1043
|
+
}).catch(() => {
|
|
1044
|
+
if (active) callbacks.current.onUnavailable();
|
|
1045
|
+
});
|
|
1046
|
+
return () => {
|
|
1047
|
+
active = false;
|
|
1048
|
+
if (widget) widget.adapter.teardown(widget.api, widget.id);
|
|
1049
|
+
};
|
|
1050
|
+
}, [siteKey, theme]);
|
|
1051
|
+
if (!siteKey) return null;
|
|
1052
|
+
return /* @__PURE__ */ jsx14("div", { className: "ba-turnstile", ref: container, "data-testid": "phoneotp-turnstile" });
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1065
1055
|
// src/components/PhoneOTP.tsx
|
|
1066
1056
|
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1067
1057
|
function PhoneOTP({
|
|
@@ -1374,8 +1364,25 @@ function InvitationBanner() {
|
|
|
1374
1364
|
return /* @__PURE__ */ jsx17("p", { className: "ba-muted", "data-testid": "authowl-invitation-banner", children: t("organization.invitationBanner") });
|
|
1375
1365
|
}
|
|
1376
1366
|
|
|
1367
|
+
// src/components/PublicConfigError.tsx
|
|
1368
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1369
|
+
function PublicConfigError({
|
|
1370
|
+
showBadge,
|
|
1371
|
+
showBranding = true
|
|
1372
|
+
}) {
|
|
1373
|
+
const t = useT();
|
|
1374
|
+
const { retry } = usePublicConfig();
|
|
1375
|
+
return /* @__PURE__ */ jsxs16("div", { className: "ba-form", "data-testid": "authowl-config-error", role: "alert", children: [
|
|
1376
|
+
showBranding ? /* @__PURE__ */ jsx18(AuthOwlBranding, {}) : null,
|
|
1377
|
+
/* @__PURE__ */ jsx18("h2", { className: "ba-title", children: t("publicConfig.error.title") }),
|
|
1378
|
+
/* @__PURE__ */ jsx18("p", { className: "ba-muted", children: t("publicConfig.error.description") }),
|
|
1379
|
+
/* @__PURE__ */ jsx18("button", { className: "ba-button", type: "button", onClick: retry, children: t("publicConfig.retry") }),
|
|
1380
|
+
/* @__PURE__ */ jsx18(AuthOwlBadge, { force: showBadge })
|
|
1381
|
+
] });
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1377
1384
|
// src/components/SignIn.tsx
|
|
1378
|
-
import { Fragment as Fragment4, jsx as
|
|
1385
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1379
1386
|
function SignIn({
|
|
1380
1387
|
redirectTo,
|
|
1381
1388
|
onSignedIn,
|
|
@@ -1417,41 +1424,44 @@ function SignIn({
|
|
|
1417
1424
|
redirectTo,
|
|
1418
1425
|
onSignedIn
|
|
1419
1426
|
});
|
|
1420
|
-
const badge = /* @__PURE__ */
|
|
1421
|
-
const branding = showBranding ? /* @__PURE__ */
|
|
1427
|
+
const badge = /* @__PURE__ */ jsx19(AuthOwlBadge, { force: showBadge });
|
|
1428
|
+
const branding = showBranding ? /* @__PURE__ */ jsx19(AuthOwlBranding, {}) : null;
|
|
1422
1429
|
if (isLoading) {
|
|
1423
|
-
return /* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-loading", "aria-busy": "true", children: [
|
|
1431
|
+
/* @__PURE__ */ jsx19("div", { className: "ba-skeleton" }),
|
|
1432
|
+
/* @__PURE__ */ jsx19("div", { className: "ba-skeleton" })
|
|
1426
1433
|
] });
|
|
1427
1434
|
}
|
|
1435
|
+
if (isError) {
|
|
1436
|
+
return /* @__PURE__ */ jsx19(PublicConfigError, { showBadge, showBranding });
|
|
1437
|
+
}
|
|
1428
1438
|
if (mfaEnrolment !== "clear") {
|
|
1429
|
-
return /* @__PURE__ */
|
|
1439
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-mfa-enrolment", "aria-busy": mfaEnrolment === "confirming", children: [
|
|
1430
1440
|
branding,
|
|
1431
|
-
mfaEnrolment === "pending" ? /* @__PURE__ */
|
|
1441
|
+
mfaEnrolment === "pending" ? /* @__PURE__ */ jsx19(MfaEnrollmentStep, {}) : /* @__PURE__ */ jsx19("div", { className: "ba-skeleton" }),
|
|
1432
1442
|
badge
|
|
1433
1443
|
] });
|
|
1434
1444
|
}
|
|
1435
1445
|
if (challenge) {
|
|
1436
|
-
return /* @__PURE__ */
|
|
1446
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-mfa", children: [
|
|
1437
1447
|
branding,
|
|
1438
|
-
/* @__PURE__ */
|
|
1448
|
+
/* @__PURE__ */ jsx19(MFAChallenge, { onVerified: () => finishSignIn({ sessionStore, redirectTo, onSignedIn }) }),
|
|
1439
1449
|
badge
|
|
1440
1450
|
] });
|
|
1441
1451
|
}
|
|
1442
1452
|
if (view === "forgot" && resetPasswordUrl) {
|
|
1443
|
-
return /* @__PURE__ */
|
|
1453
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-forgot", children: [
|
|
1444
1454
|
branding,
|
|
1445
|
-
/* @__PURE__ */
|
|
1446
|
-
/* @__PURE__ */
|
|
1455
|
+
/* @__PURE__ */ jsx19("h2", { className: "ba-title", children: t("signIn.forgotTitle") }),
|
|
1456
|
+
/* @__PURE__ */ jsx19(ForgotPassword, { resetPasswordUrl, onBack: () => setView("sign-in") }),
|
|
1447
1457
|
badge
|
|
1448
1458
|
] });
|
|
1449
1459
|
}
|
|
1450
1460
|
if (view === "otp-code") {
|
|
1451
|
-
return /* @__PURE__ */
|
|
1461
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-otp-code", children: [
|
|
1452
1462
|
branding,
|
|
1453
|
-
/* @__PURE__ */
|
|
1454
|
-
/* @__PURE__ */
|
|
1463
|
+
/* @__PURE__ */ jsx19("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
1464
|
+
/* @__PURE__ */ jsx19(
|
|
1455
1465
|
OtpCodeForm,
|
|
1456
1466
|
{
|
|
1457
1467
|
email,
|
|
@@ -1477,18 +1487,18 @@ function SignIn({
|
|
|
1477
1487
|
] });
|
|
1478
1488
|
}
|
|
1479
1489
|
if (view === "magic-sent") {
|
|
1480
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-magic-sent", children: [
|
|
1481
1491
|
branding,
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1492
|
+
/* @__PURE__ */ jsx19("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
1493
|
+
/* @__PURE__ */ jsx19("p", { className: "ba-muted", children: t("magicLink.sent") }),
|
|
1494
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: "ba-link-button", onClick: () => setView("sign-in"), children: t("forgotPassword.backToSignIn") }),
|
|
1485
1495
|
badge
|
|
1486
1496
|
] });
|
|
1487
1497
|
}
|
|
1488
1498
|
if (view === "phone") {
|
|
1489
|
-
return /* @__PURE__ */
|
|
1499
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-phone", children: [
|
|
1490
1500
|
branding,
|
|
1491
|
-
/* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ jsx19(
|
|
1492
1502
|
PhoneOTP,
|
|
1493
1503
|
{
|
|
1494
1504
|
redirectTo,
|
|
@@ -1565,14 +1575,13 @@ function SignIn({
|
|
|
1565
1575
|
{ key: "otp", enabled: plan.emailOtp, action: doRequestOtp, label: t("emailOtp.requestSubmit"), pendingLabel: t("common.sending") },
|
|
1566
1576
|
{ key: "sso", enabled: plan.sso, action: doSso, label: t("sso.continueWith"), pendingLabel: t("sso.redirecting") }
|
|
1567
1577
|
];
|
|
1568
|
-
return /* @__PURE__ */
|
|
1578
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-form", children: [
|
|
1569
1579
|
branding,
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1572
|
-
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
|
|
1575
|
-
hasCredentialForm && /* @__PURE__ */ jsxs16(
|
|
1580
|
+
/* @__PURE__ */ jsx19("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
1581
|
+
/* @__PURE__ */ jsx19(InvitationBanner, {}),
|
|
1582
|
+
/* @__PURE__ */ jsx19(SocialButtons, { providers: plan.social, callbackURL: redirectTo }),
|
|
1583
|
+
showDivider && /* @__PURE__ */ jsx19("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
1584
|
+
hasCredentialForm && /* @__PURE__ */ jsxs17(
|
|
1576
1585
|
"form",
|
|
1577
1586
|
{
|
|
1578
1587
|
method: "post",
|
|
@@ -1583,9 +1592,9 @@ function SignIn({
|
|
|
1583
1592
|
else if (plan.primary) PRIMARY_ACTION[plan.primary]();
|
|
1584
1593
|
},
|
|
1585
1594
|
children: [
|
|
1586
|
-
credentialMode === "email" ? /* @__PURE__ */
|
|
1595
|
+
credentialMode === "email" ? /* @__PURE__ */ jsxs17("label", { className: "ba-label", children: [
|
|
1587
1596
|
t("common.emailLabel"),
|
|
1588
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ jsx19(
|
|
1589
1598
|
"input",
|
|
1590
1599
|
{
|
|
1591
1600
|
ref: emailRef,
|
|
@@ -1600,9 +1609,9 @@ function SignIn({
|
|
|
1600
1609
|
required: true
|
|
1601
1610
|
}
|
|
1602
1611
|
)
|
|
1603
|
-
] }) : /* @__PURE__ */
|
|
1612
|
+
] }) : /* @__PURE__ */ jsxs17("label", { className: "ba-label", children: [
|
|
1604
1613
|
t("common.usernameLabel"),
|
|
1605
|
-
/* @__PURE__ */
|
|
1614
|
+
/* @__PURE__ */ jsx19(
|
|
1606
1615
|
"input",
|
|
1607
1616
|
{
|
|
1608
1617
|
className: "ba-input",
|
|
@@ -1617,9 +1626,9 @@ function SignIn({
|
|
|
1617
1626
|
}
|
|
1618
1627
|
)
|
|
1619
1628
|
] }),
|
|
1620
|
-
plan.password && /* @__PURE__ */
|
|
1629
|
+
plan.password && /* @__PURE__ */ jsxs17("label", { className: "ba-label", children: [
|
|
1621
1630
|
t("common.passwordLabel"),
|
|
1622
|
-
/* @__PURE__ */
|
|
1631
|
+
/* @__PURE__ */ jsx19(
|
|
1623
1632
|
"input",
|
|
1624
1633
|
{
|
|
1625
1634
|
className: "ba-input",
|
|
@@ -1635,19 +1644,19 @@ function SignIn({
|
|
|
1635
1644
|
)
|
|
1636
1645
|
] }),
|
|
1637
1646
|
authChallenge.control,
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
plan.password && /* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1647
|
+
/* @__PURE__ */ jsx19(FormError, { children: error }),
|
|
1648
|
+
plan.password && /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
1649
|
+
/* @__PURE__ */ jsx19(
|
|
1641
1650
|
"button",
|
|
1642
1651
|
{
|
|
1643
1652
|
className: "ba-button",
|
|
1644
1653
|
type: "submit",
|
|
1645
1654
|
disabled: pending || authChallenge.configPending,
|
|
1646
1655
|
"aria-busy": pending && inFlight === "password" || void 0,
|
|
1647
|
-
children: /* @__PURE__ */
|
|
1656
|
+
children: /* @__PURE__ */ jsx19(Busy, { busy: pending && inFlight === "password", label: t("signIn.submitPending"), children: t("signIn.submit") })
|
|
1648
1657
|
}
|
|
1649
1658
|
),
|
|
1650
|
-
resetPasswordUrl && /* @__PURE__ */
|
|
1659
|
+
resetPasswordUrl && /* @__PURE__ */ jsx19(
|
|
1651
1660
|
"button",
|
|
1652
1661
|
{
|
|
1653
1662
|
type: "button",
|
|
@@ -1659,7 +1668,7 @@ function SignIn({
|
|
|
1659
1668
|
] }),
|
|
1660
1669
|
credentialMode === "email" && alternates.filter((a) => a.enabled).map(({ key, action, label: label2, pendingLabel }) => {
|
|
1661
1670
|
const isPrimary = plan.primary === key;
|
|
1662
|
-
return /* @__PURE__ */
|
|
1671
|
+
return /* @__PURE__ */ jsx19(
|
|
1663
1672
|
"button",
|
|
1664
1673
|
{
|
|
1665
1674
|
type: isPrimary ? "submit" : "button",
|
|
@@ -1667,12 +1676,12 @@ function SignIn({
|
|
|
1667
1676
|
disabled: pending || authChallenge.configPending,
|
|
1668
1677
|
"aria-busy": pending && inFlight === key || void 0,
|
|
1669
1678
|
onClick: isPrimary ? void 0 : withEmail(action),
|
|
1670
|
-
children: /* @__PURE__ */
|
|
1679
|
+
children: /* @__PURE__ */ jsx19(Busy, { busy: pending && inFlight === key, label: pendingLabel, children: label2 })
|
|
1671
1680
|
},
|
|
1672
1681
|
key
|
|
1673
1682
|
);
|
|
1674
1683
|
}),
|
|
1675
|
-
plan.username && /* @__PURE__ */
|
|
1684
|
+
plan.username && /* @__PURE__ */ jsx19(
|
|
1676
1685
|
"button",
|
|
1677
1686
|
{
|
|
1678
1687
|
type: "button",
|
|
@@ -1688,8 +1697,8 @@ function SignIn({
|
|
|
1688
1697
|
]
|
|
1689
1698
|
}
|
|
1690
1699
|
),
|
|
1691
|
-
plan.passkey && /* @__PURE__ */
|
|
1692
|
-
plan.phoneOtp && /* @__PURE__ */
|
|
1700
|
+
plan.passkey && /* @__PURE__ */ jsx19(PasskeyButton, { redirectTo, onSignedIn }),
|
|
1701
|
+
plan.phoneOtp && /* @__PURE__ */ jsx19(
|
|
1693
1702
|
"button",
|
|
1694
1703
|
{
|
|
1695
1704
|
type: "button",
|
|
@@ -1698,7 +1707,7 @@ function SignIn({
|
|
|
1698
1707
|
children: t("phoneOtp.usePhone")
|
|
1699
1708
|
}
|
|
1700
1709
|
),
|
|
1701
|
-
!plan.renderable && /* @__PURE__ */
|
|
1710
|
+
!plan.renderable && /* @__PURE__ */ jsx19("p", { className: "ba-muted", children: plan.emptyReason === "unsupported" ? t("signIn.empty.unsupported") : t("signIn.empty.none") }),
|
|
1702
1711
|
badge
|
|
1703
1712
|
] });
|
|
1704
1713
|
}
|
|
@@ -1708,7 +1717,7 @@ import * as React17 from "react";
|
|
|
1708
1717
|
|
|
1709
1718
|
// src/components/VerificationPending.tsx
|
|
1710
1719
|
import * as React14 from "react";
|
|
1711
|
-
import { jsx as
|
|
1720
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1712
1721
|
function VerificationPending({
|
|
1713
1722
|
email,
|
|
1714
1723
|
callbackURL,
|
|
@@ -1726,10 +1735,10 @@ function VerificationPending({
|
|
|
1726
1735
|
const [code, setCode] = React14.useState("");
|
|
1727
1736
|
const [verified, setVerified] = React14.useState(false);
|
|
1728
1737
|
if (verified) {
|
|
1729
|
-
return /* @__PURE__ */
|
|
1738
|
+
return /* @__PURE__ */ jsx20("p", { className: "ba-success", role: "status", "data-testid": "verify-code-success", children: t("verifyEmail.success") });
|
|
1730
1739
|
}
|
|
1731
1740
|
if (method === "code") {
|
|
1732
|
-
return /* @__PURE__ */
|
|
1741
|
+
return /* @__PURE__ */ jsxs18(
|
|
1733
1742
|
"form",
|
|
1734
1743
|
{
|
|
1735
1744
|
method: "post",
|
|
@@ -1746,12 +1755,12 @@ function VerificationPending({
|
|
|
1746
1755
|
);
|
|
1747
1756
|
},
|
|
1748
1757
|
children: [
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
email: /* @__PURE__ */
|
|
1758
|
+
/* @__PURE__ */ jsx20("p", { className: "ba-muted", children: richMessage(t("verifyPending.codeBody"), {
|
|
1759
|
+
email: /* @__PURE__ */ jsx20("strong", { children: /* @__PURE__ */ jsx20(Bidi, { children: email }) })
|
|
1751
1760
|
}) }),
|
|
1752
|
-
/* @__PURE__ */
|
|
1761
|
+
/* @__PURE__ */ jsxs18("label", { className: "ba-label", children: [
|
|
1753
1762
|
t("verifyPending.codeLabel"),
|
|
1754
|
-
/* @__PURE__ */
|
|
1763
|
+
/* @__PURE__ */ jsx20(
|
|
1755
1764
|
"input",
|
|
1756
1765
|
{
|
|
1757
1766
|
className: "ba-input",
|
|
@@ -1763,20 +1772,20 @@ function VerificationPending({
|
|
|
1763
1772
|
}
|
|
1764
1773
|
)
|
|
1765
1774
|
] }),
|
|
1766
|
-
resent && /* @__PURE__ */
|
|
1775
|
+
resent && /* @__PURE__ */ jsx20("p", { className: "ba-muted", children: t("verifyPending.resent") }),
|
|
1767
1776
|
authChallenge.control,
|
|
1768
|
-
/* @__PURE__ */
|
|
1769
|
-
/* @__PURE__ */
|
|
1777
|
+
/* @__PURE__ */ jsx20(FormError, { children: error }),
|
|
1778
|
+
/* @__PURE__ */ jsx20(
|
|
1770
1779
|
"button",
|
|
1771
1780
|
{
|
|
1772
1781
|
className: "ba-button",
|
|
1773
1782
|
type: "submit",
|
|
1774
1783
|
disabled: pending || !code,
|
|
1775
1784
|
"aria-busy": pending || void 0,
|
|
1776
|
-
children: /* @__PURE__ */
|
|
1785
|
+
children: /* @__PURE__ */ jsx20(Busy, { busy: pending, label: t("common.verifying"), children: t("emailOtp.verifySubmit") })
|
|
1777
1786
|
}
|
|
1778
1787
|
),
|
|
1779
|
-
/* @__PURE__ */
|
|
1788
|
+
/* @__PURE__ */ jsx20(
|
|
1780
1789
|
"button",
|
|
1781
1790
|
{
|
|
1782
1791
|
type: "button",
|
|
@@ -1802,14 +1811,14 @@ function VerificationPending({
|
|
|
1802
1811
|
}
|
|
1803
1812
|
);
|
|
1804
1813
|
}
|
|
1805
|
-
return /* @__PURE__ */
|
|
1806
|
-
/* @__PURE__ */
|
|
1807
|
-
email: /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ jsxs18("div", { className: "ba-fields", "data-testid": "verify-pending", children: [
|
|
1815
|
+
/* @__PURE__ */ jsx20("p", { className: "ba-muted", children: richMessage(t("verifyPending.body"), {
|
|
1816
|
+
email: /* @__PURE__ */ jsx20("strong", { children: /* @__PURE__ */ jsx20(Bidi, { children: email }) })
|
|
1808
1817
|
}) }),
|
|
1809
|
-
resent && /* @__PURE__ */
|
|
1818
|
+
resent && /* @__PURE__ */ jsx20("p", { className: "ba-muted", children: t("verifyPending.resent") }),
|
|
1810
1819
|
authChallenge.control,
|
|
1811
|
-
/* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
1820
|
+
/* @__PURE__ */ jsx20(FormError, { children: error }),
|
|
1821
|
+
/* @__PURE__ */ jsx20(
|
|
1813
1822
|
"button",
|
|
1814
1823
|
{
|
|
1815
1824
|
type: "button",
|
|
@@ -1820,7 +1829,7 @@ function VerificationPending({
|
|
|
1820
1829
|
failure: t("verifyPending.error.resendFailed"),
|
|
1821
1830
|
onSuccess: () => setResent(true)
|
|
1822
1831
|
}),
|
|
1823
|
-
children: /* @__PURE__ */
|
|
1832
|
+
children: /* @__PURE__ */ jsx20(Busy, { busy: pending, label: t("common.sending"), children: t("verifyPending.resendButton") })
|
|
1824
1833
|
}
|
|
1825
1834
|
)
|
|
1826
1835
|
] });
|
|
@@ -1828,7 +1837,7 @@ function VerificationPending({
|
|
|
1828
1837
|
|
|
1829
1838
|
// src/components/PasswordlessSignUp.tsx
|
|
1830
1839
|
import * as React15 from "react";
|
|
1831
|
-
import { jsx as
|
|
1840
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1832
1841
|
function PasswordlessSignUp({ onAuthenticated }) {
|
|
1833
1842
|
const t = useT();
|
|
1834
1843
|
const { sendEmailOtp, signInEmailOtp } = useSignIn();
|
|
@@ -1838,7 +1847,7 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
1838
1847
|
const [code, setCode] = React15.useState("");
|
|
1839
1848
|
const [codeSent, setCodeSent] = React15.useState(false);
|
|
1840
1849
|
if (codeSent) {
|
|
1841
|
-
return /* @__PURE__ */
|
|
1850
|
+
return /* @__PURE__ */ jsx21("div", { className: "ba-fields", "data-testid": "signup-emailotp-code", children: /* @__PURE__ */ jsx21(
|
|
1842
1851
|
OtpCodeForm,
|
|
1843
1852
|
{
|
|
1844
1853
|
email,
|
|
@@ -1858,7 +1867,7 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
1858
1867
|
}
|
|
1859
1868
|
) });
|
|
1860
1869
|
}
|
|
1861
|
-
return /* @__PURE__ */
|
|
1870
|
+
return /* @__PURE__ */ jsxs19(
|
|
1862
1871
|
"form",
|
|
1863
1872
|
{
|
|
1864
1873
|
method: "post",
|
|
@@ -1872,9 +1881,9 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
1872
1881
|
});
|
|
1873
1882
|
},
|
|
1874
1883
|
children: [
|
|
1875
|
-
/* @__PURE__ */
|
|
1884
|
+
/* @__PURE__ */ jsxs19("label", { className: "ba-label", children: [
|
|
1876
1885
|
t("common.emailLabel"),
|
|
1877
|
-
/* @__PURE__ */
|
|
1886
|
+
/* @__PURE__ */ jsx21(
|
|
1878
1887
|
"input",
|
|
1879
1888
|
{
|
|
1880
1889
|
className: "ba-input",
|
|
@@ -1887,15 +1896,15 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
1887
1896
|
)
|
|
1888
1897
|
] }),
|
|
1889
1898
|
authChallenge.control,
|
|
1890
|
-
/* @__PURE__ */
|
|
1891
|
-
/* @__PURE__ */
|
|
1899
|
+
/* @__PURE__ */ jsx21(FormError, { children: error }),
|
|
1900
|
+
/* @__PURE__ */ jsx21(
|
|
1892
1901
|
"button",
|
|
1893
1902
|
{
|
|
1894
1903
|
className: "ba-button ba-button-secondary",
|
|
1895
1904
|
type: "submit",
|
|
1896
1905
|
disabled: pending || authChallenge.configPending,
|
|
1897
1906
|
"aria-busy": pending || void 0,
|
|
1898
|
-
children: /* @__PURE__ */
|
|
1907
|
+
children: /* @__PURE__ */ jsx21(Busy, { busy: pending, label: t("common.sending"), children: t("signUp.passwordlessSubmit") })
|
|
1899
1908
|
}
|
|
1900
1909
|
)
|
|
1901
1910
|
]
|
|
@@ -1904,16 +1913,16 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
1904
1913
|
}
|
|
1905
1914
|
|
|
1906
1915
|
// src/components/PasskeySignUpCompletion.tsx
|
|
1907
|
-
import { jsx as
|
|
1916
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1908
1917
|
function PasskeySignUpCompletion({ onComplete }) {
|
|
1909
1918
|
const t = useT();
|
|
1910
1919
|
const { addPasskey } = usePasskeys();
|
|
1911
1920
|
const { pending, error, run } = useSubmitAction();
|
|
1912
|
-
return /* @__PURE__ */
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
1916
|
-
/* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ jsxs20("div", { className: "ba-fields", "data-testid": "signup-passkey-completion", children: [
|
|
1922
|
+
/* @__PURE__ */ jsx22("h3", { className: "ba-title", children: t("signUp.passkeyTitle") }),
|
|
1923
|
+
/* @__PURE__ */ jsx22("p", { className: "ba-muted", children: t("signUp.passkeyDescription") }),
|
|
1924
|
+
/* @__PURE__ */ jsx22(FormError, { children: error }),
|
|
1925
|
+
/* @__PURE__ */ jsx22(
|
|
1917
1926
|
"button",
|
|
1918
1927
|
{
|
|
1919
1928
|
className: "ba-button",
|
|
@@ -1924,16 +1933,16 @@ function PasskeySignUpCompletion({ onComplete }) {
|
|
|
1924
1933
|
failure: t("signUp.error.passkeyFailed"),
|
|
1925
1934
|
onSuccess: onComplete
|
|
1926
1935
|
}),
|
|
1927
|
-
children: /* @__PURE__ */
|
|
1936
|
+
children: /* @__PURE__ */ jsx22(Busy, { busy: pending, label: t("passkey.waiting"), children: t("signUp.passkeySubmit") })
|
|
1928
1937
|
}
|
|
1929
1938
|
),
|
|
1930
|
-
/* @__PURE__ */
|
|
1939
|
+
/* @__PURE__ */ jsx22("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: onComplete, children: t("signUp.passkeySkip") })
|
|
1931
1940
|
] });
|
|
1932
1941
|
}
|
|
1933
1942
|
|
|
1934
1943
|
// src/components/Waitlist.tsx
|
|
1935
1944
|
import * as React16 from "react";
|
|
1936
|
-
import { jsx as
|
|
1945
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1937
1946
|
function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
1938
1947
|
const t = useT();
|
|
1939
1948
|
const { join } = useWaitlist();
|
|
@@ -1942,18 +1951,18 @@ function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
|
1942
1951
|
const [email, setEmail] = React16.useState("");
|
|
1943
1952
|
const [joined, setJoined] = React16.useState(false);
|
|
1944
1953
|
if (joined) {
|
|
1945
|
-
return /* @__PURE__ */
|
|
1946
|
-
showBranding ? /* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */
|
|
1954
|
+
return /* @__PURE__ */ jsxs21("div", { className: "ba-form", "data-testid": "waitlist-accepted", children: [
|
|
1955
|
+
showBranding ? /* @__PURE__ */ jsx23(AuthOwlBranding, {}) : null,
|
|
1956
|
+
/* @__PURE__ */ jsx23("h2", { className: "ba-title", children: t("waitlist.acceptedTitle") }),
|
|
1957
|
+
/* @__PURE__ */ jsx23("p", { className: "ba-muted", children: t("waitlist.acceptedDescription") }),
|
|
1958
|
+
/* @__PURE__ */ jsx23(AuthOwlBadge, { force: showBadge })
|
|
1950
1959
|
] });
|
|
1951
1960
|
}
|
|
1952
|
-
return /* @__PURE__ */
|
|
1953
|
-
showBranding ? /* @__PURE__ */
|
|
1954
|
-
/* @__PURE__ */
|
|
1955
|
-
/* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
1961
|
+
return /* @__PURE__ */ jsxs21("div", { className: "ba-form", "data-testid": "waitlist-form", children: [
|
|
1962
|
+
showBranding ? /* @__PURE__ */ jsx23(AuthOwlBranding, {}) : null,
|
|
1963
|
+
/* @__PURE__ */ jsx23("h2", { className: "ba-title", children: t("waitlist.title") }),
|
|
1964
|
+
/* @__PURE__ */ jsx23("p", { className: "ba-muted", children: t("waitlist.description") }),
|
|
1965
|
+
/* @__PURE__ */ jsxs21(
|
|
1957
1966
|
"form",
|
|
1958
1967
|
{
|
|
1959
1968
|
method: "post",
|
|
@@ -1975,9 +1984,9 @@ function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
|
1975
1984
|
);
|
|
1976
1985
|
},
|
|
1977
1986
|
children: [
|
|
1978
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ jsxs21("label", { className: "ba-label", children: [
|
|
1979
1988
|
t("common.emailLabel"),
|
|
1980
|
-
/* @__PURE__ */
|
|
1989
|
+
/* @__PURE__ */ jsx23(
|
|
1981
1990
|
"input",
|
|
1982
1991
|
{
|
|
1983
1992
|
className: "ba-input",
|
|
@@ -1991,26 +2000,26 @@ function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
|
1991
2000
|
)
|
|
1992
2001
|
] }),
|
|
1993
2002
|
authChallenge.control,
|
|
1994
|
-
/* @__PURE__ */
|
|
1995
|
-
/* @__PURE__ */
|
|
2003
|
+
/* @__PURE__ */ jsx23(FormError, { children: error }),
|
|
2004
|
+
/* @__PURE__ */ jsx23(
|
|
1996
2005
|
"button",
|
|
1997
2006
|
{
|
|
1998
2007
|
className: "ba-button",
|
|
1999
2008
|
type: "submit",
|
|
2000
2009
|
disabled: pending || authChallenge.configPending,
|
|
2001
2010
|
"aria-busy": pending || void 0,
|
|
2002
|
-
children: /* @__PURE__ */
|
|
2011
|
+
children: /* @__PURE__ */ jsx23(Busy, { busy: pending, label: t("waitlist.submitPending"), children: t("waitlist.submit") })
|
|
2003
2012
|
}
|
|
2004
2013
|
)
|
|
2005
2014
|
]
|
|
2006
2015
|
}
|
|
2007
2016
|
),
|
|
2008
|
-
/* @__PURE__ */
|
|
2017
|
+
/* @__PURE__ */ jsx23(AuthOwlBadge, { force: showBadge })
|
|
2009
2018
|
] });
|
|
2010
2019
|
}
|
|
2011
2020
|
|
|
2012
2021
|
// src/components/SignUp.tsx
|
|
2013
|
-
import { Fragment as Fragment5, jsx as
|
|
2022
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2014
2023
|
function SignUp({
|
|
2015
2024
|
redirectTo,
|
|
2016
2025
|
onSignedUp,
|
|
@@ -2022,7 +2031,7 @@ function SignUp({
|
|
|
2022
2031
|
const t = useT();
|
|
2023
2032
|
const toServerError = useServerError();
|
|
2024
2033
|
const { signUp } = useSignUp();
|
|
2025
|
-
const { config, isLoading } = usePublicConfig();
|
|
2034
|
+
const { config, isLoading, isError } = usePublicConfig();
|
|
2026
2035
|
const authChallenge = useAuthChallenge();
|
|
2027
2036
|
const [email, setEmail] = React17.useState("");
|
|
2028
2037
|
const [password, setPassword] = React17.useState("");
|
|
@@ -2094,18 +2103,21 @@ function SignUp({
|
|
|
2094
2103
|
}
|
|
2095
2104
|
}
|
|
2096
2105
|
if (isLoading) {
|
|
2097
|
-
return /* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
2106
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-loading", "aria-busy": "true", children: [
|
|
2107
|
+
/* @__PURE__ */ jsx24("div", { className: "ba-skeleton" }),
|
|
2108
|
+
/* @__PURE__ */ jsx24("div", { className: "ba-skeleton" })
|
|
2100
2109
|
] });
|
|
2101
2110
|
}
|
|
2111
|
+
if (isError) {
|
|
2112
|
+
return /* @__PURE__ */ jsx24(PublicConfigError, { showBadge, showBranding });
|
|
2113
|
+
}
|
|
2102
2114
|
if (config?.signUp?.mode === "waitlist") {
|
|
2103
|
-
return /* @__PURE__ */
|
|
2115
|
+
return /* @__PURE__ */ jsx24(Waitlist, { onJoined: onWaitlisted, showBadge, showBranding });
|
|
2104
2116
|
}
|
|
2105
2117
|
if (pendingEmail) {
|
|
2106
|
-
return /* @__PURE__ */
|
|
2107
|
-
showBranding ? /* @__PURE__ */
|
|
2108
|
-
/* @__PURE__ */
|
|
2118
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-verify-pending", children: [
|
|
2119
|
+
showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
|
|
2120
|
+
/* @__PURE__ */ jsx24(
|
|
2109
2121
|
VerificationPending,
|
|
2110
2122
|
{
|
|
2111
2123
|
email: pendingEmail,
|
|
@@ -2113,7 +2125,7 @@ function SignUp({
|
|
|
2113
2125
|
method: capabilities.emailVerificationMethod
|
|
2114
2126
|
}
|
|
2115
2127
|
),
|
|
2116
|
-
/* @__PURE__ */
|
|
2128
|
+
/* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
|
|
2117
2129
|
] });
|
|
2118
2130
|
}
|
|
2119
2131
|
const methods = config?.enabledMethods ?? ["password"];
|
|
@@ -2123,22 +2135,22 @@ function SignUp({
|
|
|
2123
2135
|
const showPasswordless = publicSignupAllowed && capabilities.emailOtpSignIn && capabilities.emailSignUp && !consentRequired && !capabilities.mfaRequired;
|
|
2124
2136
|
const renderable = showPassword || showPasswordless || social.length > 0;
|
|
2125
2137
|
if (completeWithPasskey) {
|
|
2126
|
-
return /* @__PURE__ */
|
|
2127
|
-
showBranding ? /* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
2129
|
-
/* @__PURE__ */
|
|
2138
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-passkey-step", children: [
|
|
2139
|
+
showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
|
|
2140
|
+
/* @__PURE__ */ jsx24(PasskeySignUpCompletion, { onComplete: finishSignUp }),
|
|
2141
|
+
/* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
|
|
2130
2142
|
] });
|
|
2131
2143
|
}
|
|
2132
|
-
return /* @__PURE__ */
|
|
2133
|
-
showBranding ? /* @__PURE__ */
|
|
2134
|
-
/* @__PURE__ */
|
|
2135
|
-
/* @__PURE__ */
|
|
2136
|
-
/* @__PURE__ */
|
|
2137
|
-
showPassword && social.length > 0 && /* @__PURE__ */
|
|
2138
|
-
showPassword && /* @__PURE__ */
|
|
2139
|
-
capabilities.legacyNameField && /* @__PURE__ */
|
|
2144
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-form", children: [
|
|
2145
|
+
showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
|
|
2146
|
+
/* @__PURE__ */ jsx24("h2", { className: "ba-title", children: t("signUp.title") }),
|
|
2147
|
+
/* @__PURE__ */ jsx24(InvitationBanner, {}),
|
|
2148
|
+
/* @__PURE__ */ jsx24(SocialButtons, { providers: social, callbackURL: redirectTo }),
|
|
2149
|
+
showPassword && social.length > 0 && /* @__PURE__ */ jsx24("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
2150
|
+
showPassword && /* @__PURE__ */ jsxs22("form", { method: "post", onSubmit, className: "ba-fields", children: [
|
|
2151
|
+
capabilities.legacyNameField && /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
2140
2152
|
t("signUp.nameLabel"),
|
|
2141
|
-
/* @__PURE__ */
|
|
2153
|
+
/* @__PURE__ */ jsx24(
|
|
2142
2154
|
"input",
|
|
2143
2155
|
{
|
|
2144
2156
|
className: "ba-input",
|
|
@@ -2152,10 +2164,10 @@ function SignUp({
|
|
|
2152
2164
|
}
|
|
2153
2165
|
)
|
|
2154
2166
|
] }),
|
|
2155
|
-
capabilities.firstLastName && /* @__PURE__ */
|
|
2156
|
-
/* @__PURE__ */
|
|
2167
|
+
capabilities.firstLastName && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
2168
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
2157
2169
|
t("signUp.firstNameLabel"),
|
|
2158
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ jsx24(
|
|
2159
2171
|
"input",
|
|
2160
2172
|
{
|
|
2161
2173
|
className: "ba-input",
|
|
@@ -2168,9 +2180,9 @@ function SignUp({
|
|
|
2168
2180
|
}
|
|
2169
2181
|
)
|
|
2170
2182
|
] }),
|
|
2171
|
-
/* @__PURE__ */
|
|
2183
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
2172
2184
|
t("signUp.lastNameLabel"),
|
|
2173
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ jsx24(
|
|
2174
2186
|
"input",
|
|
2175
2187
|
{
|
|
2176
2188
|
className: "ba-input",
|
|
@@ -2184,9 +2196,9 @@ function SignUp({
|
|
|
2184
2196
|
)
|
|
2185
2197
|
] })
|
|
2186
2198
|
] }),
|
|
2187
|
-
capabilities.collectUsername && /* @__PURE__ */
|
|
2199
|
+
capabilities.collectUsername && /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
2188
2200
|
t("common.usernameLabel"),
|
|
2189
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsx24(
|
|
2190
2202
|
"input",
|
|
2191
2203
|
{
|
|
2192
2204
|
className: "ba-input",
|
|
@@ -2200,9 +2212,9 @@ function SignUp({
|
|
|
2200
2212
|
}
|
|
2201
2213
|
)
|
|
2202
2214
|
] }),
|
|
2203
|
-
/* @__PURE__ */
|
|
2215
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
2204
2216
|
t("common.emailLabel"),
|
|
2205
|
-
/* @__PURE__ */
|
|
2217
|
+
/* @__PURE__ */ jsx24(
|
|
2206
2218
|
"input",
|
|
2207
2219
|
{
|
|
2208
2220
|
className: "ba-input",
|
|
@@ -2217,9 +2229,9 @@ function SignUp({
|
|
|
2217
2229
|
}
|
|
2218
2230
|
)
|
|
2219
2231
|
] }),
|
|
2220
|
-
/* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
2221
2233
|
t("common.passwordLabel"),
|
|
2222
|
-
/* @__PURE__ */
|
|
2234
|
+
/* @__PURE__ */ jsx24(
|
|
2223
2235
|
"input",
|
|
2224
2236
|
{
|
|
2225
2237
|
className: "ba-input",
|
|
@@ -2237,7 +2249,7 @@ function SignUp({
|
|
|
2237
2249
|
)
|
|
2238
2250
|
] }),
|
|
2239
2251
|
authChallenge.control,
|
|
2240
|
-
legal && /* @__PURE__ */
|
|
2252
|
+
legal && /* @__PURE__ */ jsx24(
|
|
2241
2253
|
LegalConsentCheckbox,
|
|
2242
2254
|
{
|
|
2243
2255
|
legal,
|
|
@@ -2246,20 +2258,20 @@ function SignUp({
|
|
|
2246
2258
|
testId: "signup-consent"
|
|
2247
2259
|
}
|
|
2248
2260
|
),
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
/* @__PURE__ */
|
|
2261
|
+
/* @__PURE__ */ jsx24(FormError, { children: error }),
|
|
2262
|
+
/* @__PURE__ */ jsx24(
|
|
2251
2263
|
"button",
|
|
2252
2264
|
{
|
|
2253
2265
|
className: "ba-button",
|
|
2254
2266
|
type: "submit",
|
|
2255
2267
|
disabled: submitting || consentBlocked || authChallenge.configPending,
|
|
2256
2268
|
"aria-busy": submitting || void 0,
|
|
2257
|
-
children: /* @__PURE__ */
|
|
2269
|
+
children: /* @__PURE__ */ jsx24(Busy, { busy: submitting, label: t("signUp.submitPending"), children: t("signUp.submit") })
|
|
2258
2270
|
}
|
|
2259
2271
|
)
|
|
2260
2272
|
] }),
|
|
2261
|
-
showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */
|
|
2262
|
-
showPasswordless && /* @__PURE__ */
|
|
2273
|
+
showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */ jsx24("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
2274
|
+
showPasswordless && /* @__PURE__ */ jsx24(
|
|
2263
2275
|
PasswordlessSignUp,
|
|
2264
2276
|
{
|
|
2265
2277
|
onAuthenticated: () => {
|
|
@@ -2268,25 +2280,25 @@ function SignUp({
|
|
|
2268
2280
|
}
|
|
2269
2281
|
}
|
|
2270
2282
|
),
|
|
2271
|
-
!renderable && /* @__PURE__ */
|
|
2272
|
-
/* @__PURE__ */
|
|
2283
|
+
!renderable && /* @__PURE__ */ jsx24("p", { className: "ba-muted", children: publicSignupAllowed && methods.length > 0 ? t("signUp.empty.unsupported") : t("signUp.empty.none") }),
|
|
2284
|
+
/* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
|
|
2273
2285
|
] });
|
|
2274
2286
|
}
|
|
2275
2287
|
|
|
2276
2288
|
// src/components/ConsentGate.tsx
|
|
2277
|
-
import { Fragment as Fragment6, jsx as
|
|
2289
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2278
2290
|
function ConsentGate({ children, title }) {
|
|
2279
2291
|
const t = useT();
|
|
2280
2292
|
const { needsConsent, status, accept } = useConsent();
|
|
2281
2293
|
const { pending, error, run } = useSubmitAction();
|
|
2282
|
-
if (!needsConsent) return /* @__PURE__ */
|
|
2283
|
-
return /* @__PURE__ */
|
|
2284
|
-
/* @__PURE__ */
|
|
2285
|
-
/* @__PURE__ */
|
|
2286
|
-
links: /* @__PURE__ */
|
|
2294
|
+
if (!needsConsent) return /* @__PURE__ */ jsx25(Fragment6, { children });
|
|
2295
|
+
return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "consent-gate", children: [
|
|
2296
|
+
/* @__PURE__ */ jsx25("h2", { className: "ba-title", children: title ?? t("consent.gateTitle") }),
|
|
2297
|
+
/* @__PURE__ */ jsx25("p", { className: "ba-muted", children: richMessage(t("consent.gateBody"), {
|
|
2298
|
+
links: /* @__PURE__ */ jsx25(ConsentDocLinks, { termsUrl: status?.termsUrl, privacyUrl: status?.privacyUrl })
|
|
2287
2299
|
}) }),
|
|
2288
|
-
/* @__PURE__ */
|
|
2289
|
-
/* @__PURE__ */
|
|
2300
|
+
/* @__PURE__ */ jsx25(FormError, { children: error }),
|
|
2301
|
+
/* @__PURE__ */ jsx25(
|
|
2290
2302
|
"button",
|
|
2291
2303
|
{
|
|
2292
2304
|
className: "ba-button",
|
|
@@ -2300,28 +2312,28 @@ function ConsentGate({ children, title }) {
|
|
|
2300
2312
|
},
|
|
2301
2313
|
{ failure: t("consent.error.acceptFailed") }
|
|
2302
2314
|
),
|
|
2303
|
-
children: /* @__PURE__ */
|
|
2315
|
+
children: /* @__PURE__ */ jsx25(Busy, { busy: pending, label: t("consent.acceptPending"), children: t("consent.acceptSubmit") })
|
|
2304
2316
|
}
|
|
2305
2317
|
),
|
|
2306
|
-
/* @__PURE__ */
|
|
2318
|
+
/* @__PURE__ */ jsx25(AuthOwlBadge, {})
|
|
2307
2319
|
] });
|
|
2308
2320
|
}
|
|
2309
2321
|
|
|
2310
2322
|
// src/components/MFARequiredGate.tsx
|
|
2311
|
-
import { Fragment as Fragment7, jsx as
|
|
2323
|
+
import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2312
2324
|
function MFARequiredGate({ children, title }) {
|
|
2313
2325
|
const state = useConfirmedMfaPending();
|
|
2314
|
-
if (state === "clear") return /* @__PURE__ */
|
|
2326
|
+
if (state === "clear") return /* @__PURE__ */ jsx26(Fragment7, { children });
|
|
2315
2327
|
if (state === "confirming") return null;
|
|
2316
|
-
return /* @__PURE__ */
|
|
2317
|
-
/* @__PURE__ */
|
|
2318
|
-
/* @__PURE__ */
|
|
2328
|
+
return /* @__PURE__ */ jsxs24("div", { className: "ba-form", "data-testid": "mfa-required-gate", children: [
|
|
2329
|
+
/* @__PURE__ */ jsx26(MfaEnrollmentStep, { title }),
|
|
2330
|
+
/* @__PURE__ */ jsx26(AuthOwlBadge, {})
|
|
2319
2331
|
] });
|
|
2320
2332
|
}
|
|
2321
2333
|
|
|
2322
2334
|
// src/components/BackupCodesManager.tsx
|
|
2323
2335
|
import * as React18 from "react";
|
|
2324
|
-
import { Fragment as Fragment8, jsx as
|
|
2336
|
+
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2325
2337
|
function BackupCodesManager({ title }) {
|
|
2326
2338
|
const t = useT();
|
|
2327
2339
|
const { user } = useUser();
|
|
@@ -2340,20 +2352,20 @@ function BackupCodesManager({ title }) {
|
|
|
2340
2352
|
}
|
|
2341
2353
|
});
|
|
2342
2354
|
};
|
|
2343
|
-
return /* @__PURE__ */
|
|
2344
|
-
title !== null && /* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
codes ? /* @__PURE__ */
|
|
2347
|
-
/* @__PURE__ */
|
|
2348
|
-
/* @__PURE__ */
|
|
2355
|
+
return /* @__PURE__ */ jsxs25("div", { className: "ba-form", "data-testid": "backup-codes-manager", children: [
|
|
2356
|
+
title !== null && /* @__PURE__ */ jsx27("h2", { className: "ba-title", children: title ?? t("backupCodes.title") }),
|
|
2357
|
+
/* @__PURE__ */ jsx27("p", { className: "ba-muted", children: t("backupCodes.hint") }),
|
|
2358
|
+
codes ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
|
|
2359
|
+
/* @__PURE__ */ jsxs25("p", { className: "ba-muted", children: [
|
|
2360
|
+
/* @__PURE__ */ jsx27("strong", { children: t("mfa.enroll.backupCodesWarningStrong") }),
|
|
2349
2361
|
" ",
|
|
2350
2362
|
t("mfa.enroll.backupCodesWarningRest")
|
|
2351
2363
|
] }),
|
|
2352
|
-
/* @__PURE__ */
|
|
2353
|
-
] }) : /* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2364
|
+
/* @__PURE__ */ jsx27("ul", { className: "ba-passkey-list", "data-testid": "backup-codes-list", children: codes.map((c) => /* @__PURE__ */ jsx27("li", { className: "ba-passkey-item", children: /* @__PURE__ */ jsx27("code", { children: /* @__PURE__ */ jsx27("bdi", { children: c }) }) }, c)) })
|
|
2365
|
+
] }) : /* @__PURE__ */ jsxs25("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
2366
|
+
/* @__PURE__ */ jsxs25("label", { className: "ba-label", children: [
|
|
2355
2367
|
t("common.passwordLabel"),
|
|
2356
|
-
/* @__PURE__ */
|
|
2368
|
+
/* @__PURE__ */ jsx27(
|
|
2357
2369
|
"input",
|
|
2358
2370
|
{
|
|
2359
2371
|
className: "ba-input",
|
|
@@ -2365,15 +2377,15 @@ function BackupCodesManager({ title }) {
|
|
|
2365
2377
|
}
|
|
2366
2378
|
)
|
|
2367
2379
|
] }),
|
|
2368
|
-
/* @__PURE__ */
|
|
2369
|
-
/* @__PURE__ */
|
|
2380
|
+
/* @__PURE__ */ jsx27(FormError, { children: error }),
|
|
2381
|
+
/* @__PURE__ */ jsx27("button", { className: "ba-button", type: "submit", disabled: pending || !password, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx27(Busy, { busy: pending, label: t("backupCodes.pending"), children: t("backupCodes.submit") }) })
|
|
2370
2382
|
] })
|
|
2371
2383
|
] });
|
|
2372
2384
|
}
|
|
2373
2385
|
|
|
2374
2386
|
// src/components/MagicLinkForm.tsx
|
|
2375
2387
|
import * as React19 from "react";
|
|
2376
|
-
import { jsx as
|
|
2388
|
+
import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2377
2389
|
function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
2378
2390
|
const t = useT();
|
|
2379
2391
|
const { signInMagicLink } = useSignIn();
|
|
@@ -2382,9 +2394,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
2382
2394
|
const [email, setEmail] = React19.useState("");
|
|
2383
2395
|
const [sent, setSent] = React19.useState(false);
|
|
2384
2396
|
if (sent) {
|
|
2385
|
-
return /* @__PURE__ */
|
|
2397
|
+
return /* @__PURE__ */ jsx28("p", { className: "ba-muted", "data-testid": "magiclink-sent", children: t("magicLink.sent") });
|
|
2386
2398
|
}
|
|
2387
|
-
return /* @__PURE__ */
|
|
2399
|
+
return /* @__PURE__ */ jsxs26(
|
|
2388
2400
|
"form",
|
|
2389
2401
|
{
|
|
2390
2402
|
method: "post",
|
|
@@ -2398,9 +2410,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
2398
2410
|
className: "ba-fields",
|
|
2399
2411
|
"data-testid": "magiclink-form",
|
|
2400
2412
|
children: [
|
|
2401
|
-
/* @__PURE__ */
|
|
2413
|
+
/* @__PURE__ */ jsxs26("label", { className: "ba-label", children: [
|
|
2402
2414
|
t("common.emailLabel"),
|
|
2403
|
-
/* @__PURE__ */
|
|
2415
|
+
/* @__PURE__ */ jsx28(
|
|
2404
2416
|
"input",
|
|
2405
2417
|
{
|
|
2406
2418
|
className: "ba-input",
|
|
@@ -2413,15 +2425,15 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
2413
2425
|
)
|
|
2414
2426
|
] }),
|
|
2415
2427
|
authChallenge.control,
|
|
2416
|
-
/* @__PURE__ */
|
|
2417
|
-
/* @__PURE__ */
|
|
2428
|
+
/* @__PURE__ */ jsx28(FormError, { children: error }),
|
|
2429
|
+
/* @__PURE__ */ jsx28(
|
|
2418
2430
|
"button",
|
|
2419
2431
|
{
|
|
2420
2432
|
className: "ba-button",
|
|
2421
2433
|
type: "submit",
|
|
2422
2434
|
disabled: pending || authChallenge.configPending,
|
|
2423
2435
|
"aria-busy": pending || void 0,
|
|
2424
|
-
children: /* @__PURE__ */
|
|
2436
|
+
children: /* @__PURE__ */ jsx28(Busy, { busy: pending, label: t("common.sending"), children: t("magicLink.submit") })
|
|
2425
2437
|
}
|
|
2426
2438
|
)
|
|
2427
2439
|
]
|
|
@@ -2431,7 +2443,7 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
2431
2443
|
|
|
2432
2444
|
// src/components/EmailOtpForm.tsx
|
|
2433
2445
|
import * as React20 from "react";
|
|
2434
|
-
import { jsx as
|
|
2446
|
+
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2435
2447
|
function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
2436
2448
|
const t = useT();
|
|
2437
2449
|
const { sessionStore } = useAuthClient();
|
|
@@ -2442,7 +2454,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
2442
2454
|
const [otp, setOtp] = React20.useState("");
|
|
2443
2455
|
const [stage, setStage] = React20.useState("email");
|
|
2444
2456
|
if (stage === "code") {
|
|
2445
|
-
return /* @__PURE__ */
|
|
2457
|
+
return /* @__PURE__ */ jsx29(
|
|
2446
2458
|
OtpCodeForm,
|
|
2447
2459
|
{
|
|
2448
2460
|
email,
|
|
@@ -2465,7 +2477,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
2465
2477
|
}
|
|
2466
2478
|
);
|
|
2467
2479
|
}
|
|
2468
|
-
return /* @__PURE__ */
|
|
2480
|
+
return /* @__PURE__ */ jsxs27(
|
|
2469
2481
|
"form",
|
|
2470
2482
|
{
|
|
2471
2483
|
method: "post",
|
|
@@ -2479,9 +2491,9 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
2479
2491
|
className: "ba-fields",
|
|
2480
2492
|
"data-testid": "emailotp-email",
|
|
2481
2493
|
children: [
|
|
2482
|
-
/* @__PURE__ */
|
|
2494
|
+
/* @__PURE__ */ jsxs27("label", { className: "ba-label", children: [
|
|
2483
2495
|
t("common.emailLabel"),
|
|
2484
|
-
/* @__PURE__ */
|
|
2496
|
+
/* @__PURE__ */ jsx29(
|
|
2485
2497
|
"input",
|
|
2486
2498
|
{
|
|
2487
2499
|
className: "ba-input",
|
|
@@ -2497,15 +2509,15 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
2497
2509
|
)
|
|
2498
2510
|
] }),
|
|
2499
2511
|
authChallenge.control,
|
|
2500
|
-
/* @__PURE__ */
|
|
2501
|
-
/* @__PURE__ */
|
|
2512
|
+
/* @__PURE__ */ jsx29(FormError, { children: error }),
|
|
2513
|
+
/* @__PURE__ */ jsx29(
|
|
2502
2514
|
"button",
|
|
2503
2515
|
{
|
|
2504
2516
|
className: "ba-button",
|
|
2505
2517
|
type: "submit",
|
|
2506
2518
|
disabled: pending || authChallenge.configPending,
|
|
2507
2519
|
"aria-busy": pending || void 0,
|
|
2508
|
-
children: /* @__PURE__ */
|
|
2520
|
+
children: /* @__PURE__ */ jsx29(Busy, { busy: pending, label: t("common.sending"), children: t("emailOtp.requestSubmit") })
|
|
2509
2521
|
}
|
|
2510
2522
|
)
|
|
2511
2523
|
]
|
|
@@ -2515,7 +2527,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
2515
2527
|
|
|
2516
2528
|
// src/components/ResetPassword.tsx
|
|
2517
2529
|
import * as React21 from "react";
|
|
2518
|
-
import { jsx as
|
|
2530
|
+
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2519
2531
|
function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
2520
2532
|
const t = useT();
|
|
2521
2533
|
const { resetPassword } = usePasswordReset();
|
|
@@ -2535,15 +2547,15 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
2535
2547
|
setReady(true);
|
|
2536
2548
|
}, [tokenProp]);
|
|
2537
2549
|
if (!ready) {
|
|
2538
|
-
return /* @__PURE__ */
|
|
2550
|
+
return /* @__PURE__ */ jsx30("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx30("div", { className: "ba-skeleton" }) });
|
|
2539
2551
|
}
|
|
2540
2552
|
if (!token) {
|
|
2541
|
-
return /* @__PURE__ */
|
|
2553
|
+
return /* @__PURE__ */ jsx30(FormError, { "data-testid": "reset-invalid", children: t("resetPassword.invalidLink") });
|
|
2542
2554
|
}
|
|
2543
2555
|
if (done) {
|
|
2544
|
-
return /* @__PURE__ */
|
|
2556
|
+
return /* @__PURE__ */ jsx30("p", { className: "ba-muted", "data-testid": "reset-done", children: t("resetPassword.done") });
|
|
2545
2557
|
}
|
|
2546
|
-
return /* @__PURE__ */
|
|
2558
|
+
return /* @__PURE__ */ jsxs28(
|
|
2547
2559
|
"form",
|
|
2548
2560
|
{
|
|
2549
2561
|
method: "post",
|
|
@@ -2569,9 +2581,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
2569
2581
|
});
|
|
2570
2582
|
},
|
|
2571
2583
|
children: [
|
|
2572
|
-
/* @__PURE__ */
|
|
2584
|
+
/* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
|
|
2573
2585
|
t("resetPassword.newPasswordLabel"),
|
|
2574
|
-
/* @__PURE__ */
|
|
2586
|
+
/* @__PURE__ */ jsx30(
|
|
2575
2587
|
"input",
|
|
2576
2588
|
{
|
|
2577
2589
|
className: "ba-input",
|
|
@@ -2588,9 +2600,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
2588
2600
|
}
|
|
2589
2601
|
)
|
|
2590
2602
|
] }),
|
|
2591
|
-
/* @__PURE__ */
|
|
2603
|
+
/* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
|
|
2592
2604
|
t("resetPassword.confirmPasswordLabel"),
|
|
2593
|
-
/* @__PURE__ */
|
|
2605
|
+
/* @__PURE__ */ jsx30(
|
|
2594
2606
|
"input",
|
|
2595
2607
|
{
|
|
2596
2608
|
className: "ba-input",
|
|
@@ -2607,8 +2619,8 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
2607
2619
|
}
|
|
2608
2620
|
)
|
|
2609
2621
|
] }),
|
|
2610
|
-
/* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
2622
|
+
/* @__PURE__ */ jsx30(FormError, { children: error }),
|
|
2623
|
+
/* @__PURE__ */ jsx30("button", { className: "ba-button", type: "submit", disabled: pending, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx30(Busy, { busy: pending, label: t("resetPassword.submitPending"), children: t("resetPassword.submit") }) })
|
|
2612
2624
|
]
|
|
2613
2625
|
}
|
|
2614
2626
|
);
|
|
@@ -2616,7 +2628,7 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
2616
2628
|
|
|
2617
2629
|
// src/components/VerifyEmail.tsx
|
|
2618
2630
|
import * as React22 from "react";
|
|
2619
|
-
import { Fragment as Fragment9, jsx as
|
|
2631
|
+
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2620
2632
|
function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
2621
2633
|
const t = useT();
|
|
2622
2634
|
const { sendVerificationEmail } = useEmailVerification();
|
|
@@ -2636,12 +2648,12 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
2636
2648
|
}
|
|
2637
2649
|
}, [onVerified, redirectTo]);
|
|
2638
2650
|
if (!ready) {
|
|
2639
|
-
return /* @__PURE__ */
|
|
2651
|
+
return /* @__PURE__ */ jsx31("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx31("div", { className: "ba-skeleton" }) });
|
|
2640
2652
|
}
|
|
2641
2653
|
if (!failed) {
|
|
2642
|
-
return /* @__PURE__ */
|
|
2654
|
+
return /* @__PURE__ */ jsx31("p", { className: "ba-muted", "data-testid": "verify-success", children: t("verifyEmail.success") });
|
|
2643
2655
|
}
|
|
2644
|
-
return /* @__PURE__ */
|
|
2656
|
+
return /* @__PURE__ */ jsxs29(
|
|
2645
2657
|
"form",
|
|
2646
2658
|
{
|
|
2647
2659
|
method: "post",
|
|
@@ -2656,11 +2668,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
2656
2668
|
});
|
|
2657
2669
|
},
|
|
2658
2670
|
children: [
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
resent ? /* @__PURE__ */
|
|
2661
|
-
/* @__PURE__ */
|
|
2671
|
+
/* @__PURE__ */ jsx31(FormError, { children: t("verifyEmail.invalidLink") }),
|
|
2672
|
+
resent ? /* @__PURE__ */ jsx31("p", { className: "ba-muted", children: richMessage(t("verifyEmail.resent"), { email: /* @__PURE__ */ jsx31(Bidi, { children: email }) }) }) : /* @__PURE__ */ jsxs29(Fragment9, { children: [
|
|
2673
|
+
/* @__PURE__ */ jsxs29("label", { className: "ba-label", children: [
|
|
2662
2674
|
t("common.emailLabel"),
|
|
2663
|
-
/* @__PURE__ */
|
|
2675
|
+
/* @__PURE__ */ jsx31(
|
|
2664
2676
|
"input",
|
|
2665
2677
|
{
|
|
2666
2678
|
className: "ba-input",
|
|
@@ -2673,15 +2685,15 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
2673
2685
|
)
|
|
2674
2686
|
] }),
|
|
2675
2687
|
authChallenge.control,
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2688
|
+
/* @__PURE__ */ jsx31(FormError, { children: error }),
|
|
2689
|
+
/* @__PURE__ */ jsx31(
|
|
2678
2690
|
"button",
|
|
2679
2691
|
{
|
|
2680
2692
|
className: "ba-button",
|
|
2681
2693
|
type: "submit",
|
|
2682
2694
|
disabled: pending || authChallenge.configPending,
|
|
2683
2695
|
"aria-busy": pending || void 0,
|
|
2684
|
-
children: /* @__PURE__ */
|
|
2696
|
+
children: /* @__PURE__ */ jsx31(Busy, { busy: pending, label: t("common.sending"), children: t("verifyEmail.resendSubmit") })
|
|
2685
2697
|
}
|
|
2686
2698
|
)
|
|
2687
2699
|
] })
|
|
@@ -2692,17 +2704,17 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
2692
2704
|
|
|
2693
2705
|
// src/components/PasskeyManager.tsx
|
|
2694
2706
|
import * as React23 from "react";
|
|
2695
|
-
import { jsx as
|
|
2707
|
+
import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2696
2708
|
function PasskeyManager({ title, allowAdd = true } = {}) {
|
|
2697
2709
|
const t = useT();
|
|
2698
2710
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
2699
2711
|
if (!isLoaded) {
|
|
2700
|
-
return /* @__PURE__ */
|
|
2712
|
+
return /* @__PURE__ */ jsx32("div", { className: "ba-form", "data-testid": "passkey-manager-loading", "aria-busy": "true", children: /* @__PURE__ */ jsx32("div", { className: "ba-skeleton" }) });
|
|
2701
2713
|
}
|
|
2702
2714
|
if (!isSignedIn || !user) {
|
|
2703
|
-
return /* @__PURE__ */
|
|
2715
|
+
return /* @__PURE__ */ jsx32("p", { className: "ba-muted", children: t("passkeys.signedOut") });
|
|
2704
2716
|
}
|
|
2705
|
-
return /* @__PURE__ */
|
|
2717
|
+
return /* @__PURE__ */ jsx32(PasskeyManagerBody, { title, allowAdd }, user.id);
|
|
2706
2718
|
}
|
|
2707
2719
|
function PasskeyManagerBody({
|
|
2708
2720
|
title,
|
|
@@ -2751,13 +2763,13 @@ function PasskeyManagerBody({
|
|
|
2751
2763
|
onSuccess: load
|
|
2752
2764
|
});
|
|
2753
2765
|
}
|
|
2754
|
-
return /* @__PURE__ */
|
|
2755
|
-
title !== null && /* @__PURE__ */
|
|
2756
|
-
passkeys === null ? error ? null : /* @__PURE__ */
|
|
2757
|
-
(passkeys ?? []).map((pk) => /* @__PURE__ */
|
|
2758
|
-
/* @__PURE__ */
|
|
2759
|
-
/* @__PURE__ */
|
|
2760
|
-
/* @__PURE__ */
|
|
2766
|
+
return /* @__PURE__ */ jsxs30("div", { className: "ba-form", "data-testid": "passkey-manager", children: [
|
|
2767
|
+
title !== null && /* @__PURE__ */ jsx32("h2", { className: "ba-title", children: title ?? t("passkeys.title") }),
|
|
2768
|
+
passkeys === null ? error ? null : /* @__PURE__ */ jsx32("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs30("ul", { className: "ba-passkey-list", children: [
|
|
2769
|
+
(passkeys ?? []).map((pk) => /* @__PURE__ */ jsxs30("li", { className: "ba-passkey-item", children: [
|
|
2770
|
+
/* @__PURE__ */ jsx32("span", { className: "ba-passkey-name", children: pk.name?.trim() || t("passkeys.unnamed") }),
|
|
2771
|
+
/* @__PURE__ */ jsxs30("span", { className: "ba-passkey-actions", children: [
|
|
2772
|
+
/* @__PURE__ */ jsx32(
|
|
2761
2773
|
"button",
|
|
2762
2774
|
{
|
|
2763
2775
|
type: "button",
|
|
@@ -2767,7 +2779,7 @@ function PasskeyManagerBody({
|
|
|
2767
2779
|
children: t("passkeys.rename")
|
|
2768
2780
|
}
|
|
2769
2781
|
),
|
|
2770
|
-
/* @__PURE__ */
|
|
2782
|
+
/* @__PURE__ */ jsx32(
|
|
2771
2783
|
"button",
|
|
2772
2784
|
{
|
|
2773
2785
|
type: "button",
|
|
@@ -2779,13 +2791,13 @@ function PasskeyManagerBody({
|
|
|
2779
2791
|
)
|
|
2780
2792
|
] })
|
|
2781
2793
|
] }, pk.id)),
|
|
2782
|
-
passkeys !== null && passkeys.length === 0 && /* @__PURE__ */
|
|
2794
|
+
passkeys !== null && passkeys.length === 0 && /* @__PURE__ */ jsx32("li", { className: "ba-muted", children: t("passkeys.empty") })
|
|
2783
2795
|
] }),
|
|
2784
|
-
error && /* @__PURE__ */
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
passkeys === null && /* @__PURE__ */
|
|
2796
|
+
error && /* @__PURE__ */ jsxs30("div", { className: "ba-inline-error", children: [
|
|
2797
|
+
/* @__PURE__ */ jsx32(FormError, { children: error }),
|
|
2798
|
+
passkeys === null && /* @__PURE__ */ jsx32("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("userProfile.retry") })
|
|
2787
2799
|
] }),
|
|
2788
|
-
passkeys !== null && allowAdd && /* @__PURE__ */
|
|
2800
|
+
passkeys !== null && allowAdd && /* @__PURE__ */ jsx32(
|
|
2789
2801
|
"button",
|
|
2790
2802
|
{
|
|
2791
2803
|
className: "ba-button",
|
|
@@ -2796,7 +2808,7 @@ function PasskeyManagerBody({
|
|
|
2796
2808
|
failure: t("passkeys.error.addFailed"),
|
|
2797
2809
|
onSuccess: load
|
|
2798
2810
|
}),
|
|
2799
|
-
children: /* @__PURE__ */
|
|
2811
|
+
children: /* @__PURE__ */ jsx32(Busy, { busy: pending, label: t("common.working"), children: t("passkeys.add") })
|
|
2800
2812
|
}
|
|
2801
2813
|
)
|
|
2802
2814
|
] });
|
|
@@ -2804,14 +2816,14 @@ function PasskeyManagerBody({
|
|
|
2804
2816
|
|
|
2805
2817
|
// src/components/control.tsx
|
|
2806
2818
|
import { membershipHas } from "@authowl/core";
|
|
2807
|
-
import { Fragment as Fragment10, jsx as
|
|
2819
|
+
import { Fragment as Fragment10, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2808
2820
|
function SignedIn({ children }) {
|
|
2809
2821
|
const { isLoaded, isSignedIn } = useUser();
|
|
2810
|
-
return isLoaded && isSignedIn ? /* @__PURE__ */
|
|
2822
|
+
return isLoaded && isSignedIn ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
|
|
2811
2823
|
}
|
|
2812
2824
|
function SignedOut({ children }) {
|
|
2813
2825
|
const { isLoaded, isSignedIn } = useUser();
|
|
2814
|
-
return isLoaded && !isSignedIn ? /* @__PURE__ */
|
|
2826
|
+
return isLoaded && !isSignedIn ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
|
|
2815
2827
|
}
|
|
2816
2828
|
function Protect({
|
|
2817
2829
|
children,
|
|
@@ -2824,36 +2836,36 @@ function Protect({
|
|
|
2824
2836
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
2825
2837
|
const membership = useSession().data?.session?.membership ?? null;
|
|
2826
2838
|
if (!isLoaded) return null;
|
|
2827
|
-
if (!isSignedIn || !user) return /* @__PURE__ */
|
|
2839
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
|
|
2828
2840
|
if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !membershipHas(membership, { role, permission, teamId })) {
|
|
2829
|
-
return /* @__PURE__ */
|
|
2841
|
+
return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
|
|
2830
2842
|
}
|
|
2831
|
-
if (condition && !condition(user)) return /* @__PURE__ */
|
|
2832
|
-
return /* @__PURE__ */
|
|
2843
|
+
if (condition && !condition(user)) return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
|
|
2844
|
+
return /* @__PURE__ */ jsx33(Fragment10, { children });
|
|
2833
2845
|
}
|
|
2834
2846
|
function AuthLoading({ children }) {
|
|
2835
2847
|
const t = useT();
|
|
2836
2848
|
const { isLoaded } = useUser();
|
|
2837
2849
|
if (isLoaded) return null;
|
|
2838
|
-
if (children !== void 0) return /* @__PURE__ */
|
|
2839
|
-
return /* @__PURE__ */
|
|
2840
|
-
/* @__PURE__ */
|
|
2841
|
-
/* @__PURE__ */
|
|
2850
|
+
if (children !== void 0) return /* @__PURE__ */ jsx33(Fragment10, { children });
|
|
2851
|
+
return /* @__PURE__ */ jsxs31("div", { className: "ba-auth-loading", role: "status", "aria-busy": "true", "data-testid": "auth-loading", children: [
|
|
2852
|
+
/* @__PURE__ */ jsx33(Spinner, {}),
|
|
2853
|
+
/* @__PURE__ */ jsx33("span", { className: "ba-sr-only", children: t("common.loading") })
|
|
2842
2854
|
] });
|
|
2843
2855
|
}
|
|
2844
2856
|
function AuthLoaded({ children }) {
|
|
2845
|
-
return useUser().isLoaded ? /* @__PURE__ */
|
|
2857
|
+
return useUser().isLoaded ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
|
|
2846
2858
|
}
|
|
2847
2859
|
|
|
2848
2860
|
// src/components/SignOutButton.tsx
|
|
2849
2861
|
import * as React24 from "react";
|
|
2850
|
-
import { jsx as
|
|
2862
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
2851
2863
|
function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
2852
2864
|
const t = useT();
|
|
2853
2865
|
const { signOut } = useSignOut();
|
|
2854
2866
|
const [pending, setPending] = React24.useState(false);
|
|
2855
2867
|
const content = children ?? t("signOut.button");
|
|
2856
|
-
return /* @__PURE__ */
|
|
2868
|
+
return /* @__PURE__ */ jsx34(
|
|
2857
2869
|
"button",
|
|
2858
2870
|
{
|
|
2859
2871
|
type: "button",
|
|
@@ -2871,7 +2883,7 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
|
2871
2883
|
setPending(false);
|
|
2872
2884
|
}
|
|
2873
2885
|
},
|
|
2874
|
-
children: /* @__PURE__ */
|
|
2886
|
+
children: /* @__PURE__ */ jsx34(Busy, { busy: pending, label: content, children: content })
|
|
2875
2887
|
}
|
|
2876
2888
|
);
|
|
2877
2889
|
}
|
|
@@ -2884,7 +2896,7 @@ import * as React36 from "react";
|
|
|
2884
2896
|
|
|
2885
2897
|
// src/components/user-profile/EmailSection.tsx
|
|
2886
2898
|
import * as React25 from "react";
|
|
2887
|
-
import { jsx as
|
|
2899
|
+
import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2888
2900
|
function EmailSection({ allowChange }) {
|
|
2889
2901
|
const t = useT();
|
|
2890
2902
|
const account = useAccount();
|
|
@@ -2894,9 +2906,9 @@ function EmailSection({ allowChange }) {
|
|
|
2894
2906
|
const [sent, setSent] = React25.useState(false);
|
|
2895
2907
|
const titleId = React25.useId();
|
|
2896
2908
|
if (!user?.email) {
|
|
2897
|
-
return /* @__PURE__ */
|
|
2898
|
-
/* @__PURE__ */
|
|
2899
|
-
/* @__PURE__ */
|
|
2909
|
+
return /* @__PURE__ */ jsxs32("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
2910
|
+
/* @__PURE__ */ jsx35("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
2911
|
+
/* @__PURE__ */ jsx35("p", { className: "ba-muted", children: t("userProfile.email.unavailable") })
|
|
2900
2912
|
] });
|
|
2901
2913
|
}
|
|
2902
2914
|
const submit = (event) => {
|
|
@@ -2916,19 +2928,19 @@ function EmailSection({ allowChange }) {
|
|
|
2916
2928
|
}
|
|
2917
2929
|
);
|
|
2918
2930
|
};
|
|
2919
|
-
return /* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
/* @__PURE__ */
|
|
2931
|
+
return /* @__PURE__ */ jsxs32("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
2932
|
+
/* @__PURE__ */ jsxs32("header", { className: "ba-profile-section-header", children: [
|
|
2933
|
+
/* @__PURE__ */ jsx35("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
2934
|
+
/* @__PURE__ */ jsx35("p", { className: "ba-muted", children: t("userProfile.email.description") })
|
|
2923
2935
|
] }),
|
|
2924
|
-
/* @__PURE__ */
|
|
2925
|
-
/* @__PURE__ */
|
|
2926
|
-
/* @__PURE__ */
|
|
2936
|
+
/* @__PURE__ */ jsxs32("p", { className: "ba-profile-current", children: [
|
|
2937
|
+
/* @__PURE__ */ jsx35("span", { children: t("userProfile.email.current") }),
|
|
2938
|
+
/* @__PURE__ */ jsx35("strong", { children: /* @__PURE__ */ jsx35(Bidi, { children: user.email }) })
|
|
2927
2939
|
] }),
|
|
2928
|
-
!allowChange ? /* @__PURE__ */
|
|
2929
|
-
/* @__PURE__ */
|
|
2940
|
+
!allowChange ? /* @__PURE__ */ jsx35("p", { className: "ba-muted", "data-testid": "email-change-disabled", children: t("userProfile.email.changeDisabled") }) : /* @__PURE__ */ jsxs32("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
2941
|
+
/* @__PURE__ */ jsxs32("label", { className: "ba-label", children: [
|
|
2930
2942
|
t("userProfile.email.newLabel"),
|
|
2931
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsx35(
|
|
2932
2944
|
"input",
|
|
2933
2945
|
{
|
|
2934
2946
|
className: "ba-input",
|
|
@@ -2940,16 +2952,16 @@ function EmailSection({ allowChange }) {
|
|
|
2940
2952
|
}
|
|
2941
2953
|
)
|
|
2942
2954
|
] }),
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
sent && /* @__PURE__ */
|
|
2945
|
-
/* @__PURE__ */
|
|
2955
|
+
/* @__PURE__ */ jsx35(FormError, { children: error }),
|
|
2956
|
+
sent && /* @__PURE__ */ jsx35("p", { className: "ba-success", role: "status", children: t("userProfile.email.sent") }),
|
|
2957
|
+
/* @__PURE__ */ jsx35(
|
|
2946
2958
|
"button",
|
|
2947
2959
|
{
|
|
2948
2960
|
className: "ba-button ba-profile-submit",
|
|
2949
2961
|
type: "submit",
|
|
2950
2962
|
disabled: pending || !newEmail.trim(),
|
|
2951
2963
|
"aria-busy": pending || void 0,
|
|
2952
|
-
children: /* @__PURE__ */
|
|
2964
|
+
children: /* @__PURE__ */ jsx35(Busy, { busy: pending, label: t("common.sending"), children: t("userProfile.email.submit") })
|
|
2953
2965
|
}
|
|
2954
2966
|
)
|
|
2955
2967
|
] })
|
|
@@ -2958,7 +2970,7 @@ function EmailSection({ allowChange }) {
|
|
|
2958
2970
|
|
|
2959
2971
|
// src/components/user-profile/DeleteAccountSection.tsx
|
|
2960
2972
|
import * as React26 from "react";
|
|
2961
|
-
import { jsx as
|
|
2973
|
+
import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2962
2974
|
function DeleteAccountSection({ onDeleted }) {
|
|
2963
2975
|
const t = useT();
|
|
2964
2976
|
const account = useAccount();
|
|
@@ -2983,18 +2995,18 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
2983
2995
|
}
|
|
2984
2996
|
);
|
|
2985
2997
|
};
|
|
2986
|
-
return /* @__PURE__ */
|
|
2987
|
-
/* @__PURE__ */
|
|
2988
|
-
/* @__PURE__ */
|
|
2989
|
-
/* @__PURE__ */
|
|
2998
|
+
return /* @__PURE__ */ jsxs33("section", { className: "ba-profile-section ba-profile-danger-zone", "aria-labelledby": titleId, children: [
|
|
2999
|
+
/* @__PURE__ */ jsxs33("header", { className: "ba-profile-section-header", children: [
|
|
3000
|
+
/* @__PURE__ */ jsx36("h2", { id: titleId, className: "ba-title", children: t("userProfile.delete.title") }),
|
|
3001
|
+
/* @__PURE__ */ jsx36("p", { className: "ba-muted", children: t("userProfile.delete.description") })
|
|
2990
3002
|
] }),
|
|
2991
|
-
/* @__PURE__ */
|
|
2992
|
-
/* @__PURE__ */
|
|
2993
|
-
/* @__PURE__ */
|
|
3003
|
+
/* @__PURE__ */ jsxs33("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3004
|
+
/* @__PURE__ */ jsx36("p", { className: "ba-profile-delete-warning", children: t("userProfile.delete.warning", { identifier }) }),
|
|
3005
|
+
/* @__PURE__ */ jsxs33("label", { className: "ba-label", children: [
|
|
2994
3006
|
t("userProfile.delete.confirmLabel"),
|
|
2995
3007
|
" ",
|
|
2996
|
-
/* @__PURE__ */
|
|
2997
|
-
/* @__PURE__ */
|
|
3008
|
+
/* @__PURE__ */ jsx36(Bidi, { children: identifier }),
|
|
3009
|
+
/* @__PURE__ */ jsx36(
|
|
2998
3010
|
"input",
|
|
2999
3011
|
{
|
|
3000
3012
|
className: "ba-input",
|
|
@@ -3008,15 +3020,15 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
3008
3020
|
}
|
|
3009
3021
|
)
|
|
3010
3022
|
] }),
|
|
3011
|
-
/* @__PURE__ */
|
|
3012
|
-
/* @__PURE__ */
|
|
3023
|
+
/* @__PURE__ */ jsx36(FormError, { children: error }),
|
|
3024
|
+
/* @__PURE__ */ jsx36(
|
|
3013
3025
|
"button",
|
|
3014
3026
|
{
|
|
3015
3027
|
className: "ba-button ba-danger-button ba-profile-submit",
|
|
3016
3028
|
type: "submit",
|
|
3017
3029
|
disabled: pending || !confirmed,
|
|
3018
3030
|
"aria-busy": pending || void 0,
|
|
3019
|
-
children: /* @__PURE__ */
|
|
3031
|
+
children: /* @__PURE__ */ jsx36(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.delete.submit") })
|
|
3020
3032
|
}
|
|
3021
3033
|
)
|
|
3022
3034
|
] })
|
|
@@ -3025,7 +3037,7 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
3025
3037
|
|
|
3026
3038
|
// src/components/user-profile/MfaSection.tsx
|
|
3027
3039
|
import * as React27 from "react";
|
|
3028
|
-
import { jsx as
|
|
3040
|
+
import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3029
3041
|
function MfaSection() {
|
|
3030
3042
|
const t = useT();
|
|
3031
3043
|
const { user } = useUser();
|
|
@@ -3038,12 +3050,12 @@ function MfaSection() {
|
|
|
3038
3050
|
const titleId = React27.useId();
|
|
3039
3051
|
const required = resolveProjectCapabilities(config).mfaRequired;
|
|
3040
3052
|
if (!user?.twoFactorEnabled) {
|
|
3041
|
-
return /* @__PURE__ */
|
|
3042
|
-
/* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3044
|
-
/* @__PURE__ */
|
|
3053
|
+
return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3054
|
+
/* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
|
|
3055
|
+
/* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
3056
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredDescription") : t("userProfile.mfa.description") })
|
|
3045
3057
|
] }),
|
|
3046
|
-
/* @__PURE__ */
|
|
3058
|
+
/* @__PURE__ */ jsx37(
|
|
3047
3059
|
MFAEnrollment,
|
|
3048
3060
|
{
|
|
3049
3061
|
title: null,
|
|
@@ -3066,16 +3078,16 @@ function MfaSection() {
|
|
|
3066
3078
|
}
|
|
3067
3079
|
);
|
|
3068
3080
|
};
|
|
3069
|
-
return /* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
/* @__PURE__ */
|
|
3072
|
-
/* @__PURE__ */
|
|
3081
|
+
return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3082
|
+
/* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
|
|
3083
|
+
/* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
3084
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredActive") : t("userProfile.mfa.active") })
|
|
3073
3085
|
] }),
|
|
3074
|
-
/* @__PURE__ */
|
|
3075
|
-
/* @__PURE__ */
|
|
3076
|
-
/* @__PURE__ */
|
|
3086
|
+
/* @__PURE__ */ jsxs34("div", { className: "ba-profile-status", role: "status", children: [
|
|
3087
|
+
/* @__PURE__ */ jsx37("strong", { children: t("userProfile.mfa.enabled") }),
|
|
3088
|
+
/* @__PURE__ */ jsx37("span", { children: t("userProfile.mfa.authenticator") })
|
|
3077
3089
|
] }),
|
|
3078
|
-
!showDisable ? /* @__PURE__ */
|
|
3090
|
+
!showDisable ? /* @__PURE__ */ jsx37(
|
|
3079
3091
|
"button",
|
|
3080
3092
|
{
|
|
3081
3093
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -3083,11 +3095,11 @@ function MfaSection() {
|
|
|
3083
3095
|
onClick: () => setShowDisable(true),
|
|
3084
3096
|
children: required ? t("userProfile.mfa.replace") : t("userProfile.mfa.disable")
|
|
3085
3097
|
}
|
|
3086
|
-
) : /* @__PURE__ */
|
|
3087
|
-
/* @__PURE__ */
|
|
3088
|
-
/* @__PURE__ */
|
|
3098
|
+
) : /* @__PURE__ */ jsxs34("form", { method: "post", className: "ba-fields ba-profile-security-form", onSubmit: submitDisable, children: [
|
|
3099
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.replaceWarning") : t("userProfile.mfa.disableWarning") }),
|
|
3100
|
+
/* @__PURE__ */ jsxs34("label", { className: "ba-label", children: [
|
|
3089
3101
|
t("common.passwordLabel"),
|
|
3090
|
-
/* @__PURE__ */
|
|
3102
|
+
/* @__PURE__ */ jsx37(
|
|
3091
3103
|
"input",
|
|
3092
3104
|
{
|
|
3093
3105
|
className: "ba-input",
|
|
@@ -3099,19 +3111,19 @@ function MfaSection() {
|
|
|
3099
3111
|
}
|
|
3100
3112
|
)
|
|
3101
3113
|
] }),
|
|
3102
|
-
/* @__PURE__ */
|
|
3103
|
-
/* @__PURE__ */
|
|
3104
|
-
/* @__PURE__ */
|
|
3114
|
+
/* @__PURE__ */ jsx37(FormError, { children: error }),
|
|
3115
|
+
/* @__PURE__ */ jsxs34("span", { className: "ba-profile-action-row", children: [
|
|
3116
|
+
/* @__PURE__ */ jsx37(
|
|
3105
3117
|
"button",
|
|
3106
3118
|
{
|
|
3107
3119
|
className: "ba-button ba-danger-button",
|
|
3108
3120
|
type: "submit",
|
|
3109
3121
|
disabled: pending || !password,
|
|
3110
3122
|
"aria-busy": pending || void 0,
|
|
3111
|
-
children: /* @__PURE__ */
|
|
3123
|
+
children: /* @__PURE__ */ jsx37(Busy, { busy: pending, label: t("common.working"), children: required ? t("userProfile.mfa.replaceConfirm") : t("userProfile.mfa.disableConfirm") })
|
|
3112
3124
|
}
|
|
3113
3125
|
),
|
|
3114
|
-
/* @__PURE__ */
|
|
3126
|
+
/* @__PURE__ */ jsx37(
|
|
3115
3127
|
"button",
|
|
3116
3128
|
{
|
|
3117
3129
|
className: "ba-button ba-button-secondary",
|
|
@@ -3131,7 +3143,7 @@ function MfaSection() {
|
|
|
3131
3143
|
|
|
3132
3144
|
// src/components/user-profile/PasswordSection.tsx
|
|
3133
3145
|
import * as React28 from "react";
|
|
3134
|
-
import { jsx as
|
|
3146
|
+
import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3135
3147
|
function PasswordSection() {
|
|
3136
3148
|
const t = useT();
|
|
3137
3149
|
const account = useAccount();
|
|
@@ -3167,43 +3179,43 @@ function PasswordSection() {
|
|
|
3167
3179
|
}
|
|
3168
3180
|
);
|
|
3169
3181
|
};
|
|
3170
|
-
return /* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
3172
|
-
/* @__PURE__ */
|
|
3173
|
-
/* @__PURE__ */
|
|
3182
|
+
return /* @__PURE__ */ jsxs35("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3183
|
+
/* @__PURE__ */ jsxs35("header", { className: "ba-profile-section-header", children: [
|
|
3184
|
+
/* @__PURE__ */ jsx38("h2", { id: titleId, className: "ba-title", children: t("userProfile.password.title") }),
|
|
3185
|
+
/* @__PURE__ */ jsx38("p", { className: "ba-muted", children: t("userProfile.password.description") })
|
|
3174
3186
|
] }),
|
|
3175
|
-
/* @__PURE__ */
|
|
3176
|
-
/* @__PURE__ */
|
|
3187
|
+
/* @__PURE__ */ jsxs35("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3188
|
+
/* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
|
|
3177
3189
|
t("userProfile.password.currentLabel"),
|
|
3178
|
-
/* @__PURE__ */
|
|
3190
|
+
/* @__PURE__ */ jsx38("input", { className: "ba-input", type: "password", autoComplete: "current-password", value: currentPassword, onChange: (event) => {
|
|
3179
3191
|
setCurrentPassword(event.target.value);
|
|
3180
3192
|
setError(null);
|
|
3181
3193
|
}, required: true })
|
|
3182
3194
|
] }),
|
|
3183
|
-
/* @__PURE__ */
|
|
3195
|
+
/* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
|
|
3184
3196
|
t("resetPassword.newPasswordLabel"),
|
|
3185
|
-
/* @__PURE__ */
|
|
3197
|
+
/* @__PURE__ */ jsx38("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: newPassword, onChange: (event) => {
|
|
3186
3198
|
setNewPassword(event.target.value);
|
|
3187
3199
|
setError(null);
|
|
3188
3200
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
3189
3201
|
] }),
|
|
3190
|
-
/* @__PURE__ */
|
|
3202
|
+
/* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
|
|
3191
3203
|
t("resetPassword.confirmPasswordLabel"),
|
|
3192
|
-
/* @__PURE__ */
|
|
3204
|
+
/* @__PURE__ */ jsx38("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: confirmPassword, onChange: (event) => {
|
|
3193
3205
|
setConfirmPassword(event.target.value);
|
|
3194
3206
|
setError(null);
|
|
3195
3207
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
3196
3208
|
] }),
|
|
3197
|
-
/* @__PURE__ */
|
|
3198
|
-
saved && /* @__PURE__ */
|
|
3199
|
-
/* @__PURE__ */
|
|
3209
|
+
/* @__PURE__ */ jsx38(FormError, { children: error }),
|
|
3210
|
+
saved && /* @__PURE__ */ jsx38("p", { className: "ba-success", role: "status", children: t("userProfile.password.saved") }),
|
|
3211
|
+
/* @__PURE__ */ jsx38(
|
|
3200
3212
|
"button",
|
|
3201
3213
|
{
|
|
3202
3214
|
className: "ba-button ba-profile-submit",
|
|
3203
3215
|
type: "submit",
|
|
3204
3216
|
disabled: pending || !currentPassword || !newPassword || !confirmPassword,
|
|
3205
3217
|
"aria-busy": pending || void 0,
|
|
3206
|
-
children: /* @__PURE__ */
|
|
3218
|
+
children: /* @__PURE__ */ jsx38(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.password.submit") })
|
|
3207
3219
|
}
|
|
3208
3220
|
)
|
|
3209
3221
|
] })
|
|
@@ -3212,22 +3224,22 @@ function PasswordSection() {
|
|
|
3212
3224
|
|
|
3213
3225
|
// src/components/user-profile/PasskeysSection.tsx
|
|
3214
3226
|
import * as React29 from "react";
|
|
3215
|
-
import { jsx as
|
|
3227
|
+
import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3216
3228
|
function PasskeysSection({ allowAdd }) {
|
|
3217
3229
|
const t = useT();
|
|
3218
3230
|
const titleId = React29.useId();
|
|
3219
|
-
return /* @__PURE__ */
|
|
3220
|
-
/* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
3222
|
-
/* @__PURE__ */
|
|
3231
|
+
return /* @__PURE__ */ jsxs36("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3232
|
+
/* @__PURE__ */ jsxs36("header", { className: "ba-profile-section-header", children: [
|
|
3233
|
+
/* @__PURE__ */ jsx39("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
|
|
3234
|
+
/* @__PURE__ */ jsx39("p", { className: "ba-muted", children: t("userProfile.passkeys.description") })
|
|
3223
3235
|
] }),
|
|
3224
|
-
/* @__PURE__ */
|
|
3236
|
+
/* @__PURE__ */ jsx39(PasskeyManager, { title: null, allowAdd })
|
|
3225
3237
|
] });
|
|
3226
3238
|
}
|
|
3227
3239
|
|
|
3228
3240
|
// src/components/user-profile/ProfileSection.tsx
|
|
3229
3241
|
import * as React30 from "react";
|
|
3230
|
-
import { Fragment as Fragment11, jsx as
|
|
3242
|
+
import { Fragment as Fragment11, jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3231
3243
|
function ProfileSection({
|
|
3232
3244
|
firstLastName,
|
|
3233
3245
|
usernameEnabled,
|
|
@@ -3269,15 +3281,15 @@ function ProfileSection({
|
|
|
3269
3281
|
}
|
|
3270
3282
|
);
|
|
3271
3283
|
};
|
|
3272
|
-
return /* @__PURE__ */
|
|
3273
|
-
/* @__PURE__ */
|
|
3274
|
-
/* @__PURE__ */
|
|
3275
|
-
/* @__PURE__ */
|
|
3284
|
+
return /* @__PURE__ */ jsxs37("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3285
|
+
/* @__PURE__ */ jsxs37("header", { className: "ba-profile-section-header", children: [
|
|
3286
|
+
/* @__PURE__ */ jsx40("h2", { id: titleId, className: "ba-title", children: t("userProfile.profile.title") }),
|
|
3287
|
+
/* @__PURE__ */ jsx40("p", { className: "ba-muted", children: t("userProfile.profile.description") })
|
|
3276
3288
|
] }),
|
|
3277
|
-
/* @__PURE__ */
|
|
3278
|
-
legacyNameField && /* @__PURE__ */
|
|
3289
|
+
/* @__PURE__ */ jsxs37("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3290
|
+
legacyNameField && /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
3279
3291
|
t("signUp.nameLabel"),
|
|
3280
|
-
/* @__PURE__ */
|
|
3292
|
+
/* @__PURE__ */ jsx40(
|
|
3281
3293
|
"input",
|
|
3282
3294
|
{
|
|
3283
3295
|
className: "ba-input",
|
|
@@ -3288,10 +3300,10 @@ function ProfileSection({
|
|
|
3288
3300
|
}
|
|
3289
3301
|
)
|
|
3290
3302
|
] }),
|
|
3291
|
-
firstLastName && /* @__PURE__ */
|
|
3292
|
-
/* @__PURE__ */
|
|
3303
|
+
firstLastName && /* @__PURE__ */ jsxs37(Fragment11, { children: [
|
|
3304
|
+
/* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
3293
3305
|
t("signUp.firstNameLabel"),
|
|
3294
|
-
/* @__PURE__ */
|
|
3306
|
+
/* @__PURE__ */ jsx40(
|
|
3295
3307
|
"input",
|
|
3296
3308
|
{
|
|
3297
3309
|
className: "ba-input",
|
|
@@ -3301,9 +3313,9 @@ function ProfileSection({
|
|
|
3301
3313
|
}
|
|
3302
3314
|
)
|
|
3303
3315
|
] }),
|
|
3304
|
-
/* @__PURE__ */
|
|
3316
|
+
/* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
3305
3317
|
t("signUp.lastNameLabel"),
|
|
3306
|
-
/* @__PURE__ */
|
|
3318
|
+
/* @__PURE__ */ jsx40(
|
|
3307
3319
|
"input",
|
|
3308
3320
|
{
|
|
3309
3321
|
className: "ba-input",
|
|
@@ -3314,9 +3326,9 @@ function ProfileSection({
|
|
|
3314
3326
|
)
|
|
3315
3327
|
] })
|
|
3316
3328
|
] }),
|
|
3317
|
-
usernameEnabled && /* @__PURE__ */
|
|
3329
|
+
usernameEnabled && /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
3318
3330
|
t("common.usernameLabel"),
|
|
3319
|
-
/* @__PURE__ */
|
|
3331
|
+
/* @__PURE__ */ jsx40(
|
|
3320
3332
|
"input",
|
|
3321
3333
|
{
|
|
3322
3334
|
className: "ba-input",
|
|
@@ -3326,9 +3338,9 @@ function ProfileSection({
|
|
|
3326
3338
|
}
|
|
3327
3339
|
)
|
|
3328
3340
|
] }),
|
|
3329
|
-
/* @__PURE__ */
|
|
3341
|
+
/* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
3330
3342
|
t("userProfile.profile.imageLabel"),
|
|
3331
|
-
/* @__PURE__ */
|
|
3343
|
+
/* @__PURE__ */ jsx40(
|
|
3332
3344
|
"input",
|
|
3333
3345
|
{
|
|
3334
3346
|
className: "ba-input",
|
|
@@ -3339,16 +3351,16 @@ function ProfileSection({
|
|
|
3339
3351
|
}
|
|
3340
3352
|
)
|
|
3341
3353
|
] }),
|
|
3342
|
-
/* @__PURE__ */
|
|
3343
|
-
saved && /* @__PURE__ */
|
|
3344
|
-
/* @__PURE__ */
|
|
3354
|
+
/* @__PURE__ */ jsx40(FormError, { children: error }),
|
|
3355
|
+
saved && /* @__PURE__ */ jsx40("p", { className: "ba-success", role: "status", children: t("userProfile.profile.saved") }),
|
|
3356
|
+
/* @__PURE__ */ jsx40(
|
|
3345
3357
|
"button",
|
|
3346
3358
|
{
|
|
3347
3359
|
className: "ba-button ba-profile-submit",
|
|
3348
3360
|
type: "submit",
|
|
3349
3361
|
disabled: pending || legacyNameField && !name.trim(),
|
|
3350
3362
|
"aria-busy": pending || void 0,
|
|
3351
|
-
children: /* @__PURE__ */
|
|
3363
|
+
children: /* @__PURE__ */ jsx40(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.save") })
|
|
3352
3364
|
}
|
|
3353
3365
|
)
|
|
3354
3366
|
] })
|
|
@@ -3357,24 +3369,24 @@ function ProfileSection({
|
|
|
3357
3369
|
|
|
3358
3370
|
// src/components/user-profile/RecoverySection.tsx
|
|
3359
3371
|
import * as React31 from "react";
|
|
3360
|
-
import { Fragment as Fragment12, jsx as
|
|
3372
|
+
import { Fragment as Fragment12, jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3361
3373
|
function RecoverySection() {
|
|
3362
3374
|
const t = useT();
|
|
3363
3375
|
const { user } = useUser();
|
|
3364
3376
|
const titleId = React31.useId();
|
|
3365
|
-
return /* @__PURE__ */
|
|
3366
|
-
/* @__PURE__ */
|
|
3367
|
-
/* @__PURE__ */
|
|
3368
|
-
/* @__PURE__ */
|
|
3377
|
+
return /* @__PURE__ */ jsxs38("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3378
|
+
/* @__PURE__ */ jsxs38("header", { className: "ba-profile-section-header", children: [
|
|
3379
|
+
/* @__PURE__ */ jsx41("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
|
|
3380
|
+
/* @__PURE__ */ jsx41("p", { className: "ba-muted", children: t("userProfile.recovery.description") })
|
|
3369
3381
|
] }),
|
|
3370
|
-
/* @__PURE__ */
|
|
3371
|
-
/* @__PURE__ */
|
|
3372
|
-
user?.email && user.emailVerified ? /* @__PURE__ */
|
|
3373
|
-
/* @__PURE__ */
|
|
3374
|
-
/* @__PURE__ */
|
|
3375
|
-
] }) : /* @__PURE__ */
|
|
3382
|
+
/* @__PURE__ */ jsxs38("div", { className: "ba-profile-recovery-card", children: [
|
|
3383
|
+
/* @__PURE__ */ jsx41("strong", { children: t("userProfile.recovery.emailTitle") }),
|
|
3384
|
+
user?.email && user.emailVerified ? /* @__PURE__ */ jsxs38(Fragment12, { children: [
|
|
3385
|
+
/* @__PURE__ */ jsx41("p", { children: t("userProfile.recovery.emailDescription") }),
|
|
3386
|
+
/* @__PURE__ */ jsx41(Bidi, { children: user.email })
|
|
3387
|
+
] }) : /* @__PURE__ */ jsx41("p", { children: t("userProfile.recovery.emailUnavailable") })
|
|
3376
3388
|
] }),
|
|
3377
|
-
/* @__PURE__ */
|
|
3389
|
+
/* @__PURE__ */ jsx41(BackupCodesManager, { title: null })
|
|
3378
3390
|
] });
|
|
3379
3391
|
}
|
|
3380
3392
|
|
|
@@ -3427,9 +3439,9 @@ function formatSessionTime(date, locale) {
|
|
|
3427
3439
|
|
|
3428
3440
|
// src/components/user-profile/use-account-resource.ts
|
|
3429
3441
|
import * as React32 from "react";
|
|
3430
|
-
function useAccountResource(
|
|
3431
|
-
const loaderRef = React32.useRef(
|
|
3432
|
-
loaderRef.current =
|
|
3442
|
+
function useAccountResource(loader, failure) {
|
|
3443
|
+
const loaderRef = React32.useRef(loader);
|
|
3444
|
+
loaderRef.current = loader;
|
|
3433
3445
|
const failureRef = React32.useRef(failure);
|
|
3434
3446
|
failureRef.current = failure;
|
|
3435
3447
|
const toServerError = useServerError();
|
|
@@ -3466,7 +3478,7 @@ function useAccountResource(loader2, failure) {
|
|
|
3466
3478
|
}
|
|
3467
3479
|
|
|
3468
3480
|
// src/components/user-profile/SessionsSection.tsx
|
|
3469
|
-
import { jsx as
|
|
3481
|
+
import { jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3470
3482
|
function SessionsSection() {
|
|
3471
3483
|
const t = useT();
|
|
3472
3484
|
const locale = useLocale();
|
|
@@ -3495,31 +3507,31 @@ function SessionsSection() {
|
|
|
3495
3507
|
}
|
|
3496
3508
|
);
|
|
3497
3509
|
};
|
|
3498
|
-
return /* @__PURE__ */
|
|
3499
|
-
/* @__PURE__ */
|
|
3500
|
-
/* @__PURE__ */
|
|
3501
|
-
/* @__PURE__ */
|
|
3510
|
+
return /* @__PURE__ */ jsxs39("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3511
|
+
/* @__PURE__ */ jsxs39("header", { className: "ba-profile-section-header", children: [
|
|
3512
|
+
/* @__PURE__ */ jsx42("h2", { id: titleId, className: "ba-title", children: t("userProfile.sessions.title") }),
|
|
3513
|
+
/* @__PURE__ */ jsx42("p", { className: "ba-muted", children: t("userProfile.sessions.description") })
|
|
3502
3514
|
] }),
|
|
3503
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */
|
|
3504
|
-
/* @__PURE__ */
|
|
3505
|
-
/* @__PURE__ */
|
|
3506
|
-
] }) : null : /* @__PURE__ */
|
|
3515
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ jsxs39("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: [
|
|
3516
|
+
/* @__PURE__ */ jsx42("div", { className: "ba-skeleton" }),
|
|
3517
|
+
/* @__PURE__ */ jsx42("div", { className: "ba-skeleton" })
|
|
3518
|
+
] }) : null : /* @__PURE__ */ jsxs39("ul", { className: "ba-profile-list", children: [
|
|
3507
3519
|
sessions.map((session) => {
|
|
3508
3520
|
const label2 = session.userAgent?.trim() || t("userProfile.sessions.unknownDevice");
|
|
3509
|
-
return /* @__PURE__ */
|
|
3510
|
-
/* @__PURE__ */
|
|
3511
|
-
/* @__PURE__ */
|
|
3512
|
-
/* @__PURE__ */
|
|
3513
|
-
session.id === currentId && /* @__PURE__ */
|
|
3521
|
+
return /* @__PURE__ */ jsxs39("li", { className: "ba-profile-list-item", children: [
|
|
3522
|
+
/* @__PURE__ */ jsxs39("span", { children: [
|
|
3523
|
+
/* @__PURE__ */ jsx42("strong", { children: label2 }),
|
|
3524
|
+
/* @__PURE__ */ jsxs39("small", { children: [
|
|
3525
|
+
session.id === currentId && /* @__PURE__ */ jsx42("em", { children: t("userProfile.sessions.current") }),
|
|
3514
3526
|
formatSessionTime(session.updatedAt, locale)
|
|
3515
3527
|
] })
|
|
3516
3528
|
] }),
|
|
3517
|
-
/* @__PURE__ */
|
|
3529
|
+
/* @__PURE__ */ jsx42("button", { className: "ba-link-button ba-danger", type: "button", disabled: mutation.pending, onClick: () => revoke(session.id, label2), children: t("userProfile.sessions.revoke") })
|
|
3518
3530
|
] }, session.id);
|
|
3519
3531
|
}),
|
|
3520
|
-
sessions.length === 0 && /* @__PURE__ */
|
|
3532
|
+
sessions.length === 0 && /* @__PURE__ */ jsx42("li", { className: "ba-muted", children: t("userProfile.sessions.empty") })
|
|
3521
3533
|
] }),
|
|
3522
|
-
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */
|
|
3534
|
+
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ jsx42(
|
|
3523
3535
|
"button",
|
|
3524
3536
|
{
|
|
3525
3537
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -3535,17 +3547,17 @@ function SessionsSection() {
|
|
|
3535
3547
|
children: t("userProfile.sessions.revokeOthers")
|
|
3536
3548
|
}
|
|
3537
3549
|
),
|
|
3538
|
-
resource.error && /* @__PURE__ */
|
|
3539
|
-
/* @__PURE__ */
|
|
3540
|
-
/* @__PURE__ */
|
|
3550
|
+
resource.error && /* @__PURE__ */ jsxs39("div", { className: "ba-profile-inline-error", children: [
|
|
3551
|
+
/* @__PURE__ */ jsx42(FormError, { children: resource.error }),
|
|
3552
|
+
/* @__PURE__ */ jsx42("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
3541
3553
|
] }),
|
|
3542
|
-
/* @__PURE__ */
|
|
3554
|
+
/* @__PURE__ */ jsx42(FormError, { children: mutation.error })
|
|
3543
3555
|
] });
|
|
3544
3556
|
}
|
|
3545
3557
|
|
|
3546
3558
|
// src/components/user-profile/SocialSection.tsx
|
|
3547
3559
|
import * as React34 from "react";
|
|
3548
|
-
import { jsx as
|
|
3560
|
+
import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3549
3561
|
function providerLabel(provider) {
|
|
3550
3562
|
return provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
3551
3563
|
}
|
|
@@ -3585,18 +3597,18 @@ function SocialSection() {
|
|
|
3585
3597
|
{ failure: t("userProfile.social.unlinkError"), onSuccess: resource.load }
|
|
3586
3598
|
);
|
|
3587
3599
|
};
|
|
3588
|
-
return /* @__PURE__ */
|
|
3589
|
-
/* @__PURE__ */
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3600
|
+
return /* @__PURE__ */ jsxs40("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3601
|
+
/* @__PURE__ */ jsxs40("header", { className: "ba-profile-section-header", children: [
|
|
3602
|
+
/* @__PURE__ */ jsx43("h2", { id: titleId, className: "ba-title", children: t("userProfile.social.title") }),
|
|
3603
|
+
/* @__PURE__ */ jsx43("p", { className: "ba-muted", children: t("userProfile.social.description") })
|
|
3592
3604
|
] }),
|
|
3593
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */
|
|
3594
|
-
linked.map((item) => /* @__PURE__ */
|
|
3595
|
-
/* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
3597
|
-
/* @__PURE__ */
|
|
3605
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ jsx43("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: /* @__PURE__ */ jsx43("div", { className: "ba-skeleton" }) }) : null : /* @__PURE__ */ jsxs40("ul", { className: "ba-profile-list", children: [
|
|
3606
|
+
linked.map((item) => /* @__PURE__ */ jsxs40("li", { className: "ba-profile-list-item", children: [
|
|
3607
|
+
/* @__PURE__ */ jsxs40("span", { children: [
|
|
3608
|
+
/* @__PURE__ */ jsx43("strong", { children: providerLabel(item.providerId) }),
|
|
3609
|
+
/* @__PURE__ */ jsx43("small", { children: item.canUnlink ? t("userProfile.social.connected") : t("userProfile.social.lastMethod") })
|
|
3598
3610
|
] }),
|
|
3599
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ jsx43(
|
|
3600
3612
|
"button",
|
|
3601
3613
|
{
|
|
3602
3614
|
className: "ba-link-button ba-danger",
|
|
@@ -3611,23 +3623,23 @@ function SocialSection() {
|
|
|
3611
3623
|
}
|
|
3612
3624
|
)
|
|
3613
3625
|
] }, item.id)),
|
|
3614
|
-
linked.length === 0 && /* @__PURE__ */
|
|
3626
|
+
linked.length === 0 && /* @__PURE__ */ jsx43("li", { className: "ba-muted", children: t("userProfile.social.empty") })
|
|
3615
3627
|
] }),
|
|
3616
|
-
available.length > 0 && /* @__PURE__ */
|
|
3617
|
-
/* @__PURE__ */
|
|
3618
|
-
available.map((provider) => /* @__PURE__ */
|
|
3628
|
+
available.length > 0 && /* @__PURE__ */ jsxs40("div", { className: "ba-profile-provider-actions", children: [
|
|
3629
|
+
/* @__PURE__ */ jsx43("p", { className: "ba-profile-subtitle", children: t("userProfile.social.add") }),
|
|
3630
|
+
available.map((provider) => /* @__PURE__ */ jsx43("button", { type: "button", className: "ba-button ba-button-secondary", disabled: mutation.pending, onClick: () => link(provider), children: t("userProfile.social.connectProvider", { provider: providerLabel(provider) }) }, provider))
|
|
3619
3631
|
] }),
|
|
3620
|
-
resource.error && /* @__PURE__ */
|
|
3621
|
-
/* @__PURE__ */
|
|
3622
|
-
/* @__PURE__ */
|
|
3632
|
+
resource.error && /* @__PURE__ */ jsxs40("div", { className: "ba-profile-inline-error", children: [
|
|
3633
|
+
/* @__PURE__ */ jsx43(FormError, { children: resource.error }),
|
|
3634
|
+
/* @__PURE__ */ jsx43("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
3623
3635
|
] }),
|
|
3624
|
-
/* @__PURE__ */
|
|
3636
|
+
/* @__PURE__ */ jsx43(FormError, { children: mutation.error })
|
|
3625
3637
|
] });
|
|
3626
3638
|
}
|
|
3627
3639
|
|
|
3628
3640
|
// src/components/user-profile/UserProfileModal.tsx
|
|
3629
3641
|
import * as React35 from "react";
|
|
3630
|
-
import { jsx as
|
|
3642
|
+
import { jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3631
3643
|
function UserProfileModal({
|
|
3632
3644
|
children,
|
|
3633
3645
|
onClose,
|
|
@@ -3635,7 +3647,7 @@ function UserProfileModal({
|
|
|
3635
3647
|
}) {
|
|
3636
3648
|
const t = useT();
|
|
3637
3649
|
const titleId = React35.useId();
|
|
3638
|
-
return /* @__PURE__ */
|
|
3650
|
+
return /* @__PURE__ */ jsxs41(
|
|
3639
3651
|
ModalSurface,
|
|
3640
3652
|
{
|
|
3641
3653
|
overlayClassName: "ba-profile-overlay",
|
|
@@ -3644,13 +3656,13 @@ function UserProfileModal({
|
|
|
3644
3656
|
testId: "user-profile-modal",
|
|
3645
3657
|
onClose,
|
|
3646
3658
|
children: [
|
|
3647
|
-
/* @__PURE__ */
|
|
3648
|
-
/* @__PURE__ */
|
|
3659
|
+
/* @__PURE__ */ jsxs41("div", { className: "ba-profile-modal-header", children: [
|
|
3660
|
+
/* @__PURE__ */ jsxs41("span", { children: [
|
|
3649
3661
|
branding,
|
|
3650
|
-
/* @__PURE__ */
|
|
3651
|
-
/* @__PURE__ */
|
|
3662
|
+
/* @__PURE__ */ jsx44("h1", { id: titleId, children: t("userProfile.title") }),
|
|
3663
|
+
/* @__PURE__ */ jsx44("p", { children: t("userProfile.description") })
|
|
3652
3664
|
] }),
|
|
3653
|
-
/* @__PURE__ */
|
|
3665
|
+
/* @__PURE__ */ jsx44(
|
|
3654
3666
|
"button",
|
|
3655
3667
|
{
|
|
3656
3668
|
type: "button",
|
|
@@ -3658,7 +3670,7 @@ function UserProfileModal({
|
|
|
3658
3670
|
"aria-label": t("userProfile.close"),
|
|
3659
3671
|
onClick: onClose,
|
|
3660
3672
|
autoFocus: true,
|
|
3661
|
-
children: /* @__PURE__ */
|
|
3673
|
+
children: /* @__PURE__ */ jsx44("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx44(
|
|
3662
3674
|
"path",
|
|
3663
3675
|
{
|
|
3664
3676
|
d: "M6 6l12 12M18 6L6 18",
|
|
@@ -3671,14 +3683,14 @@ function UserProfileModal({
|
|
|
3671
3683
|
)
|
|
3672
3684
|
] }),
|
|
3673
3685
|
children,
|
|
3674
|
-
/* @__PURE__ */
|
|
3686
|
+
/* @__PURE__ */ jsx44("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx44(AuthOwlBadge, {}) })
|
|
3675
3687
|
]
|
|
3676
3688
|
}
|
|
3677
3689
|
);
|
|
3678
3690
|
}
|
|
3679
3691
|
|
|
3680
3692
|
// src/components/UserProfile.tsx
|
|
3681
|
-
import { jsx as
|
|
3693
|
+
import { jsx as jsx45, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3682
3694
|
var SECTION_KEYS = {
|
|
3683
3695
|
profile: "userProfile.nav.profile",
|
|
3684
3696
|
email: "userProfile.nav.email",
|
|
@@ -3744,11 +3756,11 @@ function UserProfile(props = {}) {
|
|
|
3744
3756
|
window.history.replaceState(null, "", userProfileSectionHash(next));
|
|
3745
3757
|
}
|
|
3746
3758
|
};
|
|
3747
|
-
const content = !isLoaded ? /* @__PURE__ */
|
|
3748
|
-
/* @__PURE__ */
|
|
3749
|
-
/* @__PURE__ */
|
|
3750
|
-
/* @__PURE__ */
|
|
3751
|
-
] }) : !isSignedIn || !user ? /* @__PURE__ */
|
|
3759
|
+
const content = !isLoaded ? /* @__PURE__ */ jsxs42("div", { className: "ba-profile-loading", "aria-busy": "true", children: [
|
|
3760
|
+
/* @__PURE__ */ jsx45("div", { className: "ba-skeleton" }),
|
|
3761
|
+
/* @__PURE__ */ jsx45("div", { className: "ba-skeleton" }),
|
|
3762
|
+
/* @__PURE__ */ jsx45("div", { className: "ba-skeleton" })
|
|
3763
|
+
] }) : !isSignedIn || !user ? /* @__PURE__ */ jsx45("p", { className: "ba-muted", children: t("userProfile.signedOut") }) : /* @__PURE__ */ jsx45(
|
|
3752
3764
|
UserProfileBody,
|
|
3753
3765
|
{
|
|
3754
3766
|
active: visibleActive,
|
|
@@ -3760,23 +3772,23 @@ function UserProfile(props = {}) {
|
|
|
3760
3772
|
user.id
|
|
3761
3773
|
);
|
|
3762
3774
|
if (props.mode === "modal") {
|
|
3763
|
-
return /* @__PURE__ */
|
|
3775
|
+
return /* @__PURE__ */ jsx45(
|
|
3764
3776
|
UserProfileModal,
|
|
3765
3777
|
{
|
|
3766
3778
|
onClose: props.onClose,
|
|
3767
|
-
branding: showBranding ? /* @__PURE__ */
|
|
3779
|
+
branding: showBranding ? /* @__PURE__ */ jsx45(AuthOwlBranding, {}) : null,
|
|
3768
3780
|
children: content
|
|
3769
3781
|
}
|
|
3770
3782
|
);
|
|
3771
3783
|
}
|
|
3772
|
-
return /* @__PURE__ */
|
|
3773
|
-
/* @__PURE__ */
|
|
3774
|
-
showBranding ? /* @__PURE__ */
|
|
3775
|
-
/* @__PURE__ */
|
|
3776
|
-
/* @__PURE__ */
|
|
3784
|
+
return /* @__PURE__ */ jsxs42("article", { className: "ba-profile ba-profile-page", "data-testid": "user-profile", children: [
|
|
3785
|
+
/* @__PURE__ */ jsxs42("header", { className: "ba-profile-heading", children: [
|
|
3786
|
+
showBranding ? /* @__PURE__ */ jsx45(AuthOwlBranding, {}) : null,
|
|
3787
|
+
/* @__PURE__ */ jsx45("h1", { children: t("userProfile.title") }),
|
|
3788
|
+
/* @__PURE__ */ jsx45("p", { children: t("userProfile.description") })
|
|
3777
3789
|
] }),
|
|
3778
3790
|
content,
|
|
3779
|
-
/* @__PURE__ */
|
|
3791
|
+
/* @__PURE__ */ jsx45("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx45(AuthOwlBadge, {}) })
|
|
3780
3792
|
] });
|
|
3781
3793
|
}
|
|
3782
3794
|
function UserProfileBody({
|
|
@@ -3787,8 +3799,8 @@ function UserProfileBody({
|
|
|
3787
3799
|
capabilities
|
|
3788
3800
|
}) {
|
|
3789
3801
|
const t = useT();
|
|
3790
|
-
return /* @__PURE__ */
|
|
3791
|
-
/* @__PURE__ */
|
|
3802
|
+
return /* @__PURE__ */ jsxs42("div", { className: "ba-profile-layout", children: [
|
|
3803
|
+
/* @__PURE__ */ jsx45("nav", { className: "ba-profile-nav", "aria-label": t("userProfile.nav.aria"), children: sections.map((item) => /* @__PURE__ */ jsx45(
|
|
3792
3804
|
"button",
|
|
3793
3805
|
{
|
|
3794
3806
|
type: "button",
|
|
@@ -3799,8 +3811,8 @@ function UserProfileBody({
|
|
|
3799
3811
|
},
|
|
3800
3812
|
item
|
|
3801
3813
|
)) }),
|
|
3802
|
-
/* @__PURE__ */
|
|
3803
|
-
active === "profile" && /* @__PURE__ */
|
|
3814
|
+
/* @__PURE__ */ jsxs42("div", { className: "ba-profile-content", "data-section": active, children: [
|
|
3815
|
+
active === "profile" && /* @__PURE__ */ jsx45(
|
|
3804
3816
|
ProfileSection,
|
|
3805
3817
|
{
|
|
3806
3818
|
firstLastName: capabilities.firstLastName,
|
|
@@ -3808,43 +3820,54 @@ function UserProfileBody({
|
|
|
3808
3820
|
legacyNameField: capabilities.legacyNameField
|
|
3809
3821
|
}
|
|
3810
3822
|
),
|
|
3811
|
-
active === "email" && /* @__PURE__ */
|
|
3812
|
-
active === "password" && /* @__PURE__ */
|
|
3813
|
-
active === "social" && /* @__PURE__ */
|
|
3814
|
-
active === "sessions" && /* @__PURE__ */
|
|
3815
|
-
active === "passkeys" && /* @__PURE__ */
|
|
3816
|
-
active === "mfa" && /* @__PURE__ */
|
|
3817
|
-
active === "recovery" && /* @__PURE__ */
|
|
3818
|
-
active === "danger" && /* @__PURE__ */
|
|
3823
|
+
active === "email" && /* @__PURE__ */ jsx45(EmailSection, { allowChange: capabilities.emailChange }),
|
|
3824
|
+
active === "password" && /* @__PURE__ */ jsx45(PasswordSection, {}),
|
|
3825
|
+
active === "social" && /* @__PURE__ */ jsx45(SocialSection, {}),
|
|
3826
|
+
active === "sessions" && /* @__PURE__ */ jsx45(SessionsSection, {}),
|
|
3827
|
+
active === "passkeys" && /* @__PURE__ */ jsx45(PasskeysSection, { allowAdd: capabilities.passkeyAdd }),
|
|
3828
|
+
active === "mfa" && /* @__PURE__ */ jsx45(MfaSection, {}),
|
|
3829
|
+
active === "recovery" && /* @__PURE__ */ jsx45(RecoverySection, {}),
|
|
3830
|
+
active === "danger" && /* @__PURE__ */ jsx45(DeleteAccountSection, { onDeleted })
|
|
3819
3831
|
] })
|
|
3820
3832
|
] });
|
|
3821
3833
|
}
|
|
3822
3834
|
|
|
3823
3835
|
// src/components/UserButton.tsx
|
|
3824
|
-
import { jsx as
|
|
3836
|
+
import { jsx as jsx46, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3825
3837
|
function UserButton() {
|
|
3826
3838
|
const t = useT();
|
|
3827
3839
|
const { user, isLoaded } = useUser();
|
|
3828
3840
|
const { signOut } = useSignOut();
|
|
3829
3841
|
const [open, setOpen] = React37.useState(false);
|
|
3830
3842
|
const [profileOpen, setProfileOpen] = React37.useState(false);
|
|
3843
|
+
const [failedImage, setFailedImage] = React37.useState(null);
|
|
3831
3844
|
const triggerRef = React37.useRef(null);
|
|
3832
3845
|
if (!isLoaded || !user) return null;
|
|
3833
3846
|
const identity = user.email ?? user.phoneNumber ?? user.name ?? "?";
|
|
3834
|
-
|
|
3835
|
-
|
|
3847
|
+
const image = user.image ?? null;
|
|
3848
|
+
return /* @__PURE__ */ jsxs43("div", { className: "ba-user-button", "data-testid": "user-button", children: [
|
|
3849
|
+
/* @__PURE__ */ jsx46(
|
|
3836
3850
|
"button",
|
|
3837
3851
|
{
|
|
3838
3852
|
ref: triggerRef,
|
|
3839
3853
|
className: "ba-user-button-trigger",
|
|
3840
3854
|
"aria-label": t("userButton.openMenuAria"),
|
|
3841
3855
|
onClick: () => setOpen((v) => !v),
|
|
3842
|
-
children:
|
|
3856
|
+
children: image && failedImage !== image ? /* @__PURE__ */ jsx46(
|
|
3857
|
+
"img",
|
|
3858
|
+
{
|
|
3859
|
+
className: "ba-avatar",
|
|
3860
|
+
src: image,
|
|
3861
|
+
alt: "",
|
|
3862
|
+
referrerPolicy: "no-referrer",
|
|
3863
|
+
onError: () => setFailedImage(image)
|
|
3864
|
+
}
|
|
3865
|
+
) : /* @__PURE__ */ jsx46("span", { className: "ba-avatar ba-avatar-fallback", children: identity[0]?.toUpperCase() })
|
|
3843
3866
|
}
|
|
3844
3867
|
),
|
|
3845
|
-
open && /* @__PURE__ */
|
|
3846
|
-
/* @__PURE__ */
|
|
3847
|
-
/* @__PURE__ */
|
|
3868
|
+
open && /* @__PURE__ */ jsxs43("div", { className: "ba-menu", children: [
|
|
3869
|
+
/* @__PURE__ */ jsx46("p", { className: "ba-menu-label", children: identity }),
|
|
3870
|
+
/* @__PURE__ */ jsx46(
|
|
3848
3871
|
"button",
|
|
3849
3872
|
{
|
|
3850
3873
|
className: "ba-menu-item",
|
|
@@ -3855,10 +3878,10 @@ function UserButton() {
|
|
|
3855
3878
|
children: t("userButton.manageAccount")
|
|
3856
3879
|
}
|
|
3857
3880
|
),
|
|
3858
|
-
/* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ jsx46("button", { className: "ba-menu-item", onClick: () => signOut(), children: t("userButton.signOut") }),
|
|
3882
|
+
/* @__PURE__ */ jsx46("div", { className: "ba-menu-badge", children: /* @__PURE__ */ jsx46(AuthOwlBadge, {}) })
|
|
3860
3883
|
] }),
|
|
3861
|
-
profileOpen && /* @__PURE__ */
|
|
3884
|
+
profileOpen && /* @__PURE__ */ jsx46(
|
|
3862
3885
|
UserProfile,
|
|
3863
3886
|
{
|
|
3864
3887
|
mode: "modal",
|
|
@@ -3878,7 +3901,7 @@ import * as React45 from "react";
|
|
|
3878
3901
|
|
|
3879
3902
|
// src/components/CreateOrganization.tsx
|
|
3880
3903
|
import * as React38 from "react";
|
|
3881
|
-
import { jsx as
|
|
3904
|
+
import { jsx as jsx47, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
3882
3905
|
function CreateOrganization({ onCreated, title } = {}) {
|
|
3883
3906
|
const t = useT();
|
|
3884
3907
|
const { config, isLoading: configLoading } = usePublicConfig();
|
|
@@ -3890,10 +3913,10 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3890
3913
|
const [logo, setLogo] = React38.useState("");
|
|
3891
3914
|
const [slugTouched, setSlugTouched] = React38.useState(false);
|
|
3892
3915
|
if (configLoading || !isLoaded) {
|
|
3893
|
-
return /* @__PURE__ */
|
|
3916
|
+
return /* @__PURE__ */ jsx47("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
3894
3917
|
}
|
|
3895
3918
|
if (config?.organizations !== true) return null;
|
|
3896
|
-
if (!isSignedIn) return /* @__PURE__ */
|
|
3919
|
+
if (!isSignedIn) return /* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
3897
3920
|
const submit = (event) => {
|
|
3898
3921
|
event.preventDefault();
|
|
3899
3922
|
const normalizedName = name.trim();
|
|
@@ -3918,15 +3941,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3918
3941
|
}
|
|
3919
3942
|
);
|
|
3920
3943
|
};
|
|
3921
|
-
return /* @__PURE__ */
|
|
3922
|
-
title !== null && /* @__PURE__ */
|
|
3923
|
-
/* @__PURE__ */
|
|
3924
|
-
/* @__PURE__ */
|
|
3944
|
+
return /* @__PURE__ */ jsxs44("section", { className: "ba-organization-create", children: [
|
|
3945
|
+
title !== null && /* @__PURE__ */ jsxs44("header", { className: "ba-organization-section-header", children: [
|
|
3946
|
+
/* @__PURE__ */ jsx47("h2", { className: "ba-title", children: title ?? t("organization.create.title") }),
|
|
3947
|
+
/* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("organization.create.description") })
|
|
3925
3948
|
] }),
|
|
3926
|
-
/* @__PURE__ */
|
|
3927
|
-
/* @__PURE__ */
|
|
3949
|
+
/* @__PURE__ */ jsxs44("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3950
|
+
/* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
|
|
3928
3951
|
t("organization.create.name"),
|
|
3929
|
-
/* @__PURE__ */
|
|
3952
|
+
/* @__PURE__ */ jsx47(
|
|
3930
3953
|
"input",
|
|
3931
3954
|
{
|
|
3932
3955
|
className: "ba-input",
|
|
@@ -3941,9 +3964,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3941
3964
|
}
|
|
3942
3965
|
)
|
|
3943
3966
|
] }),
|
|
3944
|
-
/* @__PURE__ */
|
|
3967
|
+
/* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
|
|
3945
3968
|
t("organization.create.slug"),
|
|
3946
|
-
/* @__PURE__ */
|
|
3969
|
+
/* @__PURE__ */ jsx47(
|
|
3947
3970
|
"input",
|
|
3948
3971
|
{
|
|
3949
3972
|
className: "ba-input",
|
|
@@ -3958,9 +3981,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3958
3981
|
}
|
|
3959
3982
|
)
|
|
3960
3983
|
] }),
|
|
3961
|
-
/* @__PURE__ */
|
|
3984
|
+
/* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
|
|
3962
3985
|
t("organization.create.logo"),
|
|
3963
|
-
/* @__PURE__ */
|
|
3986
|
+
/* @__PURE__ */ jsx47(
|
|
3964
3987
|
"input",
|
|
3965
3988
|
{
|
|
3966
3989
|
className: "ba-input",
|
|
@@ -3972,15 +3995,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3972
3995
|
}
|
|
3973
3996
|
)
|
|
3974
3997
|
] }),
|
|
3975
|
-
/* @__PURE__ */
|
|
3976
|
-
/* @__PURE__ */
|
|
3998
|
+
/* @__PURE__ */ jsx47(FormError, { children: error }),
|
|
3999
|
+
/* @__PURE__ */ jsx47(
|
|
3977
4000
|
"button",
|
|
3978
4001
|
{
|
|
3979
4002
|
className: "ba-button ba-profile-submit",
|
|
3980
4003
|
type: "submit",
|
|
3981
4004
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
3982
4005
|
"aria-busy": pending || void 0,
|
|
3983
|
-
children: /* @__PURE__ */
|
|
4006
|
+
children: /* @__PURE__ */ jsx47(Busy, { busy: pending, label: t("common.working"), children: t("organization.create.submit") })
|
|
3984
4007
|
}
|
|
3985
4008
|
)
|
|
3986
4009
|
] })
|
|
@@ -3989,7 +4012,7 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3989
4012
|
|
|
3990
4013
|
// src/components/organization/OrganizationModal.tsx
|
|
3991
4014
|
import * as React39 from "react";
|
|
3992
|
-
import { jsx as
|
|
4015
|
+
import { jsx as jsx48, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
3993
4016
|
function OrganizationModal({
|
|
3994
4017
|
title,
|
|
3995
4018
|
onClose,
|
|
@@ -3998,7 +4021,7 @@ function OrganizationModal({
|
|
|
3998
4021
|
}) {
|
|
3999
4022
|
const t = useT();
|
|
4000
4023
|
const titleId = React39.useId();
|
|
4001
|
-
return /* @__PURE__ */
|
|
4024
|
+
return /* @__PURE__ */ jsxs45(
|
|
4002
4025
|
ModalSurface,
|
|
4003
4026
|
{
|
|
4004
4027
|
overlayClassName: "ba-organization-overlay",
|
|
@@ -4007,9 +4030,9 @@ function OrganizationModal({
|
|
|
4007
4030
|
returnFocusRef,
|
|
4008
4031
|
onClose,
|
|
4009
4032
|
children: [
|
|
4010
|
-
/* @__PURE__ */
|
|
4011
|
-
/* @__PURE__ */
|
|
4012
|
-
/* @__PURE__ */
|
|
4033
|
+
/* @__PURE__ */ jsxs45("div", { className: "ba-organization-modal-header", children: [
|
|
4034
|
+
/* @__PURE__ */ jsx48("h2", { id: titleId, className: "ba-title", children: title }),
|
|
4035
|
+
/* @__PURE__ */ jsx48(
|
|
4013
4036
|
"button",
|
|
4014
4037
|
{
|
|
4015
4038
|
className: "ba-profile-close",
|
|
@@ -4021,7 +4044,7 @@ function OrganizationModal({
|
|
|
4021
4044
|
}
|
|
4022
4045
|
)
|
|
4023
4046
|
] }),
|
|
4024
|
-
/* @__PURE__ */
|
|
4047
|
+
/* @__PURE__ */ jsx48("div", { className: "ba-organization-modal-body", children })
|
|
4025
4048
|
]
|
|
4026
4049
|
}
|
|
4027
4050
|
);
|
|
@@ -4086,7 +4109,7 @@ import * as React44 from "react";
|
|
|
4086
4109
|
|
|
4087
4110
|
// src/components/organization/DangerSection.tsx
|
|
4088
4111
|
import * as React41 from "react";
|
|
4089
|
-
import { jsx as
|
|
4112
|
+
import { jsx as jsx49, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4090
4113
|
function DangerSection({
|
|
4091
4114
|
organization,
|
|
4092
4115
|
membership,
|
|
@@ -4127,43 +4150,43 @@ function DangerSection({
|
|
|
4127
4150
|
}
|
|
4128
4151
|
);
|
|
4129
4152
|
};
|
|
4130
|
-
return /* @__PURE__ */
|
|
4131
|
-
/* @__PURE__ */
|
|
4132
|
-
/* @__PURE__ */
|
|
4133
|
-
/* @__PURE__ */
|
|
4153
|
+
return /* @__PURE__ */ jsxs46("section", { className: "ba-organization-section ba-organization-danger", children: [
|
|
4154
|
+
/* @__PURE__ */ jsxs46("header", { className: "ba-organization-section-header", children: [
|
|
4155
|
+
/* @__PURE__ */ jsx49("h3", { className: "ba-title", children: t("organization.profile.danger.title") }),
|
|
4156
|
+
/* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.profile.danger.description") })
|
|
4134
4157
|
] }),
|
|
4135
|
-
/* @__PURE__ */
|
|
4136
|
-
/* @__PURE__ */
|
|
4137
|
-
/* @__PURE__ */
|
|
4138
|
-
/* @__PURE__ */
|
|
4158
|
+
/* @__PURE__ */ jsxs46("div", { className: "ba-organization-danger-action", children: [
|
|
4159
|
+
/* @__PURE__ */ jsx49("strong", { children: t("organization.profile.danger.leaveTitle") }),
|
|
4160
|
+
/* @__PURE__ */ jsx49("p", { className: "ba-muted", children: isOwner ? t("organization.profile.danger.ownerLeaveHint") : t("organization.profile.danger.leaveHint") }),
|
|
4161
|
+
/* @__PURE__ */ jsx49("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: leave, children: t("organization.profile.danger.leave") })
|
|
4139
4162
|
] }),
|
|
4140
|
-
isOwner && /* @__PURE__ */
|
|
4141
|
-
/* @__PURE__ */
|
|
4142
|
-
/* @__PURE__ */
|
|
4143
|
-
/* @__PURE__ */
|
|
4163
|
+
isOwner && /* @__PURE__ */ jsxs46("form", { method: "post", className: "ba-organization-danger-action ba-organization-delete", onSubmit: remove, children: [
|
|
4164
|
+
/* @__PURE__ */ jsx49("strong", { children: t("organization.profile.danger.deleteTitle") }),
|
|
4165
|
+
/* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.profile.danger.deleteHint") }),
|
|
4166
|
+
/* @__PURE__ */ jsxs46("label", { className: "ba-label", children: [
|
|
4144
4167
|
t("organization.profile.danger.deleteConfirm"),
|
|
4145
4168
|
" ",
|
|
4146
|
-
/* @__PURE__ */
|
|
4147
|
-
/* @__PURE__ */
|
|
4169
|
+
/* @__PURE__ */ jsx49(Bidi, { children: organization.slug }),
|
|
4170
|
+
/* @__PURE__ */ jsx49("input", { className: "ba-input", dir: "ltr", value: confirmation, onChange: (event) => setConfirmation(event.target.value), autoComplete: "off", required: true })
|
|
4148
4171
|
] }),
|
|
4149
|
-
/* @__PURE__ */
|
|
4172
|
+
/* @__PURE__ */ jsx49(
|
|
4150
4173
|
"button",
|
|
4151
4174
|
{
|
|
4152
4175
|
className: "ba-button ba-danger-button",
|
|
4153
4176
|
type: "submit",
|
|
4154
4177
|
disabled: pending || !confirmed,
|
|
4155
4178
|
"aria-busy": pending || void 0,
|
|
4156
|
-
children: /* @__PURE__ */
|
|
4179
|
+
children: /* @__PURE__ */ jsx49(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.danger.delete") })
|
|
4157
4180
|
}
|
|
4158
4181
|
)
|
|
4159
4182
|
] }),
|
|
4160
|
-
/* @__PURE__ */
|
|
4183
|
+
/* @__PURE__ */ jsx49(FormError, { children: error })
|
|
4161
4184
|
] });
|
|
4162
4185
|
}
|
|
4163
4186
|
|
|
4164
4187
|
// src/components/organization/GeneralSection.tsx
|
|
4165
4188
|
import * as React42 from "react";
|
|
4166
|
-
import { jsx as
|
|
4189
|
+
import { jsx as jsx50, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
4167
4190
|
function GeneralSection({
|
|
4168
4191
|
organization,
|
|
4169
4192
|
canManage,
|
|
@@ -4181,16 +4204,16 @@ function GeneralSection({
|
|
|
4181
4204
|
setLogo(organization.logo ?? "");
|
|
4182
4205
|
}, [organization.id, organization.logo, organization.name, organization.slug]);
|
|
4183
4206
|
if (!canManage) {
|
|
4184
|
-
return /* @__PURE__ */
|
|
4185
|
-
/* @__PURE__ */
|
|
4186
|
-
/* @__PURE__ */
|
|
4187
|
-
/* @__PURE__ */
|
|
4188
|
-
/* @__PURE__ */
|
|
4189
|
-
/* @__PURE__ */
|
|
4207
|
+
return /* @__PURE__ */ jsxs47("section", { className: "ba-organization-section", children: [
|
|
4208
|
+
/* @__PURE__ */ jsx50("p", { className: "ba-muted", children: t("organization.profile.general.readOnly") }),
|
|
4209
|
+
/* @__PURE__ */ jsxs47("dl", { className: "ba-organization-facts", children: [
|
|
4210
|
+
/* @__PURE__ */ jsxs47("div", { children: [
|
|
4211
|
+
/* @__PURE__ */ jsx50("dt", { children: t("organization.create.name") }),
|
|
4212
|
+
/* @__PURE__ */ jsx50("dd", { children: organization.name })
|
|
4190
4213
|
] }),
|
|
4191
|
-
/* @__PURE__ */
|
|
4192
|
-
/* @__PURE__ */
|
|
4193
|
-
/* @__PURE__ */
|
|
4214
|
+
/* @__PURE__ */ jsxs47("div", { children: [
|
|
4215
|
+
/* @__PURE__ */ jsx50("dt", { children: t("organization.create.slug") }),
|
|
4216
|
+
/* @__PURE__ */ jsx50("dd", { children: /* @__PURE__ */ jsx50(Bidi, { children: organization.slug }) })
|
|
4194
4217
|
] })
|
|
4195
4218
|
] })
|
|
4196
4219
|
] });
|
|
@@ -4208,19 +4231,19 @@ function GeneralSection({
|
|
|
4208
4231
|
}
|
|
4209
4232
|
);
|
|
4210
4233
|
};
|
|
4211
|
-
return /* @__PURE__ */
|
|
4212
|
-
/* @__PURE__ */
|
|
4213
|
-
/* @__PURE__ */
|
|
4214
|
-
/* @__PURE__ */
|
|
4234
|
+
return /* @__PURE__ */ jsxs47("section", { className: "ba-organization-section", children: [
|
|
4235
|
+
/* @__PURE__ */ jsxs47("header", { className: "ba-organization-section-header", children: [
|
|
4236
|
+
/* @__PURE__ */ jsx50("h3", { className: "ba-title", children: t("organization.profile.general.title") }),
|
|
4237
|
+
/* @__PURE__ */ jsx50("p", { className: "ba-muted", children: t("organization.profile.general.description") })
|
|
4215
4238
|
] }),
|
|
4216
|
-
/* @__PURE__ */
|
|
4217
|
-
/* @__PURE__ */
|
|
4239
|
+
/* @__PURE__ */ jsxs47("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
4240
|
+
/* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
|
|
4218
4241
|
t("organization.create.name"),
|
|
4219
|
-
/* @__PURE__ */
|
|
4242
|
+
/* @__PURE__ */ jsx50("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
|
|
4220
4243
|
] }),
|
|
4221
|
-
/* @__PURE__ */
|
|
4244
|
+
/* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
|
|
4222
4245
|
t("organization.create.slug"),
|
|
4223
|
-
/* @__PURE__ */
|
|
4246
|
+
/* @__PURE__ */ jsx50(
|
|
4224
4247
|
"input",
|
|
4225
4248
|
{
|
|
4226
4249
|
className: "ba-input",
|
|
@@ -4232,19 +4255,19 @@ function GeneralSection({
|
|
|
4232
4255
|
}
|
|
4233
4256
|
)
|
|
4234
4257
|
] }),
|
|
4235
|
-
/* @__PURE__ */
|
|
4258
|
+
/* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
|
|
4236
4259
|
t("organization.create.logo"),
|
|
4237
|
-
/* @__PURE__ */
|
|
4260
|
+
/* @__PURE__ */ jsx50("input", { className: "ba-input", type: "url", dir: "ltr", value: logo, onChange: (event) => setLogo(event.target.value), placeholder: "https://" })
|
|
4238
4261
|
] }),
|
|
4239
|
-
/* @__PURE__ */
|
|
4240
|
-
/* @__PURE__ */
|
|
4262
|
+
/* @__PURE__ */ jsx50(FormError, { children: error }),
|
|
4263
|
+
/* @__PURE__ */ jsx50(
|
|
4241
4264
|
"button",
|
|
4242
4265
|
{
|
|
4243
4266
|
className: "ba-button ba-profile-submit",
|
|
4244
4267
|
type: "submit",
|
|
4245
4268
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
4246
4269
|
"aria-busy": pending || void 0,
|
|
4247
|
-
children: /* @__PURE__ */
|
|
4270
|
+
children: /* @__PURE__ */ jsx50(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.general.save") })
|
|
4248
4271
|
}
|
|
4249
4272
|
)
|
|
4250
4273
|
] })
|
|
@@ -4267,7 +4290,7 @@ function organizationRoleLabel(role, t) {
|
|
|
4267
4290
|
}
|
|
4268
4291
|
|
|
4269
4292
|
// src/components/organization/InvitationsSection.tsx
|
|
4270
|
-
import { jsx as
|
|
4293
|
+
import { jsx as jsx51, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
4271
4294
|
function InvitationsSection({
|
|
4272
4295
|
organization,
|
|
4273
4296
|
onChanged
|
|
@@ -4299,44 +4322,44 @@ function InvitationsSection({
|
|
|
4299
4322
|
{ failure: t("organization.profile.invitations.cancelError"), onSuccess: onChanged }
|
|
4300
4323
|
);
|
|
4301
4324
|
};
|
|
4302
|
-
return /* @__PURE__ */
|
|
4303
|
-
/* @__PURE__ */
|
|
4304
|
-
/* @__PURE__ */
|
|
4305
|
-
/* @__PURE__ */
|
|
4325
|
+
return /* @__PURE__ */ jsxs48("section", { className: "ba-organization-section", children: [
|
|
4326
|
+
/* @__PURE__ */ jsxs48("header", { className: "ba-organization-section-header", children: [
|
|
4327
|
+
/* @__PURE__ */ jsx51("h3", { className: "ba-title", children: t("organization.profile.invitations.title") }),
|
|
4328
|
+
/* @__PURE__ */ jsx51("p", { className: "ba-muted", children: t("organization.profile.invitations.description") })
|
|
4306
4329
|
] }),
|
|
4307
|
-
/* @__PURE__ */
|
|
4308
|
-
/* @__PURE__ */
|
|
4330
|
+
/* @__PURE__ */ jsxs48("form", { method: "post", className: "ba-organization-invite-form", onSubmit: invite, children: [
|
|
4331
|
+
/* @__PURE__ */ jsxs48("label", { className: "ba-label", children: [
|
|
4309
4332
|
t("organization.profile.invitations.email"),
|
|
4310
|
-
/* @__PURE__ */
|
|
4333
|
+
/* @__PURE__ */ jsx51("input", { className: "ba-input", type: "email", dir: "ltr", value: email, onChange: (event) => setEmail(event.target.value), required: true })
|
|
4311
4334
|
] }),
|
|
4312
|
-
/* @__PURE__ */
|
|
4335
|
+
/* @__PURE__ */ jsxs48("label", { className: "ba-label", children: [
|
|
4313
4336
|
t("organization.profile.members.role"),
|
|
4314
|
-
/* @__PURE__ */
|
|
4337
|
+
/* @__PURE__ */ jsx51("select", { className: "ba-input", value: role, onChange: (event) => setRole(event.target.value), children: roles.map((option) => /* @__PURE__ */ jsx51("option", { value: option, children: organizationRoleLabel(option, t) }, option)) })
|
|
4315
4338
|
] }),
|
|
4316
|
-
/* @__PURE__ */
|
|
4339
|
+
/* @__PURE__ */ jsx51(
|
|
4317
4340
|
"button",
|
|
4318
4341
|
{
|
|
4319
4342
|
className: "ba-button",
|
|
4320
4343
|
type: "submit",
|
|
4321
4344
|
disabled: pending || !email.trim(),
|
|
4322
4345
|
"aria-busy": pending || void 0,
|
|
4323
|
-
children: /* @__PURE__ */
|
|
4346
|
+
children: /* @__PURE__ */ jsx51(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.invitations.invite") })
|
|
4324
4347
|
}
|
|
4325
4348
|
)
|
|
4326
4349
|
] }),
|
|
4327
|
-
/* @__PURE__ */
|
|
4328
|
-
invitations.length === 0 ? /* @__PURE__ */
|
|
4329
|
-
/* @__PURE__ */
|
|
4330
|
-
/* @__PURE__ */
|
|
4331
|
-
/* @__PURE__ */
|
|
4350
|
+
/* @__PURE__ */ jsx51(FormError, { children: error }),
|
|
4351
|
+
invitations.length === 0 ? /* @__PURE__ */ jsx51("p", { className: "ba-muted", children: t("organization.profile.invitations.empty") }) : /* @__PURE__ */ jsx51("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ jsxs48("li", { className: "ba-organization-invitation", children: [
|
|
4352
|
+
/* @__PURE__ */ jsxs48("span", { children: [
|
|
4353
|
+
/* @__PURE__ */ jsx51("strong", { children: /* @__PURE__ */ jsx51(Bidi, { children: invitation.email }) }),
|
|
4354
|
+
/* @__PURE__ */ jsx51("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
4332
4355
|
] }),
|
|
4333
|
-
/* @__PURE__ */
|
|
4356
|
+
/* @__PURE__ */ jsx51("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => cancel(invitation), children: t("organization.profile.invitations.cancel") })
|
|
4334
4357
|
] }, invitation.id)) })
|
|
4335
4358
|
] });
|
|
4336
4359
|
}
|
|
4337
4360
|
|
|
4338
4361
|
// src/components/organization/MembersSection.tsx
|
|
4339
|
-
import { jsx as
|
|
4362
|
+
import { jsx as jsx52, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
4340
4363
|
function MembersSection({
|
|
4341
4364
|
organization,
|
|
4342
4365
|
userId,
|
|
@@ -4363,27 +4386,27 @@ function MembersSection({
|
|
|
4363
4386
|
{ failure: t("organization.profile.members.removeError"), onSuccess: onChanged }
|
|
4364
4387
|
);
|
|
4365
4388
|
};
|
|
4366
|
-
return /* @__PURE__ */
|
|
4367
|
-
/* @__PURE__ */
|
|
4368
|
-
/* @__PURE__ */
|
|
4369
|
-
/* @__PURE__ */
|
|
4389
|
+
return /* @__PURE__ */ jsxs49("section", { className: "ba-organization-section", children: [
|
|
4390
|
+
/* @__PURE__ */ jsxs49("header", { className: "ba-organization-section-header", children: [
|
|
4391
|
+
/* @__PURE__ */ jsx52("h3", { className: "ba-title", children: t("organization.profile.members.title") }),
|
|
4392
|
+
/* @__PURE__ */ jsx52("p", { className: "ba-muted", children: t("organization.profile.members.description") })
|
|
4370
4393
|
] }),
|
|
4371
|
-
/* @__PURE__ */
|
|
4372
|
-
/* @__PURE__ */
|
|
4394
|
+
/* @__PURE__ */ jsx52(FormError, { children: error }),
|
|
4395
|
+
/* @__PURE__ */ jsx52("ul", { className: "ba-organization-list", children: organization.members.map((member) => {
|
|
4373
4396
|
const primaryRole = organizationRoles(member.role)[0] ?? member.role;
|
|
4374
4397
|
const isCurrent = member.userId === userId;
|
|
4375
|
-
return /* @__PURE__ */
|
|
4376
|
-
/* @__PURE__ */
|
|
4377
|
-
/* @__PURE__ */
|
|
4378
|
-
/* @__PURE__ */
|
|
4398
|
+
return /* @__PURE__ */ jsxs49("li", { className: "ba-organization-member", children: [
|
|
4399
|
+
/* @__PURE__ */ jsx52("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: member.user.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4400
|
+
/* @__PURE__ */ jsxs49("span", { className: "ba-organization-member-copy", children: [
|
|
4401
|
+
/* @__PURE__ */ jsxs49("strong", { children: [
|
|
4379
4402
|
member.user.name,
|
|
4380
4403
|
isCurrent ? ` ${t("organization.profile.members.you")}` : ""
|
|
4381
4404
|
] }),
|
|
4382
|
-
/* @__PURE__ */
|
|
4405
|
+
/* @__PURE__ */ jsx52("small", { children: /* @__PURE__ */ jsx52(Bidi, { children: member.user.email }) })
|
|
4383
4406
|
] }),
|
|
4384
|
-
canManage && !isCurrent ? /* @__PURE__ */
|
|
4385
|
-
/* @__PURE__ */
|
|
4386
|
-
/* @__PURE__ */
|
|
4407
|
+
canManage && !isCurrent ? /* @__PURE__ */ jsxs49("span", { className: "ba-organization-member-actions", children: [
|
|
4408
|
+
/* @__PURE__ */ jsx52("label", { className: "ba-sr-only", htmlFor: `organization-role-${member.id}`, children: t("organization.profile.members.role") }),
|
|
4409
|
+
/* @__PURE__ */ jsx52(
|
|
4387
4410
|
"select",
|
|
4388
4411
|
{
|
|
4389
4412
|
id: `organization-role-${member.id}`,
|
|
@@ -4391,18 +4414,18 @@ function MembersSection({
|
|
|
4391
4414
|
value: primaryRole,
|
|
4392
4415
|
disabled: pending,
|
|
4393
4416
|
onChange: (event) => updateRole(member, event.target.value),
|
|
4394
|
-
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */
|
|
4417
|
+
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */ jsx52("option", { value: role, children: organizationRoleLabel(role, t) }, role))
|
|
4395
4418
|
}
|
|
4396
4419
|
),
|
|
4397
|
-
/* @__PURE__ */
|
|
4398
|
-
] }) : /* @__PURE__ */
|
|
4420
|
+
/* @__PURE__ */ jsx52("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(member), children: t("organization.profile.members.remove") })
|
|
4421
|
+
] }) : /* @__PURE__ */ jsx52("span", { className: "ba-organization-role-label", children: /* @__PURE__ */ jsx52(Bidi, { children: organizationRoleLabel(member.role, t) }) })
|
|
4399
4422
|
] }, member.id);
|
|
4400
4423
|
}) })
|
|
4401
4424
|
] });
|
|
4402
4425
|
}
|
|
4403
4426
|
|
|
4404
4427
|
// src/components/OrganizationProfile.tsx
|
|
4405
|
-
import { jsx as
|
|
4428
|
+
import { jsx as jsx53, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
4406
4429
|
var SECTION_KEYS2 = {
|
|
4407
4430
|
general: "organization.profile.nav.general",
|
|
4408
4431
|
members: "organization.profile.nav.members",
|
|
@@ -4410,7 +4433,7 @@ var SECTION_KEYS2 = {
|
|
|
4410
4433
|
invitations: "organization.profile.nav.invitations",
|
|
4411
4434
|
danger: "organization.profile.nav.danger"
|
|
4412
4435
|
};
|
|
4413
|
-
var TeamsSection = React44.lazy(() => import("./TeamsSection-
|
|
4436
|
+
var TeamsSection = React44.lazy(() => import("./TeamsSection-ZQDNMWV3.js"));
|
|
4414
4437
|
function OrganizationProfile({ organizationId, defaultSection = "general", onDeleted, onLeft } = {}) {
|
|
4415
4438
|
const t = useT();
|
|
4416
4439
|
const toServerError = useServerError();
|
|
@@ -4457,20 +4480,20 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
4457
4480
|
requestRef.current += 1;
|
|
4458
4481
|
};
|
|
4459
4482
|
}, [load]);
|
|
4460
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */
|
|
4483
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ jsx53("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
4461
4484
|
if (config?.organizations !== true) return null;
|
|
4462
|
-
if (!isSignedIn || !user) return /* @__PURE__ */
|
|
4463
|
-
if (wasRemoved) return /* @__PURE__ */
|
|
4464
|
-
if (!requestedId) return /* @__PURE__ */
|
|
4485
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
4486
|
+
if (wasRemoved) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
4487
|
+
if (!requestedId) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
4465
4488
|
if (error) {
|
|
4466
|
-
return /* @__PURE__ */
|
|
4467
|
-
/* @__PURE__ */
|
|
4468
|
-
/* @__PURE__ */
|
|
4489
|
+
return /* @__PURE__ */ jsxs50("div", { className: "ba-inline-error", children: [
|
|
4490
|
+
/* @__PURE__ */ jsx53(FormError, { children: error }),
|
|
4491
|
+
/* @__PURE__ */ jsx53("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
|
|
4469
4492
|
] });
|
|
4470
4493
|
}
|
|
4471
|
-
if (!organization) return /* @__PURE__ */
|
|
4494
|
+
if (!organization) return /* @__PURE__ */ jsx53("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
4472
4495
|
const membership = organization.members.find((member) => member.userId === user.id);
|
|
4473
|
-
if (!membership) return /* @__PURE__ */
|
|
4496
|
+
if (!membership) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.notMember") });
|
|
4474
4497
|
const canManage = canManageOrganization(membership);
|
|
4475
4498
|
const visibleSections = canManage ? ["general", "members", "teams", "invitations", "danger"] : ["general", "members", "teams", "danger"];
|
|
4476
4499
|
const activeSection = visibleSections.includes(section) ? section : "general";
|
|
@@ -4479,16 +4502,16 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
4479
4502
|
setOrganization(null);
|
|
4480
4503
|
callback?.(removedOrganization);
|
|
4481
4504
|
};
|
|
4482
|
-
return /* @__PURE__ */
|
|
4483
|
-
/* @__PURE__ */
|
|
4484
|
-
/* @__PURE__ */
|
|
4485
|
-
/* @__PURE__ */
|
|
4486
|
-
/* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */
|
|
4505
|
+
return /* @__PURE__ */ jsxs50("article", { className: "ba-organization-profile", children: [
|
|
4506
|
+
/* @__PURE__ */ jsxs50("header", { className: "ba-organization-profile-heading", children: [
|
|
4507
|
+
/* @__PURE__ */ jsx53("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4508
|
+
/* @__PURE__ */ jsxs50("span", { children: [
|
|
4509
|
+
/* @__PURE__ */ jsx53("h2", { className: "ba-title", children: organization.name }),
|
|
4510
|
+
/* @__PURE__ */ jsx53("p", { className: "ba-muted", children: organization.slug })
|
|
4488
4511
|
] })
|
|
4489
4512
|
] }),
|
|
4490
|
-
/* @__PURE__ */
|
|
4491
|
-
/* @__PURE__ */
|
|
4513
|
+
/* @__PURE__ */ jsxs50("div", { className: "ba-organization-profile-layout", children: [
|
|
4514
|
+
/* @__PURE__ */ jsx53("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ jsx53(
|
|
4492
4515
|
"button",
|
|
4493
4516
|
{
|
|
4494
4517
|
className: "ba-profile-nav-item",
|
|
@@ -4499,12 +4522,12 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
4499
4522
|
},
|
|
4500
4523
|
item
|
|
4501
4524
|
)) }),
|
|
4502
|
-
/* @__PURE__ */
|
|
4503
|
-
activeSection === "general" && /* @__PURE__ */
|
|
4504
|
-
activeSection === "members" && /* @__PURE__ */
|
|
4505
|
-
activeSection === "teams" && /* @__PURE__ */
|
|
4506
|
-
activeSection === "invitations" && /* @__PURE__ */
|
|
4507
|
-
activeSection === "danger" && /* @__PURE__ */
|
|
4525
|
+
/* @__PURE__ */ jsxs50("div", { className: "ba-organization-profile-content", children: [
|
|
4526
|
+
activeSection === "general" && /* @__PURE__ */ jsx53(GeneralSection, { organization, canManage, onChanged: load }),
|
|
4527
|
+
activeSection === "members" && /* @__PURE__ */ jsx53(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
|
|
4528
|
+
activeSection === "teams" && /* @__PURE__ */ jsx53(React44.Suspense, { fallback: null, children: /* @__PURE__ */ jsx53(TeamsSection, { organization, membership }) }),
|
|
4529
|
+
activeSection === "invitations" && /* @__PURE__ */ jsx53(InvitationsSection, { organization, onChanged: load }),
|
|
4530
|
+
activeSection === "danger" && /* @__PURE__ */ jsx53(
|
|
4508
4531
|
DangerSection,
|
|
4509
4532
|
{
|
|
4510
4533
|
organization,
|
|
@@ -4519,7 +4542,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
4519
4542
|
}
|
|
4520
4543
|
|
|
4521
4544
|
// src/components/OrganizationSwitcher.tsx
|
|
4522
|
-
import { Fragment as Fragment13, jsx as
|
|
4545
|
+
import { Fragment as Fragment13, jsx as jsx54, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
4523
4546
|
function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChange } = {}) {
|
|
4524
4547
|
const t = useT();
|
|
4525
4548
|
const { config, isLoading: configLoading } = usePublicConfig();
|
|
@@ -4552,9 +4575,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
4552
4575
|
document.removeEventListener("keydown", onKeyDown);
|
|
4553
4576
|
};
|
|
4554
4577
|
}, [open]);
|
|
4555
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */
|
|
4578
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ jsx54("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
|
|
4556
4579
|
if (config?.organizations !== true) return null;
|
|
4557
|
-
if (!isSignedIn) return /* @__PURE__ */
|
|
4580
|
+
if (!isSignedIn) return /* @__PURE__ */ jsx54("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
4558
4581
|
const select = (organization) => {
|
|
4559
4582
|
void run(
|
|
4560
4583
|
() => api.setActive({ organizationId: organization?.id ?? null }),
|
|
@@ -4597,9 +4620,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
4597
4620
|
else if (event.key === "ArrowDown") items[(current + 1 + items.length) % items.length]?.focus();
|
|
4598
4621
|
else items[(current - 1 + items.length) % items.length]?.focus();
|
|
4599
4622
|
};
|
|
4600
|
-
return /* @__PURE__ */
|
|
4601
|
-
/* @__PURE__ */
|
|
4602
|
-
/* @__PURE__ */
|
|
4623
|
+
return /* @__PURE__ */ jsxs51(Fragment13, { children: [
|
|
4624
|
+
/* @__PURE__ */ jsxs51("div", { ref: rootRef, className: "ba-organization-switcher", children: [
|
|
4625
|
+
/* @__PURE__ */ jsxs51(
|
|
4603
4626
|
"button",
|
|
4604
4627
|
{
|
|
4605
4628
|
ref: triggerRef,
|
|
@@ -4616,43 +4639,43 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
4616
4639
|
focusMenuItem(event.key === "ArrowDown" ? "first" : "last");
|
|
4617
4640
|
},
|
|
4618
4641
|
children: [
|
|
4619
|
-
/* @__PURE__ */
|
|
4620
|
-
/* @__PURE__ */
|
|
4621
|
-
/* @__PURE__ */
|
|
4642
|
+
/* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
|
|
4643
|
+
/* @__PURE__ */ jsx54("span", { children: active?.name ?? t("organization.personal") }),
|
|
4644
|
+
/* @__PURE__ */ jsx54("span", { "aria-hidden": "true", children: "\u2304" })
|
|
4622
4645
|
]
|
|
4623
4646
|
}
|
|
4624
4647
|
),
|
|
4625
|
-
open && /* @__PURE__ */
|
|
4626
|
-
isLoading ? /* @__PURE__ */
|
|
4627
|
-
showPersonalWorkspace && /* @__PURE__ */
|
|
4628
|
-
/* @__PURE__ */
|
|
4629
|
-
/* @__PURE__ */
|
|
4648
|
+
open && /* @__PURE__ */ jsxs51("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
|
|
4649
|
+
isLoading ? /* @__PURE__ */ jsx54("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs51(Fragment13, { children: [
|
|
4650
|
+
showPersonalWorkspace && /* @__PURE__ */ jsxs51("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === null ? "true" : void 0, disabled: pending, onClick: () => select(null), children: [
|
|
4651
|
+
/* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
|
|
4652
|
+
/* @__PURE__ */ jsx54("span", { children: t("organization.personal") })
|
|
4630
4653
|
] }),
|
|
4631
|
-
organizations?.map((organization) => /* @__PURE__ */
|
|
4632
|
-
/* @__PURE__ */
|
|
4633
|
-
/* @__PURE__ */
|
|
4654
|
+
organizations?.map((organization) => /* @__PURE__ */ jsxs51("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === organization.id ? "true" : void 0, disabled: pending, onClick: () => select(organization), children: [
|
|
4655
|
+
/* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4656
|
+
/* @__PURE__ */ jsxs51("span", { children: [
|
|
4634
4657
|
organization.name,
|
|
4635
|
-
/* @__PURE__ */
|
|
4658
|
+
/* @__PURE__ */ jsx54("small", { children: organization.slug })
|
|
4636
4659
|
] })
|
|
4637
4660
|
] }, organization.id))
|
|
4638
4661
|
] }),
|
|
4639
|
-
(loadError || error) && /* @__PURE__ */
|
|
4640
|
-
/* @__PURE__ */
|
|
4641
|
-
loadError && /* @__PURE__ */
|
|
4662
|
+
(loadError || error) && /* @__PURE__ */ jsxs51("div", { className: "ba-inline-error", children: [
|
|
4663
|
+
/* @__PURE__ */ jsx54(FormError, { children: loadError ?? error }),
|
|
4664
|
+
loadError && /* @__PURE__ */ jsx54("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
4642
4665
|
] }),
|
|
4643
|
-
/* @__PURE__ */
|
|
4644
|
-
active && /* @__PURE__ */
|
|
4666
|
+
/* @__PURE__ */ jsxs51("div", { className: "ba-organization-menu-actions", children: [
|
|
4667
|
+
active && /* @__PURE__ */ jsx54("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
4645
4668
|
setOpen(false);
|
|
4646
4669
|
setDialog("profile");
|
|
4647
4670
|
}, children: t("organization.switcher.manage") }),
|
|
4648
|
-
/* @__PURE__ */
|
|
4671
|
+
/* @__PURE__ */ jsx54("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
4649
4672
|
setOpen(false);
|
|
4650
4673
|
setDialog("create");
|
|
4651
4674
|
}, children: t("organization.switcher.create") })
|
|
4652
4675
|
] })
|
|
4653
4676
|
] })
|
|
4654
4677
|
] }),
|
|
4655
|
-
dialog === "create" && /* @__PURE__ */
|
|
4678
|
+
dialog === "create" && /* @__PURE__ */ jsx54(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx54(
|
|
4656
4679
|
CreateOrganization,
|
|
4657
4680
|
{
|
|
4658
4681
|
title: null,
|
|
@@ -4666,13 +4689,13 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
4666
4689
|
}
|
|
4667
4690
|
}
|
|
4668
4691
|
) }),
|
|
4669
|
-
dialog === "profile" && active && /* @__PURE__ */
|
|
4692
|
+
dialog === "profile" && active && /* @__PURE__ */ jsx54(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx54(OrganizationProfile, { organizationId: active.id, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
4670
4693
|
] });
|
|
4671
4694
|
}
|
|
4672
4695
|
|
|
4673
4696
|
// src/components/OrganizationList.tsx
|
|
4674
4697
|
import * as React46 from "react";
|
|
4675
|
-
import { Fragment as Fragment14, jsx as
|
|
4698
|
+
import { Fragment as Fragment14, jsx as jsx55, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
4676
4699
|
function OrganizationList({ onOrganizationChange } = {}) {
|
|
4677
4700
|
const t = useT();
|
|
4678
4701
|
const toServerError = useServerError();
|
|
@@ -4721,9 +4744,9 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
4721
4744
|
invitationRequestRef.current += 1;
|
|
4722
4745
|
};
|
|
4723
4746
|
}, [isLoaded, loadInvitations, user?.id]);
|
|
4724
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */
|
|
4747
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ jsx55("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
4725
4748
|
if (config?.organizations !== true) return null;
|
|
4726
|
-
if (!isSignedIn) return /* @__PURE__ */
|
|
4749
|
+
if (!isSignedIn) return /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
4727
4750
|
const setActive = (organization) => {
|
|
4728
4751
|
void run(
|
|
4729
4752
|
() => api.setActive({ organizationId: organization.id }),
|
|
@@ -4764,66 +4787,66 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
4764
4787
|
setDialog(null);
|
|
4765
4788
|
setProfileId(null);
|
|
4766
4789
|
};
|
|
4767
|
-
return /* @__PURE__ */
|
|
4768
|
-
/* @__PURE__ */
|
|
4769
|
-
/* @__PURE__ */
|
|
4770
|
-
/* @__PURE__ */
|
|
4771
|
-
/* @__PURE__ */
|
|
4772
|
-
/* @__PURE__ */
|
|
4790
|
+
return /* @__PURE__ */ jsxs52(Fragment14, { children: [
|
|
4791
|
+
/* @__PURE__ */ jsxs52("section", { className: "ba-organization-directory", children: [
|
|
4792
|
+
/* @__PURE__ */ jsxs52("header", { className: "ba-organization-directory-header", children: [
|
|
4793
|
+
/* @__PURE__ */ jsxs52("span", { children: [
|
|
4794
|
+
/* @__PURE__ */ jsx55("h2", { className: "ba-title", children: t("organization.list.title") }),
|
|
4795
|
+
/* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.description") })
|
|
4773
4796
|
] }),
|
|
4774
|
-
/* @__PURE__ */
|
|
4797
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-button", type: "button", onClick: (event) => {
|
|
4775
4798
|
dialogReturnFocusRef.current = event.currentTarget;
|
|
4776
4799
|
setDialog("create");
|
|
4777
4800
|
}, children: t("organization.switcher.create") })
|
|
4778
4801
|
] }),
|
|
4779
|
-
(organizationError || error) && /* @__PURE__ */
|
|
4780
|
-
/* @__PURE__ */
|
|
4781
|
-
organizationError && /* @__PURE__ */
|
|
4802
|
+
(organizationError || error) && /* @__PURE__ */ jsxs52("div", { className: "ba-inline-error", children: [
|
|
4803
|
+
/* @__PURE__ */ jsx55(FormError, { children: organizationError ?? error }),
|
|
4804
|
+
organizationError && /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
4782
4805
|
] }),
|
|
4783
|
-
isLoading ? /* @__PURE__ */
|
|
4784
|
-
/* @__PURE__ */
|
|
4785
|
-
/* @__PURE__ */
|
|
4786
|
-
] }) : organizations?.length ? /* @__PURE__ */
|
|
4787
|
-
/* @__PURE__ */
|
|
4788
|
-
/* @__PURE__ */
|
|
4789
|
-
/* @__PURE__ */
|
|
4790
|
-
/* @__PURE__ */
|
|
4806
|
+
isLoading ? /* @__PURE__ */ jsxs52("div", { className: "ba-organization-card-grid", children: [
|
|
4807
|
+
/* @__PURE__ */ jsx55("div", { className: "ba-skeleton" }),
|
|
4808
|
+
/* @__PURE__ */ jsx55("div", { className: "ba-skeleton" })
|
|
4809
|
+
] }) : organizations?.length ? /* @__PURE__ */ jsx55("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ jsxs52("li", { className: "ba-organization-card", children: [
|
|
4810
|
+
/* @__PURE__ */ jsx55("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4811
|
+
/* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-copy", children: [
|
|
4812
|
+
/* @__PURE__ */ jsx55("strong", { children: organization.name }),
|
|
4813
|
+
/* @__PURE__ */ jsx55("small", { children: /* @__PURE__ */ jsx55(Bidi, { children: organization.slug }) })
|
|
4791
4814
|
] }),
|
|
4792
|
-
activeId === organization.id && /* @__PURE__ */
|
|
4793
|
-
/* @__PURE__ */
|
|
4794
|
-
activeId !== organization.id && /* @__PURE__ */
|
|
4795
|
-
/* @__PURE__ */
|
|
4815
|
+
activeId === organization.id && /* @__PURE__ */ jsx55("span", { className: "ba-organization-active", children: t("organization.list.active") }),
|
|
4816
|
+
/* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-actions", children: [
|
|
4817
|
+
activeId !== organization.id && /* @__PURE__ */ jsx55("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
|
|
4818
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
|
|
4796
4819
|
] })
|
|
4797
|
-
] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */
|
|
4798
|
-
/* @__PURE__ */
|
|
4799
|
-
/* @__PURE__ */
|
|
4800
|
-
/* @__PURE__ */
|
|
4801
|
-
/* @__PURE__ */
|
|
4820
|
+
] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.empty") }),
|
|
4821
|
+
/* @__PURE__ */ jsxs52("section", { className: "ba-organization-user-invitations", children: [
|
|
4822
|
+
/* @__PURE__ */ jsxs52("header", { className: "ba-organization-section-header", children: [
|
|
4823
|
+
/* @__PURE__ */ jsx55("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
|
|
4824
|
+
/* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
|
|
4802
4825
|
] }),
|
|
4803
|
-
invitationError && /* @__PURE__ */
|
|
4804
|
-
/* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
4826
|
+
invitationError && /* @__PURE__ */ jsxs52("div", { className: "ba-inline-error", children: [
|
|
4827
|
+
/* @__PURE__ */ jsx55(FormError, { children: invitationError }),
|
|
4828
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
|
|
4806
4829
|
] }),
|
|
4807
|
-
invitations?.length ? /* @__PURE__ */
|
|
4808
|
-
/* @__PURE__ */
|
|
4809
|
-
/* @__PURE__ */
|
|
4810
|
-
/* @__PURE__ */
|
|
4830
|
+
invitations?.length ? /* @__PURE__ */ jsx55("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ jsxs52("li", { className: "ba-organization-invitation", children: [
|
|
4831
|
+
/* @__PURE__ */ jsxs52("span", { children: [
|
|
4832
|
+
/* @__PURE__ */ jsx55("strong", { children: invitation.organizationName }),
|
|
4833
|
+
/* @__PURE__ */ jsx55("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
4811
4834
|
] }),
|
|
4812
|
-
/* @__PURE__ */
|
|
4813
|
-
/* @__PURE__ */
|
|
4814
|
-
/* @__PURE__ */
|
|
4835
|
+
/* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-actions", children: [
|
|
4836
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
|
|
4837
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
|
|
4815
4838
|
] })
|
|
4816
|
-
] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */
|
|
4839
|
+
] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */ jsx55("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
|
|
4817
4840
|
] })
|
|
4818
4841
|
] }),
|
|
4819
|
-
dialog === "create" && /* @__PURE__ */
|
|
4842
|
+
dialog === "create" && /* @__PURE__ */ jsx55(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx55(CreateOrganization, { title: null, onCreated: () => {
|
|
4820
4843
|
void (async () => {
|
|
4821
4844
|
await refresh();
|
|
4822
4845
|
await session.refetch({ query: { disableCookieCache: true } });
|
|
4823
4846
|
setDialog(null);
|
|
4824
4847
|
})();
|
|
4825
4848
|
} }) }),
|
|
4826
|
-
dialog === "profile" && profileId && /* @__PURE__ */
|
|
4849
|
+
dialog === "profile" && profileId && /* @__PURE__ */ jsx55(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx55(OrganizationProfile, { organizationId: profileId, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
4827
4850
|
] });
|
|
4828
4851
|
}
|
|
4829
4852
|
|