@authowl/react 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -6,6 +6,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __esm = (fn, res) => function __init() {
10
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
+ };
9
12
  var __export = (target, all) => {
10
13
  for (var name in all)
11
14
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -28,87 +31,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
31
  ));
29
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
33
 
31
- // src/index.ts
32
- var index_exports = {};
33
- __export(index_exports, {
34
- AuthLoaded: () => AuthLoaded,
35
- AuthLoading: () => AuthLoading,
36
- AuthOwlBadge: () => AuthOwlBadge,
37
- AuthOwlBranding: () => AuthOwlBranding,
38
- AuthOwlError: () => import_core7.AuthOwlError,
39
- AuthOwlProvider: () => AuthOwlProvider,
40
- BackupCodesManager: () => BackupCodesManager,
41
- Bidi: () => Bidi,
42
- ConsentDocLinks: () => ConsentDocLinks,
43
- ConsentGate: () => ConsentGate,
44
- CreateOrganization: () => CreateOrganization,
45
- DEFAULT_BRAND_COLOR: () => DEFAULT_BRAND_COLOR,
46
- EmailOtpForm: () => EmailOtpForm,
47
- ForgotPassword: () => ForgotPassword,
48
- GoogleOneTap: () => GoogleOneTap,
49
- InvalidKeyError: () => import_core7.InvalidKeyError,
50
- InvitationPrompt: () => InvitationPrompt,
51
- KNOWN_METHODS: () => KNOWN_METHODS,
52
- MFAChallenge: () => MFAChallenge,
53
- MFAEnrollment: () => MFAEnrollment,
54
- MFARequiredGate: () => MFARequiredGate,
55
- MagicLinkForm: () => MagicLinkForm,
56
- OrganizationList: () => OrganizationList,
57
- OrganizationProfile: () => OrganizationProfile,
58
- OrganizationSwitcher: () => OrganizationSwitcher,
59
- PasskeyButton: () => PasskeyButton,
60
- PasskeyManager: () => PasskeyManager,
61
- PhoneOTP: () => PhoneOTP,
62
- Protect: () => Protect,
63
- RateLimitedError: () => import_core7.RateLimitedError,
64
- ResetPassword: () => ResetPassword,
65
- SignIn: () => SignIn,
66
- SignOutButton: () => SignOutButton,
67
- SignUp: () => SignUp,
68
- SignedIn: () => SignedIn,
69
- SignedOut: () => SignedOut,
70
- SocialButtons: () => SocialButtons,
71
- Spinner: () => Spinner,
72
- UserButton: () => UserButton,
73
- UserProfile: () => UserProfile,
74
- VerificationPending: () => VerificationPending,
75
- VerifyEmail: () => VerifyEmail,
76
- Waitlist: () => Waitlist,
77
- createMembershipHas: () => import_core8.createMembershipHas,
78
- emailAutocomplete: () => emailAutocomplete,
79
- membershipHas: () => import_core8.membershipHas,
80
- membershipHasPermission: () => import_core8.membershipHasPermission,
81
- membershipHasTeam: () => import_core8.membershipHasTeam,
82
- resolveSignInMethods: () => resolveSignInMethods,
83
- useAccount: () => useAccount,
84
- useAuth: () => useAuth,
85
- useAuthClient: () => useAuthClient,
86
- useAuthOwlContext: () => useAuthOwlContext,
87
- useConsent: () => useConsent,
88
- useEmailVerification: () => useEmailVerification,
89
- useLocale: () => useLocale,
90
- useMFA: () => useMFA,
91
- useOrganization: () => useOrganization,
92
- useOrganizationInvitation: () => useOrganizationInvitation,
93
- usePasskeys: () => usePasskeys,
94
- usePasswordReset: () => usePasswordReset,
95
- usePublicConfig: () => usePublicConfig,
96
- useSession: () => useSession,
97
- useSignIn: () => useSignIn,
98
- useSignOut: () => useSignOut,
99
- useSignUp: () => useSignUp,
100
- useUser: () => useUser,
101
- useWaitlist: () => useWaitlist
102
- });
103
- module.exports = __toCommonJS(index_exports);
104
-
105
- // src/provider.tsx
106
- var React5 = __toESM(require("react"), 1);
107
- var import_core2 = require("@authowl/core");
108
-
109
34
  // src/brand.ts
110
- var DEFAULT_BRAND_COLOR = "#F5B84C";
111
- var HEX6 = /^#[0-9a-fA-F]{6}$/;
112
35
  function isHex6(value) {
113
36
  return typeof value === "string" && HEX6.test(value);
114
37
  }
@@ -166,7 +89,6 @@ function oklchToLinearRgb({ L, C, h }) {
166
89
  b: -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
167
90
  };
168
91
  }
169
- var GAMUT_EPS = 1e-4;
170
92
  function inGamut({ r, g, b }) {
171
93
  return r >= -GAMUT_EPS && r <= 1 + GAMUT_EPS && g >= -GAMUT_EPS && g <= 1 + GAMUT_EPS && b >= -GAMUT_EPS && b <= 1 + GAMUT_EPS;
172
94
  }
@@ -198,10 +120,6 @@ function contrastRatio(hexA, hexB) {
198
120
  const [hi, lo] = la >= lb ? [la, lb] : [lb, la];
199
121
  return (hi + 0.05) / (lo + 0.05);
200
122
  }
201
- var NEAR_BLACK = "#18181b";
202
- var WHITE = "#ffffff";
203
- var AA_TEXT = 4.5;
204
- var PURE_BLACK = "#000000";
205
123
  function readableForeground(solidHex) {
206
124
  const white = contrastRatio(WHITE, solidHex);
207
125
  const nearBlack = contrastRatio(NEAR_BLACK, solidHex);
@@ -223,8 +141,6 @@ function readableAccent(brandHex, surfaceHex, dir) {
223
141
  }
224
142
  return dir === 1 ? WHITE : NEAR_BLACK;
225
143
  }
226
- var LIGHT_SURFACE = "#ffffff";
227
- var DARK_SURFACE = "#18181b";
228
144
  function deriveBrandRamp(primaryHex) {
229
145
  const solid = normalizeHex(primaryHex) ?? DEFAULT_BRAND_COLOR.toLowerCase();
230
146
  const fg = readableForeground(solid);
@@ -257,6 +173,21 @@ function brandRampVars(set) {
257
173
  "--ba-rt-accent-fg": set.light.accentFg
258
174
  };
259
175
  }
176
+ var DEFAULT_BRAND_COLOR, HEX6, GAMUT_EPS, NEAR_BLACK, WHITE, AA_TEXT, PURE_BLACK, LIGHT_SURFACE, DARK_SURFACE;
177
+ var init_brand = __esm({
178
+ "src/brand.ts"() {
179
+ "use strict";
180
+ DEFAULT_BRAND_COLOR = "#F5B84C";
181
+ HEX6 = /^#[0-9a-fA-F]{6}$/;
182
+ GAMUT_EPS = 1e-4;
183
+ NEAR_BLACK = "#18181b";
184
+ WHITE = "#ffffff";
185
+ AA_TEXT = 4.5;
186
+ PURE_BLACK = "#000000";
187
+ LIGHT_SURFACE = "#ffffff";
188
+ DARK_SURFACE = "#18181b";
189
+ }
190
+ });
260
191
 
261
192
  // src/appearance.ts
262
193
  function resolveAppearance(appearance, config) {
@@ -270,13 +201,12 @@ function resolveAppearance(appearance, config) {
270
201
  }
271
202
  return { theme, primaryColor, style };
272
203
  }
273
-
274
- // src/components/InvitationPrompt.tsx
275
- var React4 = __toESM(require("react"), 1);
276
-
277
- // src/hooks.ts
278
- var React = __toESM(require("react"), 1);
279
- var import_core = require("@authowl/core");
204
+ var init_appearance = __esm({
205
+ "src/appearance.ts"() {
206
+ "use strict";
207
+ init_brand();
208
+ }
209
+ });
280
210
 
281
211
  // src/components/auth-state.ts
282
212
  function sessionAuthState(data) {
@@ -287,6 +217,11 @@ function sessionAuthState(data) {
287
217
  needsMfaEnrollment: hasUser && pending
288
218
  };
289
219
  }
220
+ var init_auth_state = __esm({
221
+ "src/components/auth-state.ts"() {
222
+ "use strict";
223
+ }
224
+ });
290
225
 
291
226
  // src/hooks.ts
292
227
  function useAuthClient() {
@@ -548,12 +483,19 @@ function useSignOut() {
548
483
  const client = useAuthClient();
549
484
  return { signOut: client.signOut };
550
485
  }
486
+ var React, import_core;
487
+ var init_hooks = __esm({
488
+ "src/hooks.ts"() {
489
+ "use strict";
490
+ "use client";
491
+ React = __toESM(require("react"), 1);
492
+ import_core = require("@authowl/core");
493
+ init_provider();
494
+ init_auth_state();
495
+ }
496
+ });
551
497
 
552
498
  // src/i18n/index.tsx
553
- var React2 = __toESM(require("react"), 1);
554
- var import_i18n = require("@authowl/core/i18n");
555
- var import_i18n2 = require("@authowl/core/i18n");
556
- var import_jsx_runtime = require("react/jsx-runtime");
557
499
  function useLocale() {
558
500
  return useAuthOwlContext().locale;
559
501
  }
@@ -583,12 +525,20 @@ function useServerError() {
583
525
  [locale]
584
526
  );
585
527
  }
528
+ var React2, import_i18n, import_i18n2, import_jsx_runtime;
529
+ var init_i18n = __esm({
530
+ "src/i18n/index.tsx"() {
531
+ "use strict";
532
+ "use client";
533
+ React2 = __toESM(require("react"), 1);
534
+ import_i18n = require("@authowl/core/i18n");
535
+ init_provider();
536
+ import_i18n2 = require("@authowl/core/i18n");
537
+ import_jsx_runtime = require("react/jsx-runtime");
538
+ }
539
+ });
586
540
 
587
541
  // src/components/ModalSurface.tsx
588
- var React3 = __toESM(require("react"), 1);
589
- var import_react_dom = require("react-dom");
590
- var import_jsx_runtime2 = require("react/jsx-runtime");
591
- var useClientLayoutEffect = typeof document === "undefined" ? React3.useEffect : React3.useLayoutEffect;
592
542
  function ModalSurface({
593
543
  overlayClassName,
594
544
  panelClassName,
@@ -661,9 +611,19 @@ function ModalSurface({
661
611
  portalTarget ? (0, import_react_dom.createPortal)(surface, portalTarget) : null
662
612
  ] });
663
613
  }
614
+ var React3, import_react_dom, import_jsx_runtime2, useClientLayoutEffect;
615
+ var init_ModalSurface = __esm({
616
+ "src/components/ModalSurface.tsx"() {
617
+ "use strict";
618
+ "use client";
619
+ React3 = __toESM(require("react"), 1);
620
+ import_react_dom = require("react-dom");
621
+ import_jsx_runtime2 = require("react/jsx-runtime");
622
+ useClientLayoutEffect = typeof document === "undefined" ? React3.useEffect : React3.useLayoutEffect;
623
+ }
624
+ });
664
625
 
665
626
  // src/components/InvitationPrompt.tsx
666
- var import_jsx_runtime3 = require("react/jsx-runtime");
667
627
  function InvitationPrompt() {
668
628
  const t = useT();
669
629
  const { invitation, status, accept, dismiss } = useOrganizationInvitation();
@@ -721,10 +681,20 @@ function InvitationPrompt() {
721
681
  }
722
682
  );
723
683
  }
