@authowl/react 0.14.0 → 0.15.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/index.cjs +942 -853
- package/dist/index.d.cts +25 -4
- package/dist/index.d.ts +25 -4
- package/dist/index.js +941 -853
- package/dist/styles.css +27 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -610,6 +610,8 @@ var en = {
|
|
|
610
610
|
"userButton.openMenuAria": "Account menu",
|
|
611
611
|
"signOut.button": "Sign out",
|
|
612
612
|
"badge.securedBy": "Secured by {brand}",
|
|
613
|
+
"branding.environment.development": "Development",
|
|
614
|
+
"branding.environment.production": "Production",
|
|
613
615
|
"qr.ariaLabel": "QR code",
|
|
614
616
|
"serverError.INVALID_EMAIL_OR_PASSWORD": "Incorrect email or password.",
|
|
615
617
|
"serverError.USER_ALREADY_EXISTS": "An account with this email already exists.",
|
|
@@ -1025,6 +1027,8 @@ var ar = {
|
|
|
1025
1027
|
"userButton.openMenuAria": "\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u062D\u0633\u0627\u0628",
|
|
1026
1028
|
"signOut.button": "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062E\u0631\u0648\u062C",
|
|
1027
1029
|
"badge.securedBy": "\u0645\u062D\u0645\u064A \u0628\u0648\u0627\u0633\u0637\u0629 {brand}",
|
|
1030
|
+
"branding.environment.development": "\u0628\u064A\u0626\u0629 \u0627\u0644\u062A\u0637\u0648\u064A\u0631",
|
|
1031
|
+
"branding.environment.production": "\u0628\u064A\u0626\u0629 \u0627\u0644\u0625\u0646\u062A\u0627\u062C",
|
|
1028
1032
|
"qr.ariaLabel": "\u0631\u0645\u0632 QR",
|
|
1029
1033
|
"serverError.INVALID_EMAIL_OR_PASSWORD": "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A \u0623\u0648 \u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631 \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629.",
|
|
1030
1034
|
"serverError.USER_ALREADY_EXISTS": "\u064A\u0648\u062C\u062F \u062D\u0633\u0627\u0628 \u0645\u0633\u062C\u0644 \u0628\u0647\u0630\u0627 \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A \u0628\u0627\u0644\u0641\u0639\u0644.",
|
|
@@ -1457,7 +1461,7 @@ function resolveSignInMethods(config) {
|
|
|
1457
1461
|
const password = capabilities.passwordSignIn;
|
|
1458
1462
|
const username = capabilities.usernameSignIn;
|
|
1459
1463
|
const magicLink = capabilities.magicLinkSignIn;
|
|
1460
|
-
const emailOtp = capabilities.emailOtpSignIn;
|
|
1464
|
+
const emailOtp = capabilities.emailOtpSignIn && !capabilities.totp && !capabilities.mfaRequired;
|
|
1461
1465
|
const phoneOtp = capabilities.phoneSignIn;
|
|
1462
1466
|
const passkey = capabilities.passkeySignIn;
|
|
1463
1467
|
const sso = has("sso");
|
|
@@ -1488,7 +1492,7 @@ function resolveSignInMethods(config) {
|
|
|
1488
1492
|
}
|
|
1489
1493
|
|
|
1490
1494
|
// src/components/SignIn.tsx
|
|
1491
|
-
import * as
|
|
1495
|
+
import * as React13 from "react";
|
|
1492
1496
|
|
|
1493
1497
|
// src/components/redirect.ts
|
|
1494
1498
|
function isSafeRedirect(redirectTo, origin) {
|
|
@@ -2142,8 +2146,11 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
2142
2146
|
}
|
|
2143
2147
|
)
|
|
2144
2148
|
] }),
|
|
2145
|
-
mode !== "backup" && allowTrustDevice && /* @__PURE__ */ jsxs8("label", { className: "ba-consent", children: [
|
|
2146
|
-
/* @__PURE__ */
|
|
2149
|
+
mode !== "backup" && allowTrustDevice && /* @__PURE__ */ jsxs8("label", { className: "ba-consent ba-consent-centered", children: [
|
|
2150
|
+
/* @__PURE__ */ jsxs8("span", { className: "ba-checkbox-control", children: [
|
|
2151
|
+
/* @__PURE__ */ jsx12("input", { className: "ba-checkbox", type: "checkbox", checked: trustDevice, onChange: (e) => setTrustDevice(e.target.checked) }),
|
|
2152
|
+
/* @__PURE__ */ jsx12("span", { className: "ba-checkbox-visual", "aria-hidden": "true", children: /* @__PURE__ */ jsx12("span", { className: "ba-checkbox-check" }) })
|
|
2153
|
+
] }),
|
|
2147
2154
|
/* @__PURE__ */ jsx12("span", { children: t("mfa.challenge.trustDevice", { days: 30 }) })
|
|
2148
2155
|
] }),
|
|
2149
2156
|
/* @__PURE__ */ jsx12(FormError, { children: error }),
|
|
@@ -2409,9 +2416,65 @@ function PhoneOTP({ redirectTo, onSignedIn, onBack }) {
|
|
|
2409
2416
|
);
|
|
2410
2417
|
}
|
|
2411
2418
|
|
|
2419
|
+
// src/components/AuthOwlBranding.tsx
|
|
2420
|
+
import * as React12 from "react";
|
|
2421
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2422
|
+
function AuthOwlBranding({ href, showEnvironment = true } = {}) {
|
|
2423
|
+
const t = useT();
|
|
2424
|
+
const { config } = usePublicConfig();
|
|
2425
|
+
const logoUrl = config?.branding?.logoUrl;
|
|
2426
|
+
const appName = config?.branding?.appName?.trim() ?? "";
|
|
2427
|
+
const showAppName = config?.branding?.showAppName !== false && appName.length > 0;
|
|
2428
|
+
const alignment = config?.branding?.alignment ?? "left";
|
|
2429
|
+
const [logoFailed, setLogoFailed] = React12.useState(false);
|
|
2430
|
+
React12.useEffect(() => setLogoFailed(false), [logoUrl]);
|
|
2431
|
+
if (!config) return null;
|
|
2432
|
+
if (!logoUrl && !showAppName && (!showEnvironment || !config.environmentType)) return null;
|
|
2433
|
+
const identity = /* @__PURE__ */ jsxs13("div", { className: "ba-branding-identity", children: [
|
|
2434
|
+
logoUrl && !logoFailed ? /* @__PURE__ */ jsx17(
|
|
2435
|
+
"img",
|
|
2436
|
+
{
|
|
2437
|
+
className: "ba-branding-logo",
|
|
2438
|
+
src: logoUrl,
|
|
2439
|
+
alt: showAppName ? `${appName} logo` : "Application logo",
|
|
2440
|
+
referrerPolicy: "no-referrer",
|
|
2441
|
+
onError: () => setLogoFailed(true)
|
|
2442
|
+
}
|
|
2443
|
+
) : showAppName ? /* @__PURE__ */ jsx17("span", { className: "ba-branding-fallback", "aria-hidden": "true", children: appName.charAt(0).toLocaleUpperCase() }) : null,
|
|
2444
|
+
showAppName ? /* @__PURE__ */ jsx17("span", { className: "ba-branding-name", children: appName }) : null
|
|
2445
|
+
] });
|
|
2446
|
+
return /* @__PURE__ */ jsxs13(
|
|
2447
|
+
"header",
|
|
2448
|
+
{
|
|
2449
|
+
className: `ba-branding ba-branding-align-${alignment}`,
|
|
2450
|
+
"data-testid": "authowl-branding",
|
|
2451
|
+
children: [
|
|
2452
|
+
href ? /* @__PURE__ */ jsx17("a", { className: "ba-branding-link", href, children: identity }) : identity,
|
|
2453
|
+
showEnvironment && config.environmentType ? /* @__PURE__ */ jsxs13(
|
|
2454
|
+
"span",
|
|
2455
|
+
{
|
|
2456
|
+
className: `ba-environment ba-environment-${config.environmentType}`,
|
|
2457
|
+
"data-testid": "authowl-environment",
|
|
2458
|
+
children: [
|
|
2459
|
+
/* @__PURE__ */ jsx17("span", { className: "ba-environment-dot", "aria-hidden": "true" }),
|
|
2460
|
+
t(`branding.environment.${config.environmentType}`)
|
|
2461
|
+
]
|
|
2462
|
+
}
|
|
2463
|
+
) : null
|
|
2464
|
+
]
|
|
2465
|
+
}
|
|
2466
|
+
);
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2412
2469
|
// src/components/SignIn.tsx
|
|
2413
|
-
import { Fragment as Fragment5, jsx as
|
|
2414
|
-
function SignIn({
|
|
2470
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2471
|
+
function SignIn({
|
|
2472
|
+
redirectTo,
|
|
2473
|
+
onSignedIn,
|
|
2474
|
+
resetPasswordUrl,
|
|
2475
|
+
showBadge,
|
|
2476
|
+
showBranding = true
|
|
2477
|
+
} = {}) {
|
|
2415
2478
|
const t = useT();
|
|
2416
2479
|
const { sessionStore } = useAuthClient();
|
|
2417
2480
|
const {
|
|
@@ -2425,47 +2488,51 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2425
2488
|
const { config, isLoading, isError } = usePublicConfig();
|
|
2426
2489
|
const { pending, error, setError, run } = useSubmitAction();
|
|
2427
2490
|
const authChallenge = useAuthChallenge();
|
|
2428
|
-
const [email, setEmail] =
|
|
2429
|
-
const [username, setUsername] =
|
|
2430
|
-
const [password, setPassword] =
|
|
2431
|
-
const [credentialMode, setCredentialMode] =
|
|
2432
|
-
const [otp, setOtp] =
|
|
2433
|
-
const [view, setView] =
|
|
2491
|
+
const [email, setEmail] = React13.useState("");
|
|
2492
|
+
const [username, setUsername] = React13.useState("");
|
|
2493
|
+
const [password, setPassword] = React13.useState("");
|
|
2494
|
+
const [credentialMode, setCredentialMode] = React13.useState("email");
|
|
2495
|
+
const [otp, setOtp] = React13.useState("");
|
|
2496
|
+
const [view, setView] = React13.useState(
|
|
2434
2497
|
"sign-in"
|
|
2435
2498
|
);
|
|
2436
|
-
const [inFlight, setInFlight] =
|
|
2437
|
-
const [challenge, setChallenge] =
|
|
2438
|
-
const emailRef =
|
|
2499
|
+
const [inFlight, setInFlight] = React13.useState(null);
|
|
2500
|
+
const [challenge, setChallenge] = React13.useState(false);
|
|
2501
|
+
const emailRef = React13.useRef(null);
|
|
2439
2502
|
const plan = resolveSignInMethods(config);
|
|
2440
2503
|
usePasskeyAutofill({
|
|
2441
2504
|
enabled: credentialMode === "email" && plan.autofillHost !== null,
|
|
2442
2505
|
redirectTo,
|
|
2443
2506
|
onSignedIn
|
|
2444
2507
|
});
|
|
2445
|
-
const badge = /* @__PURE__ */
|
|
2508
|
+
const badge = /* @__PURE__ */ jsx18(AuthOwlBadge, { force: showBadge });
|
|
2509
|
+
const branding = showBranding ? /* @__PURE__ */ jsx18(AuthOwlBranding, {}) : null;
|
|
2446
2510
|
if (isLoading) {
|
|
2447
|
-
return /* @__PURE__ */
|
|
2448
|
-
/* @__PURE__ */
|
|
2449
|
-
/* @__PURE__ */
|
|
2511
|
+
return /* @__PURE__ */ jsxs14("div", { className: "ba-form", "data-testid": "signin-loading", "aria-busy": "true", children: [
|
|
2512
|
+
/* @__PURE__ */ jsx18("div", { className: "ba-skeleton" }),
|
|
2513
|
+
/* @__PURE__ */ jsx18("div", { className: "ba-skeleton" })
|
|
2450
2514
|
] });
|
|
2451
2515
|
}
|
|
2452
2516
|
if (challenge) {
|
|
2453
|
-
return /* @__PURE__ */
|
|
2454
|
-
|
|
2517
|
+
return /* @__PURE__ */ jsxs14("div", { className: "ba-form", "data-testid": "signin-mfa", children: [
|
|
2518
|
+
branding,
|
|
2519
|
+
/* @__PURE__ */ jsx18(MFAChallenge, { onVerified: () => finishSignIn({ sessionStore, redirectTo, onSignedIn }) }),
|
|
2455
2520
|
badge
|
|
2456
2521
|
] });
|
|
2457
2522
|
}
|
|
2458
2523
|
if (view === "forgot" && resetPasswordUrl) {
|
|
2459
|
-
return /* @__PURE__ */
|
|
2460
|
-
|
|
2461
|
-
/* @__PURE__ */
|
|
2524
|
+
return /* @__PURE__ */ jsxs14("div", { className: "ba-form", "data-testid": "signin-forgot", children: [
|
|
2525
|
+
branding,
|
|
2526
|
+
/* @__PURE__ */ jsx18("h2", { className: "ba-title", children: t("signIn.forgotTitle") }),
|
|
2527
|
+
/* @__PURE__ */ jsx18(ForgotPassword, { resetPasswordUrl, onBack: () => setView("sign-in") }),
|
|
2462
2528
|
badge
|
|
2463
2529
|
] });
|
|
2464
2530
|
}
|
|
2465
2531
|
if (view === "otp-code") {
|
|
2466
|
-
return /* @__PURE__ */
|
|
2467
|
-
|
|
2468
|
-
/* @__PURE__ */
|
|
2532
|
+
return /* @__PURE__ */ jsxs14("div", { className: "ba-form", "data-testid": "signin-otp-code", children: [
|
|
2533
|
+
branding,
|
|
2534
|
+
/* @__PURE__ */ jsx18("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
2535
|
+
/* @__PURE__ */ jsx18(
|
|
2469
2536
|
OtpCodeForm,
|
|
2470
2537
|
{
|
|
2471
2538
|
email,
|
|
@@ -2491,16 +2558,18 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2491
2558
|
] });
|
|
2492
2559
|
}
|
|
2493
2560
|
if (view === "magic-sent") {
|
|
2494
|
-
return /* @__PURE__ */
|
|
2495
|
-
|
|
2496
|
-
/* @__PURE__ */
|
|
2497
|
-
/* @__PURE__ */
|
|
2561
|
+
return /* @__PURE__ */ jsxs14("div", { className: "ba-form", "data-testid": "signin-magic-sent", children: [
|
|
2562
|
+
branding,
|
|
2563
|
+
/* @__PURE__ */ jsx18("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
2564
|
+
/* @__PURE__ */ jsx18("p", { className: "ba-muted", children: t("magicLink.sent") }),
|
|
2565
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: "ba-link-button", onClick: () => setView("sign-in"), children: t("forgotPassword.backToSignIn") }),
|
|
2498
2566
|
badge
|
|
2499
2567
|
] });
|
|
2500
2568
|
}
|
|
2501
2569
|
if (view === "phone") {
|
|
2502
|
-
return /* @__PURE__ */
|
|
2503
|
-
|
|
2570
|
+
return /* @__PURE__ */ jsxs14("div", { className: "ba-form", "data-testid": "signin-phone", children: [
|
|
2571
|
+
branding,
|
|
2572
|
+
/* @__PURE__ */ jsx18(
|
|
2504
2573
|
PhoneOTP,
|
|
2505
2574
|
{
|
|
2506
2575
|
redirectTo,
|
|
@@ -2572,12 +2641,13 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2572
2641
|
{ key: "otp", enabled: plan.emailOtp, action: doRequestOtp, label: t("emailOtp.requestSubmit"), pendingLabel: t("common.sending") },
|
|
2573
2642
|
{ key: "sso", enabled: plan.sso, action: doSso, label: t("sso.continueWith"), pendingLabel: t("sso.redirecting") }
|
|
2574
2643
|
];
|
|
2575
|
-
return /* @__PURE__ */
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
/* @__PURE__ */
|
|
2579
|
-
|
|
2580
|
-
|
|
2644
|
+
return /* @__PURE__ */ jsxs14("div", { className: "ba-form", "data-testid": "signin-form", children: [
|
|
2645
|
+
branding,
|
|
2646
|
+
/* @__PURE__ */ jsx18("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
2647
|
+
process.env.NODE_ENV !== "production" && isError && /* @__PURE__ */ jsx18("p", { className: "ba-muted", "data-testid": "signin-dev-config-notice", children: "AuthOwl (dev): couldn't load this project's config, so this is a password-only fallback that may not match the project's enabled sign-in methods. Check apiUrl / publishableKey; see the console for details." }),
|
|
2648
|
+
/* @__PURE__ */ jsx18(SocialButtons, { providers: plan.social, callbackURL: redirectTo }),
|
|
2649
|
+
showDivider && /* @__PURE__ */ jsx18("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
2650
|
+
hasCredentialForm && /* @__PURE__ */ jsxs14(
|
|
2581
2651
|
"form",
|
|
2582
2652
|
{
|
|
2583
2653
|
method: "post",
|
|
@@ -2588,9 +2658,9 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2588
2658
|
else if (plan.primary) PRIMARY_ACTION[plan.primary]();
|
|
2589
2659
|
},
|
|
2590
2660
|
children: [
|
|
2591
|
-
credentialMode === "email" ? /* @__PURE__ */
|
|
2661
|
+
credentialMode === "email" ? /* @__PURE__ */ jsxs14("label", { className: "ba-label", children: [
|
|
2592
2662
|
t("common.emailLabel"),
|
|
2593
|
-
/* @__PURE__ */
|
|
2663
|
+
/* @__PURE__ */ jsx18(
|
|
2594
2664
|
"input",
|
|
2595
2665
|
{
|
|
2596
2666
|
ref: emailRef,
|
|
@@ -2605,9 +2675,9 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2605
2675
|
required: true
|
|
2606
2676
|
}
|
|
2607
2677
|
)
|
|
2608
|
-
] }) : /* @__PURE__ */
|
|
2678
|
+
] }) : /* @__PURE__ */ jsxs14("label", { className: "ba-label", children: [
|
|
2609
2679
|
t("common.usernameLabel"),
|
|
2610
|
-
/* @__PURE__ */
|
|
2680
|
+
/* @__PURE__ */ jsx18(
|
|
2611
2681
|
"input",
|
|
2612
2682
|
{
|
|
2613
2683
|
className: "ba-input",
|
|
@@ -2622,9 +2692,9 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2622
2692
|
}
|
|
2623
2693
|
)
|
|
2624
2694
|
] }),
|
|
2625
|
-
plan.password && /* @__PURE__ */
|
|
2695
|
+
plan.password && /* @__PURE__ */ jsxs14("label", { className: "ba-label", children: [
|
|
2626
2696
|
t("common.passwordLabel"),
|
|
2627
|
-
/* @__PURE__ */
|
|
2697
|
+
/* @__PURE__ */ jsx18(
|
|
2628
2698
|
"input",
|
|
2629
2699
|
{
|
|
2630
2700
|
className: "ba-input",
|
|
@@ -2640,19 +2710,19 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2640
2710
|
)
|
|
2641
2711
|
] }),
|
|
2642
2712
|
authChallenge.control,
|
|
2643
|
-
/* @__PURE__ */
|
|
2644
|
-
plan.password && /* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2713
|
+
/* @__PURE__ */ jsx18(FormError, { children: error }),
|
|
2714
|
+
plan.password && /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
2715
|
+
/* @__PURE__ */ jsx18(
|
|
2646
2716
|
"button",
|
|
2647
2717
|
{
|
|
2648
2718
|
className: "ba-button",
|
|
2649
2719
|
type: "submit",
|
|
2650
2720
|
disabled: pending || authChallenge.configPending,
|
|
2651
2721
|
"aria-busy": pending && inFlight === "password" || void 0,
|
|
2652
|
-
children: /* @__PURE__ */
|
|
2722
|
+
children: /* @__PURE__ */ jsx18(Busy, { busy: pending && inFlight === "password", label: t("signIn.submitPending"), children: t("signIn.submit") })
|
|
2653
2723
|
}
|
|
2654
2724
|
),
|
|
2655
|
-
resetPasswordUrl && /* @__PURE__ */
|
|
2725
|
+
resetPasswordUrl && /* @__PURE__ */ jsx18(
|
|
2656
2726
|
"button",
|
|
2657
2727
|
{
|
|
2658
2728
|
type: "button",
|
|
@@ -2664,7 +2734,7 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2664
2734
|
] }),
|
|
2665
2735
|
credentialMode === "email" && alternates.filter((a) => a.enabled).map(({ key, action, label: label2, pendingLabel }) => {
|
|
2666
2736
|
const isPrimary = plan.primary === key;
|
|
2667
|
-
return /* @__PURE__ */
|
|
2737
|
+
return /* @__PURE__ */ jsx18(
|
|
2668
2738
|
"button",
|
|
2669
2739
|
{
|
|
2670
2740
|
type: isPrimary ? "submit" : "button",
|
|
@@ -2672,12 +2742,12 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2672
2742
|
disabled: pending || authChallenge.configPending,
|
|
2673
2743
|
"aria-busy": pending && inFlight === key || void 0,
|
|
2674
2744
|
onClick: isPrimary ? void 0 : withEmail(action),
|
|
2675
|
-
children: /* @__PURE__ */
|
|
2745
|
+
children: /* @__PURE__ */ jsx18(Busy, { busy: pending && inFlight === key, label: pendingLabel, children: label2 })
|
|
2676
2746
|
},
|
|
2677
2747
|
key
|
|
2678
2748
|
);
|
|
2679
2749
|
}),
|
|
2680
|
-
plan.username && /* @__PURE__ */
|
|
2750
|
+
plan.username && /* @__PURE__ */ jsx18(
|
|
2681
2751
|
"button",
|
|
2682
2752
|
{
|
|
2683
2753
|
type: "button",
|
|
@@ -2693,8 +2763,8 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2693
2763
|
]
|
|
2694
2764
|
}
|
|
2695
2765
|
),
|
|
2696
|
-
plan.passkey && /* @__PURE__ */
|
|
2697
|
-
plan.phoneOtp && /* @__PURE__ */
|
|
2766
|
+
plan.passkey && /* @__PURE__ */ jsx18(PasskeyButton, { redirectTo, onSignedIn }),
|
|
2767
|
+
plan.phoneOtp && /* @__PURE__ */ jsx18(
|
|
2698
2768
|
"button",
|
|
2699
2769
|
{
|
|
2700
2770
|
type: "button",
|
|
@@ -2703,17 +2773,17 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2703
2773
|
children: t("phoneOtp.usePhone")
|
|
2704
2774
|
}
|
|
2705
2775
|
),
|
|
2706
|
-
!plan.renderable && /* @__PURE__ */
|
|
2776
|
+
!plan.renderable && /* @__PURE__ */ jsx18("p", { className: "ba-muted", children: plan.emptyReason === "unsupported" ? t("signIn.empty.unsupported") : t("signIn.empty.none") }),
|
|
2707
2777
|
badge
|
|
2708
2778
|
] });
|
|
2709
2779
|
}
|
|
2710
2780
|
|
|
2711
2781
|
// src/components/SignUp.tsx
|
|
2712
|
-
import * as
|
|
2782
|
+
import * as React17 from "react";
|
|
2713
2783
|
|
|
2714
2784
|
// src/components/VerificationPending.tsx
|
|
2715
|
-
import * as
|
|
2716
|
-
import { jsx as
|
|
2785
|
+
import * as React14 from "react";
|
|
2786
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2717
2787
|
function VerificationPending({
|
|
2718
2788
|
email,
|
|
2719
2789
|
callbackURL,
|
|
@@ -2727,14 +2797,14 @@ function VerificationPending({
|
|
|
2727
2797
|
} = useEmailVerification();
|
|
2728
2798
|
const { pending, error, run } = useSubmitAction();
|
|
2729
2799
|
const authChallenge = useAuthChallenge();
|
|
2730
|
-
const [resent, setResent] =
|
|
2731
|
-
const [code, setCode] =
|
|
2732
|
-
const [verified, setVerified] =
|
|
2800
|
+
const [resent, setResent] = React14.useState(false);
|
|
2801
|
+
const [code, setCode] = React14.useState("");
|
|
2802
|
+
const [verified, setVerified] = React14.useState(false);
|
|
2733
2803
|
if (verified) {
|
|
2734
|
-
return /* @__PURE__ */
|
|
2804
|
+
return /* @__PURE__ */ jsx19("p", { className: "ba-success", role: "status", "data-testid": "verify-code-success", children: t("verifyEmail.success") });
|
|
2735
2805
|
}
|
|
2736
2806
|
if (method === "code") {
|
|
2737
|
-
return /* @__PURE__ */
|
|
2807
|
+
return /* @__PURE__ */ jsxs15(
|
|
2738
2808
|
"form",
|
|
2739
2809
|
{
|
|
2740
2810
|
method: "post",
|
|
@@ -2751,12 +2821,12 @@ function VerificationPending({
|
|
|
2751
2821
|
);
|
|
2752
2822
|
},
|
|
2753
2823
|
children: [
|
|
2754
|
-
/* @__PURE__ */
|
|
2755
|
-
email: /* @__PURE__ */
|
|
2824
|
+
/* @__PURE__ */ jsx19("p", { className: "ba-muted", children: richMessage(t("verifyPending.codeBody"), {
|
|
2825
|
+
email: /* @__PURE__ */ jsx19("strong", { children: /* @__PURE__ */ jsx19(Bidi, { children: email }) })
|
|
2756
2826
|
}) }),
|
|
2757
|
-
/* @__PURE__ */
|
|
2827
|
+
/* @__PURE__ */ jsxs15("label", { className: "ba-label", children: [
|
|
2758
2828
|
t("verifyPending.codeLabel"),
|
|
2759
|
-
/* @__PURE__ */
|
|
2829
|
+
/* @__PURE__ */ jsx19(
|
|
2760
2830
|
"input",
|
|
2761
2831
|
{
|
|
2762
2832
|
className: "ba-input",
|
|
@@ -2768,20 +2838,20 @@ function VerificationPending({
|
|
|
2768
2838
|
}
|
|
2769
2839
|
)
|
|
2770
2840
|
] }),
|
|
2771
|
-
resent && /* @__PURE__ */
|
|
2841
|
+
resent && /* @__PURE__ */ jsx19("p", { className: "ba-muted", children: t("verifyPending.resent") }),
|
|
2772
2842
|
authChallenge.control,
|
|
2773
|
-
/* @__PURE__ */
|
|
2774
|
-
/* @__PURE__ */
|
|
2843
|
+
/* @__PURE__ */ jsx19(FormError, { children: error }),
|
|
2844
|
+
/* @__PURE__ */ jsx19(
|
|
2775
2845
|
"button",
|
|
2776
2846
|
{
|
|
2777
2847
|
className: "ba-button",
|
|
2778
2848
|
type: "submit",
|
|
2779
2849
|
disabled: pending || !code,
|
|
2780
2850
|
"aria-busy": pending || void 0,
|
|
2781
|
-
children: /* @__PURE__ */
|
|
2851
|
+
children: /* @__PURE__ */ jsx19(Busy, { busy: pending, label: t("common.verifying"), children: t("emailOtp.verifySubmit") })
|
|
2782
2852
|
}
|
|
2783
2853
|
),
|
|
2784
|
-
/* @__PURE__ */
|
|
2854
|
+
/* @__PURE__ */ jsx19(
|
|
2785
2855
|
"button",
|
|
2786
2856
|
{
|
|
2787
2857
|
type: "button",
|
|
@@ -2807,14 +2877,14 @@ function VerificationPending({
|
|
|
2807
2877
|
}
|
|
2808
2878
|
);
|
|
2809
2879
|
}
|
|
2810
|
-
return /* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2812
|
-
email: /* @__PURE__ */
|
|
2880
|
+
return /* @__PURE__ */ jsxs15("div", { className: "ba-fields", "data-testid": "verify-pending", children: [
|
|
2881
|
+
/* @__PURE__ */ jsx19("p", { className: "ba-muted", children: richMessage(t("verifyPending.body"), {
|
|
2882
|
+
email: /* @__PURE__ */ jsx19("strong", { children: /* @__PURE__ */ jsx19(Bidi, { children: email }) })
|
|
2813
2883
|
}) }),
|
|
2814
|
-
resent && /* @__PURE__ */
|
|
2884
|
+
resent && /* @__PURE__ */ jsx19("p", { className: "ba-muted", children: t("verifyPending.resent") }),
|
|
2815
2885
|
authChallenge.control,
|
|
2816
|
-
/* @__PURE__ */
|
|
2817
|
-
/* @__PURE__ */
|
|
2886
|
+
/* @__PURE__ */ jsx19(FormError, { children: error }),
|
|
2887
|
+
/* @__PURE__ */ jsx19(
|
|
2818
2888
|
"button",
|
|
2819
2889
|
{
|
|
2820
2890
|
type: "button",
|
|
@@ -2825,25 +2895,25 @@ function VerificationPending({
|
|
|
2825
2895
|
failure: t("verifyPending.error.resendFailed"),
|
|
2826
2896
|
onSuccess: () => setResent(true)
|
|
2827
2897
|
}),
|
|
2828
|
-
children: /* @__PURE__ */
|
|
2898
|
+
children: /* @__PURE__ */ jsx19(Busy, { busy: pending, label: t("common.sending"), children: t("verifyPending.resendButton") })
|
|
2829
2899
|
}
|
|
2830
2900
|
)
|
|
2831
2901
|
] });
|
|
2832
2902
|
}
|
|
2833
2903
|
|
|
2834
2904
|
// src/components/PasswordlessSignUp.tsx
|
|
2835
|
-
import * as
|
|
2836
|
-
import { jsx as
|
|
2905
|
+
import * as React15 from "react";
|
|
2906
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2837
2907
|
function PasswordlessSignUp({ onAuthenticated }) {
|
|
2838
2908
|
const t = useT();
|
|
2839
2909
|
const { sendEmailOtp, signInEmailOtp } = useSignIn();
|
|
2840
2910
|
const { pending, error, setError, run } = useSubmitAction();
|
|
2841
2911
|
const authChallenge = useAuthChallenge();
|
|
2842
|
-
const [email, setEmail] =
|
|
2843
|
-
const [code, setCode] =
|
|
2844
|
-
const [codeSent, setCodeSent] =
|
|
2912
|
+
const [email, setEmail] = React15.useState("");
|
|
2913
|
+
const [code, setCode] = React15.useState("");
|
|
2914
|
+
const [codeSent, setCodeSent] = React15.useState(false);
|
|
2845
2915
|
if (codeSent) {
|
|
2846
|
-
return /* @__PURE__ */
|
|
2916
|
+
return /* @__PURE__ */ jsx20("div", { className: "ba-fields", "data-testid": "signup-emailotp-code", children: /* @__PURE__ */ jsx20(
|
|
2847
2917
|
OtpCodeForm,
|
|
2848
2918
|
{
|
|
2849
2919
|
email,
|
|
@@ -2863,7 +2933,7 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
2863
2933
|
}
|
|
2864
2934
|
) });
|
|
2865
2935
|
}
|
|
2866
|
-
return /* @__PURE__ */
|
|
2936
|
+
return /* @__PURE__ */ jsxs16(
|
|
2867
2937
|
"form",
|
|
2868
2938
|
{
|
|
2869
2939
|
method: "post",
|
|
@@ -2877,9 +2947,9 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
2877
2947
|
});
|
|
2878
2948
|
},
|
|
2879
2949
|
children: [
|
|
2880
|
-
/* @__PURE__ */
|
|
2950
|
+
/* @__PURE__ */ jsxs16("label", { className: "ba-label", children: [
|
|
2881
2951
|
t("common.emailLabel"),
|
|
2882
|
-
/* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ jsx20(
|
|
2883
2953
|
"input",
|
|
2884
2954
|
{
|
|
2885
2955
|
className: "ba-input",
|
|
@@ -2892,15 +2962,15 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
2892
2962
|
)
|
|
2893
2963
|
] }),
|
|
2894
2964
|
authChallenge.control,
|
|
2895
|
-
/* @__PURE__ */
|
|
2896
|
-
/* @__PURE__ */
|
|
2965
|
+
/* @__PURE__ */ jsx20(FormError, { children: error }),
|
|
2966
|
+
/* @__PURE__ */ jsx20(
|
|
2897
2967
|
"button",
|
|
2898
2968
|
{
|
|
2899
2969
|
className: "ba-button ba-button-secondary",
|
|
2900
2970
|
type: "submit",
|
|
2901
2971
|
disabled: pending || authChallenge.configPending,
|
|
2902
2972
|
"aria-busy": pending || void 0,
|
|
2903
|
-
children: /* @__PURE__ */
|
|
2973
|
+
children: /* @__PURE__ */ jsx20(Busy, { busy: pending, label: t("common.sending"), children: t("signUp.passwordlessSubmit") })
|
|
2904
2974
|
}
|
|
2905
2975
|
)
|
|
2906
2976
|
]
|
|
@@ -2909,16 +2979,16 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
2909
2979
|
}
|
|
2910
2980
|
|
|
2911
2981
|
// src/components/PasskeySignUpCompletion.tsx
|
|
2912
|
-
import { jsx as
|
|
2982
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2913
2983
|
function PasskeySignUpCompletion({ onComplete }) {
|
|
2914
2984
|
const t = useT();
|
|
2915
2985
|
const { addPasskey } = usePasskeys();
|
|
2916
2986
|
const { pending, error, run } = useSubmitAction();
|
|
2917
|
-
return /* @__PURE__ */
|
|
2918
|
-
/* @__PURE__ */
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
2921
|
-
/* @__PURE__ */
|
|
2987
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-fields", "data-testid": "signup-passkey-completion", children: [
|
|
2988
|
+
/* @__PURE__ */ jsx21("h3", { className: "ba-title", children: t("signUp.passkeyTitle") }),
|
|
2989
|
+
/* @__PURE__ */ jsx21("p", { className: "ba-muted", children: t("signUp.passkeyDescription") }),
|
|
2990
|
+
/* @__PURE__ */ jsx21(FormError, { children: error }),
|
|
2991
|
+
/* @__PURE__ */ jsx21(
|
|
2922
2992
|
"button",
|
|
2923
2993
|
{
|
|
2924
2994
|
className: "ba-button",
|
|
@@ -2929,34 +2999,36 @@ function PasskeySignUpCompletion({ onComplete }) {
|
|
|
2929
2999
|
failure: t("signUp.error.passkeyFailed"),
|
|
2930
3000
|
onSuccess: onComplete
|
|
2931
3001
|
}),
|
|
2932
|
-
children: /* @__PURE__ */
|
|
3002
|
+
children: /* @__PURE__ */ jsx21(Busy, { busy: pending, label: t("passkey.waiting"), children: t("signUp.passkeySubmit") })
|
|
2933
3003
|
}
|
|
2934
3004
|
),
|
|
2935
|
-
/* @__PURE__ */
|
|
3005
|
+
/* @__PURE__ */ jsx21("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: onComplete, children: t("signUp.passkeySkip") })
|
|
2936
3006
|
] });
|
|
2937
3007
|
}
|
|
2938
3008
|
|
|
2939
3009
|
// src/components/Waitlist.tsx
|
|
2940
|
-
import * as
|
|
2941
|
-
import { jsx as
|
|
2942
|
-
function Waitlist({ onJoined, showBadge } = {}) {
|
|
3010
|
+
import * as React16 from "react";
|
|
3011
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3012
|
+
function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
2943
3013
|
const t = useT();
|
|
2944
3014
|
const { join } = useWaitlist();
|
|
2945
3015
|
const { pending, error, run } = useSubmitAction();
|
|
2946
3016
|
const authChallenge = useAuthChallenge();
|
|
2947
|
-
const [email, setEmail] =
|
|
2948
|
-
const [joined, setJoined] =
|
|
3017
|
+
const [email, setEmail] = React16.useState("");
|
|
3018
|
+
const [joined, setJoined] = React16.useState(false);
|
|
2949
3019
|
if (joined) {
|
|
2950
|
-
return /* @__PURE__ */
|
|
2951
|
-
/* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
/* @__PURE__ */
|
|
3020
|
+
return /* @__PURE__ */ jsxs18("div", { className: "ba-form", "data-testid": "waitlist-accepted", children: [
|
|
3021
|
+
showBranding ? /* @__PURE__ */ jsx22(AuthOwlBranding, {}) : null,
|
|
3022
|
+
/* @__PURE__ */ jsx22("h2", { className: "ba-title", children: t("waitlist.acceptedTitle") }),
|
|
3023
|
+
/* @__PURE__ */ jsx22("p", { className: "ba-muted", children: t("waitlist.acceptedDescription") }),
|
|
3024
|
+
/* @__PURE__ */ jsx22(AuthOwlBadge, { force: showBadge })
|
|
2954
3025
|
] });
|
|
2955
3026
|
}
|
|
2956
|
-
return /* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
3027
|
+
return /* @__PURE__ */ jsxs18("div", { className: "ba-form", "data-testid": "waitlist-form", children: [
|
|
3028
|
+
showBranding ? /* @__PURE__ */ jsx22(AuthOwlBranding, {}) : null,
|
|
3029
|
+
/* @__PURE__ */ jsx22("h2", { className: "ba-title", children: t("waitlist.title") }),
|
|
3030
|
+
/* @__PURE__ */ jsx22("p", { className: "ba-muted", children: t("waitlist.description") }),
|
|
3031
|
+
/* @__PURE__ */ jsxs18(
|
|
2960
3032
|
"form",
|
|
2961
3033
|
{
|
|
2962
3034
|
method: "post",
|
|
@@ -2978,9 +3050,9 @@ function Waitlist({ onJoined, showBadge } = {}) {
|
|
|
2978
3050
|
);
|
|
2979
3051
|
},
|
|
2980
3052
|
children: [
|
|
2981
|
-
/* @__PURE__ */
|
|
3053
|
+
/* @__PURE__ */ jsxs18("label", { className: "ba-label", children: [
|
|
2982
3054
|
t("common.emailLabel"),
|
|
2983
|
-
/* @__PURE__ */
|
|
3055
|
+
/* @__PURE__ */ jsx22(
|
|
2984
3056
|
"input",
|
|
2985
3057
|
{
|
|
2986
3058
|
className: "ba-input",
|
|
@@ -2994,47 +3066,48 @@ function Waitlist({ onJoined, showBadge } = {}) {
|
|
|
2994
3066
|
)
|
|
2995
3067
|
] }),
|
|
2996
3068
|
authChallenge.control,
|
|
2997
|
-
/* @__PURE__ */
|
|
2998
|
-
/* @__PURE__ */
|
|
3069
|
+
/* @__PURE__ */ jsx22(FormError, { children: error }),
|
|
3070
|
+
/* @__PURE__ */ jsx22(
|
|
2999
3071
|
"button",
|
|
3000
3072
|
{
|
|
3001
3073
|
className: "ba-button",
|
|
3002
3074
|
type: "submit",
|
|
3003
3075
|
disabled: pending || authChallenge.configPending,
|
|
3004
3076
|
"aria-busy": pending || void 0,
|
|
3005
|
-
children: /* @__PURE__ */
|
|
3077
|
+
children: /* @__PURE__ */ jsx22(Busy, { busy: pending, label: t("waitlist.submitPending"), children: t("waitlist.submit") })
|
|
3006
3078
|
}
|
|
3007
3079
|
)
|
|
3008
3080
|
]
|
|
3009
3081
|
}
|
|
3010
3082
|
),
|
|
3011
|
-
/* @__PURE__ */
|
|
3083
|
+
/* @__PURE__ */ jsx22(AuthOwlBadge, { force: showBadge })
|
|
3012
3084
|
] });
|
|
3013
3085
|
}
|
|
3014
3086
|
|
|
3015
3087
|
// src/components/SignUp.tsx
|
|
3016
|
-
import { Fragment as Fragment6, jsx as
|
|
3088
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3017
3089
|
function SignUp({
|
|
3018
3090
|
redirectTo,
|
|
3019
3091
|
onSignedUp,
|
|
3020
3092
|
verifyEmailUrl,
|
|
3021
3093
|
showBadge,
|
|
3022
|
-
onWaitlisted
|
|
3094
|
+
onWaitlisted,
|
|
3095
|
+
showBranding = true
|
|
3023
3096
|
} = {}) {
|
|
3024
3097
|
const t = useT();
|
|
3025
3098
|
const toServerError = useServerError();
|
|
3026
3099
|
const { signUp } = useSignUp();
|
|
3027
3100
|
const { config, isLoading } = usePublicConfig();
|
|
3028
3101
|
const authChallenge = useAuthChallenge();
|
|
3029
|
-
const [email, setEmail] =
|
|
3030
|
-
const [password, setPassword] =
|
|
3031
|
-
const [name, setName] =
|
|
3032
|
-
const [firstName, setFirstName] =
|
|
3033
|
-
const [lastName, setLastName] =
|
|
3034
|
-
const [username, setUsername] =
|
|
3035
|
-
const [error, setError] =
|
|
3036
|
-
const [submitting, setSubmitting] =
|
|
3037
|
-
const [accepted, setAccepted] =
|
|
3102
|
+
const [email, setEmail] = React17.useState("");
|
|
3103
|
+
const [password, setPassword] = React17.useState("");
|
|
3104
|
+
const [name, setName] = React17.useState("");
|
|
3105
|
+
const [firstName, setFirstName] = React17.useState("");
|
|
3106
|
+
const [lastName, setLastName] = React17.useState("");
|
|
3107
|
+
const [username, setUsername] = React17.useState("");
|
|
3108
|
+
const [error, setError] = React17.useState(null);
|
|
3109
|
+
const [submitting, setSubmitting] = React17.useState(false);
|
|
3110
|
+
const [accepted, setAccepted] = React17.useState(false);
|
|
3038
3111
|
const legal = config?.legal;
|
|
3039
3112
|
const consentRequired = Boolean(legal?.required);
|
|
3040
3113
|
const consentBlocked = consentRequired && !accepted;
|
|
@@ -3042,8 +3115,8 @@ function SignUp({
|
|
|
3042
3115
|
const passwordMinLength = capabilities.passwordMinLength;
|
|
3043
3116
|
const passwordMaxLength = capabilities.passwordMaxLength;
|
|
3044
3117
|
const passkeysEnabled = capabilities.passkeyAdd;
|
|
3045
|
-
const [pendingEmail, setPendingEmail] =
|
|
3046
|
-
const [completeWithPasskey, setCompleteWithPasskey] =
|
|
3118
|
+
const [pendingEmail, setPendingEmail] = React17.useState(null);
|
|
3119
|
+
const [completeWithPasskey, setCompleteWithPasskey] = React17.useState(false);
|
|
3047
3120
|
function finishSignUp() {
|
|
3048
3121
|
onSignedUp?.();
|
|
3049
3122
|
if (redirectTo) window.location.assign(redirectTo);
|
|
@@ -3096,17 +3169,18 @@ function SignUp({
|
|
|
3096
3169
|
}
|
|
3097
3170
|
}
|
|
3098
3171
|
if (isLoading) {
|
|
3099
|
-
return /* @__PURE__ */
|
|
3100
|
-
/* @__PURE__ */
|
|
3101
|
-
/* @__PURE__ */
|
|
3172
|
+
return /* @__PURE__ */ jsxs19("div", { className: "ba-form", "data-testid": "signup-loading", "aria-busy": "true", children: [
|
|
3173
|
+
/* @__PURE__ */ jsx23("div", { className: "ba-skeleton" }),
|
|
3174
|
+
/* @__PURE__ */ jsx23("div", { className: "ba-skeleton" })
|
|
3102
3175
|
] });
|
|
3103
3176
|
}
|
|
3104
3177
|
if (config?.signUp?.mode === "waitlist") {
|
|
3105
|
-
return /* @__PURE__ */
|
|
3178
|
+
return /* @__PURE__ */ jsx23(Waitlist, { onJoined: onWaitlisted, showBadge, showBranding });
|
|
3106
3179
|
}
|
|
3107
3180
|
if (pendingEmail) {
|
|
3108
|
-
return /* @__PURE__ */
|
|
3109
|
-
/* @__PURE__ */
|
|
3181
|
+
return /* @__PURE__ */ jsxs19("div", { className: "ba-form", "data-testid": "signup-verify-pending", children: [
|
|
3182
|
+
showBranding ? /* @__PURE__ */ jsx23(AuthOwlBranding, {}) : null,
|
|
3183
|
+
/* @__PURE__ */ jsx23(
|
|
3110
3184
|
VerificationPending,
|
|
3111
3185
|
{
|
|
3112
3186
|
email: pendingEmail,
|
|
@@ -3114,7 +3188,7 @@ function SignUp({
|
|
|
3114
3188
|
method: capabilities.emailVerificationMethod
|
|
3115
3189
|
}
|
|
3116
3190
|
),
|
|
3117
|
-
/* @__PURE__ */
|
|
3191
|
+
/* @__PURE__ */ jsx23(AuthOwlBadge, { force: showBadge })
|
|
3118
3192
|
] });
|
|
3119
3193
|
}
|
|
3120
3194
|
const methods = config?.enabledMethods ?? ["password"];
|
|
@@ -3124,14 +3198,16 @@ function SignUp({
|
|
|
3124
3198
|
const showPasswordless = publicSignupAllowed && capabilities.emailOtpSignIn && capabilities.emailSignUp && !consentRequired && !capabilities.mfaRequired;
|
|
3125
3199
|
const renderable = showPassword || showPasswordless || social.length > 0;
|
|
3126
3200
|
if (completeWithPasskey) {
|
|
3127
|
-
return /* @__PURE__ */
|
|
3128
|
-
/* @__PURE__ */
|
|
3129
|
-
/* @__PURE__ */
|
|
3201
|
+
return /* @__PURE__ */ jsxs19("div", { className: "ba-form", "data-testid": "signup-passkey-step", children: [
|
|
3202
|
+
showBranding ? /* @__PURE__ */ jsx23(AuthOwlBranding, {}) : null,
|
|
3203
|
+
/* @__PURE__ */ jsx23(PasskeySignUpCompletion, { onComplete: finishSignUp }),
|
|
3204
|
+
/* @__PURE__ */ jsx23(AuthOwlBadge, { force: showBadge })
|
|
3130
3205
|
] });
|
|
3131
3206
|
}
|
|
3132
|
-
return /* @__PURE__ */
|
|
3133
|
-
/* @__PURE__ */
|
|
3134
|
-
|
|
3207
|
+
return /* @__PURE__ */ jsxs19("div", { className: "ba-form", "data-testid": "signup-form", children: [
|
|
3208
|
+
showBranding ? /* @__PURE__ */ jsx23(AuthOwlBranding, {}) : null,
|
|
3209
|
+
/* @__PURE__ */ jsx23("h2", { className: "ba-title", children: t("signUp.title") }),
|
|
3210
|
+
legal && /* @__PURE__ */ jsx23(
|
|
3135
3211
|
LegalConsentCheckbox,
|
|
3136
3212
|
{
|
|
3137
3213
|
legal,
|
|
@@ -3140,12 +3216,12 @@ function SignUp({
|
|
|
3140
3216
|
testId: "signup-consent"
|
|
3141
3217
|
}
|
|
3142
3218
|
),
|
|
3143
|
-
/* @__PURE__ */
|
|
3144
|
-
showPassword && social.length > 0 && /* @__PURE__ */
|
|
3145
|
-
showPassword && /* @__PURE__ */
|
|
3146
|
-
capabilities.legacyNameField && /* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ jsx23(SocialButtons, { providers: social, callbackURL: redirectTo }),
|
|
3220
|
+
showPassword && social.length > 0 && /* @__PURE__ */ jsx23("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
3221
|
+
showPassword && /* @__PURE__ */ jsxs19("form", { method: "post", onSubmit, className: "ba-fields", children: [
|
|
3222
|
+
capabilities.legacyNameField && /* @__PURE__ */ jsxs19("label", { className: "ba-label", children: [
|
|
3147
3223
|
t("signUp.nameLabel"),
|
|
3148
|
-
/* @__PURE__ */
|
|
3224
|
+
/* @__PURE__ */ jsx23(
|
|
3149
3225
|
"input",
|
|
3150
3226
|
{
|
|
3151
3227
|
className: "ba-input",
|
|
@@ -3159,10 +3235,10 @@ function SignUp({
|
|
|
3159
3235
|
}
|
|
3160
3236
|
)
|
|
3161
3237
|
] }),
|
|
3162
|
-
capabilities.firstLastName && /* @__PURE__ */
|
|
3163
|
-
/* @__PURE__ */
|
|
3238
|
+
capabilities.firstLastName && /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
3239
|
+
/* @__PURE__ */ jsxs19("label", { className: "ba-label", children: [
|
|
3164
3240
|
t("signUp.firstNameLabel"),
|
|
3165
|
-
/* @__PURE__ */
|
|
3241
|
+
/* @__PURE__ */ jsx23(
|
|
3166
3242
|
"input",
|
|
3167
3243
|
{
|
|
3168
3244
|
className: "ba-input",
|
|
@@ -3175,9 +3251,9 @@ function SignUp({
|
|
|
3175
3251
|
}
|
|
3176
3252
|
)
|
|
3177
3253
|
] }),
|
|
3178
|
-
/* @__PURE__ */
|
|
3254
|
+
/* @__PURE__ */ jsxs19("label", { className: "ba-label", children: [
|
|
3179
3255
|
t("signUp.lastNameLabel"),
|
|
3180
|
-
/* @__PURE__ */
|
|
3256
|
+
/* @__PURE__ */ jsx23(
|
|
3181
3257
|
"input",
|
|
3182
3258
|
{
|
|
3183
3259
|
className: "ba-input",
|
|
@@ -3191,9 +3267,9 @@ function SignUp({
|
|
|
3191
3267
|
)
|
|
3192
3268
|
] })
|
|
3193
3269
|
] }),
|
|
3194
|
-
capabilities.collectUsername && /* @__PURE__ */
|
|
3270
|
+
capabilities.collectUsername && /* @__PURE__ */ jsxs19("label", { className: "ba-label", children: [
|
|
3195
3271
|
t("common.usernameLabel"),
|
|
3196
|
-
/* @__PURE__ */
|
|
3272
|
+
/* @__PURE__ */ jsx23(
|
|
3197
3273
|
"input",
|
|
3198
3274
|
{
|
|
3199
3275
|
className: "ba-input",
|
|
@@ -3207,9 +3283,9 @@ function SignUp({
|
|
|
3207
3283
|
}
|
|
3208
3284
|
)
|
|
3209
3285
|
] }),
|
|
3210
|
-
/* @__PURE__ */
|
|
3286
|
+
/* @__PURE__ */ jsxs19("label", { className: "ba-label", children: [
|
|
3211
3287
|
t("common.emailLabel"),
|
|
3212
|
-
/* @__PURE__ */
|
|
3288
|
+
/* @__PURE__ */ jsx23(
|
|
3213
3289
|
"input",
|
|
3214
3290
|
{
|
|
3215
3291
|
className: "ba-input",
|
|
@@ -3224,9 +3300,9 @@ function SignUp({
|
|
|
3224
3300
|
}
|
|
3225
3301
|
)
|
|
3226
3302
|
] }),
|
|
3227
|
-
/* @__PURE__ */
|
|
3303
|
+
/* @__PURE__ */ jsxs19("label", { className: "ba-label", children: [
|
|
3228
3304
|
t("common.passwordLabel"),
|
|
3229
|
-
/* @__PURE__ */
|
|
3305
|
+
/* @__PURE__ */ jsx23(
|
|
3230
3306
|
"input",
|
|
3231
3307
|
{
|
|
3232
3308
|
className: "ba-input",
|
|
@@ -3244,20 +3320,20 @@ function SignUp({
|
|
|
3244
3320
|
)
|
|
3245
3321
|
] }),
|
|
3246
3322
|
authChallenge.control,
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
/* @__PURE__ */
|
|
3323
|
+
/* @__PURE__ */ jsx23(FormError, { children: error }),
|
|
3324
|
+
/* @__PURE__ */ jsx23(
|
|
3249
3325
|
"button",
|
|
3250
3326
|
{
|
|
3251
3327
|
className: "ba-button",
|
|
3252
3328
|
type: "submit",
|
|
3253
3329
|
disabled: submitting || consentBlocked || authChallenge.configPending,
|
|
3254
3330
|
"aria-busy": submitting || void 0,
|
|
3255
|
-
children: /* @__PURE__ */
|
|
3331
|
+
children: /* @__PURE__ */ jsx23(Busy, { busy: submitting, label: t("signUp.submitPending"), children: t("signUp.submit") })
|
|
3256
3332
|
}
|
|
3257
3333
|
)
|
|
3258
3334
|
] }),
|
|
3259
|
-
showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */
|
|
3260
|
-
showPasswordless && /* @__PURE__ */
|
|
3335
|
+
showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */ jsx23("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
3336
|
+
showPasswordless && /* @__PURE__ */ jsx23(
|
|
3261
3337
|
PasswordlessSignUp,
|
|
3262
3338
|
{
|
|
3263
3339
|
onAuthenticated: () => {
|
|
@@ -3266,25 +3342,25 @@ function SignUp({
|
|
|
3266
3342
|
}
|
|
3267
3343
|
}
|
|
3268
3344
|
),
|
|
3269
|
-
!renderable && /* @__PURE__ */
|
|
3270
|
-
/* @__PURE__ */
|
|
3345
|
+
!renderable && /* @__PURE__ */ jsx23("p", { className: "ba-muted", children: publicSignupAllowed && methods.length > 0 ? t("signUp.empty.unsupported") : t("signUp.empty.none") }),
|
|
3346
|
+
/* @__PURE__ */ jsx23(AuthOwlBadge, { force: showBadge })
|
|
3271
3347
|
] });
|
|
3272
3348
|
}
|
|
3273
3349
|
|
|
3274
3350
|
// src/components/ConsentGate.tsx
|
|
3275
|
-
import { Fragment as Fragment7, jsx as
|
|
3351
|
+
import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3276
3352
|
function ConsentGate({ children, title }) {
|
|
3277
3353
|
const t = useT();
|
|
3278
3354
|
const { needsConsent, status, accept } = useConsent();
|
|
3279
3355
|
const { pending, error, run } = useSubmitAction();
|
|
3280
|
-
if (!needsConsent) return /* @__PURE__ */
|
|
3281
|
-
return /* @__PURE__ */
|
|
3282
|
-
/* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
3284
|
-
links: /* @__PURE__ */
|
|
3356
|
+
if (!needsConsent) return /* @__PURE__ */ jsx24(Fragment7, { children });
|
|
3357
|
+
return /* @__PURE__ */ jsxs20("div", { className: "ba-form", "data-testid": "consent-gate", children: [
|
|
3358
|
+
/* @__PURE__ */ jsx24("h2", { className: "ba-title", children: title ?? t("consent.gateTitle") }),
|
|
3359
|
+
/* @__PURE__ */ jsx24("p", { className: "ba-muted", children: richMessage(t("consent.gateBody"), {
|
|
3360
|
+
links: /* @__PURE__ */ jsx24(ConsentDocLinks, { termsUrl: status?.termsUrl, privacyUrl: status?.privacyUrl })
|
|
3285
3361
|
}) }),
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3362
|
+
/* @__PURE__ */ jsx24(FormError, { children: error }),
|
|
3363
|
+
/* @__PURE__ */ jsx24(
|
|
3288
3364
|
"button",
|
|
3289
3365
|
{
|
|
3290
3366
|
className: "ba-button",
|
|
@@ -3298,18 +3374,18 @@ function ConsentGate({ children, title }) {
|
|
|
3298
3374
|
},
|
|
3299
3375
|
{ failure: t("consent.error.acceptFailed") }
|
|
3300
3376
|
),
|
|
3301
|
-
children: /* @__PURE__ */
|
|
3377
|
+
children: /* @__PURE__ */ jsx24(Busy, { busy: pending, label: t("consent.acceptPending"), children: t("consent.acceptSubmit") })
|
|
3302
3378
|
}
|
|
3303
3379
|
),
|
|
3304
|
-
/* @__PURE__ */
|
|
3380
|
+
/* @__PURE__ */ jsx24(AuthOwlBadge, {})
|
|
3305
3381
|
] });
|
|
3306
3382
|
}
|
|
3307
3383
|
|
|
3308
3384
|
// src/components/MFARequiredGate.tsx
|
|
3309
|
-
import * as
|
|
3385
|
+
import * as React20 from "react";
|
|
3310
3386
|
|
|
3311
3387
|
// src/components/MFAEnrollment.tsx
|
|
3312
|
-
import * as
|
|
3388
|
+
import * as React19 from "react";
|
|
3313
3389
|
|
|
3314
3390
|
// src/components/mfa-enrollment.ts
|
|
3315
3391
|
function shouldDiscardSetup(args) {
|
|
@@ -3318,7 +3394,7 @@ function shouldDiscardSetup(args) {
|
|
|
3318
3394
|
}
|
|
3319
3395
|
|
|
3320
3396
|
// src/components/QrCode.tsx
|
|
3321
|
-
import * as
|
|
3397
|
+
import * as React18 from "react";
|
|
3322
3398
|
|
|
3323
3399
|
// ../../node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
3324
3400
|
var qrcode = function(typeNumber, errorCorrectionLevel) {
|
|
@@ -4975,14 +5051,14 @@ function qrPath(value) {
|
|
|
4975
5051
|
}
|
|
4976
5052
|
|
|
4977
5053
|
// src/components/QrCode.tsx
|
|
4978
|
-
import { jsx as
|
|
5054
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4979
5055
|
function QrCode({ value, size = 200 }) {
|
|
4980
5056
|
const t = useT();
|
|
4981
|
-
const path =
|
|
5057
|
+
const path = React18.useMemo(() => qrPath(value), [value]);
|
|
4982
5058
|
if (!path) return null;
|
|
4983
5059
|
const margin = 4;
|
|
4984
5060
|
const dim = path.count + margin * 2;
|
|
4985
|
-
return /* @__PURE__ */
|
|
5061
|
+
return /* @__PURE__ */ jsxs21(
|
|
4986
5062
|
"svg",
|
|
4987
5063
|
{
|
|
4988
5064
|
width: size,
|
|
@@ -4993,15 +5069,15 @@ function QrCode({ value, size = 200 }) {
|
|
|
4993
5069
|
shapeRendering: "crispEdges",
|
|
4994
5070
|
className: "ba-qr",
|
|
4995
5071
|
children: [
|
|
4996
|
-
/* @__PURE__ */
|
|
4997
|
-
/* @__PURE__ */
|
|
5072
|
+
/* @__PURE__ */ jsx25("rect", { width: dim, height: dim, fill: "#ffffff" }),
|
|
5073
|
+
/* @__PURE__ */ jsx25("g", { transform: `translate(${margin} ${margin})`, children: /* @__PURE__ */ jsx25("path", { d: path.d, fill: "#000000" }) })
|
|
4998
5074
|
]
|
|
4999
5075
|
}
|
|
5000
5076
|
);
|
|
5001
5077
|
}
|
|
5002
5078
|
|
|
5003
5079
|
// src/components/MFAEnrollment.tsx
|
|
5004
|
-
import { jsx as
|
|
5080
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5005
5081
|
function secretFromUri(uri) {
|
|
5006
5082
|
try {
|
|
5007
5083
|
return new URL(uri).searchParams.get("secret");
|
|
@@ -5014,11 +5090,11 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5014
5090
|
const { enable, verifyTotp } = useMFA();
|
|
5015
5091
|
const { user, isLoaded } = useUser();
|
|
5016
5092
|
const { pending, error, run } = useSubmitAction();
|
|
5017
|
-
const [password, setPassword] =
|
|
5018
|
-
const [setup, setSetup] =
|
|
5019
|
-
const [code, setCode] =
|
|
5020
|
-
const [done, setDone] =
|
|
5021
|
-
const setupOwnerId =
|
|
5093
|
+
const [password, setPassword] = React19.useState("");
|
|
5094
|
+
const [setup, setSetup] = React19.useState(null);
|
|
5095
|
+
const [code, setCode] = React19.useState("");
|
|
5096
|
+
const [done, setDone] = React19.useState(false);
|
|
5097
|
+
const setupOwnerId = React19.useRef(null);
|
|
5022
5098
|
const userId = user?.id ?? null;
|
|
5023
5099
|
const stale = shouldDiscardSetup({
|
|
5024
5100
|
isLoaded,
|
|
@@ -5027,7 +5103,7 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5027
5103
|
currentUserId: userId
|
|
5028
5104
|
});
|
|
5029
5105
|
const activeSetup = stale ? null : setup;
|
|
5030
|
-
|
|
5106
|
+
React19.useEffect(() => {
|
|
5031
5107
|
if (stale) {
|
|
5032
5108
|
setSetup(null);
|
|
5033
5109
|
setPassword("");
|
|
@@ -5035,22 +5111,22 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5035
5111
|
}
|
|
5036
5112
|
}, [stale]);
|
|
5037
5113
|
if (done) {
|
|
5038
|
-
return /* @__PURE__ */
|
|
5039
|
-
/* @__PURE__ */
|
|
5040
|
-
/* @__PURE__ */
|
|
5114
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-fields", "data-testid": "mfa-enroll-done", children: [
|
|
5115
|
+
/* @__PURE__ */ jsx26("h2", { className: "ba-title", children: t("mfa.enroll.doneTitle") }),
|
|
5116
|
+
/* @__PURE__ */ jsx26("p", { className: "ba-muted", children: t("mfa.enroll.doneBody") })
|
|
5041
5117
|
] });
|
|
5042
5118
|
}
|
|
5043
5119
|
if (!activeSetup) {
|
|
5044
5120
|
if (!isLoaded) {
|
|
5045
|
-
return /* @__PURE__ */
|
|
5121
|
+
return /* @__PURE__ */ jsx26("div", { className: "ba-fields", "data-testid": "mfa-enroll-loading", "aria-busy": "true", children: /* @__PURE__ */ jsx26("div", { className: "ba-skeleton" }) });
|
|
5046
5122
|
}
|
|
5047
5123
|
if (user?.twoFactorEnabled) {
|
|
5048
|
-
return /* @__PURE__ */
|
|
5049
|
-
/* @__PURE__ */
|
|
5050
|
-
/* @__PURE__ */
|
|
5124
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-fields", "data-testid": "mfa-enroll-active", children: [
|
|
5125
|
+
/* @__PURE__ */ jsx26("h2", { className: "ba-title", children: t("mfa.enroll.activeTitle") }),
|
|
5126
|
+
/* @__PURE__ */ jsx26("p", { className: "ba-muted", children: t("mfa.enroll.activeBody") })
|
|
5051
5127
|
] });
|
|
5052
5128
|
}
|
|
5053
|
-
return /* @__PURE__ */
|
|
5129
|
+
return /* @__PURE__ */ jsxs22(
|
|
5054
5130
|
"form",
|
|
5055
5131
|
{
|
|
5056
5132
|
method: "post",
|
|
@@ -5067,11 +5143,11 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5067
5143
|
});
|
|
5068
5144
|
},
|
|
5069
5145
|
children: [
|
|
5070
|
-
title !== null && /* @__PURE__ */
|
|
5071
|
-
/* @__PURE__ */
|
|
5072
|
-
/* @__PURE__ */
|
|
5146
|
+
title !== null && /* @__PURE__ */ jsx26("h2", { className: "ba-title", children: title ?? t("mfa.enroll.title") }),
|
|
5147
|
+
/* @__PURE__ */ jsx26("p", { className: "ba-muted", children: t("mfa.enroll.passwordHint") }),
|
|
5148
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
5073
5149
|
t("common.passwordLabel"),
|
|
5074
|
-
/* @__PURE__ */
|
|
5150
|
+
/* @__PURE__ */ jsx26(
|
|
5075
5151
|
"input",
|
|
5076
5152
|
{
|
|
5077
5153
|
className: "ba-input",
|
|
@@ -5083,29 +5159,29 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5083
5159
|
}
|
|
5084
5160
|
)
|
|
5085
5161
|
] }),
|
|
5086
|
-
/* @__PURE__ */
|
|
5087
|
-
/* @__PURE__ */
|
|
5162
|
+
/* @__PURE__ */ jsx26(FormError, { children: error }),
|
|
5163
|
+
/* @__PURE__ */ jsx26("button", { className: "ba-button", type: "submit", disabled: pending || !password, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx26(Busy, { busy: pending, label: t("mfa.enroll.startPending"), children: t("common.continue") }) })
|
|
5088
5164
|
]
|
|
5089
5165
|
}
|
|
5090
5166
|
);
|
|
5091
5167
|
}
|
|
5092
5168
|
const secret = secretFromUri(activeSetup.totpURI);
|
|
5093
|
-
return /* @__PURE__ */
|
|
5094
|
-
/* @__PURE__ */
|
|
5095
|
-
/* @__PURE__ */
|
|
5096
|
-
/* @__PURE__ */
|
|
5097
|
-
secret && /* @__PURE__ */
|
|
5098
|
-
secret: /* @__PURE__ */
|
|
5169
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-fields", "data-testid": "mfa-enroll-verify", children: [
|
|
5170
|
+
/* @__PURE__ */ jsx26("h2", { className: "ba-title", children: t("mfa.enroll.scanQrTitle") }),
|
|
5171
|
+
/* @__PURE__ */ jsx26("p", { className: "ba-muted", children: t("mfa.enroll.scanQrHint") }),
|
|
5172
|
+
/* @__PURE__ */ jsx26(QrCode, { value: activeSetup.totpURI }),
|
|
5173
|
+
secret && /* @__PURE__ */ jsx26("p", { className: "ba-muted", children: richMessage(t("mfa.enroll.manualKey"), {
|
|
5174
|
+
secret: /* @__PURE__ */ jsx26("code", { className: "ba-code", children: /* @__PURE__ */ jsx26(Bidi, { children: secret }) })
|
|
5099
5175
|
}) }),
|
|
5100
|
-
/* @__PURE__ */
|
|
5101
|
-
/* @__PURE__ */
|
|
5102
|
-
/* @__PURE__ */
|
|
5176
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
5177
|
+
/* @__PURE__ */ jsxs22("p", { className: "ba-muted", children: [
|
|
5178
|
+
/* @__PURE__ */ jsx26("strong", { children: t("mfa.enroll.backupCodesWarningStrong") }),
|
|
5103
5179
|
" ",
|
|
5104
5180
|
t("mfa.enroll.backupCodesWarningRest")
|
|
5105
5181
|
] }),
|
|
5106
|
-
/* @__PURE__ */
|
|
5182
|
+
/* @__PURE__ */ jsx26("ul", { className: "ba-backup-codes", "data-testid": "mfa-backup-codes", children: activeSetup.backupCodes.map((c) => /* @__PURE__ */ jsx26("li", { children: /* @__PURE__ */ jsx26("code", { className: "ba-code", children: c }) }, c)) })
|
|
5107
5183
|
] }),
|
|
5108
|
-
/* @__PURE__ */
|
|
5184
|
+
/* @__PURE__ */ jsxs22(
|
|
5109
5185
|
"form",
|
|
5110
5186
|
{
|
|
5111
5187
|
method: "post",
|
|
@@ -5123,9 +5199,9 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5123
5199
|
});
|
|
5124
5200
|
},
|
|
5125
5201
|
children: [
|
|
5126
|
-
/* @__PURE__ */
|
|
5202
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
5127
5203
|
t("mfa.enroll.codeLabel"),
|
|
5128
|
-
/* @__PURE__ */
|
|
5204
|
+
/* @__PURE__ */ jsx26(
|
|
5129
5205
|
"input",
|
|
5130
5206
|
{
|
|
5131
5207
|
className: "ba-input",
|
|
@@ -5137,8 +5213,8 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5137
5213
|
}
|
|
5138
5214
|
)
|
|
5139
5215
|
] }),
|
|
5140
|
-
/* @__PURE__ */
|
|
5141
|
-
/* @__PURE__ */
|
|
5216
|
+
/* @__PURE__ */ jsx26(FormError, { children: error }),
|
|
5217
|
+
/* @__PURE__ */ jsx26("button", { className: "ba-button", type: "submit", disabled: pending || !code, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx26(Busy, { busy: pending, label: t("common.verifying"), children: t("mfa.enroll.activateSubmit") }) })
|
|
5142
5218
|
]
|
|
5143
5219
|
}
|
|
5144
5220
|
)
|
|
@@ -5146,14 +5222,14 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5146
5222
|
}
|
|
5147
5223
|
|
|
5148
5224
|
// src/components/MFARequiredGate.tsx
|
|
5149
|
-
import { Fragment as Fragment8, jsx as
|
|
5225
|
+
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5150
5226
|
function MFARequiredGate({ children, title }) {
|
|
5151
5227
|
const t = useT();
|
|
5152
5228
|
const client = useAuthClient();
|
|
5153
5229
|
const { needsMfaEnrollment } = useUser();
|
|
5154
5230
|
const { refetch } = useSession();
|
|
5155
|
-
const [confirmedPending, setConfirmedPending] =
|
|
5156
|
-
|
|
5231
|
+
const [confirmedPending, setConfirmedPending] = React20.useState(null);
|
|
5232
|
+
React20.useEffect(() => {
|
|
5157
5233
|
if (!needsMfaEnrollment) {
|
|
5158
5234
|
setConfirmedPending(null);
|
|
5159
5235
|
return;
|
|
@@ -5171,26 +5247,26 @@ function MFARequiredGate({ children, title }) {
|
|
|
5171
5247
|
active = false;
|
|
5172
5248
|
};
|
|
5173
5249
|
}, [client, needsMfaEnrollment, refetch]);
|
|
5174
|
-
if (!needsMfaEnrollment) return /* @__PURE__ */
|
|
5250
|
+
if (!needsMfaEnrollment) return /* @__PURE__ */ jsx27(Fragment8, { children });
|
|
5175
5251
|
if (confirmedPending !== true) return null;
|
|
5176
|
-
return /* @__PURE__ */
|
|
5177
|
-
/* @__PURE__ */
|
|
5178
|
-
/* @__PURE__ */
|
|
5179
|
-
/* @__PURE__ */
|
|
5180
|
-
/* @__PURE__ */
|
|
5252
|
+
return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "mfa-required-gate", children: [
|
|
5253
|
+
/* @__PURE__ */ jsx27("h2", { className: "ba-title", children: title ?? t("mfaGate.title") }),
|
|
5254
|
+
/* @__PURE__ */ jsx27("p", { className: "ba-muted", children: t("mfaGate.body") }),
|
|
5255
|
+
/* @__PURE__ */ jsx27(MFAEnrollment, { onEnrolled: () => refetch({ query: { disableCookieCache: true } }) }),
|
|
5256
|
+
/* @__PURE__ */ jsx27(AuthOwlBadge, {})
|
|
5181
5257
|
] });
|
|
5182
5258
|
}
|
|
5183
5259
|
|
|
5184
5260
|
// src/components/BackupCodesManager.tsx
|
|
5185
|
-
import * as
|
|
5186
|
-
import { Fragment as Fragment9, jsx as
|
|
5261
|
+
import * as React21 from "react";
|
|
5262
|
+
import { Fragment as Fragment9, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5187
5263
|
function BackupCodesManager({ title }) {
|
|
5188
5264
|
const t = useT();
|
|
5189
5265
|
const { user } = useUser();
|
|
5190
5266
|
const { regenerateBackupCodes } = useMFA();
|
|
5191
5267
|
const { pending, error, run } = useSubmitAction();
|
|
5192
|
-
const [password, setPassword] =
|
|
5193
|
-
const [codes, setCodes] =
|
|
5268
|
+
const [password, setPassword] = React21.useState("");
|
|
5269
|
+
const [codes, setCodes] = React21.useState(null);
|
|
5194
5270
|
if (!user?.twoFactorEnabled) return null;
|
|
5195
5271
|
const submit = (e) => {
|
|
5196
5272
|
e.preventDefault();
|
|
@@ -5202,20 +5278,20 @@ function BackupCodesManager({ title }) {
|
|
|
5202
5278
|
}
|
|
5203
5279
|
});
|
|
5204
5280
|
};
|
|
5205
|
-
return /* @__PURE__ */
|
|
5206
|
-
title !== null && /* @__PURE__ */
|
|
5207
|
-
/* @__PURE__ */
|
|
5208
|
-
codes ? /* @__PURE__ */
|
|
5209
|
-
/* @__PURE__ */
|
|
5210
|
-
/* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ jsxs24("div", { className: "ba-form", "data-testid": "backup-codes-manager", children: [
|
|
5282
|
+
title !== null && /* @__PURE__ */ jsx28("h2", { className: "ba-title", children: title ?? t("backupCodes.title") }),
|
|
5283
|
+
/* @__PURE__ */ jsx28("p", { className: "ba-muted", children: t("backupCodes.hint") }),
|
|
5284
|
+
codes ? /* @__PURE__ */ jsxs24(Fragment9, { children: [
|
|
5285
|
+
/* @__PURE__ */ jsxs24("p", { className: "ba-muted", children: [
|
|
5286
|
+
/* @__PURE__ */ jsx28("strong", { children: t("mfa.enroll.backupCodesWarningStrong") }),
|
|
5211
5287
|
" ",
|
|
5212
5288
|
t("mfa.enroll.backupCodesWarningRest")
|
|
5213
5289
|
] }),
|
|
5214
|
-
/* @__PURE__ */
|
|
5215
|
-
] }) : /* @__PURE__ */
|
|
5216
|
-
/* @__PURE__ */
|
|
5290
|
+
/* @__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)) })
|
|
5291
|
+
] }) : /* @__PURE__ */ jsxs24("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
5292
|
+
/* @__PURE__ */ jsxs24("label", { className: "ba-label", children: [
|
|
5217
5293
|
t("common.passwordLabel"),
|
|
5218
|
-
/* @__PURE__ */
|
|
5294
|
+
/* @__PURE__ */ jsx28(
|
|
5219
5295
|
"input",
|
|
5220
5296
|
{
|
|
5221
5297
|
className: "ba-input",
|
|
@@ -5227,26 +5303,26 @@ function BackupCodesManager({ title }) {
|
|
|
5227
5303
|
}
|
|
5228
5304
|
)
|
|
5229
5305
|
] }),
|
|
5230
|
-
/* @__PURE__ */
|
|
5231
|
-
/* @__PURE__ */
|
|
5306
|
+
/* @__PURE__ */ jsx28(FormError, { children: error }),
|
|
5307
|
+
/* @__PURE__ */ jsx28("button", { className: "ba-button", type: "submit", disabled: pending || !password, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx28(Busy, { busy: pending, label: t("backupCodes.pending"), children: t("backupCodes.submit") }) })
|
|
5232
5308
|
] })
|
|
5233
5309
|
] });
|
|
5234
5310
|
}
|
|
5235
5311
|
|
|
5236
5312
|
// src/components/MagicLinkForm.tsx
|
|
5237
|
-
import * as
|
|
5238
|
-
import { jsx as
|
|
5313
|
+
import * as React22 from "react";
|
|
5314
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5239
5315
|
function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
5240
5316
|
const t = useT();
|
|
5241
5317
|
const { signInMagicLink } = useSignIn();
|
|
5242
5318
|
const { pending, error, run } = useSubmitAction();
|
|
5243
5319
|
const authChallenge = useAuthChallenge();
|
|
5244
|
-
const [email, setEmail] =
|
|
5245
|
-
const [sent, setSent] =
|
|
5320
|
+
const [email, setEmail] = React22.useState("");
|
|
5321
|
+
const [sent, setSent] = React22.useState(false);
|
|
5246
5322
|
if (sent) {
|
|
5247
|
-
return /* @__PURE__ */
|
|
5323
|
+
return /* @__PURE__ */ jsx29("p", { className: "ba-muted", "data-testid": "magiclink-sent", children: t("magicLink.sent") });
|
|
5248
5324
|
}
|
|
5249
|
-
return /* @__PURE__ */
|
|
5325
|
+
return /* @__PURE__ */ jsxs25(
|
|
5250
5326
|
"form",
|
|
5251
5327
|
{
|
|
5252
5328
|
method: "post",
|
|
@@ -5260,9 +5336,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
5260
5336
|
className: "ba-fields",
|
|
5261
5337
|
"data-testid": "magiclink-form",
|
|
5262
5338
|
children: [
|
|
5263
|
-
/* @__PURE__ */
|
|
5339
|
+
/* @__PURE__ */ jsxs25("label", { className: "ba-label", children: [
|
|
5264
5340
|
t("common.emailLabel"),
|
|
5265
|
-
/* @__PURE__ */
|
|
5341
|
+
/* @__PURE__ */ jsx29(
|
|
5266
5342
|
"input",
|
|
5267
5343
|
{
|
|
5268
5344
|
className: "ba-input",
|
|
@@ -5275,15 +5351,15 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
5275
5351
|
)
|
|
5276
5352
|
] }),
|
|
5277
5353
|
authChallenge.control,
|
|
5278
|
-
/* @__PURE__ */
|
|
5279
|
-
/* @__PURE__ */
|
|
5354
|
+
/* @__PURE__ */ jsx29(FormError, { children: error }),
|
|
5355
|
+
/* @__PURE__ */ jsx29(
|
|
5280
5356
|
"button",
|
|
5281
5357
|
{
|
|
5282
5358
|
className: "ba-button",
|
|
5283
5359
|
type: "submit",
|
|
5284
5360
|
disabled: pending || authChallenge.configPending,
|
|
5285
5361
|
"aria-busy": pending || void 0,
|
|
5286
|
-
children: /* @__PURE__ */
|
|
5362
|
+
children: /* @__PURE__ */ jsx29(Busy, { busy: pending, label: t("common.sending"), children: t("magicLink.submit") })
|
|
5287
5363
|
}
|
|
5288
5364
|
)
|
|
5289
5365
|
]
|
|
@@ -5292,19 +5368,19 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
5292
5368
|
}
|
|
5293
5369
|
|
|
5294
5370
|
// src/components/EmailOtpForm.tsx
|
|
5295
|
-
import * as
|
|
5296
|
-
import { jsx as
|
|
5371
|
+
import * as React23 from "react";
|
|
5372
|
+
import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5297
5373
|
function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
5298
5374
|
const t = useT();
|
|
5299
5375
|
const { sessionStore } = useAuthClient();
|
|
5300
5376
|
const { sendEmailOtp, signInEmailOtp } = useSignIn();
|
|
5301
5377
|
const { pending, error, setError, run } = useSubmitAction();
|
|
5302
5378
|
const authChallenge = useAuthChallenge();
|
|
5303
|
-
const [email, setEmail] =
|
|
5304
|
-
const [otp, setOtp] =
|
|
5305
|
-
const [stage, setStage] =
|
|
5379
|
+
const [email, setEmail] = React23.useState("");
|
|
5380
|
+
const [otp, setOtp] = React23.useState("");
|
|
5381
|
+
const [stage, setStage] = React23.useState("email");
|
|
5306
5382
|
if (stage === "code") {
|
|
5307
|
-
return /* @__PURE__ */
|
|
5383
|
+
return /* @__PURE__ */ jsx30(
|
|
5308
5384
|
OtpCodeForm,
|
|
5309
5385
|
{
|
|
5310
5386
|
email,
|
|
@@ -5327,7 +5403,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
5327
5403
|
}
|
|
5328
5404
|
);
|
|
5329
5405
|
}
|
|
5330
|
-
return /* @__PURE__ */
|
|
5406
|
+
return /* @__PURE__ */ jsxs26(
|
|
5331
5407
|
"form",
|
|
5332
5408
|
{
|
|
5333
5409
|
method: "post",
|
|
@@ -5341,9 +5417,9 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
5341
5417
|
className: "ba-fields",
|
|
5342
5418
|
"data-testid": "emailotp-email",
|
|
5343
5419
|
children: [
|
|
5344
|
-
/* @__PURE__ */
|
|
5420
|
+
/* @__PURE__ */ jsxs26("label", { className: "ba-label", children: [
|
|
5345
5421
|
t("common.emailLabel"),
|
|
5346
|
-
/* @__PURE__ */
|
|
5422
|
+
/* @__PURE__ */ jsx30(
|
|
5347
5423
|
"input",
|
|
5348
5424
|
{
|
|
5349
5425
|
className: "ba-input",
|
|
@@ -5359,15 +5435,15 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
5359
5435
|
)
|
|
5360
5436
|
] }),
|
|
5361
5437
|
authChallenge.control,
|
|
5362
|
-
/* @__PURE__ */
|
|
5363
|
-
/* @__PURE__ */
|
|
5438
|
+
/* @__PURE__ */ jsx30(FormError, { children: error }),
|
|
5439
|
+
/* @__PURE__ */ jsx30(
|
|
5364
5440
|
"button",
|
|
5365
5441
|
{
|
|
5366
5442
|
className: "ba-button",
|
|
5367
5443
|
type: "submit",
|
|
5368
5444
|
disabled: pending || authChallenge.configPending,
|
|
5369
5445
|
"aria-busy": pending || void 0,
|
|
5370
|
-
children: /* @__PURE__ */
|
|
5446
|
+
children: /* @__PURE__ */ jsx30(Busy, { busy: pending, label: t("common.sending"), children: t("emailOtp.requestSubmit") })
|
|
5371
5447
|
}
|
|
5372
5448
|
)
|
|
5373
5449
|
]
|
|
@@ -5376,8 +5452,8 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
5376
5452
|
}
|
|
5377
5453
|
|
|
5378
5454
|
// src/components/ResetPassword.tsx
|
|
5379
|
-
import * as
|
|
5380
|
-
import { jsx as
|
|
5455
|
+
import * as React24 from "react";
|
|
5456
|
+
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5381
5457
|
function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
5382
5458
|
const t = useT();
|
|
5383
5459
|
const { resetPassword } = usePasswordReset();
|
|
@@ -5385,27 +5461,27 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
5385
5461
|
const capabilities = resolveProjectCapabilities(config);
|
|
5386
5462
|
const { passwordMinLength, passwordMaxLength } = capabilities;
|
|
5387
5463
|
const { pending, error, setError, run } = useSubmitAction();
|
|
5388
|
-
const [token, setToken] =
|
|
5389
|
-
const [ready, setReady] =
|
|
5390
|
-
const [password, setPassword] =
|
|
5391
|
-
const [confirm, setConfirm] =
|
|
5392
|
-
const [done, setDone] =
|
|
5393
|
-
|
|
5464
|
+
const [token, setToken] = React24.useState(tokenProp ?? null);
|
|
5465
|
+
const [ready, setReady] = React24.useState(tokenProp != null);
|
|
5466
|
+
const [password, setPassword] = React24.useState("");
|
|
5467
|
+
const [confirm, setConfirm] = React24.useState("");
|
|
5468
|
+
const [done, setDone] = React24.useState(false);
|
|
5469
|
+
React24.useEffect(() => {
|
|
5394
5470
|
if (tokenProp != null) return;
|
|
5395
5471
|
const params = new URLSearchParams(window.location.search);
|
|
5396
5472
|
setToken(params.get("token"));
|
|
5397
5473
|
setReady(true);
|
|
5398
5474
|
}, [tokenProp]);
|
|
5399
5475
|
if (!ready) {
|
|
5400
|
-
return /* @__PURE__ */
|
|
5476
|
+
return /* @__PURE__ */ jsx31("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx31("div", { className: "ba-skeleton" }) });
|
|
5401
5477
|
}
|
|
5402
5478
|
if (!token) {
|
|
5403
|
-
return /* @__PURE__ */
|
|
5479
|
+
return /* @__PURE__ */ jsx31(FormError, { "data-testid": "reset-invalid", children: t("resetPassword.invalidLink") });
|
|
5404
5480
|
}
|
|
5405
5481
|
if (done) {
|
|
5406
|
-
return /* @__PURE__ */
|
|
5482
|
+
return /* @__PURE__ */ jsx31("p", { className: "ba-muted", "data-testid": "reset-done", children: t("resetPassword.done") });
|
|
5407
5483
|
}
|
|
5408
|
-
return /* @__PURE__ */
|
|
5484
|
+
return /* @__PURE__ */ jsxs27(
|
|
5409
5485
|
"form",
|
|
5410
5486
|
{
|
|
5411
5487
|
method: "post",
|
|
@@ -5431,9 +5507,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
5431
5507
|
});
|
|
5432
5508
|
},
|
|
5433
5509
|
children: [
|
|
5434
|
-
/* @__PURE__ */
|
|
5510
|
+
/* @__PURE__ */ jsxs27("label", { className: "ba-label", children: [
|
|
5435
5511
|
t("resetPassword.newPasswordLabel"),
|
|
5436
|
-
/* @__PURE__ */
|
|
5512
|
+
/* @__PURE__ */ jsx31(
|
|
5437
5513
|
"input",
|
|
5438
5514
|
{
|
|
5439
5515
|
className: "ba-input",
|
|
@@ -5450,9 +5526,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
5450
5526
|
}
|
|
5451
5527
|
)
|
|
5452
5528
|
] }),
|
|
5453
|
-
/* @__PURE__ */
|
|
5529
|
+
/* @__PURE__ */ jsxs27("label", { className: "ba-label", children: [
|
|
5454
5530
|
t("resetPassword.confirmPasswordLabel"),
|
|
5455
|
-
/* @__PURE__ */
|
|
5531
|
+
/* @__PURE__ */ jsx31(
|
|
5456
5532
|
"input",
|
|
5457
5533
|
{
|
|
5458
5534
|
className: "ba-input",
|
|
@@ -5469,26 +5545,26 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
5469
5545
|
}
|
|
5470
5546
|
)
|
|
5471
5547
|
] }),
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
/* @__PURE__ */
|
|
5548
|
+
/* @__PURE__ */ jsx31(FormError, { children: error }),
|
|
5549
|
+
/* @__PURE__ */ jsx31("button", { className: "ba-button", type: "submit", disabled: pending, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx31(Busy, { busy: pending, label: t("resetPassword.submitPending"), children: t("resetPassword.submit") }) })
|
|
5474
5550
|
]
|
|
5475
5551
|
}
|
|
5476
5552
|
);
|
|
5477
5553
|
}
|
|
5478
5554
|
|
|
5479
5555
|
// src/components/VerifyEmail.tsx
|
|
5480
|
-
import * as
|
|
5481
|
-
import { Fragment as Fragment10, jsx as
|
|
5556
|
+
import * as React25 from "react";
|
|
5557
|
+
import { Fragment as Fragment10, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5482
5558
|
function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
5483
5559
|
const t = useT();
|
|
5484
5560
|
const { sendVerificationEmail } = useEmailVerification();
|
|
5485
5561
|
const { pending, error, run } = useSubmitAction();
|
|
5486
5562
|
const authChallenge = useAuthChallenge();
|
|
5487
|
-
const [ready, setReady] =
|
|
5488
|
-
const [failed, setFailed] =
|
|
5489
|
-
const [email, setEmail] =
|
|
5490
|
-
const [resent, setResent] =
|
|
5491
|
-
|
|
5563
|
+
const [ready, setReady] = React25.useState(false);
|
|
5564
|
+
const [failed, setFailed] = React25.useState(false);
|
|
5565
|
+
const [email, setEmail] = React25.useState("");
|
|
5566
|
+
const [resent, setResent] = React25.useState(false);
|
|
5567
|
+
React25.useEffect(() => {
|
|
5492
5568
|
const didFail = new URLSearchParams(window.location.search).has("error");
|
|
5493
5569
|
setFailed(didFail);
|
|
5494
5570
|
setReady(true);
|
|
@@ -5498,12 +5574,12 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
5498
5574
|
}
|
|
5499
5575
|
}, [onVerified, redirectTo]);
|
|
5500
5576
|
if (!ready) {
|
|
5501
|
-
return /* @__PURE__ */
|
|
5577
|
+
return /* @__PURE__ */ jsx32("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx32("div", { className: "ba-skeleton" }) });
|
|
5502
5578
|
}
|
|
5503
5579
|
if (!failed) {
|
|
5504
|
-
return /* @__PURE__ */
|
|
5580
|
+
return /* @__PURE__ */ jsx32("p", { className: "ba-muted", "data-testid": "verify-success", children: t("verifyEmail.success") });
|
|
5505
5581
|
}
|
|
5506
|
-
return /* @__PURE__ */
|
|
5582
|
+
return /* @__PURE__ */ jsxs28(
|
|
5507
5583
|
"form",
|
|
5508
5584
|
{
|
|
5509
5585
|
method: "post",
|
|
@@ -5518,11 +5594,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
5518
5594
|
});
|
|
5519
5595
|
},
|
|
5520
5596
|
children: [
|
|
5521
|
-
/* @__PURE__ */
|
|
5522
|
-
resent ? /* @__PURE__ */
|
|
5523
|
-
/* @__PURE__ */
|
|
5597
|
+
/* @__PURE__ */ jsx32(FormError, { children: t("verifyEmail.invalidLink") }),
|
|
5598
|
+
resent ? /* @__PURE__ */ jsx32("p", { className: "ba-muted", children: richMessage(t("verifyEmail.resent"), { email: /* @__PURE__ */ jsx32(Bidi, { children: email }) }) }) : /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
5599
|
+
/* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
|
|
5524
5600
|
t("common.emailLabel"),
|
|
5525
|
-
/* @__PURE__ */
|
|
5601
|
+
/* @__PURE__ */ jsx32(
|
|
5526
5602
|
"input",
|
|
5527
5603
|
{
|
|
5528
5604
|
className: "ba-input",
|
|
@@ -5535,15 +5611,15 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
5535
5611
|
)
|
|
5536
5612
|
] }),
|
|
5537
5613
|
authChallenge.control,
|
|
5538
|
-
/* @__PURE__ */
|
|
5539
|
-
/* @__PURE__ */
|
|
5614
|
+
/* @__PURE__ */ jsx32(FormError, { children: error }),
|
|
5615
|
+
/* @__PURE__ */ jsx32(
|
|
5540
5616
|
"button",
|
|
5541
5617
|
{
|
|
5542
5618
|
className: "ba-button",
|
|
5543
5619
|
type: "submit",
|
|
5544
5620
|
disabled: pending || authChallenge.configPending,
|
|
5545
5621
|
"aria-busy": pending || void 0,
|
|
5546
|
-
children: /* @__PURE__ */
|
|
5622
|
+
children: /* @__PURE__ */ jsx32(Busy, { busy: pending, label: t("common.sending"), children: t("verifyEmail.resendSubmit") })
|
|
5547
5623
|
}
|
|
5548
5624
|
)
|
|
5549
5625
|
] })
|
|
@@ -5553,18 +5629,18 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
5553
5629
|
}
|
|
5554
5630
|
|
|
5555
5631
|
// src/components/PasskeyManager.tsx
|
|
5556
|
-
import * as
|
|
5557
|
-
import { jsx as
|
|
5632
|
+
import * as React26 from "react";
|
|
5633
|
+
import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5558
5634
|
function PasskeyManager({ title, allowAdd = true } = {}) {
|
|
5559
5635
|
const t = useT();
|
|
5560
5636
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
5561
5637
|
if (!isLoaded) {
|
|
5562
|
-
return /* @__PURE__ */
|
|
5638
|
+
return /* @__PURE__ */ jsx33("div", { className: "ba-form", "data-testid": "passkey-manager-loading", "aria-busy": "true", children: /* @__PURE__ */ jsx33("div", { className: "ba-skeleton" }) });
|
|
5563
5639
|
}
|
|
5564
5640
|
if (!isSignedIn || !user) {
|
|
5565
|
-
return /* @__PURE__ */
|
|
5641
|
+
return /* @__PURE__ */ jsx33("p", { className: "ba-muted", children: t("passkeys.signedOut") });
|
|
5566
5642
|
}
|
|
5567
|
-
return /* @__PURE__ */
|
|
5643
|
+
return /* @__PURE__ */ jsx33(PasskeyManagerBody, { title, allowAdd }, user.id);
|
|
5568
5644
|
}
|
|
5569
5645
|
function PasskeyManagerBody({
|
|
5570
5646
|
title,
|
|
@@ -5573,12 +5649,12 @@ function PasskeyManagerBody({
|
|
|
5573
5649
|
const t = useT();
|
|
5574
5650
|
const toServerError = useServerError();
|
|
5575
5651
|
const api = usePasskeys();
|
|
5576
|
-
const apiRef =
|
|
5652
|
+
const apiRef = React26.useRef(api);
|
|
5577
5653
|
apiRef.current = api;
|
|
5578
5654
|
const { pending, error, setError, run } = useSubmitAction();
|
|
5579
|
-
const [passkeys, setPasskeys] =
|
|
5580
|
-
const loadTokenRef =
|
|
5581
|
-
const load =
|
|
5655
|
+
const [passkeys, setPasskeys] = React26.useState(null);
|
|
5656
|
+
const loadTokenRef = React26.useRef(0);
|
|
5657
|
+
const load = React26.useCallback(async () => {
|
|
5582
5658
|
const token = ++loadTokenRef.current;
|
|
5583
5659
|
try {
|
|
5584
5660
|
const res = await apiRef.current.listPasskeys();
|
|
@@ -5594,7 +5670,7 @@ function PasskeyManagerBody({
|
|
|
5594
5670
|
setError(t("passkeys.error.loadFailed"));
|
|
5595
5671
|
}
|
|
5596
5672
|
}, [setError, toServerError, t]);
|
|
5597
|
-
|
|
5673
|
+
React26.useEffect(() => {
|
|
5598
5674
|
void load();
|
|
5599
5675
|
}, [load]);
|
|
5600
5676
|
function onRename(id, current) {
|
|
@@ -5613,13 +5689,13 @@ function PasskeyManagerBody({
|
|
|
5613
5689
|
onSuccess: load
|
|
5614
5690
|
});
|
|
5615
5691
|
}
|
|
5616
|
-
return /* @__PURE__ */
|
|
5617
|
-
title !== null && /* @__PURE__ */
|
|
5618
|
-
passkeys === null ? error ? null : /* @__PURE__ */
|
|
5619
|
-
(passkeys ?? []).map((pk) => /* @__PURE__ */
|
|
5620
|
-
/* @__PURE__ */
|
|
5621
|
-
/* @__PURE__ */
|
|
5622
|
-
/* @__PURE__ */
|
|
5692
|
+
return /* @__PURE__ */ jsxs29("div", { className: "ba-form", "data-testid": "passkey-manager", children: [
|
|
5693
|
+
title !== null && /* @__PURE__ */ jsx33("h2", { className: "ba-title", children: title ?? t("passkeys.title") }),
|
|
5694
|
+
passkeys === null ? error ? null : /* @__PURE__ */ jsx33("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs29("ul", { className: "ba-passkey-list", children: [
|
|
5695
|
+
(passkeys ?? []).map((pk) => /* @__PURE__ */ jsxs29("li", { className: "ba-passkey-item", children: [
|
|
5696
|
+
/* @__PURE__ */ jsx33("span", { className: "ba-passkey-name", children: pk.name?.trim() || t("passkeys.unnamed") }),
|
|
5697
|
+
/* @__PURE__ */ jsxs29("span", { className: "ba-passkey-actions", children: [
|
|
5698
|
+
/* @__PURE__ */ jsx33(
|
|
5623
5699
|
"button",
|
|
5624
5700
|
{
|
|
5625
5701
|
type: "button",
|
|
@@ -5629,7 +5705,7 @@ function PasskeyManagerBody({
|
|
|
5629
5705
|
children: t("passkeys.rename")
|
|
5630
5706
|
}
|
|
5631
5707
|
),
|
|
5632
|
-
/* @__PURE__ */
|
|
5708
|
+
/* @__PURE__ */ jsx33(
|
|
5633
5709
|
"button",
|
|
5634
5710
|
{
|
|
5635
5711
|
type: "button",
|
|
@@ -5641,13 +5717,13 @@ function PasskeyManagerBody({
|
|
|
5641
5717
|
)
|
|
5642
5718
|
] })
|
|
5643
5719
|
] }, pk.id)),
|
|
5644
|
-
passkeys !== null && passkeys.length === 0 && /* @__PURE__ */
|
|
5720
|
+
passkeys !== null && passkeys.length === 0 && /* @__PURE__ */ jsx33("li", { className: "ba-muted", children: t("passkeys.empty") })
|
|
5645
5721
|
] }),
|
|
5646
|
-
error && /* @__PURE__ */
|
|
5647
|
-
/* @__PURE__ */
|
|
5648
|
-
passkeys === null && /* @__PURE__ */
|
|
5722
|
+
error && /* @__PURE__ */ jsxs29("div", { className: "ba-inline-error", children: [
|
|
5723
|
+
/* @__PURE__ */ jsx33(FormError, { children: error }),
|
|
5724
|
+
passkeys === null && /* @__PURE__ */ jsx33("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("userProfile.retry") })
|
|
5649
5725
|
] }),
|
|
5650
|
-
passkeys !== null && allowAdd && /* @__PURE__ */
|
|
5726
|
+
passkeys !== null && allowAdd && /* @__PURE__ */ jsx33(
|
|
5651
5727
|
"button",
|
|
5652
5728
|
{
|
|
5653
5729
|
className: "ba-button",
|
|
@@ -5658,7 +5734,7 @@ function PasskeyManagerBody({
|
|
|
5658
5734
|
failure: t("passkeys.error.addFailed"),
|
|
5659
5735
|
onSuccess: load
|
|
5660
5736
|
}),
|
|
5661
|
-
children: /* @__PURE__ */
|
|
5737
|
+
children: /* @__PURE__ */ jsx33(Busy, { busy: pending, label: t("common.working"), children: t("passkeys.add") })
|
|
5662
5738
|
}
|
|
5663
5739
|
)
|
|
5664
5740
|
] });
|
|
@@ -5666,14 +5742,14 @@ function PasskeyManagerBody({
|
|
|
5666
5742
|
|
|
5667
5743
|
// src/components/control.tsx
|
|
5668
5744
|
import { membershipHas } from "@authowl/core";
|
|
5669
|
-
import { Fragment as Fragment11, jsx as
|
|
5745
|
+
import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5670
5746
|
function SignedIn({ children }) {
|
|
5671
5747
|
const { isLoaded, isSignedIn } = useUser();
|
|
5672
|
-
return isLoaded && isSignedIn ? /* @__PURE__ */
|
|
5748
|
+
return isLoaded && isSignedIn ? /* @__PURE__ */ jsx34(Fragment11, { children }) : null;
|
|
5673
5749
|
}
|
|
5674
5750
|
function SignedOut({ children }) {
|
|
5675
5751
|
const { isLoaded, isSignedIn } = useUser();
|
|
5676
|
-
return isLoaded && !isSignedIn ? /* @__PURE__ */
|
|
5752
|
+
return isLoaded && !isSignedIn ? /* @__PURE__ */ jsx34(Fragment11, { children }) : null;
|
|
5677
5753
|
}
|
|
5678
5754
|
function Protect({
|
|
5679
5755
|
children,
|
|
@@ -5686,36 +5762,36 @@ function Protect({
|
|
|
5686
5762
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
5687
5763
|
const membership = useSession().data?.session?.membership ?? null;
|
|
5688
5764
|
if (!isLoaded) return null;
|
|
5689
|
-
if (!isSignedIn || !user) return /* @__PURE__ */
|
|
5765
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ jsx34(Fragment11, { children: fallback });
|
|
5690
5766
|
if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !membershipHas(membership, { role, permission, teamId })) {
|
|
5691
|
-
return /* @__PURE__ */
|
|
5767
|
+
return /* @__PURE__ */ jsx34(Fragment11, { children: fallback });
|
|
5692
5768
|
}
|
|
5693
|
-
if (condition && !condition(user)) return /* @__PURE__ */
|
|
5694
|
-
return /* @__PURE__ */
|
|
5769
|
+
if (condition && !condition(user)) return /* @__PURE__ */ jsx34(Fragment11, { children: fallback });
|
|
5770
|
+
return /* @__PURE__ */ jsx34(Fragment11, { children });
|
|
5695
5771
|
}
|
|
5696
5772
|
function AuthLoading({ children }) {
|
|
5697
5773
|
const t = useT();
|
|
5698
5774
|
const { isLoaded } = useUser();
|
|
5699
5775
|
if (isLoaded) return null;
|
|
5700
|
-
if (children !== void 0) return /* @__PURE__ */
|
|
5701
|
-
return /* @__PURE__ */
|
|
5702
|
-
/* @__PURE__ */
|
|
5703
|
-
/* @__PURE__ */
|
|
5776
|
+
if (children !== void 0) return /* @__PURE__ */ jsx34(Fragment11, { children });
|
|
5777
|
+
return /* @__PURE__ */ jsxs30("div", { className: "ba-auth-loading", role: "status", "aria-busy": "true", "data-testid": "auth-loading", children: [
|
|
5778
|
+
/* @__PURE__ */ jsx34(Spinner, {}),
|
|
5779
|
+
/* @__PURE__ */ jsx34("span", { className: "ba-sr-only", children: t("common.loading") })
|
|
5704
5780
|
] });
|
|
5705
5781
|
}
|
|
5706
5782
|
function AuthLoaded({ children }) {
|
|
5707
|
-
return useUser().isLoaded ? /* @__PURE__ */
|
|
5783
|
+
return useUser().isLoaded ? /* @__PURE__ */ jsx34(Fragment11, { children }) : null;
|
|
5708
5784
|
}
|
|
5709
5785
|
|
|
5710
5786
|
// src/components/SignOutButton.tsx
|
|
5711
|
-
import * as
|
|
5712
|
-
import { jsx as
|
|
5787
|
+
import * as React27 from "react";
|
|
5788
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
5713
5789
|
function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
5714
5790
|
const t = useT();
|
|
5715
5791
|
const { signOut } = useSignOut();
|
|
5716
|
-
const [pending, setPending] =
|
|
5792
|
+
const [pending, setPending] = React27.useState(false);
|
|
5717
5793
|
const content = children ?? t("signOut.button");
|
|
5718
|
-
return /* @__PURE__ */
|
|
5794
|
+
return /* @__PURE__ */ jsx35(
|
|
5719
5795
|
"button",
|
|
5720
5796
|
{
|
|
5721
5797
|
type: "button",
|
|
@@ -5733,32 +5809,32 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
|
5733
5809
|
setPending(false);
|
|
5734
5810
|
}
|
|
5735
5811
|
},
|
|
5736
|
-
children: /* @__PURE__ */
|
|
5812
|
+
children: /* @__PURE__ */ jsx35(Busy, { busy: pending, label: content, children: content })
|
|
5737
5813
|
}
|
|
5738
5814
|
);
|
|
5739
5815
|
}
|
|
5740
5816
|
|
|
5741
5817
|
// src/components/UserButton.tsx
|
|
5742
|
-
import * as
|
|
5818
|
+
import * as React41 from "react";
|
|
5743
5819
|
|
|
5744
5820
|
// src/components/UserProfile.tsx
|
|
5745
|
-
import * as
|
|
5821
|
+
import * as React40 from "react";
|
|
5746
5822
|
|
|
5747
5823
|
// src/components/user-profile/EmailSection.tsx
|
|
5748
|
-
import * as
|
|
5749
|
-
import { jsx as
|
|
5824
|
+
import * as React28 from "react";
|
|
5825
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5750
5826
|
function EmailSection({ allowChange }) {
|
|
5751
5827
|
const t = useT();
|
|
5752
5828
|
const account = useAccount();
|
|
5753
5829
|
const { user } = useUser();
|
|
5754
5830
|
const { pending, error, run } = useSubmitAction();
|
|
5755
|
-
const [newEmail, setNewEmail] =
|
|
5756
|
-
const [sent, setSent] =
|
|
5757
|
-
const titleId =
|
|
5831
|
+
const [newEmail, setNewEmail] = React28.useState("");
|
|
5832
|
+
const [sent, setSent] = React28.useState(false);
|
|
5833
|
+
const titleId = React28.useId();
|
|
5758
5834
|
if (!user?.email) {
|
|
5759
|
-
return /* @__PURE__ */
|
|
5760
|
-
/* @__PURE__ */
|
|
5761
|
-
/* @__PURE__ */
|
|
5835
|
+
return /* @__PURE__ */ jsxs31("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
5836
|
+
/* @__PURE__ */ jsx36("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
5837
|
+
/* @__PURE__ */ jsx36("p", { className: "ba-muted", children: t("userProfile.email.unavailable") })
|
|
5762
5838
|
] });
|
|
5763
5839
|
}
|
|
5764
5840
|
const submit = (event) => {
|
|
@@ -5778,19 +5854,19 @@ function EmailSection({ allowChange }) {
|
|
|
5778
5854
|
}
|
|
5779
5855
|
);
|
|
5780
5856
|
};
|
|
5781
|
-
return /* @__PURE__ */
|
|
5782
|
-
/* @__PURE__ */
|
|
5783
|
-
/* @__PURE__ */
|
|
5784
|
-
/* @__PURE__ */
|
|
5857
|
+
return /* @__PURE__ */ jsxs31("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
5858
|
+
/* @__PURE__ */ jsxs31("header", { className: "ba-profile-section-header", children: [
|
|
5859
|
+
/* @__PURE__ */ jsx36("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
5860
|
+
/* @__PURE__ */ jsx36("p", { className: "ba-muted", children: t("userProfile.email.description") })
|
|
5785
5861
|
] }),
|
|
5786
|
-
/* @__PURE__ */
|
|
5787
|
-
/* @__PURE__ */
|
|
5788
|
-
/* @__PURE__ */
|
|
5862
|
+
/* @__PURE__ */ jsxs31("p", { className: "ba-profile-current", children: [
|
|
5863
|
+
/* @__PURE__ */ jsx36("span", { children: t("userProfile.email.current") }),
|
|
5864
|
+
/* @__PURE__ */ jsx36("strong", { children: /* @__PURE__ */ jsx36(Bidi, { children: user.email }) })
|
|
5789
5865
|
] }),
|
|
5790
|
-
!allowChange ? /* @__PURE__ */
|
|
5791
|
-
/* @__PURE__ */
|
|
5866
|
+
!allowChange ? /* @__PURE__ */ jsx36("p", { className: "ba-muted", "data-testid": "email-change-disabled", children: t("userProfile.email.changeDisabled") }) : /* @__PURE__ */ jsxs31("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
5867
|
+
/* @__PURE__ */ jsxs31("label", { className: "ba-label", children: [
|
|
5792
5868
|
t("userProfile.email.newLabel"),
|
|
5793
|
-
/* @__PURE__ */
|
|
5869
|
+
/* @__PURE__ */ jsx36(
|
|
5794
5870
|
"input",
|
|
5795
5871
|
{
|
|
5796
5872
|
className: "ba-input",
|
|
@@ -5802,16 +5878,16 @@ function EmailSection({ allowChange }) {
|
|
|
5802
5878
|
}
|
|
5803
5879
|
)
|
|
5804
5880
|
] }),
|
|
5805
|
-
/* @__PURE__ */
|
|
5806
|
-
sent && /* @__PURE__ */
|
|
5807
|
-
/* @__PURE__ */
|
|
5881
|
+
/* @__PURE__ */ jsx36(FormError, { children: error }),
|
|
5882
|
+
sent && /* @__PURE__ */ jsx36("p", { className: "ba-success", role: "status", children: t("userProfile.email.sent") }),
|
|
5883
|
+
/* @__PURE__ */ jsx36(
|
|
5808
5884
|
"button",
|
|
5809
5885
|
{
|
|
5810
5886
|
className: "ba-button ba-profile-submit",
|
|
5811
5887
|
type: "submit",
|
|
5812
5888
|
disabled: pending || !newEmail.trim(),
|
|
5813
5889
|
"aria-busy": pending || void 0,
|
|
5814
|
-
children: /* @__PURE__ */
|
|
5890
|
+
children: /* @__PURE__ */ jsx36(Busy, { busy: pending, label: t("common.sending"), children: t("userProfile.email.submit") })
|
|
5815
5891
|
}
|
|
5816
5892
|
)
|
|
5817
5893
|
] })
|
|
@@ -5819,16 +5895,16 @@ function EmailSection({ allowChange }) {
|
|
|
5819
5895
|
}
|
|
5820
5896
|
|
|
5821
5897
|
// src/components/user-profile/DeleteAccountSection.tsx
|
|
5822
|
-
import * as
|
|
5823
|
-
import { jsx as
|
|
5898
|
+
import * as React29 from "react";
|
|
5899
|
+
import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5824
5900
|
function DeleteAccountSection({ onDeleted }) {
|
|
5825
5901
|
const t = useT();
|
|
5826
5902
|
const account = useAccount();
|
|
5827
5903
|
const session = useSession();
|
|
5828
5904
|
const { user } = useUser();
|
|
5829
5905
|
const { pending, error, run } = useSubmitAction();
|
|
5830
|
-
const [confirmation, setConfirmation] =
|
|
5831
|
-
const titleId =
|
|
5906
|
+
const [confirmation, setConfirmation] = React29.useState("");
|
|
5907
|
+
const titleId = React29.useId();
|
|
5832
5908
|
const identifier = user?.email ?? user?.phoneNumber ?? user?.id ?? "";
|
|
5833
5909
|
const confirmed = identifier.length > 0 && confirmation.trim().toLowerCase() === identifier.toLowerCase();
|
|
5834
5910
|
const submit = (event) => {
|
|
@@ -5845,18 +5921,18 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
5845
5921
|
}
|
|
5846
5922
|
);
|
|
5847
5923
|
};
|
|
5848
|
-
return /* @__PURE__ */
|
|
5849
|
-
/* @__PURE__ */
|
|
5850
|
-
/* @__PURE__ */
|
|
5851
|
-
/* @__PURE__ */
|
|
5924
|
+
return /* @__PURE__ */ jsxs32("section", { className: "ba-profile-section ba-profile-danger-zone", "aria-labelledby": titleId, children: [
|
|
5925
|
+
/* @__PURE__ */ jsxs32("header", { className: "ba-profile-section-header", children: [
|
|
5926
|
+
/* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.delete.title") }),
|
|
5927
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-muted", children: t("userProfile.delete.description") })
|
|
5852
5928
|
] }),
|
|
5853
|
-
/* @__PURE__ */
|
|
5854
|
-
/* @__PURE__ */
|
|
5855
|
-
/* @__PURE__ */
|
|
5929
|
+
/* @__PURE__ */ jsxs32("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
5930
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-profile-delete-warning", children: t("userProfile.delete.warning", { identifier }) }),
|
|
5931
|
+
/* @__PURE__ */ jsxs32("label", { className: "ba-label", children: [
|
|
5856
5932
|
t("userProfile.delete.confirmLabel"),
|
|
5857
5933
|
" ",
|
|
5858
|
-
/* @__PURE__ */
|
|
5859
|
-
/* @__PURE__ */
|
|
5934
|
+
/* @__PURE__ */ jsx37(Bidi, { children: identifier }),
|
|
5935
|
+
/* @__PURE__ */ jsx37(
|
|
5860
5936
|
"input",
|
|
5861
5937
|
{
|
|
5862
5938
|
className: "ba-input",
|
|
@@ -5870,15 +5946,15 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
5870
5946
|
}
|
|
5871
5947
|
)
|
|
5872
5948
|
] }),
|
|
5873
|
-
/* @__PURE__ */
|
|
5874
|
-
/* @__PURE__ */
|
|
5949
|
+
/* @__PURE__ */ jsx37(FormError, { children: error }),
|
|
5950
|
+
/* @__PURE__ */ jsx37(
|
|
5875
5951
|
"button",
|
|
5876
5952
|
{
|
|
5877
5953
|
className: "ba-button ba-danger-button ba-profile-submit",
|
|
5878
5954
|
type: "submit",
|
|
5879
5955
|
disabled: pending || !confirmed,
|
|
5880
5956
|
"aria-busy": pending || void 0,
|
|
5881
|
-
children: /* @__PURE__ */
|
|
5957
|
+
children: /* @__PURE__ */ jsx37(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.delete.submit") })
|
|
5882
5958
|
}
|
|
5883
5959
|
)
|
|
5884
5960
|
] })
|
|
@@ -5886,8 +5962,8 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
5886
5962
|
}
|
|
5887
5963
|
|
|
5888
5964
|
// src/components/user-profile/MfaSection.tsx
|
|
5889
|
-
import * as
|
|
5890
|
-
import { jsx as
|
|
5965
|
+
import * as React30 from "react";
|
|
5966
|
+
import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
5891
5967
|
function MfaSection() {
|
|
5892
5968
|
const t = useT();
|
|
5893
5969
|
const { user } = useUser();
|
|
@@ -5895,17 +5971,17 @@ function MfaSection() {
|
|
|
5895
5971
|
const { config } = usePublicConfig();
|
|
5896
5972
|
const { disable } = useMFA();
|
|
5897
5973
|
const { pending, error, run } = useSubmitAction();
|
|
5898
|
-
const [password, setPassword] =
|
|
5899
|
-
const [showDisable, setShowDisable] =
|
|
5900
|
-
const titleId =
|
|
5974
|
+
const [password, setPassword] = React30.useState("");
|
|
5975
|
+
const [showDisable, setShowDisable] = React30.useState(false);
|
|
5976
|
+
const titleId = React30.useId();
|
|
5901
5977
|
const required = resolveProjectCapabilities(config).mfaRequired;
|
|
5902
5978
|
if (!user?.twoFactorEnabled) {
|
|
5903
|
-
return /* @__PURE__ */
|
|
5904
|
-
/* @__PURE__ */
|
|
5905
|
-
/* @__PURE__ */
|
|
5906
|
-
/* @__PURE__ */
|
|
5979
|
+
return /* @__PURE__ */ jsxs33("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
5980
|
+
/* @__PURE__ */ jsxs33("header", { className: "ba-profile-section-header", children: [
|
|
5981
|
+
/* @__PURE__ */ jsx38("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
5982
|
+
/* @__PURE__ */ jsx38("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredDescription") : t("userProfile.mfa.description") })
|
|
5907
5983
|
] }),
|
|
5908
|
-
/* @__PURE__ */
|
|
5984
|
+
/* @__PURE__ */ jsx38(
|
|
5909
5985
|
MFAEnrollment,
|
|
5910
5986
|
{
|
|
5911
5987
|
title: null,
|
|
@@ -5928,16 +6004,16 @@ function MfaSection() {
|
|
|
5928
6004
|
}
|
|
5929
6005
|
);
|
|
5930
6006
|
};
|
|
5931
|
-
return /* @__PURE__ */
|
|
5932
|
-
/* @__PURE__ */
|
|
5933
|
-
/* @__PURE__ */
|
|
5934
|
-
/* @__PURE__ */
|
|
6007
|
+
return /* @__PURE__ */ jsxs33("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6008
|
+
/* @__PURE__ */ jsxs33("header", { className: "ba-profile-section-header", children: [
|
|
6009
|
+
/* @__PURE__ */ jsx38("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
6010
|
+
/* @__PURE__ */ jsx38("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredActive") : t("userProfile.mfa.active") })
|
|
5935
6011
|
] }),
|
|
5936
|
-
/* @__PURE__ */
|
|
5937
|
-
/* @__PURE__ */
|
|
5938
|
-
/* @__PURE__ */
|
|
6012
|
+
/* @__PURE__ */ jsxs33("div", { className: "ba-profile-status", role: "status", children: [
|
|
6013
|
+
/* @__PURE__ */ jsx38("strong", { children: t("userProfile.mfa.enabled") }),
|
|
6014
|
+
/* @__PURE__ */ jsx38("span", { children: t("userProfile.mfa.authenticator") })
|
|
5939
6015
|
] }),
|
|
5940
|
-
!showDisable ? /* @__PURE__ */
|
|
6016
|
+
!showDisable ? /* @__PURE__ */ jsx38(
|
|
5941
6017
|
"button",
|
|
5942
6018
|
{
|
|
5943
6019
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -5945,11 +6021,11 @@ function MfaSection() {
|
|
|
5945
6021
|
onClick: () => setShowDisable(true),
|
|
5946
6022
|
children: required ? t("userProfile.mfa.replace") : t("userProfile.mfa.disable")
|
|
5947
6023
|
}
|
|
5948
|
-
) : /* @__PURE__ */
|
|
5949
|
-
/* @__PURE__ */
|
|
5950
|
-
/* @__PURE__ */
|
|
6024
|
+
) : /* @__PURE__ */ jsxs33("form", { method: "post", className: "ba-fields ba-profile-security-form", onSubmit: submitDisable, children: [
|
|
6025
|
+
/* @__PURE__ */ jsx38("p", { className: "ba-muted", children: required ? t("userProfile.mfa.replaceWarning") : t("userProfile.mfa.disableWarning") }),
|
|
6026
|
+
/* @__PURE__ */ jsxs33("label", { className: "ba-label", children: [
|
|
5951
6027
|
t("common.passwordLabel"),
|
|
5952
|
-
/* @__PURE__ */
|
|
6028
|
+
/* @__PURE__ */ jsx38(
|
|
5953
6029
|
"input",
|
|
5954
6030
|
{
|
|
5955
6031
|
className: "ba-input",
|
|
@@ -5961,19 +6037,19 @@ function MfaSection() {
|
|
|
5961
6037
|
}
|
|
5962
6038
|
)
|
|
5963
6039
|
] }),
|
|
5964
|
-
/* @__PURE__ */
|
|
5965
|
-
/* @__PURE__ */
|
|
5966
|
-
/* @__PURE__ */
|
|
6040
|
+
/* @__PURE__ */ jsx38(FormError, { children: error }),
|
|
6041
|
+
/* @__PURE__ */ jsxs33("span", { className: "ba-profile-action-row", children: [
|
|
6042
|
+
/* @__PURE__ */ jsx38(
|
|
5967
6043
|
"button",
|
|
5968
6044
|
{
|
|
5969
6045
|
className: "ba-button ba-danger-button",
|
|
5970
6046
|
type: "submit",
|
|
5971
6047
|
disabled: pending || !password,
|
|
5972
6048
|
"aria-busy": pending || void 0,
|
|
5973
|
-
children: /* @__PURE__ */
|
|
6049
|
+
children: /* @__PURE__ */ jsx38(Busy, { busy: pending, label: t("common.working"), children: required ? t("userProfile.mfa.replaceConfirm") : t("userProfile.mfa.disableConfirm") })
|
|
5974
6050
|
}
|
|
5975
6051
|
),
|
|
5976
|
-
/* @__PURE__ */
|
|
6052
|
+
/* @__PURE__ */ jsx38(
|
|
5977
6053
|
"button",
|
|
5978
6054
|
{
|
|
5979
6055
|
className: "ba-button ba-button-secondary",
|
|
@@ -5992,19 +6068,19 @@ function MfaSection() {
|
|
|
5992
6068
|
}
|
|
5993
6069
|
|
|
5994
6070
|
// src/components/user-profile/PasswordSection.tsx
|
|
5995
|
-
import * as
|
|
5996
|
-
import { jsx as
|
|
6071
|
+
import * as React31 from "react";
|
|
6072
|
+
import { jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
5997
6073
|
function PasswordSection() {
|
|
5998
6074
|
const t = useT();
|
|
5999
6075
|
const account = useAccount();
|
|
6000
6076
|
const { config } = usePublicConfig();
|
|
6001
6077
|
const { passwordMinLength, passwordMaxLength } = resolveProjectCapabilities(config);
|
|
6002
6078
|
const { pending, error, setError, run } = useSubmitAction();
|
|
6003
|
-
const [currentPassword, setCurrentPassword] =
|
|
6004
|
-
const [newPassword, setNewPassword] =
|
|
6005
|
-
const [confirmPassword, setConfirmPassword] =
|
|
6006
|
-
const [saved, setSaved] =
|
|
6007
|
-
const titleId =
|
|
6079
|
+
const [currentPassword, setCurrentPassword] = React31.useState("");
|
|
6080
|
+
const [newPassword, setNewPassword] = React31.useState("");
|
|
6081
|
+
const [confirmPassword, setConfirmPassword] = React31.useState("");
|
|
6082
|
+
const [saved, setSaved] = React31.useState(false);
|
|
6083
|
+
const titleId = React31.useId();
|
|
6008
6084
|
const submit = (event) => {
|
|
6009
6085
|
event.preventDefault();
|
|
6010
6086
|
setSaved(false);
|
|
@@ -6029,43 +6105,43 @@ function PasswordSection() {
|
|
|
6029
6105
|
}
|
|
6030
6106
|
);
|
|
6031
6107
|
};
|
|
6032
|
-
return /* @__PURE__ */
|
|
6033
|
-
/* @__PURE__ */
|
|
6034
|
-
/* @__PURE__ */
|
|
6035
|
-
/* @__PURE__ */
|
|
6108
|
+
return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6109
|
+
/* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
|
|
6110
|
+
/* @__PURE__ */ jsx39("h2", { id: titleId, className: "ba-title", children: t("userProfile.password.title") }),
|
|
6111
|
+
/* @__PURE__ */ jsx39("p", { className: "ba-muted", children: t("userProfile.password.description") })
|
|
6036
6112
|
] }),
|
|
6037
|
-
/* @__PURE__ */
|
|
6038
|
-
/* @__PURE__ */
|
|
6113
|
+
/* @__PURE__ */ jsxs34("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
6114
|
+
/* @__PURE__ */ jsxs34("label", { className: "ba-label", children: [
|
|
6039
6115
|
t("userProfile.password.currentLabel"),
|
|
6040
|
-
/* @__PURE__ */
|
|
6116
|
+
/* @__PURE__ */ jsx39("input", { className: "ba-input", type: "password", autoComplete: "current-password", value: currentPassword, onChange: (event) => {
|
|
6041
6117
|
setCurrentPassword(event.target.value);
|
|
6042
6118
|
setError(null);
|
|
6043
6119
|
}, required: true })
|
|
6044
6120
|
] }),
|
|
6045
|
-
/* @__PURE__ */
|
|
6121
|
+
/* @__PURE__ */ jsxs34("label", { className: "ba-label", children: [
|
|
6046
6122
|
t("resetPassword.newPasswordLabel"),
|
|
6047
|
-
/* @__PURE__ */
|
|
6123
|
+
/* @__PURE__ */ jsx39("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: newPassword, onChange: (event) => {
|
|
6048
6124
|
setNewPassword(event.target.value);
|
|
6049
6125
|
setError(null);
|
|
6050
6126
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
6051
6127
|
] }),
|
|
6052
|
-
/* @__PURE__ */
|
|
6128
|
+
/* @__PURE__ */ jsxs34("label", { className: "ba-label", children: [
|
|
6053
6129
|
t("resetPassword.confirmPasswordLabel"),
|
|
6054
|
-
/* @__PURE__ */
|
|
6130
|
+
/* @__PURE__ */ jsx39("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: confirmPassword, onChange: (event) => {
|
|
6055
6131
|
setConfirmPassword(event.target.value);
|
|
6056
6132
|
setError(null);
|
|
6057
6133
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
6058
6134
|
] }),
|
|
6059
|
-
/* @__PURE__ */
|
|
6060
|
-
saved && /* @__PURE__ */
|
|
6061
|
-
/* @__PURE__ */
|
|
6135
|
+
/* @__PURE__ */ jsx39(FormError, { children: error }),
|
|
6136
|
+
saved && /* @__PURE__ */ jsx39("p", { className: "ba-success", role: "status", children: t("userProfile.password.saved") }),
|
|
6137
|
+
/* @__PURE__ */ jsx39(
|
|
6062
6138
|
"button",
|
|
6063
6139
|
{
|
|
6064
6140
|
className: "ba-button ba-profile-submit",
|
|
6065
6141
|
type: "submit",
|
|
6066
6142
|
disabled: pending || !currentPassword || !newPassword || !confirmPassword,
|
|
6067
6143
|
"aria-busy": pending || void 0,
|
|
6068
|
-
children: /* @__PURE__ */
|
|
6144
|
+
children: /* @__PURE__ */ jsx39(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.password.submit") })
|
|
6069
6145
|
}
|
|
6070
6146
|
)
|
|
6071
6147
|
] })
|
|
@@ -6073,23 +6149,23 @@ function PasswordSection() {
|
|
|
6073
6149
|
}
|
|
6074
6150
|
|
|
6075
6151
|
// src/components/user-profile/PasskeysSection.tsx
|
|
6076
|
-
import * as
|
|
6077
|
-
import { jsx as
|
|
6152
|
+
import * as React32 from "react";
|
|
6153
|
+
import { jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
6078
6154
|
function PasskeysSection({ allowAdd }) {
|
|
6079
6155
|
const t = useT();
|
|
6080
|
-
const titleId =
|
|
6081
|
-
return /* @__PURE__ */
|
|
6082
|
-
/* @__PURE__ */
|
|
6083
|
-
/* @__PURE__ */
|
|
6084
|
-
/* @__PURE__ */
|
|
6156
|
+
const titleId = React32.useId();
|
|
6157
|
+
return /* @__PURE__ */ jsxs35("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6158
|
+
/* @__PURE__ */ jsxs35("header", { className: "ba-profile-section-header", children: [
|
|
6159
|
+
/* @__PURE__ */ jsx40("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
|
|
6160
|
+
/* @__PURE__ */ jsx40("p", { className: "ba-muted", children: t("userProfile.passkeys.description") })
|
|
6085
6161
|
] }),
|
|
6086
|
-
/* @__PURE__ */
|
|
6162
|
+
/* @__PURE__ */ jsx40(PasskeyManager, { title: null, allowAdd })
|
|
6087
6163
|
] });
|
|
6088
6164
|
}
|
|
6089
6165
|
|
|
6090
6166
|
// src/components/user-profile/ProfileSection.tsx
|
|
6091
|
-
import * as
|
|
6092
|
-
import { Fragment as Fragment12, jsx as
|
|
6167
|
+
import * as React33 from "react";
|
|
6168
|
+
import { Fragment as Fragment12, jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
6093
6169
|
function ProfileSection({
|
|
6094
6170
|
firstLastName,
|
|
6095
6171
|
usernameEnabled,
|
|
@@ -6100,15 +6176,15 @@ function ProfileSection({
|
|
|
6100
6176
|
const { user } = useUser();
|
|
6101
6177
|
const session = useSession();
|
|
6102
6178
|
const { pending, error, run } = useSubmitAction();
|
|
6103
|
-
const [name, setName] =
|
|
6104
|
-
const [firstName, setFirstName] =
|
|
6105
|
-
const [lastName, setLastName] =
|
|
6106
|
-
const [username, setUsername] =
|
|
6179
|
+
const [name, setName] = React33.useState(user?.name ?? "");
|
|
6180
|
+
const [firstName, setFirstName] = React33.useState(user?.firstName ?? "");
|
|
6181
|
+
const [lastName, setLastName] = React33.useState(user?.lastName ?? "");
|
|
6182
|
+
const [username, setUsername] = React33.useState(
|
|
6107
6183
|
user?.displayUsername ?? user?.username ?? ""
|
|
6108
6184
|
);
|
|
6109
|
-
const [image, setImage] =
|
|
6110
|
-
const [saved, setSaved] =
|
|
6111
|
-
const titleId =
|
|
6185
|
+
const [image, setImage] = React33.useState(user?.image ?? "");
|
|
6186
|
+
const [saved, setSaved] = React33.useState(false);
|
|
6187
|
+
const titleId = React33.useId();
|
|
6112
6188
|
const submit = (event) => {
|
|
6113
6189
|
event.preventDefault();
|
|
6114
6190
|
setSaved(false);
|
|
@@ -6131,15 +6207,15 @@ function ProfileSection({
|
|
|
6131
6207
|
}
|
|
6132
6208
|
);
|
|
6133
6209
|
};
|
|
6134
|
-
return /* @__PURE__ */
|
|
6135
|
-
/* @__PURE__ */
|
|
6136
|
-
/* @__PURE__ */
|
|
6137
|
-
/* @__PURE__ */
|
|
6210
|
+
return /* @__PURE__ */ jsxs36("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6211
|
+
/* @__PURE__ */ jsxs36("header", { className: "ba-profile-section-header", children: [
|
|
6212
|
+
/* @__PURE__ */ jsx41("h2", { id: titleId, className: "ba-title", children: t("userProfile.profile.title") }),
|
|
6213
|
+
/* @__PURE__ */ jsx41("p", { className: "ba-muted", children: t("userProfile.profile.description") })
|
|
6138
6214
|
] }),
|
|
6139
|
-
/* @__PURE__ */
|
|
6140
|
-
legacyNameField && /* @__PURE__ */
|
|
6215
|
+
/* @__PURE__ */ jsxs36("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
6216
|
+
legacyNameField && /* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
|
|
6141
6217
|
t("signUp.nameLabel"),
|
|
6142
|
-
/* @__PURE__ */
|
|
6218
|
+
/* @__PURE__ */ jsx41(
|
|
6143
6219
|
"input",
|
|
6144
6220
|
{
|
|
6145
6221
|
className: "ba-input",
|
|
@@ -6150,10 +6226,10 @@ function ProfileSection({
|
|
|
6150
6226
|
}
|
|
6151
6227
|
)
|
|
6152
6228
|
] }),
|
|
6153
|
-
firstLastName && /* @__PURE__ */
|
|
6154
|
-
/* @__PURE__ */
|
|
6229
|
+
firstLastName && /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
6230
|
+
/* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
|
|
6155
6231
|
t("signUp.firstNameLabel"),
|
|
6156
|
-
/* @__PURE__ */
|
|
6232
|
+
/* @__PURE__ */ jsx41(
|
|
6157
6233
|
"input",
|
|
6158
6234
|
{
|
|
6159
6235
|
className: "ba-input",
|
|
@@ -6163,9 +6239,9 @@ function ProfileSection({
|
|
|
6163
6239
|
}
|
|
6164
6240
|
)
|
|
6165
6241
|
] }),
|
|
6166
|
-
/* @__PURE__ */
|
|
6242
|
+
/* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
|
|
6167
6243
|
t("signUp.lastNameLabel"),
|
|
6168
|
-
/* @__PURE__ */
|
|
6244
|
+
/* @__PURE__ */ jsx41(
|
|
6169
6245
|
"input",
|
|
6170
6246
|
{
|
|
6171
6247
|
className: "ba-input",
|
|
@@ -6176,9 +6252,9 @@ function ProfileSection({
|
|
|
6176
6252
|
)
|
|
6177
6253
|
] })
|
|
6178
6254
|
] }),
|
|
6179
|
-
usernameEnabled && /* @__PURE__ */
|
|
6255
|
+
usernameEnabled && /* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
|
|
6180
6256
|
t("common.usernameLabel"),
|
|
6181
|
-
/* @__PURE__ */
|
|
6257
|
+
/* @__PURE__ */ jsx41(
|
|
6182
6258
|
"input",
|
|
6183
6259
|
{
|
|
6184
6260
|
className: "ba-input",
|
|
@@ -6188,9 +6264,9 @@ function ProfileSection({
|
|
|
6188
6264
|
}
|
|
6189
6265
|
)
|
|
6190
6266
|
] }),
|
|
6191
|
-
/* @__PURE__ */
|
|
6267
|
+
/* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
|
|
6192
6268
|
t("userProfile.profile.imageLabel"),
|
|
6193
|
-
/* @__PURE__ */
|
|
6269
|
+
/* @__PURE__ */ jsx41(
|
|
6194
6270
|
"input",
|
|
6195
6271
|
{
|
|
6196
6272
|
className: "ba-input",
|
|
@@ -6201,16 +6277,16 @@ function ProfileSection({
|
|
|
6201
6277
|
}
|
|
6202
6278
|
)
|
|
6203
6279
|
] }),
|
|
6204
|
-
/* @__PURE__ */
|
|
6205
|
-
saved && /* @__PURE__ */
|
|
6206
|
-
/* @__PURE__ */
|
|
6280
|
+
/* @__PURE__ */ jsx41(FormError, { children: error }),
|
|
6281
|
+
saved && /* @__PURE__ */ jsx41("p", { className: "ba-success", role: "status", children: t("userProfile.profile.saved") }),
|
|
6282
|
+
/* @__PURE__ */ jsx41(
|
|
6207
6283
|
"button",
|
|
6208
6284
|
{
|
|
6209
6285
|
className: "ba-button ba-profile-submit",
|
|
6210
6286
|
type: "submit",
|
|
6211
6287
|
disabled: pending || legacyNameField && !name.trim(),
|
|
6212
6288
|
"aria-busy": pending || void 0,
|
|
6213
|
-
children: /* @__PURE__ */
|
|
6289
|
+
children: /* @__PURE__ */ jsx41(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.save") })
|
|
6214
6290
|
}
|
|
6215
6291
|
)
|
|
6216
6292
|
] })
|
|
@@ -6218,30 +6294,30 @@ function ProfileSection({
|
|
|
6218
6294
|
}
|
|
6219
6295
|
|
|
6220
6296
|
// src/components/user-profile/RecoverySection.tsx
|
|
6221
|
-
import * as
|
|
6222
|
-
import { Fragment as Fragment13, jsx as
|
|
6297
|
+
import * as React34 from "react";
|
|
6298
|
+
import { Fragment as Fragment13, jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
6223
6299
|
function RecoverySection() {
|
|
6224
6300
|
const t = useT();
|
|
6225
6301
|
const { user } = useUser();
|
|
6226
|
-
const titleId =
|
|
6227
|
-
return /* @__PURE__ */
|
|
6228
|
-
/* @__PURE__ */
|
|
6229
|
-
/* @__PURE__ */
|
|
6230
|
-
/* @__PURE__ */
|
|
6302
|
+
const titleId = React34.useId();
|
|
6303
|
+
return /* @__PURE__ */ jsxs37("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6304
|
+
/* @__PURE__ */ jsxs37("header", { className: "ba-profile-section-header", children: [
|
|
6305
|
+
/* @__PURE__ */ jsx42("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
|
|
6306
|
+
/* @__PURE__ */ jsx42("p", { className: "ba-muted", children: t("userProfile.recovery.description") })
|
|
6231
6307
|
] }),
|
|
6232
|
-
/* @__PURE__ */
|
|
6233
|
-
/* @__PURE__ */
|
|
6234
|
-
user?.email && user.emailVerified ? /* @__PURE__ */
|
|
6235
|
-
/* @__PURE__ */
|
|
6236
|
-
/* @__PURE__ */
|
|
6237
|
-
] }) : /* @__PURE__ */
|
|
6308
|
+
/* @__PURE__ */ jsxs37("div", { className: "ba-profile-recovery-card", children: [
|
|
6309
|
+
/* @__PURE__ */ jsx42("strong", { children: t("userProfile.recovery.emailTitle") }),
|
|
6310
|
+
user?.email && user.emailVerified ? /* @__PURE__ */ jsxs37(Fragment13, { children: [
|
|
6311
|
+
/* @__PURE__ */ jsx42("p", { children: t("userProfile.recovery.emailDescription") }),
|
|
6312
|
+
/* @__PURE__ */ jsx42(Bidi, { children: user.email })
|
|
6313
|
+
] }) : /* @__PURE__ */ jsx42("p", { children: t("userProfile.recovery.emailUnavailable") })
|
|
6238
6314
|
] }),
|
|
6239
|
-
/* @__PURE__ */
|
|
6315
|
+
/* @__PURE__ */ jsx42(BackupCodesManager, { title: null })
|
|
6240
6316
|
] });
|
|
6241
6317
|
}
|
|
6242
6318
|
|
|
6243
6319
|
// src/components/user-profile/SessionsSection.tsx
|
|
6244
|
-
import * as
|
|
6320
|
+
import * as React36 from "react";
|
|
6245
6321
|
|
|
6246
6322
|
// src/components/user-profile/model.ts
|
|
6247
6323
|
var USER_PROFILE_SECTIONS = [
|
|
@@ -6288,18 +6364,18 @@ function formatSessionTime(date, locale) {
|
|
|
6288
6364
|
}
|
|
6289
6365
|
|
|
6290
6366
|
// src/components/user-profile/use-account-resource.ts
|
|
6291
|
-
import * as
|
|
6367
|
+
import * as React35 from "react";
|
|
6292
6368
|
function useAccountResource(loader2, failure) {
|
|
6293
|
-
const loaderRef =
|
|
6369
|
+
const loaderRef = React35.useRef(loader2);
|
|
6294
6370
|
loaderRef.current = loader2;
|
|
6295
|
-
const failureRef =
|
|
6371
|
+
const failureRef = React35.useRef(failure);
|
|
6296
6372
|
failureRef.current = failure;
|
|
6297
6373
|
const toServerError = useServerError();
|
|
6298
|
-
const [data, setData] =
|
|
6299
|
-
const [error, setError] =
|
|
6300
|
-
const [loading, setLoading] =
|
|
6301
|
-
const requestRef =
|
|
6302
|
-
const load =
|
|
6374
|
+
const [data, setData] = React35.useState(null);
|
|
6375
|
+
const [error, setError] = React35.useState(null);
|
|
6376
|
+
const [loading, setLoading] = React35.useState(true);
|
|
6377
|
+
const requestRef = React35.useRef(0);
|
|
6378
|
+
const load = React35.useCallback(async () => {
|
|
6303
6379
|
const request = ++requestRef.current;
|
|
6304
6380
|
setLoading(true);
|
|
6305
6381
|
try {
|
|
@@ -6318,7 +6394,7 @@ function useAccountResource(loader2, failure) {
|
|
|
6318
6394
|
if (request === requestRef.current) setLoading(false);
|
|
6319
6395
|
}
|
|
6320
6396
|
}, [toServerError]);
|
|
6321
|
-
|
|
6397
|
+
React35.useEffect(() => {
|
|
6322
6398
|
void load();
|
|
6323
6399
|
return () => {
|
|
6324
6400
|
requestRef.current += 1;
|
|
@@ -6328,14 +6404,14 @@ function useAccountResource(loader2, failure) {
|
|
|
6328
6404
|
}
|
|
6329
6405
|
|
|
6330
6406
|
// src/components/user-profile/SessionsSection.tsx
|
|
6331
|
-
import { jsx as
|
|
6407
|
+
import { jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
6332
6408
|
function SessionsSection() {
|
|
6333
6409
|
const t = useT();
|
|
6334
6410
|
const locale = useLocale();
|
|
6335
6411
|
const account = useAccount();
|
|
6336
6412
|
const sessionState = useSession();
|
|
6337
6413
|
const mutation = useSubmitAction();
|
|
6338
|
-
const titleId =
|
|
6414
|
+
const titleId = React36.useId();
|
|
6339
6415
|
const resource = useAccountResource(
|
|
6340
6416
|
() => account.listSessions(),
|
|
6341
6417
|
t("userProfile.sessions.loadError")
|
|
@@ -6357,31 +6433,31 @@ function SessionsSection() {
|
|
|
6357
6433
|
}
|
|
6358
6434
|
);
|
|
6359
6435
|
};
|
|
6360
|
-
return /* @__PURE__ */
|
|
6361
|
-
/* @__PURE__ */
|
|
6362
|
-
/* @__PURE__ */
|
|
6363
|
-
/* @__PURE__ */
|
|
6436
|
+
return /* @__PURE__ */ jsxs38("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6437
|
+
/* @__PURE__ */ jsxs38("header", { className: "ba-profile-section-header", children: [
|
|
6438
|
+
/* @__PURE__ */ jsx43("h2", { id: titleId, className: "ba-title", children: t("userProfile.sessions.title") }),
|
|
6439
|
+
/* @__PURE__ */ jsx43("p", { className: "ba-muted", children: t("userProfile.sessions.description") })
|
|
6364
6440
|
] }),
|
|
6365
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */
|
|
6366
|
-
/* @__PURE__ */
|
|
6367
|
-
/* @__PURE__ */
|
|
6368
|
-
] }) : null : /* @__PURE__ */
|
|
6441
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ jsxs38("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: [
|
|
6442
|
+
/* @__PURE__ */ jsx43("div", { className: "ba-skeleton" }),
|
|
6443
|
+
/* @__PURE__ */ jsx43("div", { className: "ba-skeleton" })
|
|
6444
|
+
] }) : null : /* @__PURE__ */ jsxs38("ul", { className: "ba-profile-list", children: [
|
|
6369
6445
|
sessions.map((session) => {
|
|
6370
6446
|
const label2 = session.userAgent?.trim() || t("userProfile.sessions.unknownDevice");
|
|
6371
|
-
return /* @__PURE__ */
|
|
6372
|
-
/* @__PURE__ */
|
|
6373
|
-
/* @__PURE__ */
|
|
6374
|
-
/* @__PURE__ */
|
|
6375
|
-
session.id === currentId && /* @__PURE__ */
|
|
6447
|
+
return /* @__PURE__ */ jsxs38("li", { className: "ba-profile-list-item", children: [
|
|
6448
|
+
/* @__PURE__ */ jsxs38("span", { children: [
|
|
6449
|
+
/* @__PURE__ */ jsx43("strong", { children: label2 }),
|
|
6450
|
+
/* @__PURE__ */ jsxs38("small", { children: [
|
|
6451
|
+
session.id === currentId && /* @__PURE__ */ jsx43("em", { children: t("userProfile.sessions.current") }),
|
|
6376
6452
|
formatSessionTime(session.updatedAt, locale)
|
|
6377
6453
|
] })
|
|
6378
6454
|
] }),
|
|
6379
|
-
/* @__PURE__ */
|
|
6455
|
+
/* @__PURE__ */ jsx43("button", { className: "ba-link-button ba-danger", type: "button", disabled: mutation.pending, onClick: () => revoke(session.id, label2), children: t("userProfile.sessions.revoke") })
|
|
6380
6456
|
] }, session.id);
|
|
6381
6457
|
}),
|
|
6382
|
-
sessions.length === 0 && /* @__PURE__ */
|
|
6458
|
+
sessions.length === 0 && /* @__PURE__ */ jsx43("li", { className: "ba-muted", children: t("userProfile.sessions.empty") })
|
|
6383
6459
|
] }),
|
|
6384
|
-
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */
|
|
6460
|
+
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ jsx43(
|
|
6385
6461
|
"button",
|
|
6386
6462
|
{
|
|
6387
6463
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -6397,17 +6473,17 @@ function SessionsSection() {
|
|
|
6397
6473
|
children: t("userProfile.sessions.revokeOthers")
|
|
6398
6474
|
}
|
|
6399
6475
|
),
|
|
6400
|
-
resource.error && /* @__PURE__ */
|
|
6401
|
-
/* @__PURE__ */
|
|
6402
|
-
/* @__PURE__ */
|
|
6476
|
+
resource.error && /* @__PURE__ */ jsxs38("div", { className: "ba-profile-inline-error", children: [
|
|
6477
|
+
/* @__PURE__ */ jsx43(FormError, { children: resource.error }),
|
|
6478
|
+
/* @__PURE__ */ jsx43("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
6403
6479
|
] }),
|
|
6404
|
-
/* @__PURE__ */
|
|
6480
|
+
/* @__PURE__ */ jsx43(FormError, { children: mutation.error })
|
|
6405
6481
|
] });
|
|
6406
6482
|
}
|
|
6407
6483
|
|
|
6408
6484
|
// src/components/user-profile/SocialSection.tsx
|
|
6409
|
-
import * as
|
|
6410
|
-
import { jsx as
|
|
6485
|
+
import * as React37 from "react";
|
|
6486
|
+
import { jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
6411
6487
|
function providerLabel(provider) {
|
|
6412
6488
|
return provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
6413
6489
|
}
|
|
@@ -6416,7 +6492,7 @@ function SocialSection() {
|
|
|
6416
6492
|
const account = useAccount();
|
|
6417
6493
|
const { config } = usePublicConfig();
|
|
6418
6494
|
const mutation = useSubmitAction();
|
|
6419
|
-
const titleId =
|
|
6495
|
+
const titleId = React37.useId();
|
|
6420
6496
|
const resource = useAccountResource(
|
|
6421
6497
|
() => account.listSocialAccounts(),
|
|
6422
6498
|
t("userProfile.social.loadError")
|
|
@@ -6447,18 +6523,18 @@ function SocialSection() {
|
|
|
6447
6523
|
{ failure: t("userProfile.social.unlinkError"), onSuccess: resource.load }
|
|
6448
6524
|
);
|
|
6449
6525
|
};
|
|
6450
|
-
return /* @__PURE__ */
|
|
6451
|
-
/* @__PURE__ */
|
|
6452
|
-
/* @__PURE__ */
|
|
6453
|
-
/* @__PURE__ */
|
|
6526
|
+
return /* @__PURE__ */ jsxs39("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6527
|
+
/* @__PURE__ */ jsxs39("header", { className: "ba-profile-section-header", children: [
|
|
6528
|
+
/* @__PURE__ */ jsx44("h2", { id: titleId, className: "ba-title", children: t("userProfile.social.title") }),
|
|
6529
|
+
/* @__PURE__ */ jsx44("p", { className: "ba-muted", children: t("userProfile.social.description") })
|
|
6454
6530
|
] }),
|
|
6455
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */
|
|
6456
|
-
linked.map((item) => /* @__PURE__ */
|
|
6457
|
-
/* @__PURE__ */
|
|
6458
|
-
/* @__PURE__ */
|
|
6459
|
-
/* @__PURE__ */
|
|
6531
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ jsx44("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: /* @__PURE__ */ jsx44("div", { className: "ba-skeleton" }) }) : null : /* @__PURE__ */ jsxs39("ul", { className: "ba-profile-list", children: [
|
|
6532
|
+
linked.map((item) => /* @__PURE__ */ jsxs39("li", { className: "ba-profile-list-item", children: [
|
|
6533
|
+
/* @__PURE__ */ jsxs39("span", { children: [
|
|
6534
|
+
/* @__PURE__ */ jsx44("strong", { children: providerLabel(item.providerId) }),
|
|
6535
|
+
/* @__PURE__ */ jsx44("small", { children: item.canUnlink ? t("userProfile.social.connected") : t("userProfile.social.lastMethod") })
|
|
6460
6536
|
] }),
|
|
6461
|
-
/* @__PURE__ */
|
|
6537
|
+
/* @__PURE__ */ jsx44(
|
|
6462
6538
|
"button",
|
|
6463
6539
|
{
|
|
6464
6540
|
className: "ba-link-button ba-danger",
|
|
@@ -6473,26 +6549,26 @@ function SocialSection() {
|
|
|
6473
6549
|
}
|
|
6474
6550
|
)
|
|
6475
6551
|
] }, item.id)),
|
|
6476
|
-
linked.length === 0 && /* @__PURE__ */
|
|
6552
|
+
linked.length === 0 && /* @__PURE__ */ jsx44("li", { className: "ba-muted", children: t("userProfile.social.empty") })
|
|
6477
6553
|
] }),
|
|
6478
|
-
available.length > 0 && /* @__PURE__ */
|
|
6479
|
-
/* @__PURE__ */
|
|
6480
|
-
available.map((provider) => /* @__PURE__ */
|
|
6554
|
+
available.length > 0 && /* @__PURE__ */ jsxs39("div", { className: "ba-profile-provider-actions", children: [
|
|
6555
|
+
/* @__PURE__ */ jsx44("p", { className: "ba-profile-subtitle", children: t("userProfile.social.add") }),
|
|
6556
|
+
available.map((provider) => /* @__PURE__ */ jsx44("button", { type: "button", className: "ba-button ba-button-secondary", disabled: mutation.pending, onClick: () => link(provider), children: t("userProfile.social.connectProvider", { provider: providerLabel(provider) }) }, provider))
|
|
6481
6557
|
] }),
|
|
6482
|
-
resource.error && /* @__PURE__ */
|
|
6483
|
-
/* @__PURE__ */
|
|
6484
|
-
/* @__PURE__ */
|
|
6558
|
+
resource.error && /* @__PURE__ */ jsxs39("div", { className: "ba-profile-inline-error", children: [
|
|
6559
|
+
/* @__PURE__ */ jsx44(FormError, { children: resource.error }),
|
|
6560
|
+
/* @__PURE__ */ jsx44("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
6485
6561
|
] }),
|
|
6486
|
-
/* @__PURE__ */
|
|
6562
|
+
/* @__PURE__ */ jsx44(FormError, { children: mutation.error })
|
|
6487
6563
|
] });
|
|
6488
6564
|
}
|
|
6489
6565
|
|
|
6490
6566
|
// src/components/user-profile/UserProfileModal.tsx
|
|
6491
|
-
import * as
|
|
6567
|
+
import * as React39 from "react";
|
|
6492
6568
|
|
|
6493
6569
|
// src/components/ModalSurface.tsx
|
|
6494
|
-
import * as
|
|
6495
|
-
import { jsx as
|
|
6570
|
+
import * as React38 from "react";
|
|
6571
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
6496
6572
|
function ModalSurface({
|
|
6497
6573
|
overlayClassName,
|
|
6498
6574
|
panelClassName,
|
|
@@ -6502,12 +6578,12 @@ function ModalSurface({
|
|
|
6502
6578
|
onClose,
|
|
6503
6579
|
children
|
|
6504
6580
|
}) {
|
|
6505
|
-
const panelRef =
|
|
6506
|
-
const onCloseRef =
|
|
6507
|
-
const returnFocusRefRef =
|
|
6581
|
+
const panelRef = React38.useRef(null);
|
|
6582
|
+
const onCloseRef = React38.useRef(onClose);
|
|
6583
|
+
const returnFocusRefRef = React38.useRef(returnFocusRef);
|
|
6508
6584
|
onCloseRef.current = onClose;
|
|
6509
6585
|
returnFocusRefRef.current = returnFocusRef;
|
|
6510
|
-
|
|
6586
|
+
React38.useEffect(() => {
|
|
6511
6587
|
const previousFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
6512
6588
|
const previousOverflow = document.body.style.overflow;
|
|
6513
6589
|
document.body.style.overflow = "hidden";
|
|
@@ -6540,9 +6616,9 @@ function ModalSurface({
|
|
|
6540
6616
|
window.setTimeout(() => returnTarget?.focus(), 0);
|
|
6541
6617
|
};
|
|
6542
6618
|
}, []);
|
|
6543
|
-
return /* @__PURE__ */
|
|
6619
|
+
return /* @__PURE__ */ jsx45("div", { className: overlayClassName, role: "presentation", onMouseDown: (event) => {
|
|
6544
6620
|
if (event.target === event.currentTarget) onClose();
|
|
6545
|
-
}, children: /* @__PURE__ */
|
|
6621
|
+
}, children: /* @__PURE__ */ jsx45(
|
|
6546
6622
|
"div",
|
|
6547
6623
|
{
|
|
6548
6624
|
ref: panelRef,
|
|
@@ -6557,14 +6633,15 @@ function ModalSurface({
|
|
|
6557
6633
|
}
|
|
6558
6634
|
|
|
6559
6635
|
// src/components/user-profile/UserProfileModal.tsx
|
|
6560
|
-
import { jsx as
|
|
6636
|
+
import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
6561
6637
|
function UserProfileModal({
|
|
6562
6638
|
children,
|
|
6563
|
-
onClose
|
|
6639
|
+
onClose,
|
|
6640
|
+
branding
|
|
6564
6641
|
}) {
|
|
6565
6642
|
const t = useT();
|
|
6566
|
-
const titleId =
|
|
6567
|
-
return /* @__PURE__ */
|
|
6643
|
+
const titleId = React39.useId();
|
|
6644
|
+
return /* @__PURE__ */ jsxs40(
|
|
6568
6645
|
ModalSurface,
|
|
6569
6646
|
{
|
|
6570
6647
|
overlayClassName: "ba-profile-overlay",
|
|
@@ -6573,12 +6650,13 @@ function UserProfileModal({
|
|
|
6573
6650
|
testId: "user-profile-modal",
|
|
6574
6651
|
onClose,
|
|
6575
6652
|
children: [
|
|
6576
|
-
/* @__PURE__ */
|
|
6577
|
-
/* @__PURE__ */
|
|
6578
|
-
|
|
6579
|
-
/* @__PURE__ */
|
|
6653
|
+
/* @__PURE__ */ jsxs40("header", { className: "ba-profile-modal-header", children: [
|
|
6654
|
+
/* @__PURE__ */ jsxs40("span", { children: [
|
|
6655
|
+
branding,
|
|
6656
|
+
/* @__PURE__ */ jsx46("h1", { id: titleId, children: t("userProfile.title") }),
|
|
6657
|
+
/* @__PURE__ */ jsx46("p", { children: t("userProfile.description") })
|
|
6580
6658
|
] }),
|
|
6581
|
-
/* @__PURE__ */
|
|
6659
|
+
/* @__PURE__ */ jsx46(
|
|
6582
6660
|
"button",
|
|
6583
6661
|
{
|
|
6584
6662
|
type: "button",
|
|
@@ -6586,7 +6664,7 @@ function UserProfileModal({
|
|
|
6586
6664
|
"aria-label": t("userProfile.close"),
|
|
6587
6665
|
onClick: onClose,
|
|
6588
6666
|
autoFocus: true,
|
|
6589
|
-
children: /* @__PURE__ */
|
|
6667
|
+
children: /* @__PURE__ */ jsx46("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx46(
|
|
6590
6668
|
"path",
|
|
6591
6669
|
{
|
|
6592
6670
|
d: "M6 6l12 12M18 6L6 18",
|
|
@@ -6599,14 +6677,14 @@ function UserProfileModal({
|
|
|
6599
6677
|
)
|
|
6600
6678
|
] }),
|
|
6601
6679
|
children,
|
|
6602
|
-
/* @__PURE__ */
|
|
6680
|
+
/* @__PURE__ */ jsx46("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx46(AuthOwlBadge, {}) })
|
|
6603
6681
|
]
|
|
6604
6682
|
}
|
|
6605
6683
|
);
|
|
6606
6684
|
}
|
|
6607
6685
|
|
|
6608
6686
|
// src/components/UserProfile.tsx
|
|
6609
|
-
import { jsx as
|
|
6687
|
+
import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
6610
6688
|
var SECTION_KEYS = {
|
|
6611
6689
|
profile: "userProfile.nav.profile",
|
|
6612
6690
|
email: "userProfile.nav.email",
|
|
@@ -6628,13 +6706,14 @@ function UserProfile(props = {}) {
|
|
|
6628
6706
|
section,
|
|
6629
6707
|
defaultSection,
|
|
6630
6708
|
onSectionChange,
|
|
6631
|
-
onDeleted
|
|
6709
|
+
onDeleted,
|
|
6710
|
+
showBranding = true
|
|
6632
6711
|
} = props;
|
|
6633
6712
|
const mode = props.mode ?? "page";
|
|
6634
6713
|
const t = useT();
|
|
6635
6714
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
6636
6715
|
const { config } = usePublicConfig();
|
|
6637
|
-
const [internalSection, setInternalSection] =
|
|
6716
|
+
const [internalSection, setInternalSection] = React40.useState(() => initialSection(defaultSection));
|
|
6638
6717
|
const active = section ?? internalSection;
|
|
6639
6718
|
const capabilities = resolveProjectCapabilities(config);
|
|
6640
6719
|
const passwordEnabled = config !== null && capabilities.passwordSignIn;
|
|
@@ -6643,7 +6722,7 @@ function UserProfile(props = {}) {
|
|
|
6643
6722
|
const recoveryEnabled = capabilities.backupCodes && user?.twoFactorEnabled === true;
|
|
6644
6723
|
const deletionEnabled = capabilities.accountDeletion;
|
|
6645
6724
|
const socialEnabled = (config?.socialProviders?.length ?? 0) > 0;
|
|
6646
|
-
const sections =
|
|
6725
|
+
const sections = React40.useMemo(
|
|
6647
6726
|
() => userProfileSectionsFor({
|
|
6648
6727
|
password: passwordEnabled,
|
|
6649
6728
|
passkeys: passkeysEnabled,
|
|
@@ -6654,7 +6733,7 @@ function UserProfile(props = {}) {
|
|
|
6654
6733
|
}),
|
|
6655
6734
|
[deletionEnabled, mfaEnabled, passkeysEnabled, passwordEnabled, recoveryEnabled, socialEnabled]
|
|
6656
6735
|
);
|
|
6657
|
-
|
|
6736
|
+
React40.useEffect(() => {
|
|
6658
6737
|
if (section || mode !== "page") return;
|
|
6659
6738
|
const onHashChange = () => {
|
|
6660
6739
|
const next = userProfileSectionFromHash(window.location.hash);
|
|
@@ -6671,11 +6750,11 @@ function UserProfile(props = {}) {
|
|
|
6671
6750
|
window.history.replaceState(null, "", userProfileSectionHash(next));
|
|
6672
6751
|
}
|
|
6673
6752
|
};
|
|
6674
|
-
const content = !isLoaded ? /* @__PURE__ */
|
|
6675
|
-
/* @__PURE__ */
|
|
6676
|
-
/* @__PURE__ */
|
|
6677
|
-
/* @__PURE__ */
|
|
6678
|
-
] }) : !isSignedIn || !user ? /* @__PURE__ */
|
|
6753
|
+
const content = !isLoaded ? /* @__PURE__ */ jsxs41("div", { className: "ba-profile-loading", "aria-busy": "true", children: [
|
|
6754
|
+
/* @__PURE__ */ jsx47("div", { className: "ba-skeleton" }),
|
|
6755
|
+
/* @__PURE__ */ jsx47("div", { className: "ba-skeleton" }),
|
|
6756
|
+
/* @__PURE__ */ jsx47("div", { className: "ba-skeleton" })
|
|
6757
|
+
] }) : !isSignedIn || !user ? /* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("userProfile.signedOut") }) : /* @__PURE__ */ jsx47(
|
|
6679
6758
|
UserProfileBody,
|
|
6680
6759
|
{
|
|
6681
6760
|
active: visibleActive,
|
|
@@ -6687,15 +6766,23 @@ function UserProfile(props = {}) {
|
|
|
6687
6766
|
user.id
|
|
6688
6767
|
);
|
|
6689
6768
|
if (props.mode === "modal") {
|
|
6690
|
-
return /* @__PURE__ */
|
|
6769
|
+
return /* @__PURE__ */ jsx47(
|
|
6770
|
+
UserProfileModal,
|
|
6771
|
+
{
|
|
6772
|
+
onClose: props.onClose,
|
|
6773
|
+
branding: showBranding ? /* @__PURE__ */ jsx47(AuthOwlBranding, {}) : null,
|
|
6774
|
+
children: content
|
|
6775
|
+
}
|
|
6776
|
+
);
|
|
6691
6777
|
}
|
|
6692
|
-
return /* @__PURE__ */
|
|
6693
|
-
/* @__PURE__ */
|
|
6694
|
-
/* @__PURE__ */
|
|
6695
|
-
/* @__PURE__ */
|
|
6778
|
+
return /* @__PURE__ */ jsxs41("article", { className: "ba-profile ba-profile-page", "data-testid": "user-profile", children: [
|
|
6779
|
+
/* @__PURE__ */ jsxs41("header", { className: "ba-profile-heading", children: [
|
|
6780
|
+
showBranding ? /* @__PURE__ */ jsx47(AuthOwlBranding, {}) : null,
|
|
6781
|
+
/* @__PURE__ */ jsx47("h1", { children: t("userProfile.title") }),
|
|
6782
|
+
/* @__PURE__ */ jsx47("p", { children: t("userProfile.description") })
|
|
6696
6783
|
] }),
|
|
6697
6784
|
content,
|
|
6698
|
-
/* @__PURE__ */
|
|
6785
|
+
/* @__PURE__ */ jsx47("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx47(AuthOwlBadge, {}) })
|
|
6699
6786
|
] });
|
|
6700
6787
|
}
|
|
6701
6788
|
function UserProfileBody({
|
|
@@ -6706,8 +6793,8 @@ function UserProfileBody({
|
|
|
6706
6793
|
capabilities
|
|
6707
6794
|
}) {
|
|
6708
6795
|
const t = useT();
|
|
6709
|
-
return /* @__PURE__ */
|
|
6710
|
-
/* @__PURE__ */
|
|
6796
|
+
return /* @__PURE__ */ jsxs41("div", { className: "ba-profile-layout", children: [
|
|
6797
|
+
/* @__PURE__ */ jsx47("nav", { className: "ba-profile-nav", "aria-label": t("userProfile.nav.aria"), children: sections.map((item) => /* @__PURE__ */ jsx47(
|
|
6711
6798
|
"button",
|
|
6712
6799
|
{
|
|
6713
6800
|
type: "button",
|
|
@@ -6718,8 +6805,8 @@ function UserProfileBody({
|
|
|
6718
6805
|
},
|
|
6719
6806
|
item
|
|
6720
6807
|
)) }),
|
|
6721
|
-
/* @__PURE__ */
|
|
6722
|
-
active === "profile" && /* @__PURE__ */
|
|
6808
|
+
/* @__PURE__ */ jsxs41("div", { className: "ba-profile-content", "data-section": active, children: [
|
|
6809
|
+
active === "profile" && /* @__PURE__ */ jsx47(
|
|
6723
6810
|
ProfileSection,
|
|
6724
6811
|
{
|
|
6725
6812
|
firstLastName: capabilities.firstLastName,
|
|
@@ -6727,43 +6814,43 @@ function UserProfileBody({
|
|
|
6727
6814
|
legacyNameField: capabilities.legacyNameField
|
|
6728
6815
|
}
|
|
6729
6816
|
),
|
|
6730
|
-
active === "email" && /* @__PURE__ */
|
|
6731
|
-
active === "password" && /* @__PURE__ */
|
|
6732
|
-
active === "social" && /* @__PURE__ */
|
|
6733
|
-
active === "sessions" && /* @__PURE__ */
|
|
6734
|
-
active === "passkeys" && /* @__PURE__ */
|
|
6735
|
-
active === "mfa" && /* @__PURE__ */
|
|
6736
|
-
active === "recovery" && /* @__PURE__ */
|
|
6737
|
-
active === "danger" && /* @__PURE__ */
|
|
6817
|
+
active === "email" && /* @__PURE__ */ jsx47(EmailSection, { allowChange: capabilities.emailChange }),
|
|
6818
|
+
active === "password" && /* @__PURE__ */ jsx47(PasswordSection, {}),
|
|
6819
|
+
active === "social" && /* @__PURE__ */ jsx47(SocialSection, {}),
|
|
6820
|
+
active === "sessions" && /* @__PURE__ */ jsx47(SessionsSection, {}),
|
|
6821
|
+
active === "passkeys" && /* @__PURE__ */ jsx47(PasskeysSection, { allowAdd: capabilities.passkeyAdd }),
|
|
6822
|
+
active === "mfa" && /* @__PURE__ */ jsx47(MfaSection, {}),
|
|
6823
|
+
active === "recovery" && /* @__PURE__ */ jsx47(RecoverySection, {}),
|
|
6824
|
+
active === "danger" && /* @__PURE__ */ jsx47(DeleteAccountSection, { onDeleted })
|
|
6738
6825
|
] })
|
|
6739
6826
|
] });
|
|
6740
6827
|
}
|
|
6741
6828
|
|
|
6742
6829
|
// src/components/UserButton.tsx
|
|
6743
|
-
import { jsx as
|
|
6830
|
+
import { jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
6744
6831
|
function UserButton() {
|
|
6745
6832
|
const t = useT();
|
|
6746
6833
|
const { user, isLoaded } = useUser();
|
|
6747
6834
|
const { signOut } = useSignOut();
|
|
6748
|
-
const [open, setOpen] =
|
|
6749
|
-
const [profileOpen, setProfileOpen] =
|
|
6750
|
-
const triggerRef =
|
|
6835
|
+
const [open, setOpen] = React41.useState(false);
|
|
6836
|
+
const [profileOpen, setProfileOpen] = React41.useState(false);
|
|
6837
|
+
const triggerRef = React41.useRef(null);
|
|
6751
6838
|
if (!isLoaded || !user) return null;
|
|
6752
6839
|
const identity = user.email ?? user.phoneNumber ?? user.name ?? "?";
|
|
6753
|
-
return /* @__PURE__ */
|
|
6754
|
-
/* @__PURE__ */
|
|
6840
|
+
return /* @__PURE__ */ jsxs42("div", { className: "ba-user-button", "data-testid": "user-button", children: [
|
|
6841
|
+
/* @__PURE__ */ jsx48(
|
|
6755
6842
|
"button",
|
|
6756
6843
|
{
|
|
6757
6844
|
ref: triggerRef,
|
|
6758
6845
|
className: "ba-user-button-trigger",
|
|
6759
6846
|
"aria-label": t("userButton.openMenuAria"),
|
|
6760
6847
|
onClick: () => setOpen((v) => !v),
|
|
6761
|
-
children: user.image ? /* @__PURE__ */
|
|
6848
|
+
children: user.image ? /* @__PURE__ */ jsx48("img", { className: "ba-avatar", src: user.image, alt: "" }) : /* @__PURE__ */ jsx48("span", { className: "ba-avatar ba-avatar-fallback", children: identity[0]?.toUpperCase() })
|
|
6762
6849
|
}
|
|
6763
6850
|
),
|
|
6764
|
-
open && /* @__PURE__ */
|
|
6765
|
-
/* @__PURE__ */
|
|
6766
|
-
/* @__PURE__ */
|
|
6851
|
+
open && /* @__PURE__ */ jsxs42("div", { className: "ba-menu", children: [
|
|
6852
|
+
/* @__PURE__ */ jsx48("p", { className: "ba-menu-label", children: identity }),
|
|
6853
|
+
/* @__PURE__ */ jsx48(
|
|
6767
6854
|
"button",
|
|
6768
6855
|
{
|
|
6769
6856
|
className: "ba-menu-item",
|
|
@@ -6774,10 +6861,10 @@ function UserButton() {
|
|
|
6774
6861
|
children: t("userButton.manageAccount")
|
|
6775
6862
|
}
|
|
6776
6863
|
),
|
|
6777
|
-
/* @__PURE__ */
|
|
6778
|
-
/* @__PURE__ */
|
|
6864
|
+
/* @__PURE__ */ jsx48("button", { className: "ba-menu-item", onClick: () => signOut(), children: t("userButton.signOut") }),
|
|
6865
|
+
/* @__PURE__ */ jsx48("div", { className: "ba-menu-badge", children: /* @__PURE__ */ jsx48(AuthOwlBadge, {}) })
|
|
6779
6866
|
] }),
|
|
6780
|
-
profileOpen && /* @__PURE__ */
|
|
6867
|
+
profileOpen && /* @__PURE__ */ jsx48(
|
|
6781
6868
|
UserProfile,
|
|
6782
6869
|
{
|
|
6783
6870
|
mode: "modal",
|
|
@@ -6793,10 +6880,10 @@ function UserButton() {
|
|
|
6793
6880
|
}
|
|
6794
6881
|
|
|
6795
6882
|
// src/components/OrganizationSwitcher.tsx
|
|
6796
|
-
import * as
|
|
6883
|
+
import * as React50 from "react";
|
|
6797
6884
|
|
|
6798
6885
|
// src/components/CreateOrganization.tsx
|
|
6799
|
-
import * as
|
|
6886
|
+
import * as React42 from "react";
|
|
6800
6887
|
|
|
6801
6888
|
// src/components/organization/model.ts
|
|
6802
6889
|
function organizationSlugFromName(name) {
|
|
@@ -6813,22 +6900,22 @@ function canManageOrganization(member) {
|
|
|
6813
6900
|
}
|
|
6814
6901
|
|
|
6815
6902
|
// src/components/CreateOrganization.tsx
|
|
6816
|
-
import { jsx as
|
|
6903
|
+
import { jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
6817
6904
|
function CreateOrganization({ onCreated, title } = {}) {
|
|
6818
6905
|
const t = useT();
|
|
6819
6906
|
const { config, isLoading: configLoading } = usePublicConfig();
|
|
6820
6907
|
const { isLoaded, isSignedIn } = useUser();
|
|
6821
6908
|
const api = useAuthClient().organization;
|
|
6822
6909
|
const { pending, error, run } = useSubmitAction();
|
|
6823
|
-
const [name, setName] =
|
|
6824
|
-
const [slug, setSlug] =
|
|
6825
|
-
const [logo, setLogo] =
|
|
6826
|
-
const [slugTouched, setSlugTouched] =
|
|
6910
|
+
const [name, setName] = React42.useState("");
|
|
6911
|
+
const [slug, setSlug] = React42.useState("");
|
|
6912
|
+
const [logo, setLogo] = React42.useState("");
|
|
6913
|
+
const [slugTouched, setSlugTouched] = React42.useState(false);
|
|
6827
6914
|
if (configLoading || !isLoaded) {
|
|
6828
|
-
return /* @__PURE__ */
|
|
6915
|
+
return /* @__PURE__ */ jsx49("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
6829
6916
|
}
|
|
6830
6917
|
if (config?.organizations !== true) return null;
|
|
6831
|
-
if (!isSignedIn) return /* @__PURE__ */
|
|
6918
|
+
if (!isSignedIn) return /* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
6832
6919
|
const submit = (event) => {
|
|
6833
6920
|
event.preventDefault();
|
|
6834
6921
|
const normalizedName = name.trim();
|
|
@@ -6853,15 +6940,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6853
6940
|
}
|
|
6854
6941
|
);
|
|
6855
6942
|
};
|
|
6856
|
-
return /* @__PURE__ */
|
|
6857
|
-
title !== null && /* @__PURE__ */
|
|
6858
|
-
/* @__PURE__ */
|
|
6859
|
-
/* @__PURE__ */
|
|
6943
|
+
return /* @__PURE__ */ jsxs43("section", { className: "ba-organization-create", children: [
|
|
6944
|
+
title !== null && /* @__PURE__ */ jsxs43("header", { className: "ba-organization-section-header", children: [
|
|
6945
|
+
/* @__PURE__ */ jsx49("h2", { className: "ba-title", children: title ?? t("organization.create.title") }),
|
|
6946
|
+
/* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.create.description") })
|
|
6860
6947
|
] }),
|
|
6861
|
-
/* @__PURE__ */
|
|
6862
|
-
/* @__PURE__ */
|
|
6948
|
+
/* @__PURE__ */ jsxs43("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
6949
|
+
/* @__PURE__ */ jsxs43("label", { className: "ba-label", children: [
|
|
6863
6950
|
t("organization.create.name"),
|
|
6864
|
-
/* @__PURE__ */
|
|
6951
|
+
/* @__PURE__ */ jsx49(
|
|
6865
6952
|
"input",
|
|
6866
6953
|
{
|
|
6867
6954
|
className: "ba-input",
|
|
@@ -6876,9 +6963,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6876
6963
|
}
|
|
6877
6964
|
)
|
|
6878
6965
|
] }),
|
|
6879
|
-
/* @__PURE__ */
|
|
6966
|
+
/* @__PURE__ */ jsxs43("label", { className: "ba-label", children: [
|
|
6880
6967
|
t("organization.create.slug"),
|
|
6881
|
-
/* @__PURE__ */
|
|
6968
|
+
/* @__PURE__ */ jsx49(
|
|
6882
6969
|
"input",
|
|
6883
6970
|
{
|
|
6884
6971
|
className: "ba-input",
|
|
@@ -6893,9 +6980,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6893
6980
|
}
|
|
6894
6981
|
)
|
|
6895
6982
|
] }),
|
|
6896
|
-
/* @__PURE__ */
|
|
6983
|
+
/* @__PURE__ */ jsxs43("label", { className: "ba-label", children: [
|
|
6897
6984
|
t("organization.create.logo"),
|
|
6898
|
-
/* @__PURE__ */
|
|
6985
|
+
/* @__PURE__ */ jsx49(
|
|
6899
6986
|
"input",
|
|
6900
6987
|
{
|
|
6901
6988
|
className: "ba-input",
|
|
@@ -6907,15 +6994,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6907
6994
|
}
|
|
6908
6995
|
)
|
|
6909
6996
|
] }),
|
|
6910
|
-
/* @__PURE__ */
|
|
6911
|
-
/* @__PURE__ */
|
|
6997
|
+
/* @__PURE__ */ jsx49(FormError, { children: error }),
|
|
6998
|
+
/* @__PURE__ */ jsx49(
|
|
6912
6999
|
"button",
|
|
6913
7000
|
{
|
|
6914
7001
|
className: "ba-button ba-profile-submit",
|
|
6915
7002
|
type: "submit",
|
|
6916
7003
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
6917
7004
|
"aria-busy": pending || void 0,
|
|
6918
|
-
children: /* @__PURE__ */
|
|
7005
|
+
children: /* @__PURE__ */ jsx49(Busy, { busy: pending, label: t("common.working"), children: t("organization.create.submit") })
|
|
6919
7006
|
}
|
|
6920
7007
|
)
|
|
6921
7008
|
] })
|
|
@@ -6923,8 +7010,8 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6923
7010
|
}
|
|
6924
7011
|
|
|
6925
7012
|
// src/components/organization/OrganizationModal.tsx
|
|
6926
|
-
import * as
|
|
6927
|
-
import { jsx as
|
|
7013
|
+
import * as React43 from "react";
|
|
7014
|
+
import { jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
6928
7015
|
function OrganizationModal({
|
|
6929
7016
|
title,
|
|
6930
7017
|
onClose,
|
|
@@ -6932,8 +7019,8 @@ function OrganizationModal({
|
|
|
6932
7019
|
children
|
|
6933
7020
|
}) {
|
|
6934
7021
|
const t = useT();
|
|
6935
|
-
const titleId =
|
|
6936
|
-
return /* @__PURE__ */
|
|
7022
|
+
const titleId = React43.useId();
|
|
7023
|
+
return /* @__PURE__ */ jsxs44(
|
|
6937
7024
|
ModalSurface,
|
|
6938
7025
|
{
|
|
6939
7026
|
overlayClassName: "ba-organization-overlay",
|
|
@@ -6942,9 +7029,9 @@ function OrganizationModal({
|
|
|
6942
7029
|
returnFocusRef,
|
|
6943
7030
|
onClose,
|
|
6944
7031
|
children: [
|
|
6945
|
-
/* @__PURE__ */
|
|
6946
|
-
/* @__PURE__ */
|
|
6947
|
-
/* @__PURE__ */
|
|
7032
|
+
/* @__PURE__ */ jsxs44("header", { className: "ba-organization-modal-header", children: [
|
|
7033
|
+
/* @__PURE__ */ jsx50("h2", { id: titleId, className: "ba-title", children: title }),
|
|
7034
|
+
/* @__PURE__ */ jsx50(
|
|
6948
7035
|
"button",
|
|
6949
7036
|
{
|
|
6950
7037
|
className: "ba-profile-close",
|
|
@@ -6956,26 +7043,26 @@ function OrganizationModal({
|
|
|
6956
7043
|
}
|
|
6957
7044
|
)
|
|
6958
7045
|
] }),
|
|
6959
|
-
/* @__PURE__ */
|
|
7046
|
+
/* @__PURE__ */ jsx50("div", { className: "ba-organization-modal-body", children })
|
|
6960
7047
|
]
|
|
6961
7048
|
}
|
|
6962
7049
|
);
|
|
6963
7050
|
}
|
|
6964
7051
|
|
|
6965
7052
|
// src/components/organization/use-organizations-resource.ts
|
|
6966
|
-
import * as
|
|
7053
|
+
import * as React44 from "react";
|
|
6967
7054
|
function useOrganizationsResource(enabled = true) {
|
|
6968
7055
|
const api = useAuthClient().organization;
|
|
6969
|
-
const apiRef =
|
|
7056
|
+
const apiRef = React44.useRef(api);
|
|
6970
7057
|
apiRef.current = api;
|
|
6971
7058
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
6972
7059
|
const t = useT();
|
|
6973
7060
|
const toServerError = useServerError();
|
|
6974
|
-
const [organizations, setOrganizations] =
|
|
6975
|
-
const [error, setError] =
|
|
6976
|
-
const requestRef =
|
|
7061
|
+
const [organizations, setOrganizations] = React44.useState(null);
|
|
7062
|
+
const [error, setError] = React44.useState(null);
|
|
7063
|
+
const requestRef = React44.useRef(0);
|
|
6977
7064
|
const identity = user?.id ?? null;
|
|
6978
|
-
const refresh =
|
|
7065
|
+
const refresh = React44.useCallback(async () => {
|
|
6979
7066
|
const token = ++requestRef.current;
|
|
6980
7067
|
if (!enabled || !identity || !isSignedIn) {
|
|
6981
7068
|
setOrganizations([]);
|
|
@@ -6995,7 +7082,7 @@ function useOrganizationsResource(enabled = true) {
|
|
|
6995
7082
|
if (token === requestRef.current) setError(t("organization.error.load"));
|
|
6996
7083
|
}
|
|
6997
7084
|
}, [enabled, identity, isSignedIn, t, toServerError]);
|
|
6998
|
-
|
|
7085
|
+
React44.useEffect(() => {
|
|
6999
7086
|
setOrganizations(null);
|
|
7000
7087
|
setError(null);
|
|
7001
7088
|
if (!isLoaded) return;
|
|
@@ -7013,11 +7100,11 @@ function useOrganizationsResource(enabled = true) {
|
|
|
7013
7100
|
}
|
|
7014
7101
|
|
|
7015
7102
|
// src/components/OrganizationProfile.tsx
|
|
7016
|
-
import * as
|
|
7103
|
+
import * as React49 from "react";
|
|
7017
7104
|
|
|
7018
7105
|
// src/components/organization/DangerSection.tsx
|
|
7019
|
-
import * as
|
|
7020
|
-
import { jsx as
|
|
7106
|
+
import * as React45 from "react";
|
|
7107
|
+
import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
7021
7108
|
function DangerSection({
|
|
7022
7109
|
organization,
|
|
7023
7110
|
membership,
|
|
@@ -7028,7 +7115,7 @@ function DangerSection({
|
|
|
7028
7115
|
const api = useAuthClient().organization;
|
|
7029
7116
|
const session = useSession();
|
|
7030
7117
|
const { pending, error, run } = useSubmitAction();
|
|
7031
|
-
const [confirmation, setConfirmation] =
|
|
7118
|
+
const [confirmation, setConfirmation] = React45.useState("");
|
|
7032
7119
|
const isOwner = hasOrganizationRole(membership, "owner");
|
|
7033
7120
|
const confirmed = confirmation.trim().toLowerCase() === organization.slug.toLowerCase();
|
|
7034
7121
|
const leave = () => {
|
|
@@ -7058,43 +7145,43 @@ function DangerSection({
|
|
|
7058
7145
|
}
|
|
7059
7146
|
);
|
|
7060
7147
|
};
|
|
7061
|
-
return /* @__PURE__ */
|
|
7062
|
-
/* @__PURE__ */
|
|
7063
|
-
/* @__PURE__ */
|
|
7064
|
-
/* @__PURE__ */
|
|
7148
|
+
return /* @__PURE__ */ jsxs45("section", { className: "ba-organization-section ba-organization-danger", children: [
|
|
7149
|
+
/* @__PURE__ */ jsxs45("header", { className: "ba-organization-section-header", children: [
|
|
7150
|
+
/* @__PURE__ */ jsx51("h3", { className: "ba-title", children: t("organization.profile.danger.title") }),
|
|
7151
|
+
/* @__PURE__ */ jsx51("p", { className: "ba-muted", children: t("organization.profile.danger.description") })
|
|
7065
7152
|
] }),
|
|
7066
|
-
/* @__PURE__ */
|
|
7067
|
-
/* @__PURE__ */
|
|
7068
|
-
/* @__PURE__ */
|
|
7069
|
-
/* @__PURE__ */
|
|
7153
|
+
/* @__PURE__ */ jsxs45("div", { className: "ba-organization-danger-action", children: [
|
|
7154
|
+
/* @__PURE__ */ jsx51("strong", { children: t("organization.profile.danger.leaveTitle") }),
|
|
7155
|
+
/* @__PURE__ */ jsx51("p", { className: "ba-muted", children: isOwner ? t("organization.profile.danger.ownerLeaveHint") : t("organization.profile.danger.leaveHint") }),
|
|
7156
|
+
/* @__PURE__ */ jsx51("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: leave, children: t("organization.profile.danger.leave") })
|
|
7070
7157
|
] }),
|
|
7071
|
-
isOwner && /* @__PURE__ */
|
|
7072
|
-
/* @__PURE__ */
|
|
7073
|
-
/* @__PURE__ */
|
|
7074
|
-
/* @__PURE__ */
|
|
7158
|
+
isOwner && /* @__PURE__ */ jsxs45("form", { method: "post", className: "ba-organization-danger-action ba-organization-delete", onSubmit: remove, children: [
|
|
7159
|
+
/* @__PURE__ */ jsx51("strong", { children: t("organization.profile.danger.deleteTitle") }),
|
|
7160
|
+
/* @__PURE__ */ jsx51("p", { className: "ba-muted", children: t("organization.profile.danger.deleteHint") }),
|
|
7161
|
+
/* @__PURE__ */ jsxs45("label", { className: "ba-label", children: [
|
|
7075
7162
|
t("organization.profile.danger.deleteConfirm"),
|
|
7076
7163
|
" ",
|
|
7077
|
-
/* @__PURE__ */
|
|
7078
|
-
/* @__PURE__ */
|
|
7164
|
+
/* @__PURE__ */ jsx51(Bidi, { children: organization.slug }),
|
|
7165
|
+
/* @__PURE__ */ jsx51("input", { className: "ba-input", dir: "ltr", value: confirmation, onChange: (event) => setConfirmation(event.target.value), autoComplete: "off", required: true })
|
|
7079
7166
|
] }),
|
|
7080
|
-
/* @__PURE__ */
|
|
7167
|
+
/* @__PURE__ */ jsx51(
|
|
7081
7168
|
"button",
|
|
7082
7169
|
{
|
|
7083
7170
|
className: "ba-button ba-danger-button",
|
|
7084
7171
|
type: "submit",
|
|
7085
7172
|
disabled: pending || !confirmed,
|
|
7086
7173
|
"aria-busy": pending || void 0,
|
|
7087
|
-
children: /* @__PURE__ */
|
|
7174
|
+
children: /* @__PURE__ */ jsx51(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.danger.delete") })
|
|
7088
7175
|
}
|
|
7089
7176
|
)
|
|
7090
7177
|
] }),
|
|
7091
|
-
/* @__PURE__ */
|
|
7178
|
+
/* @__PURE__ */ jsx51(FormError, { children: error })
|
|
7092
7179
|
] });
|
|
7093
7180
|
}
|
|
7094
7181
|
|
|
7095
7182
|
// src/components/organization/GeneralSection.tsx
|
|
7096
|
-
import * as
|
|
7097
|
-
import { jsx as
|
|
7183
|
+
import * as React46 from "react";
|
|
7184
|
+
import { jsx as jsx52, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
7098
7185
|
function GeneralSection({
|
|
7099
7186
|
organization,
|
|
7100
7187
|
canManage,
|
|
@@ -7103,25 +7190,25 @@ function GeneralSection({
|
|
|
7103
7190
|
const t = useT();
|
|
7104
7191
|
const api = useAuthClient().organization;
|
|
7105
7192
|
const { pending, error, run } = useSubmitAction();
|
|
7106
|
-
const [name, setName] =
|
|
7107
|
-
const [slug, setSlug] =
|
|
7108
|
-
const [logo, setLogo] =
|
|
7109
|
-
|
|
7193
|
+
const [name, setName] = React46.useState(organization.name);
|
|
7194
|
+
const [slug, setSlug] = React46.useState(organization.slug);
|
|
7195
|
+
const [logo, setLogo] = React46.useState(organization.logo ?? "");
|
|
7196
|
+
React46.useEffect(() => {
|
|
7110
7197
|
setName(organization.name);
|
|
7111
7198
|
setSlug(organization.slug);
|
|
7112
7199
|
setLogo(organization.logo ?? "");
|
|
7113
7200
|
}, [organization.id, organization.logo, organization.name, organization.slug]);
|
|
7114
7201
|
if (!canManage) {
|
|
7115
|
-
return /* @__PURE__ */
|
|
7116
|
-
/* @__PURE__ */
|
|
7117
|
-
/* @__PURE__ */
|
|
7118
|
-
/* @__PURE__ */
|
|
7119
|
-
/* @__PURE__ */
|
|
7120
|
-
/* @__PURE__ */
|
|
7202
|
+
return /* @__PURE__ */ jsxs46("section", { className: "ba-organization-section", children: [
|
|
7203
|
+
/* @__PURE__ */ jsx52("p", { className: "ba-muted", children: t("organization.profile.general.readOnly") }),
|
|
7204
|
+
/* @__PURE__ */ jsxs46("dl", { className: "ba-organization-facts", children: [
|
|
7205
|
+
/* @__PURE__ */ jsxs46("div", { children: [
|
|
7206
|
+
/* @__PURE__ */ jsx52("dt", { children: t("organization.create.name") }),
|
|
7207
|
+
/* @__PURE__ */ jsx52("dd", { children: organization.name })
|
|
7121
7208
|
] }),
|
|
7122
|
-
/* @__PURE__ */
|
|
7123
|
-
/* @__PURE__ */
|
|
7124
|
-
/* @__PURE__ */
|
|
7209
|
+
/* @__PURE__ */ jsxs46("div", { children: [
|
|
7210
|
+
/* @__PURE__ */ jsx52("dt", { children: t("organization.create.slug") }),
|
|
7211
|
+
/* @__PURE__ */ jsx52("dd", { children: /* @__PURE__ */ jsx52(Bidi, { children: organization.slug }) })
|
|
7125
7212
|
] })
|
|
7126
7213
|
] })
|
|
7127
7214
|
] });
|
|
@@ -7139,19 +7226,19 @@ function GeneralSection({
|
|
|
7139
7226
|
}
|
|
7140
7227
|
);
|
|
7141
7228
|
};
|
|
7142
|
-
return /* @__PURE__ */
|
|
7143
|
-
/* @__PURE__ */
|
|
7144
|
-
/* @__PURE__ */
|
|
7145
|
-
/* @__PURE__ */
|
|
7229
|
+
return /* @__PURE__ */ jsxs46("section", { className: "ba-organization-section", children: [
|
|
7230
|
+
/* @__PURE__ */ jsxs46("header", { className: "ba-organization-section-header", children: [
|
|
7231
|
+
/* @__PURE__ */ jsx52("h3", { className: "ba-title", children: t("organization.profile.general.title") }),
|
|
7232
|
+
/* @__PURE__ */ jsx52("p", { className: "ba-muted", children: t("organization.profile.general.description") })
|
|
7146
7233
|
] }),
|
|
7147
|
-
/* @__PURE__ */
|
|
7148
|
-
/* @__PURE__ */
|
|
7234
|
+
/* @__PURE__ */ jsxs46("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
7235
|
+
/* @__PURE__ */ jsxs46("label", { className: "ba-label", children: [
|
|
7149
7236
|
t("organization.create.name"),
|
|
7150
|
-
/* @__PURE__ */
|
|
7237
|
+
/* @__PURE__ */ jsx52("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
|
|
7151
7238
|
] }),
|
|
7152
|
-
/* @__PURE__ */
|
|
7239
|
+
/* @__PURE__ */ jsxs46("label", { className: "ba-label", children: [
|
|
7153
7240
|
t("organization.create.slug"),
|
|
7154
|
-
/* @__PURE__ */
|
|
7241
|
+
/* @__PURE__ */ jsx52(
|
|
7155
7242
|
"input",
|
|
7156
7243
|
{
|
|
7157
7244
|
className: "ba-input",
|
|
@@ -7163,19 +7250,19 @@ function GeneralSection({
|
|
|
7163
7250
|
}
|
|
7164
7251
|
)
|
|
7165
7252
|
] }),
|
|
7166
|
-
/* @__PURE__ */
|
|
7253
|
+
/* @__PURE__ */ jsxs46("label", { className: "ba-label", children: [
|
|
7167
7254
|
t("organization.create.logo"),
|
|
7168
|
-
/* @__PURE__ */
|
|
7255
|
+
/* @__PURE__ */ jsx52("input", { className: "ba-input", type: "url", dir: "ltr", value: logo, onChange: (event) => setLogo(event.target.value), placeholder: "https://" })
|
|
7169
7256
|
] }),
|
|
7170
|
-
/* @__PURE__ */
|
|
7171
|
-
/* @__PURE__ */
|
|
7257
|
+
/* @__PURE__ */ jsx52(FormError, { children: error }),
|
|
7258
|
+
/* @__PURE__ */ jsx52(
|
|
7172
7259
|
"button",
|
|
7173
7260
|
{
|
|
7174
7261
|
className: "ba-button ba-profile-submit",
|
|
7175
7262
|
type: "submit",
|
|
7176
7263
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
7177
7264
|
"aria-busy": pending || void 0,
|
|
7178
|
-
children: /* @__PURE__ */
|
|
7265
|
+
children: /* @__PURE__ */ jsx52(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.general.save") })
|
|
7179
7266
|
}
|
|
7180
7267
|
)
|
|
7181
7268
|
] })
|
|
@@ -7183,7 +7270,7 @@ function GeneralSection({
|
|
|
7183
7270
|
}
|
|
7184
7271
|
|
|
7185
7272
|
// src/components/organization/InvitationsSection.tsx
|
|
7186
|
-
import * as
|
|
7273
|
+
import * as React48 from "react";
|
|
7187
7274
|
|
|
7188
7275
|
// src/components/organization/role-label.ts
|
|
7189
7276
|
function organizationRoleLabel(role, t) {
|
|
@@ -7195,15 +7282,15 @@ function organizationRoleLabel(role, t) {
|
|
|
7195
7282
|
}
|
|
7196
7283
|
|
|
7197
7284
|
// src/components/organization/use-organization-roles.ts
|
|
7198
|
-
import * as
|
|
7285
|
+
import * as React47 from "react";
|
|
7199
7286
|
var BUILTIN_ROLES = ["owner", "admin", "member"];
|
|
7200
7287
|
function useOrganizationRoles(organizationId) {
|
|
7201
7288
|
const api = useAuthClient().organization;
|
|
7202
|
-
const apiRef =
|
|
7289
|
+
const apiRef = React47.useRef(api);
|
|
7203
7290
|
apiRef.current = api;
|
|
7204
|
-
const [dynamic, setDynamic] =
|
|
7205
|
-
const requestRef =
|
|
7206
|
-
|
|
7291
|
+
const [dynamic, setDynamic] = React47.useState([]);
|
|
7292
|
+
const requestRef = React47.useRef(0);
|
|
7293
|
+
React47.useEffect(() => {
|
|
7207
7294
|
const token = ++requestRef.current;
|
|
7208
7295
|
setDynamic([]);
|
|
7209
7296
|
if (!organizationId) return;
|
|
@@ -7219,7 +7306,7 @@ function useOrganizationRoles(organizationId) {
|
|
|
7219
7306
|
requestRef.current += 1;
|
|
7220
7307
|
};
|
|
7221
7308
|
}, [organizationId]);
|
|
7222
|
-
const roles =
|
|
7309
|
+
const roles = React47.useMemo(() => {
|
|
7223
7310
|
const seen = /* @__PURE__ */ new Set();
|
|
7224
7311
|
const out = [];
|
|
7225
7312
|
for (const candidate of [...BUILTIN_ROLES, ...dynamic]) {
|
|
@@ -7234,7 +7321,7 @@ function useOrganizationRoles(organizationId) {
|
|
|
7234
7321
|
}
|
|
7235
7322
|
|
|
7236
7323
|
// src/components/organization/InvitationsSection.tsx
|
|
7237
|
-
import { jsx as
|
|
7324
|
+
import { jsx as jsx53, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
7238
7325
|
function InvitationsSection({
|
|
7239
7326
|
organization,
|
|
7240
7327
|
onChanged
|
|
@@ -7243,8 +7330,8 @@ function InvitationsSection({
|
|
|
7243
7330
|
const api = useAuthClient().organization;
|
|
7244
7331
|
const { pending, error, run } = useSubmitAction();
|
|
7245
7332
|
const { roles } = useOrganizationRoles(organization.id);
|
|
7246
|
-
const [email, setEmail] =
|
|
7247
|
-
const [role, setRole] =
|
|
7333
|
+
const [email, setEmail] = React48.useState("");
|
|
7334
|
+
const [role, setRole] = React48.useState("member");
|
|
7248
7335
|
const invitations = organization.invitations.filter((invitation) => invitation.status === "pending");
|
|
7249
7336
|
const invite = (event) => {
|
|
7250
7337
|
event.preventDefault();
|
|
@@ -7266,44 +7353,44 @@ function InvitationsSection({
|
|
|
7266
7353
|
{ failure: t("organization.profile.invitations.cancelError"), onSuccess: onChanged }
|
|
7267
7354
|
);
|
|
7268
7355
|
};
|
|
7269
|
-
return /* @__PURE__ */
|
|
7270
|
-
/* @__PURE__ */
|
|
7271
|
-
/* @__PURE__ */
|
|
7272
|
-
/* @__PURE__ */
|
|
7356
|
+
return /* @__PURE__ */ jsxs47("section", { className: "ba-organization-section", children: [
|
|
7357
|
+
/* @__PURE__ */ jsxs47("header", { className: "ba-organization-section-header", children: [
|
|
7358
|
+
/* @__PURE__ */ jsx53("h3", { className: "ba-title", children: t("organization.profile.invitations.title") }),
|
|
7359
|
+
/* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.invitations.description") })
|
|
7273
7360
|
] }),
|
|
7274
|
-
/* @__PURE__ */
|
|
7275
|
-
/* @__PURE__ */
|
|
7361
|
+
/* @__PURE__ */ jsxs47("form", { method: "post", className: "ba-organization-invite-form", onSubmit: invite, children: [
|
|
7362
|
+
/* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
|
|
7276
7363
|
t("organization.profile.invitations.email"),
|
|
7277
|
-
/* @__PURE__ */
|
|
7364
|
+
/* @__PURE__ */ jsx53("input", { className: "ba-input", type: "email", dir: "ltr", value: email, onChange: (event) => setEmail(event.target.value), required: true })
|
|
7278
7365
|
] }),
|
|
7279
|
-
/* @__PURE__ */
|
|
7366
|
+
/* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
|
|
7280
7367
|
t("organization.profile.members.role"),
|
|
7281
|
-
/* @__PURE__ */
|
|
7368
|
+
/* @__PURE__ */ jsx53("select", { className: "ba-input", value: role, onChange: (event) => setRole(event.target.value), children: roles.map((option) => /* @__PURE__ */ jsx53("option", { value: option, children: organizationRoleLabel(option, t) }, option)) })
|
|
7282
7369
|
] }),
|
|
7283
|
-
/* @__PURE__ */
|
|
7370
|
+
/* @__PURE__ */ jsx53(
|
|
7284
7371
|
"button",
|
|
7285
7372
|
{
|
|
7286
7373
|
className: "ba-button",
|
|
7287
7374
|
type: "submit",
|
|
7288
7375
|
disabled: pending || !email.trim(),
|
|
7289
7376
|
"aria-busy": pending || void 0,
|
|
7290
|
-
children: /* @__PURE__ */
|
|
7377
|
+
children: /* @__PURE__ */ jsx53(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.invitations.invite") })
|
|
7291
7378
|
}
|
|
7292
7379
|
)
|
|
7293
7380
|
] }),
|
|
7294
|
-
/* @__PURE__ */
|
|
7295
|
-
invitations.length === 0 ? /* @__PURE__ */
|
|
7296
|
-
/* @__PURE__ */
|
|
7297
|
-
/* @__PURE__ */
|
|
7298
|
-
/* @__PURE__ */
|
|
7381
|
+
/* @__PURE__ */ jsx53(FormError, { children: error }),
|
|
7382
|
+
invitations.length === 0 ? /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.invitations.empty") }) : /* @__PURE__ */ jsx53("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ jsxs47("li", { className: "ba-organization-invitation", children: [
|
|
7383
|
+
/* @__PURE__ */ jsxs47("span", { children: [
|
|
7384
|
+
/* @__PURE__ */ jsx53("strong", { children: /* @__PURE__ */ jsx53(Bidi, { children: invitation.email }) }),
|
|
7385
|
+
/* @__PURE__ */ jsx53("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
7299
7386
|
] }),
|
|
7300
|
-
/* @__PURE__ */
|
|
7387
|
+
/* @__PURE__ */ jsx53("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => cancel(invitation), children: t("organization.profile.invitations.cancel") })
|
|
7301
7388
|
] }, invitation.id)) })
|
|
7302
7389
|
] });
|
|
7303
7390
|
}
|
|
7304
7391
|
|
|
7305
7392
|
// src/components/organization/MembersSection.tsx
|
|
7306
|
-
import { jsx as
|
|
7393
|
+
import { jsx as jsx54, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
7307
7394
|
function MembersSection({
|
|
7308
7395
|
organization,
|
|
7309
7396
|
userId,
|
|
@@ -7330,27 +7417,27 @@ function MembersSection({
|
|
|
7330
7417
|
{ failure: t("organization.profile.members.removeError"), onSuccess: onChanged }
|
|
7331
7418
|
);
|
|
7332
7419
|
};
|
|
7333
|
-
return /* @__PURE__ */
|
|
7334
|
-
/* @__PURE__ */
|
|
7335
|
-
/* @__PURE__ */
|
|
7336
|
-
/* @__PURE__ */
|
|
7420
|
+
return /* @__PURE__ */ jsxs48("section", { className: "ba-organization-section", children: [
|
|
7421
|
+
/* @__PURE__ */ jsxs48("header", { className: "ba-organization-section-header", children: [
|
|
7422
|
+
/* @__PURE__ */ jsx54("h3", { className: "ba-title", children: t("organization.profile.members.title") }),
|
|
7423
|
+
/* @__PURE__ */ jsx54("p", { className: "ba-muted", children: t("organization.profile.members.description") })
|
|
7337
7424
|
] }),
|
|
7338
|
-
/* @__PURE__ */
|
|
7339
|
-
/* @__PURE__ */
|
|
7425
|
+
/* @__PURE__ */ jsx54(FormError, { children: error }),
|
|
7426
|
+
/* @__PURE__ */ jsx54("ul", { className: "ba-organization-list", children: organization.members.map((member) => {
|
|
7340
7427
|
const primaryRole = organizationRoles(member.role)[0] ?? member.role;
|
|
7341
7428
|
const isCurrent = member.userId === userId;
|
|
7342
|
-
return /* @__PURE__ */
|
|
7343
|
-
/* @__PURE__ */
|
|
7344
|
-
/* @__PURE__ */
|
|
7345
|
-
/* @__PURE__ */
|
|
7429
|
+
return /* @__PURE__ */ jsxs48("li", { className: "ba-organization-member", children: [
|
|
7430
|
+
/* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: member.user.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7431
|
+
/* @__PURE__ */ jsxs48("span", { className: "ba-organization-member-copy", children: [
|
|
7432
|
+
/* @__PURE__ */ jsxs48("strong", { children: [
|
|
7346
7433
|
member.user.name,
|
|
7347
7434
|
isCurrent ? ` ${t("organization.profile.members.you")}` : ""
|
|
7348
7435
|
] }),
|
|
7349
|
-
/* @__PURE__ */
|
|
7436
|
+
/* @__PURE__ */ jsx54("small", { children: /* @__PURE__ */ jsx54(Bidi, { children: member.user.email }) })
|
|
7350
7437
|
] }),
|
|
7351
|
-
canManage && !isCurrent ? /* @__PURE__ */
|
|
7352
|
-
/* @__PURE__ */
|
|
7353
|
-
/* @__PURE__ */
|
|
7438
|
+
canManage && !isCurrent ? /* @__PURE__ */ jsxs48("span", { className: "ba-organization-member-actions", children: [
|
|
7439
|
+
/* @__PURE__ */ jsx54("label", { className: "ba-sr-only", htmlFor: `organization-role-${member.id}`, children: t("organization.profile.members.role") }),
|
|
7440
|
+
/* @__PURE__ */ jsx54(
|
|
7354
7441
|
"select",
|
|
7355
7442
|
{
|
|
7356
7443
|
id: `organization-role-${member.id}`,
|
|
@@ -7358,18 +7445,18 @@ function MembersSection({
|
|
|
7358
7445
|
value: primaryRole,
|
|
7359
7446
|
disabled: pending,
|
|
7360
7447
|
onChange: (event) => updateRole(member, event.target.value),
|
|
7361
|
-
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */
|
|
7448
|
+
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */ jsx54("option", { value: role, children: organizationRoleLabel(role, t) }, role))
|
|
7362
7449
|
}
|
|
7363
7450
|
),
|
|
7364
|
-
/* @__PURE__ */
|
|
7365
|
-
] }) : /* @__PURE__ */
|
|
7451
|
+
/* @__PURE__ */ jsx54("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(member), children: t("organization.profile.members.remove") })
|
|
7452
|
+
] }) : /* @__PURE__ */ jsx54("span", { className: "ba-organization-role-label", children: organizationRoleLabel(primaryRole, t) })
|
|
7366
7453
|
] }, member.id);
|
|
7367
7454
|
}) })
|
|
7368
7455
|
] });
|
|
7369
7456
|
}
|
|
7370
7457
|
|
|
7371
7458
|
// src/components/OrganizationProfile.tsx
|
|
7372
|
-
import { jsx as
|
|
7459
|
+
import { jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
7373
7460
|
var SECTION_KEYS2 = {
|
|
7374
7461
|
general: "organization.profile.nav.general",
|
|
7375
7462
|
members: "organization.profile.nav.members",
|
|
@@ -7383,17 +7470,17 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7383
7470
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
7384
7471
|
const session = useSession();
|
|
7385
7472
|
const api = useAuthClient().organization;
|
|
7386
|
-
const apiRef =
|
|
7473
|
+
const apiRef = React49.useRef(api);
|
|
7387
7474
|
apiRef.current = api;
|
|
7388
7475
|
const activeOrganizationId = session.data?.session.activeOrganizationId ?? null;
|
|
7389
7476
|
const requestedId = organizationId ?? activeOrganizationId;
|
|
7390
7477
|
const enabled = config?.organizations === true && isSignedIn;
|
|
7391
|
-
const [organization, setOrganization] =
|
|
7392
|
-
const [error, setError] =
|
|
7393
|
-
const [wasRemoved, setWasRemoved] =
|
|
7394
|
-
const [section, setSection] =
|
|
7395
|
-
const requestRef =
|
|
7396
|
-
const load =
|
|
7478
|
+
const [organization, setOrganization] = React49.useState(null);
|
|
7479
|
+
const [error, setError] = React49.useState(null);
|
|
7480
|
+
const [wasRemoved, setWasRemoved] = React49.useState(false);
|
|
7481
|
+
const [section, setSection] = React49.useState(defaultSection);
|
|
7482
|
+
const requestRef = React49.useRef(0);
|
|
7483
|
+
const load = React49.useCallback(async () => {
|
|
7397
7484
|
const token = ++requestRef.current;
|
|
7398
7485
|
if (!enabled || !requestedId) {
|
|
7399
7486
|
setOrganization(null);
|
|
@@ -7413,7 +7500,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7413
7500
|
if (token === requestRef.current) setError(t("organization.profile.loadError"));
|
|
7414
7501
|
}
|
|
7415
7502
|
}, [enabled, requestedId, t, toServerError]);
|
|
7416
|
-
|
|
7503
|
+
React49.useEffect(() => {
|
|
7417
7504
|
setOrganization(null);
|
|
7418
7505
|
setError(null);
|
|
7419
7506
|
setWasRemoved(false);
|
|
@@ -7422,20 +7509,20 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7422
7509
|
requestRef.current += 1;
|
|
7423
7510
|
};
|
|
7424
7511
|
}, [load]);
|
|
7425
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */
|
|
7512
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ jsx55("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
7426
7513
|
if (config?.organizations !== true) return null;
|
|
7427
|
-
if (!isSignedIn || !user) return /* @__PURE__ */
|
|
7428
|
-
if (wasRemoved) return /* @__PURE__ */
|
|
7429
|
-
if (!requestedId) return /* @__PURE__ */
|
|
7514
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
7515
|
+
if (wasRemoved) return /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
7516
|
+
if (!requestedId) return /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
7430
7517
|
if (error) {
|
|
7431
|
-
return /* @__PURE__ */
|
|
7432
|
-
/* @__PURE__ */
|
|
7433
|
-
/* @__PURE__ */
|
|
7518
|
+
return /* @__PURE__ */ jsxs49("div", { className: "ba-inline-error", children: [
|
|
7519
|
+
/* @__PURE__ */ jsx55(FormError, { children: error }),
|
|
7520
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
|
|
7434
7521
|
] });
|
|
7435
7522
|
}
|
|
7436
|
-
if (!organization) return /* @__PURE__ */
|
|
7523
|
+
if (!organization) return /* @__PURE__ */ jsx55("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
7437
7524
|
const membership = organization.members.find((member) => member.userId === user.id);
|
|
7438
|
-
if (!membership) return /* @__PURE__ */
|
|
7525
|
+
if (!membership) return /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.profile.notMember") });
|
|
7439
7526
|
const canManage = canManageOrganization(membership);
|
|
7440
7527
|
const visibleSections = canManage ? ["general", "members", "invitations", "danger"] : ["general", "members", "danger"];
|
|
7441
7528
|
const activeSection = visibleSections.includes(section) ? section : "general";
|
|
@@ -7444,16 +7531,16 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7444
7531
|
setOrganization(null);
|
|
7445
7532
|
callback?.(removedOrganization);
|
|
7446
7533
|
};
|
|
7447
|
-
return /* @__PURE__ */
|
|
7448
|
-
/* @__PURE__ */
|
|
7449
|
-
/* @__PURE__ */
|
|
7450
|
-
/* @__PURE__ */
|
|
7451
|
-
/* @__PURE__ */
|
|
7452
|
-
/* @__PURE__ */
|
|
7534
|
+
return /* @__PURE__ */ jsxs49("article", { className: "ba-organization-profile", children: [
|
|
7535
|
+
/* @__PURE__ */ jsxs49("header", { className: "ba-organization-profile-heading", children: [
|
|
7536
|
+
/* @__PURE__ */ jsx55("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7537
|
+
/* @__PURE__ */ jsxs49("span", { children: [
|
|
7538
|
+
/* @__PURE__ */ jsx55("h2", { className: "ba-title", children: organization.name }),
|
|
7539
|
+
/* @__PURE__ */ jsx55("p", { className: "ba-muted", children: organization.slug })
|
|
7453
7540
|
] })
|
|
7454
7541
|
] }),
|
|
7455
|
-
/* @__PURE__ */
|
|
7456
|
-
/* @__PURE__ */
|
|
7542
|
+
/* @__PURE__ */ jsxs49("div", { className: "ba-organization-profile-layout", children: [
|
|
7543
|
+
/* @__PURE__ */ jsx55("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ jsx55(
|
|
7457
7544
|
"button",
|
|
7458
7545
|
{
|
|
7459
7546
|
className: "ba-profile-nav-item",
|
|
@@ -7464,11 +7551,11 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7464
7551
|
},
|
|
7465
7552
|
item
|
|
7466
7553
|
)) }),
|
|
7467
|
-
/* @__PURE__ */
|
|
7468
|
-
activeSection === "general" && /* @__PURE__ */
|
|
7469
|
-
activeSection === "members" && /* @__PURE__ */
|
|
7470
|
-
activeSection === "invitations" && /* @__PURE__ */
|
|
7471
|
-
activeSection === "danger" && /* @__PURE__ */
|
|
7554
|
+
/* @__PURE__ */ jsxs49("div", { className: "ba-organization-profile-content", children: [
|
|
7555
|
+
activeSection === "general" && /* @__PURE__ */ jsx55(GeneralSection, { organization, canManage, onChanged: load }),
|
|
7556
|
+
activeSection === "members" && /* @__PURE__ */ jsx55(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
|
|
7557
|
+
activeSection === "invitations" && /* @__PURE__ */ jsx55(InvitationsSection, { organization, onChanged: load }),
|
|
7558
|
+
activeSection === "danger" && /* @__PURE__ */ jsx55(
|
|
7472
7559
|
DangerSection,
|
|
7473
7560
|
{
|
|
7474
7561
|
organization,
|
|
@@ -7483,7 +7570,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7483
7570
|
}
|
|
7484
7571
|
|
|
7485
7572
|
// src/components/OrganizationSwitcher.tsx
|
|
7486
|
-
import { Fragment as Fragment14, jsx as
|
|
7573
|
+
import { Fragment as Fragment14, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
7487
7574
|
function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChange } = {}) {
|
|
7488
7575
|
const t = useT();
|
|
7489
7576
|
const { config, isLoading: configLoading } = usePublicConfig();
|
|
@@ -7493,15 +7580,15 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7493
7580
|
const enabled = config?.organizations === true && isSignedIn;
|
|
7494
7581
|
const { organizations, isLoading, error: loadError, refresh } = useOrganizationsResource(enabled);
|
|
7495
7582
|
const { pending, error, run } = useSubmitAction();
|
|
7496
|
-
const [open, setOpen] =
|
|
7497
|
-
const [dialog, setDialog] =
|
|
7498
|
-
const rootRef =
|
|
7499
|
-
const triggerRef =
|
|
7500
|
-
const menuRef =
|
|
7501
|
-
const menuId =
|
|
7583
|
+
const [open, setOpen] = React50.useState(false);
|
|
7584
|
+
const [dialog, setDialog] = React50.useState(null);
|
|
7585
|
+
const rootRef = React50.useRef(null);
|
|
7586
|
+
const triggerRef = React50.useRef(null);
|
|
7587
|
+
const menuRef = React50.useRef(null);
|
|
7588
|
+
const menuId = React50.useId();
|
|
7502
7589
|
const activeId = session.data?.session.activeOrganizationId ?? null;
|
|
7503
7590
|
const active = organizations?.find((organization) => organization.id === activeId) ?? null;
|
|
7504
|
-
|
|
7591
|
+
React50.useEffect(() => {
|
|
7505
7592
|
if (!open) return;
|
|
7506
7593
|
const onPointerDown = (event) => {
|
|
7507
7594
|
if (!rootRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -7516,9 +7603,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7516
7603
|
document.removeEventListener("keydown", onKeyDown);
|
|
7517
7604
|
};
|
|
7518
7605
|
}, [open]);
|
|
7519
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */
|
|
7606
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ jsx56("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
|
|
7520
7607
|
if (config?.organizations !== true) return null;
|
|
7521
|
-
if (!isSignedIn) return /* @__PURE__ */
|
|
7608
|
+
if (!isSignedIn) return /* @__PURE__ */ jsx56("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
7522
7609
|
const select = (organization) => {
|
|
7523
7610
|
void run(
|
|
7524
7611
|
() => api.setActive({ organizationId: organization?.id ?? null }),
|
|
@@ -7561,9 +7648,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7561
7648
|
else if (event.key === "ArrowDown") items[(current + 1 + items.length) % items.length]?.focus();
|
|
7562
7649
|
else items[(current - 1 + items.length) % items.length]?.focus();
|
|
7563
7650
|
};
|
|
7564
|
-
return /* @__PURE__ */
|
|
7565
|
-
/* @__PURE__ */
|
|
7566
|
-
/* @__PURE__ */
|
|
7651
|
+
return /* @__PURE__ */ jsxs50(Fragment14, { children: [
|
|
7652
|
+
/* @__PURE__ */ jsxs50("div", { ref: rootRef, className: "ba-organization-switcher", children: [
|
|
7653
|
+
/* @__PURE__ */ jsxs50(
|
|
7567
7654
|
"button",
|
|
7568
7655
|
{
|
|
7569
7656
|
ref: triggerRef,
|
|
@@ -7580,43 +7667,43 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7580
7667
|
focusMenuItem(event.key === "ArrowDown" ? "first" : "last");
|
|
7581
7668
|
},
|
|
7582
7669
|
children: [
|
|
7583
|
-
/* @__PURE__ */
|
|
7584
|
-
/* @__PURE__ */
|
|
7585
|
-
/* @__PURE__ */
|
|
7670
|
+
/* @__PURE__ */ jsx56("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
|
|
7671
|
+
/* @__PURE__ */ jsx56("span", { children: active?.name ?? t("organization.personal") }),
|
|
7672
|
+
/* @__PURE__ */ jsx56("span", { "aria-hidden": "true", children: "\u2304" })
|
|
7586
7673
|
]
|
|
7587
7674
|
}
|
|
7588
7675
|
),
|
|
7589
|
-
open && /* @__PURE__ */
|
|
7590
|
-
isLoading ? /* @__PURE__ */
|
|
7591
|
-
showPersonalWorkspace && /* @__PURE__ */
|
|
7592
|
-
/* @__PURE__ */
|
|
7593
|
-
/* @__PURE__ */
|
|
7676
|
+
open && /* @__PURE__ */ jsxs50("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
|
|
7677
|
+
isLoading ? /* @__PURE__ */ jsx56("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs50(Fragment14, { children: [
|
|
7678
|
+
showPersonalWorkspace && /* @__PURE__ */ jsxs50("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === null ? "true" : void 0, disabled: pending, onClick: () => select(null), children: [
|
|
7679
|
+
/* @__PURE__ */ jsx56("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
|
|
7680
|
+
/* @__PURE__ */ jsx56("span", { children: t("organization.personal") })
|
|
7594
7681
|
] }),
|
|
7595
|
-
organizations?.map((organization) => /* @__PURE__ */
|
|
7596
|
-
/* @__PURE__ */
|
|
7597
|
-
/* @__PURE__ */
|
|
7682
|
+
organizations?.map((organization) => /* @__PURE__ */ jsxs50("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === organization.id ? "true" : void 0, disabled: pending, onClick: () => select(organization), children: [
|
|
7683
|
+
/* @__PURE__ */ jsx56("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7684
|
+
/* @__PURE__ */ jsxs50("span", { children: [
|
|
7598
7685
|
organization.name,
|
|
7599
|
-
/* @__PURE__ */
|
|
7686
|
+
/* @__PURE__ */ jsx56("small", { children: organization.slug })
|
|
7600
7687
|
] })
|
|
7601
7688
|
] }, organization.id))
|
|
7602
7689
|
] }),
|
|
7603
|
-
(loadError || error) && /* @__PURE__ */
|
|
7604
|
-
/* @__PURE__ */
|
|
7605
|
-
loadError && /* @__PURE__ */
|
|
7690
|
+
(loadError || error) && /* @__PURE__ */ jsxs50("div", { className: "ba-inline-error", children: [
|
|
7691
|
+
/* @__PURE__ */ jsx56(FormError, { children: loadError ?? error }),
|
|
7692
|
+
loadError && /* @__PURE__ */ jsx56("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
7606
7693
|
] }),
|
|
7607
|
-
/* @__PURE__ */
|
|
7608
|
-
active && /* @__PURE__ */
|
|
7694
|
+
/* @__PURE__ */ jsxs50("div", { className: "ba-organization-menu-actions", children: [
|
|
7695
|
+
active && /* @__PURE__ */ jsx56("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
7609
7696
|
setOpen(false);
|
|
7610
7697
|
setDialog("profile");
|
|
7611
7698
|
}, children: t("organization.switcher.manage") }),
|
|
7612
|
-
/* @__PURE__ */
|
|
7699
|
+
/* @__PURE__ */ jsx56("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
7613
7700
|
setOpen(false);
|
|
7614
7701
|
setDialog("create");
|
|
7615
7702
|
}, children: t("organization.switcher.create") })
|
|
7616
7703
|
] })
|
|
7617
7704
|
] })
|
|
7618
7705
|
] }),
|
|
7619
|
-
dialog === "create" && /* @__PURE__ */
|
|
7706
|
+
dialog === "create" && /* @__PURE__ */ jsx56(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx56(
|
|
7620
7707
|
CreateOrganization,
|
|
7621
7708
|
{
|
|
7622
7709
|
title: null,
|
|
@@ -7630,13 +7717,13 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7630
7717
|
}
|
|
7631
7718
|
}
|
|
7632
7719
|
) }),
|
|
7633
|
-
dialog === "profile" && active && /* @__PURE__ */
|
|
7720
|
+
dialog === "profile" && active && /* @__PURE__ */ jsx56(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx56(OrganizationProfile, { organizationId: active.id, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
7634
7721
|
] });
|
|
7635
7722
|
}
|
|
7636
7723
|
|
|
7637
7724
|
// src/components/OrganizationList.tsx
|
|
7638
|
-
import * as
|
|
7639
|
-
import { Fragment as Fragment15, jsx as
|
|
7725
|
+
import * as React51 from "react";
|
|
7726
|
+
import { Fragment as Fragment15, jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
7640
7727
|
function OrganizationList({ onOrganizationChange } = {}) {
|
|
7641
7728
|
const t = useT();
|
|
7642
7729
|
const toServerError = useServerError();
|
|
@@ -7644,19 +7731,19 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7644
7731
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
7645
7732
|
const session = useSession();
|
|
7646
7733
|
const api = useAuthClient().organization;
|
|
7647
|
-
const apiRef =
|
|
7734
|
+
const apiRef = React51.useRef(api);
|
|
7648
7735
|
apiRef.current = api;
|
|
7649
7736
|
const enabled = config?.organizations === true && isSignedIn;
|
|
7650
7737
|
const { organizations, isLoading, error: organizationError, refresh } = useOrganizationsResource(enabled);
|
|
7651
7738
|
const { pending, error, run } = useSubmitAction();
|
|
7652
|
-
const [invitations, setInvitations] =
|
|
7653
|
-
const [invitationError, setInvitationError] =
|
|
7654
|
-
const [dialog, setDialog] =
|
|
7655
|
-
const [profileId, setProfileId] =
|
|
7656
|
-
const dialogReturnFocusRef =
|
|
7657
|
-
const invitationRequestRef =
|
|
7739
|
+
const [invitations, setInvitations] = React51.useState(null);
|
|
7740
|
+
const [invitationError, setInvitationError] = React51.useState(null);
|
|
7741
|
+
const [dialog, setDialog] = React51.useState(null);
|
|
7742
|
+
const [profileId, setProfileId] = React51.useState(null);
|
|
7743
|
+
const dialogReturnFocusRef = React51.useRef(null);
|
|
7744
|
+
const invitationRequestRef = React51.useRef(0);
|
|
7658
7745
|
const activeId = session.data?.session.activeOrganizationId ?? null;
|
|
7659
|
-
const loadInvitations =
|
|
7746
|
+
const loadInvitations = React51.useCallback(async () => {
|
|
7660
7747
|
const token = ++invitationRequestRef.current;
|
|
7661
7748
|
if (!enabled) {
|
|
7662
7749
|
setInvitations([]);
|
|
@@ -7676,7 +7763,7 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7676
7763
|
if (token === invitationRequestRef.current) setInvitationError(t("organization.list.invitationsError"));
|
|
7677
7764
|
}
|
|
7678
7765
|
}, [enabled, t, toServerError]);
|
|
7679
|
-
|
|
7766
|
+
React51.useEffect(() => {
|
|
7680
7767
|
setInvitations(null);
|
|
7681
7768
|
setInvitationError(null);
|
|
7682
7769
|
if (!isLoaded) return;
|
|
@@ -7685,9 +7772,9 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7685
7772
|
invitationRequestRef.current += 1;
|
|
7686
7773
|
};
|
|
7687
7774
|
}, [isLoaded, loadInvitations, user?.id]);
|
|
7688
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */
|
|
7775
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ jsx57("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
7689
7776
|
if (config?.organizations !== true) return null;
|
|
7690
|
-
if (!isSignedIn) return /* @__PURE__ */
|
|
7777
|
+
if (!isSignedIn) return /* @__PURE__ */ jsx57("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
7691
7778
|
const setActive = (organization) => {
|
|
7692
7779
|
void run(
|
|
7693
7780
|
() => api.setActive({ organizationId: organization.id }),
|
|
@@ -7728,71 +7815,71 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7728
7815
|
setDialog(null);
|
|
7729
7816
|
setProfileId(null);
|
|
7730
7817
|
};
|
|
7731
|
-
return /* @__PURE__ */
|
|
7732
|
-
/* @__PURE__ */
|
|
7733
|
-
/* @__PURE__ */
|
|
7734
|
-
/* @__PURE__ */
|
|
7735
|
-
/* @__PURE__ */
|
|
7736
|
-
/* @__PURE__ */
|
|
7818
|
+
return /* @__PURE__ */ jsxs51(Fragment15, { children: [
|
|
7819
|
+
/* @__PURE__ */ jsxs51("section", { className: "ba-organization-directory", children: [
|
|
7820
|
+
/* @__PURE__ */ jsxs51("header", { className: "ba-organization-directory-header", children: [
|
|
7821
|
+
/* @__PURE__ */ jsxs51("span", { children: [
|
|
7822
|
+
/* @__PURE__ */ jsx57("h2", { className: "ba-title", children: t("organization.list.title") }),
|
|
7823
|
+
/* @__PURE__ */ jsx57("p", { className: "ba-muted", children: t("organization.list.description") })
|
|
7737
7824
|
] }),
|
|
7738
|
-
/* @__PURE__ */
|
|
7825
|
+
/* @__PURE__ */ jsx57("button", { className: "ba-button", type: "button", onClick: (event) => {
|
|
7739
7826
|
dialogReturnFocusRef.current = event.currentTarget;
|
|
7740
7827
|
setDialog("create");
|
|
7741
7828
|
}, children: t("organization.switcher.create") })
|
|
7742
7829
|
] }),
|
|
7743
|
-
(organizationError || error) && /* @__PURE__ */
|
|
7744
|
-
/* @__PURE__ */
|
|
7745
|
-
organizationError && /* @__PURE__ */
|
|
7830
|
+
(organizationError || error) && /* @__PURE__ */ jsxs51("div", { className: "ba-inline-error", children: [
|
|
7831
|
+
/* @__PURE__ */ jsx57(FormError, { children: organizationError ?? error }),
|
|
7832
|
+
organizationError && /* @__PURE__ */ jsx57("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
7746
7833
|
] }),
|
|
7747
|
-
isLoading ? /* @__PURE__ */
|
|
7748
|
-
/* @__PURE__ */
|
|
7749
|
-
/* @__PURE__ */
|
|
7750
|
-
] }) : organizations?.length ? /* @__PURE__ */
|
|
7751
|
-
/* @__PURE__ */
|
|
7752
|
-
/* @__PURE__ */
|
|
7753
|
-
/* @__PURE__ */
|
|
7754
|
-
/* @__PURE__ */
|
|
7834
|
+
isLoading ? /* @__PURE__ */ jsxs51("div", { className: "ba-organization-card-grid", children: [
|
|
7835
|
+
/* @__PURE__ */ jsx57("div", { className: "ba-skeleton" }),
|
|
7836
|
+
/* @__PURE__ */ jsx57("div", { className: "ba-skeleton" })
|
|
7837
|
+
] }) : organizations?.length ? /* @__PURE__ */ jsx57("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ jsxs51("li", { className: "ba-organization-card", children: [
|
|
7838
|
+
/* @__PURE__ */ jsx57("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7839
|
+
/* @__PURE__ */ jsxs51("span", { className: "ba-organization-card-copy", children: [
|
|
7840
|
+
/* @__PURE__ */ jsx57("strong", { children: organization.name }),
|
|
7841
|
+
/* @__PURE__ */ jsx57("small", { children: /* @__PURE__ */ jsx57(Bidi, { children: organization.slug }) })
|
|
7755
7842
|
] }),
|
|
7756
|
-
activeId === organization.id && /* @__PURE__ */
|
|
7757
|
-
/* @__PURE__ */
|
|
7758
|
-
activeId !== organization.id && /* @__PURE__ */
|
|
7759
|
-
/* @__PURE__ */
|
|
7843
|
+
activeId === organization.id && /* @__PURE__ */ jsx57("span", { className: "ba-organization-active", children: t("organization.list.active") }),
|
|
7844
|
+
/* @__PURE__ */ jsxs51("span", { className: "ba-organization-card-actions", children: [
|
|
7845
|
+
activeId !== organization.id && /* @__PURE__ */ jsx57("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
|
|
7846
|
+
/* @__PURE__ */ jsx57("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
|
|
7760
7847
|
] })
|
|
7761
|
-
] }, organization.id)) }) : /* @__PURE__ */
|
|
7762
|
-
/* @__PURE__ */
|
|
7763
|
-
/* @__PURE__ */
|
|
7764
|
-
/* @__PURE__ */
|
|
7765
|
-
/* @__PURE__ */
|
|
7848
|
+
] }, organization.id)) }) : /* @__PURE__ */ jsx57("p", { className: "ba-muted", children: t("organization.list.empty") }),
|
|
7849
|
+
/* @__PURE__ */ jsxs51("section", { className: "ba-organization-user-invitations", children: [
|
|
7850
|
+
/* @__PURE__ */ jsxs51("header", { className: "ba-organization-section-header", children: [
|
|
7851
|
+
/* @__PURE__ */ jsx57("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
|
|
7852
|
+
/* @__PURE__ */ jsx57("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
|
|
7766
7853
|
] }),
|
|
7767
|
-
invitationError && /* @__PURE__ */
|
|
7768
|
-
/* @__PURE__ */
|
|
7769
|
-
/* @__PURE__ */
|
|
7854
|
+
invitationError && /* @__PURE__ */ jsxs51("div", { className: "ba-inline-error", children: [
|
|
7855
|
+
/* @__PURE__ */ jsx57(FormError, { children: invitationError }),
|
|
7856
|
+
/* @__PURE__ */ jsx57("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
|
|
7770
7857
|
] }),
|
|
7771
|
-
invitations === null && !invitationError ? /* @__PURE__ */
|
|
7772
|
-
/* @__PURE__ */
|
|
7773
|
-
/* @__PURE__ */
|
|
7774
|
-
/* @__PURE__ */
|
|
7858
|
+
invitations === null && !invitationError ? /* @__PURE__ */ jsx57("div", { className: "ba-skeleton" }) : invitations?.length ? /* @__PURE__ */ jsx57("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ jsxs51("li", { className: "ba-organization-invitation", children: [
|
|
7859
|
+
/* @__PURE__ */ jsxs51("span", { children: [
|
|
7860
|
+
/* @__PURE__ */ jsx57("strong", { children: invitation.organizationName }),
|
|
7861
|
+
/* @__PURE__ */ jsx57("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
7775
7862
|
] }),
|
|
7776
|
-
/* @__PURE__ */
|
|
7777
|
-
/* @__PURE__ */
|
|
7778
|
-
/* @__PURE__ */
|
|
7863
|
+
/* @__PURE__ */ jsxs51("span", { className: "ba-organization-card-actions", children: [
|
|
7864
|
+
/* @__PURE__ */ jsx57("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
|
|
7865
|
+
/* @__PURE__ */ jsx57("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
|
|
7779
7866
|
] })
|
|
7780
|
-
] }, invitation.id)) }) : /* @__PURE__ */
|
|
7867
|
+
] }, invitation.id)) }) : /* @__PURE__ */ jsx57("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
|
|
7781
7868
|
] })
|
|
7782
7869
|
] }),
|
|
7783
|
-
dialog === "create" && /* @__PURE__ */
|
|
7870
|
+
dialog === "create" && /* @__PURE__ */ jsx57(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx57(CreateOrganization, { title: null, onCreated: () => {
|
|
7784
7871
|
void (async () => {
|
|
7785
7872
|
await refresh();
|
|
7786
7873
|
await session.refetch({ query: { disableCookieCache: true } });
|
|
7787
7874
|
setDialog(null);
|
|
7788
7875
|
})();
|
|
7789
7876
|
} }) }),
|
|
7790
|
-
dialog === "profile" && profileId && /* @__PURE__ */
|
|
7877
|
+
dialog === "profile" && profileId && /* @__PURE__ */ jsx57(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx57(OrganizationProfile, { organizationId: profileId, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
7791
7878
|
] });
|
|
7792
7879
|
}
|
|
7793
7880
|
|
|
7794
7881
|
// src/components/GoogleOneTap.tsx
|
|
7795
|
-
import * as
|
|
7882
|
+
import * as React52 from "react";
|
|
7796
7883
|
|
|
7797
7884
|
// src/components/google-one-tap.ts
|
|
7798
7885
|
var GOOGLE_IDENTITY_SCRIPT = "https://accounts.google.com/gsi/client";
|
|
@@ -7960,11 +8047,11 @@ function GoogleOneTap({
|
|
|
7960
8047
|
const { config, isLoading: configLoading, isError: configError } = usePublicConfig();
|
|
7961
8048
|
const { user, isLoaded: sessionLoaded } = useUser();
|
|
7962
8049
|
const { signInSocial } = useSignIn();
|
|
7963
|
-
const callbacks =
|
|
8050
|
+
const callbacks = React52.useRef({ onSignedIn, onSkipped, onDismissed, onError });
|
|
7964
8051
|
callbacks.current = { onSignedIn, onSkipped, onDismissed, onError };
|
|
7965
8052
|
const googleEnabled = config?.socialProviders.includes("google") === true;
|
|
7966
8053
|
const clientId = config?.socialProviderClientIds?.google;
|
|
7967
|
-
|
|
8054
|
+
React52.useEffect(() => {
|
|
7968
8055
|
if (configLoading || !sessionLoaded) return;
|
|
7969
8056
|
if (disabled) {
|
|
7970
8057
|
callbacks.current.onSkipped?.("disabled");
|
|
@@ -8086,6 +8173,7 @@ export {
|
|
|
8086
8173
|
AuthLoaded,
|
|
8087
8174
|
AuthLoading,
|
|
8088
8175
|
AuthOwlBadge,
|
|
8176
|
+
AuthOwlBranding,
|
|
8089
8177
|
AuthOwlError,
|
|
8090
8178
|
AuthOwlProvider,
|
|
8091
8179
|
BackupCodesManager,
|