@authowl/react 0.24.4 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/{OrganizationListContent-BSGDHYAC.js → OrganizationListContent-HMRK4ZSI.js} +3 -3
- package/dist/{OrganizationProfileContent-HJT33DMJ.js → OrganizationProfileContent-7RM6OMLU.js} +3 -3
- package/dist/{OrganizationSwitcherContent-2TJ76HZM.js → OrganizationSwitcherContent-6G6ASVYZ.js} +2 -2
- package/dist/{PrivacyCenterContent-EQEXXSLA.js → PrivacyCenterContent-C4ON7H74.js} +3 -1
- package/dist/{TeamsSection-VJTKS4KP.js → TeamsSection-MXSBSO44.js} +1 -1
- package/dist/{chunk-SAVEQ6RC.js → chunk-KUNSGUZP.js} +4 -2
- package/dist/{chunk-2HNQYORD.js → chunk-R6WM64IM.js} +2 -2
- package/dist/{chunk-7WIBXVGK.js → chunk-TTBODVRM.js} +1 -1
- package/dist/index.cjs +922 -752
- package/dist/index.d.cts +174 -12
- package/dist/index.d.ts +174 -12
- package/dist/index.js +516 -349
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CreateOrganization,
|
|
4
4
|
OrganizationProfile
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-R6WM64IM.js";
|
|
6
6
|
import {
|
|
7
7
|
useSubmitAction
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KUNSGUZP.js";
|
|
9
9
|
import {
|
|
10
10
|
AuthOwlProvider,
|
|
11
11
|
Bidi,
|
|
@@ -74,6 +74,13 @@ function passkeyReachableFrom(authBaseUrl, pageHost, relyingPartyId) {
|
|
|
74
74
|
if (rpId !== "localhost" && !rpId.includes(".")) return false;
|
|
75
75
|
return pageHost === rpId || pageHost.endsWith(`.${rpId}`);
|
|
76
76
|
}
|
|
77
|
+
function passkeyReachableForConfig(config, pageHost) {
|
|
78
|
+
return passkeyReachableFrom(
|
|
79
|
+
config?.authBaseUrl,
|
|
80
|
+
pageHost,
|
|
81
|
+
config?.authentication?.passkey?.relyingPartyId
|
|
82
|
+
);
|
|
83
|
+
}
|
|
77
84
|
function resolveSignInMethods(config, pageHost) {
|
|
78
85
|
const methods = config?.enabledMethods ?? ["password"];
|
|
79
86
|
const social = config?.socialProviders ?? [];
|
|
@@ -84,11 +91,7 @@ function resolveSignInMethods(config, pageHost) {
|
|
|
84
91
|
const magicLink = capabilities.magicLinkSignIn;
|
|
85
92
|
const emailOtp = capabilities.emailOtpSignIn && !capabilities.totp && !capabilities.mfaRequired;
|
|
86
93
|
const phoneOtp = capabilities.phoneSignIn && !capabilities.mfaRequired;
|
|
87
|
-
const passkey = capabilities.passkeySignIn &&
|
|
88
|
-
config?.authBaseUrl,
|
|
89
|
-
pageHost,
|
|
90
|
-
config?.authentication?.passkey?.relyingPartyId
|
|
91
|
-
);
|
|
94
|
+
const passkey = capabilities.passkeySignIn && passkeyReachableForConfig(config, pageHost);
|
|
92
95
|
const sso = has("sso");
|
|
93
96
|
const renderable = password || username || magicLink || emailOtp || phoneOtp || passkey || sso || social.length > 0;
|
|
94
97
|
const emptyReason = renderable ? null : methods.length > 0 ? "unsupported" : "none";
|
|
@@ -620,7 +623,12 @@ function OtpCodeForm({
|
|
|
620
623
|
// src/components/MFAChallenge.tsx
|
|
621
624
|
import * as React5 from "react";
|
|
622
625
|
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
623
|
-
function MFAChallenge({
|
|
626
|
+
function MFAChallenge({
|
|
627
|
+
onVerified,
|
|
628
|
+
allowTrustDevice = true,
|
|
629
|
+
variant = "sign-in",
|
|
630
|
+
onCancel
|
|
631
|
+
}) {
|
|
624
632
|
const t = useT();
|
|
625
633
|
const { config } = usePublicConfig();
|
|
626
634
|
const { verifyTotp, verifyBackupCode, sendOtp, verifyOtp } = useMFA();
|
|
@@ -628,7 +636,8 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
628
636
|
const [mode, setMode] = React5.useState("totp");
|
|
629
637
|
const [code, setCode] = React5.useState("");
|
|
630
638
|
const [trustDevice, setTrustDevice] = React5.useState(false);
|
|
631
|
-
const
|
|
639
|
+
const stepUp = variant === "step-up";
|
|
640
|
+
const canTrustDevice = !stepUp && allowTrustDevice && (config?.mfa?.trustDevice ?? true);
|
|
632
641
|
const canUseEmailOtp = config?.mfa?.emailOtpFallback ?? true;
|
|
633
642
|
React5.useEffect(() => {
|
|
634
643
|
if (!canTrustDevice) setTrustDevice(false);
|
|
@@ -661,7 +670,7 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
661
670
|
const hint = mode === "totp" ? t("mfa.challenge.totpHint") : mode === "backup" ? t("mfa.challenge.backupHint") : t("mfa.challenge.otpHint");
|
|
662
671
|
const label2 = mode === "totp" ? t("mfa.challenge.totpLabel") : mode === "backup" ? t("mfa.challenge.backupLabel") : t("mfa.challenge.otpLabel");
|
|
663
672
|
return /* @__PURE__ */ jsxs7("form", { method: "post", className: "ba-fields", "data-testid": "mfa-challenge", onSubmit: submit, children: [
|
|
664
|
-
/* @__PURE__ */ jsx7("h2", { className: "ba-title", children: t("mfa.challenge.title") }),
|
|
673
|
+
/* @__PURE__ */ jsx7("h2", { className: "ba-title", children: t(stepUp ? "mfa.stepUp.title" : "mfa.challenge.title") }),
|
|
665
674
|
/* @__PURE__ */ jsx7("p", { className: "ba-muted", children: hint }),
|
|
666
675
|
/* @__PURE__ */ jsxs7("label", { className: "ba-label", children: [
|
|
667
676
|
label2,
|
|
@@ -692,7 +701,8 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
692
701
|
/* @__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") }) }),
|
|
693
702
|
mode !== "totp" && /* @__PURE__ */ jsx7("button", { type: "button", className: "ba-link-button", onClick: () => switchMode("totp"), children: t("mfa.challenge.useTotp") }),
|
|
694
703
|
mode !== "backup" && /* @__PURE__ */ jsx7("button", { type: "button", className: "ba-link-button", onClick: () => switchMode("backup"), children: t("mfa.challenge.useBackup") }),
|
|
695
|
-
canUseEmailOtp && /* @__PURE__ */ jsx7("button", { type: "button", className: "ba-link-button", disabled: pending, onClick: requestOtp, children: t(mode === "otp" ? "mfa.challenge.resendOtp" : "mfa.challenge.useEmailOtp") })
|
|
704
|
+
canUseEmailOtp && /* @__PURE__ */ jsx7("button", { type: "button", className: "ba-link-button", disabled: pending, onClick: requestOtp, children: t(mode === "otp" ? "mfa.challenge.resendOtp" : "mfa.challenge.useEmailOtp") }),
|
|
705
|
+
onCancel && /* @__PURE__ */ jsx7("button", { type: "button", className: "ba-link-button", disabled: pending, onClick: onCancel, children: t("common.cancel") })
|
|
696
706
|
] });
|
|
697
707
|
}
|
|
698
708
|
|
|
@@ -1948,15 +1958,32 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
1948
1958
|
);
|
|
1949
1959
|
}
|
|
1950
1960
|
|
|
1951
|
-
// src/components/
|
|
1961
|
+
// src/components/PasskeyOffer.tsx
|
|
1952
1962
|
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1953
|
-
|
|
1963
|
+
var COPY = {
|
|
1964
|
+
"sign-up": {
|
|
1965
|
+
title: "signUp.passkeyTitle",
|
|
1966
|
+
body: "signUp.passkeyDescription",
|
|
1967
|
+
submit: "signUp.passkeySubmit",
|
|
1968
|
+
skip: "signUp.passkeySkip",
|
|
1969
|
+
failed: "signUp.error.passkeyFailed"
|
|
1970
|
+
},
|
|
1971
|
+
"sign-in": {
|
|
1972
|
+
title: "passkeyOffer.title",
|
|
1973
|
+
body: "passkeyOffer.description",
|
|
1974
|
+
submit: "passkeyOffer.submit",
|
|
1975
|
+
skip: "passkeyOffer.skip",
|
|
1976
|
+
failed: "passkeyOffer.error"
|
|
1977
|
+
}
|
|
1978
|
+
};
|
|
1979
|
+
function PasskeyOffer({ onComplete, variant, title }) {
|
|
1954
1980
|
const t = useT();
|
|
1955
1981
|
const { addPasskey } = usePasskeys();
|
|
1956
1982
|
const { pending, error, run } = useSubmitAction();
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
/* @__PURE__ */ jsx22("
|
|
1983
|
+
const copy = COPY[variant];
|
|
1984
|
+
return /* @__PURE__ */ jsxs20("div", { className: "ba-fields", "data-testid": "passkey-offer", children: [
|
|
1985
|
+
/* @__PURE__ */ jsx22("h3", { className: "ba-title", children: title ?? t(copy.title) }),
|
|
1986
|
+
/* @__PURE__ */ jsx22("p", { className: "ba-muted", children: t(copy.body) }),
|
|
1960
1987
|
/* @__PURE__ */ jsx22(FormError, { children: error }),
|
|
1961
1988
|
/* @__PURE__ */ jsx22(
|
|
1962
1989
|
"button",
|
|
@@ -1966,13 +1993,13 @@ function PasskeySignUpCompletion({ onComplete }) {
|
|
|
1966
1993
|
disabled: pending,
|
|
1967
1994
|
"aria-busy": pending || void 0,
|
|
1968
1995
|
onClick: () => void run(() => addPasskey(), {
|
|
1969
|
-
failure: t(
|
|
1970
|
-
onSuccess: onComplete
|
|
1996
|
+
failure: t(copy.failed),
|
|
1997
|
+
onSuccess: () => onComplete(true)
|
|
1971
1998
|
}),
|
|
1972
|
-
children: /* @__PURE__ */ jsx22(Busy, { busy: pending, label: t("passkey.waiting"), children: t(
|
|
1999
|
+
children: /* @__PURE__ */ jsx22(Busy, { busy: pending, label: t("passkey.waiting"), children: t(copy.submit) })
|
|
1973
2000
|
}
|
|
1974
2001
|
),
|
|
1975
|
-
/* @__PURE__ */ jsx22("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: onComplete, children: t(
|
|
2002
|
+
/* @__PURE__ */ jsx22("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => onComplete(false), children: t(copy.skip) })
|
|
1976
2003
|
] });
|
|
1977
2004
|
}
|
|
1978
2005
|
|
|
@@ -2231,7 +2258,7 @@ function SignUp({
|
|
|
2231
2258
|
if (completeWithPasskey) {
|
|
2232
2259
|
return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "signup-passkey-step", children: [
|
|
2233
2260
|
showBranding ? /* @__PURE__ */ jsx25(AuthOwlBranding, {}) : null,
|
|
2234
|
-
/* @__PURE__ */ jsx25(
|
|
2261
|
+
/* @__PURE__ */ jsx25(PasskeyOffer, { variant: "sign-up", onComplete: finishSignUp }),
|
|
2235
2262
|
/* @__PURE__ */ jsx25(AuthOwlBadge, { force: showBadge })
|
|
2236
2263
|
] });
|
|
2237
2264
|
}
|
|
@@ -2442,16 +2469,66 @@ function MFARequiredGate({ children, title }) {
|
|
|
2442
2469
|
}
|
|
2443
2470
|
|
|
2444
2471
|
// src/components/BackupCodesManager.tsx
|
|
2472
|
+
import * as React19 from "react";
|
|
2473
|
+
|
|
2474
|
+
// src/components/use-step-up-action.ts
|
|
2445
2475
|
import * as React18 from "react";
|
|
2476
|
+
var SECOND_FACTOR_REQUIRED = "SECOND_FACTOR_REQUIRED";
|
|
2477
|
+
function useStepUpAction() {
|
|
2478
|
+
const { pending, error, setError, run } = useSubmitAction();
|
|
2479
|
+
const attempt = React18.useRef(null);
|
|
2480
|
+
const [stepUpRequired, setStepUpRequired] = React18.useState(false);
|
|
2481
|
+
const park = React18.useCallback((next) => {
|
|
2482
|
+
if (next !== null && attempt.current !== null) return false;
|
|
2483
|
+
attempt.current = next;
|
|
2484
|
+
setStepUpRequired(next !== null);
|
|
2485
|
+
return true;
|
|
2486
|
+
}, []);
|
|
2487
|
+
const epoch = React18.useRef(0);
|
|
2488
|
+
const guardedRun = React18.useCallback(
|
|
2489
|
+
(action, opts) => {
|
|
2490
|
+
const send = () => {
|
|
2491
|
+
const era = epoch.current;
|
|
2492
|
+
return run(action, {
|
|
2493
|
+
...opts,
|
|
2494
|
+
intercept: (failure) => {
|
|
2495
|
+
if (failure.code !== SECOND_FACTOR_REQUIRED) return opts.intercept?.(failure) ?? false;
|
|
2496
|
+
if (era !== epoch.current) return true;
|
|
2497
|
+
return park(send);
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2500
|
+
};
|
|
2501
|
+
return send();
|
|
2502
|
+
},
|
|
2503
|
+
[run, park]
|
|
2504
|
+
);
|
|
2505
|
+
const resume = React18.useCallback(() => {
|
|
2506
|
+
const send = attempt.current;
|
|
2507
|
+
park(null);
|
|
2508
|
+
void send?.();
|
|
2509
|
+
}, [park]);
|
|
2510
|
+
const cancel = React18.useCallback(() => {
|
|
2511
|
+
epoch.current += 1;
|
|
2512
|
+
park(null);
|
|
2513
|
+
setError(null);
|
|
2514
|
+
}, [park, setError]);
|
|
2515
|
+
return { pending, error, setError, stepUpRequired, run: guardedRun, resume, cancel };
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
// src/components/BackupCodesManager.tsx
|
|
2446
2519
|
import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2447
2520
|
function BackupCodesManager({ title }) {
|
|
2448
2521
|
const t = useT();
|
|
2449
2522
|
const { user } = useUser();
|
|
2450
2523
|
const { regenerateBackupCodes } = useMFA();
|
|
2451
|
-
const { pending, error, run } =
|
|
2452
|
-
const [password, setPassword] =
|
|
2453
|
-
const [codes, setCodes] =
|
|
2524
|
+
const { pending, error, stepUpRequired, run, resume, cancel } = useStepUpAction();
|
|
2525
|
+
const [password, setPassword] = React19.useState("");
|
|
2526
|
+
const [codes, setCodes] = React19.useState(null);
|
|
2454
2527
|
if (!user?.twoFactorEnabled) return null;
|
|
2528
|
+
const cancelStepUp = () => {
|
|
2529
|
+
cancel();
|
|
2530
|
+
setPassword("");
|
|
2531
|
+
};
|
|
2455
2532
|
const submit = (e) => {
|
|
2456
2533
|
e.preventDefault();
|
|
2457
2534
|
void run(() => regenerateBackupCodes({ password }), {
|
|
@@ -2472,7 +2549,7 @@ function BackupCodesManager({ title }) {
|
|
|
2472
2549
|
t("mfa.enroll.backupCodesWarningRest")
|
|
2473
2550
|
] }),
|
|
2474
2551
|
/* @__PURE__ */ jsx28("ul", { className: "ba-passkey-list", "data-testid": "backup-codes-list", children: codes.map((c) => /* @__PURE__ */ jsx28("li", { className: "ba-passkey-item", children: /* @__PURE__ */ jsx28("code", { children: /* @__PURE__ */ jsx28("bdi", { children: c }) }) }, c)) })
|
|
2475
|
-
] }) : /* @__PURE__ */ jsxs26("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
2552
|
+
] }) : stepUpRequired ? /* @__PURE__ */ jsx28(MFAChallenge, { variant: "step-up", onVerified: resume, onCancel: cancelStepUp }) : /* @__PURE__ */ jsxs26("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
2476
2553
|
/* @__PURE__ */ jsxs26("label", { className: "ba-label", children: [
|
|
2477
2554
|
t("common.passwordLabel"),
|
|
2478
2555
|
/* @__PURE__ */ jsx28(
|
|
@@ -2494,15 +2571,15 @@ function BackupCodesManager({ title }) {
|
|
|
2494
2571
|
}
|
|
2495
2572
|
|
|
2496
2573
|
// src/components/MagicLinkForm.tsx
|
|
2497
|
-
import * as
|
|
2574
|
+
import * as React20 from "react";
|
|
2498
2575
|
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2499
2576
|
function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
2500
2577
|
const t = useT();
|
|
2501
2578
|
const { signInMagicLink } = useSignIn();
|
|
2502
2579
|
const { pending, error, run } = useSubmitAction();
|
|
2503
2580
|
const authChallenge = useAuthChallenge();
|
|
2504
|
-
const [email, setEmail] =
|
|
2505
|
-
const [sent, setSent] =
|
|
2581
|
+
const [email, setEmail] = React20.useState("");
|
|
2582
|
+
const [sent, setSent] = React20.useState(false);
|
|
2506
2583
|
if (sent) {
|
|
2507
2584
|
return /* @__PURE__ */ jsx29("p", { className: "ba-muted", "data-testid": "magiclink-sent", children: t("magicLink.sent") });
|
|
2508
2585
|
}
|
|
@@ -2552,7 +2629,7 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
2552
2629
|
}
|
|
2553
2630
|
|
|
2554
2631
|
// src/components/EmailOtpForm.tsx
|
|
2555
|
-
import * as
|
|
2632
|
+
import * as React21 from "react";
|
|
2556
2633
|
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2557
2634
|
function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
2558
2635
|
const t = useT();
|
|
@@ -2560,9 +2637,9 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
2560
2637
|
const { sendEmailOtp, signInEmailOtp } = useSignIn();
|
|
2561
2638
|
const { pending, error, setError, run } = useSubmitAction();
|
|
2562
2639
|
const authChallenge = useAuthChallenge();
|
|
2563
|
-
const [email, setEmail] =
|
|
2564
|
-
const [otp, setOtp] =
|
|
2565
|
-
const [stage, setStage] =
|
|
2640
|
+
const [email, setEmail] = React21.useState("");
|
|
2641
|
+
const [otp, setOtp] = React21.useState("");
|
|
2642
|
+
const [stage, setStage] = React21.useState("email");
|
|
2566
2643
|
if (stage === "code") {
|
|
2567
2644
|
return /* @__PURE__ */ jsx30(
|
|
2568
2645
|
OtpCodeForm,
|
|
@@ -2636,7 +2713,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
2636
2713
|
}
|
|
2637
2714
|
|
|
2638
2715
|
// src/components/ResetPassword.tsx
|
|
2639
|
-
import * as
|
|
2716
|
+
import * as React22 from "react";
|
|
2640
2717
|
import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2641
2718
|
function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
2642
2719
|
const t = useT();
|
|
@@ -2645,12 +2722,12 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
2645
2722
|
const capabilities = resolveProjectCapabilities(config);
|
|
2646
2723
|
const { passwordMinLength, passwordMaxLength } = capabilities;
|
|
2647
2724
|
const { pending, error, setError, run } = useSubmitAction();
|
|
2648
|
-
const [token, setToken] =
|
|
2649
|
-
const [ready, setReady] =
|
|
2650
|
-
const [password, setPassword] =
|
|
2651
|
-
const [confirm, setConfirm] =
|
|
2652
|
-
const [done, setDone] =
|
|
2653
|
-
|
|
2725
|
+
const [token, setToken] = React22.useState(tokenProp ?? null);
|
|
2726
|
+
const [ready, setReady] = React22.useState(tokenProp != null);
|
|
2727
|
+
const [password, setPassword] = React22.useState("");
|
|
2728
|
+
const [confirm, setConfirm] = React22.useState("");
|
|
2729
|
+
const [done, setDone] = React22.useState(false);
|
|
2730
|
+
React22.useEffect(() => {
|
|
2654
2731
|
if (tokenProp != null) return;
|
|
2655
2732
|
const params = new URLSearchParams(window.location.search);
|
|
2656
2733
|
setToken(params.get("token"));
|
|
@@ -2737,18 +2814,18 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
2737
2814
|
}
|
|
2738
2815
|
|
|
2739
2816
|
// src/components/VerifyEmail.tsx
|
|
2740
|
-
import * as
|
|
2817
|
+
import * as React23 from "react";
|
|
2741
2818
|
import { Fragment as Fragment9, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2742
2819
|
function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
2743
2820
|
const t = useT();
|
|
2744
2821
|
const { sendVerificationEmail } = useEmailVerification();
|
|
2745
2822
|
const { pending, error, run } = useSubmitAction();
|
|
2746
2823
|
const authChallenge = useAuthChallenge();
|
|
2747
|
-
const [ready, setReady] =
|
|
2748
|
-
const [failed, setFailed] =
|
|
2749
|
-
const [email, setEmail] =
|
|
2750
|
-
const [resent, setResent] =
|
|
2751
|
-
|
|
2824
|
+
const [ready, setReady] = React23.useState(false);
|
|
2825
|
+
const [failed, setFailed] = React23.useState(false);
|
|
2826
|
+
const [email, setEmail] = React23.useState("");
|
|
2827
|
+
const [resent, setResent] = React23.useState(false);
|
|
2828
|
+
React23.useEffect(() => {
|
|
2752
2829
|
const didFail = new URLSearchParams(window.location.search).has("error");
|
|
2753
2830
|
setFailed(didFail);
|
|
2754
2831
|
setReady(true);
|
|
@@ -2813,7 +2890,7 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
2813
2890
|
}
|
|
2814
2891
|
|
|
2815
2892
|
// src/components/PasskeyManager.tsx
|
|
2816
|
-
import * as
|
|
2893
|
+
import * as React24 from "react";
|
|
2817
2894
|
import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2818
2895
|
function PasskeyManager({ title, allowAdd = true } = {}) {
|
|
2819
2896
|
const t = useT();
|
|
@@ -2833,12 +2910,12 @@ function PasskeyManagerBody({
|
|
|
2833
2910
|
const t = useT();
|
|
2834
2911
|
const toServerError = useServerError();
|
|
2835
2912
|
const api = usePasskeys();
|
|
2836
|
-
const apiRef =
|
|
2913
|
+
const apiRef = React24.useRef(api);
|
|
2837
2914
|
apiRef.current = api;
|
|
2838
2915
|
const { pending, error, setError, run } = useSubmitAction();
|
|
2839
|
-
const [passkeys, setPasskeys] =
|
|
2840
|
-
const loadTokenRef =
|
|
2841
|
-
const load =
|
|
2916
|
+
const [passkeys, setPasskeys] = React24.useState(null);
|
|
2917
|
+
const loadTokenRef = React24.useRef(0);
|
|
2918
|
+
const load = React24.useCallback(async () => {
|
|
2842
2919
|
const token = ++loadTokenRef.current;
|
|
2843
2920
|
try {
|
|
2844
2921
|
const res = await apiRef.current.listPasskeys();
|
|
@@ -2854,7 +2931,7 @@ function PasskeyManagerBody({
|
|
|
2854
2931
|
setError(t("passkeys.error.loadFailed"));
|
|
2855
2932
|
}
|
|
2856
2933
|
}, [setError, toServerError, t]);
|
|
2857
|
-
|
|
2934
|
+
React24.useEffect(() => {
|
|
2858
2935
|
void load();
|
|
2859
2936
|
}, [load]);
|
|
2860
2937
|
function onRename(id, current) {
|
|
@@ -2924,16 +3001,96 @@ function PasskeyManagerBody({
|
|
|
2924
3001
|
] });
|
|
2925
3002
|
}
|
|
2926
3003
|
|
|
3004
|
+
// src/components/PasskeyOfferGate.tsx
|
|
3005
|
+
import * as React26 from "react";
|
|
3006
|
+
|
|
3007
|
+
// src/components/use-passkey-offer.ts
|
|
3008
|
+
import * as React25 from "react";
|
|
3009
|
+
import {
|
|
3010
|
+
passkeyOfferIsDue,
|
|
3011
|
+
recordPasskeyOfferDismissed,
|
|
3012
|
+
recordPasskeyOfferSettled
|
|
3013
|
+
} from "@authowl/core";
|
|
3014
|
+
function usePasskeyOffer() {
|
|
3015
|
+
const { config } = usePublicConfig();
|
|
3016
|
+
const { user, isSignedIn } = useUser();
|
|
3017
|
+
const { data: sessionData } = useSession();
|
|
3018
|
+
const { listPasskeys } = usePasskeys();
|
|
3019
|
+
const api = React25.useRef(listPasskeys);
|
|
3020
|
+
api.current = listPasskeys;
|
|
3021
|
+
const projectId = config?.environmentId ?? null;
|
|
3022
|
+
const eligible = projectId !== null && isSignedIn && resolveProjectCapabilities(config).passkeyAdd && user?.twoFactorEnabled !== true && typeof window !== "undefined" && "PublicKeyCredential" in window && passkeyReachableForConfig(config, window.location.hostname);
|
|
3023
|
+
const userId = user?.id ?? null;
|
|
3024
|
+
const sessionId = sessionData?.session?.id ?? null;
|
|
3025
|
+
const subject = React25.useMemo(
|
|
3026
|
+
() => eligible && userId && sessionId ? { userId, sessionKey: `${projectId}:${sessionId}:${userId}` } : null,
|
|
3027
|
+
[eligible, projectId, sessionId, userId]
|
|
3028
|
+
);
|
|
3029
|
+
const shouldOffer = React25.useCallback(async () => {
|
|
3030
|
+
if (subject === null || projectId === null || !passkeyOfferIsDue(projectId, subject.userId)) {
|
|
3031
|
+
return false;
|
|
3032
|
+
}
|
|
3033
|
+
try {
|
|
3034
|
+
const res = await api.current();
|
|
3035
|
+
if (res?.error || !res?.data) return false;
|
|
3036
|
+
return res.data.length === 0;
|
|
3037
|
+
} catch {
|
|
3038
|
+
return false;
|
|
3039
|
+
}
|
|
3040
|
+
}, [subject, projectId]);
|
|
3041
|
+
const remember = React25.useCallback(
|
|
3042
|
+
(added) => {
|
|
3043
|
+
if (projectId === null || subject === null) return;
|
|
3044
|
+
if (added) recordPasskeyOfferSettled(projectId, subject.userId);
|
|
3045
|
+
else recordPasskeyOfferDismissed(projectId, subject.userId);
|
|
3046
|
+
},
|
|
3047
|
+
[projectId, subject]
|
|
3048
|
+
);
|
|
3049
|
+
return { subject, shouldOffer, remember };
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
// src/components/PasskeyOfferGate.tsx
|
|
3053
|
+
import { Fragment as Fragment10, jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3054
|
+
function PasskeyOfferGate({ children, title }) {
|
|
3055
|
+
const { subject, shouldOffer, remember } = usePasskeyOffer();
|
|
3056
|
+
const [offerFor, setOfferFor] = React26.useState(null);
|
|
3057
|
+
React26.useEffect(() => {
|
|
3058
|
+
if (subject === null) return;
|
|
3059
|
+
let cancelled = false;
|
|
3060
|
+
void shouldOffer().then((due) => {
|
|
3061
|
+
if (!cancelled) setOfferFor(due ? subject.sessionKey : null);
|
|
3062
|
+
});
|
|
3063
|
+
return () => {
|
|
3064
|
+
cancelled = true;
|
|
3065
|
+
};
|
|
3066
|
+
}, [subject, shouldOffer]);
|
|
3067
|
+
if (subject === null || offerFor !== subject.sessionKey) return /* @__PURE__ */ jsx34(Fragment10, { children });
|
|
3068
|
+
return /* @__PURE__ */ jsxs32("div", { className: "ba-form", "data-testid": "passkey-offer-gate", children: [
|
|
3069
|
+
/* @__PURE__ */ jsx34(
|
|
3070
|
+
PasskeyOffer,
|
|
3071
|
+
{
|
|
3072
|
+
variant: "sign-in",
|
|
3073
|
+
title,
|
|
3074
|
+
onComplete: (added) => {
|
|
3075
|
+
remember(added);
|
|
3076
|
+
setOfferFor(null);
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
),
|
|
3080
|
+
/* @__PURE__ */ jsx34(AuthOwlBadge, {})
|
|
3081
|
+
] });
|
|
3082
|
+
}
|
|
3083
|
+
|
|
2927
3084
|
// src/components/control.tsx
|
|
2928
3085
|
import { membershipHas } from "@authowl/core";
|
|
2929
|
-
import { Fragment as
|
|
3086
|
+
import { Fragment as Fragment11, jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2930
3087
|
function SignedIn({ children }) {
|
|
2931
3088
|
const { isLoaded, isSignedIn } = useUser();
|
|
2932
|
-
return isLoaded && isSignedIn ? /* @__PURE__ */
|
|
3089
|
+
return isLoaded && isSignedIn ? /* @__PURE__ */ jsx35(Fragment11, { children }) : null;
|
|
2933
3090
|
}
|
|
2934
3091
|
function SignedOut({ children }) {
|
|
2935
3092
|
const { isLoaded, isSignedIn } = useUser();
|
|
2936
|
-
return isLoaded && !isSignedIn ? /* @__PURE__ */
|
|
3093
|
+
return isLoaded && !isSignedIn ? /* @__PURE__ */ jsx35(Fragment11, { children }) : null;
|
|
2937
3094
|
}
|
|
2938
3095
|
function Protect({
|
|
2939
3096
|
children,
|
|
@@ -2946,36 +3103,36 @@ function Protect({
|
|
|
2946
3103
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
2947
3104
|
const membership = useSession().data?.session?.membership ?? null;
|
|
2948
3105
|
if (!isLoaded) return null;
|
|
2949
|
-
if (!isSignedIn || !user) return /* @__PURE__ */
|
|
3106
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ jsx35(Fragment11, { children: fallback });
|
|
2950
3107
|
if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !membershipHas(membership, { role, permission, teamId })) {
|
|
2951
|
-
return /* @__PURE__ */
|
|
3108
|
+
return /* @__PURE__ */ jsx35(Fragment11, { children: fallback });
|
|
2952
3109
|
}
|
|
2953
|
-
if (condition && !condition(user)) return /* @__PURE__ */
|
|
2954
|
-
return /* @__PURE__ */
|
|
3110
|
+
if (condition && !condition(user)) return /* @__PURE__ */ jsx35(Fragment11, { children: fallback });
|
|
3111
|
+
return /* @__PURE__ */ jsx35(Fragment11, { children });
|
|
2955
3112
|
}
|
|
2956
3113
|
function AuthLoading({ children }) {
|
|
2957
3114
|
const t = useT();
|
|
2958
3115
|
const { isLoaded } = useUser();
|
|
2959
3116
|
if (isLoaded) return null;
|
|
2960
|
-
if (children !== void 0) return /* @__PURE__ */
|
|
2961
|
-
return /* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
/* @__PURE__ */
|
|
3117
|
+
if (children !== void 0) return /* @__PURE__ */ jsx35(Fragment11, { children });
|
|
3118
|
+
return /* @__PURE__ */ jsxs33("div", { className: "ba-auth-loading", role: "status", "aria-busy": "true", "data-testid": "auth-loading", children: [
|
|
3119
|
+
/* @__PURE__ */ jsx35(Spinner, {}),
|
|
3120
|
+
/* @__PURE__ */ jsx35("span", { className: "ba-sr-only", children: t("common.loading") })
|
|
2964
3121
|
] });
|
|
2965
3122
|
}
|
|
2966
3123
|
function AuthLoaded({ children }) {
|
|
2967
|
-
return useUser().isLoaded ? /* @__PURE__ */
|
|
3124
|
+
return useUser().isLoaded ? /* @__PURE__ */ jsx35(Fragment11, { children }) : null;
|
|
2968
3125
|
}
|
|
2969
3126
|
|
|
2970
3127
|
// src/components/SignOutButton.tsx
|
|
2971
|
-
import * as
|
|
2972
|
-
import { jsx as
|
|
3128
|
+
import * as React27 from "react";
|
|
3129
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
2973
3130
|
function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
2974
3131
|
const t = useT();
|
|
2975
3132
|
const { signOut } = useSignOut();
|
|
2976
|
-
const [pending, setPending] =
|
|
3133
|
+
const [pending, setPending] = React27.useState(false);
|
|
2977
3134
|
const content = children ?? t("signOut.button");
|
|
2978
|
-
return /* @__PURE__ */
|
|
3135
|
+
return /* @__PURE__ */ jsx36(
|
|
2979
3136
|
"button",
|
|
2980
3137
|
{
|
|
2981
3138
|
type: "button",
|
|
@@ -2993,32 +3150,32 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
|
2993
3150
|
setPending(false);
|
|
2994
3151
|
}
|
|
2995
3152
|
},
|
|
2996
|
-
children: /* @__PURE__ */
|
|
3153
|
+
children: /* @__PURE__ */ jsx36(Busy, { busy: pending, label: content, children: content })
|
|
2997
3154
|
}
|
|
2998
3155
|
);
|
|
2999
3156
|
}
|
|
3000
3157
|
|
|
3001
3158
|
// src/components/UserButton.tsx
|
|
3002
|
-
import * as
|
|
3159
|
+
import * as React41 from "react";
|
|
3003
3160
|
|
|
3004
3161
|
// src/components/UserProfile.tsx
|
|
3005
|
-
import * as
|
|
3162
|
+
import * as React40 from "react";
|
|
3006
3163
|
|
|
3007
3164
|
// src/components/user-profile/EmailSection.tsx
|
|
3008
|
-
import * as
|
|
3009
|
-
import { jsx as
|
|
3165
|
+
import * as React28 from "react";
|
|
3166
|
+
import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3010
3167
|
function EmailSection({ allowChange }) {
|
|
3011
3168
|
const t = useT();
|
|
3012
3169
|
const account = useAccount();
|
|
3013
3170
|
const { user } = useUser();
|
|
3014
3171
|
const { pending, error, run } = useSubmitAction();
|
|
3015
|
-
const [newEmail, setNewEmail] =
|
|
3016
|
-
const [sent, setSent] =
|
|
3017
|
-
const titleId =
|
|
3172
|
+
const [newEmail, setNewEmail] = React28.useState("");
|
|
3173
|
+
const [sent, setSent] = React28.useState(false);
|
|
3174
|
+
const titleId = React28.useId();
|
|
3018
3175
|
if (!user?.email) {
|
|
3019
|
-
return /* @__PURE__ */
|
|
3020
|
-
/* @__PURE__ */
|
|
3021
|
-
/* @__PURE__ */
|
|
3176
|
+
return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3177
|
+
/* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
3178
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-muted", children: t("userProfile.email.unavailable") })
|
|
3022
3179
|
] });
|
|
3023
3180
|
}
|
|
3024
3181
|
const submit = (event) => {
|
|
@@ -3038,19 +3195,19 @@ function EmailSection({ allowChange }) {
|
|
|
3038
3195
|
}
|
|
3039
3196
|
);
|
|
3040
3197
|
};
|
|
3041
|
-
return /* @__PURE__ */
|
|
3042
|
-
/* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3044
|
-
/* @__PURE__ */
|
|
3198
|
+
return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3199
|
+
/* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
|
|
3200
|
+
/* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
3201
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-muted", children: t("userProfile.email.description") })
|
|
3045
3202
|
] }),
|
|
3046
|
-
/* @__PURE__ */
|
|
3047
|
-
/* @__PURE__ */
|
|
3048
|
-
/* @__PURE__ */
|
|
3203
|
+
/* @__PURE__ */ jsxs34("p", { className: "ba-profile-current", children: [
|
|
3204
|
+
/* @__PURE__ */ jsx37("span", { children: t("userProfile.email.current") }),
|
|
3205
|
+
/* @__PURE__ */ jsx37("strong", { children: /* @__PURE__ */ jsx37(Bidi, { children: user.email }) })
|
|
3049
3206
|
] }),
|
|
3050
|
-
!allowChange ? /* @__PURE__ */
|
|
3051
|
-
/* @__PURE__ */
|
|
3207
|
+
!allowChange ? /* @__PURE__ */ jsx37("p", { className: "ba-muted", "data-testid": "email-change-disabled", children: t("userProfile.email.changeDisabled") }) : /* @__PURE__ */ jsxs34("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3208
|
+
/* @__PURE__ */ jsxs34("label", { className: "ba-label", children: [
|
|
3052
3209
|
t("userProfile.email.newLabel"),
|
|
3053
|
-
/* @__PURE__ */
|
|
3210
|
+
/* @__PURE__ */ jsx37(
|
|
3054
3211
|
"input",
|
|
3055
3212
|
{
|
|
3056
3213
|
className: "ba-input",
|
|
@@ -3062,16 +3219,16 @@ function EmailSection({ allowChange }) {
|
|
|
3062
3219
|
}
|
|
3063
3220
|
)
|
|
3064
3221
|
] }),
|
|
3065
|
-
/* @__PURE__ */
|
|
3066
|
-
sent && /* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3222
|
+
/* @__PURE__ */ jsx37(FormError, { children: error }),
|
|
3223
|
+
sent && /* @__PURE__ */ jsx37("p", { className: "ba-success", role: "status", children: t("userProfile.email.sent") }),
|
|
3224
|
+
/* @__PURE__ */ jsx37(
|
|
3068
3225
|
"button",
|
|
3069
3226
|
{
|
|
3070
3227
|
className: "ba-button ba-profile-submit",
|
|
3071
3228
|
type: "submit",
|
|
3072
3229
|
disabled: pending || !newEmail.trim(),
|
|
3073
3230
|
"aria-busy": pending || void 0,
|
|
3074
|
-
children: /* @__PURE__ */
|
|
3231
|
+
children: /* @__PURE__ */ jsx37(Busy, { busy: pending, label: t("common.sending"), children: t("userProfile.email.submit") })
|
|
3075
3232
|
}
|
|
3076
3233
|
)
|
|
3077
3234
|
] })
|
|
@@ -3079,16 +3236,16 @@ function EmailSection({ allowChange }) {
|
|
|
3079
3236
|
}
|
|
3080
3237
|
|
|
3081
3238
|
// src/components/user-profile/DeleteAccountSection.tsx
|
|
3082
|
-
import * as
|
|
3083
|
-
import { jsx as
|
|
3239
|
+
import * as React29 from "react";
|
|
3240
|
+
import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3084
3241
|
function DeleteAccountSection({ onDeleted }) {
|
|
3085
3242
|
const t = useT();
|
|
3086
3243
|
const account = useAccount();
|
|
3087
3244
|
const session = useSession();
|
|
3088
3245
|
const { user } = useUser();
|
|
3089
3246
|
const { pending, error, run } = useSubmitAction();
|
|
3090
|
-
const [confirmation, setConfirmation] =
|
|
3091
|
-
const titleId =
|
|
3247
|
+
const [confirmation, setConfirmation] = React29.useState("");
|
|
3248
|
+
const titleId = React29.useId();
|
|
3092
3249
|
const identifier = user?.email ?? user?.phoneNumber ?? user?.id ?? "";
|
|
3093
3250
|
const confirmed = identifier.length > 0 && confirmation.trim().toLowerCase() === identifier.toLowerCase();
|
|
3094
3251
|
const submit = (event) => {
|
|
@@ -3105,18 +3262,18 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
3105
3262
|
}
|
|
3106
3263
|
);
|
|
3107
3264
|
};
|
|
3108
|
-
return /* @__PURE__ */
|
|
3109
|
-
/* @__PURE__ */
|
|
3110
|
-
/* @__PURE__ */
|
|
3111
|
-
/* @__PURE__ */
|
|
3265
|
+
return /* @__PURE__ */ jsxs35("section", { className: "ba-profile-section ba-profile-danger-zone", "aria-labelledby": titleId, children: [
|
|
3266
|
+
/* @__PURE__ */ jsxs35("header", { className: "ba-profile-section-header", children: [
|
|
3267
|
+
/* @__PURE__ */ jsx38("h2", { id: titleId, className: "ba-title", children: t("userProfile.delete.title") }),
|
|
3268
|
+
/* @__PURE__ */ jsx38("p", { className: "ba-muted", children: t("userProfile.delete.description") })
|
|
3112
3269
|
] }),
|
|
3113
|
-
/* @__PURE__ */
|
|
3114
|
-
/* @__PURE__ */
|
|
3115
|
-
/* @__PURE__ */
|
|
3270
|
+
/* @__PURE__ */ jsxs35("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3271
|
+
/* @__PURE__ */ jsx38("p", { className: "ba-profile-delete-warning", children: t("userProfile.delete.warning", { identifier }) }),
|
|
3272
|
+
/* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
|
|
3116
3273
|
t("userProfile.delete.confirmLabel"),
|
|
3117
3274
|
" ",
|
|
3118
|
-
/* @__PURE__ */
|
|
3119
|
-
/* @__PURE__ */
|
|
3275
|
+
/* @__PURE__ */ jsx38(Bidi, { children: identifier }),
|
|
3276
|
+
/* @__PURE__ */ jsx38(
|
|
3120
3277
|
"input",
|
|
3121
3278
|
{
|
|
3122
3279
|
className: "ba-input",
|
|
@@ -3130,15 +3287,15 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
3130
3287
|
}
|
|
3131
3288
|
)
|
|
3132
3289
|
] }),
|
|
3133
|
-
/* @__PURE__ */
|
|
3134
|
-
/* @__PURE__ */
|
|
3290
|
+
/* @__PURE__ */ jsx38(FormError, { children: error }),
|
|
3291
|
+
/* @__PURE__ */ jsx38(
|
|
3135
3292
|
"button",
|
|
3136
3293
|
{
|
|
3137
3294
|
className: "ba-button ba-danger-button ba-profile-submit",
|
|
3138
3295
|
type: "submit",
|
|
3139
3296
|
disabled: pending || !confirmed,
|
|
3140
3297
|
"aria-busy": pending || void 0,
|
|
3141
|
-
children: /* @__PURE__ */
|
|
3298
|
+
children: /* @__PURE__ */ jsx38(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.delete.submit") })
|
|
3142
3299
|
}
|
|
3143
3300
|
)
|
|
3144
3301
|
] })
|
|
@@ -3146,26 +3303,26 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
3146
3303
|
}
|
|
3147
3304
|
|
|
3148
3305
|
// src/components/user-profile/MfaSection.tsx
|
|
3149
|
-
import * as
|
|
3150
|
-
import { jsx as
|
|
3306
|
+
import * as React30 from "react";
|
|
3307
|
+
import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3151
3308
|
function MfaSection() {
|
|
3152
3309
|
const t = useT();
|
|
3153
3310
|
const { user } = useUser();
|
|
3154
3311
|
const session = useSession();
|
|
3155
3312
|
const { config } = usePublicConfig();
|
|
3156
3313
|
const { disable } = useMFA();
|
|
3157
|
-
const { pending, error, run } =
|
|
3158
|
-
const [password, setPassword] =
|
|
3159
|
-
const [showDisable, setShowDisable] =
|
|
3160
|
-
const titleId =
|
|
3314
|
+
const { pending, error, stepUpRequired, run, resume, cancel } = useStepUpAction();
|
|
3315
|
+
const [password, setPassword] = React30.useState("");
|
|
3316
|
+
const [showDisable, setShowDisable] = React30.useState(false);
|
|
3317
|
+
const titleId = React30.useId();
|
|
3161
3318
|
const required = resolveProjectCapabilities(config).mfaRequired;
|
|
3162
3319
|
if (!user?.twoFactorEnabled) {
|
|
3163
|
-
return /* @__PURE__ */
|
|
3164
|
-
/* @__PURE__ */
|
|
3165
|
-
/* @__PURE__ */
|
|
3166
|
-
/* @__PURE__ */
|
|
3320
|
+
return /* @__PURE__ */ jsxs36("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3321
|
+
/* @__PURE__ */ jsxs36("header", { className: "ba-profile-section-header", children: [
|
|
3322
|
+
/* @__PURE__ */ jsx39("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
3323
|
+
/* @__PURE__ */ jsx39("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredDescription") : t("userProfile.mfa.description") })
|
|
3167
3324
|
] }),
|
|
3168
|
-
/* @__PURE__ */
|
|
3325
|
+
/* @__PURE__ */ jsx39(
|
|
3169
3326
|
MFAEnrollment,
|
|
3170
3327
|
{
|
|
3171
3328
|
title: null,
|
|
@@ -3188,16 +3345,26 @@ function MfaSection() {
|
|
|
3188
3345
|
}
|
|
3189
3346
|
);
|
|
3190
3347
|
};
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3348
|
+
const cancelDisable = () => {
|
|
3349
|
+
cancel();
|
|
3350
|
+
setShowDisable(false);
|
|
3351
|
+
setPassword("");
|
|
3352
|
+
};
|
|
3353
|
+
return /* @__PURE__ */ jsxs36("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3354
|
+
/* @__PURE__ */ jsxs36("header", { className: "ba-profile-section-header", children: [
|
|
3355
|
+
/* @__PURE__ */ jsx39("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
3356
|
+
/* @__PURE__ */ jsx39("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredActive") : t("userProfile.mfa.active") })
|
|
3195
3357
|
] }),
|
|
3196
|
-
/* @__PURE__ */
|
|
3197
|
-
/* @__PURE__ */
|
|
3198
|
-
/* @__PURE__ */
|
|
3358
|
+
/* @__PURE__ */ jsxs36("div", { className: "ba-profile-status", role: "status", children: [
|
|
3359
|
+
/* @__PURE__ */ jsx39("strong", { children: t("userProfile.mfa.enabled") }),
|
|
3360
|
+
/* @__PURE__ */ jsx39("span", { children: t("userProfile.mfa.authenticator") })
|
|
3199
3361
|
] }),
|
|
3200
|
-
|
|
3362
|
+
stepUpRequired ? (
|
|
3363
|
+
// Turning the factor off requires PROVING it, not just knowing the
|
|
3364
|
+
// password - see `useStepUpAction`. The parked attempt replays with the
|
|
3365
|
+
// password already entered, so accepting a code finishes the removal.
|
|
3366
|
+
/* @__PURE__ */ jsx39(MFAChallenge, { variant: "step-up", onVerified: resume, onCancel: cancelDisable })
|
|
3367
|
+
) : !showDisable ? /* @__PURE__ */ jsx39(
|
|
3201
3368
|
"button",
|
|
3202
3369
|
{
|
|
3203
3370
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -3205,11 +3372,11 @@ function MfaSection() {
|
|
|
3205
3372
|
onClick: () => setShowDisable(true),
|
|
3206
3373
|
children: required ? t("userProfile.mfa.replace") : t("userProfile.mfa.disable")
|
|
3207
3374
|
}
|
|
3208
|
-
) : /* @__PURE__ */
|
|
3209
|
-
/* @__PURE__ */
|
|
3210
|
-
/* @__PURE__ */
|
|
3375
|
+
) : /* @__PURE__ */ jsxs36("form", { method: "post", className: "ba-fields ba-profile-security-form", onSubmit: submitDisable, children: [
|
|
3376
|
+
/* @__PURE__ */ jsx39("p", { className: "ba-muted", children: required ? t("userProfile.mfa.replaceWarning") : t("userProfile.mfa.disableWarning") }),
|
|
3377
|
+
/* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
|
|
3211
3378
|
t("common.passwordLabel"),
|
|
3212
|
-
/* @__PURE__ */
|
|
3379
|
+
/* @__PURE__ */ jsx39(
|
|
3213
3380
|
"input",
|
|
3214
3381
|
{
|
|
3215
3382
|
className: "ba-input",
|
|
@@ -3221,29 +3388,26 @@ function MfaSection() {
|
|
|
3221
3388
|
}
|
|
3222
3389
|
)
|
|
3223
3390
|
] }),
|
|
3224
|
-
/* @__PURE__ */
|
|
3225
|
-
/* @__PURE__ */
|
|
3226
|
-
/* @__PURE__ */
|
|
3391
|
+
/* @__PURE__ */ jsx39(FormError, { children: error }),
|
|
3392
|
+
/* @__PURE__ */ jsxs36("span", { className: "ba-profile-action-row", children: [
|
|
3393
|
+
/* @__PURE__ */ jsx39(
|
|
3227
3394
|
"button",
|
|
3228
3395
|
{
|
|
3229
3396
|
className: "ba-button ba-danger-button",
|
|
3230
3397
|
type: "submit",
|
|
3231
3398
|
disabled: pending || !password,
|
|
3232
3399
|
"aria-busy": pending || void 0,
|
|
3233
|
-
children: /* @__PURE__ */
|
|
3400
|
+
children: /* @__PURE__ */ jsx39(Busy, { busy: pending, label: t("common.working"), children: required ? t("userProfile.mfa.replaceConfirm") : t("userProfile.mfa.disableConfirm") })
|
|
3234
3401
|
}
|
|
3235
3402
|
),
|
|
3236
|
-
/* @__PURE__ */
|
|
3403
|
+
/* @__PURE__ */ jsx39(
|
|
3237
3404
|
"button",
|
|
3238
3405
|
{
|
|
3239
3406
|
className: "ba-button ba-button-secondary",
|
|
3240
3407
|
type: "button",
|
|
3241
3408
|
disabled: pending,
|
|
3242
|
-
onClick:
|
|
3243
|
-
|
|
3244
|
-
setPassword("");
|
|
3245
|
-
},
|
|
3246
|
-
children: t("userProfile.cancel")
|
|
3409
|
+
onClick: cancelDisable,
|
|
3410
|
+
children: t("common.cancel")
|
|
3247
3411
|
}
|
|
3248
3412
|
)
|
|
3249
3413
|
] })
|
|
@@ -3252,19 +3416,19 @@ function MfaSection() {
|
|
|
3252
3416
|
}
|
|
3253
3417
|
|
|
3254
3418
|
// src/components/user-profile/PasswordSection.tsx
|
|
3255
|
-
import * as
|
|
3256
|
-
import { jsx as
|
|
3419
|
+
import * as React31 from "react";
|
|
3420
|
+
import { jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3257
3421
|
function PasswordSection() {
|
|
3258
3422
|
const t = useT();
|
|
3259
3423
|
const account = useAccount();
|
|
3260
3424
|
const { config } = usePublicConfig();
|
|
3261
3425
|
const { passwordMinLength, passwordMaxLength } = resolveProjectCapabilities(config);
|
|
3262
3426
|
const { pending, error, setError, run } = useSubmitAction();
|
|
3263
|
-
const [currentPassword, setCurrentPassword] =
|
|
3264
|
-
const [newPassword, setNewPassword] =
|
|
3265
|
-
const [confirmPassword, setConfirmPassword] =
|
|
3266
|
-
const [saved, setSaved] =
|
|
3267
|
-
const titleId =
|
|
3427
|
+
const [currentPassword, setCurrentPassword] = React31.useState("");
|
|
3428
|
+
const [newPassword, setNewPassword] = React31.useState("");
|
|
3429
|
+
const [confirmPassword, setConfirmPassword] = React31.useState("");
|
|
3430
|
+
const [saved, setSaved] = React31.useState(false);
|
|
3431
|
+
const titleId = React31.useId();
|
|
3268
3432
|
const submit = (event) => {
|
|
3269
3433
|
event.preventDefault();
|
|
3270
3434
|
setSaved(false);
|
|
@@ -3289,43 +3453,43 @@ function PasswordSection() {
|
|
|
3289
3453
|
}
|
|
3290
3454
|
);
|
|
3291
3455
|
};
|
|
3292
|
-
return /* @__PURE__ */
|
|
3293
|
-
/* @__PURE__ */
|
|
3294
|
-
/* @__PURE__ */
|
|
3295
|
-
/* @__PURE__ */
|
|
3456
|
+
return /* @__PURE__ */ jsxs37("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3457
|
+
/* @__PURE__ */ jsxs37("header", { className: "ba-profile-section-header", children: [
|
|
3458
|
+
/* @__PURE__ */ jsx40("h2", { id: titleId, className: "ba-title", children: t("userProfile.password.title") }),
|
|
3459
|
+
/* @__PURE__ */ jsx40("p", { className: "ba-muted", children: t("userProfile.password.description") })
|
|
3296
3460
|
] }),
|
|
3297
|
-
/* @__PURE__ */
|
|
3298
|
-
/* @__PURE__ */
|
|
3461
|
+
/* @__PURE__ */ jsxs37("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3462
|
+
/* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
3299
3463
|
t("userProfile.password.currentLabel"),
|
|
3300
|
-
/* @__PURE__ */
|
|
3464
|
+
/* @__PURE__ */ jsx40("input", { className: "ba-input", type: "password", autoComplete: "current-password", value: currentPassword, onChange: (event) => {
|
|
3301
3465
|
setCurrentPassword(event.target.value);
|
|
3302
3466
|
setError(null);
|
|
3303
3467
|
}, required: true })
|
|
3304
3468
|
] }),
|
|
3305
|
-
/* @__PURE__ */
|
|
3469
|
+
/* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
3306
3470
|
t("resetPassword.newPasswordLabel"),
|
|
3307
|
-
/* @__PURE__ */
|
|
3471
|
+
/* @__PURE__ */ jsx40("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: newPassword, onChange: (event) => {
|
|
3308
3472
|
setNewPassword(event.target.value);
|
|
3309
3473
|
setError(null);
|
|
3310
3474
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
3311
3475
|
] }),
|
|
3312
|
-
/* @__PURE__ */
|
|
3476
|
+
/* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
3313
3477
|
t("resetPassword.confirmPasswordLabel"),
|
|
3314
|
-
/* @__PURE__ */
|
|
3478
|
+
/* @__PURE__ */ jsx40("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: confirmPassword, onChange: (event) => {
|
|
3315
3479
|
setConfirmPassword(event.target.value);
|
|
3316
3480
|
setError(null);
|
|
3317
3481
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
3318
3482
|
] }),
|
|
3319
|
-
/* @__PURE__ */
|
|
3320
|
-
saved && /* @__PURE__ */
|
|
3321
|
-
/* @__PURE__ */
|
|
3483
|
+
/* @__PURE__ */ jsx40(FormError, { children: error }),
|
|
3484
|
+
saved && /* @__PURE__ */ jsx40("p", { className: "ba-success", role: "status", children: t("userProfile.password.saved") }),
|
|
3485
|
+
/* @__PURE__ */ jsx40(
|
|
3322
3486
|
"button",
|
|
3323
3487
|
{
|
|
3324
3488
|
className: "ba-button ba-profile-submit",
|
|
3325
3489
|
type: "submit",
|
|
3326
3490
|
disabled: pending || !currentPassword || !newPassword || !confirmPassword,
|
|
3327
3491
|
"aria-busy": pending || void 0,
|
|
3328
|
-
children: /* @__PURE__ */
|
|
3492
|
+
children: /* @__PURE__ */ jsx40(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.password.submit") })
|
|
3329
3493
|
}
|
|
3330
3494
|
)
|
|
3331
3495
|
] })
|
|
@@ -3333,23 +3497,23 @@ function PasswordSection() {
|
|
|
3333
3497
|
}
|
|
3334
3498
|
|
|
3335
3499
|
// src/components/user-profile/PasskeysSection.tsx
|
|
3336
|
-
import * as
|
|
3337
|
-
import { jsx as
|
|
3500
|
+
import * as React32 from "react";
|
|
3501
|
+
import { jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3338
3502
|
function PasskeysSection({ allowAdd }) {
|
|
3339
3503
|
const t = useT();
|
|
3340
|
-
const titleId =
|
|
3341
|
-
return /* @__PURE__ */
|
|
3342
|
-
/* @__PURE__ */
|
|
3343
|
-
/* @__PURE__ */
|
|
3344
|
-
/* @__PURE__ */
|
|
3504
|
+
const titleId = React32.useId();
|
|
3505
|
+
return /* @__PURE__ */ jsxs38("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3506
|
+
/* @__PURE__ */ jsxs38("header", { className: "ba-profile-section-header", children: [
|
|
3507
|
+
/* @__PURE__ */ jsx41("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
|
|
3508
|
+
/* @__PURE__ */ jsx41("p", { className: "ba-muted", children: t("userProfile.passkeys.description") })
|
|
3345
3509
|
] }),
|
|
3346
|
-
/* @__PURE__ */
|
|
3510
|
+
/* @__PURE__ */ jsx41(PasskeyManager, { title: null, allowAdd })
|
|
3347
3511
|
] });
|
|
3348
3512
|
}
|
|
3349
3513
|
|
|
3350
3514
|
// src/components/user-profile/ProfileSection.tsx
|
|
3351
|
-
import * as
|
|
3352
|
-
import { Fragment as
|
|
3515
|
+
import * as React33 from "react";
|
|
3516
|
+
import { Fragment as Fragment12, jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3353
3517
|
function ProfileSection({
|
|
3354
3518
|
firstLastName,
|
|
3355
3519
|
usernameEnabled,
|
|
@@ -3360,15 +3524,15 @@ function ProfileSection({
|
|
|
3360
3524
|
const { user } = useUser();
|
|
3361
3525
|
const session = useSession();
|
|
3362
3526
|
const { pending, error, run } = useSubmitAction();
|
|
3363
|
-
const [name, setName] =
|
|
3364
|
-
const [firstName, setFirstName] =
|
|
3365
|
-
const [lastName, setLastName] =
|
|
3366
|
-
const [username, setUsername] =
|
|
3527
|
+
const [name, setName] = React33.useState(user?.name ?? "");
|
|
3528
|
+
const [firstName, setFirstName] = React33.useState(user?.firstName ?? "");
|
|
3529
|
+
const [lastName, setLastName] = React33.useState(user?.lastName ?? "");
|
|
3530
|
+
const [username, setUsername] = React33.useState(
|
|
3367
3531
|
user?.displayUsername ?? user?.username ?? ""
|
|
3368
3532
|
);
|
|
3369
|
-
const [image, setImage] =
|
|
3370
|
-
const [saved, setSaved] =
|
|
3371
|
-
const titleId =
|
|
3533
|
+
const [image, setImage] = React33.useState(user?.image ?? "");
|
|
3534
|
+
const [saved, setSaved] = React33.useState(false);
|
|
3535
|
+
const titleId = React33.useId();
|
|
3372
3536
|
const submit = (event) => {
|
|
3373
3537
|
event.preventDefault();
|
|
3374
3538
|
setSaved(false);
|
|
@@ -3391,15 +3555,15 @@ function ProfileSection({
|
|
|
3391
3555
|
}
|
|
3392
3556
|
);
|
|
3393
3557
|
};
|
|
3394
|
-
return /* @__PURE__ */
|
|
3395
|
-
/* @__PURE__ */
|
|
3396
|
-
/* @__PURE__ */
|
|
3397
|
-
/* @__PURE__ */
|
|
3558
|
+
return /* @__PURE__ */ jsxs39("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3559
|
+
/* @__PURE__ */ jsxs39("header", { className: "ba-profile-section-header", children: [
|
|
3560
|
+
/* @__PURE__ */ jsx42("h2", { id: titleId, className: "ba-title", children: t("userProfile.profile.title") }),
|
|
3561
|
+
/* @__PURE__ */ jsx42("p", { className: "ba-muted", children: t("userProfile.profile.description") })
|
|
3398
3562
|
] }),
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
legacyNameField && /* @__PURE__ */
|
|
3563
|
+
/* @__PURE__ */ jsxs39("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3564
|
+
legacyNameField && /* @__PURE__ */ jsxs39("label", { className: "ba-label", children: [
|
|
3401
3565
|
t("signUp.nameLabel"),
|
|
3402
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ jsx42(
|
|
3403
3567
|
"input",
|
|
3404
3568
|
{
|
|
3405
3569
|
className: "ba-input",
|
|
@@ -3410,10 +3574,10 @@ function ProfileSection({
|
|
|
3410
3574
|
}
|
|
3411
3575
|
)
|
|
3412
3576
|
] }),
|
|
3413
|
-
firstLastName && /* @__PURE__ */
|
|
3414
|
-
/* @__PURE__ */
|
|
3577
|
+
firstLastName && /* @__PURE__ */ jsxs39(Fragment12, { children: [
|
|
3578
|
+
/* @__PURE__ */ jsxs39("label", { className: "ba-label", children: [
|
|
3415
3579
|
t("signUp.firstNameLabel"),
|
|
3416
|
-
/* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ jsx42(
|
|
3417
3581
|
"input",
|
|
3418
3582
|
{
|
|
3419
3583
|
className: "ba-input",
|
|
@@ -3423,9 +3587,9 @@ function ProfileSection({
|
|
|
3423
3587
|
}
|
|
3424
3588
|
)
|
|
3425
3589
|
] }),
|
|
3426
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsxs39("label", { className: "ba-label", children: [
|
|
3427
3591
|
t("signUp.lastNameLabel"),
|
|
3428
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsx42(
|
|
3429
3593
|
"input",
|
|
3430
3594
|
{
|
|
3431
3595
|
className: "ba-input",
|
|
@@ -3436,9 +3600,9 @@ function ProfileSection({
|
|
|
3436
3600
|
)
|
|
3437
3601
|
] })
|
|
3438
3602
|
] }),
|
|
3439
|
-
usernameEnabled && /* @__PURE__ */
|
|
3603
|
+
usernameEnabled && /* @__PURE__ */ jsxs39("label", { className: "ba-label", children: [
|
|
3440
3604
|
t("common.usernameLabel"),
|
|
3441
|
-
/* @__PURE__ */
|
|
3605
|
+
/* @__PURE__ */ jsx42(
|
|
3442
3606
|
"input",
|
|
3443
3607
|
{
|
|
3444
3608
|
className: "ba-input",
|
|
@@ -3448,9 +3612,9 @@ function ProfileSection({
|
|
|
3448
3612
|
}
|
|
3449
3613
|
)
|
|
3450
3614
|
] }),
|
|
3451
|
-
/* @__PURE__ */
|
|
3615
|
+
/* @__PURE__ */ jsxs39("label", { className: "ba-label", children: [
|
|
3452
3616
|
t("userProfile.profile.imageLabel"),
|
|
3453
|
-
/* @__PURE__ */
|
|
3617
|
+
/* @__PURE__ */ jsx42(
|
|
3454
3618
|
"input",
|
|
3455
3619
|
{
|
|
3456
3620
|
className: "ba-input",
|
|
@@ -3461,16 +3625,16 @@ function ProfileSection({
|
|
|
3461
3625
|
}
|
|
3462
3626
|
)
|
|
3463
3627
|
] }),
|
|
3464
|
-
/* @__PURE__ */
|
|
3465
|
-
saved && /* @__PURE__ */
|
|
3466
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsx42(FormError, { children: error }),
|
|
3629
|
+
saved && /* @__PURE__ */ jsx42("p", { className: "ba-success", role: "status", children: t("userProfile.profile.saved") }),
|
|
3630
|
+
/* @__PURE__ */ jsx42(
|
|
3467
3631
|
"button",
|
|
3468
3632
|
{
|
|
3469
3633
|
className: "ba-button ba-profile-submit",
|
|
3470
3634
|
type: "submit",
|
|
3471
3635
|
disabled: pending || legacyNameField && !name.trim(),
|
|
3472
3636
|
"aria-busy": pending || void 0,
|
|
3473
|
-
children: /* @__PURE__ */
|
|
3637
|
+
children: /* @__PURE__ */ jsx42(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.save") })
|
|
3474
3638
|
}
|
|
3475
3639
|
)
|
|
3476
3640
|
] })
|
|
@@ -3478,30 +3642,30 @@ function ProfileSection({
|
|
|
3478
3642
|
}
|
|
3479
3643
|
|
|
3480
3644
|
// src/components/user-profile/RecoverySection.tsx
|
|
3481
|
-
import * as
|
|
3482
|
-
import { Fragment as
|
|
3645
|
+
import * as React34 from "react";
|
|
3646
|
+
import { Fragment as Fragment13, jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3483
3647
|
function RecoverySection() {
|
|
3484
3648
|
const t = useT();
|
|
3485
3649
|
const { user } = useUser();
|
|
3486
|
-
const titleId =
|
|
3487
|
-
return /* @__PURE__ */
|
|
3488
|
-
/* @__PURE__ */
|
|
3489
|
-
/* @__PURE__ */
|
|
3490
|
-
/* @__PURE__ */
|
|
3650
|
+
const titleId = React34.useId();
|
|
3651
|
+
return /* @__PURE__ */ jsxs40("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3652
|
+
/* @__PURE__ */ jsxs40("header", { className: "ba-profile-section-header", children: [
|
|
3653
|
+
/* @__PURE__ */ jsx43("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
|
|
3654
|
+
/* @__PURE__ */ jsx43("p", { className: "ba-muted", children: t("userProfile.recovery.description") })
|
|
3491
3655
|
] }),
|
|
3492
|
-
/* @__PURE__ */
|
|
3493
|
-
/* @__PURE__ */
|
|
3494
|
-
user?.email && user.emailVerified ? /* @__PURE__ */
|
|
3495
|
-
/* @__PURE__ */
|
|
3496
|
-
/* @__PURE__ */
|
|
3497
|
-
] }) : /* @__PURE__ */
|
|
3656
|
+
/* @__PURE__ */ jsxs40("div", { className: "ba-profile-recovery-card", children: [
|
|
3657
|
+
/* @__PURE__ */ jsx43("strong", { children: t("userProfile.recovery.emailTitle") }),
|
|
3658
|
+
user?.email && user.emailVerified ? /* @__PURE__ */ jsxs40(Fragment13, { children: [
|
|
3659
|
+
/* @__PURE__ */ jsx43("p", { children: t("userProfile.recovery.emailDescription") }),
|
|
3660
|
+
/* @__PURE__ */ jsx43(Bidi, { children: user.email })
|
|
3661
|
+
] }) : /* @__PURE__ */ jsx43("p", { children: t("userProfile.recovery.emailUnavailable") })
|
|
3498
3662
|
] }),
|
|
3499
|
-
/* @__PURE__ */
|
|
3663
|
+
/* @__PURE__ */ jsx43(BackupCodesManager, { title: null })
|
|
3500
3664
|
] });
|
|
3501
3665
|
}
|
|
3502
3666
|
|
|
3503
3667
|
// src/components/user-profile/SessionsSection.tsx
|
|
3504
|
-
import * as
|
|
3668
|
+
import * as React36 from "react";
|
|
3505
3669
|
|
|
3506
3670
|
// src/components/user-profile/model.ts
|
|
3507
3671
|
var USER_PROFILE_SECTIONS = [
|
|
@@ -3550,18 +3714,18 @@ function formatSessionTime(date, locale) {
|
|
|
3550
3714
|
}
|
|
3551
3715
|
|
|
3552
3716
|
// src/components/user-profile/use-account-resource.ts
|
|
3553
|
-
import * as
|
|
3717
|
+
import * as React35 from "react";
|
|
3554
3718
|
function useAccountResource(loader, failure) {
|
|
3555
|
-
const loaderRef =
|
|
3719
|
+
const loaderRef = React35.useRef(loader);
|
|
3556
3720
|
loaderRef.current = loader;
|
|
3557
|
-
const failureRef =
|
|
3721
|
+
const failureRef = React35.useRef(failure);
|
|
3558
3722
|
failureRef.current = failure;
|
|
3559
3723
|
const toServerError = useServerError();
|
|
3560
|
-
const [data, setData] =
|
|
3561
|
-
const [error, setError] =
|
|
3562
|
-
const [loading, setLoading] =
|
|
3563
|
-
const requestRef =
|
|
3564
|
-
const load =
|
|
3724
|
+
const [data, setData] = React35.useState(null);
|
|
3725
|
+
const [error, setError] = React35.useState(null);
|
|
3726
|
+
const [loading, setLoading] = React35.useState(true);
|
|
3727
|
+
const requestRef = React35.useRef(0);
|
|
3728
|
+
const load = React35.useCallback(async () => {
|
|
3565
3729
|
const request = ++requestRef.current;
|
|
3566
3730
|
setLoading(true);
|
|
3567
3731
|
try {
|
|
@@ -3580,7 +3744,7 @@ function useAccountResource(loader, failure) {
|
|
|
3580
3744
|
if (request === requestRef.current) setLoading(false);
|
|
3581
3745
|
}
|
|
3582
3746
|
}, [toServerError]);
|
|
3583
|
-
|
|
3747
|
+
React35.useEffect(() => {
|
|
3584
3748
|
void load();
|
|
3585
3749
|
return () => {
|
|
3586
3750
|
requestRef.current += 1;
|
|
@@ -3590,14 +3754,14 @@ function useAccountResource(loader, failure) {
|
|
|
3590
3754
|
}
|
|
3591
3755
|
|
|
3592
3756
|
// src/components/user-profile/SessionsSection.tsx
|
|
3593
|
-
import { jsx as
|
|
3757
|
+
import { jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3594
3758
|
function SessionsSection() {
|
|
3595
3759
|
const t = useT();
|
|
3596
3760
|
const locale = useLocale();
|
|
3597
3761
|
const account = useAccount();
|
|
3598
3762
|
const sessionState = useSession();
|
|
3599
3763
|
const mutation = useSubmitAction();
|
|
3600
|
-
const titleId =
|
|
3764
|
+
const titleId = React36.useId();
|
|
3601
3765
|
const resource = useAccountResource(
|
|
3602
3766
|
() => account.listSessions(),
|
|
3603
3767
|
t("userProfile.sessions.loadError")
|
|
@@ -3619,31 +3783,31 @@ function SessionsSection() {
|
|
|
3619
3783
|
}
|
|
3620
3784
|
);
|
|
3621
3785
|
};
|
|
3622
|
-
return /* @__PURE__ */
|
|
3623
|
-
/* @__PURE__ */
|
|
3624
|
-
/* @__PURE__ */
|
|
3625
|
-
/* @__PURE__ */
|
|
3786
|
+
return /* @__PURE__ */ jsxs41("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3787
|
+
/* @__PURE__ */ jsxs41("header", { className: "ba-profile-section-header", children: [
|
|
3788
|
+
/* @__PURE__ */ jsx44("h2", { id: titleId, className: "ba-title", children: t("userProfile.sessions.title") }),
|
|
3789
|
+
/* @__PURE__ */ jsx44("p", { className: "ba-muted", children: t("userProfile.sessions.description") })
|
|
3626
3790
|
] }),
|
|
3627
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */
|
|
3628
|
-
/* @__PURE__ */
|
|
3629
|
-
/* @__PURE__ */
|
|
3630
|
-
] }) : null : /* @__PURE__ */
|
|
3791
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ jsxs41("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: [
|
|
3792
|
+
/* @__PURE__ */ jsx44("div", { className: "ba-skeleton" }),
|
|
3793
|
+
/* @__PURE__ */ jsx44("div", { className: "ba-skeleton" })
|
|
3794
|
+
] }) : null : /* @__PURE__ */ jsxs41("ul", { className: "ba-profile-list", children: [
|
|
3631
3795
|
sessions.map((session) => {
|
|
3632
3796
|
const label2 = session.userAgent?.trim() || t("userProfile.sessions.unknownDevice");
|
|
3633
|
-
return /* @__PURE__ */
|
|
3634
|
-
/* @__PURE__ */
|
|
3635
|
-
/* @__PURE__ */
|
|
3636
|
-
/* @__PURE__ */
|
|
3637
|
-
session.id === currentId && /* @__PURE__ */
|
|
3797
|
+
return /* @__PURE__ */ jsxs41("li", { className: "ba-profile-list-item", children: [
|
|
3798
|
+
/* @__PURE__ */ jsxs41("span", { children: [
|
|
3799
|
+
/* @__PURE__ */ jsx44("strong", { children: label2 }),
|
|
3800
|
+
/* @__PURE__ */ jsxs41("small", { children: [
|
|
3801
|
+
session.id === currentId && /* @__PURE__ */ jsx44("em", { children: t("userProfile.sessions.current") }),
|
|
3638
3802
|
formatSessionTime(session.updatedAt, locale)
|
|
3639
3803
|
] })
|
|
3640
3804
|
] }),
|
|
3641
|
-
/* @__PURE__ */
|
|
3805
|
+
/* @__PURE__ */ jsx44("button", { className: "ba-link-button ba-danger", type: "button", disabled: mutation.pending, onClick: () => revoke(session.id, label2), children: t("userProfile.sessions.revoke") })
|
|
3642
3806
|
] }, session.id);
|
|
3643
3807
|
}),
|
|
3644
|
-
sessions.length === 0 && /* @__PURE__ */
|
|
3808
|
+
sessions.length === 0 && /* @__PURE__ */ jsx44("li", { className: "ba-muted", children: t("userProfile.sessions.empty") })
|
|
3645
3809
|
] }),
|
|
3646
|
-
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */
|
|
3810
|
+
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ jsx44(
|
|
3647
3811
|
"button",
|
|
3648
3812
|
{
|
|
3649
3813
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -3659,17 +3823,17 @@ function SessionsSection() {
|
|
|
3659
3823
|
children: t("userProfile.sessions.revokeOthers")
|
|
3660
3824
|
}
|
|
3661
3825
|
),
|
|
3662
|
-
resource.error && /* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
/* @__PURE__ */
|
|
3826
|
+
resource.error && /* @__PURE__ */ jsxs41("div", { className: "ba-profile-inline-error", children: [
|
|
3827
|
+
/* @__PURE__ */ jsx44(FormError, { children: resource.error }),
|
|
3828
|
+
/* @__PURE__ */ jsx44("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
3665
3829
|
] }),
|
|
3666
|
-
/* @__PURE__ */
|
|
3830
|
+
/* @__PURE__ */ jsx44(FormError, { children: mutation.error })
|
|
3667
3831
|
] });
|
|
3668
3832
|
}
|
|
3669
3833
|
|
|
3670
3834
|
// src/components/user-profile/SocialSection.tsx
|
|
3671
|
-
import * as
|
|
3672
|
-
import { jsx as
|
|
3835
|
+
import * as React37 from "react";
|
|
3836
|
+
import { jsx as jsx45, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3673
3837
|
function providerLabel(provider) {
|
|
3674
3838
|
return provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
3675
3839
|
}
|
|
@@ -3678,7 +3842,7 @@ function SocialSection() {
|
|
|
3678
3842
|
const account = useAccount();
|
|
3679
3843
|
const { config } = usePublicConfig();
|
|
3680
3844
|
const mutation = useSubmitAction();
|
|
3681
|
-
const titleId =
|
|
3845
|
+
const titleId = React37.useId();
|
|
3682
3846
|
const resource = useAccountResource(
|
|
3683
3847
|
() => account.listSocialAccounts(),
|
|
3684
3848
|
t("userProfile.social.loadError")
|
|
@@ -3709,18 +3873,18 @@ function SocialSection() {
|
|
|
3709
3873
|
{ failure: t("userProfile.social.unlinkError"), onSuccess: resource.load }
|
|
3710
3874
|
);
|
|
3711
3875
|
};
|
|
3712
|
-
return /* @__PURE__ */
|
|
3713
|
-
/* @__PURE__ */
|
|
3714
|
-
/* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */
|
|
3876
|
+
return /* @__PURE__ */ jsxs42("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3877
|
+
/* @__PURE__ */ jsxs42("header", { className: "ba-profile-section-header", children: [
|
|
3878
|
+
/* @__PURE__ */ jsx45("h2", { id: titleId, className: "ba-title", children: t("userProfile.social.title") }),
|
|
3879
|
+
/* @__PURE__ */ jsx45("p", { className: "ba-muted", children: t("userProfile.social.description") })
|
|
3716
3880
|
] }),
|
|
3717
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */
|
|
3718
|
-
linked.map((item) => /* @__PURE__ */
|
|
3719
|
-
/* @__PURE__ */
|
|
3720
|
-
/* @__PURE__ */
|
|
3721
|
-
/* @__PURE__ */
|
|
3881
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ jsx45("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: /* @__PURE__ */ jsx45("div", { className: "ba-skeleton" }) }) : null : /* @__PURE__ */ jsxs42("ul", { className: "ba-profile-list", children: [
|
|
3882
|
+
linked.map((item) => /* @__PURE__ */ jsxs42("li", { className: "ba-profile-list-item", children: [
|
|
3883
|
+
/* @__PURE__ */ jsxs42("span", { children: [
|
|
3884
|
+
/* @__PURE__ */ jsx45("strong", { children: providerLabel(item.providerId) }),
|
|
3885
|
+
/* @__PURE__ */ jsx45("small", { children: item.canUnlink ? t("userProfile.social.connected") : t("userProfile.social.lastMethod") })
|
|
3722
3886
|
] }),
|
|
3723
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ jsx45(
|
|
3724
3888
|
"button",
|
|
3725
3889
|
{
|
|
3726
3890
|
className: "ba-link-button ba-danger",
|
|
@@ -3735,31 +3899,31 @@ function SocialSection() {
|
|
|
3735
3899
|
}
|
|
3736
3900
|
)
|
|
3737
3901
|
] }, item.id)),
|
|
3738
|
-
linked.length === 0 && /* @__PURE__ */
|
|
3902
|
+
linked.length === 0 && /* @__PURE__ */ jsx45("li", { className: "ba-muted", children: t("userProfile.social.empty") })
|
|
3739
3903
|
] }),
|
|
3740
|
-
available.length > 0 && /* @__PURE__ */
|
|
3741
|
-
/* @__PURE__ */
|
|
3742
|
-
available.map((provider) => /* @__PURE__ */
|
|
3904
|
+
available.length > 0 && /* @__PURE__ */ jsxs42("div", { className: "ba-profile-provider-actions", children: [
|
|
3905
|
+
/* @__PURE__ */ jsx45("p", { className: "ba-profile-subtitle", children: t("userProfile.social.add") }),
|
|
3906
|
+
available.map((provider) => /* @__PURE__ */ jsx45("button", { type: "button", className: "ba-button ba-button-secondary", disabled: mutation.pending, onClick: () => link(provider), children: t("userProfile.social.connectProvider", { provider: providerLabel(provider) }) }, provider))
|
|
3743
3907
|
] }),
|
|
3744
|
-
resource.error && /* @__PURE__ */
|
|
3745
|
-
/* @__PURE__ */
|
|
3746
|
-
/* @__PURE__ */
|
|
3908
|
+
resource.error && /* @__PURE__ */ jsxs42("div", { className: "ba-profile-inline-error", children: [
|
|
3909
|
+
/* @__PURE__ */ jsx45(FormError, { children: resource.error }),
|
|
3910
|
+
/* @__PURE__ */ jsx45("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
3747
3911
|
] }),
|
|
3748
|
-
/* @__PURE__ */
|
|
3912
|
+
/* @__PURE__ */ jsx45(FormError, { children: mutation.error })
|
|
3749
3913
|
] });
|
|
3750
3914
|
}
|
|
3751
3915
|
|
|
3752
3916
|
// src/components/user-profile/UserProfileModal.tsx
|
|
3753
|
-
import * as
|
|
3754
|
-
import { jsx as
|
|
3917
|
+
import * as React38 from "react";
|
|
3918
|
+
import { jsx as jsx46, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3755
3919
|
function UserProfileModal({
|
|
3756
3920
|
children,
|
|
3757
3921
|
onClose,
|
|
3758
3922
|
branding
|
|
3759
3923
|
}) {
|
|
3760
3924
|
const t = useT();
|
|
3761
|
-
const titleId =
|
|
3762
|
-
return /* @__PURE__ */
|
|
3925
|
+
const titleId = React38.useId();
|
|
3926
|
+
return /* @__PURE__ */ jsxs43(
|
|
3763
3927
|
ModalSurface,
|
|
3764
3928
|
{
|
|
3765
3929
|
overlayClassName: "ba-profile-overlay",
|
|
@@ -3768,13 +3932,13 @@ function UserProfileModal({
|
|
|
3768
3932
|
testId: "user-profile-modal",
|
|
3769
3933
|
onClose,
|
|
3770
3934
|
children: [
|
|
3771
|
-
/* @__PURE__ */
|
|
3772
|
-
/* @__PURE__ */
|
|
3935
|
+
/* @__PURE__ */ jsxs43("div", { className: "ba-profile-modal-header", children: [
|
|
3936
|
+
/* @__PURE__ */ jsxs43("span", { children: [
|
|
3773
3937
|
branding,
|
|
3774
|
-
/* @__PURE__ */
|
|
3775
|
-
/* @__PURE__ */
|
|
3938
|
+
/* @__PURE__ */ jsx46("h1", { id: titleId, children: t("userProfile.title") }),
|
|
3939
|
+
/* @__PURE__ */ jsx46("p", { children: t("userProfile.description") })
|
|
3776
3940
|
] }),
|
|
3777
|
-
/* @__PURE__ */
|
|
3941
|
+
/* @__PURE__ */ jsx46(
|
|
3778
3942
|
"button",
|
|
3779
3943
|
{
|
|
3780
3944
|
type: "button",
|
|
@@ -3782,7 +3946,7 @@ function UserProfileModal({
|
|
|
3782
3946
|
"aria-label": t("userProfile.close"),
|
|
3783
3947
|
onClick: onClose,
|
|
3784
3948
|
autoFocus: true,
|
|
3785
|
-
children: /* @__PURE__ */
|
|
3949
|
+
children: /* @__PURE__ */ jsx46("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx46(
|
|
3786
3950
|
"path",
|
|
3787
3951
|
{
|
|
3788
3952
|
d: "M6 6l12 12M18 6L6 18",
|
|
@@ -3795,39 +3959,39 @@ function UserProfileModal({
|
|
|
3795
3959
|
)
|
|
3796
3960
|
] }),
|
|
3797
3961
|
children,
|
|
3798
|
-
/* @__PURE__ */
|
|
3962
|
+
/* @__PURE__ */ jsx46("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx46(AuthOwlBadge, {}) })
|
|
3799
3963
|
]
|
|
3800
3964
|
}
|
|
3801
3965
|
);
|
|
3802
3966
|
}
|
|
3803
3967
|
|
|
3804
3968
|
// src/components/PrivacyCenter.tsx
|
|
3805
|
-
import * as
|
|
3806
|
-
import { jsx as
|
|
3807
|
-
var PrivacyCenterContent =
|
|
3808
|
-
const module = await import("./PrivacyCenterContent-
|
|
3969
|
+
import * as React39 from "react";
|
|
3970
|
+
import { jsx as jsx47, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
3971
|
+
var PrivacyCenterContent = React39.lazy(async () => {
|
|
3972
|
+
const module = await import("./PrivacyCenterContent-C4ON7H74.js");
|
|
3809
3973
|
return { default: module.PrivacyCenterContent };
|
|
3810
3974
|
});
|
|
3811
3975
|
function PrivacyCenter(props = {}) {
|
|
3812
|
-
return /* @__PURE__ */
|
|
3976
|
+
return /* @__PURE__ */ jsx47(React39.Suspense, { fallback: /* @__PURE__ */ jsx47(PrivacyCenterFallback, { className: props.className }), children: /* @__PURE__ */ jsx47(PrivacyCenterContent, { ...props }) });
|
|
3813
3977
|
}
|
|
3814
3978
|
function PrivacyCenterFallback({ className }) {
|
|
3815
|
-
return /* @__PURE__ */
|
|
3979
|
+
return /* @__PURE__ */ jsxs44(
|
|
3816
3980
|
"section",
|
|
3817
3981
|
{
|
|
3818
3982
|
className: ["ba-profile-section ba-privacy-center", className].filter(Boolean).join(" "),
|
|
3819
3983
|
"aria-busy": "true",
|
|
3820
3984
|
children: [
|
|
3821
|
-
/* @__PURE__ */
|
|
3822
|
-
/* @__PURE__ */
|
|
3823
|
-
/* @__PURE__ */
|
|
3985
|
+
/* @__PURE__ */ jsx47("div", { className: "ba-skeleton" }),
|
|
3986
|
+
/* @__PURE__ */ jsx47("div", { className: "ba-skeleton" }),
|
|
3987
|
+
/* @__PURE__ */ jsx47("div", { className: "ba-skeleton" })
|
|
3824
3988
|
]
|
|
3825
3989
|
}
|
|
3826
3990
|
);
|
|
3827
3991
|
}
|
|
3828
3992
|
|
|
3829
3993
|
// src/components/UserProfile.tsx
|
|
3830
|
-
import { jsx as
|
|
3994
|
+
import { jsx as jsx48, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
3831
3995
|
var SECTION_KEYS = {
|
|
3832
3996
|
profile: "userProfile.nav.profile",
|
|
3833
3997
|
email: "userProfile.nav.email",
|
|
@@ -3857,7 +4021,7 @@ function UserProfile(props = {}) {
|
|
|
3857
4021
|
const t = useT();
|
|
3858
4022
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
3859
4023
|
const { config } = usePublicConfig();
|
|
3860
|
-
const [internalSection, setInternalSection] =
|
|
4024
|
+
const [internalSection, setInternalSection] = React40.useState(() => initialSection(defaultSection));
|
|
3861
4025
|
const active = section ?? internalSection;
|
|
3862
4026
|
const capabilities = resolveProjectCapabilities(config);
|
|
3863
4027
|
const passwordEnabled = config !== null && capabilities.passwordSignIn;
|
|
@@ -3867,7 +4031,7 @@ function UserProfile(props = {}) {
|
|
|
3867
4031
|
const deletionEnabled = capabilities.accountDeletion;
|
|
3868
4032
|
const socialEnabled = (config?.socialProviders?.length ?? 0) > 0;
|
|
3869
4033
|
const privacyEnabled = config?.privacy !== void 0;
|
|
3870
|
-
const sections =
|
|
4034
|
+
const sections = React40.useMemo(
|
|
3871
4035
|
() => userProfileSectionsFor({
|
|
3872
4036
|
password: passwordEnabled,
|
|
3873
4037
|
passkeys: passkeysEnabled,
|
|
@@ -3879,7 +4043,7 @@ function UserProfile(props = {}) {
|
|
|
3879
4043
|
}),
|
|
3880
4044
|
[deletionEnabled, mfaEnabled, passkeysEnabled, passwordEnabled, privacyEnabled, recoveryEnabled, socialEnabled]
|
|
3881
4045
|
);
|
|
3882
|
-
|
|
4046
|
+
React40.useEffect(() => {
|
|
3883
4047
|
if (section || mode !== "page") return;
|
|
3884
4048
|
const onHashChange = () => {
|
|
3885
4049
|
const next = userProfileSectionFromHash(window.location.hash);
|
|
@@ -3896,11 +4060,11 @@ function UserProfile(props = {}) {
|
|
|
3896
4060
|
window.history.replaceState(null, "", userProfileSectionHash(next));
|
|
3897
4061
|
}
|
|
3898
4062
|
};
|
|
3899
|
-
const content = !isLoaded ? /* @__PURE__ */
|
|
3900
|
-
/* @__PURE__ */
|
|
3901
|
-
/* @__PURE__ */
|
|
3902
|
-
/* @__PURE__ */
|
|
3903
|
-
] }) : !isSignedIn || !user ? /* @__PURE__ */
|
|
4063
|
+
const content = !isLoaded ? /* @__PURE__ */ jsxs45("div", { className: "ba-profile-loading", "aria-busy": "true", children: [
|
|
4064
|
+
/* @__PURE__ */ jsx48("div", { className: "ba-skeleton" }),
|
|
4065
|
+
/* @__PURE__ */ jsx48("div", { className: "ba-skeleton" }),
|
|
4066
|
+
/* @__PURE__ */ jsx48("div", { className: "ba-skeleton" })
|
|
4067
|
+
] }) : !isSignedIn || !user ? /* @__PURE__ */ jsx48("p", { className: "ba-muted", children: t("userProfile.signedOut") }) : /* @__PURE__ */ jsx48(
|
|
3904
4068
|
UserProfileBody,
|
|
3905
4069
|
{
|
|
3906
4070
|
active: visibleActive,
|
|
@@ -3912,23 +4076,23 @@ function UserProfile(props = {}) {
|
|
|
3912
4076
|
user.id
|
|
3913
4077
|
);
|
|
3914
4078
|
if (props.mode === "modal") {
|
|
3915
|
-
return /* @__PURE__ */
|
|
4079
|
+
return /* @__PURE__ */ jsx48(
|
|
3916
4080
|
UserProfileModal,
|
|
3917
4081
|
{
|
|
3918
4082
|
onClose: props.onClose,
|
|
3919
|
-
branding: showBranding ? /* @__PURE__ */
|
|
4083
|
+
branding: showBranding ? /* @__PURE__ */ jsx48(AuthOwlBranding, {}) : null,
|
|
3920
4084
|
children: content
|
|
3921
4085
|
}
|
|
3922
4086
|
);
|
|
3923
4087
|
}
|
|
3924
|
-
return /* @__PURE__ */
|
|
3925
|
-
/* @__PURE__ */
|
|
3926
|
-
showBranding ? /* @__PURE__ */
|
|
3927
|
-
/* @__PURE__ */
|
|
3928
|
-
/* @__PURE__ */
|
|
4088
|
+
return /* @__PURE__ */ jsxs45("article", { className: "ba-profile ba-profile-page", "data-testid": "user-profile", children: [
|
|
4089
|
+
/* @__PURE__ */ jsxs45("header", { className: "ba-profile-heading", children: [
|
|
4090
|
+
showBranding ? /* @__PURE__ */ jsx48(AuthOwlBranding, {}) : null,
|
|
4091
|
+
/* @__PURE__ */ jsx48("h1", { children: t("userProfile.title") }),
|
|
4092
|
+
/* @__PURE__ */ jsx48("p", { children: t("userProfile.description") })
|
|
3929
4093
|
] }),
|
|
3930
4094
|
content,
|
|
3931
|
-
/* @__PURE__ */
|
|
4095
|
+
/* @__PURE__ */ jsx48("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx48(AuthOwlBadge, {}) })
|
|
3932
4096
|
] });
|
|
3933
4097
|
}
|
|
3934
4098
|
function UserProfileBody({
|
|
@@ -3939,8 +4103,8 @@ function UserProfileBody({
|
|
|
3939
4103
|
capabilities
|
|
3940
4104
|
}) {
|
|
3941
4105
|
const t = useT();
|
|
3942
|
-
return /* @__PURE__ */
|
|
3943
|
-
/* @__PURE__ */
|
|
4106
|
+
return /* @__PURE__ */ jsxs45("div", { className: "ba-profile-layout", children: [
|
|
4107
|
+
/* @__PURE__ */ jsx48("nav", { className: "ba-profile-nav", "aria-label": t("userProfile.nav.aria"), children: sections.map((item) => /* @__PURE__ */ jsx48(
|
|
3944
4108
|
"button",
|
|
3945
4109
|
{
|
|
3946
4110
|
type: "button",
|
|
@@ -3951,8 +4115,8 @@ function UserProfileBody({
|
|
|
3951
4115
|
},
|
|
3952
4116
|
item
|
|
3953
4117
|
)) }),
|
|
3954
|
-
/* @__PURE__ */
|
|
3955
|
-
active === "profile" && /* @__PURE__ */
|
|
4118
|
+
/* @__PURE__ */ jsxs45("div", { className: "ba-profile-content", "data-section": active, children: [
|
|
4119
|
+
active === "profile" && /* @__PURE__ */ jsx48(
|
|
3956
4120
|
ProfileSection,
|
|
3957
4121
|
{
|
|
3958
4122
|
firstLastName: capabilities.firstLastName,
|
|
@@ -3960,41 +4124,41 @@ function UserProfileBody({
|
|
|
3960
4124
|
legacyNameField: capabilities.legacyNameField
|
|
3961
4125
|
}
|
|
3962
4126
|
),
|
|
3963
|
-
active === "email" && /* @__PURE__ */
|
|
3964
|
-
active === "password" && /* @__PURE__ */
|
|
3965
|
-
active === "social" && /* @__PURE__ */
|
|
3966
|
-
active === "sessions" && /* @__PURE__ */
|
|
3967
|
-
active === "passkeys" && /* @__PURE__ */
|
|
3968
|
-
active === "mfa" && /* @__PURE__ */
|
|
3969
|
-
active === "recovery" && /* @__PURE__ */
|
|
3970
|
-
active === "privacy" && /* @__PURE__ */
|
|
3971
|
-
active === "danger" && /* @__PURE__ */
|
|
4127
|
+
active === "email" && /* @__PURE__ */ jsx48(EmailSection, { allowChange: capabilities.emailChange }),
|
|
4128
|
+
active === "password" && /* @__PURE__ */ jsx48(PasswordSection, {}),
|
|
4129
|
+
active === "social" && /* @__PURE__ */ jsx48(SocialSection, {}),
|
|
4130
|
+
active === "sessions" && /* @__PURE__ */ jsx48(SessionsSection, {}),
|
|
4131
|
+
active === "passkeys" && /* @__PURE__ */ jsx48(PasskeysSection, { allowAdd: capabilities.passkeyAdd }),
|
|
4132
|
+
active === "mfa" && /* @__PURE__ */ jsx48(MfaSection, {}),
|
|
4133
|
+
active === "recovery" && /* @__PURE__ */ jsx48(RecoverySection, {}),
|
|
4134
|
+
active === "privacy" && /* @__PURE__ */ jsx48(PrivacyCenter, {}),
|
|
4135
|
+
active === "danger" && /* @__PURE__ */ jsx48(DeleteAccountSection, { onDeleted })
|
|
3972
4136
|
] })
|
|
3973
4137
|
] });
|
|
3974
4138
|
}
|
|
3975
4139
|
|
|
3976
4140
|
// src/components/UserButton.tsx
|
|
3977
|
-
import { jsx as
|
|
4141
|
+
import { jsx as jsx49, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
3978
4142
|
function UserButton() {
|
|
3979
4143
|
const t = useT();
|
|
3980
4144
|
const { user, isLoaded } = useUser();
|
|
3981
4145
|
const { signOut } = useSignOut();
|
|
3982
|
-
const [open, setOpen] =
|
|
3983
|
-
const [profileOpen, setProfileOpen] =
|
|
3984
|
-
const [failedImage, setFailedImage] =
|
|
3985
|
-
const triggerRef =
|
|
4146
|
+
const [open, setOpen] = React41.useState(false);
|
|
4147
|
+
const [profileOpen, setProfileOpen] = React41.useState(false);
|
|
4148
|
+
const [failedImage, setFailedImage] = React41.useState(null);
|
|
4149
|
+
const triggerRef = React41.useRef(null);
|
|
3986
4150
|
if (!isLoaded || !user) return null;
|
|
3987
4151
|
const identity = user.email ?? user.phoneNumber ?? user.name ?? "?";
|
|
3988
4152
|
const image = user.image ?? null;
|
|
3989
|
-
return /* @__PURE__ */
|
|
3990
|
-
/* @__PURE__ */
|
|
4153
|
+
return /* @__PURE__ */ jsxs46("div", { className: "ba-user-button", "data-testid": "user-button", children: [
|
|
4154
|
+
/* @__PURE__ */ jsx49(
|
|
3991
4155
|
"button",
|
|
3992
4156
|
{
|
|
3993
4157
|
ref: triggerRef,
|
|
3994
4158
|
className: "ba-user-button-trigger",
|
|
3995
4159
|
"aria-label": t("userButton.openMenuAria"),
|
|
3996
4160
|
onClick: () => setOpen((v) => !v),
|
|
3997
|
-
children: image && failedImage !== image ? /* @__PURE__ */
|
|
4161
|
+
children: image && failedImage !== image ? /* @__PURE__ */ jsx49(
|
|
3998
4162
|
"img",
|
|
3999
4163
|
{
|
|
4000
4164
|
className: "ba-avatar",
|
|
@@ -4003,12 +4167,12 @@ function UserButton() {
|
|
|
4003
4167
|
referrerPolicy: "no-referrer",
|
|
4004
4168
|
onError: () => setFailedImage(image)
|
|
4005
4169
|
}
|
|
4006
|
-
) : /* @__PURE__ */
|
|
4170
|
+
) : /* @__PURE__ */ jsx49("span", { className: "ba-avatar ba-avatar-fallback", children: identity[0]?.toUpperCase() })
|
|
4007
4171
|
}
|
|
4008
4172
|
),
|
|
4009
|
-
open && /* @__PURE__ */
|
|
4010
|
-
/* @__PURE__ */
|
|
4011
|
-
/* @__PURE__ */
|
|
4173
|
+
open && /* @__PURE__ */ jsxs46("div", { className: "ba-menu", children: [
|
|
4174
|
+
/* @__PURE__ */ jsx49("p", { className: "ba-menu-label", children: identity }),
|
|
4175
|
+
/* @__PURE__ */ jsx49(
|
|
4012
4176
|
"button",
|
|
4013
4177
|
{
|
|
4014
4178
|
className: "ba-menu-item",
|
|
@@ -4019,10 +4183,10 @@ function UserButton() {
|
|
|
4019
4183
|
children: t("userButton.manageAccount")
|
|
4020
4184
|
}
|
|
4021
4185
|
),
|
|
4022
|
-
/* @__PURE__ */
|
|
4023
|
-
/* @__PURE__ */
|
|
4186
|
+
/* @__PURE__ */ jsx49("button", { className: "ba-menu-item", onClick: () => signOut(), children: t("userButton.signOut") }),
|
|
4187
|
+
/* @__PURE__ */ jsx49("div", { className: "ba-menu-badge", children: /* @__PURE__ */ jsx49(AuthOwlBadge, {}) })
|
|
4024
4188
|
] }),
|
|
4025
|
-
profileOpen && /* @__PURE__ */
|
|
4189
|
+
profileOpen && /* @__PURE__ */ jsx49(
|
|
4026
4190
|
UserProfile,
|
|
4027
4191
|
{
|
|
4028
4192
|
mode: "modal",
|
|
@@ -4038,35 +4202,35 @@ function UserButton() {
|
|
|
4038
4202
|
}
|
|
4039
4203
|
|
|
4040
4204
|
// src/components/OrganizationSwitcher.tsx
|
|
4041
|
-
import * as
|
|
4042
|
-
import { jsx as
|
|
4043
|
-
var OrganizationSwitcherContent =
|
|
4044
|
-
const module = await import("./OrganizationSwitcherContent-
|
|
4205
|
+
import * as React42 from "react";
|
|
4206
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
4207
|
+
var OrganizationSwitcherContent = React42.lazy(async () => {
|
|
4208
|
+
const module = await import("./OrganizationSwitcherContent-6G6ASVYZ.js");
|
|
4045
4209
|
return { default: module.OrganizationSwitcherContent };
|
|
4046
4210
|
});
|
|
4047
4211
|
function OrganizationSwitcher(props = {}) {
|
|
4048
|
-
return /* @__PURE__ */
|
|
4049
|
-
|
|
4212
|
+
return /* @__PURE__ */ jsx50(
|
|
4213
|
+
React42.Suspense,
|
|
4050
4214
|
{
|
|
4051
|
-
fallback: /* @__PURE__ */
|
|
4052
|
-
children: /* @__PURE__ */
|
|
4215
|
+
fallback: /* @__PURE__ */ jsx50("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-busy": "true" }),
|
|
4216
|
+
children: /* @__PURE__ */ jsx50(OrganizationSwitcherContent, { ...props })
|
|
4053
4217
|
}
|
|
4054
4218
|
);
|
|
4055
4219
|
}
|
|
4056
4220
|
|
|
4057
4221
|
// src/components/OrganizationList.tsx
|
|
4058
|
-
import * as
|
|
4059
|
-
import { jsx as
|
|
4060
|
-
var OrganizationListContent =
|
|
4061
|
-
const module = await import("./OrganizationListContent-
|
|
4222
|
+
import * as React43 from "react";
|
|
4223
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
4224
|
+
var OrganizationListContent = React43.lazy(async () => {
|
|
4225
|
+
const module = await import("./OrganizationListContent-HMRK4ZSI.js");
|
|
4062
4226
|
return { default: module.OrganizationListContent };
|
|
4063
4227
|
});
|
|
4064
4228
|
function OrganizationList(props = {}) {
|
|
4065
|
-
return /* @__PURE__ */
|
|
4229
|
+
return /* @__PURE__ */ jsx51(React43.Suspense, { fallback: /* @__PURE__ */ jsx51("div", { className: "ba-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ jsx51(OrganizationListContent, { ...props }) });
|
|
4066
4230
|
}
|
|
4067
4231
|
|
|
4068
4232
|
// src/components/GoogleOneTap.tsx
|
|
4069
|
-
import * as
|
|
4233
|
+
import * as React44 from "react";
|
|
4070
4234
|
|
|
4071
4235
|
// src/components/google-one-tap.ts
|
|
4072
4236
|
var GOOGLE_IDENTITY_SCRIPT = "https://accounts.google.com/gsi/client";
|
|
@@ -4242,16 +4406,16 @@ function GoogleOneTap({
|
|
|
4242
4406
|
const { config, isLoading: configLoading, isError: configError } = usePublicConfig();
|
|
4243
4407
|
const { user, isLoaded: sessionLoaded } = useUser();
|
|
4244
4408
|
const { signInSocial } = useSignIn();
|
|
4245
|
-
const callbacks =
|
|
4409
|
+
const callbacks = React44.useRef({ onSignedIn, onSkipped, onDismissed, onError });
|
|
4246
4410
|
callbacks.current = { onSignedIn, onSkipped, onDismissed, onError };
|
|
4247
4411
|
const googleEnabled = config?.socialProviders.includes("google") === true;
|
|
4248
4412
|
const clientId = config?.socialProviderClientIds?.google;
|
|
4249
|
-
|
|
4413
|
+
React44.useEffect(() => {
|
|
4250
4414
|
if (process.env.NODE_ENV === "production") return;
|
|
4251
4415
|
if (disabled || !googleEnabled || !clientId || nonce) return;
|
|
4252
4416
|
warnOneTapWithoutNonce(clientId);
|
|
4253
4417
|
}, [clientId, disabled, googleEnabled, nonce]);
|
|
4254
|
-
|
|
4418
|
+
React44.useEffect(() => {
|
|
4255
4419
|
if (configLoading || !sessionLoaded) return;
|
|
4256
4420
|
if (disabled) {
|
|
4257
4421
|
callbacks.current.onSkipped?.("disabled");
|
|
@@ -4397,11 +4561,13 @@ export {
|
|
|
4397
4561
|
OrganizationSwitcher,
|
|
4398
4562
|
PasskeyButton,
|
|
4399
4563
|
PasskeyManager,
|
|
4564
|
+
PasskeyOfferGate,
|
|
4400
4565
|
PhoneOTP,
|
|
4401
4566
|
PrivacyCenter,
|
|
4402
4567
|
Protect,
|
|
4403
4568
|
RateLimitedError,
|
|
4404
4569
|
ResetPassword,
|
|
4570
|
+
SECOND_FACTOR_REQUIRED,
|
|
4405
4571
|
SignIn,
|
|
4406
4572
|
SignOutButton,
|
|
4407
4573
|
SignUp,
|
|
@@ -4440,6 +4606,7 @@ export {
|
|
|
4440
4606
|
useSignIn,
|
|
4441
4607
|
useSignOut,
|
|
4442
4608
|
useSignUp,
|
|
4609
|
+
useStepUpAction,
|
|
4443
4610
|
useUser,
|
|
4444
4611
|
useWaitlist
|
|
4445
4612
|
};
|