684
+ var React4, import_jsx_runtime3;
685
+ var init_InvitationPrompt = __esm({
686
+ "src/components/InvitationPrompt.tsx"() {
687
+ "use strict";
688
+ "use client";
689
+ React4 = __toESM(require("react"), 1);
690
+ init_hooks();
691
+ init_i18n();
692
+ init_ModalSurface();
693
+ import_jsx_runtime3 = require("react/jsx-runtime");
694
+ }
695
+ });
724
696
 
725
697
  // src/provider.tsx
726
- var import_jsx_runtime4 = require("react/jsx-runtime");
727
- var warnedConfigProjects = /* @__PURE__ */ new Set();
728
698
  function warnPublicConfigFailed(resolved, error) {
729
699
  let origin = resolved.apiUrl;
730
700
  try {
@@ -739,7 +709,6 @@ function warnPublicConfigFailed(resolved, error) {
739
709
  `[AuthOwl] Could not load this project's public config from ${origin} (${reason}). Falling back to a password-only sign-in form, regardless of the methods this project actually enabled. Likely causes: the API is unreachable, \`apiUrl\` is wrong, or the publishable key points at a missing/mismatched project. If password sign-in is not enabled for this project, the form will dead-end at submit - check \`apiUrl\` and \`publishableKey\` on <AuthOwlProvider>. (This warning is dev-only.)`
740
710
  );
741
711
  }
742
- var Context = React5.createContext(null);
743
712
  function detectLocale() {
744
713
  if (typeof document !== "undefined") {
745
714
  const root = document.documentElement;
@@ -818,13 +787,602 @@ function AuthOwlProvider({
818
787
  }
819
788
  ) });
820
789
  }
