@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.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
AuthLoaded: () => AuthLoaded,
|
|
35
35
|
AuthLoading: () => AuthLoading,
|
|
36
36
|
AuthOwlBadge: () => AuthOwlBadge,
|
|
37
|
+
AuthOwlBranding: () => AuthOwlBranding,
|
|
37
38
|
AuthOwlError: () => import_core5.AuthOwlError,
|
|
38
39
|
AuthOwlProvider: () => AuthOwlProvider,
|
|
39
40
|
BackupCodesManager: () => BackupCodesManager,
|
|
@@ -703,6 +704,8 @@ var en = {
|
|
|
703
704
|
"userButton.openMenuAria": "Account menu",
|
|
704
705
|
"signOut.button": "Sign out",
|
|
705
706
|
"badge.securedBy": "Secured by {brand}",
|
|
707
|
+
"branding.environment.development": "Development",
|
|
708
|
+
"branding.environment.production": "Production",
|
|
706
709
|
"qr.ariaLabel": "QR code",
|
|
707
710
|
"serverError.INVALID_EMAIL_OR_PASSWORD": "Incorrect email or password.",
|
|
708
711
|
"serverError.USER_ALREADY_EXISTS": "An account with this email already exists.",
|
|
@@ -1118,6 +1121,8 @@ var ar = {
|
|
|
1118
1121
|
"userButton.openMenuAria": "\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u062D\u0633\u0627\u0628",
|
|
1119
1122
|
"signOut.button": "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062E\u0631\u0648\u062C",
|
|
1120
1123
|
"badge.securedBy": "\u0645\u062D\u0645\u064A \u0628\u0648\u0627\u0633\u0637\u0629 {brand}",
|
|
1124
|
+
"branding.environment.development": "\u0628\u064A\u0626\u0629 \u0627\u0644\u062A\u0637\u0648\u064A\u0631",
|
|
1125
|
+
"branding.environment.production": "\u0628\u064A\u0626\u0629 \u0627\u0644\u0625\u0646\u062A\u0627\u062C",
|
|
1121
1126
|
"qr.ariaLabel": "\u0631\u0645\u0632 QR",
|
|
1122
1127
|
"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.",
|
|
1123
1128
|
"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.",
|
|
@@ -1548,7 +1553,7 @@ function resolveSignInMethods(config) {
|
|
|
1548
1553
|
const password = capabilities.passwordSignIn;
|
|
1549
1554
|
const username = capabilities.usernameSignIn;
|
|
1550
1555
|
const magicLink = capabilities.magicLinkSignIn;
|
|
1551
|
-
const emailOtp = capabilities.emailOtpSignIn;
|
|
1556
|
+
const emailOtp = capabilities.emailOtpSignIn && !capabilities.totp && !capabilities.mfaRequired;
|
|
1552
1557
|
const phoneOtp = capabilities.phoneSignIn;
|
|
1553
1558
|
const passkey = capabilities.passkeySignIn;
|
|
1554
1559
|
const sso = has("sso");
|
|
@@ -1579,7 +1584,7 @@ function resolveSignInMethods(config) {
|
|
|
1579
1584
|
}
|
|
1580
1585
|
|
|
1581
1586
|
// src/components/SignIn.tsx
|
|
1582
|
-
var
|
|
1587
|
+
var React13 = __toESM(require("react"), 1);
|
|
1583
1588
|
|
|
1584
1589
|
// src/components/redirect.ts
|
|
1585
1590
|
function isSafeRedirect(redirectTo, origin) {
|
|
@@ -2233,8 +2238,11 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
2233
2238
|
}
|
|
2234
2239
|
)
|
|
2235
2240
|
] }),
|
|
2236
|
-
mode !== "backup" && allowTrustDevice && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "ba-consent", children: [
|
|
2237
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
2241
|
+
mode !== "backup" && allowTrustDevice && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "ba-consent ba-consent-centered", children: [
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "ba-checkbox-control", children: [
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { className: "ba-checkbox", type: "checkbox", checked: trustDevice, onChange: (e) => setTrustDevice(e.target.checked) }),
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "ba-checkbox-visual", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "ba-checkbox-check" }) })
|
|
2245
|
+
] }),
|
|
2238
2246
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: t("mfa.challenge.trustDevice", { days: 30 }) })
|
|
2239
2247
|
] }),
|
|
2240
2248
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FormError, { children: error }),
|
|
@@ -2500,9 +2508,65 @@ function PhoneOTP({ redirectTo, onSignedIn, onBack }) {
|
|
|
2500
2508
|
);
|
|
2501
2509
|
}
|
|
2502
2510
|
|
|
2503
|
-
// src/components/
|
|
2511
|
+
// src/components/AuthOwlBranding.tsx
|
|
2512
|
+
var React12 = __toESM(require("react"), 1);
|
|
2504
2513
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2505
|
-
function
|
|
2514
|
+
function AuthOwlBranding({ href, showEnvironment = true } = {}) {
|
|
2515
|
+
const t = useT();
|
|
2516
|
+
const { config } = usePublicConfig();
|
|
2517
|
+
const logoUrl = config?.branding?.logoUrl;
|
|
2518
|
+
const appName = config?.branding?.appName?.trim() ?? "";
|
|
2519
|
+
const showAppName = config?.branding?.showAppName !== false && appName.length > 0;
|
|
2520
|
+
const alignment = config?.branding?.alignment ?? "left";
|
|
2521
|
+
const [logoFailed, setLogoFailed] = React12.useState(false);
|
|
2522
|
+
React12.useEffect(() => setLogoFailed(false), [logoUrl]);
|
|
2523
|
+
if (!config) return null;
|
|
2524
|
+
if (!logoUrl && !showAppName && (!showEnvironment || !config.environmentType)) return null;
|
|
2525
|
+
const identity = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "ba-branding-identity", children: [
|
|
2526
|
+
logoUrl && !logoFailed ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2527
|
+
"img",
|
|
2528
|
+
{
|
|
2529
|
+
className: "ba-branding-logo",
|
|
2530
|
+
src: logoUrl,
|
|
2531
|
+
alt: showAppName ? `${appName} logo` : "Application logo",
|
|
2532
|
+
referrerPolicy: "no-referrer",
|
|
2533
|
+
onError: () => setLogoFailed(true)
|
|
2534
|
+
}
|
|
2535
|
+
) : showAppName ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ba-branding-fallback", "aria-hidden": "true", children: appName.charAt(0).toLocaleUpperCase() }) : null,
|
|
2536
|
+
showAppName ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ba-branding-name", children: appName }) : null
|
|
2537
|
+
] });
|
|
2538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2539
|
+
"header",
|
|
2540
|
+
{
|
|
2541
|
+
className: `ba-branding ba-branding-align-${alignment}`,
|
|
2542
|
+
"data-testid": "authowl-branding",
|
|
2543
|
+
children: [
|
|
2544
|
+
href ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("a", { className: "ba-branding-link", href, children: identity }) : identity,
|
|
2545
|
+
showEnvironment && config.environmentType ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2546
|
+
"span",
|
|
2547
|
+
{
|
|
2548
|
+
className: `ba-environment ba-environment-${config.environmentType}`,
|
|
2549
|
+
"data-testid": "authowl-environment",
|
|
2550
|
+
children: [
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ba-environment-dot", "aria-hidden": "true" }),
|
|
2552
|
+
t(`branding.environment.${config.environmentType}`)
|
|
2553
|
+
]
|
|
2554
|
+
}
|
|
2555
|
+
) : null
|
|
2556
|
+
]
|
|
2557
|
+
}
|
|
2558
|
+
);
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
// src/components/SignIn.tsx
|
|
2562
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2563
|
+
function SignIn({
|
|
2564
|
+
redirectTo,
|
|
2565
|
+
onSignedIn,
|
|
2566
|
+
resetPasswordUrl,
|
|
2567
|
+
showBadge,
|
|
2568
|
+
showBranding = true
|
|
2569
|
+
} = {}) {
|
|
2506
2570
|
const t = useT();
|
|
2507
2571
|
const { sessionStore } = useAuthClient();
|
|
2508
2572
|
const {
|
|
@@ -2516,47 +2580,51 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2516
2580
|
const { config, isLoading, isError } = usePublicConfig();
|
|
2517
2581
|
const { pending, error, setError, run } = useSubmitAction();
|
|
2518
2582
|
const authChallenge = useAuthChallenge();
|
|
2519
|
-
const [email, setEmail] =
|
|
2520
|
-
const [username, setUsername] =
|
|
2521
|
-
const [password, setPassword] =
|
|
2522
|
-
const [credentialMode, setCredentialMode] =
|
|
2523
|
-
const [otp, setOtp] =
|
|
2524
|
-
const [view, setView] =
|
|
2583
|
+
const [email, setEmail] = React13.useState("");
|
|
2584
|
+
const [username, setUsername] = React13.useState("");
|
|
2585
|
+
const [password, setPassword] = React13.useState("");
|
|
2586
|
+
const [credentialMode, setCredentialMode] = React13.useState("email");
|
|
2587
|
+
const [otp, setOtp] = React13.useState("");
|
|
2588
|
+
const [view, setView] = React13.useState(
|
|
2525
2589
|
"sign-in"
|
|
2526
2590
|
);
|
|
2527
|
-
const [inFlight, setInFlight] =
|
|
2528
|
-
const [challenge, setChallenge] =
|
|
2529
|
-
const emailRef =
|
|
2591
|
+
const [inFlight, setInFlight] = React13.useState(null);
|
|
2592
|
+
const [challenge, setChallenge] = React13.useState(false);
|
|
2593
|
+
const emailRef = React13.useRef(null);
|
|
2530
2594
|
const plan = resolveSignInMethods(config);
|
|
2531
2595
|
usePasskeyAutofill({
|
|
2532
2596
|
enabled: credentialMode === "email" && plan.autofillHost !== null,
|
|
2533
2597
|
redirectTo,
|
|
2534
2598
|
onSignedIn
|
|
2535
2599
|
});
|
|
2536
|
-
const badge = /* @__PURE__ */ (0,
|
|
2600
|
+
const badge = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AuthOwlBadge, { force: showBadge });
|
|
2601
|
+
const branding = showBranding ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AuthOwlBranding, {}) : null;
|
|
2537
2602
|
if (isLoading) {
|
|
2538
|
-
return /* @__PURE__ */ (0,
|
|
2539
|
-
/* @__PURE__ */ (0,
|
|
2540
|
-
/* @__PURE__ */ (0,
|
|
2603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ba-form", "data-testid": "signin-loading", "aria-busy": "true", children: [
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "ba-skeleton" }),
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "ba-skeleton" })
|
|
2541
2606
|
] });
|
|
2542
2607
|
}
|
|
2543
2608
|
if (challenge) {
|
|
2544
|
-
return /* @__PURE__ */ (0,
|
|
2545
|
-
|
|
2609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ba-form", "data-testid": "signin-mfa", children: [
|
|
2610
|
+
branding,
|
|
2611
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MFAChallenge, { onVerified: () => finishSignIn({ sessionStore, redirectTo, onSignedIn }) }),
|
|
2546
2612
|
badge
|
|
2547
2613
|
] });
|
|
2548
2614
|
}
|
|
2549
2615
|
if (view === "forgot" && resetPasswordUrl) {
|
|
2550
|
-
return /* @__PURE__ */ (0,
|
|
2551
|
-
|
|
2552
|
-
/* @__PURE__ */ (0,
|
|
2616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ba-form", "data-testid": "signin-forgot", children: [
|
|
2617
|
+
branding,
|
|
2618
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: "ba-title", children: t("signIn.forgotTitle") }),
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ForgotPassword, { resetPasswordUrl, onBack: () => setView("sign-in") }),
|
|
2553
2620
|
badge
|
|
2554
2621
|
] });
|
|
2555
2622
|
}
|
|
2556
2623
|
if (view === "otp-code") {
|
|
2557
|
-
return /* @__PURE__ */ (0,
|
|
2558
|
-
|
|
2559
|
-
/* @__PURE__ */ (0,
|
|
2624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ba-form", "data-testid": "signin-otp-code", children: [
|
|
2625
|
+
branding,
|
|
2626
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2560
2628
|
OtpCodeForm,
|
|
2561
2629
|
{
|
|
2562
2630
|
email,
|
|
@@ -2582,16 +2650,18 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2582
2650
|
] });
|
|
2583
2651
|
}
|
|
2584
2652
|
if (view === "magic-sent") {
|
|
2585
|
-
return /* @__PURE__ */ (0,
|
|
2586
|
-
|
|
2587
|
-
/* @__PURE__ */ (0,
|
|
2588
|
-
/* @__PURE__ */ (0,
|
|
2653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ba-form", "data-testid": "signin-magic-sent", children: [
|
|
2654
|
+
branding,
|
|
2655
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
2656
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "ba-muted", children: t("magicLink.sent") }),
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "ba-link-button", onClick: () => setView("sign-in"), children: t("forgotPassword.backToSignIn") }),
|
|
2589
2658
|
badge
|
|
2590
2659
|
] });
|
|
2591
2660
|
}
|
|
2592
2661
|
if (view === "phone") {
|
|
2593
|
-
return /* @__PURE__ */ (0,
|
|
2594
|
-
|
|
2662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ba-form", "data-testid": "signin-phone", children: [
|
|
2663
|
+
branding,
|
|
2664
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2595
2665
|
PhoneOTP,
|
|
2596
2666
|
{
|
|
2597
2667
|
redirectTo,
|
|
@@ -2663,12 +2733,13 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2663
2733
|
{ key: "otp", enabled: plan.emailOtp, action: doRequestOtp, label: t("emailOtp.requestSubmit"), pendingLabel: t("common.sending") },
|
|
2664
2734
|
{ key: "sso", enabled: plan.sso, action: doSso, label: t("sso.continueWith"), pendingLabel: t("sso.redirecting") }
|
|
2665
2735
|
];
|
|
2666
|
-
return /* @__PURE__ */ (0,
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
/* @__PURE__ */ (0,
|
|
2670
|
-
|
|
2671
|
-
|
|
2736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ba-form", "data-testid": "signin-form", children: [
|
|
2737
|
+
branding,
|
|
2738
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
2739
|
+
process.env.NODE_ENV !== "production" && isError && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("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." }),
|
|
2740
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SocialButtons, { providers: plan.social, callbackURL: redirectTo }),
|
|
2741
|
+
showDivider && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
2742
|
+
hasCredentialForm && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2672
2743
|
"form",
|
|
2673
2744
|
{
|
|
2674
2745
|
method: "post",
|
|
@@ -2679,9 +2750,9 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2679
2750
|
else if (plan.primary) PRIMARY_ACTION[plan.primary]();
|
|
2680
2751
|
},
|
|
2681
2752
|
children: [
|
|
2682
|
-
credentialMode === "email" ? /* @__PURE__ */ (0,
|
|
2753
|
+
credentialMode === "email" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "ba-label", children: [
|
|
2683
2754
|
t("common.emailLabel"),
|
|
2684
|
-
/* @__PURE__ */ (0,
|
|
2755
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2685
2756
|
"input",
|
|
2686
2757
|
{
|
|
2687
2758
|
ref: emailRef,
|
|
@@ -2696,9 +2767,9 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2696
2767
|
required: true
|
|
2697
2768
|
}
|
|
2698
2769
|
)
|
|
2699
|
-
] }) : /* @__PURE__ */ (0,
|
|
2770
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "ba-label", children: [
|
|
2700
2771
|
t("common.usernameLabel"),
|
|
2701
|
-
/* @__PURE__ */ (0,
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2702
2773
|
"input",
|
|
2703
2774
|
{
|
|
2704
2775
|
className: "ba-input",
|
|
@@ -2713,9 +2784,9 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2713
2784
|
}
|
|
2714
2785
|
)
|
|
2715
2786
|
] }),
|
|
2716
|
-
plan.password && /* @__PURE__ */ (0,
|
|
2787
|
+
plan.password && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "ba-label", children: [
|
|
2717
2788
|
t("common.passwordLabel"),
|
|
2718
|
-
/* @__PURE__ */ (0,
|
|
2789
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2719
2790
|
"input",
|
|
2720
2791
|
{
|
|
2721
2792
|
className: "ba-input",
|
|
@@ -2731,19 +2802,19 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2731
2802
|
)
|
|
2732
2803
|
] }),
|
|
2733
2804
|
authChallenge.control,
|
|
2734
|
-
/* @__PURE__ */ (0,
|
|
2735
|
-
plan.password && /* @__PURE__ */ (0,
|
|
2736
|
-
/* @__PURE__ */ (0,
|
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormError, { children: error }),
|
|
2806
|
+
plan.password && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2807
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2737
2808
|
"button",
|
|
2738
2809
|
{
|
|
2739
2810
|
className: "ba-button",
|
|
2740
2811
|
type: "submit",
|
|
2741
2812
|
disabled: pending || authChallenge.configPending,
|
|
2742
2813
|
"aria-busy": pending && inFlight === "password" || void 0,
|
|
2743
|
-
children: /* @__PURE__ */ (0,
|
|
2814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Busy, { busy: pending && inFlight === "password", label: t("signIn.submitPending"), children: t("signIn.submit") })
|
|
2744
2815
|
}
|
|
2745
2816
|
),
|
|
2746
|
-
resetPasswordUrl && /* @__PURE__ */ (0,
|
|
2817
|
+
resetPasswordUrl && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2747
2818
|
"button",
|
|
2748
2819
|
{
|
|
2749
2820
|
type: "button",
|
|
@@ -2755,7 +2826,7 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2755
2826
|
] }),
|
|
2756
2827
|
credentialMode === "email" && alternates.filter((a) => a.enabled).map(({ key, action, label: label2, pendingLabel }) => {
|
|
2757
2828
|
const isPrimary = plan.primary === key;
|
|
2758
|
-
return /* @__PURE__ */ (0,
|
|
2829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2759
2830
|
"button",
|
|
2760
2831
|
{
|
|
2761
2832
|
type: isPrimary ? "submit" : "button",
|
|
@@ -2763,12 +2834,12 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2763
2834
|
disabled: pending || authChallenge.configPending,
|
|
2764
2835
|
"aria-busy": pending && inFlight === key || void 0,
|
|
2765
2836
|
onClick: isPrimary ? void 0 : withEmail(action),
|
|
2766
|
-
children: /* @__PURE__ */ (0,
|
|
2837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Busy, { busy: pending && inFlight === key, label: pendingLabel, children: label2 })
|
|
2767
2838
|
},
|
|
2768
2839
|
key
|
|
2769
2840
|
);
|
|
2770
2841
|
}),
|
|
2771
|
-
plan.username && /* @__PURE__ */ (0,
|
|
2842
|
+
plan.username && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2772
2843
|
"button",
|
|
2773
2844
|
{
|
|
2774
2845
|
type: "button",
|
|
@@ -2784,8 +2855,8 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2784
2855
|
]
|
|
2785
2856
|
}
|
|
2786
2857
|
),
|
|
2787
|
-
plan.passkey && /* @__PURE__ */ (0,
|
|
2788
|
-
plan.phoneOtp && /* @__PURE__ */ (0,
|
|
2858
|
+
plan.passkey && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PasskeyButton, { redirectTo, onSignedIn }),
|
|
2859
|
+
plan.phoneOtp && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2789
2860
|
"button",
|
|
2790
2861
|
{
|
|
2791
2862
|
type: "button",
|
|
@@ -2794,17 +2865,17 @@ function SignIn({ redirectTo, onSignedIn, resetPasswordUrl, showBadge } = {}) {
|
|
|
2794
2865
|
children: t("phoneOtp.usePhone")
|
|
2795
2866
|
}
|
|
2796
2867
|
),
|
|
2797
|
-
!plan.renderable && /* @__PURE__ */ (0,
|
|
2868
|
+
!plan.renderable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "ba-muted", children: plan.emptyReason === "unsupported" ? t("signIn.empty.unsupported") : t("signIn.empty.none") }),
|
|
2798
2869
|
badge
|
|
2799
2870
|
] });
|
|
2800
2871
|
}
|
|
2801
2872
|
|
|
2802
2873
|
// src/components/SignUp.tsx
|
|
2803
|
-
var
|
|
2874
|
+
var React17 = __toESM(require("react"), 1);
|
|
2804
2875
|
|
|
2805
2876
|
// src/components/VerificationPending.tsx
|
|
2806
|
-
var
|
|
2807
|
-
var
|
|
2877
|
+
var React14 = __toESM(require("react"), 1);
|
|
2878
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2808
2879
|
function VerificationPending({
|
|
2809
2880
|
email,
|
|
2810
2881
|
callbackURL,
|
|
@@ -2818,14 +2889,14 @@ function VerificationPending({
|
|
|
2818
2889
|
} = useEmailVerification();
|
|
2819
2890
|
const { pending, error, run } = useSubmitAction();
|
|
2820
2891
|
const authChallenge = useAuthChallenge();
|
|
2821
|
-
const [resent, setResent] =
|
|
2822
|
-
const [code, setCode] =
|
|
2823
|
-
const [verified, setVerified] =
|
|
2892
|
+
const [resent, setResent] = React14.useState(false);
|
|
2893
|
+
const [code, setCode] = React14.useState("");
|
|
2894
|
+
const [verified, setVerified] = React14.useState(false);
|
|
2824
2895
|
if (verified) {
|
|
2825
|
-
return /* @__PURE__ */ (0,
|
|
2896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "ba-success", role: "status", "data-testid": "verify-code-success", children: t("verifyEmail.success") });
|
|
2826
2897
|
}
|
|
2827
2898
|
if (method === "code") {
|
|
2828
|
-
return /* @__PURE__ */ (0,
|
|
2899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2829
2900
|
"form",
|
|
2830
2901
|
{
|
|
2831
2902
|
method: "post",
|
|
@@ -2842,12 +2913,12 @@ function VerificationPending({
|
|
|
2842
2913
|
);
|
|
2843
2914
|
},
|
|
2844
2915
|
children: [
|
|
2845
|
-
/* @__PURE__ */ (0,
|
|
2846
|
-
email: /* @__PURE__ */ (0,
|
|
2916
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "ba-muted", children: richMessage(t("verifyPending.codeBody"), {
|
|
2917
|
+
email: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Bidi, { children: email }) })
|
|
2847
2918
|
}) }),
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2919
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "ba-label", children: [
|
|
2849
2920
|
t("verifyPending.codeLabel"),
|
|
2850
|
-
/* @__PURE__ */ (0,
|
|
2921
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2851
2922
|
"input",
|
|
2852
2923
|
{
|
|
2853
2924
|
className: "ba-input",
|
|
@@ -2859,20 +2930,20 @@ function VerificationPending({
|
|
|
2859
2930
|
}
|
|
2860
2931
|
)
|
|
2861
2932
|
] }),
|
|
2862
|
-
resent && /* @__PURE__ */ (0,
|
|
2933
|
+
resent && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "ba-muted", children: t("verifyPending.resent") }),
|
|
2863
2934
|
authChallenge.control,
|
|
2864
|
-
/* @__PURE__ */ (0,
|
|
2865
|
-
/* @__PURE__ */ (0,
|
|
2935
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FormError, { children: error }),
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2866
2937
|
"button",
|
|
2867
2938
|
{
|
|
2868
2939
|
className: "ba-button",
|
|
2869
2940
|
type: "submit",
|
|
2870
2941
|
disabled: pending || !code,
|
|
2871
2942
|
"aria-busy": pending || void 0,
|
|
2872
|
-
children: /* @__PURE__ */ (0,
|
|
2943
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Busy, { busy: pending, label: t("common.verifying"), children: t("emailOtp.verifySubmit") })
|
|
2873
2944
|
}
|
|
2874
2945
|
),
|
|
2875
|
-
/* @__PURE__ */ (0,
|
|
2946
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2876
2947
|
"button",
|
|
2877
2948
|
{
|
|
2878
2949
|
type: "button",
|
|
@@ -2898,14 +2969,14 @@ function VerificationPending({
|
|
|
2898
2969
|
}
|
|
2899
2970
|
);
|
|
2900
2971
|
}
|
|
2901
|
-
return /* @__PURE__ */ (0,
|
|
2902
|
-
/* @__PURE__ */ (0,
|
|
2903
|
-
email: /* @__PURE__ */ (0,
|
|
2972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ba-fields", "data-testid": "verify-pending", children: [
|
|
2973
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "ba-muted", children: richMessage(t("verifyPending.body"), {
|
|
2974
|
+
email: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Bidi, { children: email }) })
|
|
2904
2975
|
}) }),
|
|
2905
|
-
resent && /* @__PURE__ */ (0,
|
|
2976
|
+
resent && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "ba-muted", children: t("verifyPending.resent") }),
|
|
2906
2977
|
authChallenge.control,
|
|
2907
|
-
/* @__PURE__ */ (0,
|
|
2908
|
-
/* @__PURE__ */ (0,
|
|
2978
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FormError, { children: error }),
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2909
2980
|
"button",
|
|
2910
2981
|
{
|
|
2911
2982
|
type: "button",
|
|
@@ -2916,25 +2987,25 @@ function VerificationPending({
|
|
|
2916
2987
|
failure: t("verifyPending.error.resendFailed"),
|
|
2917
2988
|
onSuccess: () => setResent(true)
|
|
2918
2989
|
}),
|
|
2919
|
-
children: /* @__PURE__ */ (0,
|
|
2990
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Busy, { busy: pending, label: t("common.sending"), children: t("verifyPending.resendButton") })
|
|
2920
2991
|
}
|
|
2921
2992
|
)
|
|
2922
2993
|
] });
|
|
2923
2994
|
}
|
|
2924
2995
|
|
|
2925
2996
|
// src/components/PasswordlessSignUp.tsx
|
|
2926
|
-
var
|
|
2927
|
-
var
|
|
2997
|
+
var React15 = __toESM(require("react"), 1);
|
|
2998
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2928
2999
|
function PasswordlessSignUp({ onAuthenticated }) {
|
|
2929
3000
|
const t = useT();
|
|
2930
3001
|
const { sendEmailOtp, signInEmailOtp } = useSignIn();
|
|
2931
3002
|
const { pending, error, setError, run } = useSubmitAction();
|
|
2932
3003
|
const authChallenge = useAuthChallenge();
|
|
2933
|
-
const [email, setEmail] =
|
|
2934
|
-
const [code, setCode] =
|
|
2935
|
-
const [codeSent, setCodeSent] =
|
|
3004
|
+
const [email, setEmail] = React15.useState("");
|
|
3005
|
+
const [code, setCode] = React15.useState("");
|
|
3006
|
+
const [codeSent, setCodeSent] = React15.useState(false);
|
|
2936
3007
|
if (codeSent) {
|
|
2937
|
-
return /* @__PURE__ */ (0,
|
|
3008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "ba-fields", "data-testid": "signup-emailotp-code", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2938
3009
|
OtpCodeForm,
|
|
2939
3010
|
{
|
|
2940
3011
|
email,
|
|
@@ -2954,7 +3025,7 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
2954
3025
|
}
|
|
2955
3026
|
) });
|
|
2956
3027
|
}
|
|
2957
|
-
return /* @__PURE__ */ (0,
|
|
3028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2958
3029
|
"form",
|
|
2959
3030
|
{
|
|
2960
3031
|
method: "post",
|
|
@@ -2968,9 +3039,9 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
2968
3039
|
});
|
|
2969
3040
|
},
|
|
2970
3041
|
children: [
|
|
2971
|
-
/* @__PURE__ */ (0,
|
|
3042
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "ba-label", children: [
|
|
2972
3043
|
t("common.emailLabel"),
|
|
2973
|
-
/* @__PURE__ */ (0,
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2974
3045
|
"input",
|
|
2975
3046
|
{
|
|
2976
3047
|
className: "ba-input",
|
|
@@ -2983,15 +3054,15 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
2983
3054
|
)
|
|
2984
3055
|
] }),
|
|
2985
3056
|
authChallenge.control,
|
|
2986
|
-
/* @__PURE__ */ (0,
|
|
2987
|
-
/* @__PURE__ */ (0,
|
|
3057
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FormError, { children: error }),
|
|
3058
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2988
3059
|
"button",
|
|
2989
3060
|
{
|
|
2990
3061
|
className: "ba-button ba-button-secondary",
|
|
2991
3062
|
type: "submit",
|
|
2992
3063
|
disabled: pending || authChallenge.configPending,
|
|
2993
3064
|
"aria-busy": pending || void 0,
|
|
2994
|
-
children: /* @__PURE__ */ (0,
|
|
3065
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Busy, { busy: pending, label: t("common.sending"), children: t("signUp.passwordlessSubmit") })
|
|
2995
3066
|
}
|
|
2996
3067
|
)
|
|
2997
3068
|
]
|
|
@@ -3000,16 +3071,16 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
3000
3071
|
}
|
|
3001
3072
|
|
|
3002
3073
|
// src/components/PasskeySignUpCompletion.tsx
|
|
3003
|
-
var
|
|
3074
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3004
3075
|
function PasskeySignUpCompletion({ onComplete }) {
|
|
3005
3076
|
const t = useT();
|
|
3006
3077
|
const { addPasskey } = usePasskeys();
|
|
3007
3078
|
const { pending, error, run } = useSubmitAction();
|
|
3008
|
-
return /* @__PURE__ */ (0,
|
|
3009
|
-
/* @__PURE__ */ (0,
|
|
3010
|
-
/* @__PURE__ */ (0,
|
|
3011
|
-
/* @__PURE__ */ (0,
|
|
3012
|
-
/* @__PURE__ */ (0,
|
|
3079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ba-fields", "data-testid": "signup-passkey-completion", children: [
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { className: "ba-title", children: t("signUp.passkeyTitle") }),
|
|
3081
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "ba-muted", children: t("signUp.passkeyDescription") }),
|
|
3082
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FormError, { children: error }),
|
|
3083
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3013
3084
|
"button",
|
|
3014
3085
|
{
|
|
3015
3086
|
className: "ba-button",
|
|
@@ -3020,34 +3091,36 @@ function PasskeySignUpCompletion({ onComplete }) {
|
|
|
3020
3091
|
failure: t("signUp.error.passkeyFailed"),
|
|
3021
3092
|
onSuccess: onComplete
|
|
3022
3093
|
}),
|
|
3023
|
-
children: /* @__PURE__ */ (0,
|
|
3094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Busy, { busy: pending, label: t("passkey.waiting"), children: t("signUp.passkeySubmit") })
|
|
3024
3095
|
}
|
|
3025
3096
|
),
|
|
3026
|
-
/* @__PURE__ */ (0,
|
|
3097
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: onComplete, children: t("signUp.passkeySkip") })
|
|
3027
3098
|
] });
|
|
3028
3099
|
}
|
|
3029
3100
|
|
|
3030
3101
|
// src/components/Waitlist.tsx
|
|
3031
|
-
var
|
|
3032
|
-
var
|
|
3033
|
-
function Waitlist({ onJoined, showBadge } = {}) {
|
|
3102
|
+
var React16 = __toESM(require("react"), 1);
|
|
3103
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3104
|
+
function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
3034
3105
|
const t = useT();
|
|
3035
3106
|
const { join } = useWaitlist();
|
|
3036
3107
|
const { pending, error, run } = useSubmitAction();
|
|
3037
3108
|
const authChallenge = useAuthChallenge();
|
|
3038
|
-
const [email, setEmail] =
|
|
3039
|
-
const [joined, setJoined] =
|
|
3109
|
+
const [email, setEmail] = React16.useState("");
|
|
3110
|
+
const [joined, setJoined] = React16.useState(false);
|
|
3040
3111
|
if (joined) {
|
|
3041
|
-
return /* @__PURE__ */ (0,
|
|
3042
|
-
/* @__PURE__ */ (0,
|
|
3043
|
-
/* @__PURE__ */ (0,
|
|
3044
|
-
/* @__PURE__ */ (0,
|
|
3112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "ba-form", "data-testid": "waitlist-accepted", children: [
|
|
3113
|
+
showBranding ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AuthOwlBranding, {}) : null,
|
|
3114
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "ba-title", children: t("waitlist.acceptedTitle") }),
|
|
3115
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "ba-muted", children: t("waitlist.acceptedDescription") }),
|
|
3116
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AuthOwlBadge, { force: showBadge })
|
|
3045
3117
|
] });
|
|
3046
3118
|
}
|
|
3047
|
-
return /* @__PURE__ */ (0,
|
|
3048
|
-
/* @__PURE__ */ (0,
|
|
3049
|
-
/* @__PURE__ */ (0,
|
|
3050
|
-
/* @__PURE__ */ (0,
|
|
3119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "ba-form", "data-testid": "waitlist-form", children: [
|
|
3120
|
+
showBranding ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AuthOwlBranding, {}) : null,
|
|
3121
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "ba-title", children: t("waitlist.title") }),
|
|
3122
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "ba-muted", children: t("waitlist.description") }),
|
|
3123
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3051
3124
|
"form",
|
|
3052
3125
|
{
|
|
3053
3126
|
method: "post",
|
|
@@ -3069,9 +3142,9 @@ function Waitlist({ onJoined, showBadge } = {}) {
|
|
|
3069
3142
|
);
|
|
3070
3143
|
},
|
|
3071
3144
|
children: [
|
|
3072
|
-
/* @__PURE__ */ (0,
|
|
3145
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "ba-label", children: [
|
|
3073
3146
|
t("common.emailLabel"),
|
|
3074
|
-
/* @__PURE__ */ (0,
|
|
3147
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3075
3148
|
"input",
|
|
3076
3149
|
{
|
|
3077
3150
|
className: "ba-input",
|
|
@@ -3085,47 +3158,48 @@ function Waitlist({ onJoined, showBadge } = {}) {
|
|
|
3085
3158
|
)
|
|
3086
3159
|
] }),
|
|
3087
3160
|
authChallenge.control,
|
|
3088
|
-
/* @__PURE__ */ (0,
|
|
3089
|
-
/* @__PURE__ */ (0,
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FormError, { children: error }),
|
|
3162
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3090
3163
|
"button",
|
|
3091
3164
|
{
|
|
3092
3165
|
className: "ba-button",
|
|
3093
3166
|
type: "submit",
|
|
3094
3167
|
disabled: pending || authChallenge.configPending,
|
|
3095
3168
|
"aria-busy": pending || void 0,
|
|
3096
|
-
children: /* @__PURE__ */ (0,
|
|
3169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Busy, { busy: pending, label: t("waitlist.submitPending"), children: t("waitlist.submit") })
|
|
3097
3170
|
}
|
|
3098
3171
|
)
|
|
3099
3172
|
]
|
|
3100
3173
|
}
|
|
3101
3174
|
),
|
|
3102
|
-
/* @__PURE__ */ (0,
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AuthOwlBadge, { force: showBadge })
|
|
3103
3176
|
] });
|
|
3104
3177
|
}
|
|
3105
3178
|
|
|
3106
3179
|
// src/components/SignUp.tsx
|
|
3107
|
-
var
|
|
3180
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3108
3181
|
function SignUp({
|
|
3109
3182
|
redirectTo,
|
|
3110
3183
|
onSignedUp,
|
|
3111
3184
|
verifyEmailUrl,
|
|
3112
3185
|
showBadge,
|
|
3113
|
-
onWaitlisted
|
|
3186
|
+
onWaitlisted,
|
|
3187
|
+
showBranding = true
|
|
3114
3188
|
} = {}) {
|
|
3115
3189
|
const t = useT();
|
|
3116
3190
|
const toServerError = useServerError();
|
|
3117
3191
|
const { signUp } = useSignUp();
|
|
3118
3192
|
const { config, isLoading } = usePublicConfig();
|
|
3119
3193
|
const authChallenge = useAuthChallenge();
|
|
3120
|
-
const [email, setEmail] =
|
|
3121
|
-
const [password, setPassword] =
|
|
3122
|
-
const [name, setName] =
|
|
3123
|
-
const [firstName, setFirstName] =
|
|
3124
|
-
const [lastName, setLastName] =
|
|
3125
|
-
const [username, setUsername] =
|
|
3126
|
-
const [error, setError] =
|
|
3127
|
-
const [submitting, setSubmitting] =
|
|
3128
|
-
const [accepted, setAccepted] =
|
|
3194
|
+
const [email, setEmail] = React17.useState("");
|
|
3195
|
+
const [password, setPassword] = React17.useState("");
|
|
3196
|
+
const [name, setName] = React17.useState("");
|
|
3197
|
+
const [firstName, setFirstName] = React17.useState("");
|
|
3198
|
+
const [lastName, setLastName] = React17.useState("");
|
|
3199
|
+
const [username, setUsername] = React17.useState("");
|
|
3200
|
+
const [error, setError] = React17.useState(null);
|
|
3201
|
+
const [submitting, setSubmitting] = React17.useState(false);
|
|
3202
|
+
const [accepted, setAccepted] = React17.useState(false);
|
|
3129
3203
|
const legal = config?.legal;
|
|
3130
3204
|
const consentRequired = Boolean(legal?.required);
|
|
3131
3205
|
const consentBlocked = consentRequired && !accepted;
|
|
@@ -3133,8 +3207,8 @@ function SignUp({
|
|
|
3133
3207
|
const passwordMinLength = capabilities.passwordMinLength;
|
|
3134
3208
|
const passwordMaxLength = capabilities.passwordMaxLength;
|
|
3135
3209
|
const passkeysEnabled = capabilities.passkeyAdd;
|
|
3136
|
-
const [pendingEmail, setPendingEmail] =
|
|
3137
|
-
const [completeWithPasskey, setCompleteWithPasskey] =
|
|
3210
|
+
const [pendingEmail, setPendingEmail] = React17.useState(null);
|
|
3211
|
+
const [completeWithPasskey, setCompleteWithPasskey] = React17.useState(false);
|
|
3138
3212
|
function finishSignUp() {
|
|
3139
3213
|
onSignedUp?.();
|
|
3140
3214
|
if (redirectTo) window.location.assign(redirectTo);
|
|
@@ -3187,17 +3261,18 @@ function SignUp({
|
|
|
3187
3261
|
}
|
|
3188
3262
|
}
|
|
3189
3263
|
if (isLoading) {
|
|
3190
|
-
return /* @__PURE__ */ (0,
|
|
3191
|
-
/* @__PURE__ */ (0,
|
|
3192
|
-
/* @__PURE__ */ (0,
|
|
3264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "ba-form", "data-testid": "signup-loading", "aria-busy": "true", children: [
|
|
3265
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "ba-skeleton" }),
|
|
3266
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "ba-skeleton" })
|
|
3193
3267
|
] });
|
|
3194
3268
|
}
|
|
3195
3269
|
if (config?.signUp?.mode === "waitlist") {
|
|
3196
|
-
return /* @__PURE__ */ (0,
|
|
3270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Waitlist, { onJoined: onWaitlisted, showBadge, showBranding });
|
|
3197
3271
|
}
|
|
3198
3272
|
if (pendingEmail) {
|
|
3199
|
-
return /* @__PURE__ */ (0,
|
|
3200
|
-
/* @__PURE__ */ (0,
|
|
3273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "ba-form", "data-testid": "signup-verify-pending", children: [
|
|
3274
|
+
showBranding ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AuthOwlBranding, {}) : null,
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3201
3276
|
VerificationPending,
|
|
3202
3277
|
{
|
|
3203
3278
|
email: pendingEmail,
|
|
@@ -3205,7 +3280,7 @@ function SignUp({
|
|
|
3205
3280
|
method: capabilities.emailVerificationMethod
|
|
3206
3281
|
}
|
|
3207
3282
|
),
|
|
3208
|
-
/* @__PURE__ */ (0,
|
|
3283
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AuthOwlBadge, { force: showBadge })
|
|
3209
3284
|
] });
|
|
3210
3285
|
}
|
|
3211
3286
|
const methods = config?.enabledMethods ?? ["password"];
|
|
@@ -3215,14 +3290,16 @@ function SignUp({
|
|
|
3215
3290
|
const showPasswordless = publicSignupAllowed && capabilities.emailOtpSignIn && capabilities.emailSignUp && !consentRequired && !capabilities.mfaRequired;
|
|
3216
3291
|
const renderable = showPassword || showPasswordless || social.length > 0;
|
|
3217
3292
|
if (completeWithPasskey) {
|
|
3218
|
-
return /* @__PURE__ */ (0,
|
|
3219
|
-
/* @__PURE__ */ (0,
|
|
3220
|
-
/* @__PURE__ */ (0,
|
|
3293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "ba-form", "data-testid": "signup-passkey-step", children: [
|
|
3294
|
+
showBranding ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AuthOwlBranding, {}) : null,
|
|
3295
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PasskeySignUpCompletion, { onComplete: finishSignUp }),
|
|
3296
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AuthOwlBadge, { force: showBadge })
|
|
3221
3297
|
] });
|
|
3222
3298
|
}
|
|
3223
|
-
return /* @__PURE__ */ (0,
|
|
3224
|
-
/* @__PURE__ */ (0,
|
|
3225
|
-
|
|
3299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "ba-form", "data-testid": "signup-form", children: [
|
|
3300
|
+
showBranding ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AuthOwlBranding, {}) : null,
|
|
3301
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { className: "ba-title", children: t("signUp.title") }),
|
|
3302
|
+
legal && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3226
3303
|
LegalConsentCheckbox,
|
|
3227
3304
|
{
|
|
3228
3305
|
legal,
|
|
@@ -3231,12 +3308,12 @@ function SignUp({
|
|
|
3231
3308
|
testId: "signup-consent"
|
|
3232
3309
|
}
|
|
3233
3310
|
),
|
|
3234
|
-
/* @__PURE__ */ (0,
|
|
3235
|
-
showPassword && social.length > 0 && /* @__PURE__ */ (0,
|
|
3236
|
-
showPassword && /* @__PURE__ */ (0,
|
|
3237
|
-
capabilities.legacyNameField && /* @__PURE__ */ (0,
|
|
3311
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SocialButtons, { providers: social, callbackURL: redirectTo }),
|
|
3312
|
+
showPassword && social.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
3313
|
+
showPassword && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("form", { method: "post", onSubmit, className: "ba-fields", children: [
|
|
3314
|
+
capabilities.legacyNameField && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "ba-label", children: [
|
|
3238
3315
|
t("signUp.nameLabel"),
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3316
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3240
3317
|
"input",
|
|
3241
3318
|
{
|
|
3242
3319
|
className: "ba-input",
|
|
@@ -3250,10 +3327,10 @@ function SignUp({
|
|
|
3250
3327
|
}
|
|
3251
3328
|
)
|
|
3252
3329
|
] }),
|
|
3253
|
-
capabilities.firstLastName && /* @__PURE__ */ (0,
|
|
3254
|
-
/* @__PURE__ */ (0,
|
|
3330
|
+
capabilities.firstLastName && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "ba-label", children: [
|
|
3255
3332
|
t("signUp.firstNameLabel"),
|
|
3256
|
-
/* @__PURE__ */ (0,
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3257
3334
|
"input",
|
|
3258
3335
|
{
|
|
3259
3336
|
className: "ba-input",
|
|
@@ -3266,9 +3343,9 @@ function SignUp({
|
|
|
3266
3343
|
}
|
|
3267
3344
|
)
|
|
3268
3345
|
] }),
|
|
3269
|
-
/* @__PURE__ */ (0,
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "ba-label", children: [
|
|
3270
3347
|
t("signUp.lastNameLabel"),
|
|
3271
|
-
/* @__PURE__ */ (0,
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3272
3349
|
"input",
|
|
3273
3350
|
{
|
|
3274
3351
|
className: "ba-input",
|
|
@@ -3282,9 +3359,9 @@ function SignUp({
|
|
|
3282
3359
|
)
|
|
3283
3360
|
] })
|
|
3284
3361
|
] }),
|
|
3285
|
-
capabilities.collectUsername && /* @__PURE__ */ (0,
|
|
3362
|
+
capabilities.collectUsername && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "ba-label", children: [
|
|
3286
3363
|
t("common.usernameLabel"),
|
|
3287
|
-
/* @__PURE__ */ (0,
|
|
3364
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3288
3365
|
"input",
|
|
3289
3366
|
{
|
|
3290
3367
|
className: "ba-input",
|
|
@@ -3298,9 +3375,9 @@ function SignUp({
|
|
|
3298
3375
|
}
|
|
3299
3376
|
)
|
|
3300
3377
|
] }),
|
|
3301
|
-
/* @__PURE__ */ (0,
|
|
3378
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "ba-label", children: [
|
|
3302
3379
|
t("common.emailLabel"),
|
|
3303
|
-
/* @__PURE__ */ (0,
|
|
3380
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3304
3381
|
"input",
|
|
3305
3382
|
{
|
|
3306
3383
|
className: "ba-input",
|
|
@@ -3315,9 +3392,9 @@ function SignUp({
|
|
|
3315
3392
|
}
|
|
3316
3393
|
)
|
|
3317
3394
|
] }),
|
|
3318
|
-
/* @__PURE__ */ (0,
|
|
3395
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "ba-label", children: [
|
|
3319
3396
|
t("common.passwordLabel"),
|
|
3320
|
-
/* @__PURE__ */ (0,
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3321
3398
|
"input",
|
|
3322
3399
|
{
|
|
3323
3400
|
className: "ba-input",
|
|
@@ -3335,20 +3412,20 @@ function SignUp({
|
|
|
3335
3412
|
)
|
|
3336
3413
|
] }),
|
|
3337
3414
|
authChallenge.control,
|
|
3338
|
-
/* @__PURE__ */ (0,
|
|
3339
|
-
/* @__PURE__ */ (0,
|
|
3415
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FormError, { children: error }),
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3340
3417
|
"button",
|
|
3341
3418
|
{
|
|
3342
3419
|
className: "ba-button",
|
|
3343
3420
|
type: "submit",
|
|
3344
3421
|
disabled: submitting || consentBlocked || authChallenge.configPending,
|
|
3345
3422
|
"aria-busy": submitting || void 0,
|
|
3346
|
-
children: /* @__PURE__ */ (0,
|
|
3423
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Busy, { busy: submitting, label: t("signUp.submitPending"), children: t("signUp.submit") })
|
|
3347
3424
|
}
|
|
3348
3425
|
)
|
|
3349
3426
|
] }),
|
|
3350
|
-
showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */ (0,
|
|
3351
|
-
showPasswordless && /* @__PURE__ */ (0,
|
|
3427
|
+
showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
3428
|
+
showPasswordless && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3352
3429
|
PasswordlessSignUp,
|
|
3353
3430
|
{
|
|
3354
3431
|
onAuthenticated: () => {
|
|
@@ -3357,25 +3434,25 @@ function SignUp({
|
|
|
3357
3434
|
}
|
|
3358
3435
|
}
|
|
3359
3436
|
),
|
|
3360
|
-
!renderable && /* @__PURE__ */ (0,
|
|
3361
|
-
/* @__PURE__ */ (0,
|
|
3437
|
+
!renderable && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "ba-muted", children: publicSignupAllowed && methods.length > 0 ? t("signUp.empty.unsupported") : t("signUp.empty.none") }),
|
|
3438
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AuthOwlBadge, { force: showBadge })
|
|
3362
3439
|
] });
|
|
3363
3440
|
}
|
|
3364
3441
|
|
|
3365
3442
|
// src/components/ConsentGate.tsx
|
|
3366
|
-
var
|
|
3443
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3367
3444
|
function ConsentGate({ children, title }) {
|
|
3368
3445
|
const t = useT();
|
|
3369
3446
|
const { needsConsent, status, accept } = useConsent();
|
|
3370
3447
|
const { pending, error, run } = useSubmitAction();
|
|
3371
|
-
if (!needsConsent) return /* @__PURE__ */ (0,
|
|
3372
|
-
return /* @__PURE__ */ (0,
|
|
3373
|
-
/* @__PURE__ */ (0,
|
|
3374
|
-
/* @__PURE__ */ (0,
|
|
3375
|
-
links: /* @__PURE__ */ (0,
|
|
3448
|
+
if (!needsConsent) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children });
|
|
3449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "ba-form", "data-testid": "consent-gate", children: [
|
|
3450
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "ba-title", children: title ?? t("consent.gateTitle") }),
|
|
3451
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "ba-muted", children: richMessage(t("consent.gateBody"), {
|
|
3452
|
+
links: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ConsentDocLinks, { termsUrl: status?.termsUrl, privacyUrl: status?.privacyUrl })
|
|
3376
3453
|
}) }),
|
|
3377
|
-
/* @__PURE__ */ (0,
|
|
3378
|
-
/* @__PURE__ */ (0,
|
|
3454
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FormError, { children: error }),
|
|
3455
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3379
3456
|
"button",
|
|
3380
3457
|
{
|
|
3381
3458
|
className: "ba-button",
|
|
@@ -3389,18 +3466,18 @@ function ConsentGate({ children, title }) {
|
|
|
3389
3466
|
},
|
|
3390
3467
|
{ failure: t("consent.error.acceptFailed") }
|
|
3391
3468
|
),
|
|
3392
|
-
children: /* @__PURE__ */ (0,
|
|
3469
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Busy, { busy: pending, label: t("consent.acceptPending"), children: t("consent.acceptSubmit") })
|
|
3393
3470
|
}
|
|
3394
3471
|
),
|
|
3395
|
-
/* @__PURE__ */ (0,
|
|
3472
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AuthOwlBadge, {})
|
|
3396
3473
|
] });
|
|
3397
3474
|
}
|
|
3398
3475
|
|
|
3399
3476
|
// src/components/MFARequiredGate.tsx
|
|
3400
|
-
var
|
|
3477
|
+
var React20 = __toESM(require("react"), 1);
|
|
3401
3478
|
|
|
3402
3479
|
// src/components/MFAEnrollment.tsx
|
|
3403
|
-
var
|
|
3480
|
+
var React19 = __toESM(require("react"), 1);
|
|
3404
3481
|
|
|
3405
3482
|
// src/components/mfa-enrollment.ts
|
|
3406
3483
|
function shouldDiscardSetup(args) {
|
|
@@ -3409,7 +3486,7 @@ function shouldDiscardSetup(args) {
|
|
|
3409
3486
|
}
|
|
3410
3487
|
|
|
3411
3488
|
// src/components/QrCode.tsx
|
|
3412
|
-
var
|
|
3489
|
+
var React18 = __toESM(require("react"), 1);
|
|
3413
3490
|
|
|
3414
3491
|
// ../../node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
3415
3492
|
var qrcode = function(typeNumber, errorCorrectionLevel) {
|
|
@@ -5066,14 +5143,14 @@ function qrPath(value) {
|
|
|
5066
5143
|
}
|
|
5067
5144
|
|
|
5068
5145
|
// src/components/QrCode.tsx
|
|
5069
|
-
var
|
|
5146
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5070
5147
|
function QrCode({ value, size = 200 }) {
|
|
5071
5148
|
const t = useT();
|
|
5072
|
-
const path =
|
|
5149
|
+
const path = React18.useMemo(() => qrPath(value), [value]);
|
|
5073
5150
|
if (!path) return null;
|
|
5074
5151
|
const margin = 4;
|
|
5075
5152
|
const dim = path.count + margin * 2;
|
|
5076
|
-
return /* @__PURE__ */ (0,
|
|
5153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5077
5154
|
"svg",
|
|
5078
5155
|
{
|
|
5079
5156
|
width: size,
|
|
@@ -5084,15 +5161,15 @@ function QrCode({ value, size = 200 }) {
|
|
|
5084
5161
|
shapeRendering: "crispEdges",
|
|
5085
5162
|
className: "ba-qr",
|
|
5086
5163
|
children: [
|
|
5087
|
-
/* @__PURE__ */ (0,
|
|
5088
|
-
/* @__PURE__ */ (0,
|
|
5164
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { width: dim, height: dim, fill: "#ffffff" }),
|
|
5165
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("g", { transform: `translate(${margin} ${margin})`, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: path.d, fill: "#000000" }) })
|
|
5089
5166
|
]
|
|
5090
5167
|
}
|
|
5091
5168
|
);
|
|
5092
5169
|
}
|
|
5093
5170
|
|
|
5094
5171
|
// src/components/MFAEnrollment.tsx
|
|
5095
|
-
var
|
|
5172
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5096
5173
|
function secretFromUri(uri) {
|
|
5097
5174
|
try {
|
|
5098
5175
|
return new URL(uri).searchParams.get("secret");
|
|
@@ -5105,11 +5182,11 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5105
5182
|
const { enable, verifyTotp } = useMFA();
|
|
5106
5183
|
const { user, isLoaded } = useUser();
|
|
5107
5184
|
const { pending, error, run } = useSubmitAction();
|
|
5108
|
-
const [password, setPassword] =
|
|
5109
|
-
const [setup, setSetup] =
|
|
5110
|
-
const [code, setCode] =
|
|
5111
|
-
const [done, setDone] =
|
|
5112
|
-
const setupOwnerId =
|
|
5185
|
+
const [password, setPassword] = React19.useState("");
|
|
5186
|
+
const [setup, setSetup] = React19.useState(null);
|
|
5187
|
+
const [code, setCode] = React19.useState("");
|
|
5188
|
+
const [done, setDone] = React19.useState(false);
|
|
5189
|
+
const setupOwnerId = React19.useRef(null);
|
|
5113
5190
|
const userId = user?.id ?? null;
|
|
5114
5191
|
const stale = shouldDiscardSetup({
|
|
5115
5192
|
isLoaded,
|
|
@@ -5118,7 +5195,7 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5118
5195
|
currentUserId: userId
|
|
5119
5196
|
});
|
|
5120
5197
|
const activeSetup = stale ? null : setup;
|
|
5121
|
-
|
|
5198
|
+
React19.useEffect(() => {
|
|
5122
5199
|
if (stale) {
|
|
5123
5200
|
setSetup(null);
|
|
5124
5201
|
setPassword("");
|
|
@@ -5126,22 +5203,22 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5126
5203
|
}
|
|
5127
5204
|
}, [stale]);
|
|
5128
5205
|
if (done) {
|
|
5129
|
-
return /* @__PURE__ */ (0,
|
|
5130
|
-
/* @__PURE__ */ (0,
|
|
5131
|
-
/* @__PURE__ */ (0,
|
|
5206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "ba-fields", "data-testid": "mfa-enroll-done", children: [
|
|
5207
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "ba-title", children: t("mfa.enroll.doneTitle") }),
|
|
5208
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "ba-muted", children: t("mfa.enroll.doneBody") })
|
|
5132
5209
|
] });
|
|
5133
5210
|
}
|
|
5134
5211
|
if (!activeSetup) {
|
|
5135
5212
|
if (!isLoaded) {
|
|
5136
|
-
return /* @__PURE__ */ (0,
|
|
5213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "ba-fields", "data-testid": "mfa-enroll-loading", "aria-busy": "true", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "ba-skeleton" }) });
|
|
5137
5214
|
}
|
|
5138
5215
|
if (user?.twoFactorEnabled) {
|
|
5139
|
-
return /* @__PURE__ */ (0,
|
|
5140
|
-
/* @__PURE__ */ (0,
|
|
5141
|
-
/* @__PURE__ */ (0,
|
|
5216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "ba-fields", "data-testid": "mfa-enroll-active", children: [
|
|
5217
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "ba-title", children: t("mfa.enroll.activeTitle") }),
|
|
5218
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "ba-muted", children: t("mfa.enroll.activeBody") })
|
|
5142
5219
|
] });
|
|
5143
5220
|
}
|
|
5144
|
-
return /* @__PURE__ */ (0,
|
|
5221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5145
5222
|
"form",
|
|
5146
5223
|
{
|
|
5147
5224
|
method: "post",
|
|
@@ -5158,11 +5235,11 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5158
5235
|
});
|
|
5159
5236
|
},
|
|
5160
5237
|
children: [
|
|
5161
|
-
title !== null && /* @__PURE__ */ (0,
|
|
5162
|
-
/* @__PURE__ */ (0,
|
|
5163
|
-
/* @__PURE__ */ (0,
|
|
5238
|
+
title !== null && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "ba-title", children: title ?? t("mfa.enroll.title") }),
|
|
5239
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "ba-muted", children: t("mfa.enroll.passwordHint") }),
|
|
5240
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "ba-label", children: [
|
|
5164
5241
|
t("common.passwordLabel"),
|
|
5165
|
-
/* @__PURE__ */ (0,
|
|
5242
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5166
5243
|
"input",
|
|
5167
5244
|
{
|
|
5168
5245
|
className: "ba-input",
|
|
@@ -5174,29 +5251,29 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5174
5251
|
}
|
|
5175
5252
|
)
|
|
5176
5253
|
] }),
|
|
5177
|
-
/* @__PURE__ */ (0,
|
|
5178
|
-
/* @__PURE__ */ (0,
|
|
5254
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormError, { children: error }),
|
|
5255
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !password, "aria-busy": pending || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Busy, { busy: pending, label: t("mfa.enroll.startPending"), children: t("common.continue") }) })
|
|
5179
5256
|
]
|
|
5180
5257
|
}
|
|
5181
5258
|
);
|
|
5182
5259
|
}
|
|
5183
5260
|
const secret = secretFromUri(activeSetup.totpURI);
|
|
5184
|
-
return /* @__PURE__ */ (0,
|
|
5185
|
-
/* @__PURE__ */ (0,
|
|
5186
|
-
/* @__PURE__ */ (0,
|
|
5187
|
-
/* @__PURE__ */ (0,
|
|
5188
|
-
secret && /* @__PURE__ */ (0,
|
|
5189
|
-
secret: /* @__PURE__ */ (0,
|
|
5261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "ba-fields", "data-testid": "mfa-enroll-verify", children: [
|
|
5262
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "ba-title", children: t("mfa.enroll.scanQrTitle") }),
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "ba-muted", children: t("mfa.enroll.scanQrHint") }),
|
|
5264
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(QrCode, { value: activeSetup.totpURI }),
|
|
5265
|
+
secret && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "ba-muted", children: richMessage(t("mfa.enroll.manualKey"), {
|
|
5266
|
+
secret: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("code", { className: "ba-code", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Bidi, { children: secret }) })
|
|
5190
5267
|
}) }),
|
|
5191
|
-
/* @__PURE__ */ (0,
|
|
5192
|
-
/* @__PURE__ */ (0,
|
|
5193
|
-
/* @__PURE__ */ (0,
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
|
|
5269
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "ba-muted", children: [
|
|
5270
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("strong", { children: t("mfa.enroll.backupCodesWarningStrong") }),
|
|
5194
5271
|
" ",
|
|
5195
5272
|
t("mfa.enroll.backupCodesWarningRest")
|
|
5196
5273
|
] }),
|
|
5197
|
-
/* @__PURE__ */ (0,
|
|
5274
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("ul", { className: "ba-backup-codes", "data-testid": "mfa-backup-codes", children: activeSetup.backupCodes.map((c) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("code", { className: "ba-code", children: c }) }, c)) })
|
|
5198
5275
|
] }),
|
|
5199
|
-
/* @__PURE__ */ (0,
|
|
5276
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5200
5277
|
"form",
|
|
5201
5278
|
{
|
|
5202
5279
|
method: "post",
|
|
@@ -5214,9 +5291,9 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5214
5291
|
});
|
|
5215
5292
|
},
|
|
5216
5293
|
children: [
|
|
5217
|
-
/* @__PURE__ */ (0,
|
|
5294
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "ba-label", children: [
|
|
5218
5295
|
t("mfa.enroll.codeLabel"),
|
|
5219
|
-
/* @__PURE__ */ (0,
|
|
5296
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5220
5297
|
"input",
|
|
5221
5298
|
{
|
|
5222
5299
|
className: "ba-input",
|
|
@@ -5228,8 +5305,8 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5228
5305
|
}
|
|
5229
5306
|
)
|
|
5230
5307
|
] }),
|
|
5231
|
-
/* @__PURE__ */ (0,
|
|
5232
|
-
/* @__PURE__ */ (0,
|
|
5308
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormError, { children: error }),
|
|
5309
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !code, "aria-busy": pending || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Busy, { busy: pending, label: t("common.verifying"), children: t("mfa.enroll.activateSubmit") }) })
|
|
5233
5310
|
]
|
|
5234
5311
|
}
|
|
5235
5312
|
)
|
|
@@ -5237,14 +5314,14 @@ function MFAEnrollment({ onEnrolled, title }) {
|
|
|
5237
5314
|
}
|
|
5238
5315
|
|
|
5239
5316
|
// src/components/MFARequiredGate.tsx
|
|
5240
|
-
var
|
|
5317
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5241
5318
|
function MFARequiredGate({ children, title }) {
|
|
5242
5319
|
const t = useT();
|
|
5243
5320
|
const client = useAuthClient();
|
|
5244
5321
|
const { needsMfaEnrollment } = useUser();
|
|
5245
5322
|
const { refetch } = useSession();
|
|
5246
|
-
const [confirmedPending, setConfirmedPending] =
|
|
5247
|
-
|
|
5323
|
+
const [confirmedPending, setConfirmedPending] = React20.useState(null);
|
|
5324
|
+
React20.useEffect(() => {
|
|
5248
5325
|
if (!needsMfaEnrollment) {
|
|
5249
5326
|
setConfirmedPending(null);
|
|
5250
5327
|
return;
|
|
@@ -5262,26 +5339,26 @@ function MFARequiredGate({ children, title }) {
|
|
|
5262
5339
|
active = false;
|
|
5263
5340
|
};
|
|
5264
5341
|
}, [client, needsMfaEnrollment, refetch]);
|
|
5265
|
-
if (!needsMfaEnrollment) return /* @__PURE__ */ (0,
|
|
5342
|
+
if (!needsMfaEnrollment) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children });
|
|
5266
5343
|
if (confirmedPending !== true) return null;
|
|
5267
|
-
return /* @__PURE__ */ (0,
|
|
5268
|
-
/* @__PURE__ */ (0,
|
|
5269
|
-
/* @__PURE__ */ (0,
|
|
5270
|
-
/* @__PURE__ */ (0,
|
|
5271
|
-
/* @__PURE__ */ (0,
|
|
5344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "ba-form", "data-testid": "mfa-required-gate", children: [
|
|
5345
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h2", { className: "ba-title", children: title ?? t("mfaGate.title") }),
|
|
5346
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "ba-muted", children: t("mfaGate.body") }),
|
|
5347
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MFAEnrollment, { onEnrolled: () => refetch({ query: { disableCookieCache: true } }) }),
|
|
5348
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AuthOwlBadge, {})
|
|
5272
5349
|
] });
|
|
5273
5350
|
}
|
|
5274
5351
|
|
|
5275
5352
|
// src/components/BackupCodesManager.tsx
|
|
5276
|
-
var
|
|
5277
|
-
var
|
|
5353
|
+
var React21 = __toESM(require("react"), 1);
|
|
5354
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5278
5355
|
function BackupCodesManager({ title }) {
|
|
5279
5356
|
const t = useT();
|
|
5280
5357
|
const { user } = useUser();
|
|
5281
5358
|
const { regenerateBackupCodes } = useMFA();
|
|
5282
5359
|
const { pending, error, run } = useSubmitAction();
|
|
5283
|
-
const [password, setPassword] =
|
|
5284
|
-
const [codes, setCodes] =
|
|
5360
|
+
const [password, setPassword] = React21.useState("");
|
|
5361
|
+
const [codes, setCodes] = React21.useState(null);
|
|
5285
5362
|
if (!user?.twoFactorEnabled) return null;
|
|
5286
5363
|
const submit = (e) => {
|
|
5287
5364
|
e.preventDefault();
|
|
@@ -5293,20 +5370,20 @@ function BackupCodesManager({ title }) {
|
|
|
5293
5370
|
}
|
|
5294
5371
|
});
|
|
5295
5372
|
};
|
|
5296
|
-
return /* @__PURE__ */ (0,
|
|
5297
|
-
title !== null && /* @__PURE__ */ (0,
|
|
5298
|
-
/* @__PURE__ */ (0,
|
|
5299
|
-
codes ? /* @__PURE__ */ (0,
|
|
5300
|
-
/* @__PURE__ */ (0,
|
|
5301
|
-
/* @__PURE__ */ (0,
|
|
5373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "ba-form", "data-testid": "backup-codes-manager", children: [
|
|
5374
|
+
title !== null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h2", { className: "ba-title", children: title ?? t("backupCodes.title") }),
|
|
5375
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "ba-muted", children: t("backupCodes.hint") }),
|
|
5376
|
+
codes ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5377
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "ba-muted", children: [
|
|
5378
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("strong", { children: t("mfa.enroll.backupCodesWarningStrong") }),
|
|
5302
5379
|
" ",
|
|
5303
5380
|
t("mfa.enroll.backupCodesWarningRest")
|
|
5304
5381
|
] }),
|
|
5305
|
-
/* @__PURE__ */ (0,
|
|
5306
|
-
] }) : /* @__PURE__ */ (0,
|
|
5307
|
-
/* @__PURE__ */ (0,
|
|
5382
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { className: "ba-passkey-list", "data-testid": "backup-codes-list", children: codes.map((c) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("li", { className: "ba-passkey-item", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("code", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("bdi", { children: c }) }) }, c)) })
|
|
5383
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
5384
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "ba-label", children: [
|
|
5308
5385
|
t("common.passwordLabel"),
|
|
5309
|
-
/* @__PURE__ */ (0,
|
|
5386
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5310
5387
|
"input",
|
|
5311
5388
|
{
|
|
5312
5389
|
className: "ba-input",
|
|
@@ -5318,26 +5395,26 @@ function BackupCodesManager({ title }) {
|
|
|
5318
5395
|
}
|
|
5319
5396
|
)
|
|
5320
5397
|
] }),
|
|
5321
|
-
/* @__PURE__ */ (0,
|
|
5322
|
-
/* @__PURE__ */ (0,
|
|
5398
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FormError, { children: error }),
|
|
5399
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !password, "aria-busy": pending || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Busy, { busy: pending, label: t("backupCodes.pending"), children: t("backupCodes.submit") }) })
|
|
5323
5400
|
] })
|
|
5324
5401
|
] });
|
|
5325
5402
|
}
|
|
5326
5403
|
|
|
5327
5404
|
// src/components/MagicLinkForm.tsx
|
|
5328
|
-
var
|
|
5329
|
-
var
|
|
5405
|
+
var React22 = __toESM(require("react"), 1);
|
|
5406
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5330
5407
|
function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
5331
5408
|
const t = useT();
|
|
5332
5409
|
const { signInMagicLink } = useSignIn();
|
|
5333
5410
|
const { pending, error, run } = useSubmitAction();
|
|
5334
5411
|
const authChallenge = useAuthChallenge();
|
|
5335
|
-
const [email, setEmail] =
|
|
5336
|
-
const [sent, setSent] =
|
|
5412
|
+
const [email, setEmail] = React22.useState("");
|
|
5413
|
+
const [sent, setSent] = React22.useState(false);
|
|
5337
5414
|
if (sent) {
|
|
5338
|
-
return /* @__PURE__ */ (0,
|
|
5415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "ba-muted", "data-testid": "magiclink-sent", children: t("magicLink.sent") });
|
|
5339
5416
|
}
|
|
5340
|
-
return /* @__PURE__ */ (0,
|
|
5417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5341
5418
|
"form",
|
|
5342
5419
|
{
|
|
5343
5420
|
method: "post",
|
|
@@ -5351,9 +5428,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
5351
5428
|
className: "ba-fields",
|
|
5352
5429
|
"data-testid": "magiclink-form",
|
|
5353
5430
|
children: [
|
|
5354
|
-
/* @__PURE__ */ (0,
|
|
5431
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "ba-label", children: [
|
|
5355
5432
|
t("common.emailLabel"),
|
|
5356
|
-
/* @__PURE__ */ (0,
|
|
5433
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5357
5434
|
"input",
|
|
5358
5435
|
{
|
|
5359
5436
|
className: "ba-input",
|
|
@@ -5366,15 +5443,15 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
5366
5443
|
)
|
|
5367
5444
|
] }),
|
|
5368
5445
|
authChallenge.control,
|
|
5369
|
-
/* @__PURE__ */ (0,
|
|
5370
|
-
/* @__PURE__ */ (0,
|
|
5446
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FormError, { children: error }),
|
|
5447
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5371
5448
|
"button",
|
|
5372
5449
|
{
|
|
5373
5450
|
className: "ba-button",
|
|
5374
5451
|
type: "submit",
|
|
5375
5452
|
disabled: pending || authChallenge.configPending,
|
|
5376
5453
|
"aria-busy": pending || void 0,
|
|
5377
|
-
children: /* @__PURE__ */ (0,
|
|
5454
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Busy, { busy: pending, label: t("common.sending"), children: t("magicLink.submit") })
|
|
5378
5455
|
}
|
|
5379
5456
|
)
|
|
5380
5457
|
]
|
|
@@ -5383,19 +5460,19 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
5383
5460
|
}
|
|
5384
5461
|
|
|
5385
5462
|
// src/components/EmailOtpForm.tsx
|
|
5386
|
-
var
|
|
5387
|
-
var
|
|
5463
|
+
var React23 = __toESM(require("react"), 1);
|
|
5464
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5388
5465
|
function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
5389
5466
|
const t = useT();
|
|
5390
5467
|
const { sessionStore } = useAuthClient();
|
|
5391
5468
|
const { sendEmailOtp, signInEmailOtp } = useSignIn();
|
|
5392
5469
|
const { pending, error, setError, run } = useSubmitAction();
|
|
5393
5470
|
const authChallenge = useAuthChallenge();
|
|
5394
|
-
const [email, setEmail] =
|
|
5395
|
-
const [otp, setOtp] =
|
|
5396
|
-
const [stage, setStage] =
|
|
5471
|
+
const [email, setEmail] = React23.useState("");
|
|
5472
|
+
const [otp, setOtp] = React23.useState("");
|
|
5473
|
+
const [stage, setStage] = React23.useState("email");
|
|
5397
5474
|
if (stage === "code") {
|
|
5398
|
-
return /* @__PURE__ */ (0,
|
|
5475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5399
5476
|
OtpCodeForm,
|
|
5400
5477
|
{
|
|
5401
5478
|
email,
|
|
@@ -5418,7 +5495,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
5418
5495
|
}
|
|
5419
5496
|
);
|
|
5420
5497
|
}
|
|
5421
|
-
return /* @__PURE__ */ (0,
|
|
5498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5422
5499
|
"form",
|
|
5423
5500
|
{
|
|
5424
5501
|
method: "post",
|
|
@@ -5432,9 +5509,9 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
5432
5509
|
className: "ba-fields",
|
|
5433
5510
|
"data-testid": "emailotp-email",
|
|
5434
5511
|
children: [
|
|
5435
|
-
/* @__PURE__ */ (0,
|
|
5512
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "ba-label", children: [
|
|
5436
5513
|
t("common.emailLabel"),
|
|
5437
|
-
/* @__PURE__ */ (0,
|
|
5514
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5438
5515
|
"input",
|
|
5439
5516
|
{
|
|
5440
5517
|
className: "ba-input",
|
|
@@ -5450,15 +5527,15 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
5450
5527
|
)
|
|
5451
5528
|
] }),
|
|
5452
5529
|
authChallenge.control,
|
|
5453
|
-
/* @__PURE__ */ (0,
|
|
5454
|
-
/* @__PURE__ */ (0,
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FormError, { children: error }),
|
|
5531
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5455
5532
|
"button",
|
|
5456
5533
|
{
|
|
5457
5534
|
className: "ba-button",
|
|
5458
5535
|
type: "submit",
|
|
5459
5536
|
disabled: pending || authChallenge.configPending,
|
|
5460
5537
|
"aria-busy": pending || void 0,
|
|
5461
|
-
children: /* @__PURE__ */ (0,
|
|
5538
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Busy, { busy: pending, label: t("common.sending"), children: t("emailOtp.requestSubmit") })
|
|
5462
5539
|
}
|
|
5463
5540
|
)
|
|
5464
5541
|
]
|
|
@@ -5467,8 +5544,8 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
5467
5544
|
}
|
|
5468
5545
|
|
|
5469
5546
|
// src/components/ResetPassword.tsx
|
|
5470
|
-
var
|
|
5471
|
-
var
|
|
5547
|
+
var React24 = __toESM(require("react"), 1);
|
|
5548
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5472
5549
|
function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
5473
5550
|
const t = useT();
|
|
5474
5551
|
const { resetPassword } = usePasswordReset();
|
|
@@ -5476,27 +5553,27 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
5476
5553
|
const capabilities = resolveProjectCapabilities(config);
|
|
5477
5554
|
const { passwordMinLength, passwordMaxLength } = capabilities;
|
|
5478
5555
|
const { pending, error, setError, run } = useSubmitAction();
|
|
5479
|
-
const [token, setToken] =
|
|
5480
|
-
const [ready, setReady] =
|
|
5481
|
-
const [password, setPassword] =
|
|
5482
|
-
const [confirm, setConfirm] =
|
|
5483
|
-
const [done, setDone] =
|
|
5484
|
-
|
|
5556
|
+
const [token, setToken] = React24.useState(tokenProp ?? null);
|
|
5557
|
+
const [ready, setReady] = React24.useState(tokenProp != null);
|
|
5558
|
+
const [password, setPassword] = React24.useState("");
|
|
5559
|
+
const [confirm, setConfirm] = React24.useState("");
|
|
5560
|
+
const [done, setDone] = React24.useState(false);
|
|
5561
|
+
React24.useEffect(() => {
|
|
5485
5562
|
if (tokenProp != null) return;
|
|
5486
5563
|
const params = new URLSearchParams(window.location.search);
|
|
5487
5564
|
setToken(params.get("token"));
|
|
5488
5565
|
setReady(true);
|
|
5489
5566
|
}, [tokenProp]);
|
|
5490
5567
|
if (!ready) {
|
|
5491
|
-
return /* @__PURE__ */ (0,
|
|
5568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "ba-skeleton" }) });
|
|
5492
5569
|
}
|
|
5493
5570
|
if (!token) {
|
|
5494
|
-
return /* @__PURE__ */ (0,
|
|
5571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FormError, { "data-testid": "reset-invalid", children: t("resetPassword.invalidLink") });
|
|
5495
5572
|
}
|
|
5496
5573
|
if (done) {
|
|
5497
|
-
return /* @__PURE__ */ (0,
|
|
5574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "ba-muted", "data-testid": "reset-done", children: t("resetPassword.done") });
|
|
5498
5575
|
}
|
|
5499
|
-
return /* @__PURE__ */ (0,
|
|
5576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5500
5577
|
"form",
|
|
5501
5578
|
{
|
|
5502
5579
|
method: "post",
|
|
@@ -5522,9 +5599,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
5522
5599
|
});
|
|
5523
5600
|
},
|
|
5524
5601
|
children: [
|
|
5525
|
-
/* @__PURE__ */ (0,
|
|
5602
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "ba-label", children: [
|
|
5526
5603
|
t("resetPassword.newPasswordLabel"),
|
|
5527
|
-
/* @__PURE__ */ (0,
|
|
5604
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5528
5605
|
"input",
|
|
5529
5606
|
{
|
|
5530
5607
|
className: "ba-input",
|
|
@@ -5541,9 +5618,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
5541
5618
|
}
|
|
5542
5619
|
)
|
|
5543
5620
|
] }),
|
|
5544
|
-
/* @__PURE__ */ (0,
|
|
5621
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "ba-label", children: [
|
|
5545
5622
|
t("resetPassword.confirmPasswordLabel"),
|
|
5546
|
-
/* @__PURE__ */ (0,
|
|
5623
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5547
5624
|
"input",
|
|
5548
5625
|
{
|
|
5549
5626
|
className: "ba-input",
|
|
@@ -5560,26 +5637,26 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
5560
5637
|
}
|
|
5561
5638
|
)
|
|
5562
5639
|
] }),
|
|
5563
|
-
/* @__PURE__ */ (0,
|
|
5564
|
-
/* @__PURE__ */ (0,
|
|
5640
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FormError, { children: error }),
|
|
5641
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { className: "ba-button", type: "submit", disabled: pending, "aria-busy": pending || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Busy, { busy: pending, label: t("resetPassword.submitPending"), children: t("resetPassword.submit") }) })
|
|
5565
5642
|
]
|
|
5566
5643
|
}
|
|
5567
5644
|
);
|
|
5568
5645
|
}
|
|
5569
5646
|
|
|
5570
5647
|
// src/components/VerifyEmail.tsx
|
|
5571
|
-
var
|
|
5572
|
-
var
|
|
5648
|
+
var React25 = __toESM(require("react"), 1);
|
|
5649
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5573
5650
|
function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
5574
5651
|
const t = useT();
|
|
5575
5652
|
const { sendVerificationEmail } = useEmailVerification();
|
|
5576
5653
|
const { pending, error, run } = useSubmitAction();
|
|
5577
5654
|
const authChallenge = useAuthChallenge();
|
|
5578
|
-
const [ready, setReady] =
|
|
5579
|
-
const [failed, setFailed] =
|
|
5580
|
-
const [email, setEmail] =
|
|
5581
|
-
const [resent, setResent] =
|
|
5582
|
-
|
|
5655
|
+
const [ready, setReady] = React25.useState(false);
|
|
5656
|
+
const [failed, setFailed] = React25.useState(false);
|
|
5657
|
+
const [email, setEmail] = React25.useState("");
|
|
5658
|
+
const [resent, setResent] = React25.useState(false);
|
|
5659
|
+
React25.useEffect(() => {
|
|
5583
5660
|
const didFail = new URLSearchParams(window.location.search).has("error");
|
|
5584
5661
|
setFailed(didFail);
|
|
5585
5662
|
setReady(true);
|
|
@@ -5589,12 +5666,12 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
5589
5666
|
}
|
|
5590
5667
|
}, [onVerified, redirectTo]);
|
|
5591
5668
|
if (!ready) {
|
|
5592
|
-
return /* @__PURE__ */ (0,
|
|
5669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ba-skeleton" }) });
|
|
5593
5670
|
}
|
|
5594
5671
|
if (!failed) {
|
|
5595
|
-
return /* @__PURE__ */ (0,
|
|
5672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "ba-muted", "data-testid": "verify-success", children: t("verifyEmail.success") });
|
|
5596
5673
|
}
|
|
5597
|
-
return /* @__PURE__ */ (0,
|
|
5674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5598
5675
|
"form",
|
|
5599
5676
|
{
|
|
5600
5677
|
method: "post",
|
|
@@ -5609,11 +5686,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
5609
5686
|
});
|
|
5610
5687
|
},
|
|
5611
5688
|
children: [
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5613
|
-
resent ? /* @__PURE__ */ (0,
|
|
5614
|
-
/* @__PURE__ */ (0,
|
|
5689
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FormError, { children: t("verifyEmail.invalidLink") }),
|
|
5690
|
+
resent ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "ba-muted", children: richMessage(t("verifyEmail.resent"), { email: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Bidi, { children: email }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
5691
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "ba-label", children: [
|
|
5615
5692
|
t("common.emailLabel"),
|
|
5616
|
-
/* @__PURE__ */ (0,
|
|
5693
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5617
5694
|
"input",
|
|
5618
5695
|
{
|
|
5619
5696
|
className: "ba-input",
|
|
@@ -5626,15 +5703,15 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
5626
5703
|
)
|
|
5627
5704
|
] }),
|
|
5628
5705
|
authChallenge.control,
|
|
5629
|
-
/* @__PURE__ */ (0,
|
|
5630
|
-
/* @__PURE__ */ (0,
|
|
5706
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FormError, { children: error }),
|
|
5707
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5631
5708
|
"button",
|
|
5632
5709
|
{
|
|
5633
5710
|
className: "ba-button",
|
|
5634
5711
|
type: "submit",
|
|
5635
5712
|
disabled: pending || authChallenge.configPending,
|
|
5636
5713
|
"aria-busy": pending || void 0,
|
|
5637
|
-
children: /* @__PURE__ */ (0,
|
|
5714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Busy, { busy: pending, label: t("common.sending"), children: t("verifyEmail.resendSubmit") })
|
|
5638
5715
|
}
|
|
5639
5716
|
)
|
|
5640
5717
|
] })
|
|
@@ -5644,18 +5721,18 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
5644
5721
|
}
|
|
5645
5722
|
|
|
5646
5723
|
// src/components/PasskeyManager.tsx
|
|
5647
|
-
var
|
|
5648
|
-
var
|
|
5724
|
+
var React26 = __toESM(require("react"), 1);
|
|
5725
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5649
5726
|
function PasskeyManager({ title, allowAdd = true } = {}) {
|
|
5650
5727
|
const t = useT();
|
|
5651
5728
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
5652
5729
|
if (!isLoaded) {
|
|
5653
|
-
return /* @__PURE__ */ (0,
|
|
5730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "ba-form", "data-testid": "passkey-manager-loading", "aria-busy": "true", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "ba-skeleton" }) });
|
|
5654
5731
|
}
|
|
5655
5732
|
if (!isSignedIn || !user) {
|
|
5656
|
-
return /* @__PURE__ */ (0,
|
|
5733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "ba-muted", children: t("passkeys.signedOut") });
|
|
5657
5734
|
}
|
|
5658
|
-
return /* @__PURE__ */ (0,
|
|
5735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PasskeyManagerBody, { title, allowAdd }, user.id);
|
|
5659
5736
|
}
|
|
5660
5737
|
function PasskeyManagerBody({
|
|
5661
5738
|
title,
|
|
@@ -5664,12 +5741,12 @@ function PasskeyManagerBody({
|
|
|
5664
5741
|
const t = useT();
|
|
5665
5742
|
const toServerError = useServerError();
|
|
5666
5743
|
const api = usePasskeys();
|
|
5667
|
-
const apiRef =
|
|
5744
|
+
const apiRef = React26.useRef(api);
|
|
5668
5745
|
apiRef.current = api;
|
|
5669
5746
|
const { pending, error, setError, run } = useSubmitAction();
|
|
5670
|
-
const [passkeys, setPasskeys] =
|
|
5671
|
-
const loadTokenRef =
|
|
5672
|
-
const load =
|
|
5747
|
+
const [passkeys, setPasskeys] = React26.useState(null);
|
|
5748
|
+
const loadTokenRef = React26.useRef(0);
|
|
5749
|
+
const load = React26.useCallback(async () => {
|
|
5673
5750
|
const token = ++loadTokenRef.current;
|
|
5674
5751
|
try {
|
|
5675
5752
|
const res = await apiRef.current.listPasskeys();
|
|
@@ -5685,7 +5762,7 @@ function PasskeyManagerBody({
|
|
|
5685
5762
|
setError(t("passkeys.error.loadFailed"));
|
|
5686
5763
|
}
|
|
5687
5764
|
}, [setError, toServerError, t]);
|
|
5688
|
-
|
|
5765
|
+
React26.useEffect(() => {
|
|
5689
5766
|
void load();
|
|
5690
5767
|
}, [load]);
|
|
5691
5768
|
function onRename(id, current) {
|
|
@@ -5704,13 +5781,13 @@ function PasskeyManagerBody({
|
|
|
5704
5781
|
onSuccess: load
|
|
5705
5782
|
});
|
|
5706
5783
|
}
|
|
5707
|
-
return /* @__PURE__ */ (0,
|
|
5708
|
-
title !== null && /* @__PURE__ */ (0,
|
|
5709
|
-
passkeys === null ? error ? null : /* @__PURE__ */ (0,
|
|
5710
|
-
(passkeys ?? []).map((pk) => /* @__PURE__ */ (0,
|
|
5711
|
-
/* @__PURE__ */ (0,
|
|
5712
|
-
/* @__PURE__ */ (0,
|
|
5713
|
-
/* @__PURE__ */ (0,
|
|
5784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "ba-form", "data-testid": "passkey-manager", children: [
|
|
5785
|
+
title !== null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: "ba-title", children: title ?? t("passkeys.title") }),
|
|
5786
|
+
passkeys === null ? error ? null : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "ba-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("ul", { className: "ba-passkey-list", children: [
|
|
5787
|
+
(passkeys ?? []).map((pk) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("li", { className: "ba-passkey-item", children: [
|
|
5788
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ba-passkey-name", children: pk.name?.trim() || t("passkeys.unnamed") }),
|
|
5789
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "ba-passkey-actions", children: [
|
|
5790
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5714
5791
|
"button",
|
|
5715
5792
|
{
|
|
5716
5793
|
type: "button",
|
|
@@ -5720,7 +5797,7 @@ function PasskeyManagerBody({
|
|
|
5720
5797
|
children: t("passkeys.rename")
|
|
5721
5798
|
}
|
|
5722
5799
|
),
|
|
5723
|
-
/* @__PURE__ */ (0,
|
|
5800
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5724
5801
|
"button",
|
|
5725
5802
|
{
|
|
5726
5803
|
type: "button",
|
|
@@ -5732,13 +5809,13 @@ function PasskeyManagerBody({
|
|
|
5732
5809
|
)
|
|
5733
5810
|
] })
|
|
5734
5811
|
] }, pk.id)),
|
|
5735
|
-
passkeys !== null && passkeys.length === 0 && /* @__PURE__ */ (0,
|
|
5812
|
+
passkeys !== null && passkeys.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("li", { className: "ba-muted", children: t("passkeys.empty") })
|
|
5736
5813
|
] }),
|
|
5737
|
-
error && /* @__PURE__ */ (0,
|
|
5738
|
-
/* @__PURE__ */ (0,
|
|
5739
|
-
passkeys === null && /* @__PURE__ */ (0,
|
|
5814
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "ba-inline-error", children: [
|
|
5815
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FormError, { children: error }),
|
|
5816
|
+
passkeys === null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("userProfile.retry") })
|
|
5740
5817
|
] }),
|
|
5741
|
-
passkeys !== null && allowAdd && /* @__PURE__ */ (0,
|
|
5818
|
+
passkeys !== null && allowAdd && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5742
5819
|
"button",
|
|
5743
5820
|
{
|
|
5744
5821
|
className: "ba-button",
|
|
@@ -5749,7 +5826,7 @@ function PasskeyManagerBody({
|
|
|
5749
5826
|
failure: t("passkeys.error.addFailed"),
|
|
5750
5827
|
onSuccess: load
|
|
5751
5828
|
}),
|
|
5752
|
-
children: /* @__PURE__ */ (0,
|
|
5829
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("passkeys.add") })
|
|
5753
5830
|
}
|
|
5754
5831
|
)
|
|
5755
5832
|
] });
|
|
@@ -5757,14 +5834,14 @@ function PasskeyManagerBody({
|
|
|
5757
5834
|
|
|
5758
5835
|
// src/components/control.tsx
|
|
5759
5836
|
var import_core4 = require("@authowl/core");
|
|
5760
|
-
var
|
|
5837
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5761
5838
|
function SignedIn({ children }) {
|
|
5762
5839
|
const { isLoaded, isSignedIn } = useUser();
|
|
5763
|
-
return isLoaded && isSignedIn ? /* @__PURE__ */ (0,
|
|
5840
|
+
return isLoaded && isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children }) : null;
|
|
5764
5841
|
}
|
|
5765
5842
|
function SignedOut({ children }) {
|
|
5766
5843
|
const { isLoaded, isSignedIn } = useUser();
|
|
5767
|
-
return isLoaded && !isSignedIn ? /* @__PURE__ */ (0,
|
|
5844
|
+
return isLoaded && !isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children }) : null;
|
|
5768
5845
|
}
|
|
5769
5846
|
function Protect({
|
|
5770
5847
|
children,
|
|
@@ -5777,36 +5854,36 @@ function Protect({
|
|
|
5777
5854
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
5778
5855
|
const membership = useSession().data?.session?.membership ?? null;
|
|
5779
5856
|
if (!isLoaded) return null;
|
|
5780
|
-
if (!isSignedIn || !user) return /* @__PURE__ */ (0,
|
|
5857
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: fallback });
|
|
5781
5858
|
if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !(0, import_core4.membershipHas)(membership, { role, permission, teamId })) {
|
|
5782
|
-
return /* @__PURE__ */ (0,
|
|
5859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: fallback });
|
|
5783
5860
|
}
|
|
5784
|
-
if (condition && !condition(user)) return /* @__PURE__ */ (0,
|
|
5785
|
-
return /* @__PURE__ */ (0,
|
|
5861
|
+
if (condition && !condition(user)) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: fallback });
|
|
5862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
|
|
5786
5863
|
}
|
|
5787
5864
|
function AuthLoading({ children }) {
|
|
5788
5865
|
const t = useT();
|
|
5789
5866
|
const { isLoaded } = useUser();
|
|
5790
5867
|
if (isLoaded) return null;
|
|
5791
|
-
if (children !== void 0) return /* @__PURE__ */ (0,
|
|
5792
|
-
return /* @__PURE__ */ (0,
|
|
5793
|
-
/* @__PURE__ */ (0,
|
|
5794
|
-
/* @__PURE__ */ (0,
|
|
5868
|
+
if (children !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
|
|
5869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ba-auth-loading", role: "status", "aria-busy": "true", "data-testid": "auth-loading", children: [
|
|
5870
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Spinner, {}),
|
|
5871
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "ba-sr-only", children: t("common.loading") })
|
|
5795
5872
|
] });
|
|
5796
5873
|
}
|
|
5797
5874
|
function AuthLoaded({ children }) {
|
|
5798
|
-
return useUser().isLoaded ? /* @__PURE__ */ (0,
|
|
5875
|
+
return useUser().isLoaded ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children }) : null;
|
|
5799
5876
|
}
|
|
5800
5877
|
|
|
5801
5878
|
// src/components/SignOutButton.tsx
|
|
5802
|
-
var
|
|
5803
|
-
var
|
|
5879
|
+
var React27 = __toESM(require("react"), 1);
|
|
5880
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5804
5881
|
function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
5805
5882
|
const t = useT();
|
|
5806
5883
|
const { signOut } = useSignOut();
|
|
5807
|
-
const [pending, setPending] =
|
|
5884
|
+
const [pending, setPending] = React27.useState(false);
|
|
5808
5885
|
const content = children ?? t("signOut.button");
|
|
5809
|
-
return /* @__PURE__ */ (0,
|
|
5886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5810
5887
|
"button",
|
|
5811
5888
|
{
|
|
5812
5889
|
type: "button",
|
|
@@ -5824,32 +5901,32 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
|
5824
5901
|
setPending(false);
|
|
5825
5902
|
}
|
|
5826
5903
|
},
|
|
5827
|
-
children: /* @__PURE__ */ (0,
|
|
5904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Busy, { busy: pending, label: content, children: content })
|
|
5828
5905
|
}
|
|
5829
5906
|
);
|
|
5830
5907
|
}
|
|
5831
5908
|
|
|
5832
5909
|
// src/components/UserButton.tsx
|
|
5833
|
-
var
|
|
5910
|
+
var React41 = __toESM(require("react"), 1);
|
|
5834
5911
|
|
|
5835
5912
|
// src/components/UserProfile.tsx
|
|
5836
|
-
var
|
|
5913
|
+
var React40 = __toESM(require("react"), 1);
|
|
5837
5914
|
|
|
5838
5915
|
// src/components/user-profile/EmailSection.tsx
|
|
5839
|
-
var
|
|
5840
|
-
var
|
|
5916
|
+
var React28 = __toESM(require("react"), 1);
|
|
5917
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5841
5918
|
function EmailSection({ allowChange }) {
|
|
5842
5919
|
const t = useT();
|
|
5843
5920
|
const account = useAccount();
|
|
5844
5921
|
const { user } = useUser();
|
|
5845
5922
|
const { pending, error, run } = useSubmitAction();
|
|
5846
|
-
const [newEmail, setNewEmail] =
|
|
5847
|
-
const [sent, setSent] =
|
|
5848
|
-
const titleId =
|
|
5923
|
+
const [newEmail, setNewEmail] = React28.useState("");
|
|
5924
|
+
const [sent, setSent] = React28.useState(false);
|
|
5925
|
+
const titleId = React28.useId();
|
|
5849
5926
|
if (!user?.email) {
|
|
5850
|
-
return /* @__PURE__ */ (0,
|
|
5851
|
-
/* @__PURE__ */ (0,
|
|
5852
|
-
/* @__PURE__ */ (0,
|
|
5927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
5929
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "ba-muted", children: t("userProfile.email.unavailable") })
|
|
5853
5930
|
] });
|
|
5854
5931
|
}
|
|
5855
5932
|
const submit = (event) => {
|
|
@@ -5869,19 +5946,19 @@ function EmailSection({ allowChange }) {
|
|
|
5869
5946
|
}
|
|
5870
5947
|
);
|
|
5871
5948
|
};
|
|
5872
|
-
return /* @__PURE__ */ (0,
|
|
5873
|
-
/* @__PURE__ */ (0,
|
|
5874
|
-
/* @__PURE__ */ (0,
|
|
5875
|
-
/* @__PURE__ */ (0,
|
|
5949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
5950
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
5951
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
5952
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "ba-muted", children: t("userProfile.email.description") })
|
|
5876
5953
|
] }),
|
|
5877
|
-
/* @__PURE__ */ (0,
|
|
5878
|
-
/* @__PURE__ */ (0,
|
|
5879
|
-
/* @__PURE__ */ (0,
|
|
5954
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { className: "ba-profile-current", children: [
|
|
5955
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: t("userProfile.email.current") }),
|
|
5956
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Bidi, { children: user.email }) })
|
|
5880
5957
|
] }),
|
|
5881
|
-
!allowChange ? /* @__PURE__ */ (0,
|
|
5882
|
-
/* @__PURE__ */ (0,
|
|
5958
|
+
!allowChange ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "ba-muted", "data-testid": "email-change-disabled", children: t("userProfile.email.changeDisabled") }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
5959
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "ba-label", children: [
|
|
5883
5960
|
t("userProfile.email.newLabel"),
|
|
5884
|
-
/* @__PURE__ */ (0,
|
|
5961
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5885
5962
|
"input",
|
|
5886
5963
|
{
|
|
5887
5964
|
className: "ba-input",
|
|
@@ -5893,16 +5970,16 @@ function EmailSection({ allowChange }) {
|
|
|
5893
5970
|
}
|
|
5894
5971
|
)
|
|
5895
5972
|
] }),
|
|
5896
|
-
/* @__PURE__ */ (0,
|
|
5897
|
-
sent && /* @__PURE__ */ (0,
|
|
5898
|
-
/* @__PURE__ */ (0,
|
|
5973
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FormError, { children: error }),
|
|
5974
|
+
sent && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "ba-success", role: "status", children: t("userProfile.email.sent") }),
|
|
5975
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5899
5976
|
"button",
|
|
5900
5977
|
{
|
|
5901
5978
|
className: "ba-button ba-profile-submit",
|
|
5902
5979
|
type: "submit",
|
|
5903
5980
|
disabled: pending || !newEmail.trim(),
|
|
5904
5981
|
"aria-busy": pending || void 0,
|
|
5905
|
-
children: /* @__PURE__ */ (0,
|
|
5982
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Busy, { busy: pending, label: t("common.sending"), children: t("userProfile.email.submit") })
|
|
5906
5983
|
}
|
|
5907
5984
|
)
|
|
5908
5985
|
] })
|
|
@@ -5910,16 +5987,16 @@ function EmailSection({ allowChange }) {
|
|
|
5910
5987
|
}
|
|
5911
5988
|
|
|
5912
5989
|
// src/components/user-profile/DeleteAccountSection.tsx
|
|
5913
|
-
var
|
|
5914
|
-
var
|
|
5990
|
+
var React29 = __toESM(require("react"), 1);
|
|
5991
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5915
5992
|
function DeleteAccountSection({ onDeleted }) {
|
|
5916
5993
|
const t = useT();
|
|
5917
5994
|
const account = useAccount();
|
|
5918
5995
|
const session = useSession();
|
|
5919
5996
|
const { user } = useUser();
|
|
5920
5997
|
const { pending, error, run } = useSubmitAction();
|
|
5921
|
-
const [confirmation, setConfirmation] =
|
|
5922
|
-
const titleId =
|
|
5998
|
+
const [confirmation, setConfirmation] = React29.useState("");
|
|
5999
|
+
const titleId = React29.useId();
|
|
5923
6000
|
const identifier = user?.email ?? user?.phoneNumber ?? user?.id ?? "";
|
|
5924
6001
|
const confirmed = identifier.length > 0 && confirmation.trim().toLowerCase() === identifier.toLowerCase();
|
|
5925
6002
|
const submit = (event) => {
|
|
@@ -5936,18 +6013,18 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
5936
6013
|
}
|
|
5937
6014
|
);
|
|
5938
6015
|
};
|
|
5939
|
-
return /* @__PURE__ */ (0,
|
|
5940
|
-
/* @__PURE__ */ (0,
|
|
5941
|
-
/* @__PURE__ */ (0,
|
|
5942
|
-
/* @__PURE__ */ (0,
|
|
6016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("section", { className: "ba-profile-section ba-profile-danger-zone", "aria-labelledby": titleId, children: [
|
|
6017
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
6018
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.delete.title") }),
|
|
6019
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "ba-muted", children: t("userProfile.delete.description") })
|
|
5943
6020
|
] }),
|
|
5944
|
-
/* @__PURE__ */ (0,
|
|
5945
|
-
/* @__PURE__ */ (0,
|
|
5946
|
-
/* @__PURE__ */ (0,
|
|
6021
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
6022
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "ba-profile-delete-warning", children: t("userProfile.delete.warning", { identifier }) }),
|
|
6023
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "ba-label", children: [
|
|
5947
6024
|
t("userProfile.delete.confirmLabel"),
|
|
5948
6025
|
" ",
|
|
5949
|
-
/* @__PURE__ */ (0,
|
|
5950
|
-
/* @__PURE__ */ (0,
|
|
6026
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Bidi, { children: identifier }),
|
|
6027
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5951
6028
|
"input",
|
|
5952
6029
|
{
|
|
5953
6030
|
className: "ba-input",
|
|
@@ -5961,15 +6038,15 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
5961
6038
|
}
|
|
5962
6039
|
)
|
|
5963
6040
|
] }),
|
|
5964
|
-
/* @__PURE__ */ (0,
|
|
5965
|
-
/* @__PURE__ */ (0,
|
|
6041
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(FormError, { children: error }),
|
|
6042
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5966
6043
|
"button",
|
|
5967
6044
|
{
|
|
5968
6045
|
className: "ba-button ba-danger-button ba-profile-submit",
|
|
5969
6046
|
type: "submit",
|
|
5970
6047
|
disabled: pending || !confirmed,
|
|
5971
6048
|
"aria-busy": pending || void 0,
|
|
5972
|
-
children: /* @__PURE__ */ (0,
|
|
6049
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.delete.submit") })
|
|
5973
6050
|
}
|
|
5974
6051
|
)
|
|
5975
6052
|
] })
|
|
@@ -5977,8 +6054,8 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
5977
6054
|
}
|
|
5978
6055
|
|
|
5979
6056
|
// src/components/user-profile/MfaSection.tsx
|
|
5980
|
-
var
|
|
5981
|
-
var
|
|
6057
|
+
var React30 = __toESM(require("react"), 1);
|
|
6058
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5982
6059
|
function MfaSection() {
|
|
5983
6060
|
const t = useT();
|
|
5984
6061
|
const { user } = useUser();
|
|
@@ -5986,17 +6063,17 @@ function MfaSection() {
|
|
|
5986
6063
|
const { config } = usePublicConfig();
|
|
5987
6064
|
const { disable } = useMFA();
|
|
5988
6065
|
const { pending, error, run } = useSubmitAction();
|
|
5989
|
-
const [password, setPassword] =
|
|
5990
|
-
const [showDisable, setShowDisable] =
|
|
5991
|
-
const titleId =
|
|
6066
|
+
const [password, setPassword] = React30.useState("");
|
|
6067
|
+
const [showDisable, setShowDisable] = React30.useState(false);
|
|
6068
|
+
const titleId = React30.useId();
|
|
5992
6069
|
const required = resolveProjectCapabilities(config).mfaRequired;
|
|
5993
6070
|
if (!user?.twoFactorEnabled) {
|
|
5994
|
-
return /* @__PURE__ */ (0,
|
|
5995
|
-
/* @__PURE__ */ (0,
|
|
5996
|
-
/* @__PURE__ */ (0,
|
|
5997
|
-
/* @__PURE__ */ (0,
|
|
6071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6072
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
6073
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
6074
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredDescription") : t("userProfile.mfa.description") })
|
|
5998
6075
|
] }),
|
|
5999
|
-
/* @__PURE__ */ (0,
|
|
6076
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6000
6077
|
MFAEnrollment,
|
|
6001
6078
|
{
|
|
6002
6079
|
title: null,
|
|
@@ -6019,16 +6096,16 @@ function MfaSection() {
|
|
|
6019
6096
|
}
|
|
6020
6097
|
);
|
|
6021
6098
|
};
|
|
6022
|
-
return /* @__PURE__ */ (0,
|
|
6023
|
-
/* @__PURE__ */ (0,
|
|
6024
|
-
/* @__PURE__ */ (0,
|
|
6025
|
-
/* @__PURE__ */ (0,
|
|
6099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6100
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
6101
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
6102
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredActive") : t("userProfile.mfa.active") })
|
|
6026
6103
|
] }),
|
|
6027
|
-
/* @__PURE__ */ (0,
|
|
6028
|
-
/* @__PURE__ */ (0,
|
|
6029
|
-
/* @__PURE__ */ (0,
|
|
6104
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ba-profile-status", role: "status", children: [
|
|
6105
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("strong", { children: t("userProfile.mfa.enabled") }),
|
|
6106
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: t("userProfile.mfa.authenticator") })
|
|
6030
6107
|
] }),
|
|
6031
|
-
!showDisable ? /* @__PURE__ */ (0,
|
|
6108
|
+
!showDisable ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6032
6109
|
"button",
|
|
6033
6110
|
{
|
|
6034
6111
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -6036,11 +6113,11 @@ function MfaSection() {
|
|
|
6036
6113
|
onClick: () => setShowDisable(true),
|
|
6037
6114
|
children: required ? t("userProfile.mfa.replace") : t("userProfile.mfa.disable")
|
|
6038
6115
|
}
|
|
6039
|
-
) : /* @__PURE__ */ (0,
|
|
6040
|
-
/* @__PURE__ */ (0,
|
|
6041
|
-
/* @__PURE__ */ (0,
|
|
6116
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("form", { method: "post", className: "ba-fields ba-profile-security-form", onSubmit: submitDisable, children: [
|
|
6117
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "ba-muted", children: required ? t("userProfile.mfa.replaceWarning") : t("userProfile.mfa.disableWarning") }),
|
|
6118
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "ba-label", children: [
|
|
6042
6119
|
t("common.passwordLabel"),
|
|
6043
|
-
/* @__PURE__ */ (0,
|
|
6120
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6044
6121
|
"input",
|
|
6045
6122
|
{
|
|
6046
6123
|
className: "ba-input",
|
|
@@ -6052,19 +6129,19 @@ function MfaSection() {
|
|
|
6052
6129
|
}
|
|
6053
6130
|
)
|
|
6054
6131
|
] }),
|
|
6055
|
-
/* @__PURE__ */ (0,
|
|
6056
|
-
/* @__PURE__ */ (0,
|
|
6057
|
-
/* @__PURE__ */ (0,
|
|
6132
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FormError, { children: error }),
|
|
6133
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "ba-profile-action-row", children: [
|
|
6134
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6058
6135
|
"button",
|
|
6059
6136
|
{
|
|
6060
6137
|
className: "ba-button ba-danger-button",
|
|
6061
6138
|
type: "submit",
|
|
6062
6139
|
disabled: pending || !password,
|
|
6063
6140
|
"aria-busy": pending || void 0,
|
|
6064
|
-
children: /* @__PURE__ */ (0,
|
|
6141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Busy, { busy: pending, label: t("common.working"), children: required ? t("userProfile.mfa.replaceConfirm") : t("userProfile.mfa.disableConfirm") })
|
|
6065
6142
|
}
|
|
6066
6143
|
),
|
|
6067
|
-
/* @__PURE__ */ (0,
|
|
6144
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6068
6145
|
"button",
|
|
6069
6146
|
{
|
|
6070
6147
|
className: "ba-button ba-button-secondary",
|
|
@@ -6083,19 +6160,19 @@ function MfaSection() {
|
|
|
6083
6160
|
}
|
|
6084
6161
|
|
|
6085
6162
|
// src/components/user-profile/PasswordSection.tsx
|
|
6086
|
-
var
|
|
6087
|
-
var
|
|
6163
|
+
var React31 = __toESM(require("react"), 1);
|
|
6164
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6088
6165
|
function PasswordSection() {
|
|
6089
6166
|
const t = useT();
|
|
6090
6167
|
const account = useAccount();
|
|
6091
6168
|
const { config } = usePublicConfig();
|
|
6092
6169
|
const { passwordMinLength, passwordMaxLength } = resolveProjectCapabilities(config);
|
|
6093
6170
|
const { pending, error, setError, run } = useSubmitAction();
|
|
6094
|
-
const [currentPassword, setCurrentPassword] =
|
|
6095
|
-
const [newPassword, setNewPassword] =
|
|
6096
|
-
const [confirmPassword, setConfirmPassword] =
|
|
6097
|
-
const [saved, setSaved] =
|
|
6098
|
-
const titleId =
|
|
6171
|
+
const [currentPassword, setCurrentPassword] = React31.useState("");
|
|
6172
|
+
const [newPassword, setNewPassword] = React31.useState("");
|
|
6173
|
+
const [confirmPassword, setConfirmPassword] = React31.useState("");
|
|
6174
|
+
const [saved, setSaved] = React31.useState(false);
|
|
6175
|
+
const titleId = React31.useId();
|
|
6099
6176
|
const submit = (event) => {
|
|
6100
6177
|
event.preventDefault();
|
|
6101
6178
|
setSaved(false);
|
|
@@ -6120,43 +6197,43 @@ function PasswordSection() {
|
|
|
6120
6197
|
}
|
|
6121
6198
|
);
|
|
6122
6199
|
};
|
|
6123
|
-
return /* @__PURE__ */ (0,
|
|
6124
|
-
/* @__PURE__ */ (0,
|
|
6125
|
-
/* @__PURE__ */ (0,
|
|
6126
|
-
/* @__PURE__ */ (0,
|
|
6200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6201
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
6202
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.password.title") }),
|
|
6203
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "ba-muted", children: t("userProfile.password.description") })
|
|
6127
6204
|
] }),
|
|
6128
|
-
/* @__PURE__ */ (0,
|
|
6129
|
-
/* @__PURE__ */ (0,
|
|
6205
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
6206
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "ba-label", children: [
|
|
6130
6207
|
t("userProfile.password.currentLabel"),
|
|
6131
|
-
/* @__PURE__ */ (0,
|
|
6208
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { className: "ba-input", type: "password", autoComplete: "current-password", value: currentPassword, onChange: (event) => {
|
|
6132
6209
|
setCurrentPassword(event.target.value);
|
|
6133
6210
|
setError(null);
|
|
6134
6211
|
}, required: true })
|
|
6135
6212
|
] }),
|
|
6136
|
-
/* @__PURE__ */ (0,
|
|
6213
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "ba-label", children: [
|
|
6137
6214
|
t("resetPassword.newPasswordLabel"),
|
|
6138
|
-
/* @__PURE__ */ (0,
|
|
6215
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: newPassword, onChange: (event) => {
|
|
6139
6216
|
setNewPassword(event.target.value);
|
|
6140
6217
|
setError(null);
|
|
6141
6218
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
6142
6219
|
] }),
|
|
6143
|
-
/* @__PURE__ */ (0,
|
|
6220
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "ba-label", children: [
|
|
6144
6221
|
t("resetPassword.confirmPasswordLabel"),
|
|
6145
|
-
/* @__PURE__ */ (0,
|
|
6222
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: confirmPassword, onChange: (event) => {
|
|
6146
6223
|
setConfirmPassword(event.target.value);
|
|
6147
6224
|
setError(null);
|
|
6148
6225
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
6149
6226
|
] }),
|
|
6150
|
-
/* @__PURE__ */ (0,
|
|
6151
|
-
saved && /* @__PURE__ */ (0,
|
|
6152
|
-
/* @__PURE__ */ (0,
|
|
6227
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FormError, { children: error }),
|
|
6228
|
+
saved && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "ba-success", role: "status", children: t("userProfile.password.saved") }),
|
|
6229
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6153
6230
|
"button",
|
|
6154
6231
|
{
|
|
6155
6232
|
className: "ba-button ba-profile-submit",
|
|
6156
6233
|
type: "submit",
|
|
6157
6234
|
disabled: pending || !currentPassword || !newPassword || !confirmPassword,
|
|
6158
6235
|
"aria-busy": pending || void 0,
|
|
6159
|
-
children: /* @__PURE__ */ (0,
|
|
6236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.password.submit") })
|
|
6160
6237
|
}
|
|
6161
6238
|
)
|
|
6162
6239
|
] })
|
|
@@ -6164,23 +6241,23 @@ function PasswordSection() {
|
|
|
6164
6241
|
}
|
|
6165
6242
|
|
|
6166
6243
|
// src/components/user-profile/PasskeysSection.tsx
|
|
6167
|
-
var
|
|
6168
|
-
var
|
|
6244
|
+
var React32 = __toESM(require("react"), 1);
|
|
6245
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6169
6246
|
function PasskeysSection({ allowAdd }) {
|
|
6170
6247
|
const t = useT();
|
|
6171
|
-
const titleId =
|
|
6172
|
-
return /* @__PURE__ */ (0,
|
|
6173
|
-
/* @__PURE__ */ (0,
|
|
6174
|
-
/* @__PURE__ */ (0,
|
|
6175
|
-
/* @__PURE__ */ (0,
|
|
6248
|
+
const titleId = React32.useId();
|
|
6249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6250
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
6251
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
|
|
6252
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "ba-muted", children: t("userProfile.passkeys.description") })
|
|
6176
6253
|
] }),
|
|
6177
|
-
/* @__PURE__ */ (0,
|
|
6254
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PasskeyManager, { title: null, allowAdd })
|
|
6178
6255
|
] });
|
|
6179
6256
|
}
|
|
6180
6257
|
|
|
6181
6258
|
// src/components/user-profile/ProfileSection.tsx
|
|
6182
|
-
var
|
|
6183
|
-
var
|
|
6259
|
+
var React33 = __toESM(require("react"), 1);
|
|
6260
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6184
6261
|
function ProfileSection({
|
|
6185
6262
|
firstLastName,
|
|
6186
6263
|
usernameEnabled,
|
|
@@ -6191,15 +6268,15 @@ function ProfileSection({
|
|
|
6191
6268
|
const { user } = useUser();
|
|
6192
6269
|
const session = useSession();
|
|
6193
6270
|
const { pending, error, run } = useSubmitAction();
|
|
6194
|
-
const [name, setName] =
|
|
6195
|
-
const [firstName, setFirstName] =
|
|
6196
|
-
const [lastName, setLastName] =
|
|
6197
|
-
const [username, setUsername] =
|
|
6271
|
+
const [name, setName] = React33.useState(user?.name ?? "");
|
|
6272
|
+
const [firstName, setFirstName] = React33.useState(user?.firstName ?? "");
|
|
6273
|
+
const [lastName, setLastName] = React33.useState(user?.lastName ?? "");
|
|
6274
|
+
const [username, setUsername] = React33.useState(
|
|
6198
6275
|
user?.displayUsername ?? user?.username ?? ""
|
|
6199
6276
|
);
|
|
6200
|
-
const [image, setImage] =
|
|
6201
|
-
const [saved, setSaved] =
|
|
6202
|
-
const titleId =
|
|
6277
|
+
const [image, setImage] = React33.useState(user?.image ?? "");
|
|
6278
|
+
const [saved, setSaved] = React33.useState(false);
|
|
6279
|
+
const titleId = React33.useId();
|
|
6203
6280
|
const submit = (event) => {
|
|
6204
6281
|
event.preventDefault();
|
|
6205
6282
|
setSaved(false);
|
|
@@ -6222,15 +6299,15 @@ function ProfileSection({
|
|
|
6222
6299
|
}
|
|
6223
6300
|
);
|
|
6224
6301
|
};
|
|
6225
|
-
return /* @__PURE__ */ (0,
|
|
6226
|
-
/* @__PURE__ */ (0,
|
|
6227
|
-
/* @__PURE__ */ (0,
|
|
6228
|
-
/* @__PURE__ */ (0,
|
|
6302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6303
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
6304
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.profile.title") }),
|
|
6305
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "ba-muted", children: t("userProfile.profile.description") })
|
|
6229
6306
|
] }),
|
|
6230
|
-
/* @__PURE__ */ (0,
|
|
6231
|
-
legacyNameField && /* @__PURE__ */ (0,
|
|
6307
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
6308
|
+
legacyNameField && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "ba-label", children: [
|
|
6232
6309
|
t("signUp.nameLabel"),
|
|
6233
|
-
/* @__PURE__ */ (0,
|
|
6310
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6234
6311
|
"input",
|
|
6235
6312
|
{
|
|
6236
6313
|
className: "ba-input",
|
|
@@ -6241,10 +6318,10 @@ function ProfileSection({
|
|
|
6241
6318
|
}
|
|
6242
6319
|
)
|
|
6243
6320
|
] }),
|
|
6244
|
-
firstLastName && /* @__PURE__ */ (0,
|
|
6245
|
-
/* @__PURE__ */ (0,
|
|
6321
|
+
firstLastName && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
6322
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "ba-label", children: [
|
|
6246
6323
|
t("signUp.firstNameLabel"),
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6324
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6248
6325
|
"input",
|
|
6249
6326
|
{
|
|
6250
6327
|
className: "ba-input",
|
|
@@ -6254,9 +6331,9 @@ function ProfileSection({
|
|
|
6254
6331
|
}
|
|
6255
6332
|
)
|
|
6256
6333
|
] }),
|
|
6257
|
-
/* @__PURE__ */ (0,
|
|
6334
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "ba-label", children: [
|
|
6258
6335
|
t("signUp.lastNameLabel"),
|
|
6259
|
-
/* @__PURE__ */ (0,
|
|
6336
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6260
6337
|
"input",
|
|
6261
6338
|
{
|
|
6262
6339
|
className: "ba-input",
|
|
@@ -6267,9 +6344,9 @@ function ProfileSection({
|
|
|
6267
6344
|
)
|
|
6268
6345
|
] })
|
|
6269
6346
|
] }),
|
|
6270
|
-
usernameEnabled && /* @__PURE__ */ (0,
|
|
6347
|
+
usernameEnabled && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "ba-label", children: [
|
|
6271
6348
|
t("common.usernameLabel"),
|
|
6272
|
-
/* @__PURE__ */ (0,
|
|
6349
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6273
6350
|
"input",
|
|
6274
6351
|
{
|
|
6275
6352
|
className: "ba-input",
|
|
@@ -6279,9 +6356,9 @@ function ProfileSection({
|
|
|
6279
6356
|
}
|
|
6280
6357
|
)
|
|
6281
6358
|
] }),
|
|
6282
|
-
/* @__PURE__ */ (0,
|
|
6359
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "ba-label", children: [
|
|
6283
6360
|
t("userProfile.profile.imageLabel"),
|
|
6284
|
-
/* @__PURE__ */ (0,
|
|
6361
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6285
6362
|
"input",
|
|
6286
6363
|
{
|
|
6287
6364
|
className: "ba-input",
|
|
@@ -6292,16 +6369,16 @@ function ProfileSection({
|
|
|
6292
6369
|
}
|
|
6293
6370
|
)
|
|
6294
6371
|
] }),
|
|
6295
|
-
/* @__PURE__ */ (0,
|
|
6296
|
-
saved && /* @__PURE__ */ (0,
|
|
6297
|
-
/* @__PURE__ */ (0,
|
|
6372
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(FormError, { children: error }),
|
|
6373
|
+
saved && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "ba-success", role: "status", children: t("userProfile.profile.saved") }),
|
|
6374
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6298
6375
|
"button",
|
|
6299
6376
|
{
|
|
6300
6377
|
className: "ba-button ba-profile-submit",
|
|
6301
6378
|
type: "submit",
|
|
6302
6379
|
disabled: pending || legacyNameField && !name.trim(),
|
|
6303
6380
|
"aria-busy": pending || void 0,
|
|
6304
|
-
children: /* @__PURE__ */ (0,
|
|
6381
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.save") })
|
|
6305
6382
|
}
|
|
6306
6383
|
)
|
|
6307
6384
|
] })
|
|
@@ -6309,30 +6386,30 @@ function ProfileSection({
|
|
|
6309
6386
|
}
|
|
6310
6387
|
|
|
6311
6388
|
// src/components/user-profile/RecoverySection.tsx
|
|
6312
|
-
var
|
|
6313
|
-
var
|
|
6389
|
+
var React34 = __toESM(require("react"), 1);
|
|
6390
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
6314
6391
|
function RecoverySection() {
|
|
6315
6392
|
const t = useT();
|
|
6316
6393
|
const { user } = useUser();
|
|
6317
|
-
const titleId =
|
|
6318
|
-
return /* @__PURE__ */ (0,
|
|
6319
|
-
/* @__PURE__ */ (0,
|
|
6320
|
-
/* @__PURE__ */ (0,
|
|
6321
|
-
/* @__PURE__ */ (0,
|
|
6394
|
+
const titleId = React34.useId();
|
|
6395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6396
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
6397
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
|
|
6398
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "ba-muted", children: t("userProfile.recovery.description") })
|
|
6322
6399
|
] }),
|
|
6323
|
-
/* @__PURE__ */ (0,
|
|
6324
|
-
/* @__PURE__ */ (0,
|
|
6325
|
-
user?.email && user.emailVerified ? /* @__PURE__ */ (0,
|
|
6326
|
-
/* @__PURE__ */ (0,
|
|
6327
|
-
/* @__PURE__ */ (0,
|
|
6328
|
-
] }) : /* @__PURE__ */ (0,
|
|
6400
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "ba-profile-recovery-card", children: [
|
|
6401
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("strong", { children: t("userProfile.recovery.emailTitle") }),
|
|
6402
|
+
user?.email && user.emailVerified ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6403
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: t("userProfile.recovery.emailDescription") }),
|
|
6404
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Bidi, { children: user.email })
|
|
6405
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: t("userProfile.recovery.emailUnavailable") })
|
|
6329
6406
|
] }),
|
|
6330
|
-
/* @__PURE__ */ (0,
|
|
6407
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BackupCodesManager, { title: null })
|
|
6331
6408
|
] });
|
|
6332
6409
|
}
|
|
6333
6410
|
|
|
6334
6411
|
// src/components/user-profile/SessionsSection.tsx
|
|
6335
|
-
var
|
|
6412
|
+
var React36 = __toESM(require("react"), 1);
|
|
6336
6413
|
|
|
6337
6414
|
// src/components/user-profile/model.ts
|
|
6338
6415
|
var USER_PROFILE_SECTIONS = [
|
|
@@ -6379,18 +6456,18 @@ function formatSessionTime(date, locale) {
|
|
|
6379
6456
|
}
|
|
6380
6457
|
|
|
6381
6458
|
// src/components/user-profile/use-account-resource.ts
|
|
6382
|
-
var
|
|
6459
|
+
var React35 = __toESM(require("react"), 1);
|
|
6383
6460
|
function useAccountResource(loader2, failure) {
|
|
6384
|
-
const loaderRef =
|
|
6461
|
+
const loaderRef = React35.useRef(loader2);
|
|
6385
6462
|
loaderRef.current = loader2;
|
|
6386
|
-
const failureRef =
|
|
6463
|
+
const failureRef = React35.useRef(failure);
|
|
6387
6464
|
failureRef.current = failure;
|
|
6388
6465
|
const toServerError = useServerError();
|
|
6389
|
-
const [data, setData] =
|
|
6390
|
-
const [error, setError] =
|
|
6391
|
-
const [loading, setLoading] =
|
|
6392
|
-
const requestRef =
|
|
6393
|
-
const load =
|
|
6466
|
+
const [data, setData] = React35.useState(null);
|
|
6467
|
+
const [error, setError] = React35.useState(null);
|
|
6468
|
+
const [loading, setLoading] = React35.useState(true);
|
|
6469
|
+
const requestRef = React35.useRef(0);
|
|
6470
|
+
const load = React35.useCallback(async () => {
|
|
6394
6471
|
const request = ++requestRef.current;
|
|
6395
6472
|
setLoading(true);
|
|
6396
6473
|
try {
|
|
@@ -6409,7 +6486,7 @@ function useAccountResource(loader2, failure) {
|
|
|
6409
6486
|
if (request === requestRef.current) setLoading(false);
|
|
6410
6487
|
}
|
|
6411
6488
|
}, [toServerError]);
|
|
6412
|
-
|
|
6489
|
+
React35.useEffect(() => {
|
|
6413
6490
|
void load();
|
|
6414
6491
|
return () => {
|
|
6415
6492
|
requestRef.current += 1;
|
|
@@ -6419,14 +6496,14 @@ function useAccountResource(loader2, failure) {
|
|
|
6419
6496
|
}
|
|
6420
6497
|
|
|
6421
6498
|
// src/components/user-profile/SessionsSection.tsx
|
|
6422
|
-
var
|
|
6499
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
6423
6500
|
function SessionsSection() {
|
|
6424
6501
|
const t = useT();
|
|
6425
6502
|
const locale = useLocale();
|
|
6426
6503
|
const account = useAccount();
|
|
6427
6504
|
const sessionState = useSession();
|
|
6428
6505
|
const mutation = useSubmitAction();
|
|
6429
|
-
const titleId =
|
|
6506
|
+
const titleId = React36.useId();
|
|
6430
6507
|
const resource = useAccountResource(
|
|
6431
6508
|
() => account.listSessions(),
|
|
6432
6509
|
t("userProfile.sessions.loadError")
|
|
@@ -6448,31 +6525,31 @@ function SessionsSection() {
|
|
|
6448
6525
|
}
|
|
6449
6526
|
);
|
|
6450
6527
|
};
|
|
6451
|
-
return /* @__PURE__ */ (0,
|
|
6452
|
-
/* @__PURE__ */ (0,
|
|
6453
|
-
/* @__PURE__ */ (0,
|
|
6454
|
-
/* @__PURE__ */ (0,
|
|
6528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6529
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
6530
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.sessions.title") }),
|
|
6531
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "ba-muted", children: t("userProfile.sessions.description") })
|
|
6455
6532
|
] }),
|
|
6456
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */ (0,
|
|
6457
|
-
/* @__PURE__ */ (0,
|
|
6458
|
-
/* @__PURE__ */ (0,
|
|
6459
|
-
] }) : null : /* @__PURE__ */ (0,
|
|
6533
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: [
|
|
6534
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "ba-skeleton" }),
|
|
6535
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "ba-skeleton" })
|
|
6536
|
+
] }) : null : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("ul", { className: "ba-profile-list", children: [
|
|
6460
6537
|
sessions.map((session) => {
|
|
6461
6538
|
const label2 = session.userAgent?.trim() || t("userProfile.sessions.unknownDevice");
|
|
6462
|
-
return /* @__PURE__ */ (0,
|
|
6463
|
-
/* @__PURE__ */ (0,
|
|
6464
|
-
/* @__PURE__ */ (0,
|
|
6465
|
-
/* @__PURE__ */ (0,
|
|
6466
|
-
session.id === currentId && /* @__PURE__ */ (0,
|
|
6539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("li", { className: "ba-profile-list-item", children: [
|
|
6540
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
|
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: label2 }),
|
|
6542
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("small", { children: [
|
|
6543
|
+
session.id === currentId && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("em", { children: t("userProfile.sessions.current") }),
|
|
6467
6544
|
formatSessionTime(session.updatedAt, locale)
|
|
6468
6545
|
] })
|
|
6469
6546
|
] }),
|
|
6470
|
-
/* @__PURE__ */ (0,
|
|
6547
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: mutation.pending, onClick: () => revoke(session.id, label2), children: t("userProfile.sessions.revoke") })
|
|
6471
6548
|
] }, session.id);
|
|
6472
6549
|
}),
|
|
6473
|
-
sessions.length === 0 && /* @__PURE__ */ (0,
|
|
6550
|
+
sessions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("li", { className: "ba-muted", children: t("userProfile.sessions.empty") })
|
|
6474
6551
|
] }),
|
|
6475
|
-
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ (0,
|
|
6552
|
+
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
6476
6553
|
"button",
|
|
6477
6554
|
{
|
|
6478
6555
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -6488,17 +6565,17 @@ function SessionsSection() {
|
|
|
6488
6565
|
children: t("userProfile.sessions.revokeOthers")
|
|
6489
6566
|
}
|
|
6490
6567
|
),
|
|
6491
|
-
resource.error && /* @__PURE__ */ (0,
|
|
6492
|
-
/* @__PURE__ */ (0,
|
|
6493
|
-
/* @__PURE__ */ (0,
|
|
6568
|
+
resource.error && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "ba-profile-inline-error", children: [
|
|
6569
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormError, { children: resource.error }),
|
|
6570
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
6494
6571
|
] }),
|
|
6495
|
-
/* @__PURE__ */ (0,
|
|
6572
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormError, { children: mutation.error })
|
|
6496
6573
|
] });
|
|
6497
6574
|
}
|
|
6498
6575
|
|
|
6499
6576
|
// src/components/user-profile/SocialSection.tsx
|
|
6500
|
-
var
|
|
6501
|
-
var
|
|
6577
|
+
var React37 = __toESM(require("react"), 1);
|
|
6578
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6502
6579
|
function providerLabel(provider) {
|
|
6503
6580
|
return provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
6504
6581
|
}
|
|
@@ -6507,7 +6584,7 @@ function SocialSection() {
|
|
|
6507
6584
|
const account = useAccount();
|
|
6508
6585
|
const { config } = usePublicConfig();
|
|
6509
6586
|
const mutation = useSubmitAction();
|
|
6510
|
-
const titleId =
|
|
6587
|
+
const titleId = React37.useId();
|
|
6511
6588
|
const resource = useAccountResource(
|
|
6512
6589
|
() => account.listSocialAccounts(),
|
|
6513
6590
|
t("userProfile.social.loadError")
|
|
@@ -6538,18 +6615,18 @@ function SocialSection() {
|
|
|
6538
6615
|
{ failure: t("userProfile.social.unlinkError"), onSuccess: resource.load }
|
|
6539
6616
|
);
|
|
6540
6617
|
};
|
|
6541
|
-
return /* @__PURE__ */ (0,
|
|
6542
|
-
/* @__PURE__ */ (0,
|
|
6543
|
-
/* @__PURE__ */ (0,
|
|
6544
|
-
/* @__PURE__ */ (0,
|
|
6618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
6619
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
6620
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.social.title") }),
|
|
6621
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "ba-muted", children: t("userProfile.social.description") })
|
|
6545
6622
|
] }),
|
|
6546
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */ (0,
|
|
6547
|
-
linked.map((item) => /* @__PURE__ */ (0,
|
|
6548
|
-
/* @__PURE__ */ (0,
|
|
6549
|
-
/* @__PURE__ */ (0,
|
|
6550
|
-
/* @__PURE__ */ (0,
|
|
6623
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "ba-skeleton" }) }) : null : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("ul", { className: "ba-profile-list", children: [
|
|
6624
|
+
linked.map((item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("li", { className: "ba-profile-list-item", children: [
|
|
6625
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { children: [
|
|
6626
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: providerLabel(item.providerId) }),
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("small", { children: item.canUnlink ? t("userProfile.social.connected") : t("userProfile.social.lastMethod") })
|
|
6551
6628
|
] }),
|
|
6552
|
-
/* @__PURE__ */ (0,
|
|
6629
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
6553
6630
|
"button",
|
|
6554
6631
|
{
|
|
6555
6632
|
className: "ba-link-button ba-danger",
|
|
@@ -6564,26 +6641,26 @@ function SocialSection() {
|
|
|
6564
6641
|
}
|
|
6565
6642
|
)
|
|
6566
6643
|
] }, item.id)),
|
|
6567
|
-
linked.length === 0 && /* @__PURE__ */ (0,
|
|
6644
|
+
linked.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { className: "ba-muted", children: t("userProfile.social.empty") })
|
|
6568
6645
|
] }),
|
|
6569
|
-
available.length > 0 && /* @__PURE__ */ (0,
|
|
6570
|
-
/* @__PURE__ */ (0,
|
|
6571
|
-
available.map((provider) => /* @__PURE__ */ (0,
|
|
6646
|
+
available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "ba-profile-provider-actions", children: [
|
|
6647
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "ba-profile-subtitle", children: t("userProfile.social.add") }),
|
|
6648
|
+
available.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: "ba-button ba-button-secondary", disabled: mutation.pending, onClick: () => link(provider), children: t("userProfile.social.connectProvider", { provider: providerLabel(provider) }) }, provider))
|
|
6572
6649
|
] }),
|
|
6573
|
-
resource.error && /* @__PURE__ */ (0,
|
|
6574
|
-
/* @__PURE__ */ (0,
|
|
6575
|
-
/* @__PURE__ */ (0,
|
|
6650
|
+
resource.error && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "ba-profile-inline-error", children: [
|
|
6651
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(FormError, { children: resource.error }),
|
|
6652
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
6576
6653
|
] }),
|
|
6577
|
-
/* @__PURE__ */ (0,
|
|
6654
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(FormError, { children: mutation.error })
|
|
6578
6655
|
] });
|
|
6579
6656
|
}
|
|
6580
6657
|
|
|
6581
6658
|
// src/components/user-profile/UserProfileModal.tsx
|
|
6582
|
-
var
|
|
6659
|
+
var React39 = __toESM(require("react"), 1);
|
|
6583
6660
|
|
|
6584
6661
|
// src/components/ModalSurface.tsx
|
|
6585
|
-
var
|
|
6586
|
-
var
|
|
6662
|
+
var React38 = __toESM(require("react"), 1);
|
|
6663
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
6587
6664
|
function ModalSurface({
|
|
6588
6665
|
overlayClassName,
|
|
6589
6666
|
panelClassName,
|
|
@@ -6593,12 +6670,12 @@ function ModalSurface({
|
|
|
6593
6670
|
onClose,
|
|
6594
6671
|
children
|
|
6595
6672
|
}) {
|
|
6596
|
-
const panelRef =
|
|
6597
|
-
const onCloseRef =
|
|
6598
|
-
const returnFocusRefRef =
|
|
6673
|
+
const panelRef = React38.useRef(null);
|
|
6674
|
+
const onCloseRef = React38.useRef(onClose);
|
|
6675
|
+
const returnFocusRefRef = React38.useRef(returnFocusRef);
|
|
6599
6676
|
onCloseRef.current = onClose;
|
|
6600
6677
|
returnFocusRefRef.current = returnFocusRef;
|
|
6601
|
-
|
|
6678
|
+
React38.useEffect(() => {
|
|
6602
6679
|
const previousFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
6603
6680
|
const previousOverflow = document.body.style.overflow;
|
|
6604
6681
|
document.body.style.overflow = "hidden";
|
|
@@ -6631,9 +6708,9 @@ function ModalSurface({
|
|
|
6631
6708
|
window.setTimeout(() => returnTarget?.focus(), 0);
|
|
6632
6709
|
};
|
|
6633
6710
|
}, []);
|
|
6634
|
-
return /* @__PURE__ */ (0,
|
|
6711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: overlayClassName, role: "presentation", onMouseDown: (event) => {
|
|
6635
6712
|
if (event.target === event.currentTarget) onClose();
|
|
6636
|
-
}, children: /* @__PURE__ */ (0,
|
|
6713
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
6637
6714
|
"div",
|
|
6638
6715
|
{
|
|
6639
6716
|
ref: panelRef,
|
|
@@ -6648,14 +6725,15 @@ function ModalSurface({
|
|
|
6648
6725
|
}
|
|
6649
6726
|
|
|
6650
6727
|
// src/components/user-profile/UserProfileModal.tsx
|
|
6651
|
-
var
|
|
6728
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
6652
6729
|
function UserProfileModal({
|
|
6653
6730
|
children,
|
|
6654
|
-
onClose
|
|
6731
|
+
onClose,
|
|
6732
|
+
branding
|
|
6655
6733
|
}) {
|
|
6656
6734
|
const t = useT();
|
|
6657
|
-
const titleId =
|
|
6658
|
-
return /* @__PURE__ */ (0,
|
|
6735
|
+
const titleId = React39.useId();
|
|
6736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
6659
6737
|
ModalSurface,
|
|
6660
6738
|
{
|
|
6661
6739
|
overlayClassName: "ba-profile-overlay",
|
|
@@ -6664,12 +6742,13 @@ function UserProfileModal({
|
|
|
6664
6742
|
testId: "user-profile-modal",
|
|
6665
6743
|
onClose,
|
|
6666
6744
|
children: [
|
|
6667
|
-
/* @__PURE__ */ (0,
|
|
6668
|
-
/* @__PURE__ */ (0,
|
|
6669
|
-
|
|
6670
|
-
/* @__PURE__ */ (0,
|
|
6745
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("header", { className: "ba-profile-modal-header", children: [
|
|
6746
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { children: [
|
|
6747
|
+
branding,
|
|
6748
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h1", { id: titleId, children: t("userProfile.title") }),
|
|
6749
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: t("userProfile.description") })
|
|
6671
6750
|
] }),
|
|
6672
|
-
/* @__PURE__ */ (0,
|
|
6751
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
6673
6752
|
"button",
|
|
6674
6753
|
{
|
|
6675
6754
|
type: "button",
|
|
@@ -6677,7 +6756,7 @@ function UserProfileModal({
|
|
|
6677
6756
|
"aria-label": t("userProfile.close"),
|
|
6678
6757
|
onClick: onClose,
|
|
6679
6758
|
autoFocus: true,
|
|
6680
|
-
children: /* @__PURE__ */ (0,
|
|
6759
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
6681
6760
|
"path",
|
|
6682
6761
|
{
|
|
6683
6762
|
d: "M6 6l12 12M18 6L6 18",
|
|
@@ -6690,14 +6769,14 @@ function UserProfileModal({
|
|
|
6690
6769
|
)
|
|
6691
6770
|
] }),
|
|
6692
6771
|
children,
|
|
6693
|
-
/* @__PURE__ */ (0,
|
|
6772
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AuthOwlBadge, {}) })
|
|
6694
6773
|
]
|
|
6695
6774
|
}
|
|
6696
6775
|
);
|
|
6697
6776
|
}
|
|
6698
6777
|
|
|
6699
6778
|
// src/components/UserProfile.tsx
|
|
6700
|
-
var
|
|
6779
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
6701
6780
|
var SECTION_KEYS = {
|
|
6702
6781
|
profile: "userProfile.nav.profile",
|
|
6703
6782
|
email: "userProfile.nav.email",
|
|
@@ -6719,13 +6798,14 @@ function UserProfile(props = {}) {
|
|
|
6719
6798
|
section,
|
|
6720
6799
|
defaultSection,
|
|
6721
6800
|
onSectionChange,
|
|
6722
|
-
onDeleted
|
|
6801
|
+
onDeleted,
|
|
6802
|
+
showBranding = true
|
|
6723
6803
|
} = props;
|
|
6724
6804
|
const mode = props.mode ?? "page";
|
|
6725
6805
|
const t = useT();
|
|
6726
6806
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
6727
6807
|
const { config } = usePublicConfig();
|
|
6728
|
-
const [internalSection, setInternalSection] =
|
|
6808
|
+
const [internalSection, setInternalSection] = React40.useState(() => initialSection(defaultSection));
|
|
6729
6809
|
const active = section ?? internalSection;
|
|
6730
6810
|
const capabilities = resolveProjectCapabilities(config);
|
|
6731
6811
|
const passwordEnabled = config !== null && capabilities.passwordSignIn;
|
|
@@ -6734,7 +6814,7 @@ function UserProfile(props = {}) {
|
|
|
6734
6814
|
const recoveryEnabled = capabilities.backupCodes && user?.twoFactorEnabled === true;
|
|
6735
6815
|
const deletionEnabled = capabilities.accountDeletion;
|
|
6736
6816
|
const socialEnabled = (config?.socialProviders?.length ?? 0) > 0;
|
|
6737
|
-
const sections =
|
|
6817
|
+
const sections = React40.useMemo(
|
|
6738
6818
|
() => userProfileSectionsFor({
|
|
6739
6819
|
password: passwordEnabled,
|
|
6740
6820
|
passkeys: passkeysEnabled,
|
|
@@ -6745,7 +6825,7 @@ function UserProfile(props = {}) {
|
|
|
6745
6825
|
}),
|
|
6746
6826
|
[deletionEnabled, mfaEnabled, passkeysEnabled, passwordEnabled, recoveryEnabled, socialEnabled]
|
|
6747
6827
|
);
|
|
6748
|
-
|
|
6828
|
+
React40.useEffect(() => {
|
|
6749
6829
|
if (section || mode !== "page") return;
|
|
6750
6830
|
const onHashChange = () => {
|
|
6751
6831
|
const next = userProfileSectionFromHash(window.location.hash);
|
|
@@ -6762,11 +6842,11 @@ function UserProfile(props = {}) {
|
|
|
6762
6842
|
window.history.replaceState(null, "", userProfileSectionHash(next));
|
|
6763
6843
|
}
|
|
6764
6844
|
};
|
|
6765
|
-
const content = !isLoaded ? /* @__PURE__ */ (0,
|
|
6766
|
-
/* @__PURE__ */ (0,
|
|
6767
|
-
/* @__PURE__ */ (0,
|
|
6768
|
-
/* @__PURE__ */ (0,
|
|
6769
|
-
] }) : !isSignedIn || !user ? /* @__PURE__ */ (0,
|
|
6845
|
+
const content = !isLoaded ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "ba-profile-loading", "aria-busy": "true", children: [
|
|
6846
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "ba-skeleton" }),
|
|
6847
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "ba-skeleton" }),
|
|
6848
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "ba-skeleton" })
|
|
6849
|
+
] }) : !isSignedIn || !user ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "ba-muted", children: t("userProfile.signedOut") }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6770
6850
|
UserProfileBody,
|
|
6771
6851
|
{
|
|
6772
6852
|
active: visibleActive,
|
|
@@ -6778,15 +6858,23 @@ function UserProfile(props = {}) {
|
|
|
6778
6858
|
user.id
|
|
6779
6859
|
);
|
|
6780
6860
|
if (props.mode === "modal") {
|
|
6781
|
-
return /* @__PURE__ */ (0,
|
|
6861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6862
|
+
UserProfileModal,
|
|
6863
|
+
{
|
|
6864
|
+
onClose: props.onClose,
|
|
6865
|
+
branding: showBranding ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AuthOwlBranding, {}) : null,
|
|
6866
|
+
children: content
|
|
6867
|
+
}
|
|
6868
|
+
);
|
|
6782
6869
|
}
|
|
6783
|
-
return /* @__PURE__ */ (0,
|
|
6784
|
-
/* @__PURE__ */ (0,
|
|
6785
|
-
/* @__PURE__ */ (0,
|
|
6786
|
-
/* @__PURE__ */ (0,
|
|
6870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("article", { className: "ba-profile ba-profile-page", "data-testid": "user-profile", children: [
|
|
6871
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("header", { className: "ba-profile-heading", children: [
|
|
6872
|
+
showBranding ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AuthOwlBranding, {}) : null,
|
|
6873
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("h1", { children: t("userProfile.title") }),
|
|
6874
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { children: t("userProfile.description") })
|
|
6787
6875
|
] }),
|
|
6788
6876
|
content,
|
|
6789
|
-
/* @__PURE__ */ (0,
|
|
6877
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AuthOwlBadge, {}) })
|
|
6790
6878
|
] });
|
|
6791
6879
|
}
|
|
6792
6880
|
function UserProfileBody({
|
|
@@ -6797,8 +6885,8 @@ function UserProfileBody({
|
|
|
6797
6885
|
capabilities
|
|
6798
6886
|
}) {
|
|
6799
6887
|
const t = useT();
|
|
6800
|
-
return /* @__PURE__ */ (0,
|
|
6801
|
-
/* @__PURE__ */ (0,
|
|
6888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "ba-profile-layout", children: [
|
|
6889
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("nav", { className: "ba-profile-nav", "aria-label": t("userProfile.nav.aria"), children: sections.map((item) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6802
6890
|
"button",
|
|
6803
6891
|
{
|
|
6804
6892
|
type: "button",
|
|
@@ -6809,8 +6897,8 @@ function UserProfileBody({
|
|
|
6809
6897
|
},
|
|
6810
6898
|
item
|
|
6811
6899
|
)) }),
|
|
6812
|
-
/* @__PURE__ */ (0,
|
|
6813
|
-
active === "profile" && /* @__PURE__ */ (0,
|
|
6900
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "ba-profile-content", "data-section": active, children: [
|
|
6901
|
+
active === "profile" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6814
6902
|
ProfileSection,
|
|
6815
6903
|
{
|
|
6816
6904
|
firstLastName: capabilities.firstLastName,
|
|
@@ -6818,43 +6906,43 @@ function UserProfileBody({
|
|
|
6818
6906
|
legacyNameField: capabilities.legacyNameField
|
|
6819
6907
|
}
|
|
6820
6908
|
),
|
|
6821
|
-
active === "email" && /* @__PURE__ */ (0,
|
|
6822
|
-
active === "password" && /* @__PURE__ */ (0,
|
|
6823
|
-
active === "social" && /* @__PURE__ */ (0,
|
|
6824
|
-
active === "sessions" && /* @__PURE__ */ (0,
|
|
6825
|
-
active === "passkeys" && /* @__PURE__ */ (0,
|
|
6826
|
-
active === "mfa" && /* @__PURE__ */ (0,
|
|
6827
|
-
active === "recovery" && /* @__PURE__ */ (0,
|
|
6828
|
-
active === "danger" && /* @__PURE__ */ (0,
|
|
6909
|
+
active === "email" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(EmailSection, { allowChange: capabilities.emailChange }),
|
|
6910
|
+
active === "password" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PasswordSection, {}),
|
|
6911
|
+
active === "social" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SocialSection, {}),
|
|
6912
|
+
active === "sessions" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SessionsSection, {}),
|
|
6913
|
+
active === "passkeys" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PasskeysSection, { allowAdd: capabilities.passkeyAdd }),
|
|
6914
|
+
active === "mfa" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(MfaSection, {}),
|
|
6915
|
+
active === "recovery" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RecoverySection, {}),
|
|
6916
|
+
active === "danger" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DeleteAccountSection, { onDeleted })
|
|
6829
6917
|
] })
|
|
6830
6918
|
] });
|
|
6831
6919
|
}
|
|
6832
6920
|
|
|
6833
6921
|
// src/components/UserButton.tsx
|
|
6834
|
-
var
|
|
6922
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
6835
6923
|
function UserButton() {
|
|
6836
6924
|
const t = useT();
|
|
6837
6925
|
const { user, isLoaded } = useUser();
|
|
6838
6926
|
const { signOut } = useSignOut();
|
|
6839
|
-
const [open, setOpen] =
|
|
6840
|
-
const [profileOpen, setProfileOpen] =
|
|
6841
|
-
const triggerRef =
|
|
6927
|
+
const [open, setOpen] = React41.useState(false);
|
|
6928
|
+
const [profileOpen, setProfileOpen] = React41.useState(false);
|
|
6929
|
+
const triggerRef = React41.useRef(null);
|
|
6842
6930
|
if (!isLoaded || !user) return null;
|
|
6843
6931
|
const identity = user.email ?? user.phoneNumber ?? user.name ?? "?";
|
|
6844
|
-
return /* @__PURE__ */ (0,
|
|
6845
|
-
/* @__PURE__ */ (0,
|
|
6932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ba-user-button", "data-testid": "user-button", children: [
|
|
6933
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6846
6934
|
"button",
|
|
6847
6935
|
{
|
|
6848
6936
|
ref: triggerRef,
|
|
6849
6937
|
className: "ba-user-button-trigger",
|
|
6850
6938
|
"aria-label": t("userButton.openMenuAria"),
|
|
6851
6939
|
onClick: () => setOpen((v) => !v),
|
|
6852
|
-
children: user.image ? /* @__PURE__ */ (0,
|
|
6940
|
+
children: user.image ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("img", { className: "ba-avatar", src: user.image, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ba-avatar ba-avatar-fallback", children: identity[0]?.toUpperCase() })
|
|
6853
6941
|
}
|
|
6854
6942
|
),
|
|
6855
|
-
open && /* @__PURE__ */ (0,
|
|
6856
|
-
/* @__PURE__ */ (0,
|
|
6857
|
-
/* @__PURE__ */ (0,
|
|
6943
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ba-menu", children: [
|
|
6944
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "ba-menu-label", children: identity }),
|
|
6945
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6858
6946
|
"button",
|
|
6859
6947
|
{
|
|
6860
6948
|
className: "ba-menu-item",
|
|
@@ -6865,10 +6953,10 @@ function UserButton() {
|
|
|
6865
6953
|
children: t("userButton.manageAccount")
|
|
6866
6954
|
}
|
|
6867
6955
|
),
|
|
6868
|
-
/* @__PURE__ */ (0,
|
|
6869
|
-
/* @__PURE__ */ (0,
|
|
6956
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { className: "ba-menu-item", onClick: () => signOut(), children: t("userButton.signOut") }),
|
|
6957
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "ba-menu-badge", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(AuthOwlBadge, {}) })
|
|
6870
6958
|
] }),
|
|
6871
|
-
profileOpen && /* @__PURE__ */ (0,
|
|
6959
|
+
profileOpen && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6872
6960
|
UserProfile,
|
|
6873
6961
|
{
|
|
6874
6962
|
mode: "modal",
|
|
@@ -6884,10 +6972,10 @@ function UserButton() {
|
|
|
6884
6972
|
}
|
|
6885
6973
|
|
|
6886
6974
|
// src/components/OrganizationSwitcher.tsx
|
|
6887
|
-
var
|
|
6975
|
+
var React50 = __toESM(require("react"), 1);
|
|
6888
6976
|
|
|
6889
6977
|
// src/components/CreateOrganization.tsx
|
|
6890
|
-
var
|
|
6978
|
+
var React42 = __toESM(require("react"), 1);
|
|
6891
6979
|
|
|
6892
6980
|
// src/components/organization/model.ts
|
|
6893
6981
|
function organizationSlugFromName(name) {
|
|
@@ -6904,22 +6992,22 @@ function canManageOrganization(member) {
|
|
|
6904
6992
|
}
|
|
6905
6993
|
|
|
6906
6994
|
// src/components/CreateOrganization.tsx
|
|
6907
|
-
var
|
|
6995
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
6908
6996
|
function CreateOrganization({ onCreated, title } = {}) {
|
|
6909
6997
|
const t = useT();
|
|
6910
6998
|
const { config, isLoading: configLoading } = usePublicConfig();
|
|
6911
6999
|
const { isLoaded, isSignedIn } = useUser();
|
|
6912
7000
|
const api = useAuthClient().organization;
|
|
6913
7001
|
const { pending, error, run } = useSubmitAction();
|
|
6914
|
-
const [name, setName] =
|
|
6915
|
-
const [slug, setSlug] =
|
|
6916
|
-
const [logo, setLogo] =
|
|
6917
|
-
const [slugTouched, setSlugTouched] =
|
|
7002
|
+
const [name, setName] = React42.useState("");
|
|
7003
|
+
const [slug, setSlug] = React42.useState("");
|
|
7004
|
+
const [logo, setLogo] = React42.useState("");
|
|
7005
|
+
const [slugTouched, setSlugTouched] = React42.useState(false);
|
|
6918
7006
|
if (configLoading || !isLoaded) {
|
|
6919
|
-
return /* @__PURE__ */ (0,
|
|
7007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
6920
7008
|
}
|
|
6921
7009
|
if (config?.organizations !== true) return null;
|
|
6922
|
-
if (!isSignedIn) return /* @__PURE__ */ (0,
|
|
7010
|
+
if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
6923
7011
|
const submit = (event) => {
|
|
6924
7012
|
event.preventDefault();
|
|
6925
7013
|
const normalizedName = name.trim();
|
|
@@ -6944,15 +7032,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6944
7032
|
}
|
|
6945
7033
|
);
|
|
6946
7034
|
};
|
|
6947
|
-
return /* @__PURE__ */ (0,
|
|
6948
|
-
title !== null && /* @__PURE__ */ (0,
|
|
6949
|
-
/* @__PURE__ */ (0,
|
|
6950
|
-
/* @__PURE__ */ (0,
|
|
7035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: "ba-organization-create", children: [
|
|
7036
|
+
title !== null && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
7037
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("h2", { className: "ba-title", children: title ?? t("organization.create.title") }),
|
|
7038
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "ba-muted", children: t("organization.create.description") })
|
|
6951
7039
|
] }),
|
|
6952
|
-
/* @__PURE__ */ (0,
|
|
6953
|
-
/* @__PURE__ */ (0,
|
|
7040
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
7041
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "ba-label", children: [
|
|
6954
7042
|
t("organization.create.name"),
|
|
6955
|
-
/* @__PURE__ */ (0,
|
|
7043
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6956
7044
|
"input",
|
|
6957
7045
|
{
|
|
6958
7046
|
className: "ba-input",
|
|
@@ -6967,9 +7055,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6967
7055
|
}
|
|
6968
7056
|
)
|
|
6969
7057
|
] }),
|
|
6970
|
-
/* @__PURE__ */ (0,
|
|
7058
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "ba-label", children: [
|
|
6971
7059
|
t("organization.create.slug"),
|
|
6972
|
-
/* @__PURE__ */ (0,
|
|
7060
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6973
7061
|
"input",
|
|
6974
7062
|
{
|
|
6975
7063
|
className: "ba-input",
|
|
@@ -6984,9 +7072,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6984
7072
|
}
|
|
6985
7073
|
)
|
|
6986
7074
|
] }),
|
|
6987
|
-
/* @__PURE__ */ (0,
|
|
7075
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "ba-label", children: [
|
|
6988
7076
|
t("organization.create.logo"),
|
|
6989
|
-
/* @__PURE__ */ (0,
|
|
7077
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6990
7078
|
"input",
|
|
6991
7079
|
{
|
|
6992
7080
|
className: "ba-input",
|
|
@@ -6998,15 +7086,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6998
7086
|
}
|
|
6999
7087
|
)
|
|
7000
7088
|
] }),
|
|
7001
|
-
/* @__PURE__ */ (0,
|
|
7002
|
-
/* @__PURE__ */ (0,
|
|
7089
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FormError, { children: error }),
|
|
7090
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
7003
7091
|
"button",
|
|
7004
7092
|
{
|
|
7005
7093
|
className: "ba-button ba-profile-submit",
|
|
7006
7094
|
type: "submit",
|
|
7007
7095
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
7008
7096
|
"aria-busy": pending || void 0,
|
|
7009
|
-
children: /* @__PURE__ */ (0,
|
|
7097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.create.submit") })
|
|
7010
7098
|
}
|
|
7011
7099
|
)
|
|
7012
7100
|
] })
|
|
@@ -7014,8 +7102,8 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
7014
7102
|
}
|
|
7015
7103
|
|
|
7016
7104
|
// src/components/organization/OrganizationModal.tsx
|
|
7017
|
-
var
|
|
7018
|
-
var
|
|
7105
|
+
var React43 = __toESM(require("react"), 1);
|
|
7106
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
7019
7107
|
function OrganizationModal({
|
|
7020
7108
|
title,
|
|
7021
7109
|
onClose,
|
|
@@ -7023,8 +7111,8 @@ function OrganizationModal({
|
|
|
7023
7111
|
children
|
|
7024
7112
|
}) {
|
|
7025
7113
|
const t = useT();
|
|
7026
|
-
const titleId =
|
|
7027
|
-
return /* @__PURE__ */ (0,
|
|
7114
|
+
const titleId = React43.useId();
|
|
7115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
7028
7116
|
ModalSurface,
|
|
7029
7117
|
{
|
|
7030
7118
|
overlayClassName: "ba-organization-overlay",
|
|
@@ -7033,9 +7121,9 @@ function OrganizationModal({
|
|
|
7033
7121
|
returnFocusRef,
|
|
7034
7122
|
onClose,
|
|
7035
7123
|
children: [
|
|
7036
|
-
/* @__PURE__ */ (0,
|
|
7037
|
-
/* @__PURE__ */ (0,
|
|
7038
|
-
/* @__PURE__ */ (0,
|
|
7124
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("header", { className: "ba-organization-modal-header", children: [
|
|
7125
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h2", { id: titleId, className: "ba-title", children: title }),
|
|
7126
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
7039
7127
|
"button",
|
|
7040
7128
|
{
|
|
7041
7129
|
className: "ba-profile-close",
|
|
@@ -7047,26 +7135,26 @@ function OrganizationModal({
|
|
|
7047
7135
|
}
|
|
7048
7136
|
)
|
|
7049
7137
|
] }),
|
|
7050
|
-
/* @__PURE__ */ (0,
|
|
7138
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "ba-organization-modal-body", children })
|
|
7051
7139
|
]
|
|
7052
7140
|
}
|
|
7053
7141
|
);
|
|
7054
7142
|
}
|
|
7055
7143
|
|
|
7056
7144
|
// src/components/organization/use-organizations-resource.ts
|
|
7057
|
-
var
|
|
7145
|
+
var React44 = __toESM(require("react"), 1);
|
|
7058
7146
|
function useOrganizationsResource(enabled = true) {
|
|
7059
7147
|
const api = useAuthClient().organization;
|
|
7060
|
-
const apiRef =
|
|
7148
|
+
const apiRef = React44.useRef(api);
|
|
7061
7149
|
apiRef.current = api;
|
|
7062
7150
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
7063
7151
|
const t = useT();
|
|
7064
7152
|
const toServerError = useServerError();
|
|
7065
|
-
const [organizations, setOrganizations] =
|
|
7066
|
-
const [error, setError] =
|
|
7067
|
-
const requestRef =
|
|
7153
|
+
const [organizations, setOrganizations] = React44.useState(null);
|
|
7154
|
+
const [error, setError] = React44.useState(null);
|
|
7155
|
+
const requestRef = React44.useRef(0);
|
|
7068
7156
|
const identity = user?.id ?? null;
|
|
7069
|
-
const refresh =
|
|
7157
|
+
const refresh = React44.useCallback(async () => {
|
|
7070
7158
|
const token = ++requestRef.current;
|
|
7071
7159
|
if (!enabled || !identity || !isSignedIn) {
|
|
7072
7160
|
setOrganizations([]);
|
|
@@ -7086,7 +7174,7 @@ function useOrganizationsResource(enabled = true) {
|
|
|
7086
7174
|
if (token === requestRef.current) setError(t("organization.error.load"));
|
|
7087
7175
|
}
|
|
7088
7176
|
}, [enabled, identity, isSignedIn, t, toServerError]);
|
|
7089
|
-
|
|
7177
|
+
React44.useEffect(() => {
|
|
7090
7178
|
setOrganizations(null);
|
|
7091
7179
|
setError(null);
|
|
7092
7180
|
if (!isLoaded) return;
|
|
@@ -7104,11 +7192,11 @@ function useOrganizationsResource(enabled = true) {
|
|
|
7104
7192
|
}
|
|
7105
7193
|
|
|
7106
7194
|
// src/components/OrganizationProfile.tsx
|
|
7107
|
-
var
|
|
7195
|
+
var React49 = __toESM(require("react"), 1);
|
|
7108
7196
|
|
|
7109
7197
|
// src/components/organization/DangerSection.tsx
|
|
7110
|
-
var
|
|
7111
|
-
var
|
|
7198
|
+
var React45 = __toESM(require("react"), 1);
|
|
7199
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
7112
7200
|
function DangerSection({
|
|
7113
7201
|
organization,
|
|
7114
7202
|
membership,
|
|
@@ -7119,7 +7207,7 @@ function DangerSection({
|
|
|
7119
7207
|
const api = useAuthClient().organization;
|
|
7120
7208
|
const session = useSession();
|
|
7121
7209
|
const { pending, error, run } = useSubmitAction();
|
|
7122
|
-
const [confirmation, setConfirmation] =
|
|
7210
|
+
const [confirmation, setConfirmation] = React45.useState("");
|
|
7123
7211
|
const isOwner = hasOrganizationRole(membership, "owner");
|
|
7124
7212
|
const confirmed = confirmation.trim().toLowerCase() === organization.slug.toLowerCase();
|
|
7125
7213
|
const leave = () => {
|
|
@@ -7149,43 +7237,43 @@ function DangerSection({
|
|
|
7149
7237
|
}
|
|
7150
7238
|
);
|
|
7151
7239
|
};
|
|
7152
|
-
return /* @__PURE__ */ (0,
|
|
7153
|
-
/* @__PURE__ */ (0,
|
|
7154
|
-
/* @__PURE__ */ (0,
|
|
7155
|
-
/* @__PURE__ */ (0,
|
|
7240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("section", { className: "ba-organization-section ba-organization-danger", children: [
|
|
7241
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
7242
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h3", { className: "ba-title", children: t("organization.profile.danger.title") }),
|
|
7243
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "ba-muted", children: t("organization.profile.danger.description") })
|
|
7156
7244
|
] }),
|
|
7157
|
-
/* @__PURE__ */ (0,
|
|
7158
|
-
/* @__PURE__ */ (0,
|
|
7159
|
-
/* @__PURE__ */ (0,
|
|
7160
|
-
/* @__PURE__ */ (0,
|
|
7245
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "ba-organization-danger-action", children: [
|
|
7246
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("strong", { children: t("organization.profile.danger.leaveTitle") }),
|
|
7247
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "ba-muted", children: isOwner ? t("organization.profile.danger.ownerLeaveHint") : t("organization.profile.danger.leaveHint") }),
|
|
7248
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: leave, children: t("organization.profile.danger.leave") })
|
|
7161
7249
|
] }),
|
|
7162
|
-
isOwner && /* @__PURE__ */ (0,
|
|
7163
|
-
/* @__PURE__ */ (0,
|
|
7164
|
-
/* @__PURE__ */ (0,
|
|
7165
|
-
/* @__PURE__ */ (0,
|
|
7250
|
+
isOwner && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("form", { method: "post", className: "ba-organization-danger-action ba-organization-delete", onSubmit: remove, children: [
|
|
7251
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("strong", { children: t("organization.profile.danger.deleteTitle") }),
|
|
7252
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "ba-muted", children: t("organization.profile.danger.deleteHint") }),
|
|
7253
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "ba-label", children: [
|
|
7166
7254
|
t("organization.profile.danger.deleteConfirm"),
|
|
7167
7255
|
" ",
|
|
7168
|
-
/* @__PURE__ */ (0,
|
|
7169
|
-
/* @__PURE__ */ (0,
|
|
7256
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Bidi, { children: organization.slug }),
|
|
7257
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("input", { className: "ba-input", dir: "ltr", value: confirmation, onChange: (event) => setConfirmation(event.target.value), autoComplete: "off", required: true })
|
|
7170
7258
|
] }),
|
|
7171
|
-
/* @__PURE__ */ (0,
|
|
7259
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
7172
7260
|
"button",
|
|
7173
7261
|
{
|
|
7174
7262
|
className: "ba-button ba-danger-button",
|
|
7175
7263
|
type: "submit",
|
|
7176
7264
|
disabled: pending || !confirmed,
|
|
7177
7265
|
"aria-busy": pending || void 0,
|
|
7178
|
-
children: /* @__PURE__ */ (0,
|
|
7266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.danger.delete") })
|
|
7179
7267
|
}
|
|
7180
7268
|
)
|
|
7181
7269
|
] }),
|
|
7182
|
-
/* @__PURE__ */ (0,
|
|
7270
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FormError, { children: error })
|
|
7183
7271
|
] });
|
|
7184
7272
|
}
|
|
7185
7273
|
|
|
7186
7274
|
// src/components/organization/GeneralSection.tsx
|
|
7187
|
-
var
|
|
7188
|
-
var
|
|
7275
|
+
var React46 = __toESM(require("react"), 1);
|
|
7276
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
7189
7277
|
function GeneralSection({
|
|
7190
7278
|
organization,
|
|
7191
7279
|
canManage,
|
|
@@ -7194,25 +7282,25 @@ function GeneralSection({
|
|
|
7194
7282
|
const t = useT();
|
|
7195
7283
|
const api = useAuthClient().organization;
|
|
7196
7284
|
const { pending, error, run } = useSubmitAction();
|
|
7197
|
-
const [name, setName] =
|
|
7198
|
-
const [slug, setSlug] =
|
|
7199
|
-
const [logo, setLogo] =
|
|
7200
|
-
|
|
7285
|
+
const [name, setName] = React46.useState(organization.name);
|
|
7286
|
+
const [slug, setSlug] = React46.useState(organization.slug);
|
|
7287
|
+
const [logo, setLogo] = React46.useState(organization.logo ?? "");
|
|
7288
|
+
React46.useEffect(() => {
|
|
7201
7289
|
setName(organization.name);
|
|
7202
7290
|
setSlug(organization.slug);
|
|
7203
7291
|
setLogo(organization.logo ?? "");
|
|
7204
7292
|
}, [organization.id, organization.logo, organization.name, organization.slug]);
|
|
7205
7293
|
if (!canManage) {
|
|
7206
|
-
return /* @__PURE__ */ (0,
|
|
7207
|
-
/* @__PURE__ */ (0,
|
|
7208
|
-
/* @__PURE__ */ (0,
|
|
7209
|
-
/* @__PURE__ */ (0,
|
|
7210
|
-
/* @__PURE__ */ (0,
|
|
7211
|
-
/* @__PURE__ */ (0,
|
|
7294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("section", { className: "ba-organization-section", children: [
|
|
7295
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "ba-muted", children: t("organization.profile.general.readOnly") }),
|
|
7296
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("dl", { className: "ba-organization-facts", children: [
|
|
7297
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { children: [
|
|
7298
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("dt", { children: t("organization.create.name") }),
|
|
7299
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("dd", { children: organization.name })
|
|
7212
7300
|
] }),
|
|
7213
|
-
/* @__PURE__ */ (0,
|
|
7214
|
-
/* @__PURE__ */ (0,
|
|
7215
|
-
/* @__PURE__ */ (0,
|
|
7301
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { children: [
|
|
7302
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("dt", { children: t("organization.create.slug") }),
|
|
7303
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Bidi, { children: organization.slug }) })
|
|
7216
7304
|
] })
|
|
7217
7305
|
] })
|
|
7218
7306
|
] });
|
|
@@ -7230,19 +7318,19 @@ function GeneralSection({
|
|
|
7230
7318
|
}
|
|
7231
7319
|
);
|
|
7232
7320
|
};
|
|
7233
|
-
return /* @__PURE__ */ (0,
|
|
7234
|
-
/* @__PURE__ */ (0,
|
|
7235
|
-
/* @__PURE__ */ (0,
|
|
7236
|
-
/* @__PURE__ */ (0,
|
|
7321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("section", { className: "ba-organization-section", children: [
|
|
7322
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
7323
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h3", { className: "ba-title", children: t("organization.profile.general.title") }),
|
|
7324
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "ba-muted", children: t("organization.profile.general.description") })
|
|
7237
7325
|
] }),
|
|
7238
|
-
/* @__PURE__ */ (0,
|
|
7239
|
-
/* @__PURE__ */ (0,
|
|
7326
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
7327
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "ba-label", children: [
|
|
7240
7328
|
t("organization.create.name"),
|
|
7241
|
-
/* @__PURE__ */ (0,
|
|
7329
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
|
|
7242
7330
|
] }),
|
|
7243
|
-
/* @__PURE__ */ (0,
|
|
7331
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "ba-label", children: [
|
|
7244
7332
|
t("organization.create.slug"),
|
|
7245
|
-
/* @__PURE__ */ (0,
|
|
7333
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
7246
7334
|
"input",
|
|
7247
7335
|
{
|
|
7248
7336
|
className: "ba-input",
|
|
@@ -7254,19 +7342,19 @@ function GeneralSection({
|
|
|
7254
7342
|
}
|
|
7255
7343
|
)
|
|
7256
7344
|
] }),
|
|
7257
|
-
/* @__PURE__ */ (0,
|
|
7345
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "ba-label", children: [
|
|
7258
7346
|
t("organization.create.logo"),
|
|
7259
|
-
/* @__PURE__ */ (0,
|
|
7347
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("input", { className: "ba-input", type: "url", dir: "ltr", value: logo, onChange: (event) => setLogo(event.target.value), placeholder: "https://" })
|
|
7260
7348
|
] }),
|
|
7261
|
-
/* @__PURE__ */ (0,
|
|
7262
|
-
/* @__PURE__ */ (0,
|
|
7349
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FormError, { children: error }),
|
|
7350
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
7263
7351
|
"button",
|
|
7264
7352
|
{
|
|
7265
7353
|
className: "ba-button ba-profile-submit",
|
|
7266
7354
|
type: "submit",
|
|
7267
7355
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
7268
7356
|
"aria-busy": pending || void 0,
|
|
7269
|
-
children: /* @__PURE__ */ (0,
|
|
7357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.general.save") })
|
|
7270
7358
|
}
|
|
7271
7359
|
)
|
|
7272
7360
|
] })
|
|
@@ -7274,7 +7362,7 @@ function GeneralSection({
|
|
|
7274
7362
|
}
|
|
7275
7363
|
|
|
7276
7364
|
// src/components/organization/InvitationsSection.tsx
|
|
7277
|
-
var
|
|
7365
|
+
var React48 = __toESM(require("react"), 1);
|
|
7278
7366
|
|
|
7279
7367
|
// src/components/organization/role-label.ts
|
|
7280
7368
|
function organizationRoleLabel(role, t) {
|
|
@@ -7286,15 +7374,15 @@ function organizationRoleLabel(role, t) {
|
|
|
7286
7374
|
}
|
|
7287
7375
|
|
|
7288
7376
|
// src/components/organization/use-organization-roles.ts
|
|
7289
|
-
var
|
|
7377
|
+
var React47 = __toESM(require("react"), 1);
|
|
7290
7378
|
var BUILTIN_ROLES = ["owner", "admin", "member"];
|
|
7291
7379
|
function useOrganizationRoles(organizationId) {
|
|
7292
7380
|
const api = useAuthClient().organization;
|
|
7293
|
-
const apiRef =
|
|
7381
|
+
const apiRef = React47.useRef(api);
|
|
7294
7382
|
apiRef.current = api;
|
|
7295
|
-
const [dynamic, setDynamic] =
|
|
7296
|
-
const requestRef =
|
|
7297
|
-
|
|
7383
|
+
const [dynamic, setDynamic] = React47.useState([]);
|
|
7384
|
+
const requestRef = React47.useRef(0);
|
|
7385
|
+
React47.useEffect(() => {
|
|
7298
7386
|
const token = ++requestRef.current;
|
|
7299
7387
|
setDynamic([]);
|
|
7300
7388
|
if (!organizationId) return;
|
|
@@ -7310,7 +7398,7 @@ function useOrganizationRoles(organizationId) {
|
|
|
7310
7398
|
requestRef.current += 1;
|
|
7311
7399
|
};
|
|
7312
7400
|
}, [organizationId]);
|
|
7313
|
-
const roles =
|
|
7401
|
+
const roles = React47.useMemo(() => {
|
|
7314
7402
|
const seen = /* @__PURE__ */ new Set();
|
|
7315
7403
|
const out = [];
|
|
7316
7404
|
for (const candidate of [...BUILTIN_ROLES, ...dynamic]) {
|
|
@@ -7325,7 +7413,7 @@ function useOrganizationRoles(organizationId) {
|
|
|
7325
7413
|
}
|
|
7326
7414
|
|
|
7327
7415
|
// src/components/organization/InvitationsSection.tsx
|
|
7328
|
-
var
|
|
7416
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
7329
7417
|
function InvitationsSection({
|
|
7330
7418
|
organization,
|
|
7331
7419
|
onChanged
|
|
@@ -7334,8 +7422,8 @@ function InvitationsSection({
|
|
|
7334
7422
|
const api = useAuthClient().organization;
|
|
7335
7423
|
const { pending, error, run } = useSubmitAction();
|
|
7336
7424
|
const { roles } = useOrganizationRoles(organization.id);
|
|
7337
|
-
const [email, setEmail] =
|
|
7338
|
-
const [role, setRole] =
|
|
7425
|
+
const [email, setEmail] = React48.useState("");
|
|
7426
|
+
const [role, setRole] = React48.useState("member");
|
|
7339
7427
|
const invitations = organization.invitations.filter((invitation) => invitation.status === "pending");
|
|
7340
7428
|
const invite = (event) => {
|
|
7341
7429
|
event.preventDefault();
|
|
@@ -7357,44 +7445,44 @@ function InvitationsSection({
|
|
|
7357
7445
|
{ failure: t("organization.profile.invitations.cancelError"), onSuccess: onChanged }
|
|
7358
7446
|
);
|
|
7359
7447
|
};
|
|
7360
|
-
return /* @__PURE__ */ (0,
|
|
7361
|
-
/* @__PURE__ */ (0,
|
|
7362
|
-
/* @__PURE__ */ (0,
|
|
7363
|
-
/* @__PURE__ */ (0,
|
|
7448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("section", { className: "ba-organization-section", children: [
|
|
7449
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
7450
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h3", { className: "ba-title", children: t("organization.profile.invitations.title") }),
|
|
7451
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "ba-muted", children: t("organization.profile.invitations.description") })
|
|
7364
7452
|
] }),
|
|
7365
|
-
/* @__PURE__ */ (0,
|
|
7366
|
-
/* @__PURE__ */ (0,
|
|
7453
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: invite, children: [
|
|
7454
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "ba-label", children: [
|
|
7367
7455
|
t("organization.profile.invitations.email"),
|
|
7368
|
-
/* @__PURE__ */ (0,
|
|
7456
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("input", { className: "ba-input", type: "email", dir: "ltr", value: email, onChange: (event) => setEmail(event.target.value), required: true })
|
|
7369
7457
|
] }),
|
|
7370
|
-
/* @__PURE__ */ (0,
|
|
7458
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "ba-label", children: [
|
|
7371
7459
|
t("organization.profile.members.role"),
|
|
7372
|
-
/* @__PURE__ */ (0,
|
|
7460
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("select", { className: "ba-input", value: role, onChange: (event) => setRole(event.target.value), children: roles.map((option) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: option, children: organizationRoleLabel(option, t) }, option)) })
|
|
7373
7461
|
] }),
|
|
7374
|
-
/* @__PURE__ */ (0,
|
|
7462
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7375
7463
|
"button",
|
|
7376
7464
|
{
|
|
7377
7465
|
className: "ba-button",
|
|
7378
7466
|
type: "submit",
|
|
7379
7467
|
disabled: pending || !email.trim(),
|
|
7380
7468
|
"aria-busy": pending || void 0,
|
|
7381
|
-
children: /* @__PURE__ */ (0,
|
|
7469
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.invitations.invite") })
|
|
7382
7470
|
}
|
|
7383
7471
|
)
|
|
7384
7472
|
] }),
|
|
7385
|
-
/* @__PURE__ */ (0,
|
|
7386
|
-
invitations.length === 0 ? /* @__PURE__ */ (0,
|
|
7387
|
-
/* @__PURE__ */ (0,
|
|
7388
|
-
/* @__PURE__ */ (0,
|
|
7389
|
-
/* @__PURE__ */ (0,
|
|
7473
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FormError, { children: error }),
|
|
7474
|
+
invitations.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "ba-muted", children: t("organization.profile.invitations.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("li", { className: "ba-organization-invitation", children: [
|
|
7475
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { children: [
|
|
7476
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Bidi, { children: invitation.email }) }),
|
|
7477
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
7390
7478
|
] }),
|
|
7391
|
-
/* @__PURE__ */ (0,
|
|
7479
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => cancel(invitation), children: t("organization.profile.invitations.cancel") })
|
|
7392
7480
|
] }, invitation.id)) })
|
|
7393
7481
|
] });
|
|
7394
7482
|
}
|
|
7395
7483
|
|
|
7396
7484
|
// src/components/organization/MembersSection.tsx
|
|
7397
|
-
var
|
|
7485
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
7398
7486
|
function MembersSection({
|
|
7399
7487
|
organization,
|
|
7400
7488
|
userId,
|
|
@@ -7421,27 +7509,27 @@ function MembersSection({
|
|
|
7421
7509
|
{ failure: t("organization.profile.members.removeError"), onSuccess: onChanged }
|
|
7422
7510
|
);
|
|
7423
7511
|
};
|
|
7424
|
-
return /* @__PURE__ */ (0,
|
|
7425
|
-
/* @__PURE__ */ (0,
|
|
7426
|
-
/* @__PURE__ */ (0,
|
|
7427
|
-
/* @__PURE__ */ (0,
|
|
7512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("section", { className: "ba-organization-section", children: [
|
|
7513
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
7514
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { className: "ba-title", children: t("organization.profile.members.title") }),
|
|
7515
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "ba-muted", children: t("organization.profile.members.description") })
|
|
7428
7516
|
] }),
|
|
7429
|
-
/* @__PURE__ */ (0,
|
|
7430
|
-
/* @__PURE__ */ (0,
|
|
7517
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FormError, { children: error }),
|
|
7518
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className: "ba-organization-list", children: organization.members.map((member) => {
|
|
7431
7519
|
const primaryRole = organizationRoles(member.role)[0] ?? member.role;
|
|
7432
7520
|
const isCurrent = member.userId === userId;
|
|
7433
|
-
return /* @__PURE__ */ (0,
|
|
7434
|
-
/* @__PURE__ */ (0,
|
|
7435
|
-
/* @__PURE__ */ (0,
|
|
7436
|
-
/* @__PURE__ */ (0,
|
|
7521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("li", { className: "ba-organization-member", children: [
|
|
7522
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: member.user.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7523
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "ba-organization-member-copy", children: [
|
|
7524
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("strong", { children: [
|
|
7437
7525
|
member.user.name,
|
|
7438
7526
|
isCurrent ? ` ${t("organization.profile.members.you")}` : ""
|
|
7439
7527
|
] }),
|
|
7440
|
-
/* @__PURE__ */ (0,
|
|
7528
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Bidi, { children: member.user.email }) })
|
|
7441
7529
|
] }),
|
|
7442
|
-
canManage && !isCurrent ? /* @__PURE__ */ (0,
|
|
7443
|
-
/* @__PURE__ */ (0,
|
|
7444
|
-
/* @__PURE__ */ (0,
|
|
7530
|
+
canManage && !isCurrent ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "ba-organization-member-actions", children: [
|
|
7531
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { className: "ba-sr-only", htmlFor: `organization-role-${member.id}`, children: t("organization.profile.members.role") }),
|
|
7532
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
7445
7533
|
"select",
|
|
7446
7534
|
{
|
|
7447
7535
|
id: `organization-role-${member.id}`,
|
|
@@ -7449,18 +7537,18 @@ function MembersSection({
|
|
|
7449
7537
|
value: primaryRole,
|
|
7450
7538
|
disabled: pending,
|
|
7451
7539
|
onChange: (event) => updateRole(member, event.target.value),
|
|
7452
|
-
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */ (0,
|
|
7540
|
+
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: role, children: organizationRoleLabel(role, t) }, role))
|
|
7453
7541
|
}
|
|
7454
7542
|
),
|
|
7455
|
-
/* @__PURE__ */ (0,
|
|
7456
|
-
] }) : /* @__PURE__ */ (0,
|
|
7543
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(member), children: t("organization.profile.members.remove") })
|
|
7544
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ba-organization-role-label", children: organizationRoleLabel(primaryRole, t) })
|
|
7457
7545
|
] }, member.id);
|
|
7458
7546
|
}) })
|
|
7459
7547
|
] });
|
|
7460
7548
|
}
|
|
7461
7549
|
|
|
7462
7550
|
// src/components/OrganizationProfile.tsx
|
|
7463
|
-
var
|
|
7551
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
7464
7552
|
var SECTION_KEYS2 = {
|
|
7465
7553
|
general: "organization.profile.nav.general",
|
|
7466
7554
|
members: "organization.profile.nav.members",
|
|
@@ -7474,17 +7562,17 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7474
7562
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
7475
7563
|
const session = useSession();
|
|
7476
7564
|
const api = useAuthClient().organization;
|
|
7477
|
-
const apiRef =
|
|
7565
|
+
const apiRef = React49.useRef(api);
|
|
7478
7566
|
apiRef.current = api;
|
|
7479
7567
|
const activeOrganizationId = session.data?.session.activeOrganizationId ?? null;
|
|
7480
7568
|
const requestedId = organizationId ?? activeOrganizationId;
|
|
7481
7569
|
const enabled = config?.organizations === true && isSignedIn;
|
|
7482
|
-
const [organization, setOrganization] =
|
|
7483
|
-
const [error, setError] =
|
|
7484
|
-
const [wasRemoved, setWasRemoved] =
|
|
7485
|
-
const [section, setSection] =
|
|
7486
|
-
const requestRef =
|
|
7487
|
-
const load =
|
|
7570
|
+
const [organization, setOrganization] = React49.useState(null);
|
|
7571
|
+
const [error, setError] = React49.useState(null);
|
|
7572
|
+
const [wasRemoved, setWasRemoved] = React49.useState(false);
|
|
7573
|
+
const [section, setSection] = React49.useState(defaultSection);
|
|
7574
|
+
const requestRef = React49.useRef(0);
|
|
7575
|
+
const load = React49.useCallback(async () => {
|
|
7488
7576
|
const token = ++requestRef.current;
|
|
7489
7577
|
if (!enabled || !requestedId) {
|
|
7490
7578
|
setOrganization(null);
|
|
@@ -7504,7 +7592,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7504
7592
|
if (token === requestRef.current) setError(t("organization.profile.loadError"));
|
|
7505
7593
|
}
|
|
7506
7594
|
}, [enabled, requestedId, t, toServerError]);
|
|
7507
|
-
|
|
7595
|
+
React49.useEffect(() => {
|
|
7508
7596
|
setOrganization(null);
|
|
7509
7597
|
setError(null);
|
|
7510
7598
|
setWasRemoved(false);
|
|
@@ -7513,20 +7601,20 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7513
7601
|
requestRef.current += 1;
|
|
7514
7602
|
};
|
|
7515
7603
|
}, [load]);
|
|
7516
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */ (0,
|
|
7604
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
7517
7605
|
if (config?.organizations !== true) return null;
|
|
7518
|
-
if (!isSignedIn || !user) return /* @__PURE__ */ (0,
|
|
7519
|
-
if (wasRemoved) return /* @__PURE__ */ (0,
|
|
7520
|
-
if (!requestedId) return /* @__PURE__ */ (0,
|
|
7606
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
7607
|
+
if (wasRemoved) return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
7608
|
+
if (!requestedId) return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
7521
7609
|
if (error) {
|
|
7522
|
-
return /* @__PURE__ */ (0,
|
|
7523
|
-
/* @__PURE__ */ (0,
|
|
7524
|
-
/* @__PURE__ */ (0,
|
|
7610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "ba-inline-error", children: [
|
|
7611
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(FormError, { children: error }),
|
|
7612
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
|
|
7525
7613
|
] });
|
|
7526
7614
|
}
|
|
7527
|
-
if (!organization) return /* @__PURE__ */ (0,
|
|
7615
|
+
if (!organization) return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
7528
7616
|
const membership = organization.members.find((member) => member.userId === user.id);
|
|
7529
|
-
if (!membership) return /* @__PURE__ */ (0,
|
|
7617
|
+
if (!membership) return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "ba-muted", children: t("organization.profile.notMember") });
|
|
7530
7618
|
const canManage = canManageOrganization(membership);
|
|
7531
7619
|
const visibleSections = canManage ? ["general", "members", "invitations", "danger"] : ["general", "members", "danger"];
|
|
7532
7620
|
const activeSection = visibleSections.includes(section) ? section : "general";
|
|
@@ -7535,16 +7623,16 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7535
7623
|
setOrganization(null);
|
|
7536
7624
|
callback?.(removedOrganization);
|
|
7537
7625
|
};
|
|
7538
|
-
return /* @__PURE__ */ (0,
|
|
7539
|
-
/* @__PURE__ */ (0,
|
|
7540
|
-
/* @__PURE__ */ (0,
|
|
7541
|
-
/* @__PURE__ */ (0,
|
|
7542
|
-
/* @__PURE__ */ (0,
|
|
7543
|
-
/* @__PURE__ */ (0,
|
|
7626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("article", { className: "ba-organization-profile", children: [
|
|
7627
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("header", { className: "ba-organization-profile-heading", children: [
|
|
7628
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7629
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { children: [
|
|
7630
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h2", { className: "ba-title", children: organization.name }),
|
|
7631
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "ba-muted", children: organization.slug })
|
|
7544
7632
|
] })
|
|
7545
7633
|
] }),
|
|
7546
|
-
/* @__PURE__ */ (0,
|
|
7547
|
-
/* @__PURE__ */ (0,
|
|
7634
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "ba-organization-profile-layout", children: [
|
|
7635
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7548
7636
|
"button",
|
|
7549
7637
|
{
|
|
7550
7638
|
className: "ba-profile-nav-item",
|
|
@@ -7555,11 +7643,11 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7555
7643
|
},
|
|
7556
7644
|
item
|
|
7557
7645
|
)) }),
|
|
7558
|
-
/* @__PURE__ */ (0,
|
|
7559
|
-
activeSection === "general" && /* @__PURE__ */ (0,
|
|
7560
|
-
activeSection === "members" && /* @__PURE__ */ (0,
|
|
7561
|
-
activeSection === "invitations" && /* @__PURE__ */ (0,
|
|
7562
|
-
activeSection === "danger" && /* @__PURE__ */ (0,
|
|
7646
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "ba-organization-profile-content", children: [
|
|
7647
|
+
activeSection === "general" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(GeneralSection, { organization, canManage, onChanged: load }),
|
|
7648
|
+
activeSection === "members" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
|
|
7649
|
+
activeSection === "invitations" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(InvitationsSection, { organization, onChanged: load }),
|
|
7650
|
+
activeSection === "danger" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7563
7651
|
DangerSection,
|
|
7564
7652
|
{
|
|
7565
7653
|
organization,
|
|
@@ -7574,7 +7662,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7574
7662
|
}
|
|
7575
7663
|
|
|
7576
7664
|
// src/components/OrganizationSwitcher.tsx
|
|
7577
|
-
var
|
|
7665
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
7578
7666
|
function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChange } = {}) {
|
|
7579
7667
|
const t = useT();
|
|
7580
7668
|
const { config, isLoading: configLoading } = usePublicConfig();
|
|
@@ -7584,15 +7672,15 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7584
7672
|
const enabled = config?.organizations === true && isSignedIn;
|
|
7585
7673
|
const { organizations, isLoading, error: loadError, refresh } = useOrganizationsResource(enabled);
|
|
7586
7674
|
const { pending, error, run } = useSubmitAction();
|
|
7587
|
-
const [open, setOpen] =
|
|
7588
|
-
const [dialog, setDialog] =
|
|
7589
|
-
const rootRef =
|
|
7590
|
-
const triggerRef =
|
|
7591
|
-
const menuRef =
|
|
7592
|
-
const menuId =
|
|
7675
|
+
const [open, setOpen] = React50.useState(false);
|
|
7676
|
+
const [dialog, setDialog] = React50.useState(null);
|
|
7677
|
+
const rootRef = React50.useRef(null);
|
|
7678
|
+
const triggerRef = React50.useRef(null);
|
|
7679
|
+
const menuRef = React50.useRef(null);
|
|
7680
|
+
const menuId = React50.useId();
|
|
7593
7681
|
const activeId = session.data?.session.activeOrganizationId ?? null;
|
|
7594
7682
|
const active = organizations?.find((organization) => organization.id === activeId) ?? null;
|
|
7595
|
-
|
|
7683
|
+
React50.useEffect(() => {
|
|
7596
7684
|
if (!open) return;
|
|
7597
7685
|
const onPointerDown = (event) => {
|
|
7598
7686
|
if (!rootRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -7607,9 +7695,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7607
7695
|
document.removeEventListener("keydown", onKeyDown);
|
|
7608
7696
|
};
|
|
7609
7697
|
}, [open]);
|
|
7610
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */ (0,
|
|
7698
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
|
|
7611
7699
|
if (config?.organizations !== true) return null;
|
|
7612
|
-
if (!isSignedIn) return /* @__PURE__ */ (0,
|
|
7700
|
+
if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
7613
7701
|
const select = (organization) => {
|
|
7614
7702
|
void run(
|
|
7615
7703
|
() => api.setActive({ organizationId: organization?.id ?? null }),
|
|
@@ -7652,9 +7740,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7652
7740
|
else if (event.key === "ArrowDown") items[(current + 1 + items.length) % items.length]?.focus();
|
|
7653
7741
|
else items[(current - 1 + items.length) % items.length]?.focus();
|
|
7654
7742
|
};
|
|
7655
|
-
return /* @__PURE__ */ (0,
|
|
7656
|
-
/* @__PURE__ */ (0,
|
|
7657
|
-
/* @__PURE__ */ (0,
|
|
7743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
7744
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { ref: rootRef, className: "ba-organization-switcher", children: [
|
|
7745
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
7658
7746
|
"button",
|
|
7659
7747
|
{
|
|
7660
7748
|
ref: triggerRef,
|
|
@@ -7671,43 +7759,43 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7671
7759
|
focusMenuItem(event.key === "ArrowDown" ? "first" : "last");
|
|
7672
7760
|
},
|
|
7673
7761
|
children: [
|
|
7674
|
-
/* @__PURE__ */ (0,
|
|
7675
|
-
/* @__PURE__ */ (0,
|
|
7676
|
-
/* @__PURE__ */ (0,
|
|
7762
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
|
|
7763
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: active?.name ?? t("organization.personal") }),
|
|
7764
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { "aria-hidden": "true", children: "\u2304" })
|
|
7677
7765
|
]
|
|
7678
7766
|
}
|
|
7679
7767
|
),
|
|
7680
|
-
open && /* @__PURE__ */ (0,
|
|
7681
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
7682
|
-
showPersonalWorkspace && /* @__PURE__ */ (0,
|
|
7683
|
-
/* @__PURE__ */ (0,
|
|
7684
|
-
/* @__PURE__ */ (0,
|
|
7768
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
|
|
7769
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ba-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
7770
|
+
showPersonalWorkspace && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === null ? "true" : void 0, disabled: pending, onClick: () => select(null), children: [
|
|
7771
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
|
|
7772
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: t("organization.personal") })
|
|
7685
7773
|
] }),
|
|
7686
|
-
organizations?.map((organization) => /* @__PURE__ */ (0,
|
|
7687
|
-
/* @__PURE__ */ (0,
|
|
7688
|
-
/* @__PURE__ */ (0,
|
|
7774
|
+
organizations?.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === organization.id ? "true" : void 0, disabled: pending, onClick: () => select(organization), children: [
|
|
7775
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7776
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { children: [
|
|
7689
7777
|
organization.name,
|
|
7690
|
-
/* @__PURE__ */ (0,
|
|
7778
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("small", { children: organization.slug })
|
|
7691
7779
|
] })
|
|
7692
7780
|
] }, organization.id))
|
|
7693
7781
|
] }),
|
|
7694
|
-
(loadError || error) && /* @__PURE__ */ (0,
|
|
7695
|
-
/* @__PURE__ */ (0,
|
|
7696
|
-
loadError && /* @__PURE__ */ (0,
|
|
7782
|
+
(loadError || error) && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ba-inline-error", children: [
|
|
7783
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(FormError, { children: loadError ?? error }),
|
|
7784
|
+
loadError && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
7697
7785
|
] }),
|
|
7698
|
-
/* @__PURE__ */ (0,
|
|
7699
|
-
active && /* @__PURE__ */ (0,
|
|
7786
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ba-organization-menu-actions", children: [
|
|
7787
|
+
active && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
7700
7788
|
setOpen(false);
|
|
7701
7789
|
setDialog("profile");
|
|
7702
7790
|
}, children: t("organization.switcher.manage") }),
|
|
7703
|
-
/* @__PURE__ */ (0,
|
|
7791
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
7704
7792
|
setOpen(false);
|
|
7705
7793
|
setDialog("create");
|
|
7706
7794
|
}, children: t("organization.switcher.create") })
|
|
7707
7795
|
] })
|
|
7708
7796
|
] })
|
|
7709
7797
|
] }),
|
|
7710
|
-
dialog === "create" && /* @__PURE__ */ (0,
|
|
7798
|
+
dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7711
7799
|
CreateOrganization,
|
|
7712
7800
|
{
|
|
7713
7801
|
title: null,
|
|
@@ -7721,13 +7809,13 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7721
7809
|
}
|
|
7722
7810
|
}
|
|
7723
7811
|
) }),
|
|
7724
|
-
dialog === "profile" && active && /* @__PURE__ */ (0,
|
|
7812
|
+
dialog === "profile" && active && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(OrganizationProfile, { organizationId: active.id, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
7725
7813
|
] });
|
|
7726
7814
|
}
|
|
7727
7815
|
|
|
7728
7816
|
// src/components/OrganizationList.tsx
|
|
7729
|
-
var
|
|
7730
|
-
var
|
|
7817
|
+
var React51 = __toESM(require("react"), 1);
|
|
7818
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7731
7819
|
function OrganizationList({ onOrganizationChange } = {}) {
|
|
7732
7820
|
const t = useT();
|
|
7733
7821
|
const toServerError = useServerError();
|
|
@@ -7735,19 +7823,19 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7735
7823
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
7736
7824
|
const session = useSession();
|
|
7737
7825
|
const api = useAuthClient().organization;
|
|
7738
|
-
const apiRef =
|
|
7826
|
+
const apiRef = React51.useRef(api);
|
|
7739
7827
|
apiRef.current = api;
|
|
7740
7828
|
const enabled = config?.organizations === true && isSignedIn;
|
|
7741
7829
|
const { organizations, isLoading, error: organizationError, refresh } = useOrganizationsResource(enabled);
|
|
7742
7830
|
const { pending, error, run } = useSubmitAction();
|
|
7743
|
-
const [invitations, setInvitations] =
|
|
7744
|
-
const [invitationError, setInvitationError] =
|
|
7745
|
-
const [dialog, setDialog] =
|
|
7746
|
-
const [profileId, setProfileId] =
|
|
7747
|
-
const dialogReturnFocusRef =
|
|
7748
|
-
const invitationRequestRef =
|
|
7831
|
+
const [invitations, setInvitations] = React51.useState(null);
|
|
7832
|
+
const [invitationError, setInvitationError] = React51.useState(null);
|
|
7833
|
+
const [dialog, setDialog] = React51.useState(null);
|
|
7834
|
+
const [profileId, setProfileId] = React51.useState(null);
|
|
7835
|
+
const dialogReturnFocusRef = React51.useRef(null);
|
|
7836
|
+
const invitationRequestRef = React51.useRef(0);
|
|
7749
7837
|
const activeId = session.data?.session.activeOrganizationId ?? null;
|
|
7750
|
-
const loadInvitations =
|
|
7838
|
+
const loadInvitations = React51.useCallback(async () => {
|
|
7751
7839
|
const token = ++invitationRequestRef.current;
|
|
7752
7840
|
if (!enabled) {
|
|
7753
7841
|
setInvitations([]);
|
|
@@ -7767,7 +7855,7 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7767
7855
|
if (token === invitationRequestRef.current) setInvitationError(t("organization.list.invitationsError"));
|
|
7768
7856
|
}
|
|
7769
7857
|
}, [enabled, t, toServerError]);
|
|
7770
|
-
|
|
7858
|
+
React51.useEffect(() => {
|
|
7771
7859
|
setInvitations(null);
|
|
7772
7860
|
setInvitationError(null);
|
|
7773
7861
|
if (!isLoaded) return;
|
|
@@ -7776,9 +7864,9 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7776
7864
|
invitationRequestRef.current += 1;
|
|
7777
7865
|
};
|
|
7778
7866
|
}, [isLoaded, loadInvitations, user?.id]);
|
|
7779
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */ (0,
|
|
7867
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
7780
7868
|
if (config?.organizations !== true) return null;
|
|
7781
|
-
if (!isSignedIn) return /* @__PURE__ */ (0,
|
|
7869
|
+
if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
7782
7870
|
const setActive = (organization) => {
|
|
7783
7871
|
void run(
|
|
7784
7872
|
() => api.setActive({ organizationId: organization.id }),
|
|
@@ -7819,71 +7907,71 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7819
7907
|
setDialog(null);
|
|
7820
7908
|
setProfileId(null);
|
|
7821
7909
|
};
|
|
7822
|
-
return /* @__PURE__ */ (0,
|
|
7823
|
-
/* @__PURE__ */ (0,
|
|
7824
|
-
/* @__PURE__ */ (0,
|
|
7825
|
-
/* @__PURE__ */ (0,
|
|
7826
|
-
/* @__PURE__ */ (0,
|
|
7827
|
-
/* @__PURE__ */ (0,
|
|
7910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
7911
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("section", { className: "ba-organization-directory", children: [
|
|
7912
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("header", { className: "ba-organization-directory-header", children: [
|
|
7913
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { children: [
|
|
7914
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("h2", { className: "ba-title", children: t("organization.list.title") }),
|
|
7915
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "ba-muted", children: t("organization.list.description") })
|
|
7828
7916
|
] }),
|
|
7829
|
-
/* @__PURE__ */ (0,
|
|
7917
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { className: "ba-button", type: "button", onClick: (event) => {
|
|
7830
7918
|
dialogReturnFocusRef.current = event.currentTarget;
|
|
7831
7919
|
setDialog("create");
|
|
7832
7920
|
}, children: t("organization.switcher.create") })
|
|
7833
7921
|
] }),
|
|
7834
|
-
(organizationError || error) && /* @__PURE__ */ (0,
|
|
7835
|
-
/* @__PURE__ */ (0,
|
|
7836
|
-
organizationError && /* @__PURE__ */ (0,
|
|
7922
|
+
(organizationError || error) && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ba-inline-error", children: [
|
|
7923
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FormError, { children: organizationError ?? error }),
|
|
7924
|
+
organizationError && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
7837
7925
|
] }),
|
|
7838
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
7839
|
-
/* @__PURE__ */ (0,
|
|
7840
|
-
/* @__PURE__ */ (0,
|
|
7841
|
-
] }) : organizations?.length ? /* @__PURE__ */ (0,
|
|
7842
|
-
/* @__PURE__ */ (0,
|
|
7843
|
-
/* @__PURE__ */ (0,
|
|
7844
|
-
/* @__PURE__ */ (0,
|
|
7845
|
-
/* @__PURE__ */ (0,
|
|
7926
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ba-organization-card-grid", children: [
|
|
7927
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ba-skeleton" }),
|
|
7928
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ba-skeleton" })
|
|
7929
|
+
] }) : organizations?.length ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("li", { className: "ba-organization-card", children: [
|
|
7930
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7931
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "ba-organization-card-copy", children: [
|
|
7932
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("strong", { children: organization.name }),
|
|
7933
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Bidi, { children: organization.slug }) })
|
|
7846
7934
|
] }),
|
|
7847
|
-
activeId === organization.id && /* @__PURE__ */ (0,
|
|
7848
|
-
/* @__PURE__ */ (0,
|
|
7849
|
-
activeId !== organization.id && /* @__PURE__ */ (0,
|
|
7850
|
-
/* @__PURE__ */ (0,
|
|
7935
|
+
activeId === organization.id && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ba-organization-active", children: t("organization.list.active") }),
|
|
7936
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "ba-organization-card-actions", children: [
|
|
7937
|
+
activeId !== organization.id && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
|
|
7938
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
|
|
7851
7939
|
] })
|
|
7852
|
-
] }, organization.id)) }) : /* @__PURE__ */ (0,
|
|
7853
|
-
/* @__PURE__ */ (0,
|
|
7854
|
-
/* @__PURE__ */ (0,
|
|
7855
|
-
/* @__PURE__ */ (0,
|
|
7856
|
-
/* @__PURE__ */ (0,
|
|
7940
|
+
] }, organization.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "ba-muted", children: t("organization.list.empty") }),
|
|
7941
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("section", { className: "ba-organization-user-invitations", children: [
|
|
7942
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
7943
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
|
|
7944
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
|
|
7857
7945
|
] }),
|
|
7858
|
-
invitationError && /* @__PURE__ */ (0,
|
|
7859
|
-
/* @__PURE__ */ (0,
|
|
7860
|
-
/* @__PURE__ */ (0,
|
|
7946
|
+
invitationError && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ba-inline-error", children: [
|
|
7947
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FormError, { children: invitationError }),
|
|
7948
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
|
|
7861
7949
|
] }),
|
|
7862
|
-
invitations === null && !invitationError ? /* @__PURE__ */ (0,
|
|
7863
|
-
/* @__PURE__ */ (0,
|
|
7864
|
-
/* @__PURE__ */ (0,
|
|
7865
|
-
/* @__PURE__ */ (0,
|
|
7950
|
+
invitations === null && !invitationError ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ba-skeleton" }) : invitations?.length ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("li", { className: "ba-organization-invitation", children: [
|
|
7951
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { children: [
|
|
7952
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("strong", { children: invitation.organizationName }),
|
|
7953
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
7866
7954
|
] }),
|
|
7867
|
-
/* @__PURE__ */ (0,
|
|
7868
|
-
/* @__PURE__ */ (0,
|
|
7869
|
-
/* @__PURE__ */ (0,
|
|
7955
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "ba-organization-card-actions", children: [
|
|
7956
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
|
|
7957
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
|
|
7870
7958
|
] })
|
|
7871
|
-
] }, invitation.id)) }) : /* @__PURE__ */ (0,
|
|
7959
|
+
] }, invitation.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
|
|
7872
7960
|
] })
|
|
7873
7961
|
] }),
|
|
7874
|
-
dialog === "create" && /* @__PURE__ */ (0,
|
|
7962
|
+
dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CreateOrganization, { title: null, onCreated: () => {
|
|
7875
7963
|
void (async () => {
|
|
7876
7964
|
await refresh();
|
|
7877
7965
|
await session.refetch({ query: { disableCookieCache: true } });
|
|
7878
7966
|
setDialog(null);
|
|
7879
7967
|
})();
|
|
7880
7968
|
} }) }),
|
|
7881
|
-
dialog === "profile" && profileId && /* @__PURE__ */ (0,
|
|
7969
|
+
dialog === "profile" && profileId && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(OrganizationProfile, { organizationId: profileId, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
7882
7970
|
] });
|
|
7883
7971
|
}
|
|
7884
7972
|
|
|
7885
7973
|
// src/components/GoogleOneTap.tsx
|
|
7886
|
-
var
|
|
7974
|
+
var React52 = __toESM(require("react"), 1);
|
|
7887
7975
|
|
|
7888
7976
|
// src/components/google-one-tap.ts
|
|
7889
7977
|
var GOOGLE_IDENTITY_SCRIPT = "https://accounts.google.com/gsi/client";
|
|
@@ -8051,11 +8139,11 @@ function GoogleOneTap({
|
|
|
8051
8139
|
const { config, isLoading: configLoading, isError: configError } = usePublicConfig();
|
|
8052
8140
|
const { user, isLoaded: sessionLoaded } = useUser();
|
|
8053
8141
|
const { signInSocial } = useSignIn();
|
|
8054
|
-
const callbacks =
|
|
8142
|
+
const callbacks = React52.useRef({ onSignedIn, onSkipped, onDismissed, onError });
|
|
8055
8143
|
callbacks.current = { onSignedIn, onSkipped, onDismissed, onError };
|
|
8056
8144
|
const googleEnabled = config?.socialProviders.includes("google") === true;
|
|
8057
8145
|
const clientId = config?.socialProviderClientIds?.google;
|
|
8058
|
-
|
|
8146
|
+
React52.useEffect(() => {
|
|
8059
8147
|
if (configLoading || !sessionLoaded) return;
|
|
8060
8148
|
if (disabled) {
|
|
8061
8149
|
callbacks.current.onSkipped?.("disabled");
|
|
@@ -8178,6 +8266,7 @@ var import_core6 = require("@authowl/core");
|
|
|
8178
8266
|
AuthLoaded,
|
|
8179
8267
|
AuthLoading,
|
|
8180
8268
|
AuthOwlBadge,
|
|
8269
|
+
AuthOwlBranding,
|
|
8181
8270
|
AuthOwlError,
|
|
8182
8271
|
AuthOwlProvider,
|
|
8183
8272
|
BackupCodesManager,
|