@authowl/react 0.23.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,
@@ -25,9 +28,9 @@ import {
25
28
  useMFA,
26
29
  useOrganization,
27
30
  useOrganizationInvitation,
28
- useOrganizationRoles,
29
31
  usePasskeys,
30
32
  usePasswordReset,
33
+ usePrivacy,
31
34
  usePublicConfig,
32
35
  useServerError,
33
36
  useSession,
@@ -35,11 +38,10 @@ import {
35
38
  useSignInMethodRecorder,
36
39
  useSignOut,
37
40
  useSignUp,
38
- useSubmitAction,
39
41
  useT,
40
42
  useUser,
41
43
  useWaitlist
42
- } from "./chunk-E5ZOQHXY.js";
44
+ } from "./chunk-TOVDZ2ZE.js";
43
45
 
44
46
  // src/project-capabilities.ts
45
47
  import {
@@ -1736,6 +1738,7 @@ function SignIn({
1736
1738
 
1737
1739
  // src/components/SignUp.tsx
1738
1740
  import * as React17 from "react";
1741
+ import { createIdempotencyKey as createIdempotencyKey2 } from "@authowl/core";
1739
1742
 
1740
1743
  // src/components/VerificationPending.tsx
1741
1744
  import * as React14 from "react";
@@ -2040,8 +2043,53 @@ function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
2040
2043
  ] });
2041
2044
  }
2042
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
+
2043
2091
  // src/components/SignUp.tsx