821
- function useAuthOwlContext() {
822
- const v = React5.useContext(Context);
823
- if (!v) {
824
- throw new Error("AuthOwl hooks must be used inside <AuthOwlProvider>");
790
+ function useAuthOwlContext() {
791
+ const v = React5.useContext(Context);
792
+ if (!v) {
793
+ throw new Error("AuthOwl hooks must be used inside <AuthOwlProvider>");
794
+ }
795
+ return v;
796
+ }
797
+ var React5, import_core2, import_jsx_runtime4, warnedConfigProjects, Context;
798
+ var init_provider = __esm({
799
+ "src/provider.tsx"() {
800
+ "use strict";
801
+ "use client";
802
+ React5 = __toESM(require("react"), 1);
803
+ import_core2 = require("@authowl/core");
804
+ init_appearance();
805
+ init_InvitationPrompt();
806
+ import_jsx_runtime4 = require("react/jsx-runtime");
807
+ warnedConfigProjects = /* @__PURE__ */ new Set();
808
+ Context = React5.createContext(null);
809
+ }
810
+ });
811
+
812
+ // src/components/use-submit-action.ts
813
+ function useSubmitAction() {
814
+ const [pending, setPending] = React6.useState(false);
815
+ const [error, setError] = React6.useState(null);
816
+ const toMessage = useServerError();
817
+ const run = React6.useCallback(
818
+ async (action, { failure, onSuccess, mapError, keepPendingOnSuccess }) => {
819
+ setError(null);
820
+ setPending(true);
821
+ try {
822
+ const res = await action();
823
+ if (res?.error) {
824
+ setError(mapError?.(res.error) ?? toMessage(res.error, failure));
825
+ setPending(false);
826
+ return;
827
+ }
828
+ await onSuccess?.(res ?? { data: null, error: null });
829
+ if (!keepPendingOnSuccess) setPending(false);
830
+ } catch {
831
+ setError(failure);
832
+ setPending(false);
833
+ }
834
+ },
835
+ [toMessage]
836
+ );
837
+ return { pending, error, setError, run };
838
+ }
839
+ var React6;
840
+ var init_use_submit_action = __esm({
841
+ "src/components/use-submit-action.ts"() {
842
+ "use strict";
843
+ "use client";
844
+ React6 = __toESM(require("react"), 1);
845
+ init_i18n();
846
+ }
847
+ });
848
+
849
+ // src/components/Spinner.tsx
850
+ function Spinner() {
851
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ba-spinner", "aria-hidden": "true" });
852
+ }
853
+ function Busy({ busy, label: label2, children }) {
854
+ return busy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
855
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
856
+ label2
857
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children });
858
+ }
859
+ var import_jsx_runtime6;
860
+ var init_Spinner = __esm({
861
+ "src/components/Spinner.tsx"() {
862
+ "use strict";
863
+ "use client";
864
+ import_jsx_runtime6 = require("react/jsx-runtime");
865
+ }
866
+ });
867
+
868
+ // src/components/FormError.tsx
869
+ function FormError({ children, className, "data-testid": testId }) {
870
+ if (children == null || children === "" || children === false) return null;
871
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
872
+ "p",
873
+ {
874
+ className: className ? `ba-error ${className}` : "ba-error",
875
+ role: "alert",
876
+ "aria-live": "assertive",
877
+ "data-testid": testId,
878
+ children
879
+ }
880
+ );
881
+ }
882
+ var import_jsx_runtime7;
883
+ var init_FormError = __esm({
884
+ "src/components/FormError.tsx"() {
885
+ "use strict";
886
+ "use client";
887
+ import_jsx_runtime7 = require("react/jsx-runtime");
888
+ }
889
+ });
890
+
891
+ // src/components/organization/model.ts
892
+ function organizationSlugFromName(name) {
893
+ return name.normalize("NFKD").toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
894
+ }
895
+ function organizationRoles(role) {
896
+ return role.split(",").map((value) => value.trim()).filter(Boolean);
897
+ }
898
+ function hasOrganizationRole(member, role) {
899
+ return member ? organizationRoles(member.role).includes(role) : false;
900
+ }
901
+ function canManageOrganization(member) {
902
+ return hasOrganizationRole(member, "owner") || hasOrganizationRole(member, "admin");
903
+ }
904
+ function roleHasStatement(roles, heldRoles, resource, action) {
905
+ return roles.some((role) => {
906
+ if (!heldRoles.has(role.role) || typeof role.permission !== "object" || role.permission === null) {
907
+ return false;
908
+ }
909
+ const actions = role.permission[resource];
910
+ return Array.isArray(actions) && actions.includes(action);
911
+ });
912
+ }
913
+ function teamManagementCapabilities(member, dynamicRoles) {
914
+ const heldRoles = new Set(organizationRoles(member.role));
915
+ if (heldRoles.has("owner") || heldRoles.has("admin")) {
916
+ return {
917
+ createTeam: true,
918
+ updateTeam: true,
919
+ deleteTeam: true,
920
+ addTeamMember: true,
921
+ removeTeamMember: true
922
+ };
923
+ }
924
+ return {
925
+ createTeam: roleHasStatement(dynamicRoles, heldRoles, "team", "create"),
926
+ updateTeam: roleHasStatement(dynamicRoles, heldRoles, "team", "update"),
927
+ deleteTeam: roleHasStatement(dynamicRoles, heldRoles, "team", "delete"),
928
+ addTeamMember: roleHasStatement(dynamicRoles, heldRoles, "member", "update"),
929
+ removeTeamMember: roleHasStatement(dynamicRoles, heldRoles, "member", "delete")
930
+ };
931
+ }
932
+ var init_model = __esm({
933
+ "src/components/organization/model.ts"() {
934
+ "use strict";
935
+ }
936
+ });
937
+
938
+ // src/components/organization/use-organization-roles.ts
939
+ function useOrganizationRoles(organizationId) {
940
+ const api = useAuthClient().organization;
941
+ const apiRef = React49.useRef(api);
942
+ apiRef.current = api;
943
+ const [dynamicRoles, setDynamicRoles] = React49.useState([]);
944
+ const requestRef = React49.useRef(0);
945
+ React49.useEffect(() => {
946
+ const token = ++requestRef.current;
947
+ setDynamicRoles([]);
948
+ if (!organizationId) return;
949
+ void (async () => {
950
+ try {
951
+ const result = await apiRef.current.listRoles({ organizationId });
952
+ if (token !== requestRef.current) return;
953
+ setDynamicRoles((result.data ?? []).filter((entry) => entry.role.trim().length > 0));
954
+ } catch {
955
+ }
956
+ })();
957
+ return () => {
958
+ requestRef.current += 1;
959
+ };
960
+ }, [organizationId]);
961
+ const roles = React49.useMemo(() => {
962
+ const seen = /* @__PURE__ */ new Set();
963
+ const out = [];
964
+ for (const candidate of [...BUILTIN_ROLES, ...dynamicRoles.map((entry) => entry.role)]) {
965
+ const key = candidate.trim();
966
+ if (!key || seen.has(key)) continue;
967
+ seen.add(key);
968
+ out.push(key);
969
+ }
970
+ return out;
971
+ }, [dynamicRoles]);
972
+ return { roles, dynamicRoles };
973
+ }
974
+ var React49, BUILTIN_ROLES;
975
+ var init_use_organization_roles = __esm({
976
+ "src/components/organization/use-organization-roles.ts"() {
977
+ "use strict";
978
+ "use client";
979
+ React49 = __toESM(require("react"), 1);
980
+ init_hooks();
981
+ BUILTIN_ROLES = ["owner", "admin", "member"];
982
+ }
983
+ });
984
+
985
+ // src/components/organization/use-organization-list-resource.ts
986
+ function useOrganizationListResource({
987
+ enabled,
988
+ resourceKey,
989
+ request,
990
+ fallback,
991
+ inactiveData = null
992
+ }) {
993
+ const toServerError = useServerError();
994
+ const requestFn = React51.useRef(request);
995
+ requestFn.current = request;
996
+ const [data, setData] = React51.useState(null);
997
+ const [error, setError] = React51.useState(null);
998
+ const requestToken = React51.useRef(0);
999
+ const refresh = React51.useCallback(async () => {
1000
+ const token = ++requestToken.current;
1001
+ if (!enabled || !resourceKey) {
1002
+ setData(inactiveData);
1003
+ setError(null);
1004
+ return;
1005
+ }
1006
+ setError(null);
1007
+ try {
1008
+ const result = await requestFn.current();
1009
+ if (token !== requestToken.current) return;
1010
+ if (result.error) {
1011
+ setError(toServerError(result.error, fallback));
1012
+ return;
1013
+ }
1014
+ setData(result.data ?? []);
1015
+ } catch {
1016
+ if (token === requestToken.current) setError(fallback);
1017
+ }
1018
+ }, [enabled, fallback, inactiveData, resourceKey, toServerError]);
1019
+ React51.useEffect(() => {
1020
+ setData(enabled && resourceKey ? null : inactiveData);
1021
+ setError(null);
1022
+ void refresh();
1023
+ return () => {
1024
+ requestToken.current += 1;
1025
+ };
1026
+ }, [enabled, inactiveData, refresh, resourceKey]);
1027
+ return { data, isLoading: data === null && error === null, error, refresh };
1028
+ }
1029
+ var React51;
1030
+ var init_use_organization_list_resource = __esm({
1031
+ "src/components/organization/use-organization-list-resource.ts"() {
1032
+ "use strict";
1033
+ "use client";
1034
+ React51 = __toESM(require("react"), 1);
1035
+ init_i18n();
1036
+ }
1037
+ });
1038
+
1039
+ // src/components/organization/use-team-resources.ts
1040
+ function useTeamsResource(organizationId) {
1041
+ const api = useAuthClient().organization;
1042
+ const apiRef = React52.useRef(api);
1043
+ apiRef.current = api;
1044
+ const t = useT();
1045
+ const resource = useOrganizationListResource({
1046
+ enabled: true,
1047
+ resourceKey: organizationId,
1048
+ request: () => apiRef.current.listTeams({ organizationId }),
1049
+ fallback: t("organization.profile.loadError")
1050
+ });
1051
+ return { teams: resource.data, error: resource.error, reload: resource.refresh };
1052
+ }
1053
+ function useTeamMembersResource(selectedTeamId) {
1054
+ const api = useAuthClient().organization;
1055
+ const apiRef = React52.useRef(api);
1056
+ apiRef.current = api;
1057
+ const t = useT();
1058
+ const resource = useOrganizationListResource({
1059
+ enabled: selectedTeamId !== null,
1060
+ resourceKey: selectedTeamId,
1061
+ request: () => apiRef.current.listTeamMembers({ teamId: selectedTeamId }),
1062
+ fallback: t("organization.profile.loadError")
1063
+ });
1064
+ return { members: resource.data, error: resource.error, reload: resource.refresh };
1065
+ }
1066
+ var React52;
1067
+ var init_use_team_resources = __esm({
1068
+ "src/components/organization/use-team-resources.ts"() {
1069
+ "use strict";
1070
+ "use client";
1071
+ React52 = __toESM(require("react"), 1);
1072
+ init_hooks();
1073
+ init_i18n();
1074
+ init_use_organization_list_resource();
1075
+ }
1076
+ });
1077
+
1078
+ // src/components/organization/TeamMembersPanel.tsx
1079
+ function TeamMembersPanel({
1080
+ organization,
1081
+ team,
1082
+ canAdd,
1083
+ canRemove
1084
+ }) {
1085
+ const t = useT();
1086
+ const api = useAuthClient().organization;
1087
+ const { pending, error: actionError, run } = useSubmitAction();
1088
+ const [userId, setUserId] = React53.useState("");
1089
+ const { members, error, reload } = useTeamMembersResource(team.id);
1090
+ const assignedUserIds = new Set(members?.map((member) => member.userId));
1091
+ const availableMembers = organization.members.filter((member) => !assignedUserIds.has(member.userId));
1092
+ const addableUserId = availableMembers.some((member) => member.userId === userId) ? userId : availableMembers[0]?.userId ?? "";
1093
+ const addMember = (event) => {
1094
+ event.preventDefault();
1095
+ if (!addableUserId) return;
1096
+ void run(
1097
+ () => api.addTeamMember({
1098
+ teamId: team.id,
1099
+ userId: addableUserId,
1100
+ organizationId: organization.id
1101
+ }),
1102
+ {
1103
+ failure: t("organization.profile.general.error"),
1104
+ onSuccess: async () => {
1105
+ setUserId("");
1106
+ await reload();
1107
+ }
1108
+ }
1109
+ );
1110
+ };
1111
+ const removeMember = (member) => {
1112
+ const organizationMember = organization.members.find((entry) => entry.userId === member.userId);
1113
+ const displayName = organizationMember?.user.name || member.userId;
1114
+ if (!window.confirm(t("organization.profile.teams.removeMemberConfirm", { name: displayName }))) return;
1115
+ void run(
1116
+ () => api.removeTeamMember({
1117
+ teamId: team.id,
1118
+ userId: member.userId,
1119
+ organizationId: organization.id
1120
+ }),
1121
+ {
1122
+ failure: t("organization.profile.general.error"),
1123
+ onSuccess: reload
1124
+ }
1125
+ );
1126
+ };
1127
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ba-organization-user-invitations", children: [
1128
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("h4", { children: t("organization.profile.teams.manageMembers") }),
1129
+ canAdd && availableMembers.length > 0 && members !== null && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: addMember, children: [
1130
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("label", { className: "ba-label", children: [
1131
+ t("organization.profile.teams.addMember"),
1132
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("select", { className: "ba-input", value: addableUserId, onChange: (event) => setUserId(event.target.value), children: availableMembers.map((member) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("option", { value: member.userId, children: member.user.name || member.user.email || member.userId }, member.userId)) })
1133
+ ] }),
1134
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !addableUserId, children: t("organization.profile.teams.addMember") })
1135
+ ] }),
1136
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FormError, { children: actionError }),
1137
+ error && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ba-inline-error", children: [
1138
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FormError, { children: error }),
1139
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void reload(), children: t("organization.retry") })
1140
+ ] }),
1141
+ members?.length ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ul", { className: "ba-organization-list", children: members.map((member) => {
1142
+ const organizationMember = organization.members.find((entry) => entry.userId === member.userId);
1143
+ const displayName = organizationMember?.user.name || member.userId;
1144
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("li", { className: "ba-organization-member", children: [
1145
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "ba-organization-member-copy", children: [
1146
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("strong", { children: displayName }),
1147
+ organizationMember?.user.email && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Bidi, { children: organizationMember.user.email }) })
1148
+ ] }),
1149
+ canRemove && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => removeMember(member), children: t("organization.profile.teams.removeMember") })
1150
+ ] }, member.id);
1151
+ }) }) : error ? null : members === null ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ba-skeleton", "aria-label": t("common.loading") }) : members.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.membersEmpty") }) : null
1152
+ ] });
1153
+ }
1154
+ var React53, import_jsx_runtime58;
1155
+ var init_TeamMembersPanel = __esm({
1156
+ "src/components/organization/TeamMembersPanel.tsx"() {
1157
+ "use strict";
1158
+ "use client";
1159
+ React53 = __toESM(require("react"), 1);
1160
+ init_hooks();
1161
+ init_i18n();
1162
+ init_FormError();
1163
+ init_use_submit_action();
1164
+ init_use_team_resources();
1165
+ import_jsx_runtime58 = require("react/jsx-runtime");
825
1166
  }
826
- return v;
1167
+ });
1168
+
1169
+ // src/components/organization/TeamsSection.tsx
1170
+ var TeamsSection_exports = {};
1171
+ __export(TeamsSection_exports, {
1172
+ default: () => TeamsSection
1173
+ });
1174
+ function TeamsSection({
1175
+ organization,
1176
+ membership
1177
+ }) {
1178
+ const t = useT();
1179
+ const api = useAuthClient().organization;
1180
+ const { pending, error: actionError, run } = useSubmitAction();
1181
+ const { teams, error: teamsError, reload } = useTeamsResource(organization.id);
1182
+ const { dynamicRoles } = useOrganizationRoles(organization.id);
1183
+ const capabilities = teamManagementCapabilities(membership, dynamicRoles);
1184
+ const [name, setName] = React54.useState("");
1185
+ const [selectedTeamId, setSelectedTeamId] = React54.useState(null);
1186
+ const [editingTeamId, setEditingTeamId] = React54.useState(null);
1187
+ const [editingName, setEditingName] = React54.useState("");
1188
+ React54.useEffect(() => {
1189
+ setSelectedTeamId(null);
1190
+ setEditingTeamId(null);
1191
+ setEditingName("");
1192
+ }, [organization.id]);
1193
+ const create = (event) => {
1194
+ event.preventDefault();
1195
+ void run(
1196
+ () => api.createTeam({ organizationId: organization.id, name: name.trim() }),
1197
+ {
1198
+ failure: t("organization.profile.general.error"),
1199
+ onSuccess: async () => {
1200
+ setName("");
1201
+ await reload();
1202
+ }
1203
+ }
1204
+ );
1205
+ };
1206
+ const beginRename = (team) => {
1207
+ setEditingTeamId(team.id);
1208
+ setEditingName(team.name);
1209
+ };
1210
+ const rename = (event, team) => {
1211
+ event.preventDefault();
1212
+ const nextName = editingName.trim();
1213
+ if (!nextName || nextName === team.name) return;
1214
+ void run(
1215
+ () => api.updateTeam({
1216
+ teamId: team.id,
1217
+ data: { name: nextName, organizationId: organization.id }
1218
+ }),
1219
+ {
1220
+ failure: t("organization.profile.general.error"),
1221
+ onSuccess: async () => {
1222
+ setEditingTeamId(null);
1223
+ setEditingName("");
1224
+ await reload();
1225
+ }
1226
+ }
1227
+ );
1228
+ };
1229
+ const remove = (team) => {
1230
+ if (!window.confirm(t("organization.profile.teams.removeTeamConfirm", { name: team.name }))) return;
1231
+ void run(
1232
+ () => api.removeTeam({ teamId: team.id, organizationId: organization.id }),
1233
+ {
1234
+ failure: t("organization.profile.general.error"),
1235
+ onSuccess: async () => {
1236
+ if (selectedTeamId === team.id) setSelectedTeamId(null);
1237
+ if (editingTeamId === team.id) setEditingTeamId(null);
1238
+ await reload();
1239
+ }
1240
+ }
1241
+ );
1242
+ };
1243
+ const selectedTeam = teams?.find((team) => team.id === selectedTeamId);
1244
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("section", { className: "ba-organization-section", children: [
1245
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("header", { className: "ba-organization-section-header", children: [
1246
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h3", { className: "ba-title", children: t("organization.profile.teams.title") }),
1247
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.description") })
1248
+ ] }),
1249
+ capabilities.createTeam ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: create, children: [
1250
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("label", { className: "ba-label", children: [
1251
+ t("organization.profile.teams.create"),
1252
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
1253
+ ] }),
1254
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !name.trim(), "aria-busy": pending || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.teams.create") }) })
1255
+ ] }) : null,
1256
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(FormError, { children: actionError }),
1257
+ teamsError && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ba-inline-error", children: [
1258
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(FormError, { children: teamsError }),
1259
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void reload(), children: t("organization.retry") })
1260
+ ] }),
1261
+ teams?.length ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: "ba-organization-list", children: teams.map((team) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("li", { className: "ba-organization-member", children: [
1262
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: team.name.trim().charAt(0).toUpperCase() || "?" }),
1263
+ editingTeamId === team.id ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: (event) => rename(event, team), children: [
1264
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("label", { className: "ba-label", children: [
1265
+ t("organization.profile.teams.rename"),
1266
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("input", { className: "ba-input", value: editingName, onChange: (event) => setEditingName(event.target.value), required: true, autoFocus: true })
1267
+ ] }),
1268
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !editingName.trim(), children: t("organization.profile.teams.rename") }),
1269
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => setEditingTeamId(null), children: t("organization.profile.teams.cancel") })
1270
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
1271
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ba-organization-member-copy", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("strong", { children: team.name }) }),
1272
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "ba-organization-member-actions", children: [
1273
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, "aria-expanded": selectedTeamId === team.id, onClick: () => setSelectedTeamId(selectedTeamId === team.id ? null : team.id), children: t("organization.profile.teams.manageMembers") }),
1274
+ capabilities.updateTeam && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => beginRename(team), children: t("organization.profile.teams.rename") }),
1275
+ capabilities.deleteTeam && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(team), children: t("organization.profile.teams.removeTeam") })
1276
+ ] })
1277
+ ] })
1278
+ ] }, team.id)) }) : teamsError ? null : teams === null ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ba-skeleton", "aria-label": t("common.loading") }) : teams.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.empty") }) : null,
1279
+ selectedTeam && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
1280
+ TeamMembersPanel,
1281
+ {
1282
+ organization,
1283
+ team: selectedTeam,
1284
+ canAdd: capabilities.addTeamMember,
1285
+ canRemove: capabilities.removeTeamMember
1286
+ }
1287
+ )
1288
+ ] });
827
1289
  }
