@authowl/react 0.22.0 → 0.24.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.js CHANGED
@@ -1,4 +1,11 @@
1
1
  "use client";
2
+ import {
3
+ CreateOrganization,
4
+ OrganizationProfile
5
+ } from "./chunk-2HNQYORD.js";
6
+ import {
7
+ useSubmitAction
8
+ } from "./chunk-SAVEQ6RC.js";
2
9
  import {
3
10
  AuthOwlProvider,
4
11
  Bidi,
@@ -8,10 +15,6 @@ import {
8
15
  InvitationPrompt,
9
16
  ModalSurface,
10
17
  Spinner,
11
- canManageOrganization,
12
- hasOrganizationRole,
13
- organizationRoles,
14
- organizationSlugFromName,
15
18
  richMessage,
16
19
  useAccount,
17
20
  useAuth,
@@ -20,24 +23,25 @@ import {
20
23
  useConsent,
21
24
  useEmailVerification,
22
25
  useInvitationRecipientHint,
26
+ useLastUsedSignInMethod,
23
27
  useLocale,
24
28
  useMFA,
25
29
  useOrganization,
26
30
  useOrganizationInvitation,
27
- useOrganizationRoles,
28
31
  usePasskeys,
29
32
  usePasswordReset,
33
+ usePrivacy,
30
34
  usePublicConfig,
31
35
  useServerError,
32
36
  useSession,
33
37
  useSignIn,
38
+ useSignInMethodRecorder,
34
39
  useSignOut,
35
40
  useSignUp,
36
- useSubmitAction,
37
41
  useT,
38
42
  useUser,
39
43
  useWaitlist
40
- } from "./chunk-PUJV7S6G.js";
44
+ } from "./chunk-TOVDZ2ZE.js";
41
45
 
42
46
  // src/project-capabilities.ts
43
47
  import {
@@ -276,6 +280,7 @@ function SocialButtons({ providers, callbackURL }) {
276
280
  const t = useT();
277
281
  const toServerError = useServerError();
278
282
  const { signInSocial } = useSignIn();
283
+ const recordSignInMethod = useSignInMethodRecorder();
279
284
  const [pending, setPending] = React2.useState(null);
280
285
  const [error, setError] = React2.useState(null);
281
286
  React2.useEffect(() => {
@@ -308,6 +313,8 @@ function SocialButtons({ providers, callbackURL }) {
308
313
  if (res?.error) {
309
314
  setError(toServerError(res.error, t("social.error.startFailed")));
310
315
  setPending(null);
316
+ } else {
317
+ recordSignInMethod(`social:${provider}`, true);
311
318
  }
312
319
  } catch {
313
320
  setError(t("social.error.startFailed"));
@@ -1415,6 +1422,15 @@ function SignIn({
1415
1422
  const [challenge, setChallenge] = React13.useState(false);
1416
1423
  const mfaEnrolment = useConfirmedMfaPending("clear");
1417
1424
  const emailRef = React13.useRef(null);
1425
+ const recordSignInMethod = useSignInMethodRecorder();
1426
+ const onPasskeySignedIn = React13.useCallback(() => {
1427
+ recordSignInMethod("passkey");
1428
+ onSignedIn?.();
1429
+ }, [onSignedIn, recordSignInMethod]);
1430
+ const onPhoneOtpSignedIn = React13.useCallback(() => {
1431
+ recordSignInMethod("phone-otp");
1432
+ onSignedIn?.();
1433
+ }, [onSignedIn, recordSignInMethod]);
1418
1434
  const plan = resolveSignInMethods(
1419
1435
  config,
1420
1436
  typeof window === "undefined" ? void 0 : window.location.hostname
@@ -1422,7 +1438,7 @@ function SignIn({
1422
1438
  usePasskeyAutofill({
1423
1439
  enabled: credentialMode === "email" && plan.autofillHost !== null,
1424
1440
  redirectTo,
1425
- onSignedIn
1441
+ onSignedIn: onPasskeySignedIn
1426
1442
  });
1427
1443
  const badge = /* @__PURE__ */ jsx19(AuthOwlBadge, { force: showBadge });
1428
1444
  const branding = showBranding ? /* @__PURE__ */ jsx19(AuthOwlBranding, {}) : null;
@@ -1474,7 +1490,10 @@ function SignIn({
1474
1490
  error,
1475
1491
  onSubmit: () => void run(() => signInEmailOtp({ email, otp }), {
1476
1492
  failure: t("emailOtp.error.invalidCode"),
1477
- onSuccess: () => finishSignIn({ sessionStore, redirectTo, onSignedIn })
1493
+ onSuccess: () => {
1494
+ recordSignInMethod("email-otp");
1495
+ finishSignIn({ sessionStore, redirectTo, onSignedIn });
1496
+ }
1478
1497
  }),
1479
1498
  onChangeEmail: () => {
1480
1499
  setOtp("");
@@ -1502,7 +1521,7 @@ function SignIn({
1502
1521
  PhoneOTP,
1503
1522
  {
1504
1523
  redirectTo,
1505
- onSignedIn,
1524
+ onSignedIn: onPhoneOtpSignedIn,
1506
1525
  onBack: () => setView("sign-in"),
1507
1526
  onMfaPasswordRequired: () => {
1508
1527
  setView("sign-in");
@@ -1530,6 +1549,7 @@ function SignIn({
1530
1549
  failure: t("signIn.error.failed"),
1531
1550
  onSuccess: (res) => {
1532
1551
  const data = res.data;
1552
+ recordSignInMethod(credentialMode === "username" ? "username" : "password");
1533
1553
  if (data && "twoFactorRedirect" in data && data.twoFactorRedirect) {
1534
1554
  setChallenge(true);
1535
1555
  } else {
@@ -1542,7 +1562,10 @@ function SignIn({
1542
1562
  "magic",
1543
1563
  () => void run(() => authChallenge.run(AUTH_CHALLENGE_ACTIONS.passwordless, (options) => signInMagicLink({ email, callbackURL: redirectTo }, options)), {
1544
1564
  failure: t("magicLink.error.sendFailed"),
1545
- onSuccess: () => setView("magic-sent")
1565
+ onSuccess: () => {
1566
+ recordSignInMethod("magic-link", true);
1567
+ setView("magic-sent");
1568
+ }
1546
1569
  })
1547
1570
  );
1548
1571
  const doRequestOtp = () => start(
@@ -1559,6 +1582,7 @@ function SignIn({
1559
1582
  {
1560
1583
  failure: t("sso.error.startFailed"),
1561
1584
  mapError: (error2) => error2.status === 404 ? t("sso.error.notFound") : null,
1585
+ onSuccess: () => recordSignInMethod("sso", true),
1562
1586
  // SSO always redirects the browser to the IdP; keep the spinner up
1563
1587
  // through that navigation instead of flashing back to idle.
1564
1588
  keepPendingOnSuccess: true
@@ -1697,7 +1721,7 @@ function SignIn({
1697
1721
  ]
1698
1722
  }
1699
1723
  ),
1700
- plan.passkey && /* @__PURE__ */ jsx19(PasskeyButton, { redirectTo, onSignedIn }),
1724
+ plan.passkey && /* @__PURE__ */ jsx19(PasskeyButton, { redirectTo, onSignedIn: onPasskeySignedIn }),
1701
1725
  plan.phoneOtp && /* @__PURE__ */ jsx19(
1702
1726
  "button",
1703
1727
  {
@@ -1714,6 +1738,7 @@ function SignIn({
1714
1738
 
1715
1739
  // src/components/SignUp.tsx
1716
1740
  import * as React17 from "react";
1741
+ import { createIdempotencyKey as createIdempotencyKey2 } from "@authowl/core";
1717
1742
 
1718
1743
  // src/components/VerificationPending.tsx
1719
1744
  import * as React14 from "react";
@@ -2018,8 +2043,53 @@ function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
2018
2043
  ] });
2019
2044
  }
2020
2045
 
2046
+ // src/components/PrivacySignUpEvidence.tsx
2047
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
2048
+ function PrivacySignUpEvidence({
2049
+ privacy,
2050
+ locale,
2051
+ grantedPurposeCodes,
2052
+ onPurposeChange
2053
+ }) {
2054
+ const t = useT();
2055
+ if (privacy.notices.length === 0 && privacy.consentPurposes.length === 0) return null;
2056
+ return /* @__PURE__ */ jsxs22("section", { className: "ba-privacy-signup", "aria-labelledby": "ba-privacy-signup-title", children: [
2057
+ /* @__PURE__ */ jsxs22("header", { className: "ba-privacy-signup-header", children: [
2058
+ /* @__PURE__ */ jsx24("p", { className: "ba-eyebrow", children: t("privacy.dataUse") }),
2059
+ /* @__PURE__ */ jsx24("h3", { id: "ba-privacy-signup-title", children: t("privacy.signup.title") }),
2060
+ /* @__PURE__ */ jsx24("p", { children: t("privacy.signup.description") })
2061
+ ] }),
2062
+ privacy.notices.length > 0 && /* @__PURE__ */ jsx24("div", { className: "ba-privacy-notices", children: privacy.notices.map((notice, index) => /* @__PURE__ */ jsxs22("details", { className: "ba-privacy-notice", open: index === 0, children: [
2063
+ /* @__PURE__ */ jsx24("summary", { children: notice.title[locale] }),
2064
+ /* @__PURE__ */ jsx24("p", { children: notice.body[locale] })
2065
+ ] }, notice.noticeVersionId)) }),
2066
+ privacy.consentPurposes.length > 0 && /* @__PURE__ */ jsxs22("fieldset", { className: "ba-privacy-purpose-list", children: [
2067
+ /* @__PURE__ */ jsx24("legend", { children: t("privacy.signup.optional") }),
2068
+ privacy.consentPurposes.map((purpose) => /* @__PURE__ */ jsxs22("label", { className: "ba-privacy-purpose", children: [
2069
+ /* @__PURE__ */ jsxs22("span", { className: "ba-checkbox-control", children: [
2070
+ /* @__PURE__ */ jsx24(
2071
+ "input",
2072
+ {
2073
+ className: "ba-checkbox",
2074
+ type: "checkbox",
2075
+ checked: grantedPurposeCodes.has(purpose.code),
2076
+ onChange: (event) => onPurposeChange(purpose.code, event.target.checked)
2077
+ }
2078
+ ),
2079
+ /* @__PURE__ */ jsx24("span", { className: "ba-checkbox-visual", children: /* @__PURE__ */ jsx24("span", { className: "ba-checkbox-check" }) })
2080
+ ] }),
2081
+ /* @__PURE__ */ jsxs22("span", { children: [
2082
+ /* @__PURE__ */ jsx24("strong", { children: purpose.title[locale] }),
2083
+ /* @__PURE__ */ jsx24("small", { children: purpose.description[locale] })
2084
+ ] })
2085
+ ] }, purpose.purposeVersionId)),
2086
+ /* @__PURE__ */ jsx24("p", { className: "ba-privacy-choice-note", children: t("privacy.signup.choiceNote") })
2087
+ ] })
2088
+ ] });
2089
+ }
2090
+
2021
2091
  // src/components/SignUp.tsx
2022
- import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
2092
+ import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
2023
2093
  function SignUp({
2024
2094
  redirectTo,
2025
2095
  onSignedUp,
@@ -2029,6 +2099,7 @@ function SignUp({
2029
2099
  showBranding = true
2030
2100
  } = {}) {
2031
2101
  const t = useT();
2102
+ const locale = useLocale();
2032
2103
  const toServerError = useServerError();
2033
2104
  const { signUp } = useSignUp();
2034
2105
  const { config, isLoading, isError } = usePublicConfig();
@@ -2042,6 +2113,10 @@ function SignUp({
2042
2113
  const [error, setError] = React17.useState(null);
2043
2114
  const [submitting, setSubmitting] = React17.useState(false);
2044
2115
  const [accepted, setAccepted] = React17.useState(false);
2116
+ const [grantedPurposeCodes, setGrantedPurposeCodes] = React17.useState(
2117
+ () => /* @__PURE__ */ new Set()
2118
+ );
2119
+ const [privacyCorrelationId] = React17.useState(createIdempotencyKey2);
2045
2120
  const legal = config?.legal;
2046
2121
  const consentRequired = Boolean(legal?.required);
2047
2122
  const consentBlocked = consentRequired && !accepted;
@@ -2068,6 +2143,12 @@ function SignUp({
2068
2143
  }
2069
2144
  setSubmitting(true);
2070
2145
  try {
2146
+ const privacyEvidence = config?.privacy && config.privacy.notices.length > 0 ? (await import("@authowl/core/privacy")).buildPrivacySignUpEvidence(
2147
+ config.privacy,
2148
+ locale,
2149
+ grantedPurposeCodes,
2150
+ privacyCorrelationId
2151
+ ) : void 0;
2071
2152
  const res = await authChallenge.run(
2072
2153
  AUTH_CHALLENGE_ACTIONS.signUp,
2073
2154
  (options) => signUp(
@@ -2081,7 +2162,8 @@ function SignUp({
2081
2162
  ...lastName.trim() ? { lastName: lastName.trim() } : {}
2082
2163
  } : {},
2083
2164
  callbackURL: verifyEmailUrl,
2084
- consentVersion: legal?.required ? legal.version : void 0
2165
+ consentVersion: legal?.required ? legal.version : void 0,
2166
+ ...privacyEvidence ? { privacyEvidence } : {}
2085
2167
  },
2086
2168
  options
2087
2169
  )
@@ -2103,21 +2185,21 @@ function SignUp({
2103
2185
  }
2104
2186
  }
2105
2187
  if (isLoading) {
2106
- return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-loading", "aria-busy": "true", children: [
2107
- /* @__PURE__ */ jsx24("div", { className: "ba-skeleton" }),
2108
- /* @__PURE__ */ jsx24("div", { className: "ba-skeleton" })
2188
+ return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "signup-loading", "aria-busy": "true", children: [
2189
+ /* @__PURE__ */ jsx25("div", { className: "ba-skeleton" }),
2190
+ /* @__PURE__ */ jsx25("div", { className: "ba-skeleton" })
2109
2191
  ] });
2110
2192
  }
2111
2193
  if (isError) {
2112
- return /* @__PURE__ */ jsx24(PublicConfigError, { showBadge, showBranding });
2194
+ return /* @__PURE__ */ jsx25(PublicConfigError, { showBadge, showBranding });
2113
2195
  }
2114
2196
  if (config?.signUp?.mode === "waitlist") {
2115
- return /* @__PURE__ */ jsx24(Waitlist, { onJoined: onWaitlisted, showBadge, showBranding });
2197
+ return /* @__PURE__ */ jsx25(Waitlist, { onJoined: onWaitlisted, showBadge, showBranding });
2116
2198
  }
2117
2199
  if (pendingEmail) {
2118
- return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-verify-pending", children: [
2119
- showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
2120
- /* @__PURE__ */ jsx24(
2200
+ return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "signup-verify-pending", children: [
2201
+ showBranding ? /* @__PURE__ */ jsx25(AuthOwlBranding, {}) : null,
2202
+ /* @__PURE__ */ jsx25(
2121
2203
  VerificationPending,
2122
2204
  {
2123
2205
  email: pendingEmail,
@@ -2125,32 +2207,33 @@ function SignUp({
2125
2207
  method: capabilities.emailVerificationMethod
2126
2208
  }
2127
2209
  ),
2128
- /* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
2210
+ /* @__PURE__ */ jsx25(AuthOwlBadge, { force: showBadge })
2129
2211
  ] });
2130
2212
  }
2131
2213
  const methods = config?.enabledMethods ?? ["password"];
2132
2214
  const publicSignupAllowed = config?.signUp?.mode !== "restricted";
2133
- const social = consentRequired || !publicSignupAllowed ? [] : config?.socialProviders ?? [];
2215
+ const exactPrivacyEvidenceRequired = (config?.privacy?.notices.length ?? 0) > 0;
2216
+ const social = consentRequired || exactPrivacyEvidenceRequired || !publicSignupAllowed ? [] : config?.socialProviders ?? [];
2134
2217
  const showPassword = publicSignupAllowed && capabilities.passwordSignIn && capabilities.emailSignUp && capabilities.passwordSignUp;
2135
- const showPasswordless = publicSignupAllowed && capabilities.emailOtpSignIn && capabilities.emailSignUp && !consentRequired && !capabilities.mfaRequired;
2218
+ const showPasswordless = publicSignupAllowed && capabilities.emailOtpSignIn && capabilities.emailSignUp && !consentRequired && !exactPrivacyEvidenceRequired && !capabilities.mfaRequired;
2136
2219
  const renderable = showPassword || showPasswordless || social.length > 0;
2137
2220
  if (completeWithPasskey) {
2138
- return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-passkey-step", children: [
2139
- showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
2140
- /* @__PURE__ */ jsx24(PasskeySignUpCompletion, { onComplete: finishSignUp }),
2141
- /* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
2221
+ return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "signup-passkey-step", children: [
2222
+ showBranding ? /* @__PURE__ */ jsx25(AuthOwlBranding, {}) : null,
2223
+ /* @__PURE__ */ jsx25(PasskeySignUpCompletion, { onComplete: finishSignUp }),
2224
+ /* @__PURE__ */ jsx25(AuthOwlBadge, { force: showBadge })
2142
2225
  ] });
2143
2226
  }
2144
- return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-form", children: [
2145
- showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
2146
- /* @__PURE__ */ jsx24("h2", { className: "ba-title", children: t("signUp.title") }),
2147
- /* @__PURE__ */ jsx24(InvitationBanner, {}),
2148
- /* @__PURE__ */ jsx24(SocialButtons, { providers: social, callbackURL: redirectTo }),
2149
- showPassword && social.length > 0 && /* @__PURE__ */ jsx24("div", { className: "ba-divider", children: t("common.orDivider") }),
2150
- showPassword && /* @__PURE__ */ jsxs22("form", { method: "post", onSubmit, className: "ba-fields", children: [
2151
- capabilities.legacyNameField && /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2227
+ return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "signup-form", children: [
2228
+ showBranding ? /* @__PURE__ */ jsx25(AuthOwlBranding, {}) : null,
2229
+ /* @__PURE__ */ jsx25("h2", { className: "ba-title", children: t("signUp.title") }),
2230
+ /* @__PURE__ */ jsx25(InvitationBanner, {}),
2231
+ /* @__PURE__ */ jsx25(SocialButtons, { providers: social, callbackURL: redirectTo }),
2232
+ showPassword && social.length > 0 && /* @__PURE__ */ jsx25("div", { className: "ba-divider", children: t("common.orDivider") }),
2233
+ showPassword && /* @__PURE__ */ jsxs23("form", { method: "post", onSubmit, className: "ba-fields", children: [
2234
+ capabilities.legacyNameField && /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2152
2235
  t("signUp.nameLabel"),
2153
- /* @__PURE__ */ jsx24(
2236
+ /* @__PURE__ */ jsx25(
2154
2237
  "input",
2155
2238
  {
2156
2239
  className: "ba-input",
@@ -2164,10 +2247,10 @@ function SignUp({
2164
2247
  }
2165
2248
  )
2166
2249
  ] }),
2167
- capabilities.firstLastName && /* @__PURE__ */ jsxs22(Fragment5, { children: [
2168
- /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2250
+ capabilities.firstLastName && /* @__PURE__ */ jsxs23(Fragment5, { children: [
2251
+ /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2169
2252
  t("signUp.firstNameLabel"),
2170
- /* @__PURE__ */ jsx24(
2253
+ /* @__PURE__ */ jsx25(
2171
2254
  "input",
2172
2255
  {
2173
2256
  className: "ba-input",
@@ -2180,9 +2263,9 @@ function SignUp({
2180
2263
  }
2181
2264
  )
2182
2265
  ] }),
2183
- /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2266
+ /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2184
2267
  t("signUp.lastNameLabel"),
2185
- /* @__PURE__ */ jsx24(
2268
+ /* @__PURE__ */ jsx25(
2186
2269
  "input",
2187
2270
  {
2188
2271
  className: "ba-input",
@@ -2196,9 +2279,9 @@ function SignUp({
2196
2279
  )
2197
2280
  ] })
2198
2281
  ] }),
2199
- capabilities.collectUsername && /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2282
+ capabilities.collectUsername && /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2200
2283
  t("common.usernameLabel"),
2201
- /* @__PURE__ */ jsx24(
2284
+ /* @__PURE__ */ jsx25(
2202
2285
  "input",
2203
2286
  {
2204
2287
  className: "ba-input",
@@ -2212,9 +2295,9 @@ function SignUp({
2212
2295
  }
2213
2296
  )
2214
2297
  ] }),
2215
- /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2298
+ /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2216
2299
  t("common.emailLabel"),
2217
- /* @__PURE__ */ jsx24(
2300
+ /* @__PURE__ */ jsx25(
2218
2301
  "input",
2219
2302
  {
2220
2303
  className: "ba-input",
@@ -2229,9 +2312,9 @@ function SignUp({
2229
2312
  }
2230
2313
  )
2231
2314
  ] }),
2232
- /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2315
+ /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2233
2316
  t("common.passwordLabel"),
2234
- /* @__PURE__ */ jsx24(
2317
+ /* @__PURE__ */ jsx25(
2235
2318
  "input",
2236
2319
  {
2237
2320
  className: "ba-input",
@@ -2249,7 +2332,23 @@ function SignUp({
2249
2332
  )
2250
2333
  ] }),
2251
2334
  authChallenge.control,
2252
- legal && /* @__PURE__ */ jsx24(
2335
+ config?.privacy && /* @__PURE__ */ jsx25(
2336
+ PrivacySignUpEvidence,
2337
+ {
2338
+ privacy: config.privacy,
2339
+ locale,
2340
+ grantedPurposeCodes,
2341
+ onPurposeChange: (purposeCode, granted) => {
2342
+ setGrantedPurposeCodes((current) => {
2343
+ const next = new Set(current);
2344
+ if (granted) next.add(purposeCode);
2345
+ else next.delete(purposeCode);
2346
+ return next;
2347
+ });
2348
+ }
2349
+ }
2350
+ ),
2351
+ legal && /* @__PURE__ */ jsx25(
2253
2352
  LegalConsentCheckbox,
2254
2353
  {
2255
2354
  legal,
@@ -2258,20 +2357,20 @@ function SignUp({
2258
2357
  testId: "signup-consent"
2259
2358
  }
2260
2359
  ),
2261
- /* @__PURE__ */ jsx24(FormError, { children: error }),
2262
- /* @__PURE__ */ jsx24(
2360
+ /* @__PURE__ */ jsx25(FormError, { children: error }),
2361
+ /* @__PURE__ */ jsx25(
2263
2362
  "button",
2264
2363
  {
2265
2364
  className: "ba-button",
2266
2365
  type: "submit",
2267
2366
  disabled: submitting || consentBlocked || authChallenge.configPending,
2268
2367
  "aria-busy": submitting || void 0,
2269
- children: /* @__PURE__ */ jsx24(Busy, { busy: submitting, label: t("signUp.submitPending"), children: t("signUp.submit") })
2368
+ children: /* @__PURE__ */ jsx25(Busy, { busy: submitting, label: t("signUp.submitPending"), children: t("signUp.submit") })
2270
2369
  }
2271
2370
  )
2272
2371
  ] }),
2273
- showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */ jsx24("div", { className: "ba-divider", children: t("common.orDivider") }),
2274
- showPasswordless && /* @__PURE__ */ jsx24(
2372
+ showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */ jsx25("div", { className: "ba-divider", children: t("common.orDivider") }),
2373
+ showPasswordless && /* @__PURE__ */ jsx25(
2275
2374
  PasswordlessSignUp,
2276
2375
  {
2277
2376
  onAuthenticated: () => {
@@ -2280,25 +2379,25 @@ function SignUp({
2280
2379
  }
2281
2380
  }
2282
2381
  ),
2283
- !renderable && /* @__PURE__ */ jsx24("p", { className: "ba-muted", children: publicSignupAllowed && methods.length > 0 ? t("signUp.empty.unsupported") : t("signUp.empty.none") }),
2284
- /* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
2382
+ !renderable && /* @__PURE__ */ jsx25("p", { className: "ba-muted", children: publicSignupAllowed && methods.length > 0 ? t("signUp.empty.unsupported") : t("signUp.empty.none") }),
2383
+ /* @__PURE__ */ jsx25(AuthOwlBadge, { force: showBadge })
2285
2384
  ] });
2286
2385
  }
2287
2386
 
2288
2387
  // src/components/ConsentGate.tsx
2289
- import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
2388
+ import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
2290
2389
  function ConsentGate({ children, title }) {
2291
2390
  const t = useT();
2292
2391
  const { needsConsent, status, accept } = useConsent();
2293
2392
  const { pending, error, run } = useSubmitAction();
2294
- if (!needsConsent) return /* @__PURE__ */ jsx25(Fragment6, { children });
2295
- return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "consent-gate", children: [
2296
- /* @__PURE__ */ jsx25("h2", { className: "ba-title", children: title ?? t("consent.gateTitle") }),
2297
- /* @__PURE__ */ jsx25("p", { className: "ba-muted", children: richMessage(t("consent.gateBody"), {
2298
- links: /* @__PURE__ */ jsx25(ConsentDocLinks, { termsUrl: status?.termsUrl, privacyUrl: status?.privacyUrl })
2393
+ if (!needsConsent) return /* @__PURE__ */ jsx26(Fragment6, { children });
2394
+ return /* @__PURE__ */ jsxs24("div", { className: "ba-form", "data-testid": "consent-gate", children: [
2395
+ /* @__PURE__ */ jsx26("h2", { className: "ba-title", children: title ?? t("consent.gateTitle") }),
2396
+ /* @__PURE__ */ jsx26("p", { className: "ba-muted", children: richMessage(t("consent.gateBody"), {
2397
+ links: /* @__PURE__ */ jsx26(ConsentDocLinks, { termsUrl: status?.termsUrl, privacyUrl: status?.privacyUrl })
2299
2398
  }) }),
2300
- /* @__PURE__ */ jsx25(FormError, { children: error }),
2301
- /* @__PURE__ */ jsx25(
2399
+ /* @__PURE__ */ jsx26(FormError, { children: error }),
2400
+ /* @__PURE__ */ jsx26(
2302
2401
  "button",
2303
2402
  {
2304
2403
  className: "ba-button",
@@ -2312,28 +2411,28 @@ function ConsentGate({ children, title }) {
2312
2411
  },
2313
2412
  { failure: t("consent.error.acceptFailed") }
2314
2413
  ),
2315
- children: /* @__PURE__ */ jsx25(Busy, { busy: pending, label: t("consent.acceptPending"), children: t("consent.acceptSubmit") })
2414
+ children: /* @__PURE__ */ jsx26(Busy, { busy: pending, label: t("consent.acceptPending"), children: t("consent.acceptSubmit") })
2316
2415
  }
2317
2416
  ),
2318
- /* @__PURE__ */ jsx25(AuthOwlBadge, {})
2417
+ /* @__PURE__ */ jsx26(AuthOwlBadge, {})
2319
2418
  ] });
2320
2419
  }
2321
2420
 
2322
2421
  // src/components/MFARequiredGate.tsx
2323
- import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
2422
+ import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
2324
2423
  function MFARequiredGate({ children, title }) {
2325
2424
  const state = useConfirmedMfaPending();
2326
- if (state === "clear") return /* @__PURE__ */ jsx26(Fragment7, { children });
2425
+ if (state === "clear") return /* @__PURE__ */ jsx27(Fragment7, { children });
2327
2426
  if (state === "confirming") return null;
2328
- return /* @__PURE__ */ jsxs24("div", { className: "ba-form", "data-testid": "mfa-required-gate", children: [
2329
- /* @__PURE__ */ jsx26(MfaEnrollmentStep, { title }),
2330
- /* @__PURE__ */ jsx26(AuthOwlBadge, {})
2427
+ return /* @__PURE__ */ jsxs25("div", { className: "ba-form", "data-testid": "mfa-required-gate", children: [
2428
+ /* @__PURE__ */ jsx27(MfaEnrollmentStep, { title }),
2429
+ /* @__PURE__ */ jsx27(AuthOwlBadge, {})
2331
2430
  ] });
2332
2431
  }
2333
2432
 
2334
2433
  // src/components/BackupCodesManager.tsx
2335
2434
  import * as React18 from "react";
2336
- import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
2435
+ import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
2337
2436
  function BackupCodesManager({ title }) {
2338
2437
  const t = useT();
2339
2438
  const { user } = useUser();
@@ -2352,20 +2451,20 @@ function BackupCodesManager({ title }) {
2352
2451
  }
2353
2452
  });
2354
2453
  };
2355
- return /* @__PURE__ */ jsxs25("div", { className: "ba-form", "data-testid": "backup-codes-manager", children: [
2356
- title !== null && /* @__PURE__ */ jsx27("h2", { className: "ba-title", children: title ?? t("backupCodes.title") }),
2357
- /* @__PURE__ */ jsx27("p", { className: "ba-muted", children: t("backupCodes.hint") }),
2358
- codes ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
2359
- /* @__PURE__ */ jsxs25("p", { className: "ba-muted", children: [
2360
- /* @__PURE__ */ jsx27("strong", { children: t("mfa.enroll.backupCodesWarningStrong") }),
2454
+ return /* @__PURE__ */ jsxs26("div", { className: "ba-form", "data-testid": "backup-codes-manager", children: [
2455
+ title !== null && /* @__PURE__ */ jsx28("h2", { className: "ba-title", children: title ?? t("backupCodes.title") }),
2456
+ /* @__PURE__ */ jsx28("p", { className: "ba-muted", children: t("backupCodes.hint") }),
2457
+ codes ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
2458
+ /* @__PURE__ */ jsxs26("p", { className: "ba-muted", children: [
2459
+ /* @__PURE__ */ jsx28("strong", { children: t("mfa.enroll.backupCodesWarningStrong") }),
2361
2460
  " ",
2362
2461
  t("mfa.enroll.backupCodesWarningRest")
2363
2462
  ] }),
2364
- /* @__PURE__ */ jsx27("ul", { className: "ba-passkey-list", "data-testid": "backup-codes-list", children: codes.map((c) => /* @__PURE__ */ jsx27("li", { className: "ba-passkey-item", children: /* @__PURE__ */ jsx27("code", { children: /* @__PURE__ */ jsx27("bdi", { children: c }) }) }, c)) })
2365
- ] }) : /* @__PURE__ */ jsxs25("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
2366
- /* @__PURE__ */ jsxs25("label", { className: "ba-label", children: [
2463
+ /* @__PURE__ */ jsx28("ul", { className: "ba-passkey-list", "data-testid": "backup-codes-list", children: codes.map((c) => /* @__PURE__ */ jsx28("li", { className: "ba-passkey-item", children: /* @__PURE__ */ jsx28("code", { children: /* @__PURE__ */ jsx28("bdi", { children: c }) }) }, c)) })
2464
+ ] }) : /* @__PURE__ */ jsxs26("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
2465
+ /* @__PURE__ */ jsxs26("label", { className: "ba-label", children: [
2367
2466
  t("common.passwordLabel"),
2368
- /* @__PURE__ */ jsx27(
2467
+ /* @__PURE__ */ jsx28(
2369
2468
  "input",
2370
2469
  {
2371
2470
  className: "ba-input",
@@ -2377,15 +2476,15 @@ function BackupCodesManager({ title }) {
2377
2476
  }
2378
2477
  )
2379
2478
  ] }),
2380
- /* @__PURE__ */ jsx27(FormError, { children: error }),
2381
- /* @__PURE__ */ jsx27("button", { className: "ba-button", type: "submit", disabled: pending || !password, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx27(Busy, { busy: pending, label: t("backupCodes.pending"), children: t("backupCodes.submit") }) })
2479
+ /* @__PURE__ */ jsx28(FormError, { children: error }),
2480
+ /* @__PURE__ */ jsx28("button", { className: "ba-button", type: "submit", disabled: pending || !password, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx28(Busy, { busy: pending, label: t("backupCodes.pending"), children: t("backupCodes.submit") }) })
2382
2481
  ] })
2383
2482
  ] });
2384
2483
  }
2385
2484
 
2386
2485
  // src/components/MagicLinkForm.tsx
2387
2486
  import * as React19 from "react";
2388
- import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
2487
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
2389
2488
  function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2390
2489
  const t = useT();
2391
2490
  const { signInMagicLink } = useSignIn();
@@ -2394,9 +2493,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2394
2493
  const [email, setEmail] = React19.useState("");
2395
2494
  const [sent, setSent] = React19.useState(false);
2396
2495
  if (sent) {
2397
- return /* @__PURE__ */ jsx28("p", { className: "ba-muted", "data-testid": "magiclink-sent", children: t("magicLink.sent") });
2496
+ return /* @__PURE__ */ jsx29("p", { className: "ba-muted", "data-testid": "magiclink-sent", children: t("magicLink.sent") });
2398
2497
  }
2399
- return /* @__PURE__ */ jsxs26(
2498
+ return /* @__PURE__ */ jsxs27(
2400
2499
  "form",
2401
2500
  {
2402
2501
  method: "post",
@@ -2410,9 +2509,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2410
2509
  className: "ba-fields",
2411
2510
  "data-testid": "magiclink-form",
2412
2511
  children: [
2413
- /* @__PURE__ */ jsxs26("label", { className: "ba-label", children: [
2512
+ /* @__PURE__ */ jsxs27("label", { className: "ba-label", children: [
2414
2513
  t("common.emailLabel"),
2415
- /* @__PURE__ */ jsx28(
2514
+ /* @__PURE__ */ jsx29(
2416
2515
  "input",
2417
2516
  {
2418
2517
  className: "ba-input",
@@ -2425,15 +2524,15 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2425
2524
  )
2426
2525
  ] }),
2427
2526
  authChallenge.control,
2428
- /* @__PURE__ */ jsx28(FormError, { children: error }),
2429
- /* @__PURE__ */ jsx28(
2527
+ /* @__PURE__ */ jsx29(FormError, { children: error }),
2528
+ /* @__PURE__ */ jsx29(
2430
2529
  "button",
2431
2530
  {
2432
2531
  className: "ba-button",
2433
2532
  type: "submit",
2434
2533
  disabled: pending || authChallenge.configPending,
2435
2534
  "aria-busy": pending || void 0,
2436
- children: /* @__PURE__ */ jsx28(Busy, { busy: pending, label: t("common.sending"), children: t("magicLink.submit") })
2535
+ children: /* @__PURE__ */ jsx29(Busy, { busy: pending, label: t("common.sending"), children: t("magicLink.submit") })
2437
2536
  }
2438
2537
  )
2439
2538
  ]
@@ -2443,7 +2542,7 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2443
2542
 
2444
2543
  // src/components/EmailOtpForm.tsx
2445
2544
  import * as React20 from "react";
2446
- import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
2545
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
2447
2546
  function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2448
2547
  const t = useT();
2449
2548
  const { sessionStore } = useAuthClient();
@@ -2454,7 +2553,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2454
2553
  const [otp, setOtp] = React20.useState("");
2455
2554
  const [stage, setStage] = React20.useState("email");
2456
2555
  if (stage === "code") {
2457
- return /* @__PURE__ */ jsx29(
2556
+ return /* @__PURE__ */ jsx30(
2458
2557
  OtpCodeForm,
2459
2558
  {
2460
2559
  email,
@@ -2477,7 +2576,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2477
2576
  }
2478
2577
  );
2479
2578
  }
2480
- return /* @__PURE__ */ jsxs27(
2579
+ return /* @__PURE__ */ jsxs28(
2481
2580
  "form",
2482
2581
  {
2483
2582
  method: "post",
@@ -2491,9 +2590,9 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2491
2590
  className: "ba-fields",
2492
2591
  "data-testid": "emailotp-email",
2493
2592
  children: [
2494
- /* @__PURE__ */ jsxs27("label", { className: "ba-label", children: [
2593
+ /* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
2495
2594
  t("common.emailLabel"),
2496
- /* @__PURE__ */ jsx29(
2595
+ /* @__PURE__ */ jsx30(
2497
2596
  "input",
2498
2597
  {
2499
2598
  className: "ba-input",
@@ -2509,15 +2608,15 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2509
2608
  )
2510
2609
  ] }),
2511
2610
  authChallenge.control,
2512
- /* @__PURE__ */ jsx29(FormError, { children: error }),
2513
- /* @__PURE__ */ jsx29(
2611
+ /* @__PURE__ */ jsx30(FormError, { children: error }),
2612
+ /* @__PURE__ */ jsx30(
2514
2613
  "button",
2515
2614
  {
2516
2615
  className: "ba-button",
2517
2616
  type: "submit",
2518
2617
  disabled: pending || authChallenge.configPending,
2519
2618
  "aria-busy": pending || void 0,
2520
- children: /* @__PURE__ */ jsx29(Busy, { busy: pending, label: t("common.sending"), children: t("emailOtp.requestSubmit") })
2619
+ children: /* @__PURE__ */ jsx30(Busy, { busy: pending, label: t("common.sending"), children: t("emailOtp.requestSubmit") })
2521
2620
  }
2522
2621
  )
2523
2622
  ]
@@ -2527,7 +2626,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2527
2626
 
2528
2627
  // src/components/ResetPassword.tsx
2529
2628
  import * as React21 from "react";
2530
- import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
2629
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
2531
2630
  function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2532
2631
  const t = useT();
2533
2632
  const { resetPassword } = usePasswordReset();
@@ -2547,15 +2646,15 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2547
2646
  setReady(true);
2548
2647
  }, [tokenProp]);
2549
2648
  if (!ready) {
2550
- return /* @__PURE__ */ jsx30("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx30("div", { className: "ba-skeleton" }) });
2649
+ return /* @__PURE__ */ jsx31("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx31("div", { className: "ba-skeleton" }) });
2551
2650
  }
2552
2651
  if (!token) {
2553
- return /* @__PURE__ */ jsx30(FormError, { "data-testid": "reset-invalid", children: t("resetPassword.invalidLink") });
2652
+ return /* @__PURE__ */ jsx31(FormError, { "data-testid": "reset-invalid", children: t("resetPassword.invalidLink") });
2554
2653
  }
2555
2654
  if (done) {
2556
- return /* @__PURE__ */ jsx30("p", { className: "ba-muted", "data-testid": "reset-done", children: t("resetPassword.done") });
2655
+ return /* @__PURE__ */ jsx31("p", { className: "ba-muted", "data-testid": "reset-done", children: t("resetPassword.done") });
2557
2656
  }
2558
- return /* @__PURE__ */ jsxs28(
2657
+ return /* @__PURE__ */ jsxs29(
2559
2658
  "form",
2560
2659
  {
2561
2660
  method: "post",
@@ -2581,9 +2680,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2581
2680
  });
2582
2681
  },
2583
2682
  children: [
2584
- /* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
2683
+ /* @__PURE__ */ jsxs29("label", { className: "ba-label", children: [
2585
2684
  t("resetPassword.newPasswordLabel"),
2586
- /* @__PURE__ */ jsx30(
2685
+ /* @__PURE__ */ jsx31(
2587
2686
  "input",
2588
2687
  {
2589
2688
  className: "ba-input",
@@ -2600,9 +2699,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2600
2699
  }
2601
2700
  )
2602
2701
  ] }),
2603
- /* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
2702
+ /* @__PURE__ */ jsxs29("label", { className: "ba-label", children: [
2604
2703
  t("resetPassword.confirmPasswordLabel"),
2605
- /* @__PURE__ */ jsx30(
2704
+ /* @__PURE__ */ jsx31(
2606
2705
  "input",
2607
2706
  {
2608
2707
  className: "ba-input",
@@ -2619,8 +2718,8 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2619
2718
  }
2620
2719
  )
2621
2720
  ] }),
2622
- /* @__PURE__ */ jsx30(FormError, { children: error }),
2623
- /* @__PURE__ */ jsx30("button", { className: "ba-button", type: "submit", disabled: pending, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx30(Busy, { busy: pending, label: t("resetPassword.submitPending"), children: t("resetPassword.submit") }) })
2721
+ /* @__PURE__ */ jsx31(FormError, { children: error }),
2722
+ /* @__PURE__ */ jsx31("button", { className: "ba-button", type: "submit", disabled: pending, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx31(Busy, { busy: pending, label: t("resetPassword.submitPending"), children: t("resetPassword.submit") }) })
2624
2723
  ]
2625
2724
  }
2626
2725
  );
@@ -2628,7 +2727,7 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2628
2727
 
2629
2728
  // src/components/VerifyEmail.tsx
2630
2729
  import * as React22 from "react";
2631
- import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
2730
+ import { Fragment as Fragment9, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
2632
2731
  function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2633
2732
  const t = useT();
2634
2733
  const { sendVerificationEmail } = useEmailVerification();
@@ -2648,12 +2747,12 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2648
2747
  }
2649
2748
  }, [onVerified, redirectTo]);
2650
2749
  if (!ready) {
2651
- return /* @__PURE__ */ jsx31("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx31("div", { className: "ba-skeleton" }) });
2750
+ return /* @__PURE__ */ jsx32("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx32("div", { className: "ba-skeleton" }) });
2652
2751
  }
2653
2752
  if (!failed) {
2654
- return /* @__PURE__ */ jsx31("p", { className: "ba-muted", "data-testid": "verify-success", children: t("verifyEmail.success") });
2753
+ return /* @__PURE__ */ jsx32("p", { className: "ba-muted", "data-testid": "verify-success", children: t("verifyEmail.success") });
2655
2754
  }
2656
- return /* @__PURE__ */ jsxs29(
2755
+ return /* @__PURE__ */ jsxs30(
2657
2756
  "form",
2658
2757
  {
2659
2758
  method: "post",
@@ -2668,11 +2767,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2668
2767
  });
2669
2768
  },
2670
2769
  children: [
2671
- /* @__PURE__ */ jsx31(FormError, { children: t("verifyEmail.invalidLink") }),
2672
- resent ? /* @__PURE__ */ jsx31("p", { className: "ba-muted", children: richMessage(t("verifyEmail.resent"), { email: /* @__PURE__ */ jsx31(Bidi, { children: email }) }) }) : /* @__PURE__ */ jsxs29(Fragment9, { children: [
2673
- /* @__PURE__ */ jsxs29("label", { className: "ba-label", children: [
2770
+ /* @__PURE__ */ jsx32(FormError, { children: t("verifyEmail.invalidLink") }),
2771
+ resent ? /* @__PURE__ */ jsx32("p", { className: "ba-muted", children: richMessage(t("verifyEmail.resent"), { email: /* @__PURE__ */ jsx32(Bidi, { children: email }) }) }) : /* @__PURE__ */ jsxs30(Fragment9, { children: [
2772
+ /* @__PURE__ */ jsxs30("label", { className: "ba-label", children: [
2674
2773
  t("common.emailLabel"),
2675
- /* @__PURE__ */ jsx31(
2774
+ /* @__PURE__ */ jsx32(
2676
2775
  "input",
2677
2776
  {
2678
2777
  className: "ba-input",
@@ -2685,15 +2784,15 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2685
2784
  )
2686
2785
  ] }),
2687
2786
  authChallenge.control,
2688
- /* @__PURE__ */ jsx31(FormError, { children: error }),
2689
- /* @__PURE__ */ jsx31(
2787
+ /* @__PURE__ */ jsx32(FormError, { children: error }),
2788
+ /* @__PURE__ */ jsx32(
2690
2789
  "button",
2691
2790
  {
2692
2791
  className: "ba-button",
2693
2792
  type: "submit",
2694
2793
  disabled: pending || authChallenge.configPending,
2695
2794
  "aria-busy": pending || void 0,
2696
- children: /* @__PURE__ */ jsx31(Busy, { busy: pending, label: t("common.sending"), children: t("verifyEmail.resendSubmit") })
2795
+ children: /* @__PURE__ */ jsx32(Busy, { busy: pending, label: t("common.sending"), children: t("verifyEmail.resendSubmit") })
2697
2796
  }
2698
2797
  )
2699
2798
  ] })
@@ -2704,17 +2803,17 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2704
2803
 
2705
2804
  // src/components/PasskeyManager.tsx
2706
2805
  import * as React23 from "react";
2707
- import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
2806
+ import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
2708
2807
  function PasskeyManager({ title, allowAdd = true } = {}) {
2709
2808
  const t = useT();
2710
2809
  const { user, isLoaded, isSignedIn } = useUser();
2711
2810
  if (!isLoaded) {
2712
- return /* @__PURE__ */ jsx32("div", { className: "ba-form", "data-testid": "passkey-manager-loading", "aria-busy": "true", children: /* @__PURE__ */ jsx32("div", { className: "ba-skeleton" }) });
2811
+ return /* @__PURE__ */ jsx33("div", { className: "ba-form", "data-testid": "passkey-manager-loading", "aria-busy": "true", children: /* @__PURE__ */ jsx33("div", { className: "ba-skeleton" }) });
2713
2812
  }
2714
2813
  if (!isSignedIn || !user) {
2715
- return /* @__PURE__ */ jsx32("p", { className: "ba-muted", children: t("passkeys.signedOut") });
2814
+ return /* @__PURE__ */ jsx33("p", { className: "ba-muted", children: t("passkeys.signedOut") });
2716
2815
  }
2717
- return /* @__PURE__ */ jsx32(PasskeyManagerBody, { title, allowAdd }, user.id);
2816
+ return /* @__PURE__ */ jsx33(PasskeyManagerBody, { title, allowAdd }, user.id);
2718
2817
  }
2719
2818
  function PasskeyManagerBody({
2720
2819
  title,
@@ -2763,13 +2862,13 @@ function PasskeyManagerBody({
2763
2862
  onSuccess: load
2764
2863
  });
2765
2864
  }
2766
- return /* @__PURE__ */ jsxs30("div", { className: "ba-form", "data-testid": "passkey-manager", children: [
2767
- title !== null && /* @__PURE__ */ jsx32("h2", { className: "ba-title", children: title ?? t("passkeys.title") }),
2768
- passkeys === null ? error ? null : /* @__PURE__ */ jsx32("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs30("ul", { className: "ba-passkey-list", children: [
2769
- (passkeys ?? []).map((pk) => /* @__PURE__ */ jsxs30("li", { className: "ba-passkey-item", children: [
2770
- /* @__PURE__ */ jsx32("span", { className: "ba-passkey-name", children: pk.name?.trim() || t("passkeys.unnamed") }),
2771
- /* @__PURE__ */ jsxs30("span", { className: "ba-passkey-actions", children: [
2772
- /* @__PURE__ */ jsx32(
2865
+ return /* @__PURE__ */ jsxs31("div", { className: "ba-form", "data-testid": "passkey-manager", children: [
2866
+ title !== null && /* @__PURE__ */ jsx33("h2", { className: "ba-title", children: title ?? t("passkeys.title") }),
2867
+ passkeys === null ? error ? null : /* @__PURE__ */ jsx33("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs31("ul", { className: "ba-passkey-list", children: [
2868
+ (passkeys ?? []).map((pk) => /* @__PURE__ */ jsxs31("li", { className: "ba-passkey-item", children: [
2869
+ /* @__PURE__ */ jsx33("span", { className: "ba-passkey-name", children: pk.name?.trim() || t("passkeys.unnamed") }),
2870
+ /* @__PURE__ */ jsxs31("span", { className: "ba-passkey-actions", children: [
2871
+ /* @__PURE__ */ jsx33(
2773
2872
  "button",
2774
2873
  {
2775
2874
  type: "button",
@@ -2779,7 +2878,7 @@ function PasskeyManagerBody({
2779
2878
  children: t("passkeys.rename")
2780
2879
  }
2781
2880
  ),
2782
- /* @__PURE__ */ jsx32(
2881
+ /* @__PURE__ */ jsx33(
2783
2882
  "button",
2784
2883
  {
2785
2884
  type: "button",
@@ -2791,13 +2890,13 @@ function PasskeyManagerBody({
2791
2890
  )
2792
2891
  ] })
2793
2892
  ] }, pk.id)),
2794
- passkeys !== null && passkeys.length === 0 && /* @__PURE__ */ jsx32("li", { className: "ba-muted", children: t("passkeys.empty") })
2893
+ passkeys !== null && passkeys.length === 0 && /* @__PURE__ */ jsx33("li", { className: "ba-muted", children: t("passkeys.empty") })
2795
2894
  ] }),
2796
- error && /* @__PURE__ */ jsxs30("div", { className: "ba-inline-error", children: [
2797
- /* @__PURE__ */ jsx32(FormError, { children: error }),
2798
- passkeys === null && /* @__PURE__ */ jsx32("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("userProfile.retry") })
2895
+ error && /* @__PURE__ */ jsxs31("div", { className: "ba-inline-error", children: [
2896
+ /* @__PURE__ */ jsx33(FormError, { children: error }),
2897
+ passkeys === null && /* @__PURE__ */ jsx33("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("userProfile.retry") })
2799
2898
  ] }),
2800
- passkeys !== null && allowAdd && /* @__PURE__ */ jsx32(
2899
+ passkeys !== null && allowAdd && /* @__PURE__ */ jsx33(
2801
2900
  "button",
2802
2901
  {
2803
2902
  className: "ba-button",
@@ -2808,7 +2907,7 @@ function PasskeyManagerBody({
2808
2907
  failure: t("passkeys.error.addFailed"),
2809
2908
  onSuccess: load
2810
2909
  }),
2811
- children: /* @__PURE__ */ jsx32(Busy, { busy: pending, label: t("common.working"), children: t("passkeys.add") })
2910
+ children: /* @__PURE__ */ jsx33(Busy, { busy: pending, label: t("common.working"), children: t("passkeys.add") })
2812
2911
  }
2813
2912
  )
2814
2913
  ] });
@@ -2816,14 +2915,14 @@ function PasskeyManagerBody({
2816
2915
 
2817
2916
  // src/components/control.tsx
2818
2917
  import { membershipHas } from "@authowl/core";
2819
- import { Fragment as Fragment10, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
2918
+ import { Fragment as Fragment10, jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
2820
2919
  function SignedIn({ children }) {
2821
2920
  const { isLoaded, isSignedIn } = useUser();
2822
- return isLoaded && isSignedIn ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
2921
+ return isLoaded && isSignedIn ? /* @__PURE__ */ jsx34(Fragment10, { children }) : null;
2823
2922
  }
2824
2923
  function SignedOut({ children }) {
2825
2924
  const { isLoaded, isSignedIn } = useUser();
2826
- return isLoaded && !isSignedIn ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
2925
+ return isLoaded && !isSignedIn ? /* @__PURE__ */ jsx34(Fragment10, { children }) : null;
2827
2926
  }
2828
2927
  function Protect({
2829
2928
  children,
@@ -2836,36 +2935,36 @@ function Protect({
2836
2935
  const { user, isLoaded, isSignedIn } = useUser();
2837
2936
  const membership = useSession().data?.session?.membership ?? null;
2838
2937
  if (!isLoaded) return null;
2839
- if (!isSignedIn || !user) return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
2938
+ if (!isSignedIn || !user) return /* @__PURE__ */ jsx34(Fragment10, { children: fallback });
2840
2939
  if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !membershipHas(membership, { role, permission, teamId })) {
2841
- return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
2940
+ return /* @__PURE__ */ jsx34(Fragment10, { children: fallback });
2842
2941
  }
2843
- if (condition && !condition(user)) return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
2844
- return /* @__PURE__ */ jsx33(Fragment10, { children });
2942
+ if (condition && !condition(user)) return /* @__PURE__ */ jsx34(Fragment10, { children: fallback });
2943
+ return /* @__PURE__ */ jsx34(Fragment10, { children });
2845
2944
  }
2846
2945
  function AuthLoading({ children }) {
2847
2946
  const t = useT();
2848
2947
  const { isLoaded } = useUser();
2849
2948
  if (isLoaded) return null;
2850
- if (children !== void 0) return /* @__PURE__ */ jsx33(Fragment10, { children });
2851
- return /* @__PURE__ */ jsxs31("div", { className: "ba-auth-loading", role: "status", "aria-busy": "true", "data-testid": "auth-loading", children: [
2852
- /* @__PURE__ */ jsx33(Spinner, {}),
2853
- /* @__PURE__ */ jsx33("span", { className: "ba-sr-only", children: t("common.loading") })
2949
+ if (children !== void 0) return /* @__PURE__ */ jsx34(Fragment10, { children });
2950
+ return /* @__PURE__ */ jsxs32("div", { className: "ba-auth-loading", role: "status", "aria-busy": "true", "data-testid": "auth-loading", children: [
2951
+ /* @__PURE__ */ jsx34(Spinner, {}),
2952
+ /* @__PURE__ */ jsx34("span", { className: "ba-sr-only", children: t("common.loading") })
2854
2953
  ] });
2855
2954
  }
2856
2955
  function AuthLoaded({ children }) {
2857
- return useUser().isLoaded ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
2956
+ return useUser().isLoaded ? /* @__PURE__ */ jsx34(Fragment10, { children }) : null;
2858
2957
  }
2859
2958
 
2860
2959
  // src/components/SignOutButton.tsx
2861
2960
  import * as React24 from "react";
2862
- import { jsx as jsx34 } from "react/jsx-runtime";
2961
+ import { jsx as jsx35 } from "react/jsx-runtime";
2863
2962
  function SignOutButton({ children, redirectTo, onSignedOut, className }) {
2864
2963
  const t = useT();
2865
2964
  const { signOut } = useSignOut();
2866
2965
  const [pending, setPending] = React24.useState(false);
2867
2966
  const content = children ?? t("signOut.button");
2868
- return /* @__PURE__ */ jsx34(
2967
+ return /* @__PURE__ */ jsx35(
2869
2968
  "button",
2870
2969
  {
2871
2970
  type: "button",
@@ -2883,20 +2982,20 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
2883
2982
  setPending(false);
2884
2983
  }
2885
2984
  },
2886
- children: /* @__PURE__ */ jsx34(Busy, { busy: pending, label: content, children: content })
2985
+ children: /* @__PURE__ */ jsx35(Busy, { busy: pending, label: content, children: content })
2887
2986
  }
2888
2987
  );
2889
2988
  }
2890
2989
 
2891
2990
  // src/components/UserButton.tsx
2892
- import * as React37 from "react";
2991
+ import * as React38 from "react";
2893
2992
 
2894
2993
  // src/components/UserProfile.tsx
2895
- import * as React36 from "react";
2994
+ import * as React37 from "react";
2896
2995
 
2897
2996
  // src/components/user-profile/EmailSection.tsx
2898
2997
  import * as React25 from "react";
2899
- import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
2998
+ import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
2900
2999
  function EmailSection({ allowChange }) {
2901
3000
  const t = useT();
2902
3001
  const account = useAccount();
@@ -2906,9 +3005,9 @@ function EmailSection({ allowChange }) {
2906
3005
  const [sent, setSent] = React25.useState(false);
2907
3006
  const titleId = React25.useId();
2908
3007
  if (!user?.email) {
2909
- return /* @__PURE__ */ jsxs32("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
2910
- /* @__PURE__ */ jsx35("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
2911
- /* @__PURE__ */ jsx35("p", { className: "ba-muted", children: t("userProfile.email.unavailable") })
3008
+ return /* @__PURE__ */ jsxs33("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3009
+ /* @__PURE__ */ jsx36("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
3010
+ /* @__PURE__ */ jsx36("p", { className: "ba-muted", children: t("userProfile.email.unavailable") })
2912
3011
  ] });
2913
3012
  }
2914
3013
  const submit = (event) => {
@@ -2928,19 +3027,19 @@ function EmailSection({ allowChange }) {
2928
3027
  }
2929
3028
  );
2930
3029
  };
2931
- return /* @__PURE__ */ jsxs32("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
2932
- /* @__PURE__ */ jsxs32("header", { className: "ba-profile-section-header", children: [
2933
- /* @__PURE__ */ jsx35("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
2934
- /* @__PURE__ */ jsx35("p", { className: "ba-muted", children: t("userProfile.email.description") })
3030
+ return /* @__PURE__ */ jsxs33("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3031
+ /* @__PURE__ */ jsxs33("header", { className: "ba-profile-section-header", children: [
3032
+ /* @__PURE__ */ jsx36("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
3033
+ /* @__PURE__ */ jsx36("p", { className: "ba-muted", children: t("userProfile.email.description") })
2935
3034
  ] }),
2936
- /* @__PURE__ */ jsxs32("p", { className: "ba-profile-current", children: [
2937
- /* @__PURE__ */ jsx35("span", { children: t("userProfile.email.current") }),
2938
- /* @__PURE__ */ jsx35("strong", { children: /* @__PURE__ */ jsx35(Bidi, { children: user.email }) })
3035
+ /* @__PURE__ */ jsxs33("p", { className: "ba-profile-current", children: [
3036
+ /* @__PURE__ */ jsx36("span", { children: t("userProfile.email.current") }),
3037
+ /* @__PURE__ */ jsx36("strong", { children: /* @__PURE__ */ jsx36(Bidi, { children: user.email }) })
2939
3038
  ] }),
2940
- !allowChange ? /* @__PURE__ */ jsx35("p", { className: "ba-muted", "data-testid": "email-change-disabled", children: t("userProfile.email.changeDisabled") }) : /* @__PURE__ */ jsxs32("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
2941
- /* @__PURE__ */ jsxs32("label", { className: "ba-label", children: [
3039
+ !allowChange ? /* @__PURE__ */ jsx36("p", { className: "ba-muted", "data-testid": "email-change-disabled", children: t("userProfile.email.changeDisabled") }) : /* @__PURE__ */ jsxs33("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3040
+ /* @__PURE__ */ jsxs33("label", { className: "ba-label", children: [
2942
3041
  t("userProfile.email.newLabel"),
2943
- /* @__PURE__ */ jsx35(
3042
+ /* @__PURE__ */ jsx36(
2944
3043
  "input",
2945
3044
  {
2946
3045
  className: "ba-input",
@@ -2952,16 +3051,16 @@ function EmailSection({ allowChange }) {
2952
3051
  }
2953
3052
  )
2954
3053
  ] }),
2955
- /* @__PURE__ */ jsx35(FormError, { children: error }),
2956
- sent && /* @__PURE__ */ jsx35("p", { className: "ba-success", role: "status", children: t("userProfile.email.sent") }),
2957
- /* @__PURE__ */ jsx35(
3054
+ /* @__PURE__ */ jsx36(FormError, { children: error }),
3055
+ sent && /* @__PURE__ */ jsx36("p", { className: "ba-success", role: "status", children: t("userProfile.email.sent") }),
3056
+ /* @__PURE__ */ jsx36(
2958
3057
  "button",
2959
3058
  {
2960
3059
  className: "ba-button ba-profile-submit",
2961
3060
  type: "submit",
2962
3061
  disabled: pending || !newEmail.trim(),
2963
3062
  "aria-busy": pending || void 0,
2964
- children: /* @__PURE__ */ jsx35(Busy, { busy: pending, label: t("common.sending"), children: t("userProfile.email.submit") })
3063
+ children: /* @__PURE__ */ jsx36(Busy, { busy: pending, label: t("common.sending"), children: t("userProfile.email.submit") })
2965
3064
  }
2966
3065
  )
2967
3066
  ] })
@@ -2970,7 +3069,7 @@ function EmailSection({ allowChange }) {
2970
3069
 
2971
3070
  // src/components/user-profile/DeleteAccountSection.tsx
2972
3071
  import * as React26 from "react";
2973
- import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
3072
+ import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
2974
3073
  function DeleteAccountSection({ onDeleted }) {
2975
3074
  const t = useT();
2976
3075
  const account = useAccount();
@@ -2995,18 +3094,18 @@ function DeleteAccountSection({ onDeleted }) {
2995
3094
  }
2996
3095
  );
2997
3096
  };
2998
- return /* @__PURE__ */ jsxs33("section", { className: "ba-profile-section ba-profile-danger-zone", "aria-labelledby": titleId, children: [
2999
- /* @__PURE__ */ jsxs33("header", { className: "ba-profile-section-header", children: [
3000
- /* @__PURE__ */ jsx36("h2", { id: titleId, className: "ba-title", children: t("userProfile.delete.title") }),
3001
- /* @__PURE__ */ jsx36("p", { className: "ba-muted", children: t("userProfile.delete.description") })
3097
+ return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section ba-profile-danger-zone", "aria-labelledby": titleId, children: [
3098
+ /* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
3099
+ /* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.delete.title") }),
3100
+ /* @__PURE__ */ jsx37("p", { className: "ba-muted", children: t("userProfile.delete.description") })
3002
3101
  ] }),
3003
- /* @__PURE__ */ jsxs33("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3004
- /* @__PURE__ */ jsx36("p", { className: "ba-profile-delete-warning", children: t("userProfile.delete.warning", { identifier }) }),
3005
- /* @__PURE__ */ jsxs33("label", { className: "ba-label", children: [
3102
+ /* @__PURE__ */ jsxs34("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3103
+ /* @__PURE__ */ jsx37("p", { className: "ba-profile-delete-warning", children: t("userProfile.delete.warning", { identifier }) }),
3104
+ /* @__PURE__ */ jsxs34("label", { className: "ba-label", children: [
3006
3105
  t("userProfile.delete.confirmLabel"),
3007
3106
  " ",
3008
- /* @__PURE__ */ jsx36(Bidi, { children: identifier }),
3009
- /* @__PURE__ */ jsx36(
3107
+ /* @__PURE__ */ jsx37(Bidi, { children: identifier }),
3108
+ /* @__PURE__ */ jsx37(
3010
3109
  "input",
3011
3110
  {
3012
3111
  className: "ba-input",
@@ -3020,15 +3119,15 @@ function DeleteAccountSection({ onDeleted }) {
3020
3119
  }
3021
3120
  )
3022
3121
  ] }),
3023
- /* @__PURE__ */ jsx36(FormError, { children: error }),
3024
- /* @__PURE__ */ jsx36(
3122
+ /* @__PURE__ */ jsx37(FormError, { children: error }),
3123
+ /* @__PURE__ */ jsx37(
3025
3124
  "button",
3026
3125
  {
3027
3126
  className: "ba-button ba-danger-button ba-profile-submit",
3028
3127
  type: "submit",
3029
3128
  disabled: pending || !confirmed,
3030
3129
  "aria-busy": pending || void 0,
3031
- children: /* @__PURE__ */ jsx36(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.delete.submit") })
3130
+ children: /* @__PURE__ */ jsx37(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.delete.submit") })
3032
3131
  }
3033
3132
  )
3034
3133
  ] })
@@ -3037,7 +3136,7 @@ function DeleteAccountSection({ onDeleted }) {
3037
3136
 
3038
3137
  // src/components/user-profile/MfaSection.tsx
3039
3138
  import * as React27 from "react";
3040
- import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
3139
+ import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
3041
3140
  function MfaSection() {
3042
3141
  const t = useT();
3043
3142
  const { user } = useUser();
@@ -3050,12 +3149,12 @@ function MfaSection() {
3050
3149
  const titleId = React27.useId();
3051
3150
  const required = resolveProjectCapabilities(config).mfaRequired;
3052
3151
  if (!user?.twoFactorEnabled) {
3053
- return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3054
- /* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
3055
- /* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
3056
- /* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredDescription") : t("userProfile.mfa.description") })
3152
+ return /* @__PURE__ */ jsxs35("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3153
+ /* @__PURE__ */ jsxs35("header", { className: "ba-profile-section-header", children: [
3154
+ /* @__PURE__ */ jsx38("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
3155
+ /* @__PURE__ */ jsx38("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredDescription") : t("userProfile.mfa.description") })
3057
3156
  ] }),
3058
- /* @__PURE__ */ jsx37(
3157
+ /* @__PURE__ */ jsx38(
3059
3158
  MFAEnrollment,
3060
3159
  {
3061
3160
  title: null,
@@ -3078,16 +3177,16 @@ function MfaSection() {
3078
3177
  }
3079
3178
  );
3080
3179
  };
3081
- return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3082
- /* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
3083
- /* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
3084
- /* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredActive") : t("userProfile.mfa.active") })
3180
+ return /* @__PURE__ */ jsxs35("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3181
+ /* @__PURE__ */ jsxs35("header", { className: "ba-profile-section-header", children: [
3182
+ /* @__PURE__ */ jsx38("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
3183
+ /* @__PURE__ */ jsx38("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredActive") : t("userProfile.mfa.active") })
3085
3184
  ] }),
3086
- /* @__PURE__ */ jsxs34("div", { className: "ba-profile-status", role: "status", children: [
3087
- /* @__PURE__ */ jsx37("strong", { children: t("userProfile.mfa.enabled") }),
3088
- /* @__PURE__ */ jsx37("span", { children: t("userProfile.mfa.authenticator") })
3185
+ /* @__PURE__ */ jsxs35("div", { className: "ba-profile-status", role: "status", children: [
3186
+ /* @__PURE__ */ jsx38("strong", { children: t("userProfile.mfa.enabled") }),
3187
+ /* @__PURE__ */ jsx38("span", { children: t("userProfile.mfa.authenticator") })
3089
3188
  ] }),
3090
- !showDisable ? /* @__PURE__ */ jsx37(
3189
+ !showDisable ? /* @__PURE__ */ jsx38(
3091
3190
  "button",
3092
3191
  {
3093
3192
  className: "ba-button ba-button-secondary ba-profile-submit",
@@ -3095,11 +3194,11 @@ function MfaSection() {
3095
3194
  onClick: () => setShowDisable(true),
3096
3195
  children: required ? t("userProfile.mfa.replace") : t("userProfile.mfa.disable")
3097
3196
  }
3098
- ) : /* @__PURE__ */ jsxs34("form", { method: "post", className: "ba-fields ba-profile-security-form", onSubmit: submitDisable, children: [
3099
- /* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.replaceWarning") : t("userProfile.mfa.disableWarning") }),
3100
- /* @__PURE__ */ jsxs34("label", { className: "ba-label", children: [
3197
+ ) : /* @__PURE__ */ jsxs35("form", { method: "post", className: "ba-fields ba-profile-security-form", onSubmit: submitDisable, children: [
3198
+ /* @__PURE__ */ jsx38("p", { className: "ba-muted", children: required ? t("userProfile.mfa.replaceWarning") : t("userProfile.mfa.disableWarning") }),
3199
+ /* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
3101
3200
  t("common.passwordLabel"),
3102
- /* @__PURE__ */ jsx37(
3201
+ /* @__PURE__ */ jsx38(
3103
3202
  "input",
3104
3203
  {
3105
3204
  className: "ba-input",
@@ -3111,19 +3210,19 @@ function MfaSection() {
3111
3210
  }
3112
3211
  )
3113
3212
  ] }),
3114
- /* @__PURE__ */ jsx37(FormError, { children: error }),
3115
- /* @__PURE__ */ jsxs34("span", { className: "ba-profile-action-row", children: [
3116
- /* @__PURE__ */ jsx37(
3213
+ /* @__PURE__ */ jsx38(FormError, { children: error }),
3214
+ /* @__PURE__ */ jsxs35("span", { className: "ba-profile-action-row", children: [
3215
+ /* @__PURE__ */ jsx38(
3117
3216
  "button",
3118
3217
  {
3119
3218
  className: "ba-button ba-danger-button",
3120
3219
  type: "submit",
3121
3220
  disabled: pending || !password,
3122
3221
  "aria-busy": pending || void 0,
3123
- children: /* @__PURE__ */ jsx37(Busy, { busy: pending, label: t("common.working"), children: required ? t("userProfile.mfa.replaceConfirm") : t("userProfile.mfa.disableConfirm") })
3222
+ children: /* @__PURE__ */ jsx38(Busy, { busy: pending, label: t("common.working"), children: required ? t("userProfile.mfa.replaceConfirm") : t("userProfile.mfa.disableConfirm") })
3124
3223
  }
3125
3224
  ),
3126
- /* @__PURE__ */ jsx37(
3225
+ /* @__PURE__ */ jsx38(
3127
3226
  "button",
3128
3227
  {
3129
3228
  className: "ba-button ba-button-secondary",
@@ -3143,7 +3242,7 @@ function MfaSection() {
3143
3242
 
3144
3243
  // src/components/user-profile/PasswordSection.tsx
3145
3244
  import * as React28 from "react";
3146
- import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
3245
+ import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
3147
3246
  function PasswordSection() {
3148
3247
  const t = useT();
3149
3248
  const account = useAccount();
@@ -3179,43 +3278,43 @@ function PasswordSection() {
3179
3278
  }
3180
3279
  );
3181
3280
  };
3182
- return /* @__PURE__ */ jsxs35("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3183
- /* @__PURE__ */ jsxs35("header", { className: "ba-profile-section-header", children: [
3184
- /* @__PURE__ */ jsx38("h2", { id: titleId, className: "ba-title", children: t("userProfile.password.title") }),
3185
- /* @__PURE__ */ jsx38("p", { className: "ba-muted", children: t("userProfile.password.description") })
3281
+ return /* @__PURE__ */ jsxs36("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3282
+ /* @__PURE__ */ jsxs36("header", { className: "ba-profile-section-header", children: [
3283
+ /* @__PURE__ */ jsx39("h2", { id: titleId, className: "ba-title", children: t("userProfile.password.title") }),
3284
+ /* @__PURE__ */ jsx39("p", { className: "ba-muted", children: t("userProfile.password.description") })
3186
3285
  ] }),
3187
- /* @__PURE__ */ jsxs35("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3188
- /* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
3286
+ /* @__PURE__ */ jsxs36("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3287
+ /* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
3189
3288
  t("userProfile.password.currentLabel"),
3190
- /* @__PURE__ */ jsx38("input", { className: "ba-input", type: "password", autoComplete: "current-password", value: currentPassword, onChange: (event) => {
3289
+ /* @__PURE__ */ jsx39("input", { className: "ba-input", type: "password", autoComplete: "current-password", value: currentPassword, onChange: (event) => {
3191
3290
  setCurrentPassword(event.target.value);
3192
3291
  setError(null);
3193
3292
  }, required: true })
3194
3293
  ] }),
3195
- /* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
3294
+ /* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
3196
3295
  t("resetPassword.newPasswordLabel"),
3197
- /* @__PURE__ */ jsx38("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: newPassword, onChange: (event) => {
3296
+ /* @__PURE__ */ jsx39("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: newPassword, onChange: (event) => {
3198
3297
  setNewPassword(event.target.value);
3199
3298
  setError(null);
3200
3299
  }, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
3201
3300
  ] }),
3202
- /* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
3301
+ /* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
3203
3302
  t("resetPassword.confirmPasswordLabel"),
3204
- /* @__PURE__ */ jsx38("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: confirmPassword, onChange: (event) => {
3303
+ /* @__PURE__ */ jsx39("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: confirmPassword, onChange: (event) => {
3205
3304
  setConfirmPassword(event.target.value);
3206
3305
  setError(null);
3207
3306
  }, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
3208
3307
  ] }),
3209
- /* @__PURE__ */ jsx38(FormError, { children: error }),
3210
- saved && /* @__PURE__ */ jsx38("p", { className: "ba-success", role: "status", children: t("userProfile.password.saved") }),
3211
- /* @__PURE__ */ jsx38(
3308
+ /* @__PURE__ */ jsx39(FormError, { children: error }),
3309
+ saved && /* @__PURE__ */ jsx39("p", { className: "ba-success", role: "status", children: t("userProfile.password.saved") }),
3310
+ /* @__PURE__ */ jsx39(
3212
3311
  "button",
3213
3312
  {
3214
3313
  className: "ba-button ba-profile-submit",
3215
3314
  type: "submit",
3216
3315
  disabled: pending || !currentPassword || !newPassword || !confirmPassword,
3217
3316
  "aria-busy": pending || void 0,
3218
- children: /* @__PURE__ */ jsx38(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.password.submit") })
3317
+ children: /* @__PURE__ */ jsx39(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.password.submit") })
3219
3318
  }
3220
3319
  )
3221
3320
  ] })
@@ -3224,22 +3323,22 @@ function PasswordSection() {
3224
3323
 
3225
3324
  // src/components/user-profile/PasskeysSection.tsx
3226
3325
  import * as React29 from "react";
3227
- import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
3326
+ import { jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
3228
3327
  function PasskeysSection({ allowAdd }) {
3229
3328
  const t = useT();
3230
3329
  const titleId = React29.useId();
3231
- return /* @__PURE__ */ jsxs36("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3232
- /* @__PURE__ */ jsxs36("header", { className: "ba-profile-section-header", children: [
3233
- /* @__PURE__ */ jsx39("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
3234
- /* @__PURE__ */ jsx39("p", { className: "ba-muted", children: t("userProfile.passkeys.description") })
3330
+ return /* @__PURE__ */ jsxs37("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3331
+ /* @__PURE__ */ jsxs37("header", { className: "ba-profile-section-header", children: [
3332
+ /* @__PURE__ */ jsx40("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
3333
+ /* @__PURE__ */ jsx40("p", { className: "ba-muted", children: t("userProfile.passkeys.description") })
3235
3334
  ] }),
3236
- /* @__PURE__ */ jsx39(PasskeyManager, { title: null, allowAdd })
3335
+ /* @__PURE__ */ jsx40(PasskeyManager, { title: null, allowAdd })
3237
3336
  ] });
3238
3337
  }
3239
3338
 
3240
3339
  // src/components/user-profile/ProfileSection.tsx
3241
3340
  import * as React30 from "react";
3242
- import { Fragment as Fragment11, jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
3341
+ import { Fragment as Fragment11, jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
3243
3342
  function ProfileSection({
3244
3343
  firstLastName,
3245
3344
  usernameEnabled,
@@ -3281,15 +3380,15 @@ function ProfileSection({
3281
3380
  }
3282
3381
  );
3283
3382
  };
3284
- return /* @__PURE__ */ jsxs37("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3285
- /* @__PURE__ */ jsxs37("header", { className: "ba-profile-section-header", children: [
3286
- /* @__PURE__ */ jsx40("h2", { id: titleId, className: "ba-title", children: t("userProfile.profile.title") }),
3287
- /* @__PURE__ */ jsx40("p", { className: "ba-muted", children: t("userProfile.profile.description") })
3383
+ return /* @__PURE__ */ jsxs38("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3384
+ /* @__PURE__ */ jsxs38("header", { className: "ba-profile-section-header", children: [
3385
+ /* @__PURE__ */ jsx41("h2", { id: titleId, className: "ba-title", children: t("userProfile.profile.title") }),
3386
+ /* @__PURE__ */ jsx41("p", { className: "ba-muted", children: t("userProfile.profile.description") })
3288
3387
  ] }),
3289
- /* @__PURE__ */ jsxs37("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3290
- legacyNameField && /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
3388
+ /* @__PURE__ */ jsxs38("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3389
+ legacyNameField && /* @__PURE__ */ jsxs38("label", { className: "ba-label", children: [
3291
3390
  t("signUp.nameLabel"),
3292
- /* @__PURE__ */ jsx40(
3391
+ /* @__PURE__ */ jsx41(
3293
3392
  "input",
3294
3393
  {
3295
3394
  className: "ba-input",
@@ -3300,10 +3399,10 @@ function ProfileSection({
3300
3399
  }
3301
3400
  )
3302
3401
  ] }),
3303
- firstLastName && /* @__PURE__ */ jsxs37(Fragment11, { children: [
3304
- /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
3402
+ firstLastName && /* @__PURE__ */ jsxs38(Fragment11, { children: [
3403
+ /* @__PURE__ */ jsxs38("label", { className: "ba-label", children: [
3305
3404
  t("signUp.firstNameLabel"),
3306
- /* @__PURE__ */ jsx40(
3405
+ /* @__PURE__ */ jsx41(
3307
3406
  "input",
3308
3407
  {
3309
3408
  className: "ba-input",
@@ -3313,9 +3412,9 @@ function ProfileSection({
3313
3412
  }
3314
3413
  )
3315
3414
  ] }),
3316
- /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
3415
+ /* @__PURE__ */ jsxs38("label", { className: "ba-label", children: [
3317
3416
  t("signUp.lastNameLabel"),
3318
- /* @__PURE__ */ jsx40(
3417
+ /* @__PURE__ */ jsx41(
3319
3418
  "input",
3320
3419
  {
3321
3420
  className: "ba-input",
@@ -3326,9 +3425,9 @@ function ProfileSection({
3326
3425
  )
3327
3426
  ] })
3328
3427
  ] }),
3329
- usernameEnabled && /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
3428
+ usernameEnabled && /* @__PURE__ */ jsxs38("label", { className: "ba-label", children: [
3330
3429
  t("common.usernameLabel"),
3331
- /* @__PURE__ */ jsx40(
3430
+ /* @__PURE__ */ jsx41(
3332
3431
  "input",
3333
3432
  {
3334
3433
  className: "ba-input",
@@ -3338,9 +3437,9 @@ function ProfileSection({
3338
3437
  }
3339
3438
  )
3340
3439
  ] }),
3341
- /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
3440
+ /* @__PURE__ */ jsxs38("label", { className: "ba-label", children: [
3342
3441
  t("userProfile.profile.imageLabel"),
3343
- /* @__PURE__ */ jsx40(
3442
+ /* @__PURE__ */ jsx41(
3344
3443
  "input",
3345
3444
  {
3346
3445
  className: "ba-input",
@@ -3351,16 +3450,16 @@ function ProfileSection({
3351
3450
  }
3352
3451
  )
3353
3452
  ] }),
3354
- /* @__PURE__ */ jsx40(FormError, { children: error }),
3355
- saved && /* @__PURE__ */ jsx40("p", { className: "ba-success", role: "status", children: t("userProfile.profile.saved") }),
3356
- /* @__PURE__ */ jsx40(
3453
+ /* @__PURE__ */ jsx41(FormError, { children: error }),
3454
+ saved && /* @__PURE__ */ jsx41("p", { className: "ba-success", role: "status", children: t("userProfile.profile.saved") }),
3455
+ /* @__PURE__ */ jsx41(
3357
3456
  "button",
3358
3457
  {
3359
3458
  className: "ba-button ba-profile-submit",
3360
3459
  type: "submit",
3361
3460
  disabled: pending || legacyNameField && !name.trim(),
3362
3461
  "aria-busy": pending || void 0,
3363
- children: /* @__PURE__ */ jsx40(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.save") })
3462
+ children: /* @__PURE__ */ jsx41(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.save") })
3364
3463
  }
3365
3464
  )
3366
3465
  ] })
@@ -3369,24 +3468,24 @@ function ProfileSection({
3369
3468
 
3370
3469
  // src/components/user-profile/RecoverySection.tsx
3371
3470
  import * as React31 from "react";
3372
- import { Fragment as Fragment12, jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
3471
+ import { Fragment as Fragment12, jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
3373
3472
  function RecoverySection() {
3374
3473
  const t = useT();
3375
3474
  const { user } = useUser();
3376
3475
  const titleId = React31.useId();
3377
- return /* @__PURE__ */ jsxs38("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3378
- /* @__PURE__ */ jsxs38("header", { className: "ba-profile-section-header", children: [
3379
- /* @__PURE__ */ jsx41("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
3380
- /* @__PURE__ */ jsx41("p", { className: "ba-muted", children: t("userProfile.recovery.description") })
3476
+ return /* @__PURE__ */ jsxs39("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3477
+ /* @__PURE__ */ jsxs39("header", { className: "ba-profile-section-header", children: [
3478
+ /* @__PURE__ */ jsx42("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
3479
+ /* @__PURE__ */ jsx42("p", { className: "ba-muted", children: t("userProfile.recovery.description") })
3381
3480
  ] }),
3382
- /* @__PURE__ */ jsxs38("div", { className: "ba-profile-recovery-card", children: [
3383
- /* @__PURE__ */ jsx41("strong", { children: t("userProfile.recovery.emailTitle") }),
3384
- user?.email && user.emailVerified ? /* @__PURE__ */ jsxs38(Fragment12, { children: [
3385
- /* @__PURE__ */ jsx41("p", { children: t("userProfile.recovery.emailDescription") }),
3386
- /* @__PURE__ */ jsx41(Bidi, { children: user.email })
3387
- ] }) : /* @__PURE__ */ jsx41("p", { children: t("userProfile.recovery.emailUnavailable") })
3481
+ /* @__PURE__ */ jsxs39("div", { className: "ba-profile-recovery-card", children: [
3482
+ /* @__PURE__ */ jsx42("strong", { children: t("userProfile.recovery.emailTitle") }),
3483
+ user?.email && user.emailVerified ? /* @__PURE__ */ jsxs39(Fragment12, { children: [
3484
+ /* @__PURE__ */ jsx42("p", { children: t("userProfile.recovery.emailDescription") }),
3485
+ /* @__PURE__ */ jsx42(Bidi, { children: user.email })
3486
+ ] }) : /* @__PURE__ */ jsx42("p", { children: t("userProfile.recovery.emailUnavailable") })
3388
3487
  ] }),
3389
- /* @__PURE__ */ jsx41(BackupCodesManager, { title: null })
3488
+ /* @__PURE__ */ jsx42(BackupCodesManager, { title: null })
3390
3489
  ] });
3391
3490
  }
3392
3491
 
@@ -3403,6 +3502,7 @@ var USER_PROFILE_SECTIONS = [
3403
3502
  "passkeys",
3404
3503
  "mfa",
3405
3504
  "recovery",
3505
+ "privacy",
3406
3506
  "danger"
3407
3507
  ];
3408
3508
  function userProfileSectionsFor(capabilities) {
@@ -3413,6 +3513,7 @@ function userProfileSectionsFor(capabilities) {
3413
3513
  if (section === "recovery") return capabilities.recovery;
3414
3514
  if (section === "danger") return capabilities.accountDeletion;
3415
3515
  if (section === "social") return capabilities.social;
3516
+ if (section === "privacy") return capabilities.privacy;
3416
3517
  return true;
3417
3518
  });
3418
3519
  }
@@ -3478,7 +3579,7 @@ function useAccountResource(loader, failure) {
3478
3579
  }
3479
3580
 
3480
3581
  // src/components/user-profile/SessionsSection.tsx
3481
- import { jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
3582
+ import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
3482
3583
  function SessionsSection() {
3483
3584
  const t = useT();
3484
3585
  const locale = useLocale();
@@ -3507,31 +3608,31 @@ function SessionsSection() {
3507
3608
  }
3508
3609
  );
3509
3610
  };
3510
- return /* @__PURE__ */ jsxs39("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3511
- /* @__PURE__ */ jsxs39("header", { className: "ba-profile-section-header", children: [
3512
- /* @__PURE__ */ jsx42("h2", { id: titleId, className: "ba-title", children: t("userProfile.sessions.title") }),
3513
- /* @__PURE__ */ jsx42("p", { className: "ba-muted", children: t("userProfile.sessions.description") })
3611
+ return /* @__PURE__ */ jsxs40("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3612
+ /* @__PURE__ */ jsxs40("header", { className: "ba-profile-section-header", children: [
3613
+ /* @__PURE__ */ jsx43("h2", { id: titleId, className: "ba-title", children: t("userProfile.sessions.title") }),
3614
+ /* @__PURE__ */ jsx43("p", { className: "ba-muted", children: t("userProfile.sessions.description") })
3514
3615
  ] }),
3515
- resource.data === null ? resource.loading ? /* @__PURE__ */ jsxs39("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: [
3516
- /* @__PURE__ */ jsx42("div", { className: "ba-skeleton" }),
3517
- /* @__PURE__ */ jsx42("div", { className: "ba-skeleton" })
3518
- ] }) : null : /* @__PURE__ */ jsxs39("ul", { className: "ba-profile-list", children: [
3616
+ resource.data === null ? resource.loading ? /* @__PURE__ */ jsxs40("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: [
3617
+ /* @__PURE__ */ jsx43("div", { className: "ba-skeleton" }),
3618
+ /* @__PURE__ */ jsx43("div", { className: "ba-skeleton" })
3619
+ ] }) : null : /* @__PURE__ */ jsxs40("ul", { className: "ba-profile-list", children: [
3519
3620
  sessions.map((session) => {
3520
3621
  const label2 = session.userAgent?.trim() || t("userProfile.sessions.unknownDevice");
3521
- return /* @__PURE__ */ jsxs39("li", { className: "ba-profile-list-item", children: [
3522
- /* @__PURE__ */ jsxs39("span", { children: [
3523
- /* @__PURE__ */ jsx42("strong", { children: label2 }),
3524
- /* @__PURE__ */ jsxs39("small", { children: [
3525
- session.id === currentId && /* @__PURE__ */ jsx42("em", { children: t("userProfile.sessions.current") }),
3622
+ return /* @__PURE__ */ jsxs40("li", { className: "ba-profile-list-item", children: [
3623
+ /* @__PURE__ */ jsxs40("span", { children: [
3624
+ /* @__PURE__ */ jsx43("strong", { children: label2 }),
3625
+ /* @__PURE__ */ jsxs40("small", { children: [
3626
+ session.id === currentId && /* @__PURE__ */ jsx43("em", { children: t("userProfile.sessions.current") }),
3526
3627
  formatSessionTime(session.updatedAt, locale)
3527
3628
  ] })
3528
3629
  ] }),
3529
- /* @__PURE__ */ jsx42("button", { className: "ba-link-button ba-danger", type: "button", disabled: mutation.pending, onClick: () => revoke(session.id, label2), children: t("userProfile.sessions.revoke") })
3630
+ /* @__PURE__ */ jsx43("button", { className: "ba-link-button ba-danger", type: "button", disabled: mutation.pending, onClick: () => revoke(session.id, label2), children: t("userProfile.sessions.revoke") })
3530
3631
  ] }, session.id);
3531
3632
  }),
3532
- sessions.length === 0 && /* @__PURE__ */ jsx42("li", { className: "ba-muted", children: t("userProfile.sessions.empty") })
3633
+ sessions.length === 0 && /* @__PURE__ */ jsx43("li", { className: "ba-muted", children: t("userProfile.sessions.empty") })
3533
3634
  ] }),
3534
- sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ jsx42(
3635
+ sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ jsx43(
3535
3636
  "button",
3536
3637
  {
3537
3638
  className: "ba-button ba-button-secondary ba-profile-submit",
@@ -3547,17 +3648,17 @@ function SessionsSection() {
3547
3648
  children: t("userProfile.sessions.revokeOthers")
3548
3649
  }
3549
3650
  ),
3550
- resource.error && /* @__PURE__ */ jsxs39("div", { className: "ba-profile-inline-error", children: [
3551
- /* @__PURE__ */ jsx42(FormError, { children: resource.error }),
3552
- /* @__PURE__ */ jsx42("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
3651
+ resource.error && /* @__PURE__ */ jsxs40("div", { className: "ba-profile-inline-error", children: [
3652
+ /* @__PURE__ */ jsx43(FormError, { children: resource.error }),
3653
+ /* @__PURE__ */ jsx43("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
3553
3654
  ] }),
3554
- /* @__PURE__ */ jsx42(FormError, { children: mutation.error })
3655
+ /* @__PURE__ */ jsx43(FormError, { children: mutation.error })
3555
3656
  ] });
3556
3657
  }
3557
3658
 
3558
3659
  // src/components/user-profile/SocialSection.tsx
3559
3660
  import * as React34 from "react";
3560
- import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
3661
+ import { jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
3561
3662
  function providerLabel(provider) {
3562
3663
  return provider.charAt(0).toUpperCase() + provider.slice(1);
3563
3664
  }
@@ -3597,18 +3698,18 @@ function SocialSection() {
3597
3698
  { failure: t("userProfile.social.unlinkError"), onSuccess: resource.load }
3598
3699
  );
3599
3700
  };
3600
- return /* @__PURE__ */ jsxs40("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3601
- /* @__PURE__ */ jsxs40("header", { className: "ba-profile-section-header", children: [
3602
- /* @__PURE__ */ jsx43("h2", { id: titleId, className: "ba-title", children: t("userProfile.social.title") }),
3603
- /* @__PURE__ */ jsx43("p", { className: "ba-muted", children: t("userProfile.social.description") })
3701
+ return /* @__PURE__ */ jsxs41("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3702
+ /* @__PURE__ */ jsxs41("header", { className: "ba-profile-section-header", children: [
3703
+ /* @__PURE__ */ jsx44("h2", { id: titleId, className: "ba-title", children: t("userProfile.social.title") }),
3704
+ /* @__PURE__ */ jsx44("p", { className: "ba-muted", children: t("userProfile.social.description") })
3604
3705
  ] }),
3605
- resource.data === null ? resource.loading ? /* @__PURE__ */ jsx43("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: /* @__PURE__ */ jsx43("div", { className: "ba-skeleton" }) }) : null : /* @__PURE__ */ jsxs40("ul", { className: "ba-profile-list", children: [
3606
- linked.map((item) => /* @__PURE__ */ jsxs40("li", { className: "ba-profile-list-item", children: [
3607
- /* @__PURE__ */ jsxs40("span", { children: [
3608
- /* @__PURE__ */ jsx43("strong", { children: providerLabel(item.providerId) }),
3609
- /* @__PURE__ */ jsx43("small", { children: item.canUnlink ? t("userProfile.social.connected") : t("userProfile.social.lastMethod") })
3706
+ resource.data === null ? resource.loading ? /* @__PURE__ */ jsx44("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: /* @__PURE__ */ jsx44("div", { className: "ba-skeleton" }) }) : null : /* @__PURE__ */ jsxs41("ul", { className: "ba-profile-list", children: [
3707
+ linked.map((item) => /* @__PURE__ */ jsxs41("li", { className: "ba-profile-list-item", children: [
3708
+ /* @__PURE__ */ jsxs41("span", { children: [
3709
+ /* @__PURE__ */ jsx44("strong", { children: providerLabel(item.providerId) }),
3710
+ /* @__PURE__ */ jsx44("small", { children: item.canUnlink ? t("userProfile.social.connected") : t("userProfile.social.lastMethod") })
3610
3711
  ] }),
3611
- /* @__PURE__ */ jsx43(
3712
+ /* @__PURE__ */ jsx44(
3612
3713
  "button",
3613
3714
  {
3614
3715
  className: "ba-link-button ba-danger",
@@ -3623,23 +3724,23 @@ function SocialSection() {
3623
3724
  }
3624
3725
  )
3625
3726
  ] }, item.id)),
3626
- linked.length === 0 && /* @__PURE__ */ jsx43("li", { className: "ba-muted", children: t("userProfile.social.empty") })
3727
+ linked.length === 0 && /* @__PURE__ */ jsx44("li", { className: "ba-muted", children: t("userProfile.social.empty") })
3627
3728
  ] }),
3628
- available.length > 0 && /* @__PURE__ */ jsxs40("div", { className: "ba-profile-provider-actions", children: [
3629
- /* @__PURE__ */ jsx43("p", { className: "ba-profile-subtitle", children: t("userProfile.social.add") }),
3630
- available.map((provider) => /* @__PURE__ */ jsx43("button", { type: "button", className: "ba-button ba-button-secondary", disabled: mutation.pending, onClick: () => link(provider), children: t("userProfile.social.connectProvider", { provider: providerLabel(provider) }) }, provider))
3729
+ available.length > 0 && /* @__PURE__ */ jsxs41("div", { className: "ba-profile-provider-actions", children: [
3730
+ /* @__PURE__ */ jsx44("p", { className: "ba-profile-subtitle", children: t("userProfile.social.add") }),
3731
+ available.map((provider) => /* @__PURE__ */ jsx44("button", { type: "button", className: "ba-button ba-button-secondary", disabled: mutation.pending, onClick: () => link(provider), children: t("userProfile.social.connectProvider", { provider: providerLabel(provider) }) }, provider))
3631
3732
  ] }),
3632
- resource.error && /* @__PURE__ */ jsxs40("div", { className: "ba-profile-inline-error", children: [
3633
- /* @__PURE__ */ jsx43(FormError, { children: resource.error }),
3634
- /* @__PURE__ */ jsx43("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
3733
+ resource.error && /* @__PURE__ */ jsxs41("div", { className: "ba-profile-inline-error", children: [
3734
+ /* @__PURE__ */ jsx44(FormError, { children: resource.error }),
3735
+ /* @__PURE__ */ jsx44("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
3635
3736
  ] }),
3636
- /* @__PURE__ */ jsx43(FormError, { children: mutation.error })
3737
+ /* @__PURE__ */ jsx44(FormError, { children: mutation.error })
3637
3738
  ] });
3638
3739
  }
3639
3740
 
3640
3741
  // src/components/user-profile/UserProfileModal.tsx
3641
3742
  import * as React35 from "react";
3642
- import { jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
3743
+ import { jsx as jsx45, jsxs as jsxs42 } from "react/jsx-runtime";
3643
3744
  function UserProfileModal({
3644
3745
  children,
3645
3746
  onClose,
@@ -3647,7 +3748,7 @@ function UserProfileModal({
3647
3748
  }) {
3648
3749
  const t = useT();
3649
3750
  const titleId = React35.useId();
3650
- return /* @__PURE__ */ jsxs41(
3751
+ return /* @__PURE__ */ jsxs42(
3651
3752
  ModalSurface,
3652
3753
  {
3653
3754
  overlayClassName: "ba-profile-overlay",
@@ -3656,13 +3757,13 @@ function UserProfileModal({
3656
3757
  testId: "user-profile-modal",
3657
3758
  onClose,
3658
3759
  children: [
3659
- /* @__PURE__ */ jsxs41("div", { className: "ba-profile-modal-header", children: [
3660
- /* @__PURE__ */ jsxs41("span", { children: [
3760
+ /* @__PURE__ */ jsxs42("div", { className: "ba-profile-modal-header", children: [
3761
+ /* @__PURE__ */ jsxs42("span", { children: [
3661
3762
  branding,
3662
- /* @__PURE__ */ jsx44("h1", { id: titleId, children: t("userProfile.title") }),
3663
- /* @__PURE__ */ jsx44("p", { children: t("userProfile.description") })
3763
+ /* @__PURE__ */ jsx45("h1", { id: titleId, children: t("userProfile.title") }),
3764
+ /* @__PURE__ */ jsx45("p", { children: t("userProfile.description") })
3664
3765
  ] }),
3665
- /* @__PURE__ */ jsx44(
3766
+ /* @__PURE__ */ jsx45(
3666
3767
  "button",
3667
3768
  {
3668
3769
  type: "button",
@@ -3670,7 +3771,7 @@ function UserProfileModal({
3670
3771
  "aria-label": t("userProfile.close"),
3671
3772
  onClick: onClose,
3672
3773
  autoFocus: true,
3673
- children: /* @__PURE__ */ jsx44("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx44(
3774
+ children: /* @__PURE__ */ jsx45("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx45(
3674
3775
  "path",
3675
3776
  {
3676
3777
  d: "M6 6l12 12M18 6L6 18",
@@ -3683,14 +3784,39 @@ function UserProfileModal({
3683
3784
  )
3684
3785
  ] }),
3685
3786
  children,
3686
- /* @__PURE__ */ jsx44("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx44(AuthOwlBadge, {}) })
3787
+ /* @__PURE__ */ jsx45("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx45(AuthOwlBadge, {}) })
3788
+ ]
3789
+ }
3790
+ );
3791
+ }
3792
+
3793
+ // src/components/PrivacyCenter.tsx
3794
+ import * as React36 from "react";
3795
+ import { jsx as jsx46, jsxs as jsxs43 } from "react/jsx-runtime";
3796
+ var PrivacyCenterContent = React36.lazy(async () => {
3797
+ const module = await import("./PrivacyCenterContent-EQEXXSLA.js");
3798
+ return { default: module.PrivacyCenterContent };
3799
+ });
3800
+ function PrivacyCenter(props = {}) {
3801
+ return /* @__PURE__ */ jsx46(React36.Suspense, { fallback: /* @__PURE__ */ jsx46(PrivacyCenterFallback, { className: props.className }), children: /* @__PURE__ */ jsx46(PrivacyCenterContent, { ...props }) });
3802
+ }
3803
+ function PrivacyCenterFallback({ className }) {
3804
+ return /* @__PURE__ */ jsxs43(
3805
+ "section",
3806
+ {
3807
+ className: ["ba-profile-section ba-privacy-center", className].filter(Boolean).join(" "),
3808
+ "aria-busy": "true",
3809
+ children: [
3810
+ /* @__PURE__ */ jsx46("div", { className: "ba-skeleton" }),
3811
+ /* @__PURE__ */ jsx46("div", { className: "ba-skeleton" }),
3812
+ /* @__PURE__ */ jsx46("div", { className: "ba-skeleton" })
3687
3813
  ]
3688
3814
  }
3689
3815
  );
3690
3816
  }
3691
3817
 
3692
3818
  // src/components/UserProfile.tsx
3693
- import { jsx as jsx45, jsxs as jsxs42 } from "react/jsx-runtime";
3819
+ import { jsx as jsx47, jsxs as jsxs44 } from "react/jsx-runtime";
3694
3820
  var SECTION_KEYS = {
3695
3821
  profile: "userProfile.nav.profile",
3696
3822
  email: "userProfile.nav.email",
@@ -3700,6 +3826,7 @@ var SECTION_KEYS = {
3700
3826
  passkeys: "userProfile.nav.passkeys",
3701
3827
  mfa: "userProfile.nav.mfa",
3702
3828
  recovery: "userProfile.nav.recovery",
3829
+ privacy: "userProfile.nav.privacy",
3703
3830
  danger: "userProfile.nav.danger"
3704
3831
  };
3705
3832
  function initialSection(fallback) {
@@ -3719,7 +3846,7 @@ function UserProfile(props = {}) {
3719
3846
  const t = useT();
3720
3847
  const { user, isLoaded, isSignedIn } = useUser();
3721
3848
  const { config } = usePublicConfig();
3722
- const [internalSection, setInternalSection] = React36.useState(() => initialSection(defaultSection));
3849
+ const [internalSection, setInternalSection] = React37.useState(() => initialSection(defaultSection));
3723
3850
  const active = section ?? internalSection;
3724
3851
  const capabilities = resolveProjectCapabilities(config);
3725
3852
  const passwordEnabled = config !== null && capabilities.passwordSignIn;
@@ -3728,18 +3855,20 @@ function UserProfile(props = {}) {
3728
3855
  const recoveryEnabled = capabilities.backupCodes && user?.twoFactorEnabled === true;
3729
3856
  const deletionEnabled = capabilities.accountDeletion;
3730
3857
  const socialEnabled = (config?.socialProviders?.length ?? 0) > 0;
3731
- const sections = React36.useMemo(
3858
+ const privacyEnabled = config?.privacy !== void 0;
3859
+ const sections = React37.useMemo(
3732
3860
  () => userProfileSectionsFor({
3733
3861
  password: passwordEnabled,
3734
3862
  passkeys: passkeysEnabled,
3735
3863
  mfa: mfaEnabled,
3736
3864
  recovery: recoveryEnabled,
3737
3865
  accountDeletion: deletionEnabled,
3738
- social: socialEnabled
3866
+ social: socialEnabled,
3867
+ privacy: privacyEnabled
3739
3868
  }),
3740
- [deletionEnabled, mfaEnabled, passkeysEnabled, passwordEnabled, recoveryEnabled, socialEnabled]
3869
+ [deletionEnabled, mfaEnabled, passkeysEnabled, passwordEnabled, privacyEnabled, recoveryEnabled, socialEnabled]
3741
3870
  );
3742
- React36.useEffect(() => {
3871
+ React37.useEffect(() => {
3743
3872
  if (section || mode !== "page") return;
3744
3873
  const onHashChange = () => {
3745
3874
  const next = userProfileSectionFromHash(window.location.hash);
@@ -3756,11 +3885,11 @@ function UserProfile(props = {}) {
3756
3885
  window.history.replaceState(null, "", userProfileSectionHash(next));
3757
3886
  }
3758
3887
  };
3759
- const content = !isLoaded ? /* @__PURE__ */ jsxs42("div", { className: "ba-profile-loading", "aria-busy": "true", children: [
3760
- /* @__PURE__ */ jsx45("div", { className: "ba-skeleton" }),
3761
- /* @__PURE__ */ jsx45("div", { className: "ba-skeleton" }),
3762
- /* @__PURE__ */ jsx45("div", { className: "ba-skeleton" })
3763
- ] }) : !isSignedIn || !user ? /* @__PURE__ */ jsx45("p", { className: "ba-muted", children: t("userProfile.signedOut") }) : /* @__PURE__ */ jsx45(
3888
+ const content = !isLoaded ? /* @__PURE__ */ jsxs44("div", { className: "ba-profile-loading", "aria-busy": "true", children: [
3889
+ /* @__PURE__ */ jsx47("div", { className: "ba-skeleton" }),
3890
+ /* @__PURE__ */ jsx47("div", { className: "ba-skeleton" }),
3891
+ /* @__PURE__ */ jsx47("div", { className: "ba-skeleton" })
3892
+ ] }) : !isSignedIn || !user ? /* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("userProfile.signedOut") }) : /* @__PURE__ */ jsx47(
3764
3893
  UserProfileBody,
3765
3894
  {
3766
3895
  active: visibleActive,
@@ -3772,23 +3901,23 @@ function UserProfile(props = {}) {
3772
3901
  user.id
3773
3902
  );
3774
3903
  if (props.mode === "modal") {
3775
- return /* @__PURE__ */ jsx45(
3904
+ return /* @__PURE__ */ jsx47(
3776
3905
  UserProfileModal,
3777
3906
  {
3778
3907
  onClose: props.onClose,
3779
- branding: showBranding ? /* @__PURE__ */ jsx45(AuthOwlBranding, {}) : null,
3908
+ branding: showBranding ? /* @__PURE__ */ jsx47(AuthOwlBranding, {}) : null,
3780
3909
  children: content
3781
3910
  }
3782
3911
  );
3783
3912
  }
3784
- return /* @__PURE__ */ jsxs42("article", { className: "ba-profile ba-profile-page", "data-testid": "user-profile", children: [
3785
- /* @__PURE__ */ jsxs42("header", { className: "ba-profile-heading", children: [
3786
- showBranding ? /* @__PURE__ */ jsx45(AuthOwlBranding, {}) : null,
3787
- /* @__PURE__ */ jsx45("h1", { children: t("userProfile.title") }),
3788
- /* @__PURE__ */ jsx45("p", { children: t("userProfile.description") })
3913
+ return /* @__PURE__ */ jsxs44("article", { className: "ba-profile ba-profile-page", "data-testid": "user-profile", children: [
3914
+ /* @__PURE__ */ jsxs44("header", { className: "ba-profile-heading", children: [
3915
+ showBranding ? /* @__PURE__ */ jsx47(AuthOwlBranding, {}) : null,
3916
+ /* @__PURE__ */ jsx47("h1", { children: t("userProfile.title") }),
3917
+ /* @__PURE__ */ jsx47("p", { children: t("userProfile.description") })
3789
3918
  ] }),
3790
3919
  content,
3791
- /* @__PURE__ */ jsx45("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx45(AuthOwlBadge, {}) })
3920
+ /* @__PURE__ */ jsx47("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx47(AuthOwlBadge, {}) })
3792
3921
  ] });
3793
3922
  }
3794
3923
  function UserProfileBody({
@@ -3799,8 +3928,8 @@ function UserProfileBody({
3799
3928
  capabilities
3800
3929
  }) {
3801
3930
  const t = useT();
3802
- return /* @__PURE__ */ jsxs42("div", { className: "ba-profile-layout", children: [
3803
- /* @__PURE__ */ jsx45("nav", { className: "ba-profile-nav", "aria-label": t("userProfile.nav.aria"), children: sections.map((item) => /* @__PURE__ */ jsx45(
3931
+ return /* @__PURE__ */ jsxs44("div", { className: "ba-profile-layout", children: [
3932
+ /* @__PURE__ */ jsx47("nav", { className: "ba-profile-nav", "aria-label": t("userProfile.nav.aria"), children: sections.map((item) => /* @__PURE__ */ jsx47(
3804
3933
  "button",
3805
3934
  {
3806
3935
  type: "button",
@@ -3811,8 +3940,8 @@ function UserProfileBody({
3811
3940
  },
3812
3941
  item
3813
3942
  )) }),
3814
- /* @__PURE__ */ jsxs42("div", { className: "ba-profile-content", "data-section": active, children: [
3815
- active === "profile" && /* @__PURE__ */ jsx45(
3943
+ /* @__PURE__ */ jsxs44("div", { className: "ba-profile-content", "data-section": active, children: [
3944
+ active === "profile" && /* @__PURE__ */ jsx47(
3816
3945
  ProfileSection,
3817
3946
  {
3818
3947
  firstLastName: capabilities.firstLastName,
@@ -3820,40 +3949,41 @@ function UserProfileBody({
3820
3949
  legacyNameField: capabilities.legacyNameField
3821
3950
  }
3822
3951
  ),
3823
- active === "email" && /* @__PURE__ */ jsx45(EmailSection, { allowChange: capabilities.emailChange }),
3824
- active === "password" && /* @__PURE__ */ jsx45(PasswordSection, {}),
3825
- active === "social" && /* @__PURE__ */ jsx45(SocialSection, {}),
3826
- active === "sessions" && /* @__PURE__ */ jsx45(SessionsSection, {}),
3827
- active === "passkeys" && /* @__PURE__ */ jsx45(PasskeysSection, { allowAdd: capabilities.passkeyAdd }),
3828
- active === "mfa" && /* @__PURE__ */ jsx45(MfaSection, {}),
3829
- active === "recovery" && /* @__PURE__ */ jsx45(RecoverySection, {}),
3830
- active === "danger" && /* @__PURE__ */ jsx45(DeleteAccountSection, { onDeleted })
3952
+ active === "email" && /* @__PURE__ */ jsx47(EmailSection, { allowChange: capabilities.emailChange }),
3953
+ active === "password" && /* @__PURE__ */ jsx47(PasswordSection, {}),
3954
+ active === "social" && /* @__PURE__ */ jsx47(SocialSection, {}),
3955
+ active === "sessions" && /* @__PURE__ */ jsx47(SessionsSection, {}),
3956
+ active === "passkeys" && /* @__PURE__ */ jsx47(PasskeysSection, { allowAdd: capabilities.passkeyAdd }),
3957
+ active === "mfa" && /* @__PURE__ */ jsx47(MfaSection, {}),
3958
+ active === "recovery" && /* @__PURE__ */ jsx47(RecoverySection, {}),
3959
+ active === "privacy" && /* @__PURE__ */ jsx47(PrivacyCenter, {}),
3960
+ active === "danger" && /* @__PURE__ */ jsx47(DeleteAccountSection, { onDeleted })
3831
3961
  ] })
3832
3962
  ] });
3833
3963
  }
3834
3964
 
3835
3965
  // src/components/UserButton.tsx
3836
- import { jsx as jsx46, jsxs as jsxs43 } from "react/jsx-runtime";
3966
+ import { jsx as jsx48, jsxs as jsxs45 } from "react/jsx-runtime";
3837
3967
  function UserButton() {
3838
3968
  const t = useT();
3839
3969
  const { user, isLoaded } = useUser();
3840
3970
  const { signOut } = useSignOut();
3841
- const [open, setOpen] = React37.useState(false);
3842
- const [profileOpen, setProfileOpen] = React37.useState(false);
3843
- const [failedImage, setFailedImage] = React37.useState(null);
3844
- const triggerRef = React37.useRef(null);
3971
+ const [open, setOpen] = React38.useState(false);
3972
+ const [profileOpen, setProfileOpen] = React38.useState(false);
3973
+ const [failedImage, setFailedImage] = React38.useState(null);
3974
+ const triggerRef = React38.useRef(null);
3845
3975
  if (!isLoaded || !user) return null;
3846
3976
  const identity = user.email ?? user.phoneNumber ?? user.name ?? "?";
3847
3977
  const image = user.image ?? null;
3848
- return /* @__PURE__ */ jsxs43("div", { className: "ba-user-button", "data-testid": "user-button", children: [
3849
- /* @__PURE__ */ jsx46(
3978
+ return /* @__PURE__ */ jsxs45("div", { className: "ba-user-button", "data-testid": "user-button", children: [
3979
+ /* @__PURE__ */ jsx48(
3850
3980
  "button",
3851
3981
  {
3852
3982
  ref: triggerRef,
3853
3983
  className: "ba-user-button-trigger",
3854
3984
  "aria-label": t("userButton.openMenuAria"),
3855
3985
  onClick: () => setOpen((v) => !v),
3856
- children: image && failedImage !== image ? /* @__PURE__ */ jsx46(
3986
+ children: image && failedImage !== image ? /* @__PURE__ */ jsx48(
3857
3987
  "img",
3858
3988
  {
3859
3989
  className: "ba-avatar",
@@ -3862,12 +3992,12 @@ function UserButton() {
3862
3992
  referrerPolicy: "no-referrer",
3863
3993
  onError: () => setFailedImage(image)
3864
3994
  }
3865
- ) : /* @__PURE__ */ jsx46("span", { className: "ba-avatar ba-avatar-fallback", children: identity[0]?.toUpperCase() })
3995
+ ) : /* @__PURE__ */ jsx48("span", { className: "ba-avatar ba-avatar-fallback", children: identity[0]?.toUpperCase() })
3866
3996
  }
3867
3997
  ),
3868
- open && /* @__PURE__ */ jsxs43("div", { className: "ba-menu", children: [
3869
- /* @__PURE__ */ jsx46("p", { className: "ba-menu-label", children: identity }),
3870
- /* @__PURE__ */ jsx46(
3998
+ open && /* @__PURE__ */ jsxs45("div", { className: "ba-menu", children: [
3999
+ /* @__PURE__ */ jsx48("p", { className: "ba-menu-label", children: identity }),
4000
+ /* @__PURE__ */ jsx48(
3871
4001
  "button",
3872
4002
  {
3873
4003
  className: "ba-menu-item",
@@ -3878,10 +4008,10 @@ function UserButton() {
3878
4008
  children: t("userButton.manageAccount")
3879
4009
  }
3880
4010
  ),
3881
- /* @__PURE__ */ jsx46("button", { className: "ba-menu-item", onClick: () => signOut(), children: t("userButton.signOut") }),
3882
- /* @__PURE__ */ jsx46("div", { className: "ba-menu-badge", children: /* @__PURE__ */ jsx46(AuthOwlBadge, {}) })
4011
+ /* @__PURE__ */ jsx48("button", { className: "ba-menu-item", onClick: () => signOut(), children: t("userButton.signOut") }),
4012
+ /* @__PURE__ */ jsx48("div", { className: "ba-menu-badge", children: /* @__PURE__ */ jsx48(AuthOwlBadge, {}) })
3883
4013
  ] }),
3884
- profileOpen && /* @__PURE__ */ jsx46(
4014
+ profileOpen && /* @__PURE__ */ jsx48(
3885
4015
  UserProfile,
3886
4016
  {
3887
4017
  mode: "modal",
@@ -3897,961 +4027,35 @@ function UserButton() {
3897
4027
  }
3898
4028
 
3899
4029
  // src/components/OrganizationSwitcher.tsx
3900
- import * as React45 from "react";
3901
-
3902
- // src/components/CreateOrganization.tsx
3903
- import * as React38 from "react";
3904
- import { jsx as jsx47, jsxs as jsxs44 } from "react/jsx-runtime";
3905
- function CreateOrganization({ onCreated, title } = {}) {
3906
- const t = useT();
3907
- const { config, isLoading: configLoading } = usePublicConfig();
3908
- const { isLoaded, isSignedIn } = useUser();
3909
- const api = useAuthClient().organization;
3910
- const { pending, error, run } = useSubmitAction();
3911
- const [name, setName] = React38.useState("");
3912
- const [slug, setSlug] = React38.useState("");
3913
- const [logo, setLogo] = React38.useState("");
3914
- const [slugTouched, setSlugTouched] = React38.useState(false);
3915
- if (configLoading || !isLoaded) {
3916
- return /* @__PURE__ */ jsx47("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
3917
- }
3918
- if (config?.organizations !== true) return null;
3919
- if (!isSignedIn) return /* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("organization.signedOut") });
3920
- const submit = (event) => {
3921
- event.preventDefault();
3922
- const normalizedName = name.trim();
3923
- const normalizedSlug = slug.trim();
3924
- if (!normalizedName || !normalizedSlug) return;
3925
- void run(
3926
- () => api.create({
3927
- name: normalizedName,
3928
- slug: normalizedSlug,
3929
- logo: logo.trim() || null
3930
- }),
3931
- {
3932
- failure: t("organization.create.error"),
3933
- onSuccess: (result) => {
3934
- if (!result.data) return;
3935
- setName("");
3936
- setSlug("");
3937
- setLogo("");
3938
- setSlugTouched(false);
3939
- onCreated?.(result.data);
3940
- }
3941
- }
3942
- );
3943
- };
3944
- return /* @__PURE__ */ jsxs44("section", { className: "ba-organization-create", children: [
3945
- title !== null && /* @__PURE__ */ jsxs44("header", { className: "ba-organization-section-header", children: [
3946
- /* @__PURE__ */ jsx47("h2", { className: "ba-title", children: title ?? t("organization.create.title") }),
3947
- /* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("organization.create.description") })
3948
- ] }),
3949
- /* @__PURE__ */ jsxs44("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3950
- /* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
3951
- t("organization.create.name"),
3952
- /* @__PURE__ */ jsx47(
3953
- "input",
3954
- {
3955
- className: "ba-input",
3956
- value: name,
3957
- onChange: (event) => {
3958
- const next = event.target.value;
3959
- setName(next);
3960
- if (!slugTouched) setSlug(organizationSlugFromName(next));
3961
- },
3962
- autoComplete: "organization",
3963
- required: true
3964
- }
3965
- )
3966
- ] }),
3967
- /* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
3968
- t("organization.create.slug"),
3969
- /* @__PURE__ */ jsx47(
3970
- "input",
3971
- {
3972
- className: "ba-input",
3973
- dir: "ltr",
3974
- value: slug,
3975
- onChange: (event) => {
3976
- setSlugTouched(true);
3977
- setSlug(organizationSlugFromName(event.target.value));
3978
- },
3979
- pattern: "[a-z0-9]+(?:-[a-z0-9]+)*",
3980
- required: true
3981
- }
3982
- )
3983
- ] }),
3984
- /* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
3985
- t("organization.create.logo"),
3986
- /* @__PURE__ */ jsx47(
3987
- "input",
3988
- {
3989
- className: "ba-input",
3990
- type: "url",
3991
- dir: "ltr",
3992
- value: logo,
3993
- onChange: (event) => setLogo(event.target.value),
3994
- placeholder: "https://"
3995
- }
3996
- )
3997
- ] }),
3998
- /* @__PURE__ */ jsx47(FormError, { children: error }),
3999
- /* @__PURE__ */ jsx47(
4000
- "button",
4001
- {
4002
- className: "ba-button ba-profile-submit",
4003
- type: "submit",
4004
- disabled: pending || !name.trim() || !slug.trim(),
4005
- "aria-busy": pending || void 0,
4006
- children: /* @__PURE__ */ jsx47(Busy, { busy: pending, label: t("common.working"), children: t("organization.create.submit") })
4007
- }
4008
- )
4009
- ] })
4010
- ] });
4011
- }
4012
-
4013
- // src/components/organization/OrganizationModal.tsx
4014
4030
  import * as React39 from "react";
4015
- import { jsx as jsx48, jsxs as jsxs45 } from "react/jsx-runtime";
4016
- function OrganizationModal({
4017
- title,
4018
- onClose,
4019
- returnFocusRef,
4020
- children
4021
- }) {
4022
- const t = useT();
4023
- const titleId = React39.useId();
4024
- return /* @__PURE__ */ jsxs45(
4025
- ModalSurface,
4031
+ import { jsx as jsx49 } from "react/jsx-runtime";
4032
+ var OrganizationSwitcherContent = React39.lazy(async () => {
4033
+ const module = await import("./OrganizationSwitcherContent-2TJ76HZM.js");
4034
+ return { default: module.OrganizationSwitcherContent };
4035
+ });
4036
+ function OrganizationSwitcher(props = {}) {
4037
+ return /* @__PURE__ */ jsx49(
4038
+ React39.Suspense,
4026
4039
  {
4027
- overlayClassName: "ba-organization-overlay",
4028
- panelClassName: "ba-organization-modal",
4029
- labelledBy: titleId,
4030
- returnFocusRef,
4031
- onClose,
4032
- children: [
4033
- /* @__PURE__ */ jsxs45("div", { className: "ba-organization-modal-header", children: [
4034
- /* @__PURE__ */ jsx48("h2", { id: titleId, className: "ba-title", children: title }),
4035
- /* @__PURE__ */ jsx48(
4036
- "button",
4037
- {
4038
- className: "ba-profile-close",
4039
- type: "button",
4040
- "aria-label": t("organization.close"),
4041
- onClick: onClose,
4042
- autoFocus: true,
4043
- children: "\xD7"
4044
- }
4045
- )
4046
- ] }),
4047
- /* @__PURE__ */ jsx48("div", { className: "ba-organization-modal-body", children })
4048
- ]
4040
+ fallback: /* @__PURE__ */ jsx49("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-busy": "true" }),
4041
+ children: /* @__PURE__ */ jsx49(OrganizationSwitcherContent, { ...props })
4049
4042
  }
4050
4043
  );
4051
4044
  }
4052
4045
 
4053
- // src/components/organization/use-organizations-resource.ts
4046
+ // src/components/OrganizationList.tsx
4054
4047
  import * as React40 from "react";
4055
- function useOrganizationsResource(enabled = true) {
4056
- const api = useAuthClient().organization;
4057
- const apiRef = React40.useRef(api);
4058
- apiRef.current = api;
4059
- const { user, isLoaded, isSignedIn } = useUser();
4060
- const t = useT();
4061
- const toServerError = useServerError();
4062
- const [organizations, setOrganizations] = React40.useState(null);
4063
- const [error, setError] = React40.useState(null);
4064
- const requestRef = React40.useRef(0);
4065
- const identity = user?.id ?? null;
4066
- const refresh = React40.useCallback(async () => {
4067
- const token = ++requestRef.current;
4068
- if (!enabled || !identity || !isSignedIn) {
4069
- setOrganizations([]);
4070
- setError(null);
4071
- return;
4072
- }
4073
- try {
4074
- const result = await apiRef.current.list();
4075
- if (token !== requestRef.current) return;
4076
- if (result.error) {
4077
- setError(toServerError(result.error, t("organization.error.load")));
4078
- return;
4079
- }
4080
- setError(null);
4081
- setOrganizations(result.data ?? []);
4082
- } catch {
4083
- if (token === requestRef.current) setError(t("organization.error.load"));
4084
- }
4085
- }, [enabled, identity, isSignedIn, t, toServerError]);
4086
- React40.useEffect(() => {
4087
- setOrganizations(null);
4088
- setError(null);
4089
- if (!isLoaded) return;
4090
- void refresh();
4091
- return () => {
4092
- requestRef.current += 1;
4093
- };
4094
- }, [identity, isLoaded, refresh]);
4095
- React40.useEffect(
4096
- () => api.subscribe(() => void refresh()),
4097
- [api, refresh]
4098
- );
4099
- return {
4100
- organizations,
4101
- isLoading: !isLoaded || organizations === null && error === null,
4102
- error,
4103
- refresh
4104
- };
4105
- }
4106
-
4107
- // src/components/OrganizationProfile.tsx
4108
- import * as React44 from "react";
4109
-
4110
- // src/components/organization/DangerSection.tsx
4111
- import * as React41 from "react";
4112
- import { jsx as jsx49, jsxs as jsxs46 } from "react/jsx-runtime";
4113
- function DangerSection({
4114
- organization,
4115
- membership,
4116
- onDeleted,
4117
- onLeft
4118
- }) {
4119
- const t = useT();
4120
- const api = useAuthClient().organization;
4121
- const session = useSession();
4122
- const { pending, error, run } = useSubmitAction();
4123
- const [confirmation, setConfirmation] = React41.useState("");
4124
- const isOwner = hasOrganizationRole(membership, "owner");
4125
- const confirmed = confirmation.trim().toLowerCase() === organization.slug.toLowerCase();
4126
- const leave = () => {
4127
- if (!window.confirm(t("organization.profile.danger.leaveConfirm", { name: organization.name }))) return;
4128
- void run(
4129
- () => api.leave({ organizationId: organization.id }),
4130
- {
4131
- failure: t("organization.profile.danger.leaveError"),
4132
- onSuccess: async () => {
4133
- await session.refetch({ query: { disableCookieCache: true } });
4134
- onLeft?.(organization);
4135
- }
4136
- }
4137
- );
4138
- };
4139
- const remove = (event) => {
4140
- event.preventDefault();
4141
- if (!confirmed) return;
4142
- void run(
4143
- () => api.delete({ organizationId: organization.id }),
4144
- {
4145
- failure: t("organization.profile.danger.deleteError"),
4146
- onSuccess: async () => {
4147
- await session.refetch({ query: { disableCookieCache: true } });
4148
- onDeleted?.(organization);
4149
- }
4150
- }
4151
- );
4152
- };
4153
- return /* @__PURE__ */ jsxs46("section", { className: "ba-organization-section ba-organization-danger", children: [
4154
- /* @__PURE__ */ jsxs46("header", { className: "ba-organization-section-header", children: [
4155
- /* @__PURE__ */ jsx49("h3", { className: "ba-title", children: t("organization.profile.danger.title") }),
4156
- /* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.profile.danger.description") })
4157
- ] }),
4158
- /* @__PURE__ */ jsxs46("div", { className: "ba-organization-danger-action", children: [
4159
- /* @__PURE__ */ jsx49("strong", { children: t("organization.profile.danger.leaveTitle") }),
4160
- /* @__PURE__ */ jsx49("p", { className: "ba-muted", children: isOwner ? t("organization.profile.danger.ownerLeaveHint") : t("organization.profile.danger.leaveHint") }),
4161
- /* @__PURE__ */ jsx49("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: leave, children: t("organization.profile.danger.leave") })
4162
- ] }),
4163
- isOwner && /* @__PURE__ */ jsxs46("form", { method: "post", className: "ba-organization-danger-action ba-organization-delete", onSubmit: remove, children: [
4164
- /* @__PURE__ */ jsx49("strong", { children: t("organization.profile.danger.deleteTitle") }),
4165
- /* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.profile.danger.deleteHint") }),
4166
- /* @__PURE__ */ jsxs46("label", { className: "ba-label", children: [
4167
- t("organization.profile.danger.deleteConfirm"),
4168
- " ",
4169
- /* @__PURE__ */ jsx49(Bidi, { children: organization.slug }),
4170
- /* @__PURE__ */ jsx49("input", { className: "ba-input", dir: "ltr", value: confirmation, onChange: (event) => setConfirmation(event.target.value), autoComplete: "off", required: true })
4171
- ] }),
4172
- /* @__PURE__ */ jsx49(
4173
- "button",
4174
- {
4175
- className: "ba-button ba-danger-button",
4176
- type: "submit",
4177
- disabled: pending || !confirmed,
4178
- "aria-busy": pending || void 0,
4179
- children: /* @__PURE__ */ jsx49(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.danger.delete") })
4180
- }
4181
- )
4182
- ] }),
4183
- /* @__PURE__ */ jsx49(FormError, { children: error })
4184
- ] });
4185
- }
4186
-
4187
- // src/components/organization/GeneralSection.tsx
4188
- import * as React42 from "react";
4189
- import { jsx as jsx50, jsxs as jsxs47 } from "react/jsx-runtime";
4190
- function GeneralSection({
4191
- organization,
4192
- canManage,
4193
- onChanged
4194
- }) {
4195
- const t = useT();
4196
- const api = useAuthClient().organization;
4197
- const { pending, error, run } = useSubmitAction();
4198
- const [name, setName] = React42.useState(organization.name);
4199
- const [slug, setSlug] = React42.useState(organization.slug);
4200
- const [logo, setLogo] = React42.useState(organization.logo ?? "");
4201
- React42.useEffect(() => {
4202
- setName(organization.name);
4203
- setSlug(organization.slug);
4204
- setLogo(organization.logo ?? "");
4205
- }, [organization.id, organization.logo, organization.name, organization.slug]);
4206
- if (!canManage) {
4207
- return /* @__PURE__ */ jsxs47("section", { className: "ba-organization-section", children: [
4208
- /* @__PURE__ */ jsx50("p", { className: "ba-muted", children: t("organization.profile.general.readOnly") }),
4209
- /* @__PURE__ */ jsxs47("dl", { className: "ba-organization-facts", children: [
4210
- /* @__PURE__ */ jsxs47("div", { children: [
4211
- /* @__PURE__ */ jsx50("dt", { children: t("organization.create.name") }),
4212
- /* @__PURE__ */ jsx50("dd", { children: organization.name })
4213
- ] }),
4214
- /* @__PURE__ */ jsxs47("div", { children: [
4215
- /* @__PURE__ */ jsx50("dt", { children: t("organization.create.slug") }),
4216
- /* @__PURE__ */ jsx50("dd", { children: /* @__PURE__ */ jsx50(Bidi, { children: organization.slug }) })
4217
- ] })
4218
- ] })
4219
- ] });
4220
- }
4221
- const submit = (event) => {
4222
- event.preventDefault();
4223
- void run(
4224
- () => api.update({
4225
- organizationId: organization.id,
4226
- data: { name: name.trim(), slug: slug.trim(), logo: logo.trim() || null }
4227
- }),
4228
- {
4229
- failure: t("organization.profile.general.error"),
4230
- onSuccess: onChanged
4231
- }
4232
- );
4233
- };
4234
- return /* @__PURE__ */ jsxs47("section", { className: "ba-organization-section", children: [
4235
- /* @__PURE__ */ jsxs47("header", { className: "ba-organization-section-header", children: [
4236
- /* @__PURE__ */ jsx50("h3", { className: "ba-title", children: t("organization.profile.general.title") }),
4237
- /* @__PURE__ */ jsx50("p", { className: "ba-muted", children: t("organization.profile.general.description") })
4238
- ] }),
4239
- /* @__PURE__ */ jsxs47("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
4240
- /* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
4241
- t("organization.create.name"),
4242
- /* @__PURE__ */ jsx50("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
4243
- ] }),
4244
- /* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
4245
- t("organization.create.slug"),
4246
- /* @__PURE__ */ jsx50(
4247
- "input",
4248
- {
4249
- className: "ba-input",
4250
- dir: "ltr",
4251
- value: slug,
4252
- onChange: (event) => setSlug(organizationSlugFromName(event.target.value)),
4253
- pattern: "[a-z0-9]+(?:-[a-z0-9]+)*",
4254
- required: true
4255
- }
4256
- )
4257
- ] }),
4258
- /* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
4259
- t("organization.create.logo"),
4260
- /* @__PURE__ */ jsx50("input", { className: "ba-input", type: "url", dir: "ltr", value: logo, onChange: (event) => setLogo(event.target.value), placeholder: "https://" })
4261
- ] }),
4262
- /* @__PURE__ */ jsx50(FormError, { children: error }),
4263
- /* @__PURE__ */ jsx50(
4264
- "button",
4265
- {
4266
- className: "ba-button ba-profile-submit",
4267
- type: "submit",
4268
- disabled: pending || !name.trim() || !slug.trim(),
4269
- "aria-busy": pending || void 0,
4270
- children: /* @__PURE__ */ jsx50(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.general.save") })
4271
- }
4272
- )
4273
- ] })
4274
- ] });
4275
- }
4276
-
4277
- // src/components/organization/InvitationsSection.tsx
4278
- import * as React43 from "react";
4279
-
4280
- // src/components/organization/role-label.ts
4281
- function organizationRoleLabel(role, t) {
4282
- const roles = organizationRoles(role);
4283
- return (roles.length > 0 ? roles : [role]).map((roleKey) => {
4284
- if (roleKey === "owner") return t("organization.role.owner");
4285
- if (roleKey === "admin") return t("organization.role.admin");
4286
- if (roleKey === "member") return t("organization.role.member");
4287
- const label2 = roleKey.split(/[-_]+/).filter(Boolean).map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(" ");
4288
- return t("organization.role.custom", { role: label2 });
4289
- }).join(t("organization.role.separator"));
4290
- }
4291
-
4292
- // src/components/organization/InvitationsSection.tsx
4293
- import { jsx as jsx51, jsxs as jsxs48 } from "react/jsx-runtime";
4294
- function InvitationsSection({
4295
- organization,
4296
- onChanged
4297
- }) {
4298
- const t = useT();
4299
- const api = useAuthClient().organization;
4300
- const { pending, error, run } = useSubmitAction();
4301
- const { roles } = useOrganizationRoles(organization.id);
4302
- const [email, setEmail] = React43.useState("");
4303
- const [role, setRole] = React43.useState("member");
4304
- const invitations = organization.invitations.filter((invitation) => invitation.status === "pending");
4305
- const invite = (event) => {
4306
- event.preventDefault();
4307
- void run(
4308
- () => api.inviteMember({ organizationId: organization.id, email: email.trim(), role }),
4309
- {
4310
- failure: t("organization.profile.invitations.inviteError"),
4311
- onSuccess: async () => {
4312
- setEmail("");
4313
- await onChanged();
4314
- }
4315
- }
4316
- );
4317
- };
4318
- const cancel = (invitation) => {
4319
- if (!window.confirm(t("organization.profile.invitations.cancelConfirm", { email: invitation.email }))) return;
4320
- void run(
4321
- () => api.cancelInvitation({ invitationId: invitation.id }),
4322
- { failure: t("organization.profile.invitations.cancelError"), onSuccess: onChanged }
4323
- );
4324
- };
4325
- return /* @__PURE__ */ jsxs48("section", { className: "ba-organization-section", children: [
4326
- /* @__PURE__ */ jsxs48("header", { className: "ba-organization-section-header", children: [
4327
- /* @__PURE__ */ jsx51("h3", { className: "ba-title", children: t("organization.profile.invitations.title") }),
4328
- /* @__PURE__ */ jsx51("p", { className: "ba-muted", children: t("organization.profile.invitations.description") })
4329
- ] }),
4330
- /* @__PURE__ */ jsxs48("form", { method: "post", className: "ba-organization-invite-form", onSubmit: invite, children: [
4331
- /* @__PURE__ */ jsxs48("label", { className: "ba-label", children: [
4332
- t("organization.profile.invitations.email"),
4333
- /* @__PURE__ */ jsx51("input", { className: "ba-input", type: "email", dir: "ltr", value: email, onChange: (event) => setEmail(event.target.value), required: true })
4334
- ] }),
4335
- /* @__PURE__ */ jsxs48("label", { className: "ba-label", children: [
4336
- t("organization.profile.members.role"),
4337
- /* @__PURE__ */ jsx51("select", { className: "ba-input", value: role, onChange: (event) => setRole(event.target.value), children: roles.map((option) => /* @__PURE__ */ jsx51("option", { value: option, children: organizationRoleLabel(option, t) }, option)) })
4338
- ] }),
4339
- /* @__PURE__ */ jsx51(
4340
- "button",
4341
- {
4342
- className: "ba-button",
4343
- type: "submit",
4344
- disabled: pending || !email.trim(),
4345
- "aria-busy": pending || void 0,
4346
- children: /* @__PURE__ */ jsx51(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.invitations.invite") })
4347
- }
4348
- )
4349
- ] }),
4350
- /* @__PURE__ */ jsx51(FormError, { children: error }),
4351
- invitations.length === 0 ? /* @__PURE__ */ jsx51("p", { className: "ba-muted", children: t("organization.profile.invitations.empty") }) : /* @__PURE__ */ jsx51("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ jsxs48("li", { className: "ba-organization-invitation", children: [
4352
- /* @__PURE__ */ jsxs48("span", { children: [
4353
- /* @__PURE__ */ jsx51("strong", { children: /* @__PURE__ */ jsx51(Bidi, { children: invitation.email }) }),
4354
- /* @__PURE__ */ jsx51("small", { children: organizationRoleLabel(invitation.role, t) })
4355
- ] }),
4356
- /* @__PURE__ */ jsx51("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => cancel(invitation), children: t("organization.profile.invitations.cancel") })
4357
- ] }, invitation.id)) })
4358
- ] });
4359
- }
4360
-
4361
- // src/components/organization/MembersSection.tsx
4362
- import { jsx as jsx52, jsxs as jsxs49 } from "react/jsx-runtime";
4363
- function MembersSection({
4364
- organization,
4365
- userId,
4366
- canManage,
4367
- onChanged
4368
- }) {
4369
- const t = useT();
4370
- const api = useAuthClient().organization;
4371
- const { pending, error, run } = useSubmitAction();
4372
- const { roles } = useOrganizationRoles(organization.id);
4373
- const updateRole = (member, role) => {
4374
- const current = organizationRoles(member.role)[0] ?? member.role;
4375
- if (current === role) return;
4376
- if (!window.confirm(t("organization.profile.members.roleConfirm", { name: member.user.name, role: organizationRoleLabel(role, t) }))) return;
4377
- void run(
4378
- () => api.updateMemberRole({ organizationId: organization.id, memberId: member.id, role }),
4379
- { failure: t("organization.profile.members.roleError"), onSuccess: onChanged }
4380
- );
4381
- };
4382
- const remove = (member) => {
4383
- if (!window.confirm(t("organization.profile.members.removeConfirm", { name: member.user.name }))) return;
4384
- void run(
4385
- () => api.removeMember({ organizationId: organization.id, memberIdOrEmail: member.id }),
4386
- { failure: t("organization.profile.members.removeError"), onSuccess: onChanged }
4387
- );
4388
- };
4389
- return /* @__PURE__ */ jsxs49("section", { className: "ba-organization-section", children: [
4390
- /* @__PURE__ */ jsxs49("header", { className: "ba-organization-section-header", children: [
4391
- /* @__PURE__ */ jsx52("h3", { className: "ba-title", children: t("organization.profile.members.title") }),
4392
- /* @__PURE__ */ jsx52("p", { className: "ba-muted", children: t("organization.profile.members.description") })
4393
- ] }),
4394
- /* @__PURE__ */ jsx52(FormError, { children: error }),
4395
- /* @__PURE__ */ jsx52("ul", { className: "ba-organization-list", children: organization.members.map((member) => {
4396
- const primaryRole = organizationRoles(member.role)[0] ?? member.role;
4397
- const isCurrent = member.userId === userId;
4398
- return /* @__PURE__ */ jsxs49("li", { className: "ba-organization-member", children: [
4399
- /* @__PURE__ */ jsx52("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: member.user.name.trim().charAt(0).toUpperCase() || "?" }),
4400
- /* @__PURE__ */ jsxs49("span", { className: "ba-organization-member-copy", children: [
4401
- /* @__PURE__ */ jsxs49("strong", { children: [
4402
- member.user.name,
4403
- isCurrent ? ` ${t("organization.profile.members.you")}` : ""
4404
- ] }),
4405
- /* @__PURE__ */ jsx52("small", { children: /* @__PURE__ */ jsx52(Bidi, { children: member.user.email }) })
4406
- ] }),
4407
- canManage && !isCurrent ? /* @__PURE__ */ jsxs49("span", { className: "ba-organization-member-actions", children: [
4408
- /* @__PURE__ */ jsx52("label", { className: "ba-sr-only", htmlFor: `organization-role-${member.id}`, children: t("organization.profile.members.role") }),
4409
- /* @__PURE__ */ jsx52(
4410
- "select",
4411
- {
4412
- id: `organization-role-${member.id}`,
4413
- className: "ba-input ba-organization-role",
4414
- value: primaryRole,
4415
- disabled: pending,
4416
- onChange: (event) => updateRole(member, event.target.value),
4417
- children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */ jsx52("option", { value: role, children: organizationRoleLabel(role, t) }, role))
4418
- }
4419
- ),
4420
- /* @__PURE__ */ jsx52("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(member), children: t("organization.profile.members.remove") })
4421
- ] }) : /* @__PURE__ */ jsx52("span", { className: "ba-organization-role-label", children: /* @__PURE__ */ jsx52(Bidi, { children: organizationRoleLabel(member.role, t) }) })
4422
- ] }, member.id);
4423
- }) })
4424
- ] });
4425
- }
4426
-
4427
- // src/components/OrganizationProfile.tsx
4428
- import { jsx as jsx53, jsxs as jsxs50 } from "react/jsx-runtime";
4429
- var SECTION_KEYS2 = {
4430
- general: "organization.profile.nav.general",
4431
- members: "organization.profile.nav.members",
4432
- teams: "organization.profile.nav.teams",
4433
- invitations: "organization.profile.nav.invitations",
4434
- danger: "organization.profile.nav.danger"
4435
- };
4436
- var TeamsSection = React44.lazy(() => import("./TeamsSection-ZQDNMWV3.js"));
4437
- function OrganizationProfile({ organizationId, defaultSection = "general", onDeleted, onLeft } = {}) {
4438
- const t = useT();
4439
- const toServerError = useServerError();
4440
- const { config, isLoading: configLoading } = usePublicConfig();
4441
- const { user, isLoaded, isSignedIn } = useUser();
4442
- const session = useSession();
4443
- const api = useAuthClient().organization;
4444
- const apiRef = React44.useRef(api);
4445
- apiRef.current = api;
4446
- const activeOrganizationId = session.data?.session.activeOrganizationId ?? null;
4447
- const requestedId = organizationId ?? activeOrganizationId;
4448
- const enabled = config?.organizations === true && isSignedIn;
4449
- const [organization, setOrganization] = React44.useState(null);
4450
- const [error, setError] = React44.useState(null);
4451
- const [wasRemoved, setWasRemoved] = React44.useState(false);
4452
- const [section, setSection] = React44.useState(defaultSection);
4453
- const requestRef = React44.useRef(0);
4454
- const load = React44.useCallback(async () => {
4455
- const token = ++requestRef.current;
4456
- if (!enabled || !requestedId) {
4457
- setOrganization(null);
4458
- setError(null);
4459
- return;
4460
- }
4461
- try {
4462
- const result = await apiRef.current.get({ organizationId: requestedId });
4463
- if (token !== requestRef.current) return;
4464
- if (result.error) {
4465
- setError(toServerError(result.error, t("organization.profile.loadError")));
4466
- return;
4467
- }
4468
- setError(null);
4469
- setOrganization(result.data ?? null);
4470
- } catch {
4471
- if (token === requestRef.current) setError(t("organization.profile.loadError"));
4472
- }
4473
- }, [enabled, requestedId, t, toServerError]);
4474
- React44.useEffect(() => {
4475
- setOrganization(null);
4476
- setError(null);
4477
- setWasRemoved(false);
4478
- void load();
4479
- return () => {
4480
- requestRef.current += 1;
4481
- };
4482
- }, [load]);
4483
- if (configLoading || !isLoaded) return /* @__PURE__ */ jsx53("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
4484
- if (config?.organizations !== true) return null;
4485
- if (!isSignedIn || !user) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.signedOut") });
4486
- if (wasRemoved) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.noActive") });
4487
- if (!requestedId) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.noActive") });
4488
- if (error) {
4489
- return /* @__PURE__ */ jsxs50("div", { className: "ba-inline-error", children: [
4490
- /* @__PURE__ */ jsx53(FormError, { children: error }),
4491
- /* @__PURE__ */ jsx53("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
4492
- ] });
4493
- }
4494
- if (!organization) return /* @__PURE__ */ jsx53("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
4495
- const membership = organization.members.find((member) => member.userId === user.id);
4496
- if (!membership) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.notMember") });
4497
- const canManage = canManageOrganization(membership);
4498
- const visibleSections = canManage ? ["general", "members", "teams", "invitations", "danger"] : ["general", "members", "teams", "danger"];
4499
- const activeSection = visibleSections.includes(section) ? section : "general";
4500
- const handleRemoval = (callback) => (removedOrganization) => {
4501
- setWasRemoved(true);
4502
- setOrganization(null);
4503
- callback?.(removedOrganization);
4504
- };
4505
- return /* @__PURE__ */ jsxs50("article", { className: "ba-organization-profile", children: [
4506
- /* @__PURE__ */ jsxs50("header", { className: "ba-organization-profile-heading", children: [
4507
- /* @__PURE__ */ jsx53("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
4508
- /* @__PURE__ */ jsxs50("span", { children: [
4509
- /* @__PURE__ */ jsx53("h2", { className: "ba-title", children: organization.name }),
4510
- /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: organization.slug })
4511
- ] })
4512
- ] }),
4513
- /* @__PURE__ */ jsxs50("div", { className: "ba-organization-profile-layout", children: [
4514
- /* @__PURE__ */ jsx53("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ jsx53(
4515
- "button",
4516
- {
4517
- className: "ba-profile-nav-item",
4518
- type: "button",
4519
- "aria-current": activeSection === item ? "page" : void 0,
4520
- onClick: () => setSection(item),
4521
- children: t(SECTION_KEYS2[item])
4522
- },
4523
- item
4524
- )) }),
4525
- /* @__PURE__ */ jsxs50("div", { className: "ba-organization-profile-content", children: [
4526
- activeSection === "general" && /* @__PURE__ */ jsx53(GeneralSection, { organization, canManage, onChanged: load }),
4527
- activeSection === "members" && /* @__PURE__ */ jsx53(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
4528
- activeSection === "teams" && /* @__PURE__ */ jsx53(React44.Suspense, { fallback: null, children: /* @__PURE__ */ jsx53(TeamsSection, { organization, membership }) }),
4529
- activeSection === "invitations" && /* @__PURE__ */ jsx53(InvitationsSection, { organization, onChanged: load }),
4530
- activeSection === "danger" && /* @__PURE__ */ jsx53(
4531
- DangerSection,
4532
- {
4533
- organization,
4534
- membership,
4535
- onDeleted: handleRemoval(onDeleted),
4536
- onLeft: handleRemoval(onLeft)
4537
- }
4538
- )
4539
- ] })
4540
- ] })
4541
- ] });
4542
- }
4543
-
4544
- // src/components/OrganizationSwitcher.tsx
4545
- import { Fragment as Fragment13, jsx as jsx54, jsxs as jsxs51 } from "react/jsx-runtime";
4546
- function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChange } = {}) {
4547
- const t = useT();
4548
- const { config, isLoading: configLoading } = usePublicConfig();
4549
- const { isLoaded, isSignedIn } = useUser();
4550
- const session = useSession();
4551
- const api = useAuthClient().organization;
4552
- const enabled = config?.organizations === true && isSignedIn;
4553
- const { organizations, isLoading, error: loadError, refresh } = useOrganizationsResource(enabled);
4554
- const { pending, error, run } = useSubmitAction();
4555
- const [open, setOpen] = React45.useState(false);
4556
- const [dialog, setDialog] = React45.useState(null);
4557
- const rootRef = React45.useRef(null);
4558
- const triggerRef = React45.useRef(null);
4559
- const menuRef = React45.useRef(null);
4560
- const menuId = React45.useId();
4561
- const activeId = session.data?.session.activeOrganizationId ?? null;
4562
- const active = organizations?.find((organization) => organization.id === activeId) ?? null;
4563
- React45.useEffect(() => {
4564
- if (!open) return;
4565
- const onPointerDown = (event) => {
4566
- if (!rootRef.current?.contains(event.target)) setOpen(false);
4567
- };
4568
- const onKeyDown = (event) => {
4569
- if (event.key === "Escape") setOpen(false);
4570
- };
4571
- document.addEventListener("pointerdown", onPointerDown);
4572
- document.addEventListener("keydown", onKeyDown);
4573
- return () => {
4574
- document.removeEventListener("pointerdown", onPointerDown);
4575
- document.removeEventListener("keydown", onKeyDown);
4576
- };
4577
- }, [open]);
4578
- if (configLoading || !isLoaded) return /* @__PURE__ */ jsx54("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
4579
- if (config?.organizations !== true) return null;
4580
- if (!isSignedIn) return /* @__PURE__ */ jsx54("p", { className: "ba-muted", children: t("organization.signedOut") });
4581
- const select = (organization) => {
4582
- void run(
4583
- () => api.setActive({ organizationId: organization?.id ?? null }),
4584
- {
4585
- failure: t("organization.switcher.error"),
4586
- onSuccess: async () => {
4587
- await session.refetch({ query: { disableCookieCache: true } });
4588
- setOpen(false);
4589
- onOrganizationChange?.(organization);
4590
- }
4591
- }
4592
- );
4593
- };
4594
- const afterProfileRemoval = async () => {
4595
- await refresh();
4596
- await session.refetch({ query: { disableCookieCache: true } });
4597
- setDialog(null);
4598
- };
4599
- const focusMenuItem = (position) => {
4600
- window.requestAnimationFrame(() => {
4601
- const items = menuRef.current?.querySelectorAll('[role="menuitem"]:not([disabled])');
4602
- if (!items?.length) return;
4603
- items[position === "first" ? 0 : items.length - 1]?.focus();
4604
- });
4605
- };
4606
- const onMenuKeyDown = (event) => {
4607
- const items = [...menuRef.current?.querySelectorAll('[role="menuitem"]:not([disabled])') ?? []];
4608
- if (event.key === "Escape") {
4609
- event.preventDefault();
4610
- event.stopPropagation();
4611
- setOpen(false);
4612
- triggerRef.current?.focus();
4613
- return;
4614
- }
4615
- if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key) || items.length === 0) return;
4616
- event.preventDefault();
4617
- const current = items.indexOf(document.activeElement);
4618
- if (event.key === "Home") items[0]?.focus();
4619
- else if (event.key === "End") items.at(-1)?.focus();
4620
- else if (event.key === "ArrowDown") items[(current + 1 + items.length) % items.length]?.focus();
4621
- else items[(current - 1 + items.length) % items.length]?.focus();
4622
- };
4623
- return /* @__PURE__ */ jsxs51(Fragment13, { children: [
4624
- /* @__PURE__ */ jsxs51("div", { ref: rootRef, className: "ba-organization-switcher", children: [
4625
- /* @__PURE__ */ jsxs51(
4626
- "button",
4627
- {
4628
- ref: triggerRef,
4629
- className: "ba-organization-switcher-trigger",
4630
- type: "button",
4631
- "aria-haspopup": "menu",
4632
- "aria-expanded": open,
4633
- "aria-controls": open ? menuId : void 0,
4634
- onClick: () => setOpen((value) => !value),
4635
- onKeyDown: (event) => {
4636
- if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
4637
- event.preventDefault();
4638
- setOpen(true);
4639
- focusMenuItem(event.key === "ArrowDown" ? "first" : "last");
4640
- },
4641
- children: [
4642
- /* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
4643
- /* @__PURE__ */ jsx54("span", { children: active?.name ?? t("organization.personal") }),
4644
- /* @__PURE__ */ jsx54("span", { "aria-hidden": "true", children: "\u2304" })
4645
- ]
4646
- }
4647
- ),
4648
- open && /* @__PURE__ */ jsxs51("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
4649
- isLoading ? /* @__PURE__ */ jsx54("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs51(Fragment13, { children: [
4650
- showPersonalWorkspace && /* @__PURE__ */ jsxs51("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === null ? "true" : void 0, disabled: pending, onClick: () => select(null), children: [
4651
- /* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
4652
- /* @__PURE__ */ jsx54("span", { children: t("organization.personal") })
4653
- ] }),
4654
- organizations?.map((organization) => /* @__PURE__ */ jsxs51("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === organization.id ? "true" : void 0, disabled: pending, onClick: () => select(organization), children: [
4655
- /* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
4656
- /* @__PURE__ */ jsxs51("span", { children: [
4657
- organization.name,
4658
- /* @__PURE__ */ jsx54("small", { children: organization.slug })
4659
- ] })
4660
- ] }, organization.id))
4661
- ] }),
4662
- (loadError || error) && /* @__PURE__ */ jsxs51("div", { className: "ba-inline-error", children: [
4663
- /* @__PURE__ */ jsx54(FormError, { children: loadError ?? error }),
4664
- loadError && /* @__PURE__ */ jsx54("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
4665
- ] }),
4666
- /* @__PURE__ */ jsxs51("div", { className: "ba-organization-menu-actions", children: [
4667
- active && /* @__PURE__ */ jsx54("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
4668
- setOpen(false);
4669
- setDialog("profile");
4670
- }, children: t("organization.switcher.manage") }),
4671
- /* @__PURE__ */ jsx54("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
4672
- setOpen(false);
4673
- setDialog("create");
4674
- }, children: t("organization.switcher.create") })
4675
- ] })
4676
- ] })
4677
- ] }),
4678
- dialog === "create" && /* @__PURE__ */ jsx54(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx54(
4679
- CreateOrganization,
4680
- {
4681
- title: null,
4682
- onCreated: (organization) => {
4683
- void (async () => {
4684
- await refresh();
4685
- await session.refetch({ query: { disableCookieCache: true } });
4686
- setDialog(null);
4687
- onOrganizationChange?.(organization);
4688
- })();
4689
- }
4690
- }
4691
- ) }),
4692
- dialog === "profile" && active && /* @__PURE__ */ jsx54(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx54(OrganizationProfile, { organizationId: active.id, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
4693
- ] });
4694
- }
4695
-
4696
- // src/components/OrganizationList.tsx
4697
- import * as React46 from "react";
4698
- import { Fragment as Fragment14, jsx as jsx55, jsxs as jsxs52 } from "react/jsx-runtime";
4699
- function OrganizationList({ onOrganizationChange } = {}) {
4700
- const t = useT();
4701
- const toServerError = useServerError();
4702
- const { config, isLoading: configLoading } = usePublicConfig();
4703
- const { user, isLoaded, isSignedIn } = useUser();
4704
- const session = useSession();
4705
- const api = useAuthClient().organization;
4706
- const apiRef = React46.useRef(api);
4707
- apiRef.current = api;
4708
- const enabled = config?.organizations === true && isSignedIn;
4709
- const { organizations, isLoading, error: organizationError, refresh } = useOrganizationsResource(enabled);
4710
- const { pending, error, run } = useSubmitAction();
4711
- const [invitations, setInvitations] = React46.useState(null);
4712
- const [invitationError, setInvitationError] = React46.useState(null);
4713
- const [dialog, setDialog] = React46.useState(null);
4714
- const [profileId, setProfileId] = React46.useState(null);
4715
- const dialogReturnFocusRef = React46.useRef(null);
4716
- const invitationRequestRef = React46.useRef(0);
4717
- const activeId = session.data?.session.activeOrganizationId ?? null;
4718
- const loadInvitations = React46.useCallback(async () => {
4719
- const token = ++invitationRequestRef.current;
4720
- if (!enabled) {
4721
- setInvitations([]);
4722
- setInvitationError(null);
4723
- return;
4724
- }
4725
- try {
4726
- const result = await apiRef.current.listUserInvitations();
4727
- if (token !== invitationRequestRef.current) return;
4728
- if (result.error) {
4729
- setInvitationError(toServerError(result.error, t("organization.list.invitationsError")));
4730
- return;
4731
- }
4732
- setInvitationError(null);
4733
- setInvitations((result.data ?? []).filter((invitation) => invitation.status === "pending"));
4734
- } catch {
4735
- if (token === invitationRequestRef.current) setInvitationError(t("organization.list.invitationsError"));
4736
- }
4737
- }, [enabled, t, toServerError]);
4738
- React46.useEffect(() => {
4739
- setInvitations(null);
4740
- setInvitationError(null);
4741
- if (!isLoaded) return;
4742
- void loadInvitations();
4743
- return () => {
4744
- invitationRequestRef.current += 1;
4745
- };
4746
- }, [isLoaded, loadInvitations, user?.id]);
4747
- if (configLoading || !isLoaded) return /* @__PURE__ */ jsx55("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
4748
- if (config?.organizations !== true) return null;
4749
- if (!isSignedIn) return /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.signedOut") });
4750
- const setActive = (organization) => {
4751
- void run(
4752
- () => api.setActive({ organizationId: organization.id }),
4753
- {
4754
- failure: t("organization.switcher.error"),
4755
- onSuccess: async () => {
4756
- await session.refetch({ query: { disableCookieCache: true } });
4757
- onOrganizationChange?.(organization);
4758
- }
4759
- }
4760
- );
4761
- };
4762
- const invitationAction = (invitation, action) => {
4763
- const onSuccess = async () => {
4764
- await Promise.all([refresh(), loadInvitations()]);
4765
- if (action === "accept") await session.refetch({ query: { disableCookieCache: true } });
4766
- };
4767
- if (action === "accept") {
4768
- void run(
4769
- () => api.acceptInvitation({ invitationId: invitation.id }),
4770
- { failure: t("organization.list.acceptError"), onSuccess }
4771
- );
4772
- return;
4773
- }
4774
- void run(
4775
- () => api.rejectInvitation({ invitationId: invitation.id }),
4776
- { failure: t("organization.list.rejectError"), onSuccess }
4777
- );
4778
- };
4779
- const openProfile = (organization, trigger) => {
4780
- dialogReturnFocusRef.current = trigger;
4781
- setProfileId(organization.id);
4782
- setDialog("profile");
4783
- };
4784
- const afterProfileRemoval = async () => {
4785
- await refresh();
4786
- await session.refetch({ query: { disableCookieCache: true } });
4787
- setDialog(null);
4788
- setProfileId(null);
4789
- };
4790
- return /* @__PURE__ */ jsxs52(Fragment14, { children: [
4791
- /* @__PURE__ */ jsxs52("section", { className: "ba-organization-directory", children: [
4792
- /* @__PURE__ */ jsxs52("header", { className: "ba-organization-directory-header", children: [
4793
- /* @__PURE__ */ jsxs52("span", { children: [
4794
- /* @__PURE__ */ jsx55("h2", { className: "ba-title", children: t("organization.list.title") }),
4795
- /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.description") })
4796
- ] }),
4797
- /* @__PURE__ */ jsx55("button", { className: "ba-button", type: "button", onClick: (event) => {
4798
- dialogReturnFocusRef.current = event.currentTarget;
4799
- setDialog("create");
4800
- }, children: t("organization.switcher.create") })
4801
- ] }),
4802
- (organizationError || error) && /* @__PURE__ */ jsxs52("div", { className: "ba-inline-error", children: [
4803
- /* @__PURE__ */ jsx55(FormError, { children: organizationError ?? error }),
4804
- organizationError && /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
4805
- ] }),
4806
- isLoading ? /* @__PURE__ */ jsxs52("div", { className: "ba-organization-card-grid", children: [
4807
- /* @__PURE__ */ jsx55("div", { className: "ba-skeleton" }),
4808
- /* @__PURE__ */ jsx55("div", { className: "ba-skeleton" })
4809
- ] }) : organizations?.length ? /* @__PURE__ */ jsx55("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ jsxs52("li", { className: "ba-organization-card", children: [
4810
- /* @__PURE__ */ jsx55("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
4811
- /* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-copy", children: [
4812
- /* @__PURE__ */ jsx55("strong", { children: organization.name }),
4813
- /* @__PURE__ */ jsx55("small", { children: /* @__PURE__ */ jsx55(Bidi, { children: organization.slug }) })
4814
- ] }),
4815
- activeId === organization.id && /* @__PURE__ */ jsx55("span", { className: "ba-organization-active", children: t("organization.list.active") }),
4816
- /* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-actions", children: [
4817
- activeId !== organization.id && /* @__PURE__ */ jsx55("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
4818
- /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
4819
- ] })
4820
- ] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.empty") }),
4821
- /* @__PURE__ */ jsxs52("section", { className: "ba-organization-user-invitations", children: [
4822
- /* @__PURE__ */ jsxs52("header", { className: "ba-organization-section-header", children: [
4823
- /* @__PURE__ */ jsx55("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
4824
- /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
4825
- ] }),
4826
- invitationError && /* @__PURE__ */ jsxs52("div", { className: "ba-inline-error", children: [
4827
- /* @__PURE__ */ jsx55(FormError, { children: invitationError }),
4828
- /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
4829
- ] }),
4830
- invitations?.length ? /* @__PURE__ */ jsx55("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ jsxs52("li", { className: "ba-organization-invitation", children: [
4831
- /* @__PURE__ */ jsxs52("span", { children: [
4832
- /* @__PURE__ */ jsx55("strong", { children: invitation.organizationName }),
4833
- /* @__PURE__ */ jsx55("small", { children: organizationRoleLabel(invitation.role, t) })
4834
- ] }),
4835
- /* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-actions", children: [
4836
- /* @__PURE__ */ jsx55("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
4837
- /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
4838
- ] })
4839
- ] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */ jsx55("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
4840
- ] })
4841
- ] }),
4842
- dialog === "create" && /* @__PURE__ */ jsx55(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx55(CreateOrganization, { title: null, onCreated: () => {
4843
- void (async () => {
4844
- await refresh();
4845
- await session.refetch({ query: { disableCookieCache: true } });
4846
- setDialog(null);
4847
- })();
4848
- } }) }),
4849
- dialog === "profile" && profileId && /* @__PURE__ */ jsx55(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx55(OrganizationProfile, { organizationId: profileId, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
4850
- ] });
4048
+ import { jsx as jsx50 } from "react/jsx-runtime";
4049
+ var OrganizationListContent = React40.lazy(async () => {
4050
+ const module = await import("./OrganizationListContent-BSGDHYAC.js");
4051
+ return { default: module.OrganizationListContent };
4052
+ });
4053
+ function OrganizationList(props = {}) {
4054
+ return /* @__PURE__ */ jsx50(React40.Suspense, { fallback: /* @__PURE__ */ jsx50("div", { className: "ba-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ jsx50(OrganizationListContent, { ...props }) });
4851
4055
  }
4852
4056
 
4853
4057
  // src/components/GoogleOneTap.tsx
4854
- import * as React47 from "react";
4058
+ import * as React41 from "react";
4855
4059
 
4856
4060
  // src/components/google-one-tap.ts
4857
4061
  var GOOGLE_IDENTITY_SCRIPT = "https://accounts.google.com/gsi/client";
@@ -5000,6 +4204,14 @@ function normalizeDismissReason(reason) {
5000
4204
  }
5001
4205
  return "unknown";
5002
4206
  }
4207
+ var warnedMissingNonce = /* @__PURE__ */ new Set();
4208
+ function warnOneTapWithoutNonce(clientId) {
4209
+ if (warnedMissingNonce.has(clientId)) return;
4210
+ warnedMissingNonce.add(clientId);
4211
+ console.warn(
4212
+ "[AuthOwl] <GoogleOneTap/> is running without a `nonce`. Google\u2019s ID token is then not bound to a value chosen for this prompt. Generate a fresh random value per prompt and pass it as `nonce`; AuthOwl forwards it to Google and verifies the match. The direct browser exchange does not keep separate one-time server state, so do not treat this prop by itself as replay protection. (This warning is dev-only.)"
4213
+ );
4214
+ }
5003
4215
  function GoogleOneTap({
5004
4216
  disabled = false,
5005
4217
  nonce,
@@ -5019,11 +4231,16 @@ function GoogleOneTap({
5019
4231
  const { config, isLoading: configLoading, isError: configError } = usePublicConfig();
5020
4232
  const { user, isLoaded: sessionLoaded } = useUser();
5021
4233
  const { signInSocial } = useSignIn();
5022
- const callbacks = React47.useRef({ onSignedIn, onSkipped, onDismissed, onError });
4234
+ const callbacks = React41.useRef({ onSignedIn, onSkipped, onDismissed, onError });
5023
4235
  callbacks.current = { onSignedIn, onSkipped, onDismissed, onError };
5024
4236
  const googleEnabled = config?.socialProviders.includes("google") === true;
5025
4237
  const clientId = config?.socialProviderClientIds?.google;
5026
- React47.useEffect(() => {
4238
+ React41.useEffect(() => {
4239
+ if (process.env.NODE_ENV === "production") return;
4240
+ if (disabled || !googleEnabled || !clientId || nonce) return;
4241
+ warnOneTapWithoutNonce(clientId);
4242
+ }, [clientId, disabled, googleEnabled, nonce]);
4243
+ React41.useEffect(() => {
5027
4244
  if (configLoading || !sessionLoaded) return;
5028
4245
  if (disabled) {
5029
4246
  callbacks.current.onSkipped?.("disabled");
@@ -5170,6 +4387,7 @@ export {
5170
4387
  PasskeyButton,
5171
4388
  PasskeyManager,
5172
4389
  PhoneOTP,
4390
+ PrivacyCenter,
5173
4391
  Protect,
5174
4392
  RateLimitedError,
5175
4393
  ResetPassword,
@@ -5198,12 +4416,14 @@ export {
5198
4416
  useConsent,
5199
4417
  useEmailVerification,
5200
4418
  useInvitationRecipientHint,
4419
+ useLastUsedSignInMethod,
5201
4420
  useLocale,
5202
4421
  useMFA,
5203
4422
  useOrganization,
5204
4423
  useOrganizationInvitation,
5205
4424
  usePasskeys,
5206
4425
  usePasswordReset,
4426
+ usePrivacy,
5207
4427
  usePublicConfig,
5208
4428
  useSession,
5209
4429
  useSignIn,