2044
- 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";
2045
2093
  function SignUp({
2046
2094
  redirectTo,
2047
2095
  onSignedUp,
@@ -2051,6 +2099,7 @@ function SignUp({
2051
2099
  showBranding = true
2052
2100
  } = {}) {
2053
2101
  const t = useT();
2102
+ const locale = useLocale();
2054
2103
  const toServerError = useServerError();
2055
2104
  const { signUp } = useSignUp();
2056
2105
  const { config, isLoading, isError } = usePublicConfig();
@@ -2064,6 +2113,10 @@ function SignUp({
2064
2113
  const [error, setError] = React17.useState(null);
2065
2114
  const [submitting, setSubmitting] = React17.useState(false);
2066
2115
  const [accepted, setAccepted] = React17.useState(false);
2116
+ const [grantedPurposeCodes, setGrantedPurposeCodes] = React17.useState(
2117
+ () => /* @__PURE__ */ new Set()
2118
+ );
2119
+ const [privacyCorrelationId] = React17.useState(createIdempotencyKey2);
2067
2120
  const legal = config?.legal;
2068
2121
  const consentRequired = Boolean(legal?.required);
2069
2122
  const consentBlocked = consentRequired && !accepted;
@@ -2090,6 +2143,12 @@ function SignUp({
2090
2143
  }
2091
2144
  setSubmitting(true);
2092
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;
2093
2152
  const res = await authChallenge.run(
2094
2153
  AUTH_CHALLENGE_ACTIONS.signUp,
2095
2154
  (options) => signUp(
@@ -2103,7 +2162,8 @@ function SignUp({
2103
2162
  ...lastName.trim() ? { lastName: lastName.trim() } : {}
2104
2163
  } : {},
2105
2164
  callbackURL: verifyEmailUrl,
2106
- consentVersion: legal?.required ? legal.version : void 0
2165
+ consentVersion: legal?.required ? legal.version : void 0,
2166
+ ...privacyEvidence ? { privacyEvidence } : {}
2107
2167
  },
2108
2168
  options
2109
2169
  )
@@ -2125,21 +2185,21 @@ function SignUp({
2125
2185
  }
2126
2186
  }
2127
2187
  if (isLoading) {
2128
- return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-loading", "aria-busy": "true", children: [
2129
- /* @__PURE__ */ jsx24("div", { className: "ba-skeleton" }),
2130
- /* @__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" })
2131
2191
  ] });
2132
2192
  }
2133
2193
  if (isError) {
2134
- return /* @__PURE__ */ jsx24(PublicConfigError, { showBadge, showBranding });
2194
+ return /* @__PURE__ */ jsx25(PublicConfigError, { showBadge, showBranding });
2135
2195
  }
2136
2196
  if (config?.signUp?.mode === "waitlist") {
2137
- return /* @__PURE__ */ jsx24(Waitlist, { onJoined: onWaitlisted, showBadge, showBranding });
2197
+ return /* @__PURE__ */ jsx25(Waitlist, { onJoined: onWaitlisted, showBadge, showBranding });
2138
2198
  }
2139
2199
  if (pendingEmail) {
2140
- return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-verify-pending", children: [
2141
- showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
2142
- /* @__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(
2143
2203
  VerificationPending,
2144
2204
  {
2145
2205
  email: pendingEmail,
@@ -2147,32 +2207,33 @@ function SignUp({
2147
2207
  method: capabilities.emailVerificationMethod
2148
2208
  }
2149
2209
  ),
2150
- /* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
2210
+ /* @__PURE__ */ jsx25(AuthOwlBadge, { force: showBadge })
2151
2211
  ] });
2152
2212
  }
2153
2213
  const methods = config?.enabledMethods ?? ["password"];
2154
2214
  const publicSignupAllowed = config?.signUp?.mode !== "restricted";
2155
- const social = consentRequired || !publicSignupAllowed ? [] : config?.socialProviders ?? [];
2215
+ const exactPrivacyEvidenceRequired = (config?.privacy?.notices.length ?? 0) > 0;
2216
+ const social = consentRequired || exactPrivacyEvidenceRequired || !publicSignupAllowed ? [] : config?.socialProviders ?? [];
2156
2217
  const showPassword = publicSignupAllowed && capabilities.passwordSignIn && capabilities.emailSignUp && capabilities.passwordSignUp;
2157
- const showPasswordless = publicSignupAllowed && capabilities.emailOtpSignIn && capabilities.emailSignUp && !consentRequired && !capabilities.mfaRequired;
2218
+ const showPasswordless = publicSignupAllowed && capabilities.emailOtpSignIn && capabilities.emailSignUp && !consentRequired && !exactPrivacyEvidenceRequired && !capabilities.mfaRequired;
2158
2219
  const renderable = showPassword || showPasswordless || social.length > 0;
2159
2220
  if (completeWithPasskey) {
2160
- return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-passkey-step", children: [
2161
- showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
2162
- /* @__PURE__ */ jsx24(PasskeySignUpCompletion, { onComplete: finishSignUp }),
2163
- /* @__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 })
2164
2225
  ] });
2165
2226
  }
2166
- return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-form", children: [
2167
- showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
2168
- /* @__PURE__ */ jsx24("h2", { className: "ba-title", children: t("signUp.title") }),
2169
- /* @__PURE__ */ jsx24(InvitationBanner, {}),
2170
- /* @__PURE__ */ jsx24(SocialButtons, { providers: social, callbackURL: redirectTo }),
2171
- showPassword && social.length > 0 && /* @__PURE__ */ jsx24("div", { className: "ba-divider", children: t("common.orDivider") }),
2172
- showPassword && /* @__PURE__ */ jsxs22("form", { method: "post", onSubmit, className: "ba-fields", children: [
2173
- 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: [
2174
2235
  t("signUp.nameLabel"),
2175
- /* @__PURE__ */ jsx24(
2236
+ /* @__PURE__ */ jsx25(
2176
2237
  "input",
2177
2238
  {
2178
2239
  className: "ba-input",
@@ -2186,10 +2247,10 @@ function SignUp({
2186
2247
  }
2187
2248
  )
2188
2249
  ] }),
2189
- capabilities.firstLastName && /* @__PURE__ */ jsxs22(Fragment5, { children: [
2190
- /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2250
+ capabilities.firstLastName && /* @__PURE__ */ jsxs23(Fragment5, { children: [
2251
+ /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2191
2252
  t("signUp.firstNameLabel"),
2192
- /* @__PURE__ */ jsx24(
2253
+ /* @__PURE__ */ jsx25(
2193
2254
  "input",
2194
2255
  {
2195
2256
  className: "ba-input",
@@ -2202,9 +2263,9 @@ function SignUp({
2202
2263
  }
2203
2264
  )
2204
2265
  ] }),
2205
- /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2266
+ /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2206
2267
  t("signUp.lastNameLabel"),
2207
- /* @__PURE__ */ jsx24(
2268
+ /* @__PURE__ */ jsx25(
2208
2269
  "input",
2209
2270
  {
2210
2271
  className: "ba-input",
@@ -2218,9 +2279,9 @@ function SignUp({
2218
2279
  )
2219
2280
  ] })
2220
2281
  ] }),
2221
- capabilities.collectUsername && /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2282
+ capabilities.collectUsername && /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2222
2283
  t("common.usernameLabel"),
2223
- /* @__PURE__ */ jsx24(
2284
+ /* @__PURE__ */ jsx25(
2224
2285
  "input",
2225
2286
  {
2226
2287
  className: "ba-input",
@@ -2234,9 +2295,9 @@ function SignUp({
2234
2295
  }
2235
2296
  )
2236
2297
  ] }),
2237
- /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2298
+ /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2238
2299
  t("common.emailLabel"),
2239
- /* @__PURE__ */ jsx24(
2300
+ /* @__PURE__ */ jsx25(
2240
2301
  "input",
2241
2302
  {
2242
2303
  className: "ba-input",
@@ -2251,9 +2312,9 @@ function SignUp({
2251
2312
  }
2252
2313
  )
2253
2314
  ] }),
2254
- /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
2315
+ /* @__PURE__ */ jsxs23("label", { className: "ba-label", children: [
2255
2316
  t("common.passwordLabel"),
2256
- /* @__PURE__ */ jsx24(
2317
+ /* @__PURE__ */ jsx25(
2257
2318
  "input",
2258
2319
  {
2259
2320
  className: "ba-input",
@@ -2271,7 +2332,23 @@ function SignUp({
2271
2332
  )
2272
2333
  ] }),
2273
2334
  authChallenge.control,
2274
- 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(
2275
2352
  LegalConsentCheckbox,
2276
2353
  {
2277
2354
  legal,
@@ -2280,20 +2357,20 @@ function SignUp({
2280
2357
  testId: "signup-consent"
2281
2358
  }
2282
2359
  ),
2283
- /* @__PURE__ */ jsx24(FormError, { children: error }),
2284
- /* @__PURE__ */ jsx24(
2360
+ /* @__PURE__ */ jsx25(FormError, { children: error }),
2361
+ /* @__PURE__ */ jsx25(
2285
2362
  "button",
2286
2363
  {
2287
2364
  className: "ba-button",
2288
2365
  type: "submit",
2289
2366
  disabled: submitting || consentBlocked || authChallenge.configPending,
2290
2367
  "aria-busy": submitting || void 0,
2291
- 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") })
2292
2369
  }
2293
2370
  )
2294
2371
  ] }),
2295
- showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */ jsx24("div", { className: "ba-divider", children: t("common.orDivider") }),
2296
- showPasswordless && /* @__PURE__ */ jsx24(
2372
+ showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */ jsx25("div", { className: "ba-divider", children: t("common.orDivider") }),
2373
+ showPasswordless && /* @__PURE__ */ jsx25(
2297
2374
  PasswordlessSignUp,
2298
2375
  {
2299
2376
  onAuthenticated: () => {
@@ -2302,25 +2379,25 @@ function SignUp({
2302
2379
  }
2303
2380
  }
2304
2381
  ),
2305
- !renderable && /* @__PURE__ */ jsx24("p", { className: "ba-muted", children: publicSignupAllowed && methods.length > 0 ? t("signUp.empty.unsupported") : t("signUp.empty.none") }),
2306
- /* @__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 })
2307
2384
  ] });
2308
2385
  }
2309
2386
 
2310
2387
  // src/components/ConsentGate.tsx
2311
- 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";
2312
2389
  function ConsentGate({ children, title }) {
2313
2390
  const t = useT();
2314
2391
  const { needsConsent, status, accept } = useConsent();
2315
2392
  const { pending, error, run } = useSubmitAction();
2316
- if (!needsConsent) return /* @__PURE__ */ jsx25(Fragment6, { children });
2317
- return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "consent-gate", children: [
2318
- /* @__PURE__ */ jsx25("h2", { className: "ba-title", children: title ?? t("consent.gateTitle") }),
2319
- /* @__PURE__ */ jsx25("p", { className: "ba-muted", children: richMessage(t("consent.gateBody"), {
2320
- 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 })
2321
2398
  }) }),
2322
- /* @__PURE__ */ jsx25(FormError, { children: error }),
2323
- /* @__PURE__ */ jsx25(
2399
+ /* @__PURE__ */ jsx26(FormError, { children: error }),
2400
+ /* @__PURE__ */ jsx26(
2324
2401
  "button",
2325
2402
  {
2326
2403
  className: "ba-button",
@@ -2334,28 +2411,28 @@ function ConsentGate({ children, title }) {
2334
2411
  },
2335
2412
  { failure: t("consent.error.acceptFailed") }
2336
2413
  ),
2337
- 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") })
2338
2415
  }
2339
2416
  ),
2340
- /* @__PURE__ */ jsx25(AuthOwlBadge, {})
2417
+ /* @__PURE__ */ jsx26(AuthOwlBadge, {})
2341
2418
  ] });
2342
2419
  }
2343
2420
 
2344
2421
  // src/components/MFARequiredGate.tsx
2345
- 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";
2346
2423
  function MFARequiredGate({ children, title }) {
2347
2424
  const state = useConfirmedMfaPending();
2348
- if (state === "clear") return /* @__PURE__ */ jsx26(Fragment7, { children });
2425
+ if (state === "clear") return /* @__PURE__ */ jsx27(Fragment7, { children });
2349
2426
  if (state === "confirming") return null;
2350
- return /* @__PURE__ */ jsxs24("div", { className: "ba-form", "data-testid": "mfa-required-gate", children: [
2351
- /* @__PURE__ */ jsx26(MfaEnrollmentStep, { title }),
2352
- /* @__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, {})
2353
2430
  ] });
2354
2431
  }
2355
2432
 
2356
2433
  // src/components/BackupCodesManager.tsx
2357
2434
  import * as React18 from "react";
2358
- 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";
2359
2436
  function BackupCodesManager({ title }) {
2360
2437
  const t = useT();
2361
2438
  const { user } = useUser();
@@ -2374,20 +2451,20 @@ function BackupCodesManager({ title }) {
2374
2451
  }
2375
2452
  });
2376
2453
  };
2377
- return /* @__PURE__ */ jsxs25("div", { className: "ba-form", "data-testid": "backup-codes-manager", children: [
2378
- title !== null && /* @__PURE__ */ jsx27("h2", { className: "ba-title", children: title ?? t("backupCodes.title") }),
2379
- /* @__PURE__ */ jsx27("p", { className: "ba-muted", children: t("backupCodes.hint") }),
2380
- codes ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
2381
- /* @__PURE__ */ jsxs25("p", { className: "ba-muted", children: [
2382
- /* @__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") }),
2383
2460
  " ",
2384
2461
  t("mfa.enroll.backupCodesWarningRest")
2385
2462
  ] }),
2386
- /* @__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)) })
2387
- ] }) : /* @__PURE__ */ jsxs25("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
2388
- /* @__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: [
2389
2466
  t("common.passwordLabel"),
2390
- /* @__PURE__ */ jsx27(
2467
+ /* @__PURE__ */ jsx28(
2391
2468
  "input",
2392
2469
  {
2393
2470
  className: "ba-input",
@@ -2399,15 +2476,15 @@ function BackupCodesManager({ title }) {
2399
2476
  }
2400
2477
  )
2401
2478
  ] }),
2402
- /* @__PURE__ */ jsx27(FormError, { children: error }),
2403
- /* @__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") }) })
2404
2481
  ] })
2405
2482
  ] });
2406
2483
  }
2407
2484
 
2408
2485
  // src/components/MagicLinkForm.tsx
2409
2486
  import * as React19 from "react";
2410
- import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
2487
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
2411
2488
  function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2412
2489
  const t = useT();
2413
2490
  const { signInMagicLink } = useSignIn();
@@ -2416,9 +2493,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2416
2493
  const [email, setEmail] = React19.useState("");
2417
2494
  const [sent, setSent] = React19.useState(false);
2418
2495
  if (sent) {
2419
- 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") });
2420
2497
  }
2421
- return /* @__PURE__ */ jsxs26(
2498
+ return /* @__PURE__ */ jsxs27(
2422
2499
  "form",
2423
2500
  {
2424
2501
  method: "post",
@@ -2432,9 +2509,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2432
2509
  className: "ba-fields",
2433
2510
  "data-testid": "magiclink-form",
2434
2511
  children: [
2435
- /* @__PURE__ */ jsxs26("label", { className: "ba-label", children: [
2512
+ /* @__PURE__ */ jsxs27("label", { className: "ba-label", children: [
2436
2513
  t("common.emailLabel"),
2437
- /* @__PURE__ */ jsx28(
2514
+ /* @__PURE__ */ jsx29(
2438
2515
  "input",
2439
2516
  {
2440
2517
  className: "ba-input",
@@ -2447,15 +2524,15 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2447
2524
  )
2448
2525
  ] }),
2449
2526
  authChallenge.control,
2450
- /* @__PURE__ */ jsx28(FormError, { children: error }),
2451
- /* @__PURE__ */ jsx28(
2527
+ /* @__PURE__ */ jsx29(FormError, { children: error }),
2528
+ /* @__PURE__ */ jsx29(
2452
2529
  "button",
2453
2530
  {
2454
2531
  className: "ba-button",
2455
2532
  type: "submit",
2456
2533
  disabled: pending || authChallenge.configPending,
2457
2534
  "aria-busy": pending || void 0,
2458
- 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") })
2459
2536
  }
2460
2537
  )
2461
2538
  ]
@@ -2465,7 +2542,7 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
2465
2542
 
2466
2543
  // src/components/EmailOtpForm.tsx
2467
2544
  import * as React20 from "react";
2468
- import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
2545
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
2469
2546
  function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2470
2547
  const t = useT();
2471
2548
  const { sessionStore } = useAuthClient();
@@ -2476,7 +2553,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2476
2553
  const [otp, setOtp] = React20.useState("");
2477
2554
  const [stage, setStage] = React20.useState("email");
2478
2555
  if (stage === "code") {
2479
- return /* @__PURE__ */ jsx29(
2556
+ return /* @__PURE__ */ jsx30(
2480
2557
  OtpCodeForm,
2481
2558
  {
2482
2559
  email,
@@ -2499,7 +2576,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2499
2576
  }
2500
2577
  );
2501
2578
  }
2502
- return /* @__PURE__ */ jsxs27(
2579
+ return /* @__PURE__ */ jsxs28(
2503
2580
  "form",
2504
2581
  {
2505
2582
  method: "post",
@@ -2513,9 +2590,9 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2513
2590
  className: "ba-fields",
2514
2591
  "data-testid": "emailotp-email",
2515
2592
  children: [
2516
- /* @__PURE__ */ jsxs27("label", { className: "ba-label", children: [
2593
+ /* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
2517
2594
  t("common.emailLabel"),
2518
- /* @__PURE__ */ jsx29(
2595
+ /* @__PURE__ */ jsx30(
2519
2596
  "input",
2520
2597
  {
2521
2598
  className: "ba-input",
@@ -2531,15 +2608,15 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2531
2608
  )
2532
2609
  ] }),
2533
2610
  authChallenge.control,
2534
- /* @__PURE__ */ jsx29(FormError, { children: error }),
2535
- /* @__PURE__ */ jsx29(
2611
+ /* @__PURE__ */ jsx30(FormError, { children: error }),
2612
+ /* @__PURE__ */ jsx30(
2536
2613
  "button",
2537
2614
  {
2538
2615
  className: "ba-button",
2539
2616
  type: "submit",
2540
2617
  disabled: pending || authChallenge.configPending,
2541
2618
  "aria-busy": pending || void 0,
2542
- 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") })
2543
2620
  }
2544
2621
  )
2545
2622
  ]
@@ -2549,7 +2626,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
2549
2626
 
2550
2627
  // src/components/ResetPassword.tsx
2551
2628
  import * as React21 from "react";
2552
- import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
2629
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
2553
2630
  function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2554
2631
  const t = useT();
2555
2632
  const { resetPassword } = usePasswordReset();
@@ -2569,15 +2646,15 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2569
2646
  setReady(true);
2570
2647
  }, [tokenProp]);
2571
2648
  if (!ready) {
2572
- 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" }) });
2573
2650
  }
2574
2651
  if (!token) {
2575
- 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") });
2576
2653
  }
2577
2654
  if (done) {
2578
- 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") });
2579
2656
  }
2580
- return /* @__PURE__ */ jsxs28(
2657
+ return /* @__PURE__ */ jsxs29(
2581
2658
  "form",
2582
2659
  {
2583
2660
  method: "post",
@@ -2603,9 +2680,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2603
2680
  });
2604
2681
  },
2605
2682
  children: [
2606
- /* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
2683
+ /* @__PURE__ */ jsxs29("label", { className: "ba-label", children: [
2607
2684
  t("resetPassword.newPasswordLabel"),
2608
- /* @__PURE__ */ jsx30(
2685
+ /* @__PURE__ */ jsx31(
2609
2686
  "input",
2610
2687
  {
2611
2688
  className: "ba-input",
@@ -2622,9 +2699,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2622
2699
  }
2623
2700
  )
2624
2701
  ] }),
2625
- /* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
2702
+ /* @__PURE__ */ jsxs29("label", { className: "ba-label", children: [
2626
2703
  t("resetPassword.confirmPasswordLabel"),
2627
- /* @__PURE__ */ jsx30(
2704
+ /* @__PURE__ */ jsx31(
2628
2705
  "input",
2629
2706
  {
2630
2707
  className: "ba-input",
@@ -2641,8 +2718,8 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2641
2718
  }
2642
2719
  )
2643
2720
  ] }),
2644
- /* @__PURE__ */ jsx30(FormError, { children: error }),
2645
- /* @__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") }) })
2646
2723
  ]
2647
2724
  }
2648
2725
  );
@@ -2650,7 +2727,7 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
2650
2727
 
2651
2728
  // src/components/VerifyEmail.tsx
2652
2729
  import * as React22 from "react";
2653
- 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";
2654
2731
  function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2655
2732
  const t = useT();
2656
2733
  const { sendVerificationEmail } = useEmailVerification();
@@ -2670,12 +2747,12 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2670
2747
  }
2671
2748
  }, [onVerified, redirectTo]);
2672
2749
  if (!ready) {
2673
- 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" }) });
2674
2751
  }
2675
2752
  if (!failed) {
2676
- 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") });
2677
2754
  }
2678
- return /* @__PURE__ */ jsxs29(
2755
+ return /* @__PURE__ */ jsxs30(
2679
2756
  "form",
2680
2757
  {
2681
2758
  method: "post",
@@ -2690,11 +2767,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2690
2767
  });
2691
2768
  },
2692
2769
  children: [
2693
- /* @__PURE__ */ jsx31(FormError, { children: t("verifyEmail.invalidLink") }),
2694
- resent ? /* @__PURE__ */ jsx31("p", { className: "ba-muted", children: richMessage(t("verifyEmail.resent"), { email: /* @__PURE__ */ jsx31(Bidi, { children: email }) }) }) : /* @__PURE__ */ jsxs29(Fragment9, { children: [
2695
- /* @__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: [
2696
2773
  t("common.emailLabel"),
2697
- /* @__PURE__ */ jsx31(
2774
+ /* @__PURE__ */ jsx32(
2698
2775
  "input",
2699
2776
  {
2700
2777
  className: "ba-input",
@@ -2707,15 +2784,15 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2707
2784
  )
2708
2785
  ] }),
2709
2786
  authChallenge.control,
2710
- /* @__PURE__ */ jsx31(FormError, { children: error }),
2711
- /* @__PURE__ */ jsx31(
2787
+ /* @__PURE__ */ jsx32(FormError, { children: error }),
2788
+ /* @__PURE__ */ jsx32(
2712
2789
  "button",
2713
2790
  {
2714
2791
  className: "ba-button",
2715
2792
  type: "submit",
2716
2793
  disabled: pending || authChallenge.configPending,
2717
2794
  "aria-busy": pending || void 0,
2718
- 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") })
2719
2796
  }
2720
2797
  )
2721
2798
  ] })
@@ -2726,17 +2803,17 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
2726
2803
 
2727
2804
  // src/components/PasskeyManager.tsx
2728
2805
  import * as React23 from "react";
2729
- import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
2806
+ import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
2730
2807
  function PasskeyManager({ title, allowAdd = true } = {}) {
2731
2808
  const t = useT();
2732
2809
  const { user, isLoaded, isSignedIn } = useUser();
2733
2810
  if (!isLoaded) {
2734
- 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" }) });
2735
2812
  }
2736
2813
  if (!isSignedIn || !user) {
2737
- return /* @__PURE__ */ jsx32("p", { className: "ba-muted", children: t("passkeys.signedOut") });
2814
+ return /* @__PURE__ */ jsx33("p", { className: "ba-muted", children: t("passkeys.signedOut") });
2738
2815
  }
2739
- return /* @__PURE__ */ jsx32(PasskeyManagerBody, { title, allowAdd }, user.id);
2816
+ return /* @__PURE__ */ jsx33(PasskeyManagerBody, { title, allowAdd }, user.id);
2740
2817
  }
2741
2818
  function PasskeyManagerBody({
2742
2819
  title,
@@ -2785,13 +2862,13 @@ function PasskeyManagerBody({
2785
2862
  onSuccess: load
2786
2863
  });
2787
2864
  }
2788
- return /* @__PURE__ */ jsxs30("div", { className: "ba-form", "data-testid": "passkey-manager", children: [
2789
- title !== null && /* @__PURE__ */ jsx32("h2", { className: "ba-title", children: title ?? t("passkeys.title") }),
2790
- passkeys === null ? error ? null : /* @__PURE__ */ jsx32("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs30("ul", { className: "ba-passkey-list", children: [
2791
- (passkeys ?? []).map((pk) => /* @__PURE__ */ jsxs30("li", { className: "ba-passkey-item", children: [
2792
- /* @__PURE__ */ jsx32("span", { className: "ba-passkey-name", children: pk.name?.trim() || t("passkeys.unnamed") }),
2793
- /* @__PURE__ */ jsxs30("span", { className: "ba-passkey-actions", children: [
2794
- /* @__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(
2795
2872
  "button",
2796
2873
  {
2797
2874
  type: "button",
@@ -2801,7 +2878,7 @@ function PasskeyManagerBody({
2801
2878
  children: t("passkeys.rename")
2802
2879
  }
2803
2880
  ),
2804
- /* @__PURE__ */ jsx32(
2881
+ /* @__PURE__ */ jsx33(
2805
2882
  "button",
2806
2883
  {
2807
2884
  type: "button",
@@ -2813,13 +2890,13 @@ function PasskeyManagerBody({
2813
2890
  )
2814
2891
  ] })
2815
2892
  ] }, pk.id)),
2816
- 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") })
2817
2894
  ] }),
2818
- error && /* @__PURE__ */ jsxs30("div", { className: "ba-inline-error", children: [
2819
- /* @__PURE__ */ jsx32(FormError, { children: error }),
2820
- 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") })
2821
2898
  ] }),
2822
- passkeys !== null && allowAdd && /* @__PURE__ */ jsx32(
2899
+ passkeys !== null && allowAdd && /* @__PURE__ */ jsx33(
2823
2900
  "button",
2824
2901
  {
2825
2902
  className: "ba-button",
@@ -2830,7 +2907,7 @@ function PasskeyManagerBody({
2830
2907
  failure: t("passkeys.error.addFailed"),
2831
2908
  onSuccess: load
2832
2909
  }),
2833
- 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") })
2834
2911
  }
2835
2912
  )
2836
2913
  ] });
@@ -2838,14 +2915,14 @@ function PasskeyManagerBody({
2838
2915
 
2839
2916
  // src/components/control.tsx
2840
2917
  import { membershipHas } from "@authowl/core";
2841
- 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";
2842
2919
  function SignedIn({ children }) {
2843
2920
  const { isLoaded, isSignedIn } = useUser();
2844
- return isLoaded && isSignedIn ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
2921
+ return isLoaded && isSignedIn ? /* @__PURE__ */ jsx34(Fragment10, { children }) : null;
2845
2922
  }
2846
2923
  function SignedOut({ children }) {
2847
2924
  const { isLoaded, isSignedIn } = useUser();
2848
- return isLoaded && !isSignedIn ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
2925
+ return isLoaded && !isSignedIn ? /* @__PURE__ */ jsx34(Fragment10, { children }) : null;
2849
2926
  }
2850
2927
  function Protect({
2851
2928
  children,
@@ -2858,36 +2935,36 @@ function Protect({
2858
2935
  const { user, isLoaded, isSignedIn } = useUser();
2859
2936
  const membership = useSession().data?.session?.membership ?? null;
2860
2937
  if (!isLoaded) return null;
2861
- if (!isSignedIn || !user) return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
2938
+ if (!isSignedIn || !user) return /* @__PURE__ */ jsx34(Fragment10, { children: fallback });
2862
2939
  if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !membershipHas(membership, { role, permission, teamId })) {
2863
- return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
2940
+ return /* @__PURE__ */ jsx34(Fragment10, { children: fallback });
2864
2941
  }
2865
- if (condition && !condition(user)) return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
2866
- return /* @__PURE__ */ jsx33(Fragment10, { children });
2942
+ if (condition && !condition(user)) return /* @__PURE__ */ jsx34(Fragment10, { children: fallback });
2943
+ return /* @__PURE__ */ jsx34(Fragment10, { children });
2867
2944
  }
2868
2945
  function AuthLoading({ children }) {
2869
2946
  const t = useT();
2870
2947
  const { isLoaded } = useUser();
2871
2948
  if (isLoaded) return null;
2872
- if (children !== void 0) return /* @__PURE__ */ jsx33(Fragment10, { children });
2873
- return /* @__PURE__ */ jsxs31("div", { className: "ba-auth-loading", role: "status", "aria-busy": "true", "data-testid": "auth-loading", children: [
2874
- /* @__PURE__ */ jsx33(Spinner, {}),
2875
- /* @__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") })
2876
2953
  ] });
2877
2954
  }
2878
2955
  function AuthLoaded({ children }) {
2879
- return useUser().isLoaded ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
2956
+ return useUser().isLoaded ? /* @__PURE__ */ jsx34(Fragment10, { children }) : null;
2880
2957
  }
2881
2958
 
2882
2959
  // src/components/SignOutButton.tsx
2883
2960
  import * as React24 from "react";
2884
- import { jsx as jsx34 } from "react/jsx-runtime";
2961
+ import { jsx as jsx35 } from "react/jsx-runtime";
2885
2962
  function SignOutButton({ children, redirectTo, onSignedOut, className }) {
2886
2963
  const t = useT();
2887
2964
  const { signOut } = useSignOut();
2888
2965
  const [pending, setPending] = React24.useState(false);
2889
2966
  const content = children ?? t("signOut.button");
2890
- return /* @__PURE__ */ jsx34(
2967
+ return /* @__PURE__ */ jsx35(
2891
2968
  "button",
2892
2969
  {
2893
2970
  type: "button",
@@ -2905,20 +2982,20 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
2905
2982
  setPending(false);
2906
2983
  }
2907
2984
  },
2908
- children: /* @__PURE__ */ jsx34(Busy, { busy: pending, label: content, children: content })
2985
+ children: /* @__PURE__ */ jsx35(Busy, { busy: pending, label: content, children: content })
2909
2986
  }
2910
2987
  );
2911
2988
  }
2912
2989
 
2913
2990
  // src/components/UserButton.tsx
2914
- import * as React37 from "react";
2991
+ import * as React38 from "react";
2915
2992
 
2916
2993
  // src/components/UserProfile.tsx
2917
- import * as React36 from "react";
2994
+ import * as React37 from "react";
2918
2995
 
2919
2996
  // src/components/user-profile/EmailSection.tsx
2920
2997
  import * as React25 from "react";
2921
- import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
2998
+ import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
2922
2999
  function EmailSection({ allowChange }) {
2923
3000
  const t = useT();
2924
3001
  const account = useAccount();
@@ -2928,9 +3005,9 @@ function EmailSection({ allowChange }) {
2928
3005
  const [sent, setSent] = React25.useState(false);
2929
3006
  const titleId = React25.useId();
2930
3007
  if (!user?.email) {
2931
- return /* @__PURE__ */ jsxs32("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
2932
- /* @__PURE__ */ jsx35("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
2933
- /* @__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") })
2934
3011
  ] });
2935
3012
  }
2936
3013
  const submit = (event) => {
@@ -2950,19 +3027,19 @@ function EmailSection({ allowChange }) {
2950
3027
  }
2951
3028
  );
2952
3029
  };
2953
- return /* @__PURE__ */ jsxs32("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
2954
- /* @__PURE__ */ jsxs32("header", { className: "ba-profile-section-header", children: [
2955
- /* @__PURE__ */ jsx35("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
2956
- /* @__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") })
2957
3034
  ] }),
2958
- /* @__PURE__ */ jsxs32("p", { className: "ba-profile-current", children: [
2959
- /* @__PURE__ */ jsx35("span", { children: t("userProfile.email.current") }),
2960
- /* @__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 }) })
2961
3038
  ] }),
2962
- !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: [
2963
- /* @__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: [
2964
3041
  t("userProfile.email.newLabel"),
2965
- /* @__PURE__ */ jsx35(
3042
+ /* @__PURE__ */ jsx36(
2966
3043
  "input",
2967
3044
  {
2968
3045
  className: "ba-input",
@@ -2974,16 +3051,16 @@ function EmailSection({ allowChange }) {
2974
3051
  }
2975
3052
  )
2976
3053
  ] }),
2977
- /* @__PURE__ */ jsx35(FormError, { children: error }),
2978
- sent && /* @__PURE__ */ jsx35("p", { className: "ba-success", role: "status", children: t("userProfile.email.sent") }),
2979
- /* @__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(
2980
3057
  "button",
2981
3058
  {
2982
3059
  className: "ba-button ba-profile-submit",
2983
3060
  type: "submit",
2984
3061
  disabled: pending || !newEmail.trim(),
2985
3062
  "aria-busy": pending || void 0,
2986
- 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") })
2987
3064
  }
2988
3065
  )
2989
3066
  ] })
@@ -2992,7 +3069,7 @@ function EmailSection({ allowChange }) {
2992
3069
 
2993
3070
  // src/components/user-profile/DeleteAccountSection.tsx
2994
3071
  import * as React26 from "react";
2995
- import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
3072
+ import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
2996
3073
  function DeleteAccountSection({ onDeleted }) {
2997
3074
  const t = useT();
2998
3075
  const account = useAccount();
@@ -3017,18 +3094,18 @@ function DeleteAccountSection({ onDeleted }) {
3017
3094
  }
3018
3095
  );
3019
3096
  };
3020
- return /* @__PURE__ */ jsxs33("section", { className: "ba-profile-section ba-profile-danger-zone", "aria-labelledby": titleId, children: [
3021
- /* @__PURE__ */ jsxs33("header", { className: "ba-profile-section-header", children: [
3022
- /* @__PURE__ */ jsx36("h2", { id: titleId, className: "ba-title", children: t("userProfile.delete.title") }),
3023
- /* @__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") })
3024
3101
  ] }),
3025
- /* @__PURE__ */ jsxs33("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3026
- /* @__PURE__ */ jsx36("p", { className: "ba-profile-delete-warning", children: t("userProfile.delete.warning", { identifier }) }),
3027
- /* @__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: [
3028
3105
  t("userProfile.delete.confirmLabel"),
3029
3106
  " ",
3030
- /* @__PURE__ */ jsx36(Bidi, { children: identifier }),
3031
- /* @__PURE__ */ jsx36(
3107
+ /* @__PURE__ */ jsx37(Bidi, { children: identifier }),
3108
+ /* @__PURE__ */ jsx37(
3032
3109
  "input",
3033
3110
  {
3034
3111
  className: "ba-input",
@@ -3042,15 +3119,15 @@ function DeleteAccountSection({ onDeleted }) {
3042
3119
  }
3043
3120
  )
3044
3121
  ] }),
3045
- /* @__PURE__ */ jsx36(FormError, { children: error }),
3046
- /* @__PURE__ */ jsx36(
3122
+ /* @__PURE__ */ jsx37(FormError, { children: error }),
3123
+ /* @__PURE__ */ jsx37(
3047
3124
  "button",
3048
3125
  {
3049
3126
  className: "ba-button ba-danger-button ba-profile-submit",
3050
3127
  type: "submit",
3051
3128
  disabled: pending || !confirmed,
3052
3129
  "aria-busy": pending || void 0,
3053
- 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") })
3054
3131
  }
3055
3132
  )
3056
3133
  ] })
@@ -3059,7 +3136,7 @@ function DeleteAccountSection({ onDeleted }) {
3059
3136
 
3060
3137
  // src/components/user-profile/MfaSection.tsx
3061
3138
  import * as React27 from "react";
3062
- import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
3139
+ import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
3063
3140
  function MfaSection() {
3064
3141
  const t = useT();
3065
3142
  const { user } = useUser();
@@ -3072,12 +3149,12 @@ function MfaSection() {
3072
3149
  const titleId = React27.useId();
3073
3150
  const required = resolveProjectCapabilities(config).mfaRequired;
3074
3151
  if (!user?.twoFactorEnabled) {
3075
- return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3076
- /* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
3077
- /* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
3078
- /* @__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") })
3079
3156
  ] }),
3080
- /* @__PURE__ */ jsx37(
3157
+ /* @__PURE__ */ jsx38(
3081
3158
  MFAEnrollment,
3082
3159
  {
3083
3160
  title: null,
@@ -3100,16 +3177,16 @@ function MfaSection() {
3100
3177
  }
3101
3178
  );
3102
3179
  };
3103
- return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3104
- /* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
3105
- /* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
3106
- /* @__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") })
3107
3184
  ] }),
3108
- /* @__PURE__ */ jsxs34("div", { className: "ba-profile-status", role: "status", children: [
3109
- /* @__PURE__ */ jsx37("strong", { children: t("userProfile.mfa.enabled") }),
3110
- /* @__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") })
3111
3188
  ] }),
3112
- !showDisable ? /* @__PURE__ */ jsx37(
3189
+ !showDisable ? /* @__PURE__ */ jsx38(
3113
3190
  "button",
3114
3191
  {
3115
3192
  className: "ba-button ba-button-secondary ba-profile-submit",
@@ -3117,11 +3194,11 @@ function MfaSection() {
3117
3194
  onClick: () => setShowDisable(true),
3118
3195
  children: required ? t("userProfile.mfa.replace") : t("userProfile.mfa.disable")
3119
3196
  }
3120
- ) : /* @__PURE__ */ jsxs34("form", { method: "post", className: "ba-fields ba-profile-security-form", onSubmit: submitDisable, children: [
3121
- /* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.replaceWarning") : t("userProfile.mfa.disableWarning") }),
3122
- /* @__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: [
3123
3200
  t("common.passwordLabel"),
3124
- /* @__PURE__ */ jsx37(
3201
+ /* @__PURE__ */ jsx38(
3125
3202
  "input",
3126
3203
  {
3127
3204
  className: "ba-input",
@@ -3133,19 +3210,19 @@ function MfaSection() {
3133
3210
  }
3134
3211
  )
3135
3212
  ] }),
3136
- /* @__PURE__ */ jsx37(FormError, { children: error }),
3137
- /* @__PURE__ */ jsxs34("span", { className: "ba-profile-action-row", children: [
3138
- /* @__PURE__ */ jsx37(
3213
+ /* @__PURE__ */ jsx38(FormError, { children: error }),
3214
+ /* @__PURE__ */ jsxs35("span", { className: "ba-profile-action-row", children: [
3215
+ /* @__PURE__ */ jsx38(
3139
3216
  "button",
3140
3217
  {
3141
3218
  className: "ba-button ba-danger-button",
3142
3219
  type: "submit",
3143
3220
  disabled: pending || !password,
3144
3221
  "aria-busy": pending || void 0,
3145
- 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") })
3146
3223
  }
3147
3224
  ),
3148
- /* @__PURE__ */ jsx37(
3225
+ /* @__PURE__ */ jsx38(
3149
3226
  "button",
3150
3227
  {
3151
3228
  className: "ba-button ba-button-secondary",
@@ -3165,7 +3242,7 @@ function MfaSection() {
3165
3242
 
3166
3243
  // src/components/user-profile/PasswordSection.tsx
3167
3244
  import * as React28 from "react";
3168
- import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
3245
+ import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
3169
3246
  function PasswordSection() {
3170
3247
  const t = useT();
3171
3248
  const account = useAccount();
@@ -3201,43 +3278,43 @@ function PasswordSection() {
3201
3278
  }
3202
3279
  );
3203
3280
  };
3204
- return /* @__PURE__ */ jsxs35("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3205
- /* @__PURE__ */ jsxs35("header", { className: "ba-profile-section-header", children: [
3206
- /* @__PURE__ */ jsx38("h2", { id: titleId, className: "ba-title", children: t("userProfile.password.title") }),
3207
- /* @__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") })
3208
3285
  ] }),
3209
- /* @__PURE__ */ jsxs35("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3210
- /* @__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: [
3211
3288
  t("userProfile.password.currentLabel"),
3212
- /* @__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) => {
3213
3290
  setCurrentPassword(event.target.value);
3214
3291
  setError(null);
3215
3292
  }, required: true })
3216
3293
  ] }),
3217
- /* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
3294
+ /* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
3218
3295
  t("resetPassword.newPasswordLabel"),
3219
- /* @__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) => {
3220
3297
  setNewPassword(event.target.value);
3221
3298
  setError(null);
3222
3299
  }, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
3223
3300
  ] }),
3224
- /* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
3301
+ /* @__PURE__ */ jsxs36("label", { className: "ba-label", children: [
3225
3302
  t("resetPassword.confirmPasswordLabel"),
3226
- /* @__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) => {
3227
3304
  setConfirmPassword(event.target.value);
3228
3305
  setError(null);
3229
3306
  }, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
3230
3307
  ] }),
3231
- /* @__PURE__ */ jsx38(FormError, { children: error }),
3232
- saved && /* @__PURE__ */ jsx38("p", { className: "ba-success", role: "status", children: t("userProfile.password.saved") }),
3233
- /* @__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(
3234
3311
  "button",
3235
3312
  {
3236
3313
  className: "ba-button ba-profile-submit",
3237
3314
  type: "submit",
3238
3315
  disabled: pending || !currentPassword || !newPassword || !confirmPassword,
3239
3316
  "aria-busy": pending || void 0,
3240
- 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") })
3241
3318
  }
3242
3319
  )
3243
3320
  ] })
@@ -3246,22 +3323,22 @@ function PasswordSection() {
3246
3323
 
3247
3324
  // src/components/user-profile/PasskeysSection.tsx
3248
3325
  import * as React29 from "react";
3249
- import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
3326
+ import { jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
3250
3327
  function PasskeysSection({ allowAdd }) {
3251
3328
  const t = useT();
3252
3329
  const titleId = React29.useId();
3253
- return /* @__PURE__ */ jsxs36("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3254
- /* @__PURE__ */ jsxs36("header", { className: "ba-profile-section-header", children: [
3255
- /* @__PURE__ */ jsx39("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
3256
- /* @__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") })
3257
3334
  ] }),
3258
- /* @__PURE__ */ jsx39(PasskeyManager, { title: null, allowAdd })
3335
+ /* @__PURE__ */ jsx40(PasskeyManager, { title: null, allowAdd })
3259
3336
  ] });
3260
3337
  }
3261
3338
 
3262
3339
  // src/components/user-profile/ProfileSection.tsx
3263
3340
  import * as React30 from "react";
3264
- 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";
3265
3342
  function ProfileSection({
3266
3343
  firstLastName,
3267
3344
  usernameEnabled,
@@ -3303,15 +3380,15 @@ function ProfileSection({
3303
3380
  }
3304
3381
  );
3305
3382
  };
3306
- return /* @__PURE__ */ jsxs37("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3307
- /* @__PURE__ */ jsxs37("header", { className: "ba-profile-section-header", children: [
3308
- /* @__PURE__ */ jsx40("h2", { id: titleId, className: "ba-title", children: t("userProfile.profile.title") }),
3309
- /* @__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") })
3310
3387
  ] }),
3311
- /* @__PURE__ */ jsxs37("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3312
- 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: [
3313
3390
  t("signUp.nameLabel"),
3314
- /* @__PURE__ */ jsx40(
3391
+ /* @__PURE__ */ jsx41(
3315
3392
  "input",
3316
3393
  {
3317
3394
  className: "ba-input",
@@ -3322,10 +3399,10 @@ function ProfileSection({
3322
3399
  }
3323
3400
  )
3324
3401
  ] }),
3325
- firstLastName && /* @__PURE__ */ jsxs37(Fragment11, { children: [
3326
- /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
3402
+ firstLastName && /* @__PURE__ */ jsxs38(Fragment11, { children: [
3403
+ /* @__PURE__ */ jsxs38("label", { className: "ba-label", children: [
3327
3404
  t("signUp.firstNameLabel"),
3328
- /* @__PURE__ */ jsx40(
3405
+ /* @__PURE__ */ jsx41(
3329
3406
  "input",
3330
3407
  {
3331
3408
  className: "ba-input",
@@ -3335,9 +3412,9 @@ function ProfileSection({
3335
3412
  }
3336
3413
  )
3337
3414
  ] }),
3338
- /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
3415
+ /* @__PURE__ */ jsxs38("label", { className: "ba-label", children: [
3339
3416
  t("signUp.lastNameLabel"),
3340
- /* @__PURE__ */ jsx40(
3417
+ /* @__PURE__ */ jsx41(
3341
3418
  "input",
3342
3419
  {
3343
3420
  className: "ba-input",
@@ -3348,9 +3425,9 @@ function ProfileSection({
3348
3425
  )
3349
3426
  ] })
3350
3427
  ] }),
3351
- usernameEnabled && /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
3428
+ usernameEnabled && /* @__PURE__ */ jsxs38("label", { className: "ba-label", children: [
3352
3429
  t("common.usernameLabel"),
3353
- /* @__PURE__ */ jsx40(
3430
+ /* @__PURE__ */ jsx41(
3354
3431
  "input",
3355
3432
  {
3356
3433
  className: "ba-input",
@@ -3360,9 +3437,9 @@ function ProfileSection({
3360
3437
  }
3361
3438
  )
3362
3439
  ] }),
3363
- /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
3440
+ /* @__PURE__ */ jsxs38("label", { className: "ba-label", children: [
3364
3441
  t("userProfile.profile.imageLabel"),
3365
- /* @__PURE__ */ jsx40(
3442
+ /* @__PURE__ */ jsx41(
3366
3443
  "input",
3367
3444
  {
3368
3445
  className: "ba-input",
@@ -3373,16 +3450,16 @@ function ProfileSection({
3373
3450
  }
3374
3451
  )
3375
3452
  ] }),
3376
- /* @__PURE__ */ jsx40(FormError, { children: error }),
3377
- saved && /* @__PURE__ */ jsx40("p", { className: "ba-success", role: "status", children: t("userProfile.profile.saved") }),
3378
- /* @__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(
3379
3456
  "button",
3380
3457
  {
3381
3458
  className: "ba-button ba-profile-submit",
3382
3459
  type: "submit",
3383
3460
  disabled: pending || legacyNameField && !name.trim(),
3384
3461
  "aria-busy": pending || void 0,
3385
- 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") })
3386
3463
  }
3387
3464
  )
3388
3465
  ] })
@@ -3391,24 +3468,24 @@ function ProfileSection({
3391
3468
 
3392
3469
  // src/components/user-profile/RecoverySection.tsx
3393
3470
  import * as React31 from "react";
3394
- 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";
3395
3472
  function RecoverySection() {
3396
3473
  const t = useT();
3397
3474
  const { user } = useUser();
3398
3475
  const titleId = React31.useId();
3399
- return /* @__PURE__ */ jsxs38("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3400
- /* @__PURE__ */ jsxs38("header", { className: "ba-profile-section-header", children: [
3401
- /* @__PURE__ */ jsx41("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
3402
- /* @__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") })
3403
3480
  ] }),
3404
- /* @__PURE__ */ jsxs38("div", { className: "ba-profile-recovery-card", children: [
3405
- /* @__PURE__ */ jsx41("strong", { children: t("userProfile.recovery.emailTitle") }),
3406
- user?.email && user.emailVerified ? /* @__PURE__ */ jsxs38(Fragment12, { children: [
3407
- /* @__PURE__ */ jsx41("p", { children: t("userProfile.recovery.emailDescription") }),
3408
- /* @__PURE__ */ jsx41(Bidi, { children: user.email })
3409
- ] }) : /* @__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") })
3410
3487
  ] }),
3411
- /* @__PURE__ */ jsx41(BackupCodesManager, { title: null })
3488
+ /* @__PURE__ */ jsx42(BackupCodesManager, { title: null })
3412
3489
  ] });
3413
3490
  }
3414
3491
 
@@ -3425,6 +3502,7 @@ var USER_PROFILE_SECTIONS = [
3425
3502
  "passkeys",
3426
3503
  "mfa",
3427
3504
  "recovery",
3505
+ "privacy",
3428
3506
  "danger"
3429
3507
  ];
3430
3508
  function userProfileSectionsFor(capabilities) {
@@ -3435,6 +3513,7 @@ function userProfileSectionsFor(capabilities) {
3435
3513
  if (section === "recovery") return capabilities.recovery;
3436
3514
  if (section === "danger") return capabilities.accountDeletion;
3437
3515
  if (section === "social") return capabilities.social;
3516
+ if (section === "privacy") return capabilities.privacy;
3438
3517
  return true;
3439
3518
  });
3440
3519
  }
@@ -3500,7 +3579,7 @@ function useAccountResource(loader, failure) {
3500
3579
  }
3501
3580
 
3502
3581
  // src/components/user-profile/SessionsSection.tsx
3503
- import { jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
3582
+ import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
3504
3583
  function SessionsSection() {
3505
3584
  const t = useT();
3506
3585
  const locale = useLocale();
@@ -3529,31 +3608,31 @@ function SessionsSection() {
3529
3608
  }
3530
3609
  );
3531
3610
  };
3532
- return /* @__PURE__ */ jsxs39("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3533
- /* @__PURE__ */ jsxs39("header", { className: "ba-profile-section-header", children: [
3534
- /* @__PURE__ */ jsx42("h2", { id: titleId, className: "ba-title", children: t("userProfile.sessions.title") }),
3535
- /* @__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") })
3536
3615
  ] }),
3537
- resource.data === null ? resource.loading ? /* @__PURE__ */ jsxs39("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: [
3538
- /* @__PURE__ */ jsx42("div", { className: "ba-skeleton" }),
3539
- /* @__PURE__ */ jsx42("div", { className: "ba-skeleton" })
3540
- ] }) : 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: [
3541
3620
  sessions.map((session) => {
3542
3621
  const label2 = session.userAgent?.trim() || t("userProfile.sessions.unknownDevice");
3543
- return /* @__PURE__ */ jsxs39("li", { className: "ba-profile-list-item", children: [
3544
- /* @__PURE__ */ jsxs39("span", { children: [
3545
- /* @__PURE__ */ jsx42("strong", { children: label2 }),
3546
- /* @__PURE__ */ jsxs39("small", { children: [
3547
- 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") }),
3548
3627
  formatSessionTime(session.updatedAt, locale)
3549
3628
  ] })
3550
3629
  ] }),
3551
- /* @__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") })
3552
3631
  ] }, session.id);
3553
3632
  }),
3554
- 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") })
3555
3634
  ] }),
3556
- sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ jsx42(
3635
+ sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ jsx43(
3557
3636
  "button",
3558
3637
  {
3559
3638
  className: "ba-button ba-button-secondary ba-profile-submit",
@@ -3569,17 +3648,17 @@ function SessionsSection() {
3569
3648
  children: t("userProfile.sessions.revokeOthers")
3570
3649
  }
3571
3650
  ),
3572
- resource.error && /* @__PURE__ */ jsxs39("div", { className: "ba-profile-inline-error", children: [
3573
- /* @__PURE__ */ jsx42(FormError, { children: resource.error }),
3574
- /* @__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") })
3575
3654
  ] }),
3576
- /* @__PURE__ */ jsx42(FormError, { children: mutation.error })
3655
+ /* @__PURE__ */ jsx43(FormError, { children: mutation.error })
3577
3656
  ] });
3578
3657
  }
3579
3658
 
3580
3659
  // src/components/user-profile/SocialSection.tsx
3581
3660
  import * as React34 from "react";
3582
- import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
3661
+ import { jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
3583
3662
  function providerLabel(provider) {
3584
3663
  return provider.charAt(0).toUpperCase() + provider.slice(1);
3585
3664
  }
@@ -3619,18 +3698,18 @@ function SocialSection() {
3619
3698
  { failure: t("userProfile.social.unlinkError"), onSuccess: resource.load }
3620
3699
  );
3621
3700
  };
3622
- return /* @__PURE__ */ jsxs40("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
3623
- /* @__PURE__ */ jsxs40("header", { className: "ba-profile-section-header", children: [
3624
- /* @__PURE__ */ jsx43("h2", { id: titleId, className: "ba-title", children: t("userProfile.social.title") }),
3625
- /* @__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") })
3626
3705
  ] }),
3627
- 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: [
3628
- linked.map((item) => /* @__PURE__ */ jsxs40("li", { className: "ba-profile-list-item", children: [
3629
- /* @__PURE__ */ jsxs40("span", { children: [
3630
- /* @__PURE__ */ jsx43("strong", { children: providerLabel(item.providerId) }),
3631
- /* @__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") })
3632
3711
  ] }),
3633
- /* @__PURE__ */ jsx43(
3712
+ /* @__PURE__ */ jsx44(
3634
3713
  "button",
3635
3714
  {
3636
3715
  className: "ba-link-button ba-danger",
@@ -3645,23 +3724,23 @@ function SocialSection() {
3645
3724
  }
3646
3725
  )
3647
3726
  ] }, item.id)),
3648
- 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") })
3649
3728
  ] }),
3650
- available.length > 0 && /* @__PURE__ */ jsxs40("div", { className: "ba-profile-provider-actions", children: [
3651
- /* @__PURE__ */ jsx43("p", { className: "ba-profile-subtitle", children: t("userProfile.social.add") }),
3652
- 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))
3653
3732
  ] }),
3654
- resource.error && /* @__PURE__ */ jsxs40("div", { className: "ba-profile-inline-error", children: [
3655
- /* @__PURE__ */ jsx43(FormError, { children: resource.error }),
3656
- /* @__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") })
3657
3736
  ] }),
3658
- /* @__PURE__ */ jsx43(FormError, { children: mutation.error })
3737
+ /* @__PURE__ */ jsx44(FormError, { children: mutation.error })
3659
3738
  ] });
3660
3739
  }
3661
3740
 
3662
3741
  // src/components/user-profile/UserProfileModal.tsx
3663
3742
  import * as React35 from "react";
3664
- import { jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
3743
+ import { jsx as jsx45, jsxs as jsxs42 } from "react/jsx-runtime";
3665
3744
  function UserProfileModal({
3666
3745
  children,
3667
3746
  onClose,
@@ -3669,7 +3748,7 @@ function UserProfileModal({
3669
3748
  }) {
3670
3749
  const t = useT();
3671
3750
  const titleId = React35.useId();
3672
- return /* @__PURE__ */ jsxs41(
3751
+ return /* @__PURE__ */ jsxs42(
3673
3752
  ModalSurface,
3674
3753
  {
3675
3754
  overlayClassName: "ba-profile-overlay",
@@ -3678,13 +3757,13 @@ function UserProfileModal({
3678
3757
  testId: "user-profile-modal",
3679
3758
  onClose,
3680
3759
  children: [
3681
- /* @__PURE__ */ jsxs41("div", { className: "ba-profile-modal-header", children: [
3682
- /* @__PURE__ */ jsxs41("span", { children: [
3760
+ /* @__PURE__ */ jsxs42("div", { className: "ba-profile-modal-header", children: [
3761
+ /* @__PURE__ */ jsxs42("span", { children: [
3683
3762
  branding,
3684
- /* @__PURE__ */ jsx44("h1", { id: titleId, children: t("userProfile.title") }),
3685
- /* @__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") })
3686
3765
  ] }),
3687
- /* @__PURE__ */ jsx44(
3766
+ /* @__PURE__ */ jsx45(
3688
3767
  "button",
3689
3768
  {
3690
3769
  type: "button",
@@ -3692,7 +3771,7 @@ function UserProfileModal({
3692
3771
  "aria-label": t("userProfile.close"),
3693
3772
  onClick: onClose,
3694
3773
  autoFocus: true,
3695
- 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(
3696
3775
  "path",
3697
3776
  {
3698
3777
  d: "M6 6l12 12M18 6L6 18",
@@ -3705,14 +3784,39 @@ function UserProfileModal({
3705
3784
  )
3706
3785
  ] }),
3707
3786
  children,
3708
- /* @__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" })
3709
3813
  ]
3710
3814
  }
3711
3815
  );
3712
3816
  }
3713
3817
 
3714
3818
  // src/components/UserProfile.tsx
3715
- import { jsx as jsx45, jsxs as jsxs42 } from "react/jsx-runtime";
3819
+ import { jsx as jsx47, jsxs as jsxs44 } from "react/jsx-runtime";
3716
3820
  var SECTION_KEYS = {
3717
3821
  profile: "userProfile.nav.profile",
3718
3822
  email: "userProfile.nav.email",
@@ -3722,6 +3826,7 @@ var SECTION_KEYS = {
3722
3826
  passkeys: "userProfile.nav.passkeys",
3723
3827
  mfa: "userProfile.nav.mfa",
3724
3828
  recovery: "userProfile.nav.recovery",
3829
+ privacy: "userProfile.nav.privacy",
3725
3830
  danger: "userProfile.nav.danger"
3726
3831
  };
3727
3832
  function initialSection(fallback) {
@@ -3741,7 +3846,7 @@ function UserProfile(props = {}) {
3741
3846
  const t = useT();
3742
3847
  const { user, isLoaded, isSignedIn } = useUser();
3743
3848
  const { config } = usePublicConfig();
3744
- const [internalSection, setInternalSection] = React36.useState(() => initialSection(defaultSection));
3849
+ const [internalSection, setInternalSection] = React37.useState(() => initialSection(defaultSection));
3745
3850
  const active = section ?? internalSection;
3746
3851
  const capabilities = resolveProjectCapabilities(config);
3747
3852
  const passwordEnabled = config !== null && capabilities.passwordSignIn;
@@ -3750,18 +3855,20 @@ function UserProfile(props = {}) {
3750
3855
  const recoveryEnabled = capabilities.backupCodes && user?.twoFactorEnabled === true;
3751
3856
  const deletionEnabled = capabilities.accountDeletion;
3752
3857
  const socialEnabled = (config?.socialProviders?.length ?? 0) > 0;
3753
- const sections = React36.useMemo(
3858
+ const privacyEnabled = config?.privacy !== void 0;
3859
+ const sections = React37.useMemo(
3754
3860
  () => userProfileSectionsFor({
3755
3861
  password: passwordEnabled,
3756
3862
  passkeys: passkeysEnabled,
3757
3863
  mfa: mfaEnabled,
3758
3864
  recovery: recoveryEnabled,
3759
3865
  accountDeletion: deletionEnabled,
3760
- social: socialEnabled
3866
+ social: socialEnabled,
3867
+ privacy: privacyEnabled
3761
3868
  }),
3762
- [deletionEnabled, mfaEnabled, passkeysEnabled, passwordEnabled, recoveryEnabled, socialEnabled]
3869
+ [deletionEnabled, mfaEnabled, passkeysEnabled, passwordEnabled, privacyEnabled, recoveryEnabled, socialEnabled]
3763
3870
  );
3764
- React36.useEffect(() => {
3871
+ React37.useEffect(() => {
3765
3872
  if (section || mode !== "page") return;
3766
3873
  const onHashChange = () => {
3767
3874
  const next = userProfileSectionFromHash(window.location.hash);
@@ -3778,11 +3885,11 @@ function UserProfile(props = {}) {
3778
3885
  window.history.replaceState(null, "", userProfileSectionHash(next));
3779
3886
  }
3780
3887
  };
3781
- const content = !isLoaded ? /* @__PURE__ */ jsxs42("div", { className: "ba-profile-loading", "aria-busy": "true", children: [
3782
- /* @__PURE__ */ jsx45("div", { className: "ba-skeleton" }),
3783
- /* @__PURE__ */ jsx45("div", { className: "ba-skeleton" }),
3784
- /* @__PURE__ */ jsx45("div", { className: "ba-skeleton" })
3785
- ] }) : !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(
3786
3893
  UserProfileBody,
3787
3894
  {
3788
3895
  active: visibleActive,
@@ -3794,23 +3901,23 @@ function UserProfile(props = {}) {
3794
3901
  user.id
3795
3902
  );
3796
3903
  if (props.mode === "modal") {
3797
- return /* @__PURE__ */ jsx45(
3904
+ return /* @__PURE__ */ jsx47(
3798
3905
  UserProfileModal,
3799
3906
  {
3800
3907
  onClose: props.onClose,
3801
- branding: showBranding ? /* @__PURE__ */ jsx45(AuthOwlBranding, {}) : null,
3908
+ branding: showBranding ? /* @__PURE__ */ jsx47(AuthOwlBranding, {}) : null,
3802
3909
  children: content
3803
3910
  }
3804
3911
  );
3805
3912
  }
3806
- return /* @__PURE__ */ jsxs42("article", { className: "ba-profile ba-profile-page", "data-testid": "user-profile", children: [
3807
- /* @__PURE__ */ jsxs42("header", { className: "ba-profile-heading", children: [
3808
- showBranding ? /* @__PURE__ */ jsx45(AuthOwlBranding, {}) : null,
3809
- /* @__PURE__ */ jsx45("h1", { children: t("userProfile.title") }),
3810
- /* @__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") })
3811
3918
  ] }),
3812
3919
  content,
3813
- /* @__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, {}) })
3814
3921
  ] });
3815
3922
  }
3816
3923
  function UserProfileBody({
@@ -3821,8 +3928,8 @@ function UserProfileBody({
3821
3928
  capabilities
3822
3929
  }) {
3823
3930
  const t = useT();
3824
- return /* @__PURE__ */ jsxs42("div", { className: "ba-profile-layout", children: [
3825
- /* @__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(
3826
3933
  "button",
3827
3934
  {
3828
3935
  type: "button",
@@ -3833,8 +3940,8 @@ function UserProfileBody({
3833
3940
  },
3834
3941
  item
3835
3942
  )) }),
3836
- /* @__PURE__ */ jsxs42("div", { className: "ba-profile-content", "data-section": active, children: [
3837
- active === "profile" && /* @__PURE__ */ jsx45(
3943
+ /* @__PURE__ */ jsxs44("div", { className: "ba-profile-content", "data-section": active, children: [
3944
+ active === "profile" && /* @__PURE__ */ jsx47(
3838
3945
  ProfileSection,
3839
3946
  {
3840
3947
  firstLastName: capabilities.firstLastName,
@@ -3842,40 +3949,41 @@ function UserProfileBody({
3842
3949
  legacyNameField: capabilities.legacyNameField
3843
3950
  }
3844
3951
  ),
3845
- active === "email" && /* @__PURE__ */ jsx45(EmailSection, { allowChange: capabilities.emailChange }),
3846
- active === "password" && /* @__PURE__ */ jsx45(PasswordSection, {}),
3847
- active === "social" && /* @__PURE__ */ jsx45(SocialSection, {}),
3848
- active === "sessions" && /* @__PURE__ */ jsx45(SessionsSection, {}),
3849
- active === "passkeys" && /* @__PURE__ */ jsx45(PasskeysSection, { allowAdd: capabilities.passkeyAdd }),
3850
- active === "mfa" && /* @__PURE__ */ jsx45(MfaSection, {}),
3851
- active === "recovery" && /* @__PURE__ */ jsx45(RecoverySection, {}),
3852
- 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 })
3853
3961
  ] })
3854
3962
  ] });
3855
3963
  }
3856
3964
 
3857
3965
  // src/components/UserButton.tsx
3858
- import { jsx as jsx46, jsxs as jsxs43 } from "react/jsx-runtime";
3966
+ import { jsx as jsx48, jsxs as jsxs45 } from "react/jsx-runtime";
3859
3967
  function UserButton() {
3860
3968
  const t = useT();
3861
3969
  const { user, isLoaded } = useUser();
3862
3970
  const { signOut } = useSignOut();
3863
- const [open, setOpen] = React37.useState(false);
3864
- const [profileOpen, setProfileOpen] = React37.useState(false);
3865
- const [failedImage, setFailedImage] = React37.useState(null);
3866
- 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);
3867
3975
  if (!isLoaded || !user) return null;
3868
3976
  const identity = user.email ?? user.phoneNumber ?? user.name ?? "?";
3869
3977
  const image = user.image ?? null;
3870
- return /* @__PURE__ */ jsxs43("div", { className: "ba-user-button", "data-testid": "user-button", children: [
3871
- /* @__PURE__ */ jsx46(
3978
+ return /* @__PURE__ */ jsxs45("div", { className: "ba-user-button", "data-testid": "user-button", children: [
3979
+ /* @__PURE__ */ jsx48(
3872
3980
  "button",
3873
3981
  {
3874
3982
  ref: triggerRef,
3875
3983
  className: "ba-user-button-trigger",
3876
3984
  "aria-label": t("userButton.openMenuAria"),
3877
3985
  onClick: () => setOpen((v) => !v),
3878
- children: image && failedImage !== image ? /* @__PURE__ */ jsx46(
3986
+ children: image && failedImage !== image ? /* @__PURE__ */ jsx48(
3879
3987
  "img",
3880
3988
  {
3881
3989
  className: "ba-avatar",
@@ -3884,12 +3992,12 @@ function UserButton() {
3884
3992
  referrerPolicy: "no-referrer",
3885
3993
  onError: () => setFailedImage(image)
3886
3994
  }
3887
- ) : /* @__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() })
3888
3996
  }
3889
3997
  ),
3890
- open && /* @__PURE__ */ jsxs43("div", { className: "ba-menu", children: [
3891
- /* @__PURE__ */ jsx46("p", { className: "ba-menu-label", children: identity }),
3892
- /* @__PURE__ */ jsx46(
3998
+ open && /* @__PURE__ */ jsxs45("div", { className: "ba-menu", children: [
3999
+ /* @__PURE__ */ jsx48("p", { className: "ba-menu-label", children: identity }),
4000
+ /* @__PURE__ */ jsx48(
3893
4001
  "button",
3894
4002
  {
3895
4003
  className: "ba-menu-item",
@@ -3900,10 +4008,10 @@ function UserButton() {
3900
4008
  children: t("userButton.manageAccount")
3901
4009
  }
3902
4010
  ),
3903
- /* @__PURE__ */ jsx46("button", { className: "ba-menu-item", onClick: () => signOut(), children: t("userButton.signOut") }),
3904
- /* @__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, {}) })
3905
4013
  ] }),
3906
- profileOpen && /* @__PURE__ */ jsx46(
4014
+ profileOpen && /* @__PURE__ */ jsx48(
3907
4015
  UserProfile,
3908
4016
  {
3909
4017
  mode: "modal",
@@ -3919,961 +4027,35 @@ function UserButton() {
3919
4027
  }
3920
4028
 
3921
4029
  // src/components/OrganizationSwitcher.tsx
3922
- import * as React45 from "react";
3923
-
3924
- // src/components/CreateOrganization.tsx
3925
- import * as React38 from "react";
3926
- import { jsx as jsx47, jsxs as jsxs44 } from "react/jsx-runtime";
3927
- function CreateOrganization({ onCreated, title } = {}) {
3928
- const t = useT();
3929
- const { config, isLoading: configLoading } = usePublicConfig();
3930
- const { isLoaded, isSignedIn } = useUser();
3931
- const api = useAuthClient().organization;
3932
- const { pending, error, run } = useSubmitAction();
3933
- const [name, setName] = React38.useState("");
3934
- const [slug, setSlug] = React38.useState("");
3935
- const [logo, setLogo] = React38.useState("");
3936
- const [slugTouched, setSlugTouched] = React38.useState(false);
3937
- if (configLoading || !isLoaded) {
3938
- return /* @__PURE__ */ jsx47("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
3939
- }
3940
- if (config?.organizations !== true) return null;
3941
- if (!isSignedIn) return /* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("organization.signedOut") });
3942
- const submit = (event) => {
3943
- event.preventDefault();
3944
- const normalizedName = name.trim();
3945
- const normalizedSlug = slug.trim();
3946
- if (!normalizedName || !normalizedSlug) return;
3947
- void run(
3948
- () => api.create({
3949
- name: normalizedName,
3950
- slug: normalizedSlug,
3951
- logo: logo.trim() || null
3952
- }),
3953
- {
3954
- failure: t("organization.create.error"),
3955
- onSuccess: (result) => {
3956
- if (!result.data) return;
3957
- setName("");
3958
- setSlug("");
3959
- setLogo("");
3960
- setSlugTouched(false);
3961
- onCreated?.(result.data);
3962
- }
3963
- }
3964
- );
3965
- };
3966
- return /* @__PURE__ */ jsxs44("section", { className: "ba-organization-create", children: [
3967
- title !== null && /* @__PURE__ */ jsxs44("header", { className: "ba-organization-section-header", children: [
3968
- /* @__PURE__ */ jsx47("h2", { className: "ba-title", children: title ?? t("organization.create.title") }),
3969
- /* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("organization.create.description") })
3970
- ] }),
3971
- /* @__PURE__ */ jsxs44("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
3972
- /* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
3973
- t("organization.create.name"),
3974
- /* @__PURE__ */ jsx47(
3975
- "input",
3976
- {
3977
- className: "ba-input",
3978
- value: name,
3979
- onChange: (event) => {
3980
- const next = event.target.value;
3981
- setName(next);
3982
- if (!slugTouched) setSlug(organizationSlugFromName(next));
3983
- },
3984
- autoComplete: "organization",
3985
- required: true
3986
- }
3987
- )
3988
- ] }),
3989
- /* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
3990
- t("organization.create.slug"),
3991
- /* @__PURE__ */ jsx47(
3992
- "input",
3993
- {
3994
- className: "ba-input",
3995
- dir: "ltr",
3996
- value: slug,
3997
- onChange: (event) => {
3998
- setSlugTouched(true);
3999
- setSlug(organizationSlugFromName(event.target.value));
4000
- },
4001
- pattern: "[a-z0-9]+(?:-[a-z0-9]+)*",
4002
- required: true
4003
- }
4004
- )
4005
- ] }),
4006
- /* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
4007
- t("organization.create.logo"),
4008
- /* @__PURE__ */ jsx47(
4009
- "input",
4010
- {
4011
- className: "ba-input",
4012
- type: "url",
4013
- dir: "ltr",
4014
- value: logo,
4015
- onChange: (event) => setLogo(event.target.value),
4016
- placeholder: "https://"
4017
- }
4018
- )
4019
- ] }),
4020
- /* @__PURE__ */ jsx47(FormError, { children: error }),
4021
- /* @__PURE__ */ jsx47(
4022
- "button",
4023
- {
4024
- className: "ba-button ba-profile-submit",
4025
- type: "submit",
4026
- disabled: pending || !name.trim() || !slug.trim(),
4027
- "aria-busy": pending || void 0,
4028
- children: /* @__PURE__ */ jsx47(Busy, { busy: pending, label: t("common.working"), children: t("organization.create.submit") })
4029
- }
4030
- )
4031
- ] })
4032
- ] });
4033
- }
4034
-
4035
- // src/components/organization/OrganizationModal.tsx
4036
4030
  import * as React39 from "react";
4037
- import { jsx as jsx48, jsxs as jsxs45 } from "react/jsx-runtime";
4038
- function OrganizationModal({
4039
- title,
4040
- onClose,
4041
- returnFocusRef,
4042
- children
4043
- }) {
4044
- const t = useT();
4045
- const titleId = React39.useId();
4046
- return /* @__PURE__ */ jsxs45(
4047
- 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,
4048
4039
  {
4049
- overlayClassName: "ba-organization-overlay",
4050
- panelClassName: "ba-organization-modal",
4051
- labelledBy: titleId,
4052
- returnFocusRef,
4053
- onClose,
4054
- children: [
4055
- /* @__PURE__ */ jsxs45("div", { className: "ba-organization-modal-header", children: [
4056
- /* @__PURE__ */ jsx48("h2", { id: titleId, className: "ba-title", children: title }),
4057
- /* @__PURE__ */ jsx48(
4058
- "button",
4059
- {
4060
- className: "ba-profile-close",
4061
- type: "button",
4062
- "aria-label": t("organization.close"),
4063
- onClick: onClose,
4064
- autoFocus: true,
4065
- children: "\xD7"
4066
- }
4067
- )
4068
- ] }),
4069
- /* @__PURE__ */ jsx48("div", { className: "ba-organization-modal-body", children })
4070
- ]
4040
+ fallback: /* @__PURE__ */ jsx49("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-busy": "true" }),
4041
+ children: /* @__PURE__ */ jsx49(OrganizationSwitcherContent, { ...props })
4071
4042
  }
4072
4043
  );
4073
4044
  }
4074
4045
 
4075
- // src/components/organization/use-organizations-resource.ts
4076
- import * as React40 from "react";
4077
- function useOrganizationsResource(enabled = true) {
4078
- const api = useAuthClient().organization;
4079
- const apiRef = React40.useRef(api);
4080
- apiRef.current = api;
4081
- const { user, isLoaded, isSignedIn } = useUser();
4082
- const t = useT();
4083
- const toServerError = useServerError();
4084
- const [organizations, setOrganizations] = React40.useState(null);
4085
- const [error, setError] = React40.useState(null);
4086
- const requestRef = React40.useRef(0);
4087
- const identity = user?.id ?? null;
4088
- const refresh = React40.useCallback(async () => {
4089
- const token = ++requestRef.current;
4090
- if (!enabled || !identity || !isSignedIn) {
4091
- setOrganizations([]);
4092
- setError(null);
4093
- return;
4094
- }
4095
- try {
4096
- const result = await apiRef.current.list();
4097
- if (token !== requestRef.current) return;
4098
- if (result.error) {
4099
- setError(toServerError(result.error, t("organization.error.load")));
4100
- return;
4101
- }
4102
- setError(null);
4103
- setOrganizations(result.data ?? []);
4104
- } catch {
4105
- if (token === requestRef.current) setError(t("organization.error.load"));
4106
- }
4107
- }, [enabled, identity, isSignedIn, t, toServerError]);
4108
- React40.useEffect(() => {
4109
- setOrganizations(null);
4110
- setError(null);
4111
- if (!isLoaded) return;
4112
- void refresh();
4113
- return () => {
4114
- requestRef.current += 1;
4115
- };
4116
- }, [identity, isLoaded, refresh]);
4117
- React40.useEffect(
4118
- () => api.subscribe(() => void refresh()),
4119
- [api, refresh]
4120
- );
4121
- return {
4122
- organizations,
4123
- isLoading: !isLoaded || organizations === null && error === null,
4124
- error,
4125
- refresh
4126
- };
4127
- }
4128
-
4129
- // src/components/OrganizationProfile.tsx
4130
- import * as React44 from "react";
4131
-
4132
- // src/components/organization/DangerSection.tsx
4133
- import * as React41 from "react";
4134
- import { jsx as jsx49, jsxs as jsxs46 } from "react/jsx-runtime";
4135
- function DangerSection({
4136
- organization,
4137
- membership,
4138
- onDeleted,
4139
- onLeft
4140
- }) {
4141
- const t = useT();
4142
- const api = useAuthClient().organization;
4143
- const session = useSession();
4144
- const { pending, error, run } = useSubmitAction();
4145
- const [confirmation, setConfirmation] = React41.useState("");
4146
- const isOwner = hasOrganizationRole(membership, "owner");
4147
- const confirmed = confirmation.trim().toLowerCase() === organization.slug.toLowerCase();
4148
- const leave = () => {
4149
- if (!window.confirm(t("organization.profile.danger.leaveConfirm", { name: organization.name }))) return;
4150
- void run(
4151
- () => api.leave({ organizationId: organization.id }),
4152
- {
4153
- failure: t("organization.profile.danger.leaveError"),
4154
- onSuccess: async () => {
4155
- await session.refetch({ query: { disableCookieCache: true } });
4156
- onLeft?.(organization);
4157
- }
4158
- }
4159
- );
4160
- };
4161
- const remove = (event) => {
4162
- event.preventDefault();
4163
- if (!confirmed) return;
4164
- void run(
4165
- () => api.delete({ organizationId: organization.id }),
4166
- {
4167
- failure: t("organization.profile.danger.deleteError"),
4168
- onSuccess: async () => {
4169
- await session.refetch({ query: { disableCookieCache: true } });
4170
- onDeleted?.(organization);
4171
- }
4172
- }
4173
- );
4174
- };
4175
- return /* @__PURE__ */ jsxs46("section", { className: "ba-organization-section ba-organization-danger", children: [
4176
- /* @__PURE__ */ jsxs46("header", { className: "ba-organization-section-header", children: [
4177
- /* @__PURE__ */ jsx49("h3", { className: "ba-title", children: t("organization.profile.danger.title") }),
4178
- /* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.profile.danger.description") })
4179
- ] }),
4180
- /* @__PURE__ */ jsxs46("div", { className: "ba-organization-danger-action", children: [
4181
- /* @__PURE__ */ jsx49("strong", { children: t("organization.profile.danger.leaveTitle") }),
4182
- /* @__PURE__ */ jsx49("p", { className: "ba-muted", children: isOwner ? t("organization.profile.danger.ownerLeaveHint") : t("organization.profile.danger.leaveHint") }),
4183
- /* @__PURE__ */ jsx49("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: leave, children: t("organization.profile.danger.leave") })
4184
- ] }),
4185
- isOwner && /* @__PURE__ */ jsxs46("form", { method: "post", className: "ba-organization-danger-action ba-organization-delete", onSubmit: remove, children: [
4186
- /* @__PURE__ */ jsx49("strong", { children: t("organization.profile.danger.deleteTitle") }),
4187
- /* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.profile.danger.deleteHint") }),
4188
- /* @__PURE__ */ jsxs46("label", { className: "ba-label", children: [
4189
- t("organization.profile.danger.deleteConfirm"),
4190
- " ",
4191
- /* @__PURE__ */ jsx49(Bidi, { children: organization.slug }),
4192
- /* @__PURE__ */ jsx49("input", { className: "ba-input", dir: "ltr", value: confirmation, onChange: (event) => setConfirmation(event.target.value), autoComplete: "off", required: true })
4193
- ] }),
4194
- /* @__PURE__ */ jsx49(
4195
- "button",
4196
- {
4197
- className: "ba-button ba-danger-button",
4198
- type: "submit",
4199
- disabled: pending || !confirmed,
4200
- "aria-busy": pending || void 0,
4201
- children: /* @__PURE__ */ jsx49(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.danger.delete") })
4202
- }
4203
- )
4204
- ] }),
4205
- /* @__PURE__ */ jsx49(FormError, { children: error })
4206
- ] });
4207
- }
4208
-
4209
- // src/components/organization/GeneralSection.tsx
4210
- import * as React42 from "react";
4211
- import { jsx as jsx50, jsxs as jsxs47 } from "react/jsx-runtime";
4212
- function GeneralSection({
4213
- organization,
4214
- canManage,
4215
- onChanged
4216
- }) {
4217
- const t = useT();
4218
- const api = useAuthClient().organization;
4219
- const { pending, error, run } = useSubmitAction();
4220
- const [name, setName] = React42.useState(organization.name);
4221
- const [slug, setSlug] = React42.useState(organization.slug);
4222
- const [logo, setLogo] = React42.useState(organization.logo ?? "");
4223
- React42.useEffect(() => {
4224
- setName(organization.name);
4225
- setSlug(organization.slug);
4226
- setLogo(organization.logo ?? "");
4227
- }, [organization.id, organization.logo, organization.name, organization.slug]);
4228
- if (!canManage) {
4229
- return /* @__PURE__ */ jsxs47("section", { className: "ba-organization-section", children: [
4230
- /* @__PURE__ */ jsx50("p", { className: "ba-muted", children: t("organization.profile.general.readOnly") }),
4231
- /* @__PURE__ */ jsxs47("dl", { className: "ba-organization-facts", children: [
4232
- /* @__PURE__ */ jsxs47("div", { children: [
4233
- /* @__PURE__ */ jsx50("dt", { children: t("organization.create.name") }),
4234
- /* @__PURE__ */ jsx50("dd", { children: organization.name })
4235
- ] }),
4236
- /* @__PURE__ */ jsxs47("div", { children: [
4237
- /* @__PURE__ */ jsx50("dt", { children: t("organization.create.slug") }),
4238
- /* @__PURE__ */ jsx50("dd", { children: /* @__PURE__ */ jsx50(Bidi, { children: organization.slug }) })
4239
- ] })
4240
- ] })
4241
- ] });
4242
- }
4243
- const submit = (event) => {
4244
- event.preventDefault();
4245
- void run(
4246
- () => api.update({
4247
- organizationId: organization.id,
4248
- data: { name: name.trim(), slug: slug.trim(), logo: logo.trim() || null }
4249
- }),
4250
- {
4251
- failure: t("organization.profile.general.error"),
4252
- onSuccess: onChanged
4253
- }
4254
- );
4255
- };
4256
- return /* @__PURE__ */ jsxs47("section", { className: "ba-organization-section", children: [
4257
- /* @__PURE__ */ jsxs47("header", { className: "ba-organization-section-header", children: [
4258
- /* @__PURE__ */ jsx50("h3", { className: "ba-title", children: t("organization.profile.general.title") }),
4259
- /* @__PURE__ */ jsx50("p", { className: "ba-muted", children: t("organization.profile.general.description") })
4260
- ] }),
4261
- /* @__PURE__ */ jsxs47("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
4262
- /* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
4263
- t("organization.create.name"),
4264
- /* @__PURE__ */ jsx50("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
4265
- ] }),
4266
- /* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
4267
- t("organization.create.slug"),
4268
- /* @__PURE__ */ jsx50(
4269
- "input",
4270
- {
4271
- className: "ba-input",
4272
- dir: "ltr",
4273
- value: slug,
4274
- onChange: (event) => setSlug(organizationSlugFromName(event.target.value)),
4275
- pattern: "[a-z0-9]+(?:-[a-z0-9]+)*",
4276
- required: true
4277
- }
4278
- )
4279
- ] }),
4280
- /* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
4281
- t("organization.create.logo"),
4282
- /* @__PURE__ */ jsx50("input", { className: "ba-input", type: "url", dir: "ltr", value: logo, onChange: (event) => setLogo(event.target.value), placeholder: "https://" })
4283
- ] }),
4284
- /* @__PURE__ */ jsx50(FormError, { children: error }),
4285
- /* @__PURE__ */ jsx50(
4286
- "button",
4287
- {
4288
- className: "ba-button ba-profile-submit",
4289
- type: "submit",
4290
- disabled: pending || !name.trim() || !slug.trim(),
4291
- "aria-busy": pending || void 0,
4292
- children: /* @__PURE__ */ jsx50(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.general.save") })
4293
- }
4294
- )
4295
- ] })
4296
- ] });
4297
- }
4298
-
4299
- // src/components/organization/InvitationsSection.tsx
4300
- import * as React43 from "react";
4301
-
4302
- // src/components/organization/role-label.ts
4303
- function organizationRoleLabel(role, t) {
4304
- const roles = organizationRoles(role);
4305
- return (roles.length > 0 ? roles : [role]).map((roleKey) => {
4306
- if (roleKey === "owner") return t("organization.role.owner");
4307
- if (roleKey === "admin") return t("organization.role.admin");
4308
- if (roleKey === "member") return t("organization.role.member");
4309
- const label2 = roleKey.split(/[-_]+/).filter(Boolean).map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(" ");
4310
- return t("organization.role.custom", { role: label2 });
4311
- }).join(t("organization.role.separator"));
4312
- }
4313
-
4314
- // src/components/organization/InvitationsSection.tsx
4315
- import { jsx as jsx51, jsxs as jsxs48 } from "react/jsx-runtime";
4316
- function InvitationsSection({
4317
- organization,
4318
- onChanged
4319
- }) {
4320
- const t = useT();
4321
- const api = useAuthClient().organization;
4322
- const { pending, error, run } = useSubmitAction();
4323
- const { roles } = useOrganizationRoles(organization.id);
4324
- const [email, setEmail] = React43.useState("");
4325
- const [role, setRole] = React43.useState("member");
4326
- const invitations = organization.invitations.filter((invitation) => invitation.status === "pending");
4327
- const invite = (event) => {
4328
- event.preventDefault();
4329
- void run(
4330
- () => api.inviteMember({ organizationId: organization.id, email: email.trim(), role }),
4331
- {
4332
- failure: t("organization.profile.invitations.inviteError"),
4333
- onSuccess: async () => {
4334
- setEmail("");
4335
- await onChanged();
4336
- }
4337
- }
4338
- );
4339
- };
4340
- const cancel = (invitation) => {
4341
- if (!window.confirm(t("organization.profile.invitations.cancelConfirm", { email: invitation.email }))) return;
4342
- void run(
4343
- () => api.cancelInvitation({ invitationId: invitation.id }),
4344
- { failure: t("organization.profile.invitations.cancelError"), onSuccess: onChanged }
4345
- );
4346
- };
4347
- return /* @__PURE__ */ jsxs48("section", { className: "ba-organization-section", children: [
4348
- /* @__PURE__ */ jsxs48("header", { className: "ba-organization-section-header", children: [
4349
- /* @__PURE__ */ jsx51("h3", { className: "ba-title", children: t("organization.profile.invitations.title") }),
4350
- /* @__PURE__ */ jsx51("p", { className: "ba-muted", children: t("organization.profile.invitations.description") })
4351
- ] }),
4352
- /* @__PURE__ */ jsxs48("form", { method: "post", className: "ba-organization-invite-form", onSubmit: invite, children: [
4353
- /* @__PURE__ */ jsxs48("label", { className: "ba-label", children: [
4354
- t("organization.profile.invitations.email"),
4355
- /* @__PURE__ */ jsx51("input", { className: "ba-input", type: "email", dir: "ltr", value: email, onChange: (event) => setEmail(event.target.value), required: true })
4356
- ] }),
4357
- /* @__PURE__ */ jsxs48("label", { className: "ba-label", children: [
4358
- t("organization.profile.members.role"),
4359
- /* @__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)) })
4360
- ] }),
4361
- /* @__PURE__ */ jsx51(
4362
- "button",
4363
- {
4364
- className: "ba-button",
4365
- type: "submit",
4366
- disabled: pending || !email.trim(),
4367
- "aria-busy": pending || void 0,
4368
- children: /* @__PURE__ */ jsx51(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.invitations.invite") })
4369
- }
4370
- )
4371
- ] }),
4372
- /* @__PURE__ */ jsx51(FormError, { children: error }),
4373
- 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: [
4374
- /* @__PURE__ */ jsxs48("span", { children: [
4375
- /* @__PURE__ */ jsx51("strong", { children: /* @__PURE__ */ jsx51(Bidi, { children: invitation.email }) }),
4376
- /* @__PURE__ */ jsx51("small", { children: organizationRoleLabel(invitation.role, t) })
4377
- ] }),
4378
- /* @__PURE__ */ jsx51("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => cancel(invitation), children: t("organization.profile.invitations.cancel") })
4379
- ] }, invitation.id)) })
4380
- ] });
4381
- }
4382
-
4383
- // src/components/organization/MembersSection.tsx
4384
- import { jsx as jsx52, jsxs as jsxs49 } from "react/jsx-runtime";
4385
- function MembersSection({
4386
- organization,
4387
- userId,
4388
- canManage,
4389
- onChanged
4390
- }) {
4391
- const t = useT();
4392
- const api = useAuthClient().organization;
4393
- const { pending, error, run } = useSubmitAction();
4394
- const { roles } = useOrganizationRoles(organization.id);
4395
- const updateRole = (member, role) => {
4396
- const current = organizationRoles(member.role)[0] ?? member.role;
4397
- if (current === role) return;
4398
- if (!window.confirm(t("organization.profile.members.roleConfirm", { name: member.user.name, role: organizationRoleLabel(role, t) }))) return;
4399
- void run(
4400
- () => api.updateMemberRole({ organizationId: organization.id, memberId: member.id, role }),
4401
- { failure: t("organization.profile.members.roleError"), onSuccess: onChanged }
4402
- );
4403
- };
4404
- const remove = (member) => {
4405
- if (!window.confirm(t("organization.profile.members.removeConfirm", { name: member.user.name }))) return;
4406
- void run(
4407
- () => api.removeMember({ organizationId: organization.id, memberIdOrEmail: member.id }),
4408
- { failure: t("organization.profile.members.removeError"), onSuccess: onChanged }
4409
- );
4410
- };
4411
- return /* @__PURE__ */ jsxs49("section", { className: "ba-organization-section", children: [
4412
- /* @__PURE__ */ jsxs49("header", { className: "ba-organization-section-header", children: [
4413
- /* @__PURE__ */ jsx52("h3", { className: "ba-title", children: t("organization.profile.members.title") }),
4414
- /* @__PURE__ */ jsx52("p", { className: "ba-muted", children: t("organization.profile.members.description") })
4415
- ] }),
4416
- /* @__PURE__ */ jsx52(FormError, { children: error }),
4417
- /* @__PURE__ */ jsx52("ul", { className: "ba-organization-list", children: organization.members.map((member) => {
4418
- const primaryRole = organizationRoles(member.role)[0] ?? member.role;
4419
- const isCurrent = member.userId === userId;
4420
- return /* @__PURE__ */ jsxs49("li", { className: "ba-organization-member", children: [
4421
- /* @__PURE__ */ jsx52("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: member.user.name.trim().charAt(0).toUpperCase() || "?" }),
4422
- /* @__PURE__ */ jsxs49("span", { className: "ba-organization-member-copy", children: [
4423
- /* @__PURE__ */ jsxs49("strong", { children: [
4424
- member.user.name,
4425
- isCurrent ? ` ${t("organization.profile.members.you")}` : ""
4426
- ] }),
4427
- /* @__PURE__ */ jsx52("small", { children: /* @__PURE__ */ jsx52(Bidi, { children: member.user.email }) })
4428
- ] }),
4429
- canManage && !isCurrent ? /* @__PURE__ */ jsxs49("span", { className: "ba-organization-member-actions", children: [
4430
- /* @__PURE__ */ jsx52("label", { className: "ba-sr-only", htmlFor: `organization-role-${member.id}`, children: t("organization.profile.members.role") }),
4431
- /* @__PURE__ */ jsx52(
4432
- "select",
4433
- {
4434
- id: `organization-role-${member.id}`,
4435
- className: "ba-input ba-organization-role",
4436
- value: primaryRole,
4437
- disabled: pending,
4438
- onChange: (event) => updateRole(member, event.target.value),
4439
- children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */ jsx52("option", { value: role, children: organizationRoleLabel(role, t) }, role))
4440
- }
4441
- ),
4442
- /* @__PURE__ */ jsx52("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(member), children: t("organization.profile.members.remove") })
4443
- ] }) : /* @__PURE__ */ jsx52("span", { className: "ba-organization-role-label", children: /* @__PURE__ */ jsx52(Bidi, { children: organizationRoleLabel(member.role, t) }) })
4444
- ] }, member.id);
4445
- }) })
4446
- ] });
4447
- }
4448
-
4449
- // src/components/OrganizationProfile.tsx
4450
- import { jsx as jsx53, jsxs as jsxs50 } from "react/jsx-runtime";
4451
- var SECTION_KEYS2 = {
4452
- general: "organization.profile.nav.general",
4453
- members: "organization.profile.nav.members",
4454
- teams: "organization.profile.nav.teams",
4455
- invitations: "organization.profile.nav.invitations",
4456
- danger: "organization.profile.nav.danger"
4457
- };
4458
- var TeamsSection = React44.lazy(() => import("./TeamsSection-NV64O5I4.js"));
4459
- function OrganizationProfile({ organizationId, defaultSection = "general", onDeleted, onLeft } = {}) {
4460
- const t = useT();
4461
- const toServerError = useServerError();
4462
- const { config, isLoading: configLoading } = usePublicConfig();
4463
- const { user, isLoaded, isSignedIn } = useUser();
4464
- const session = useSession();
4465
- const api = useAuthClient().organization;
4466
- const apiRef = React44.useRef(api);
4467
- apiRef.current = api;
4468
- const activeOrganizationId = session.data?.session.activeOrganizationId ?? null;
4469
- const requestedId = organizationId ?? activeOrganizationId;
4470
- const enabled = config?.organizations === true && isSignedIn;
4471
- const [organization, setOrganization] = React44.useState(null);
4472
- const [error, setError] = React44.useState(null);
4473
- const [wasRemoved, setWasRemoved] = React44.useState(false);
4474
- const [section, setSection] = React44.useState(defaultSection);
4475
- const requestRef = React44.useRef(0);
4476
- const load = React44.useCallback(async () => {
4477
- const token = ++requestRef.current;
4478
- if (!enabled || !requestedId) {
4479
- setOrganization(null);
4480
- setError(null);
4481
- return;
4482
- }
4483
- try {
4484
- const result = await apiRef.current.get({ organizationId: requestedId });
4485
- if (token !== requestRef.current) return;
4486
- if (result.error) {
4487
- setError(toServerError(result.error, t("organization.profile.loadError")));
4488
- return;
4489
- }
4490
- setError(null);
4491
- setOrganization(result.data ?? null);
4492
- } catch {
4493
- if (token === requestRef.current) setError(t("organization.profile.loadError"));
4494
- }
4495
- }, [enabled, requestedId, t, toServerError]);
4496
- React44.useEffect(() => {
4497
- setOrganization(null);
4498
- setError(null);
4499
- setWasRemoved(false);
4500
- void load();
4501
- return () => {
4502
- requestRef.current += 1;
4503
- };
4504
- }, [load]);
4505
- if (configLoading || !isLoaded) return /* @__PURE__ */ jsx53("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
4506
- if (config?.organizations !== true) return null;
4507
- if (!isSignedIn || !user) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.signedOut") });
4508
- if (wasRemoved) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.noActive") });
4509
- if (!requestedId) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.noActive") });
4510
- if (error) {
4511
- return /* @__PURE__ */ jsxs50("div", { className: "ba-inline-error", children: [
4512
- /* @__PURE__ */ jsx53(FormError, { children: error }),
4513
- /* @__PURE__ */ jsx53("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
4514
- ] });
4515
- }
4516
- if (!organization) return /* @__PURE__ */ jsx53("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
4517
- const membership = organization.members.find((member) => member.userId === user.id);
4518
- if (!membership) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.notMember") });
4519
- const canManage = canManageOrganization(membership);
4520
- const visibleSections = canManage ? ["general", "members", "teams", "invitations", "danger"] : ["general", "members", "teams", "danger"];
4521
- const activeSection = visibleSections.includes(section) ? section : "general";
4522
- const handleRemoval = (callback) => (removedOrganization) => {
4523
- setWasRemoved(true);
4524
- setOrganization(null);
4525
- callback?.(removedOrganization);
4526
- };
4527
- return /* @__PURE__ */ jsxs50("article", { className: "ba-organization-profile", children: [
4528
- /* @__PURE__ */ jsxs50("header", { className: "ba-organization-profile-heading", children: [
4529
- /* @__PURE__ */ jsx53("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
4530
- /* @__PURE__ */ jsxs50("span", { children: [
4531
- /* @__PURE__ */ jsx53("h2", { className: "ba-title", children: organization.name }),
4532
- /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: organization.slug })
4533
- ] })
4534
- ] }),
4535
- /* @__PURE__ */ jsxs50("div", { className: "ba-organization-profile-layout", children: [
4536
- /* @__PURE__ */ jsx53("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ jsx53(
4537
- "button",
4538
- {
4539
- className: "ba-profile-nav-item",
4540
- type: "button",
4541
- "aria-current": activeSection === item ? "page" : void 0,
4542
- onClick: () => setSection(item),
4543
- children: t(SECTION_KEYS2[item])
4544
- },
4545
- item
4546
- )) }),
4547
- /* @__PURE__ */ jsxs50("div", { className: "ba-organization-profile-content", children: [
4548
- activeSection === "general" && /* @__PURE__ */ jsx53(GeneralSection, { organization, canManage, onChanged: load }),
4549
- activeSection === "members" && /* @__PURE__ */ jsx53(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
4550
- activeSection === "teams" && /* @__PURE__ */ jsx53(React44.Suspense, { fallback: null, children: /* @__PURE__ */ jsx53(TeamsSection, { organization, membership }) }),
4551
- activeSection === "invitations" && /* @__PURE__ */ jsx53(InvitationsSection, { organization, onChanged: load }),
4552
- activeSection === "danger" && /* @__PURE__ */ jsx53(
4553
- DangerSection,
4554
- {
4555
- organization,
4556
- membership,
4557
- onDeleted: handleRemoval(onDeleted),
4558
- onLeft: handleRemoval(onLeft)
4559
- }
4560
- )
4561
- ] })
4562
- ] })
4563
- ] });
4564
- }
4565
-
4566
- // src/components/OrganizationSwitcher.tsx
4567
- import { Fragment as Fragment13, jsx as jsx54, jsxs as jsxs51 } from "react/jsx-runtime";
4568
- function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChange } = {}) {
4569
- const t = useT();
4570
- const { config, isLoading: configLoading } = usePublicConfig();
4571
- const { isLoaded, isSignedIn } = useUser();
4572
- const session = useSession();
4573
- const api = useAuthClient().organization;
4574
- const enabled = config?.organizations === true && isSignedIn;
4575
- const { organizations, isLoading, error: loadError, refresh } = useOrganizationsResource(enabled);
4576
- const { pending, error, run } = useSubmitAction();
4577
- const [open, setOpen] = React45.useState(false);
4578
- const [dialog, setDialog] = React45.useState(null);
4579
- const rootRef = React45.useRef(null);
4580
- const triggerRef = React45.useRef(null);
4581
- const menuRef = React45.useRef(null);
4582
- const menuId = React45.useId();
4583
- const activeId = session.data?.session.activeOrganizationId ?? null;
4584
- const active = organizations?.find((organization) => organization.id === activeId) ?? null;
4585
- React45.useEffect(() => {
4586
- if (!open) return;
4587
- const onPointerDown = (event) => {
4588
- if (!rootRef.current?.contains(event.target)) setOpen(false);
4589
- };
4590
- const onKeyDown = (event) => {
4591
- if (event.key === "Escape") setOpen(false);
4592
- };
4593
- document.addEventListener("pointerdown", onPointerDown);
4594
- document.addEventListener("keydown", onKeyDown);
4595
- return () => {
4596
- document.removeEventListener("pointerdown", onPointerDown);
4597
- document.removeEventListener("keydown", onKeyDown);
4598
- };
4599
- }, [open]);
4600
- if (configLoading || !isLoaded) return /* @__PURE__ */ jsx54("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
4601
- if (config?.organizations !== true) return null;
4602
- if (!isSignedIn) return /* @__PURE__ */ jsx54("p", { className: "ba-muted", children: t("organization.signedOut") });
4603
- const select = (organization) => {
4604
- void run(
4605
- () => api.setActive({ organizationId: organization?.id ?? null }),
4606
- {
4607
- failure: t("organization.switcher.error"),
4608
- onSuccess: async () => {
4609
- await session.refetch({ query: { disableCookieCache: true } });
4610
- setOpen(false);
4611
- onOrganizationChange?.(organization);
4612
- }
4613
- }
4614
- );
4615
- };
4616
- const afterProfileRemoval = async () => {
4617
- await refresh();
4618
- await session.refetch({ query: { disableCookieCache: true } });
4619
- setDialog(null);
4620
- };
4621
- const focusMenuItem = (position) => {
4622
- window.requestAnimationFrame(() => {
4623
- const items = menuRef.current?.querySelectorAll('[role="menuitem"]:not([disabled])');
4624
- if (!items?.length) return;
4625
- items[position === "first" ? 0 : items.length - 1]?.focus();
4626
- });
4627
- };
4628
- const onMenuKeyDown = (event) => {
4629
- const items = [...menuRef.current?.querySelectorAll('[role="menuitem"]:not([disabled])') ?? []];
4630
- if (event.key === "Escape") {
4631
- event.preventDefault();
4632
- event.stopPropagation();
4633
- setOpen(false);
4634
- triggerRef.current?.focus();
4635
- return;
4636
- }
4637
- if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key) || items.length === 0) return;
4638
- event.preventDefault();
4639
- const current = items.indexOf(document.activeElement);
4640
- if (event.key === "Home") items[0]?.focus();
4641
- else if (event.key === "End") items.at(-1)?.focus();
4642
- else if (event.key === "ArrowDown") items[(current + 1 + items.length) % items.length]?.focus();
4643
- else items[(current - 1 + items.length) % items.length]?.focus();
4644
- };
4645
- return /* @__PURE__ */ jsxs51(Fragment13, { children: [
4646
- /* @__PURE__ */ jsxs51("div", { ref: rootRef, className: "ba-organization-switcher", children: [
4647
- /* @__PURE__ */ jsxs51(
4648
- "button",
4649
- {
4650
- ref: triggerRef,
4651
- className: "ba-organization-switcher-trigger",
4652
- type: "button",
4653
- "aria-haspopup": "menu",
4654
- "aria-expanded": open,
4655
- "aria-controls": open ? menuId : void 0,
4656
- onClick: () => setOpen((value) => !value),
4657
- onKeyDown: (event) => {
4658
- if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
4659
- event.preventDefault();
4660
- setOpen(true);
4661
- focusMenuItem(event.key === "ArrowDown" ? "first" : "last");
4662
- },
4663
- children: [
4664
- /* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
4665
- /* @__PURE__ */ jsx54("span", { children: active?.name ?? t("organization.personal") }),
4666
- /* @__PURE__ */ jsx54("span", { "aria-hidden": "true", children: "\u2304" })
4667
- ]
4668
- }
4669
- ),
4670
- open && /* @__PURE__ */ jsxs51("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
4671
- isLoading ? /* @__PURE__ */ jsx54("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs51(Fragment13, { children: [
4672
- 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: [
4673
- /* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
4674
- /* @__PURE__ */ jsx54("span", { children: t("organization.personal") })
4675
- ] }),
4676
- 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: [
4677
- /* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
4678
- /* @__PURE__ */ jsxs51("span", { children: [
4679
- organization.name,
4680
- /* @__PURE__ */ jsx54("small", { children: organization.slug })
4681
- ] })
4682
- ] }, organization.id))
4683
- ] }),
4684
- (loadError || error) && /* @__PURE__ */ jsxs51("div", { className: "ba-inline-error", children: [
4685
- /* @__PURE__ */ jsx54(FormError, { children: loadError ?? error }),
4686
- loadError && /* @__PURE__ */ jsx54("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
4687
- ] }),
4688
- /* @__PURE__ */ jsxs51("div", { className: "ba-organization-menu-actions", children: [
4689
- active && /* @__PURE__ */ jsx54("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
4690
- setOpen(false);
4691
- setDialog("profile");
4692
- }, children: t("organization.switcher.manage") }),
4693
- /* @__PURE__ */ jsx54("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
4694
- setOpen(false);
4695
- setDialog("create");
4696
- }, children: t("organization.switcher.create") })
4697
- ] })
4698
- ] })
4699
- ] }),
4700
- dialog === "create" && /* @__PURE__ */ jsx54(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx54(
4701
- CreateOrganization,
4702
- {
4703
- title: null,
4704
- onCreated: (organization) => {
4705
- void (async () => {
4706
- await refresh();
4707
- await session.refetch({ query: { disableCookieCache: true } });
4708
- setDialog(null);
4709
- onOrganizationChange?.(organization);
4710
- })();
4711
- }
4712
- }
4713
- ) }),
4714
- 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() }) })
4715
- ] });
4716
- }
4717
-
4718
4046
  // src/components/OrganizationList.tsx
4719
- import * as React46 from "react";
4720
- import { Fragment as Fragment14, jsx as jsx55, jsxs as jsxs52 } from "react/jsx-runtime";
4721
- function OrganizationList({ onOrganizationChange } = {}) {
4722
- const t = useT();
4723
- const toServerError = useServerError();
4724
- const { config, isLoading: configLoading } = usePublicConfig();
4725
- const { user, isLoaded, isSignedIn } = useUser();
4726
- const session = useSession();
4727
- const api = useAuthClient().organization;
4728
- const apiRef = React46.useRef(api);
4729
- apiRef.current = api;
4730
- const enabled = config?.organizations === true && isSignedIn;
4731
- const { organizations, isLoading, error: organizationError, refresh } = useOrganizationsResource(enabled);
4732
- const { pending, error, run } = useSubmitAction();
4733
- const [invitations, setInvitations] = React46.useState(null);
4734
- const [invitationError, setInvitationError] = React46.useState(null);
4735
- const [dialog, setDialog] = React46.useState(null);
4736
- const [profileId, setProfileId] = React46.useState(null);
4737
- const dialogReturnFocusRef = React46.useRef(null);
4738
- const invitationRequestRef = React46.useRef(0);
4739
- const activeId = session.data?.session.activeOrganizationId ?? null;
4740
- const loadInvitations = React46.useCallback(async () => {
4741
- const token = ++invitationRequestRef.current;
4742
- if (!enabled) {
4743
- setInvitations([]);
4744
- setInvitationError(null);
4745
- return;
4746
- }
4747
- try {
4748
- const result = await apiRef.current.listUserInvitations();
4749
- if (token !== invitationRequestRef.current) return;
4750
- if (result.error) {
4751
- setInvitationError(toServerError(result.error, t("organization.list.invitationsError")));
4752
- return;
4753
- }
4754
- setInvitationError(null);
4755
- setInvitations((result.data ?? []).filter((invitation) => invitation.status === "pending"));
4756
- } catch {
4757
- if (token === invitationRequestRef.current) setInvitationError(t("organization.list.invitationsError"));
4758
- }
4759
- }, [enabled, t, toServerError]);
4760
- React46.useEffect(() => {
4761
- setInvitations(null);
4762
- setInvitationError(null);
4763
- if (!isLoaded) return;
4764
- void loadInvitations();
4765
- return () => {
4766
- invitationRequestRef.current += 1;
4767
- };
4768
- }, [isLoaded, loadInvitations, user?.id]);
4769
- if (configLoading || !isLoaded) return /* @__PURE__ */ jsx55("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
4770
- if (config?.organizations !== true) return null;
4771
- if (!isSignedIn) return /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.signedOut") });
4772
- const setActive = (organization) => {
4773
- void run(
4774
- () => api.setActive({ organizationId: organization.id }),
4775
- {
4776
- failure: t("organization.switcher.error"),
4777
- onSuccess: async () => {
4778
- await session.refetch({ query: { disableCookieCache: true } });
4779
- onOrganizationChange?.(organization);
4780
- }
4781
- }
4782
- );
4783
- };
4784
- const invitationAction = (invitation, action) => {
4785
- const onSuccess = async () => {
4786
- await Promise.all([refresh(), loadInvitations()]);
4787
- if (action === "accept") await session.refetch({ query: { disableCookieCache: true } });
4788
- };
4789
- if (action === "accept") {
4790
- void run(
4791
- () => api.acceptInvitation({ invitationId: invitation.id }),
4792
- { failure: t("organization.list.acceptError"), onSuccess }
4793
- );
4794
- return;
4795
- }
4796
- void run(
4797
- () => api.rejectInvitation({ invitationId: invitation.id }),
4798
- { failure: t("organization.list.rejectError"), onSuccess }
4799
- );
4800
- };
4801
- const openProfile = (organization, trigger) => {
4802
- dialogReturnFocusRef.current = trigger;
4803
- setProfileId(organization.id);
4804
- setDialog("profile");
4805
- };
4806
- const afterProfileRemoval = async () => {
4807
- await refresh();
4808
- await session.refetch({ query: { disableCookieCache: true } });
4809
- setDialog(null);
4810
- setProfileId(null);
4811
- };
4812
- return /* @__PURE__ */ jsxs52(Fragment14, { children: [
4813
- /* @__PURE__ */ jsxs52("section", { className: "ba-organization-directory", children: [
4814
- /* @__PURE__ */ jsxs52("header", { className: "ba-organization-directory-header", children: [
4815
- /* @__PURE__ */ jsxs52("span", { children: [
4816
- /* @__PURE__ */ jsx55("h2", { className: "ba-title", children: t("organization.list.title") }),
4817
- /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.description") })
4818
- ] }),
4819
- /* @__PURE__ */ jsx55("button", { className: "ba-button", type: "button", onClick: (event) => {
4820
- dialogReturnFocusRef.current = event.currentTarget;
4821
- setDialog("create");
4822
- }, children: t("organization.switcher.create") })
4823
- ] }),
4824
- (organizationError || error) && /* @__PURE__ */ jsxs52("div", { className: "ba-inline-error", children: [
4825
- /* @__PURE__ */ jsx55(FormError, { children: organizationError ?? error }),
4826
- organizationError && /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
4827
- ] }),
4828
- isLoading ? /* @__PURE__ */ jsxs52("div", { className: "ba-organization-card-grid", children: [
4829
- /* @__PURE__ */ jsx55("div", { className: "ba-skeleton" }),
4830
- /* @__PURE__ */ jsx55("div", { className: "ba-skeleton" })
4831
- ] }) : organizations?.length ? /* @__PURE__ */ jsx55("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ jsxs52("li", { className: "ba-organization-card", children: [
4832
- /* @__PURE__ */ jsx55("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
4833
- /* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-copy", children: [
4834
- /* @__PURE__ */ jsx55("strong", { children: organization.name }),
4835
- /* @__PURE__ */ jsx55("small", { children: /* @__PURE__ */ jsx55(Bidi, { children: organization.slug }) })
4836
- ] }),
4837
- activeId === organization.id && /* @__PURE__ */ jsx55("span", { className: "ba-organization-active", children: t("organization.list.active") }),
4838
- /* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-actions", children: [
4839
- activeId !== organization.id && /* @__PURE__ */ jsx55("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
4840
- /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
4841
- ] })
4842
- ] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.empty") }),
4843
- /* @__PURE__ */ jsxs52("section", { className: "ba-organization-user-invitations", children: [
4844
- /* @__PURE__ */ jsxs52("header", { className: "ba-organization-section-header", children: [
4845
- /* @__PURE__ */ jsx55("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
4846
- /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
4847
- ] }),
4848
- invitationError && /* @__PURE__ */ jsxs52("div", { className: "ba-inline-error", children: [
4849
- /* @__PURE__ */ jsx55(FormError, { children: invitationError }),
4850
- /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
4851
- ] }),
4852
- invitations?.length ? /* @__PURE__ */ jsx55("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ jsxs52("li", { className: "ba-organization-invitation", children: [
4853
- /* @__PURE__ */ jsxs52("span", { children: [
4854
- /* @__PURE__ */ jsx55("strong", { children: invitation.organizationName }),
4855
- /* @__PURE__ */ jsx55("small", { children: organizationRoleLabel(invitation.role, t) })
4856
- ] }),
4857
- /* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-actions", children: [
4858
- /* @__PURE__ */ jsx55("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
4859
- /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
4860
- ] })
4861
- ] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */ jsx55("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
4862
- ] })
4863
- ] }),
4864
- dialog === "create" && /* @__PURE__ */ jsx55(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx55(CreateOrganization, { title: null, onCreated: () => {
4865
- void (async () => {
4866
- await refresh();
4867
- await session.refetch({ query: { disableCookieCache: true } });
4868
- setDialog(null);
4869
- })();
4870
- } }) }),
4871
- 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() }) })
4872
- ] });
4047
+ import * as React40 from "react";
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 }) });
4873
4055
  }
4874
4056
 
4875
4057
  // src/components/GoogleOneTap.tsx
4876
- import * as React47 from "react";
4058
+ import * as React41 from "react";
4877
4059
 
4878
4060
  // src/components/google-one-tap.ts
4879
4061
  var GOOGLE_IDENTITY_SCRIPT = "https://accounts.google.com/gsi/client";
@@ -5049,16 +4231,16 @@ function GoogleOneTap({
5049
4231
  const { config, isLoading: configLoading, isError: configError } = usePublicConfig();
5050
4232
  const { user, isLoaded: sessionLoaded } = useUser();
5051
4233
  const { signInSocial } = useSignIn();
5052
- const callbacks = React47.useRef({ onSignedIn, onSkipped, onDismissed, onError });
4234
+ const callbacks = React41.useRef({ onSignedIn, onSkipped, onDismissed, onError });
5053
4235
  callbacks.current = { onSignedIn, onSkipped, onDismissed, onError };
5054
4236
  const googleEnabled = config?.socialProviders.includes("google") === true;
5055
4237
  const clientId = config?.socialProviderClientIds?.google;
5056
- React47.useEffect(() => {
4238
+ React41.useEffect(() => {
5057
4239
  if (process.env.NODE_ENV === "production") return;
5058
4240
  if (disabled || !googleEnabled || !clientId || nonce) return;
5059
4241
  warnOneTapWithoutNonce(clientId);
5060
4242
  }, [clientId, disabled, googleEnabled, nonce]);
5061
- React47.useEffect(() => {
4243
+ React41.useEffect(() => {
5062
4244
  if (configLoading || !sessionLoaded) return;
5063
4245
  if (disabled) {
5064
4246
  callbacks.current.onSkipped?.("disabled");
@@ -5205,6 +4387,7 @@ export {
5205
4387
  PasskeyButton,
5206
4388
  PasskeyManager,
5207
4389
  PhoneOTP,
4390
+ PrivacyCenter,
5208
4391
  Protect,
5209
4392
  RateLimitedError,
5210
4393
  ResetPassword,
@@ -5240,6 +4423,7 @@ export {
5240
4423
  useOrganizationInvitation,
5241
4424
  usePasskeys,
5242
4425
  usePasswordReset,
4426
+ usePrivacy,
5243
4427
  usePublicConfig,
5244
4428
  useSession,
5245
4429
  useSignIn,