1290
+ var React54, import_jsx_runtime59;
1291
+ var init_TeamsSection = __esm({
1292
+ "src/components/organization/TeamsSection.tsx"() {
1293
+ "use strict";
1294
+ "use client";
1295
+ React54 = __toESM(require("react"), 1);
1296
+ init_hooks();
1297
+ init_i18n();
1298
+ init_FormError();
1299
+ init_Spinner();
1300
+ init_use_submit_action();
1301
+ init_TeamMembersPanel();
1302
+ init_model();
1303
+ init_use_organization_roles();
1304
+ init_use_team_resources();
1305
+ import_jsx_runtime59 = require("react/jsx-runtime");
1306
+ }
1307
+ });
1308
+
1309
+ // src/index.ts
1310
+ var index_exports = {};
1311
+ __export(index_exports, {
1312
+ AuthLoaded: () => AuthLoaded,
1313
+ AuthLoading: () => AuthLoading,
1314
+ AuthOwlBadge: () => AuthOwlBadge,
1315
+ AuthOwlBranding: () => AuthOwlBranding,
1316
+ AuthOwlError: () => import_core7.AuthOwlError,
1317
+ AuthOwlProvider: () => AuthOwlProvider,
1318
+ BackupCodesManager: () => BackupCodesManager,
1319
+ Bidi: () => Bidi,
1320
+ ConsentDocLinks: () => ConsentDocLinks,
1321
+ ConsentGate: () => ConsentGate,
1322
+ CreateOrganization: () => CreateOrganization,
1323
+ DEFAULT_BRAND_COLOR: () => DEFAULT_BRAND_COLOR,
1324
+ EmailOtpForm: () => EmailOtpForm,
1325
+ ForgotPassword: () => ForgotPassword,
1326
+ GoogleOneTap: () => GoogleOneTap,
1327
+ InvalidKeyError: () => import_core7.InvalidKeyError,
1328
+ InvitationPrompt: () => InvitationPrompt,
1329
+ KNOWN_METHODS: () => KNOWN_METHODS,
1330
+ MFAChallenge: () => MFAChallenge,
1331
+ MFAEnrollment: () => MFAEnrollment,
1332
+ MFARequiredGate: () => MFARequiredGate,
1333
+ MagicLinkForm: () => MagicLinkForm,
1334
+ OrganizationList: () => OrganizationList,
1335
+ OrganizationProfile: () => OrganizationProfile,
1336
+ OrganizationSwitcher: () => OrganizationSwitcher,
1337
+ PasskeyButton: () => PasskeyButton,
1338
+ PasskeyManager: () => PasskeyManager,
1339
+ PhoneOTP: () => PhoneOTP,
1340
+ Protect: () => Protect,
1341
+ RateLimitedError: () => import_core7.RateLimitedError,
1342
+ ResetPassword: () => ResetPassword,
1343
+ SignIn: () => SignIn,
1344
+ SignOutButton: () => SignOutButton,
1345
+ SignUp: () => SignUp,
1346
+ SignedIn: () => SignedIn,
1347
+ SignedOut: () => SignedOut,
1348
+ SocialButtons: () => SocialButtons,
1349
+ Spinner: () => Spinner,
1350
+ UserButton: () => UserButton,
1351
+ UserProfile: () => UserProfile,
1352
+ VerificationPending: () => VerificationPending,
1353
+ VerifyEmail: () => VerifyEmail,
1354
+ Waitlist: () => Waitlist,
1355
+ createMembershipHas: () => import_core8.createMembershipHas,
1356
+ emailAutocomplete: () => emailAutocomplete,
1357
+ membershipHas: () => import_core8.membershipHas,
1358
+ membershipHasPermission: () => import_core8.membershipHasPermission,
1359
+ membershipHasTeam: () => import_core8.membershipHasTeam,
1360
+ resolveSignInMethods: () => resolveSignInMethods,
1361
+ useAccount: () => useAccount,
1362
+ useAuth: () => useAuth,
1363
+ useAuthClient: () => useAuthClient,
1364
+ useAuthOwlContext: () => useAuthOwlContext,
1365
+ useConsent: () => useConsent,
1366
+ useEmailVerification: () => useEmailVerification,
1367
+ useLocale: () => useLocale,
1368
+ useMFA: () => useMFA,
1369
+ useOrganization: () => useOrganization,
1370
+ useOrganizationInvitation: () => useOrganizationInvitation,
1371
+ usePasskeys: () => usePasskeys,
1372
+ usePasswordReset: () => usePasswordReset,
1373
+ usePublicConfig: () => usePublicConfig,
1374
+ useSession: () => useSession,
1375
+ useSignIn: () => useSignIn,
1376
+ useSignOut: () => useSignOut,
1377
+ useSignUp: () => useSignUp,
1378
+ useUser: () => useUser,
1379
+ useWaitlist: () => useWaitlist
1380
+ });
1381
+ module.exports = __toCommonJS(index_exports);
1382
+ init_provider();
1383
+ init_i18n();
1384
+ init_brand();
1385
+ init_hooks();
828
1386
 
829
1387
  // src/project-capabilities.ts
830
1388
  var import_core3 = require("@authowl/core");
@@ -899,6 +1457,8 @@ function resolveSignInMethods(config, pageHost) {
899
1457
 
900
1458
  // src/components/SignIn.tsx
901
1459
  var React19 = __toESM(require("react"), 1);
1460
+ init_hooks();
1461
+ init_i18n();
902
1462
 
903
1463
  // src/components/redirect.ts
904
1464
  function isSafeRedirect(redirectTo, origin) {
@@ -958,37 +1518,12 @@ async function finishSignIn(opts) {
958
1518
  }
959
1519
  }
960
1520
 
961
- // src/components/use-submit-action.ts
962
- var React6 = __toESM(require("react"), 1);
963
- function useSubmitAction() {
964
- const [pending, setPending] = React6.useState(false);
965
- const [error, setError] = React6.useState(null);
966
- const toMessage = useServerError();
967
- const run = React6.useCallback(
968
- async (action, { failure, onSuccess, mapError, keepPendingOnSuccess }) => {
969
- setError(null);
970
- setPending(true);
971
- try {
972
- const res = await action();
973
- if (res?.error) {
974
- setError(mapError?.(res.error) ?? toMessage(res.error, failure));
975
- setPending(false);
976
- return;
977
- }
978
- await onSuccess?.(res ?? { data: null, error: null });
979
- if (!keepPendingOnSuccess) setPending(false);
980
- } catch {
981
- setError(failure);
982
- setPending(false);
983
- }
984
- },
985
- [toMessage]
986
- );
987
- return { pending, error, setError, run };
988
- }
1521
+ // src/components/SignIn.tsx
1522
+ init_use_submit_action();
989
1523
 
990
1524
  // src/components/passkey-autofill.ts
991
1525
  var React7 = __toESM(require("react"), 1);
1526
+ init_hooks();
992
1527
  function usePasskeyAutofill(opts) {
993
1528
  const { signInPasskey } = useSignIn();
994
1529
  const { sessionStore } = useAuthClient();
@@ -1015,6 +1550,8 @@ function usePasskeyAutofill(opts) {
1015
1550
 
1016
1551
  // src/components/SocialButtons.tsx
1017
1552
  var React8 = __toESM(require("react"), 1);
1553
+ init_hooks();
1554
+ init_i18n();
1018
1555
 
1019
1556
  // src/components/social-icons.tsx
1020
1557
  var import_jsx_runtime5 = require("react/jsx-runtime");
@@ -1069,35 +1606,9 @@ function ProviderIcon({ provider }) {
1069
1606
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: ICONS[provider] ?? null });
1070
1607
  }
1071
1608
 
1072
- // src/components/Spinner.tsx
1073
- var import_jsx_runtime6 = require("react/jsx-runtime");
1074
- function Spinner() {
1075
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ba-spinner", "aria-hidden": "true" });
1076
- }
1077
- function Busy({ busy, label: label2, children }) {
1078
- return busy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1079
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
1080
- label2
1081
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children });
1082
- }
1083
-
1084
- // src/components/FormError.tsx
1085
- var import_jsx_runtime7 = require("react/jsx-runtime");
1086
- function FormError({ children, className, "data-testid": testId }) {
1087
- if (children == null || children === "" || children === false) return null;
1088
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1089
- "p",
1090
- {
1091
- className: className ? `ba-error ${className}` : "ba-error",
1092
- role: "alert",
1093
- "aria-live": "assertive",
1094
- "data-testid": testId,
1095
- children
1096
- }
1097
- );
1098
- }
1099
-
1100
1609
  // src/components/SocialButtons.tsx
1610
+ init_Spinner();
1611
+ init_FormError();
1101
1612
  var import_jsx_runtime8 = require("react/jsx-runtime");
1102
1613
  var LABELS = {
1103
1614
  google: "Google",
@@ -1168,6 +1679,11 @@ function SocialButtons({ providers, callbackURL }) {
1168
1679
  }
1169
1680
 
1170
1681
  // src/components/PasskeyButton.tsx
1682
+ init_hooks();
1683
+ init_i18n();
1684
+ init_use_submit_action();
1685
+ init_Spinner();
1686
+ init_FormError();
1171
1687
  var import_jsx_runtime9 = require("react/jsx-runtime");
1172
1688
  function PasskeyButton({ redirectTo, onSignedIn }) {
1173
1689
  const t = useT();
@@ -1199,9 +1715,15 @@ function PasskeyButton({ redirectTo, onSignedIn }) {
1199
1715
 
1200
1716
  // src/components/ForgotPassword.tsx
1201
1717
  var React11 = __toESM(require("react"), 1);
1718
+ init_hooks();
1719
+ init_i18n();
1720
+ init_use_submit_action();
1721
+ init_Spinner();
1202
1722
 
1203
1723
  // src/components/AuthChallenge.tsx
1204
1724
  var React10 = __toESM(require("react"), 1);
1725
+ init_hooks();
1726
+ init_i18n();
1205
1727
 
1206
1728
  // src/components/Turnstile.tsx
1207
1729
  var React9 = __toESM(require("react"), 1);
@@ -1411,6 +1933,7 @@ function useAuthChallenge() {
1411
1933
  }
1412
1934
 
1413
1935
  // src/components/ForgotPassword.tsx
1936
+ init_FormError();
1414
1937
  var import_jsx_runtime12 = require("react/jsx-runtime");
1415
1938
  function ForgotPassword({ resetPasswordUrl, onBack }) {
1416
1939
  const t = useT();
@@ -1472,6 +1995,9 @@ function ForgotPassword({ resetPasswordUrl, onBack }) {
1472
1995
  }
1473
1996
 
1474
1997
  // src/components/OtpCodeForm.tsx
1998
+ init_i18n();
1999
+ init_Spinner();
2000
+ init_FormError();
1475
2001
  var import_jsx_runtime13 = require("react/jsx-runtime");
1476
2002
  function OtpCodeForm({
1477
2003
  email,
@@ -1519,6 +2045,11 @@ function OtpCodeForm({
1519
2045
 
1520
2046
  // src/components/MFAChallenge.tsx
1521
2047
  var React12 = __toESM(require("react"), 1);
2048
+ init_hooks();
2049
+ init_i18n();
2050
+ init_use_submit_action();
2051
+ init_Spinner();
2052
+ init_FormError();
1522
2053
  var import_jsx_runtime14 = require("react/jsx-runtime");
1523
2054
  function MFAChallenge({ onVerified, allowTrustDevice = true }) {
1524
2055
  const t = useT();
@@ -1587,9 +2118,15 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
1587
2118
 
1588
2119
  // src/components/mfa-enrollment-step.tsx
1589
2120
  var React15 = __toESM(require("react"), 1);
2121
+ init_hooks();
2122
+ init_i18n();
1590
2123
 
1591
2124
  // src/components/MFAEnrollment.tsx
1592
2125
  var React14 = __toESM(require("react"), 1);
2126
+ init_hooks();
2127
+ init_i18n();
2128
+ init_use_submit_action();
2129
+ init_Spinner();
1593
2130
 
1594
2131
  // src/components/mfa-enrollment.ts
1595
2132
  function shouldDiscardSetup(args) {
@@ -1599,6 +2136,7 @@ function shouldDiscardSetup(args) {
1599
2136
 
1600
2137
  // src/components/QrCode.tsx
1601
2138
  var React13 = __toESM(require("react"), 1);
2139
+ init_i18n();
1602
2140
 
1603
2141
  // ../../node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
1604
2142
  var qrcode = function(typeNumber, errorCorrectionLevel) {
@@ -3281,6 +3819,7 @@ function QrCode({ value, size = 200 }) {
3281
3819
  }
3282
3820
 
3283
3821
  // src/components/MFAEnrollment.tsx
3822
+ init_FormError();
3284
3823
  var import_jsx_runtime16 = require("react/jsx-runtime");
3285
3824
  function secretFromUri(uri) {
3286
3825
  try {
@@ -3464,6 +4003,8 @@ function MfaEnrollmentStep({ title }) {
3464
4003
  }
3465
4004
 
3466
4005
  // src/components/AuthOwlBadge.tsx
4006
+ init_hooks();
4007
+ init_i18n();
3467
4008
  var import_jsx_runtime18 = require("react/jsx-runtime");
3468
4009
  function OwlMark() {
3469
4010
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { className: "ba-badge-mark", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [
@@ -3497,11 +4038,20 @@ function AuthOwlBadge({ href = "https://authowl.dev", force } = {}) {
3497
4038
  );
3498
4039
  }
3499
4040
 
4041
+ // src/components/SignIn.tsx
4042
+ init_Spinner();
4043
+
3500
4044
  // src/components/PhoneOTP.tsx
3501
4045
  var React16 = __toESM(require("react"), 1);
3502
4046
  var import_core4 = require("@authowl/core");
4047
+ init_hooks();
4048
+ init_i18n();
4049
+
4050
+ // src/components/LegalConsentCheckbox.tsx
4051
+ init_i18n();
3503
4052
 
3504
4053
  // src/components/ConsentDocLinks.tsx
4054
+ init_i18n();
3505
4055
  var import_jsx_runtime19 = require("react/jsx-runtime");
3506
4056
  function ConsentDocLinks({ termsUrl, privacyUrl }) {
3507
4057
  const t = useT();
@@ -3543,6 +4093,9 @@ function LegalConsentCheckbox({
3543
4093
  }
3544
4094
 
3545
4095
  // src/components/PhoneOTP.tsx
4096
+ init_use_submit_action();
4097
+ init_Spinner();
4098
+ init_FormError();
3546
4099
  var import_jsx_runtime21 = require("react/jsx-runtime");
3547
4100
  function PhoneOTP({
3548
4101
  redirectTo,
@@ -3790,8 +4343,13 @@ function PhoneOTP({
3790
4343
  );
3791
4344
  }
3792
4345
 
4346
+ // src/components/SignIn.tsx
4347
+ init_FormError();
4348
+
3793
4349
  // src/components/AuthOwlBranding.tsx
3794
4350
  var React17 = __toESM(require("react"), 1);
4351
+ init_hooks();
4352
+ init_i18n();
3795
4353
  var import_jsx_runtime22 = require("react/jsx-runtime");
3796
4354
  function AuthOwlBranding({ href, showEnvironment = true } = {}) {
3797
4355
  const t = useT();
@@ -3843,6 +4401,7 @@ function AuthOwlBranding({ href, showEnvironment = true } = {}) {
3843
4401
  // src/components/InvitationBanner.tsx
3844
4402
  var React18 = __toESM(require("react"), 1);
3845
4403
  var import_core5 = require("@authowl/core");
4404
+ init_i18n();
3846
4405
  var import_jsx_runtime23 = require("react/jsx-runtime");
3847
4406
  function InvitationBanner() {
3848
4407
  const t = useT();
@@ -4185,9 +4744,16 @@ function SignIn({
4185
4744
 
4186
4745
  // src/components/SignUp.tsx
4187
4746
  var React23 = __toESM(require("react"), 1);
4747
+ init_hooks();
4748
+ init_i18n();
4188
4749
 
4189
4750
  // src/components/VerificationPending.tsx
4190
4751
  var React20 = __toESM(require("react"), 1);
4752
+ init_hooks();
4753
+ init_i18n();
4754
+ init_use_submit_action();
4755
+ init_Spinner();
4756
+ init_FormError();
4191
4757
  var import_jsx_runtime25 = require("react/jsx-runtime");
4192
4758
  function VerificationPending({
4193
4759
  email,
@@ -4308,6 +4874,11 @@ function VerificationPending({
4308
4874
 
4309
4875
  // src/components/PasswordlessSignUp.tsx
4310
4876
  var React21 = __toESM(require("react"), 1);
4877
+ init_hooks();
4878
+ init_i18n();
4879
+ init_use_submit_action();
4880
+ init_Spinner();
4881
+ init_FormError();
4311
4882
  var import_jsx_runtime26 = require("react/jsx-runtime");
4312
4883
  function PasswordlessSignUp({ onAuthenticated }) {
4313
4884
  const t = useT();
@@ -4384,6 +4955,11 @@ function PasswordlessSignUp({ onAuthenticated }) {
4384
4955
  }
4385
4956
 
4386
4957
  // src/components/PasskeySignUpCompletion.tsx
4958
+ init_hooks();
4959
+ init_i18n();
4960
+ init_use_submit_action();
4961
+ init_Spinner();
4962
+ init_FormError();
4387
4963
  var import_jsx_runtime27 = require("react/jsx-runtime");
4388
4964
  function PasskeySignUpCompletion({ onComplete }) {
4389
4965
  const t = useT();
@@ -4411,8 +4987,17 @@ function PasskeySignUpCompletion({ onComplete }) {
4411
4987
  ] });
4412
4988
  }
4413
4989
 
4990
+ // src/components/SignUp.tsx
4991
+ init_Spinner();
4992
+ init_FormError();
4993
+
4414
4994
  // src/components/Waitlist.tsx
4415
4995
  var React22 = __toESM(require("react"), 1);
4996
+ init_hooks();
4997
+ init_i18n();
4998
+ init_FormError();
4999
+ init_Spinner();
5000
+ init_use_submit_action();
4416
5001
  var import_jsx_runtime28 = require("react/jsx-runtime");
4417
5002
  function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
4418
5003
  const t = useT();
@@ -4754,6 +5339,11 @@ function SignUp({
4754
5339
  }
4755
5340
 
4756
5341
  // src/components/ConsentGate.tsx
5342
+ init_hooks();
5343
+ init_i18n();
5344
+ init_use_submit_action();
5345
+ init_Spinner();
5346
+ init_FormError();
4757
5347
  var import_jsx_runtime30 = require("react/jsx-runtime");
4758
5348
  function ConsentGate({ children, title }) {
4759
5349
  const t = useT();
@@ -4801,6 +5391,11 @@ function MFARequiredGate({ children, title }) {
4801
5391
 
4802
5392
  // src/components/BackupCodesManager.tsx
4803
5393
  var React24 = __toESM(require("react"), 1);
5394
+ init_hooks();
5395
+ init_i18n();
5396
+ init_use_submit_action();
5397
+ init_Spinner();
5398
+ init_FormError();
4804
5399
  var import_jsx_runtime32 = require("react/jsx-runtime");
4805
5400
  function BackupCodesManager({ title }) {
4806
5401
  const t = useT();
@@ -4853,6 +5448,11 @@ function BackupCodesManager({ title }) {
4853
5448
 
4854
5449
  // src/components/MagicLinkForm.tsx
4855
5450
  var React25 = __toESM(require("react"), 1);
5451
+ init_hooks();
5452
+ init_i18n();
5453
+ init_use_submit_action();
5454
+ init_Spinner();
5455
+ init_FormError();
4856
5456
  var import_jsx_runtime33 = require("react/jsx-runtime");
4857
5457
  function MagicLinkForm({ callbackURL, webauthnAutofill }) {
4858
5458
  const t = useT();
@@ -4911,6 +5511,11 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
4911
5511
 
4912
5512
  // src/components/EmailOtpForm.tsx
4913
5513
  var React26 = __toESM(require("react"), 1);
5514
+ init_hooks();
5515
+ init_i18n();
5516
+ init_use_submit_action();
5517
+ init_Spinner();
5518
+ init_FormError();
4914
5519
  var import_jsx_runtime34 = require("react/jsx-runtime");
4915
5520
  function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
4916
5521
  const t = useT();
@@ -4995,6 +5600,11 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
4995
5600
 
4996
5601
  // src/components/ResetPassword.tsx
4997
5602
  var React27 = __toESM(require("react"), 1);
5603
+ init_hooks();
5604
+ init_i18n();
5605
+ init_use_submit_action();
5606
+ init_Spinner();
5607
+ init_FormError();
4998
5608
  var import_jsx_runtime35 = require("react/jsx-runtime");
4999
5609
  function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
5000
5610
  const t = useT();
@@ -5096,6 +5706,11 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
5096
5706
 
5097
5707
  // src/components/VerifyEmail.tsx
5098
5708
  var React28 = __toESM(require("react"), 1);
5709
+ init_hooks();
5710
+ init_i18n();
5711
+ init_use_submit_action();
5712
+ init_Spinner();
5713
+ init_FormError();
5099
5714
  var import_jsx_runtime36 = require("react/jsx-runtime");
5100
5715
  function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
5101
5716
  const t = useT();
@@ -5172,6 +5787,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
5172
5787
 
5173
5788
  // src/components/PasskeyManager.tsx
5174
5789
  var React29 = __toESM(require("react"), 1);
5790
+ init_hooks();
5791
+ init_i18n();
5792
+ init_use_submit_action();
5793
+ init_Spinner();
5794
+ init_FormError();
5175
5795
  var import_jsx_runtime37 = require("react/jsx-runtime");
5176
5796
  function PasskeyManager({ title, allowAdd = true } = {}) {
5177
5797
  const t = useT();
@@ -5284,6 +5904,9 @@ function PasskeyManagerBody({
5284
5904
 
5285
5905
  // src/components/control.tsx
5286
5906
  var import_core6 = require("@authowl/core");
5907
+ init_hooks();
5908
+ init_i18n();
5909
+ init_Spinner();
5287
5910
  var import_jsx_runtime38 = require("react/jsx-runtime");
5288
5911
  function SignedIn({ children }) {
5289
5912
  const { isLoaded, isSignedIn } = useUser();
@@ -5325,8 +5948,14 @@ function AuthLoaded({ children }) {
5325
5948
  return useUser().isLoaded ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children }) : null;
5326
5949
  }
5327
5950
 
5951
+ // src/index.ts
5952
+ init_Spinner();
5953
+
5328
5954
  // src/components/SignOutButton.tsx
5329
5955
  var React30 = __toESM(require("react"), 1);
5956
+ init_hooks();
5957
+ init_i18n();
5958
+ init_Spinner();
5330
5959
  var import_jsx_runtime39 = require("react/jsx-runtime");
5331
5960
  function SignOutButton({ children, redirectTo, onSignedOut, className }) {
5332
5961
  const t = useT();
@@ -5358,12 +5987,21 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
5358
5987
 
5359
5988
  // src/components/UserButton.tsx
5360
5989
  var React43 = __toESM(require("react"), 1);
5990
+ init_hooks();
5991
+ init_i18n();
5361
5992
 
5362
5993
  // src/components/UserProfile.tsx
5363
5994
  var React42 = __toESM(require("react"), 1);
5995
+ init_hooks();
5996
+ init_i18n();
5364
5997
 
5365
5998
  // src/components/user-profile/EmailSection.tsx
5366
5999
  var React31 = __toESM(require("react"), 1);
6000
+ init_hooks();
6001
+ init_i18n();
6002
+ init_use_submit_action();
6003
+ init_Spinner();
6004
+ init_FormError();
5367
6005
  var import_jsx_runtime40 = require("react/jsx-runtime");
5368
6006
  function EmailSection({ allowChange }) {
5369
6007
  const t = useT();
@@ -5438,6 +6076,11 @@ function EmailSection({ allowChange }) {
5438
6076
 
5439
6077
  // src/components/user-profile/DeleteAccountSection.tsx
5440
6078
  var React32 = __toESM(require("react"), 1);
6079
+ init_hooks();
6080
+ init_i18n();
6081
+ init_use_submit_action();
6082
+ init_Spinner();
6083
+ init_FormError();
5441
6084
  var import_jsx_runtime41 = require("react/jsx-runtime");
5442
6085
  function DeleteAccountSection({ onDeleted }) {
5443
6086
  const t = useT();
@@ -5505,6 +6148,11 @@ function DeleteAccountSection({ onDeleted }) {
5505
6148
 
5506
6149
  // src/components/user-profile/MfaSection.tsx
5507
6150
  var React33 = __toESM(require("react"), 1);
6151
+ init_hooks();
6152
+ init_i18n();
6153
+ init_use_submit_action();
6154
+ init_Spinner();
6155
+ init_FormError();
5508
6156
  var import_jsx_runtime42 = require("react/jsx-runtime");
5509
6157
  function MfaSection() {
5510
6158
  const t = useT();
@@ -5611,6 +6259,11 @@ function MfaSection() {
5611
6259
 
5612
6260
  // src/components/user-profile/PasswordSection.tsx
5613
6261
  var React34 = __toESM(require("react"), 1);
6262
+ init_hooks();
6263
+ init_i18n();
6264
+ init_use_submit_action();
6265
+ init_Spinner();
6266
+ init_FormError();
5614
6267
  var import_jsx_runtime43 = require("react/jsx-runtime");
5615
6268
  function PasswordSection() {
5616
6269
  const t = useT();
@@ -5692,6 +6345,7 @@ function PasswordSection() {
5692
6345
 
5693
6346
  // src/components/user-profile/PasskeysSection.tsx
5694
6347
  var React35 = __toESM(require("react"), 1);
6348
+ init_i18n();
5695
6349
  var import_jsx_runtime44 = require("react/jsx-runtime");
5696
6350
  function PasskeysSection({ allowAdd }) {
5697
6351
  const t = useT();
@@ -5707,6 +6361,11 @@ function PasskeysSection({ allowAdd }) {
5707
6361
 
5708
6362
  // src/components/user-profile/ProfileSection.tsx
5709
6363
  var React36 = __toESM(require("react"), 1);
6364
+ init_hooks();
6365
+ init_i18n();
6366
+ init_use_submit_action();
6367
+ init_Spinner();
6368
+ init_FormError();
5710
6369
  var import_jsx_runtime45 = require("react/jsx-runtime");
5711
6370
  function ProfileSection({
5712
6371
  firstLastName,
@@ -5837,6 +6496,8 @@ function ProfileSection({
5837
6496
 
5838
6497
  // src/components/user-profile/RecoverySection.tsx
5839
6498
  var React37 = __toESM(require("react"), 1);
6499
+ init_hooks();
6500
+ init_i18n();
5840
6501
  var import_jsx_runtime46 = require("react/jsx-runtime");
5841
6502
  function RecoverySection() {
5842
6503
  const t = useT();
@@ -5860,6 +6521,9 @@ function RecoverySection() {
5860
6521
 
5861
6522
  // src/components/user-profile/SessionsSection.tsx
5862
6523
  var React39 = __toESM(require("react"), 1);
6524
+ init_hooks();
6525
+ init_i18n();
6526
+ init_use_submit_action();
5863
6527
 
5864
6528
  // src/components/user-profile/model.ts
5865
6529
  var USER_PROFILE_SECTIONS = [
@@ -5907,6 +6571,7 @@ function formatSessionTime(date, locale) {
5907
6571
 
5908
6572
  // src/components/user-profile/use-account-resource.ts
5909
6573
  var React38 = __toESM(require("react"), 1);
6574
+ init_i18n();
5910
6575
  function useAccountResource(loader2, failure) {
5911
6576
  const loaderRef = React38.useRef(loader2);
5912
6577
  loaderRef.current = loader2;
@@ -5946,6 +6611,7 @@ function useAccountResource(loader2, failure) {
5946
6611
  }
5947
6612
 
5948
6613
  // src/components/user-profile/SessionsSection.tsx
6614
+ init_FormError();
5949
6615
  var import_jsx_runtime47 = require("react/jsx-runtime");
5950
6616
  function SessionsSection() {
5951
6617
  const t = useT();
@@ -6025,6 +6691,10 @@ function SessionsSection() {
6025
6691
 
6026
6692
  // src/components/user-profile/SocialSection.tsx
6027
6693
  var React40 = __toESM(require("react"), 1);
6694
+ init_hooks();
6695
+ init_i18n();
6696
+ init_use_submit_action();
6697
+ init_FormError();
6028
6698
  var import_jsx_runtime48 = require("react/jsx-runtime");
6029
6699
  function providerLabel(provider) {
6030
6700
  return provider.charAt(0).toUpperCase() + provider.slice(1);
@@ -6107,6 +6777,8 @@ function SocialSection() {
6107
6777
 
6108
6778
  // src/components/user-profile/UserProfileModal.tsx
6109
6779
  var React41 = __toESM(require("react"), 1);
6780
+ init_i18n();
6781
+ init_ModalSurface();
6110
6782
  var import_jsx_runtime49 = require("react/jsx-runtime");
6111
6783
  function UserProfileModal({
6112
6784
  children,
@@ -6354,26 +7026,18 @@ function UserButton() {
6354
7026
  }
6355
7027
 
6356
7028
  // src/components/OrganizationSwitcher.tsx
6357
- var React52 = __toESM(require("react"), 1);
7029
+ var React56 = __toESM(require("react"), 1);
7030
+ init_hooks();
7031
+ init_i18n();
6358
7032
 
6359
7033
  // src/components/CreateOrganization.tsx
6360
7034
  var React44 = __toESM(require("react"), 1);
6361
-
6362
- // src/components/organization/model.ts
6363
- function organizationSlugFromName(name) {
6364
- return name.normalize("NFKD").toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
6365
- }
6366
- function organizationRoles(role) {
6367
- return role.split(",").map((value) => value.trim()).filter(Boolean);
6368
- }
6369
- function hasOrganizationRole(member, role) {
6370
- return member ? organizationRoles(member.role).includes(role) : false;
6371
- }
6372
- function canManageOrganization(member) {
6373
- return hasOrganizationRole(member, "owner") || hasOrganizationRole(member, "admin");
6374
- }
6375
-
6376
- // src/components/CreateOrganization.tsx
7035
+ init_hooks();
7036
+ init_i18n();
7037
+ init_model();
7038
+ init_use_submit_action();
7039
+ init_Spinner();
7040
+ init_FormError();
6377
7041
  var import_jsx_runtime52 = require("react/jsx-runtime");
6378
7042
  function CreateOrganization({ onCreated, title } = {}) {
6379
7043
  const t = useT();
@@ -6485,6 +7149,8 @@ function CreateOrganization({ onCreated, title } = {}) {
6485
7149
 
6486
7150
  // src/components/organization/OrganizationModal.tsx
6487
7151
  var React45 = __toESM(require("react"), 1);
7152
+ init_i18n();
7153
+ init_ModalSurface();
6488
7154
  var import_jsx_runtime53 = require("react/jsx-runtime");
6489
7155
  function OrganizationModal({
6490
7156
  title,
@@ -6525,6 +7191,8 @@ function OrganizationModal({
6525
7191
 
6526
7192
  // src/components/organization/use-organizations-resource.ts
6527
7193
  var React46 = __toESM(require("react"), 1);
7194
+ init_hooks();
7195
+ init_i18n();
6528
7196
  function useOrganizationsResource(enabled = true) {
6529
7197
  const api = useAuthClient().organization;
6530
7198
  const apiRef = React46.useRef(api);
@@ -6565,6 +7233,10 @@ function useOrganizationsResource(enabled = true) {
6565
7233
  requestRef.current += 1;
6566
7234
  };
6567
7235
  }, [identity, isLoaded, refresh]);
7236
+ React46.useEffect(
7237
+ () => api.subscribe(() => void refresh()),
7238
+ [api, refresh]
7239
+ );
6568
7240
  return {
6569
7241
  organizations,
6570
7242
  isLoading: !isLoaded || organizations === null && error === null,
@@ -6574,10 +7246,18 @@ function useOrganizationsResource(enabled = true) {
6574
7246
  }
6575
7247
 
6576
7248
  // src/components/OrganizationProfile.tsx
6577
- var React51 = __toESM(require("react"), 1);
7249
+ var React55 = __toESM(require("react"), 1);
7250
+ init_hooks();
7251
+ init_i18n();
6578
7252
 
6579
7253
  // src/components/organization/DangerSection.tsx
6580
7254
  var React47 = __toESM(require("react"), 1);
7255
+ init_hooks();
7256
+ init_i18n();
7257
+ init_use_submit_action();
7258
+ init_Spinner();
7259
+ init_model();
7260
+ init_FormError();
6581
7261
  var import_jsx_runtime54 = require("react/jsx-runtime");
6582
7262
  function DangerSection({
6583
7263
  organization,
@@ -6655,6 +7335,12 @@ function DangerSection({
6655
7335
 
6656
7336
  // src/components/organization/GeneralSection.tsx
6657
7337
  var React48 = __toESM(require("react"), 1);
7338
+ init_hooks();
7339
+ init_i18n();
7340
+ init_use_submit_action();
7341
+ init_Spinner();
7342
+ init_model();
7343
+ init_FormError();
6658
7344
  var import_jsx_runtime55 = require("react/jsx-runtime");
6659
7345
  function GeneralSection({
6660
7346
  organization,
@@ -6745,56 +7431,27 @@ function GeneralSection({
6745
7431
 
6746
7432
  // src/components/organization/InvitationsSection.tsx
6747
7433
  var React50 = __toESM(require("react"), 1);
7434
+ init_hooks();
7435
+ init_i18n();
7436
+ init_use_submit_action();
7437
+ init_Spinner();
6748
7438
 
6749
7439
  // src/components/organization/role-label.ts
7440
+ init_model();
6750
7441
  function organizationRoleLabel(role, t) {
6751
- const primaryRole = organizationRoles(role)[0] ?? role;
6752
- if (primaryRole === "owner") return t("organization.role.owner");
6753
- if (primaryRole === "admin") return t("organization.role.admin");
6754
- if (primaryRole === "member") return t("organization.role.member");
6755
- return primaryRole;
6756
- }
6757
-
6758
- // src/components/organization/use-organization-roles.ts
6759
- var React49 = __toESM(require("react"), 1);
6760
- var BUILTIN_ROLES = ["owner", "admin", "member"];
6761
- function useOrganizationRoles(organizationId) {
6762
- const api = useAuthClient().organization;
6763
- const apiRef = React49.useRef(api);
6764
- apiRef.current = api;
6765
- const [dynamic, setDynamic] = React49.useState([]);
6766
- const requestRef = React49.useRef(0);
6767
- React49.useEffect(() => {
6768
- const token = ++requestRef.current;
6769
- setDynamic([]);
6770
- if (!organizationId) return;
6771
- void (async () => {
6772
- try {
6773
- const result = await apiRef.current.listRoles({ organizationId });
6774
- if (token !== requestRef.current) return;
6775
- setDynamic((result.data ?? []).map((entry) => entry.role).filter(Boolean));
6776
- } catch {
6777
- }
6778
- })();
6779
- return () => {
6780
- requestRef.current += 1;
6781
- };
6782
- }, [organizationId]);
6783
- const roles = React49.useMemo(() => {
6784
- const seen = /* @__PURE__ */ new Set();
6785
- const out = [];
6786
- for (const candidate of [...BUILTIN_ROLES, ...dynamic]) {
6787
- const key = candidate.trim();
6788
- if (!key || seen.has(key)) continue;
6789
- seen.add(key);
6790
- out.push(key);
6791
- }
6792
- return out;
6793
- }, [dynamic]);
6794
- return { roles };
7442
+ const roles = organizationRoles(role);
7443
+ return (roles.length > 0 ? roles : [role]).map((roleKey) => {
7444
+ if (roleKey === "owner") return t("organization.role.owner");
7445
+ if (roleKey === "admin") return t("organization.role.admin");
7446
+ if (roleKey === "member") return t("organization.role.member");
7447
+ const label2 = roleKey.split(/[-_]+/).filter(Boolean).map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(" ");
7448
+ return t("organization.role.custom", { role: label2 });
7449
+ }).join(t("organization.role.separator"));
6795
7450
  }
6796
7451
 
6797
7452
  // src/components/organization/InvitationsSection.tsx
7453
+ init_use_organization_roles();
7454
+ init_FormError();
6798
7455
  var import_jsx_runtime56 = require("react/jsx-runtime");
6799
7456
  function InvitationsSection({
6800
7457
  organization,
@@ -6864,6 +7521,12 @@ function InvitationsSection({
6864
7521
  }
6865
7522
 
6866
7523
  // src/components/organization/MembersSection.tsx
7524
+ init_hooks();
7525
+ init_i18n();
7526
+ init_use_submit_action();
7527
+ init_model();
7528
+ init_use_organization_roles();
7529
+ init_FormError();
6867
7530
  var import_jsx_runtime57 = require("react/jsx-runtime");
6868
7531
  function MembersSection({
6869
7532
  organization,
@@ -6923,20 +7586,24 @@ function MembersSection({
6923
7586
  }
6924
7587
  ),
6925
7588
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(member), children: t("organization.profile.members.remove") })
6926
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ba-organization-role-label", children: organizationRoleLabel(primaryRole, t) })
7589
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ba-organization-role-label", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Bidi, { children: organizationRoleLabel(member.role, t) }) })
6927
7590
  ] }, member.id);
6928
7591
  }) })
6929
7592
  ] });
6930
7593
  }
6931
7594
 
6932
7595
  // src/components/OrganizationProfile.tsx
6933
- var import_jsx_runtime58 = require("react/jsx-runtime");
7596
+ init_model();
7597
+ init_FormError();
7598
+ var import_jsx_runtime60 = require("react/jsx-runtime");
6934
7599
  var SECTION_KEYS2 = {
6935
7600
  general: "organization.profile.nav.general",
6936
7601
  members: "organization.profile.nav.members",
7602
+ teams: "organization.profile.nav.teams",
6937
7603
  invitations: "organization.profile.nav.invitations",
6938
7604
  danger: "organization.profile.nav.danger"
6939
7605
  };
7606
+ var TeamsSection2 = React55.lazy(() => Promise.resolve().then(() => (init_TeamsSection(), TeamsSection_exports)));
6940
7607
  function OrganizationProfile({ organizationId, defaultSection = "general", onDeleted, onLeft } = {}) {
6941
7608
  const t = useT();
6942
7609
  const toServerError = useServerError();
@@ -6944,17 +7611,17 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
6944
7611
  const { user, isLoaded, isSignedIn } = useUser();
6945
7612
  const session = useSession();
6946
7613
  const api = useAuthClient().organization;
6947
- const apiRef = React51.useRef(api);
7614
+ const apiRef = React55.useRef(api);
6948
7615
  apiRef.current = api;
6949
7616
  const activeOrganizationId = session.data?.session.activeOrganizationId ?? null;
6950
7617
  const requestedId = organizationId ?? activeOrganizationId;
6951
7618
  const enabled = config?.organizations === true && isSignedIn;
6952
- const [organization, setOrganization] = React51.useState(null);
6953
- const [error, setError] = React51.useState(null);
6954
- const [wasRemoved, setWasRemoved] = React51.useState(false);
6955
- const [section, setSection] = React51.useState(defaultSection);
6956
- const requestRef = React51.useRef(0);
6957
- const load = React51.useCallback(async () => {
7619
+ const [organization, setOrganization] = React55.useState(null);
7620
+ const [error, setError] = React55.useState(null);
7621
+ const [wasRemoved, setWasRemoved] = React55.useState(false);
7622
+ const [section, setSection] = React55.useState(defaultSection);
7623
+ const requestRef = React55.useRef(0);
7624
+ const load = React55.useCallback(async () => {
6958
7625
  const token = ++requestRef.current;
6959
7626
  if (!enabled || !requestedId) {
6960
7627
  setOrganization(null);
@@ -6974,7 +7641,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
6974
7641
  if (token === requestRef.current) setError(t("organization.profile.loadError"));
6975
7642
  }
6976
7643
  }, [enabled, requestedId, t, toServerError]);
6977
- React51.useEffect(() => {
7644
+ React55.useEffect(() => {
6978
7645
  setOrganization(null);
6979
7646
  setError(null);
6980
7647
  setWasRemoved(false);
@@ -6983,38 +7650,38 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
6983
7650
  requestRef.current += 1;
6984
7651
  };
6985
7652
  }, [load]);
6986
- if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
7653
+ if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
6987
7654
  if (config?.organizations !== true) return null;
6988
- if (!isSignedIn || !user) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
6989
- if (wasRemoved) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
6990
- if (!requestedId) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
7655
+ if (!isSignedIn || !user) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
7656
+ if (wasRemoved) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
7657
+ if (!requestedId) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
6991
7658
  if (error) {
6992
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ba-inline-error", children: [
6993
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FormError, { children: error }),
6994
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
7659
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ba-inline-error", children: [
7660
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FormError, { children: error }),
7661
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
6995
7662
  ] });
6996
7663
  }
6997
- if (!organization) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
7664
+ if (!organization) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
6998
7665
  const membership = organization.members.find((member) => member.userId === user.id);
6999
- if (!membership) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "ba-muted", children: t("organization.profile.notMember") });
7666
+ if (!membership) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.profile.notMember") });
7000
7667
  const canManage = canManageOrganization(membership);
7001
- const visibleSections = canManage ? ["general", "members", "invitations", "danger"] : ["general", "members", "danger"];
7668
+ const visibleSections = canManage ? ["general", "members", "teams", "invitations", "danger"] : ["general", "members", "teams", "danger"];
7002
7669
  const activeSection = visibleSections.includes(section) ? section : "general";
7003
7670
  const handleRemoval = (callback) => (removedOrganization) => {
7004
7671
  setWasRemoved(true);
7005
7672
  setOrganization(null);
7006
7673
  callback?.(removedOrganization);
7007
7674
  };
7008
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("article", { className: "ba-organization-profile", children: [
7009
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("header", { className: "ba-organization-profile-heading", children: [
7010
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
7011
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { children: [
7012
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("h2", { className: "ba-title", children: organization.name }),
7013
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "ba-muted", children: organization.slug })
7675
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("article", { className: "ba-organization-profile", children: [
7676
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("header", { className: "ba-organization-profile-heading", children: [
7677
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
7678
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { children: [
7679
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h2", { className: "ba-title", children: organization.name }),
7680
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: organization.slug })
7014
7681
  ] })
7015
7682
  ] }),
7016
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ba-organization-profile-layout", children: [
7017
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
7683
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ba-organization-profile-layout", children: [
7684
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
7018
7685
  "button",
7019
7686
  {
7020
7687
  className: "ba-profile-nav-item",
@@ -7025,11 +7692,12 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
7025
7692
  },
7026
7693
  item
7027
7694
  )) }),
7028
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ba-organization-profile-content", children: [
7029
- activeSection === "general" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(GeneralSection, { organization, canManage, onChanged: load }),
7030
- activeSection === "members" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
7031
- activeSection === "invitations" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(InvitationsSection, { organization, onChanged: load }),
7032
- activeSection === "danger" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
7695
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ba-organization-profile-content", children: [
7696
+ activeSection === "general" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(GeneralSection, { organization, canManage, onChanged: load }),
7697
+ activeSection === "members" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
7698
+ activeSection === "teams" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(React55.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TeamsSection2, { organization, membership }) }),
7699
+ activeSection === "invitations" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(InvitationsSection, { organization, onChanged: load }),
7700
+ activeSection === "danger" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
7033
7701
  DangerSection,
7034
7702
  {
7035
7703
  organization,
@@ -7044,7 +7712,9 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
7044
7712
  }
7045
7713
 
7046
7714
  // src/components/OrganizationSwitcher.tsx
7047
- var import_jsx_runtime59 = require("react/jsx-runtime");
7715
+ init_use_submit_action();
7716
+ init_FormError();
7717
+ var import_jsx_runtime61 = require("react/jsx-runtime");
7048
7718
  function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChange } = {}) {
7049
7719
  const t = useT();
7050
7720
  const { config, isLoading: configLoading } = usePublicConfig();
@@ -7054,15 +7724,15 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
7054
7724
  const enabled = config?.organizations === true && isSignedIn;
7055
7725
  const { organizations, isLoading, error: loadError, refresh } = useOrganizationsResource(enabled);
7056
7726
  const { pending, error, run } = useSubmitAction();
7057
- const [open, setOpen] = React52.useState(false);
7058
- const [dialog, setDialog] = React52.useState(null);
7059
- const rootRef = React52.useRef(null);
7060
- const triggerRef = React52.useRef(null);
7061
- const menuRef = React52.useRef(null);
7062
- const menuId = React52.useId();
7727
+ const [open, setOpen] = React56.useState(false);
7728
+ const [dialog, setDialog] = React56.useState(null);
7729
+ const rootRef = React56.useRef(null);
7730
+ const triggerRef = React56.useRef(null);
7731
+ const menuRef = React56.useRef(null);
7732
+ const menuId = React56.useId();
7063
7733
  const activeId = session.data?.session.activeOrganizationId ?? null;
7064
7734
  const active = organizations?.find((organization) => organization.id === activeId) ?? null;
7065
- React52.useEffect(() => {
7735
+ React56.useEffect(() => {
7066
7736
  if (!open) return;
7067
7737
  const onPointerDown = (event) => {
7068
7738
  if (!rootRef.current?.contains(event.target)) setOpen(false);
@@ -7077,9 +7747,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
7077
7747
  document.removeEventListener("keydown", onKeyDown);
7078
7748
  };
7079
7749
  }, [open]);
7080
- if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
7750
+ if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
7081
7751
  if (config?.organizations !== true) return null;
7082
- if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
7752
+ if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
7083
7753
  const select = (organization) => {
7084
7754
  void run(
7085
7755
  () => api.setActive({ organizationId: organization?.id ?? null }),
@@ -7122,9 +7792,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
7122
7792
  else if (event.key === "ArrowDown") items[(current + 1 + items.length) % items.length]?.focus();
7123
7793
  else items[(current - 1 + items.length) % items.length]?.focus();
7124
7794
  };
7125
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
7126
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { ref: rootRef, className: "ba-organization-switcher", children: [
7127
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
7795
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
7796
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { ref: rootRef, className: "ba-organization-switcher", children: [
7797
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
7128
7798
  "button",
7129
7799
  {
7130
7800
  ref: triggerRef,
@@ -7141,43 +7811,43 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
7141
7811
  focusMenuItem(event.key === "ArrowDown" ? "first" : "last");
7142
7812
  },
7143
7813
  children: [
7144
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
7145
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: active?.name ?? t("organization.personal") }),
7146
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { "aria-hidden": "true", children: "\u2304" })
7814
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
7815
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children: active?.name ?? t("organization.personal") }),
7816
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { "aria-hidden": "true", children: "\u2304" })
7147
7817
  ]
7148
7818
  }
7149
7819
  ),
7150
- open && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
7151
- isLoading ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ba-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
7152
- showPersonalWorkspace && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === null ? "true" : void 0, disabled: pending, onClick: () => select(null), children: [
7153
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
7154
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: t("organization.personal") })
7820
+ open && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
7821
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ba-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
7822
+ showPersonalWorkspace && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === null ? "true" : void 0, disabled: pending, onClick: () => select(null), children: [
7823
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
7824
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children: t("organization.personal") })
7155
7825
  ] }),
7156
- organizations?.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === organization.id ? "true" : void 0, disabled: pending, onClick: () => select(organization), children: [
7157
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
7158
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { children: [
7826
+ organizations?.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === organization.id ? "true" : void 0, disabled: pending, onClick: () => select(organization), children: [
7827
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
7828
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { children: [
7159
7829
  organization.name,
7160
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("small", { children: organization.slug })
7830
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("small", { children: organization.slug })
7161
7831
  ] })
7162
7832
  ] }, organization.id))
7163
7833
  ] }),
7164
- (loadError || error) && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ba-inline-error", children: [
7165
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(FormError, { children: loadError ?? error }),
7166
- loadError && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
7834
+ (loadError || error) && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "ba-inline-error", children: [
7835
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(FormError, { children: loadError ?? error }),
7836
+ loadError && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
7167
7837
  ] }),
7168
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ba-organization-menu-actions", children: [
7169
- active && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
7838
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "ba-organization-menu-actions", children: [
7839
+ active && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
7170
7840
  setOpen(false);
7171
7841
  setDialog("profile");
7172
7842
  }, children: t("organization.switcher.manage") }),
7173
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
7843
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
7174
7844
  setOpen(false);
7175
7845
  setDialog("create");
7176
7846
  }, children: t("organization.switcher.create") })
7177
7847
  ] })
7178
7848
  ] })
7179
7849
  ] }),
7180
- dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
7850
+ dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
7181
7851
  CreateOrganization,
7182
7852
  {
7183
7853
  title: null,
@@ -7191,13 +7861,20 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
7191
7861
  }
7192
7862
  }
7193
7863
  ) }),
7194
- dialog === "profile" && active && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(OrganizationProfile, { organizationId: active.id, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
7864
+ dialog === "profile" && active && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(OrganizationProfile, { organizationId: active.id, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
7195
7865
  ] });
7196
7866
  }
7197
7867
 
7868
+ // src/index.ts
7869
+ init_InvitationPrompt();
7870
+
7198
7871
  // src/components/OrganizationList.tsx
7199
- var React53 = __toESM(require("react"), 1);
7200
- var import_jsx_runtime60 = require("react/jsx-runtime");
7872
+ var React57 = __toESM(require("react"), 1);
7873
+ init_hooks();
7874
+ init_i18n();
7875
+ init_use_submit_action();
7876
+ init_FormError();
7877
+ var import_jsx_runtime62 = require("react/jsx-runtime");
7201
7878
  function OrganizationList({ onOrganizationChange } = {}) {
7202
7879
  const t = useT();
7203
7880
  const toServerError = useServerError();
@@ -7205,19 +7882,19 @@ function OrganizationList({ onOrganizationChange } = {}) {
7205
7882
  const { user, isLoaded, isSignedIn } = useUser();
7206
7883
  const session = useSession();
7207
7884
  const api = useAuthClient().organization;
7208
- const apiRef = React53.useRef(api);
7885
+ const apiRef = React57.useRef(api);
7209
7886
  apiRef.current = api;
7210
7887
  const enabled = config?.organizations === true && isSignedIn;
7211
7888
  const { organizations, isLoading, error: organizationError, refresh } = useOrganizationsResource(enabled);
7212
7889
  const { pending, error, run } = useSubmitAction();
7213
- const [invitations, setInvitations] = React53.useState(null);
7214
- const [invitationError, setInvitationError] = React53.useState(null);
7215
- const [dialog, setDialog] = React53.useState(null);
7216
- const [profileId, setProfileId] = React53.useState(null);
7217
- const dialogReturnFocusRef = React53.useRef(null);
7218
- const invitationRequestRef = React53.useRef(0);
7890
+ const [invitations, setInvitations] = React57.useState(null);
7891
+ const [invitationError, setInvitationError] = React57.useState(null);
7892
+ const [dialog, setDialog] = React57.useState(null);
7893
+ const [profileId, setProfileId] = React57.useState(null);
7894
+ const dialogReturnFocusRef = React57.useRef(null);
7895
+ const invitationRequestRef = React57.useRef(0);
7219
7896
  const activeId = session.data?.session.activeOrganizationId ?? null;
7220
- const loadInvitations = React53.useCallback(async () => {
7897
+ const loadInvitations = React57.useCallback(async () => {
7221
7898
  const token = ++invitationRequestRef.current;
7222
7899
  if (!enabled) {
7223
7900
  setInvitations([]);
@@ -7237,7 +7914,7 @@ function OrganizationList({ onOrganizationChange } = {}) {
7237
7914
  if (token === invitationRequestRef.current) setInvitationError(t("organization.list.invitationsError"));
7238
7915
  }
7239
7916
  }, [enabled, t, toServerError]);
7240
- React53.useEffect(() => {
7917
+ React57.useEffect(() => {
7241
7918
  setInvitations(null);
7242
7919
  setInvitationError(null);
7243
7920
  if (!isLoaded) return;
@@ -7246,9 +7923,9 @@ function OrganizationList({ onOrganizationChange } = {}) {
7246
7923
  invitationRequestRef.current += 1;
7247
7924
  };
7248
7925
  }, [isLoaded, loadInvitations, user?.id]);
7249
- if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
7926
+ if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
7250
7927
  if (config?.organizations !== true) return null;
7251
- if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
7928
+ if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
7252
7929
  const setActive = (organization) => {
7253
7930
  void run(
7254
7931
  () => api.setActive({ organizationId: organization.id }),
@@ -7289,71 +7966,72 @@ function OrganizationList({ onOrganizationChange } = {}) {
7289
7966
  setDialog(null);
7290
7967
  setProfileId(null);
7291
7968
  };
7292
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
7293
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("section", { className: "ba-organization-directory", children: [
7294
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("header", { className: "ba-organization-directory-header", children: [
7295
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { children: [
7296
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h2", { className: "ba-title", children: t("organization.list.title") }),
7297
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.list.description") })
7969
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
7970
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "ba-organization-directory", children: [
7971
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("header", { className: "ba-organization-directory-header", children: [
7972
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { children: [
7973
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h2", { className: "ba-title", children: t("organization.list.title") }),
7974
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.list.description") })
7298
7975
  ] }),
7299
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { className: "ba-button", type: "button", onClick: (event) => {
7976
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-button", type: "button", onClick: (event) => {
7300
7977
  dialogReturnFocusRef.current = event.currentTarget;
7301
7978
  setDialog("create");
7302
7979
  }, children: t("organization.switcher.create") })
7303
7980
  ] }),
7304
- (organizationError || error) && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ba-inline-error", children: [
7305
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FormError, { children: organizationError ?? error }),
7306
- organizationError && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
7981
+ (organizationError || error) && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ba-inline-error", children: [
7982
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(FormError, { children: organizationError ?? error }),
7983
+ organizationError && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
7307
7984
  ] }),
7308
- isLoading ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ba-organization-card-grid", children: [
7309
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ba-skeleton" }),
7310
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ba-skeleton" })
7311
- ] }) : organizations?.length ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("li", { className: "ba-organization-card", children: [
7312
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
7313
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "ba-organization-card-copy", children: [
7314
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("strong", { children: organization.name }),
7315
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Bidi, { children: organization.slug }) })
7985
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ba-organization-card-grid", children: [
7986
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ba-skeleton" }),
7987
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ba-skeleton" })
7988
+ ] }) : organizations?.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("li", { className: "ba-organization-card", children: [
7989
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
7990
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ba-organization-card-copy", children: [
7991
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("strong", { children: organization.name }),
7992
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Bidi, { children: organization.slug }) })
7316
7993
  ] }),
7317
- activeId === organization.id && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ba-organization-active", children: t("organization.list.active") }),
7318
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "ba-organization-card-actions", children: [
7319
- activeId !== organization.id && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
7320
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
7994
+ activeId === organization.id && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ba-organization-active", children: t("organization.list.active") }),
7995
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ba-organization-card-actions", children: [
7996
+ activeId !== organization.id && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
7997
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
7321
7998
  ] })
7322
- ] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.list.empty") }),
7323
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("section", { className: "ba-organization-user-invitations", children: [
7324
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("header", { className: "ba-organization-section-header", children: [
7325
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
7326
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
7999
+ ] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.list.empty") }),
8000
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "ba-organization-user-invitations", children: [
8001
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("header", { className: "ba-organization-section-header", children: [
8002
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
8003
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
7327
8004
  ] }),
7328
- invitationError && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ba-inline-error", children: [
7329
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FormError, { children: invitationError }),
7330
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
8005
+ invitationError && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ba-inline-error", children: [
8006
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(FormError, { children: invitationError }),
8007
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
7331
8008
  ] }),
7332
- invitations === null && !invitationError ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ba-skeleton" }) : invitations?.length ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("li", { className: "ba-organization-invitation", children: [
7333
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { children: [
7334
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("strong", { children: invitation.organizationName }),
7335
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("small", { children: organizationRoleLabel(invitation.role, t) })
8009
+ invitations?.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("li", { className: "ba-organization-invitation", children: [
8010
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { children: [
8011
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("strong", { children: invitation.organizationName }),
8012
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("small", { children: organizationRoleLabel(invitation.role, t) })
7336
8013
  ] }),
7337
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "ba-organization-card-actions", children: [
7338
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
7339
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
8014
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ba-organization-card-actions", children: [
8015
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
8016
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
7340
8017
  ] })
7341
- ] }, invitation.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
8018
+ ] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ba-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
7342
8019
  ] })
7343
8020
  ] }),
7344
- dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(CreateOrganization, { title: null, onCreated: () => {
8021
+ dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CreateOrganization, { title: null, onCreated: () => {
7345
8022
  void (async () => {
7346
8023
  await refresh();
7347
8024
  await session.refetch({ query: { disableCookieCache: true } });
7348
8025
  setDialog(null);
7349
8026
  })();
7350
8027
  } }) }),
7351
- dialog === "profile" && profileId && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(OrganizationProfile, { organizationId: profileId, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
8028
+ dialog === "profile" && profileId && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrganizationProfile, { organizationId: profileId, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
7352
8029
  ] });
7353
8030
  }
7354
8031
 
7355
8032
  // src/components/GoogleOneTap.tsx
7356
- var React54 = __toESM(require("react"), 1);
8033
+ var React58 = __toESM(require("react"), 1);
8034
+ init_hooks();
7357
8035
 
7358
8036
  // src/components/google-one-tap.ts
7359
8037
  var GOOGLE_IDENTITY_SCRIPT = "https://accounts.google.com/gsi/client";
@@ -7521,11 +8199,11 @@ function GoogleOneTap({
7521
8199
  const { config, isLoading: configLoading, isError: configError } = usePublicConfig();
7522
8200
  const { user, isLoaded: sessionLoaded } = useUser();
7523
8201
  const { signInSocial } = useSignIn();
7524
- const callbacks = React54.useRef({ onSignedIn, onSkipped, onDismissed, onError });
8202
+ const callbacks = React58.useRef({ onSignedIn, onSkipped, onDismissed, onError });
7525
8203
  callbacks.current = { onSignedIn, onSkipped, onDismissed, onError };
7526
8204
  const googleEnabled = config?.socialProviders.includes("google") === true;
7527
8205
  const clientId = config?.socialProviderClientIds?.google;
7528
- React54.useEffect(() => {
8206
+ React58.useEffect(() => {
7529
8207
  if (configLoading || !sessionLoaded) return;
7530
8208
  if (disabled) {
7531
8209
  callbacks.current.onSkipped?.("disabled");