@authowl/react 0.22.0 → 0.23.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
@@ -737,6 +737,42 @@ var init_InvitationPrompt = __esm({
737
737
  }
738
738
  });
739
739
 
740
+ // src/last-used-method.ts
741
+ function useLastUsedSignInMethod() {
742
+ const { config } = usePublicConfig();
743
+ const projectId = config?.environmentId ?? null;
744
+ return React5.useMemo(
745
+ () => projectId ? (0, import_core2.readLastUsedSignInMethod)(projectId) : null,
746
+ [projectId]
747
+ );
748
+ }
749
+ function useSignInMethodRecorder() {
750
+ const { config } = usePublicConfig();
751
+ const projectId = config?.environmentId ?? null;
752
+ return React5.useCallback(
753
+ (method, pending) => {
754
+ if (!projectId) return;
755
+ (pending ? import_core2.rememberPendingSignInMethod : import_core2.recordLastUsedSignInMethod)(projectId, method);
756
+ },
757
+ [projectId]
758
+ );
759
+ }
760
+ function useConfirmPendingSignInMethod(loaded, signedIn, projectId) {
761
+ React5.useEffect(() => {
762
+ if (loaded && projectId) (0, import_core2.settlePendingSignInMethod)(projectId, signedIn);
763
+ }, [loaded, projectId, signedIn]);
764
+ }
765
+ var React5, import_core2;
766
+ var init_last_used_method = __esm({
767
+ "src/last-used-method.ts"() {
768
+ "use strict";
769
+ "use client";
770
+ React5 = __toESM(require("react"), 1);
771
+ import_core2 = require("@authowl/core");
772
+ init_hooks();
773
+ }
774
+ });
775
+
740
776
  // src/provider.tsx
741
777
  function warnPublicConfigFailed(resolved, error) {
742
778
  let origin = resolved.apiUrl;
@@ -752,6 +788,12 @@ function warnPublicConfigFailed(resolved, error) {
752
788
  `[AuthOwl] Could not load this project's public config from ${origin} (${reason}). Authentication UI is unavailable until the request succeeds. Likely causes: the API is unreachable, \`apiUrl\` is wrong, or the publishable key points at a missing/mismatched project. Check \`apiUrl\` and \`publishableKey\` on <AuthOwlProvider>. (This warning is dev-only.)`
753
789
  );
754
790
  }
791
+ function LastUsedMethodSync() {
792
+ const { config } = usePublicConfig();
793
+ const { isLoaded, isSignedIn } = useUser();
794
+ useConfirmPendingSignInMethod(isLoaded, isSignedIn, config?.environmentId ?? null);
795
+ return null;
796
+ }
755
797
  function detectLocale() {
756
798
  if (typeof document !== "undefined") {
757
799
  const root = document.documentElement;
@@ -763,9 +805,9 @@ function detectLocale() {
763
805
  return "en";
764
806
  }
765
807
  function resolveLocale(prop, autoDetected, configLocale) {
766
- if (prop !== "auto" && (0, import_core2.isLocale)(prop)) return prop;
808
+ if (prop !== "auto" && (0, import_core3.isLocale)(prop)) return prop;
767
809
  if (prop === "auto") return autoDetected ?? "en";
768
- return (0, import_core2.isLocale)(configLocale) ? configLocale : "en";
810
+ return (0, import_core3.isLocale)(configLocale) ? configLocale : "en";
769
811
  }
770
812
  function AuthOwlProvider({
771
813
  publishableKey,
@@ -776,21 +818,21 @@ function AuthOwlProvider({
776
818
  invitationPrompt = true,
777
819
  children
778
820
  }) {
779
- const fetchRef = React5.useRef(fetch);
821
+ const fetchRef = React6.useRef(fetch);
780
822
  fetchRef.current = fetch;
781
- const resolved = React5.useMemo(
782
- () => (0, import_core2.resolveConfig)({ publishableKey, apiUrl, fetch: fetchRef.current }),
823
+ const resolved = React6.useMemo(
824
+ () => (0, import_core3.resolveConfig)({ publishableKey, apiUrl, fetch: fetchRef.current }),
783
825
  [publishableKey, apiUrl]
784
826
  );
785
- const client = React5.useMemo(() => (0, import_core2.createAuthOwlClient)(resolved), [resolved]);
786
- const [config, setConfig] = React5.useState(null);
787
- const [configState, setConfigState] = React5.useState("loading");
788
- const [configAttempt, setConfigAttempt] = React5.useState(0);
789
- const retryPublicConfig = React5.useCallback(() => setConfigAttempt((attempt) => attempt + 1), []);
790
- React5.useEffect(() => {
827
+ const client = React6.useMemo(() => (0, import_core3.createAuthOwlClient)(resolved), [resolved]);
828
+ const [config, setConfig] = React6.useState(null);
829
+ const [configState, setConfigState] = React6.useState("loading");
830
+ const [configAttempt, setConfigAttempt] = React6.useState(0);
831
+ const retryPublicConfig = React6.useCallback(() => setConfigAttempt((attempt) => attempt + 1), []);
832
+ React6.useEffect(() => {
791
833
  let active = true;
792
834
  setConfigState("loading");
793
- (0, import_core2.getPublicConfig)(resolved).then((c) => {
835
+ (0, import_core3.getPublicConfig)(resolved).then((c) => {
794
836
  if (!active) return;
795
837
  setConfig(c);
796
838
  setConfigState("ready");
@@ -805,15 +847,18 @@ function AuthOwlProvider({
805
847
  };
806
848
  }, [resolved, configAttempt]);
807
849
  const merged = resolveAppearance(appearance, config);
808
- const [autoLocale, setAutoLocale] = React5.useState(null);
809
- React5.useEffect(() => {
850
+ const [autoLocale, setAutoLocale] = React6.useState(null);
851
+ React6.useEffect(() => {
810
852
  if (localeProp === "auto") setAutoLocale(detectLocale());
811
853
  }, [localeProp]);
812
854
  const locale = resolveLocale(localeProp, autoLocale, config?.locale);
813
- React5.useEffect(() => {
814
- (0, import_core2.captureInvitationClaim)();
855
+ React6.useEffect(() => {
856
+ return (0, import_core3.setActiveLocale)(resolved.decoded.projectId, locale);
857
+ }, [locale, resolved.decoded.projectId]);
858
+ React6.useEffect(() => {
859
+ (0, import_core3.captureInvitationClaim)();
815
860
  }, []);
816
- const ctxValue = React5.useMemo(
861
+ const ctxValue = React6.useMemo(
817
862
  () => ({ client, appearance, config, configState, retryPublicConfig, locale }),
818
863
  [client, appearance, config, configState, retryPublicConfig, locale]
819
864
  );
@@ -823,43 +868,46 @@ function AuthOwlProvider({
823
868
  className: "authowl-root",
824
869
  "data-authowl-theme": merged.theme,
825
870
  "data-authowl-locale": locale,
826
- dir: (0, import_core2.directionFor)(locale),
871
+ dir: (0, import_core3.directionFor)(locale),
827
872
  style: { display: "contents", ...merged.style },
828
873
  children: [
829
874
  children,
875
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LastUsedMethodSync, {}),
830
876
  invitationPrompt ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InvitationPrompt, {}) : null
831
877
  ]
832
878
  }
833
879
  ) });
834
880
  }
835
881
  function useAuthOwlContext() {
836
- const v = React5.useContext(Context);
882
+ const v = React6.useContext(Context);
837
883
  if (!v) {
838
884
  throw new Error("AuthOwl hooks must be used inside <AuthOwlProvider>");
839
885
  }
840
886
  return v;
841
887
  }
842
- var React5, import_core2, import_jsx_runtime4, warnedConfigProjects, Context;
888
+ var React6, import_core3, import_jsx_runtime4, warnedConfigProjects, Context;
843
889
  var init_provider = __esm({
844
890
  "src/provider.tsx"() {
845
891
  "use strict";
846
892
  "use client";
847
- React5 = __toESM(require("react"), 1);
848
- import_core2 = require("@authowl/core");
893
+ React6 = __toESM(require("react"), 1);
894
+ import_core3 = require("@authowl/core");
849
895
  init_appearance();
850
896
  init_InvitationPrompt();
897
+ init_last_used_method();
898
+ init_hooks();
851
899
  import_jsx_runtime4 = require("react/jsx-runtime");
852
900
  warnedConfigProjects = /* @__PURE__ */ new Set();
853
- Context = React5.createContext(null);
901
+ Context = React6.createContext(null);
854
902
  }
855
903
  });
856
904
 
857
905
  // src/components/use-submit-action.ts
858
906
  function useSubmitAction() {
859
- const [pending, setPending] = React6.useState(false);
860
- const [error, setError] = React6.useState(null);
907
+ const [pending, setPending] = React7.useState(false);
908
+ const [error, setError] = React7.useState(null);
861
909
  const toMessage = useServerError();
862
- const run = React6.useCallback(
910
+ const run = React7.useCallback(
863
911
  async (action, { failure, onSuccess, mapError, keepPendingOnSuccess }) => {
864
912
  setError(null);
865
913
  setPending(true);
@@ -881,12 +929,12 @@ function useSubmitAction() {
881
929
  );
882
930
  return { pending, error, setError, run };
883
931
  }
884
- var React6;
932
+ var React7;
885
933
  var init_use_submit_action = __esm({
886
934
  "src/components/use-submit-action.ts"() {
887
935
  "use strict";
888
936
  "use client";
889
- React6 = __toESM(require("react"), 1);
937
+ React7 = __toESM(require("react"), 1);
890
938
  init_i18n();
891
939
  }
892
940
  });
@@ -2806,11 +2854,11 @@ var init_model = __esm({
2806
2854
  // src/components/organization/use-organization-roles.ts
2807
2855
  function useOrganizationRoles(organizationId) {
2808
2856
  const api = useAuthClient().organization;
2809
- const apiRef = React49.useRef(api);
2857
+ const apiRef = React50.useRef(api);
2810
2858
  apiRef.current = api;
2811
- const [dynamicRoles, setDynamicRoles] = React49.useState([]);
2812
- const requestRef = React49.useRef(0);
2813
- React49.useEffect(() => {
2859
+ const [dynamicRoles, setDynamicRoles] = React50.useState([]);
2860
+ const requestRef = React50.useRef(0);
2861
+ React50.useEffect(() => {
2814
2862
  const token = ++requestRef.current;
2815
2863
  setDynamicRoles([]);
2816
2864
  if (!organizationId) return;
@@ -2826,7 +2874,7 @@ function useOrganizationRoles(organizationId) {
2826
2874
  requestRef.current += 1;
2827
2875
  };
2828
2876
  }, [organizationId]);
2829
- const roles = React49.useMemo(() => {
2877
+ const roles = React50.useMemo(() => {
2830
2878
  const seen = /* @__PURE__ */ new Set();
2831
2879
  const out = [];
2832
2880
  for (const candidate of [...BUILTIN_ROLES, ...dynamicRoles.map((entry) => entry.role)]) {
@@ -2839,12 +2887,12 @@ function useOrganizationRoles(organizationId) {
2839
2887
  }, [dynamicRoles]);
2840
2888
  return { roles, dynamicRoles };
2841
2889
  }
2842
- var React49, BUILTIN_ROLES;
2890
+ var React50, BUILTIN_ROLES;
2843
2891
  var init_use_organization_roles = __esm({
2844
2892
  "src/components/organization/use-organization-roles.ts"() {
2845
2893
  "use strict";
2846
2894
  "use client";
2847
- React49 = __toESM(require("react"), 1);
2895
+ React50 = __toESM(require("react"), 1);
2848
2896
  init_hooks();
2849
2897
  BUILTIN_ROLES = ["owner", "admin", "member"];
2850
2898
  }
@@ -2859,12 +2907,12 @@ function useOrganizationListResource({
2859
2907
  inactiveData = null
2860
2908
  }) {
2861
2909
  const toServerError = useServerError();
2862
- const requestFn = React51.useRef(request);
2910
+ const requestFn = React52.useRef(request);
2863
2911
  requestFn.current = request;
2864
- const [data, setData] = React51.useState(null);
2865
- const [error, setError] = React51.useState(null);
2866
- const requestToken = React51.useRef(0);
2867
- const refresh = React51.useCallback(async () => {
2912
+ const [data, setData] = React52.useState(null);
2913
+ const [error, setError] = React52.useState(null);
2914
+ const requestToken = React52.useRef(0);
2915
+ const refresh = React52.useCallback(async () => {
2868
2916
  const token = ++requestToken.current;
2869
2917
  if (!enabled || !resourceKey) {
2870
2918
  setData(inactiveData);
@@ -2884,7 +2932,7 @@ function useOrganizationListResource({
2884
2932
  if (token === requestToken.current) setError(fallback);
2885
2933
  }
2886
2934
  }, [enabled, fallback, inactiveData, resourceKey, toServerError]);
2887
- React51.useEffect(() => {
2935
+ React52.useEffect(() => {
2888
2936
  setData(enabled && resourceKey ? null : inactiveData);
2889
2937
  setError(null);
2890
2938
  void refresh();
@@ -2894,12 +2942,12 @@ function useOrganizationListResource({
2894
2942
  }, [enabled, inactiveData, refresh, resourceKey]);
2895
2943
  return { data, isLoading: data === null && error === null, error, refresh };
2896
2944
  }
2897
- var React51;
2945
+ var React52;
2898
2946
  var init_use_organization_list_resource = __esm({
2899
2947
  "src/components/organization/use-organization-list-resource.ts"() {
2900
2948
  "use strict";
2901
2949
  "use client";
2902
- React51 = __toESM(require("react"), 1);
2950
+ React52 = __toESM(require("react"), 1);
2903
2951
  init_i18n();
2904
2952
  }
2905
2953
  });
@@ -2907,7 +2955,7 @@ var init_use_organization_list_resource = __esm({
2907
2955
  // src/components/organization/use-team-resources.ts
2908
2956
  function useTeamsResource(organizationId) {
2909
2957
  const api = useAuthClient().organization;
2910
- const apiRef = React52.useRef(api);
2958
+ const apiRef = React53.useRef(api);
2911
2959
  apiRef.current = api;
2912
2960
  const t = useT();
2913
2961
  const resource = useOrganizationListResource({
@@ -2920,7 +2968,7 @@ function useTeamsResource(organizationId) {
2920
2968
  }
2921
2969
  function useTeamMembersResource(selectedTeamId) {
2922
2970
  const api = useAuthClient().organization;
2923
- const apiRef = React52.useRef(api);
2971
+ const apiRef = React53.useRef(api);
2924
2972
  apiRef.current = api;
2925
2973
  const t = useT();
2926
2974
  const resource = useOrganizationListResource({
@@ -2931,12 +2979,12 @@ function useTeamMembersResource(selectedTeamId) {
2931
2979
  });
2932
2980
  return { members: resource.data, error: resource.error, reload: resource.refresh };
2933
2981
  }
2934
- var React52;
2982
+ var React53;
2935
2983
  var init_use_team_resources = __esm({
2936
2984
  "src/components/organization/use-team-resources.ts"() {
2937
2985
  "use strict";
2938
2986
  "use client";
2939
- React52 = __toESM(require("react"), 1);
2987
+ React53 = __toESM(require("react"), 1);
2940
2988
  init_hooks();
2941
2989
  init_i18n();
2942
2990
  init_use_organization_list_resource();
@@ -2953,7 +3001,7 @@ function TeamMembersPanel({
2953
3001
  const t = useT();
2954
3002
  const api = useAuthClient().organization;
2955
3003
  const { pending, error: actionError, run } = useSubmitAction();
2956
- const [userId, setUserId] = React53.useState("");
3004
+ const [userId, setUserId] = React54.useState("");
2957
3005
  const { members, error, reload } = useTeamMembersResource(team.id);
2958
3006
  const assignedUserIds = new Set(members?.map((member) => member.userId));
2959
3007
  const availableMembers = organization.members.filter((member) => !assignedUserIds.has(member.userId));
@@ -3019,12 +3067,12 @@ function TeamMembersPanel({
3019
3067
  }) }) : error ? null : members === null ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ba-skeleton", "aria-label": t("common.loading") }) : members.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.membersEmpty") }) : null
3020
3068
  ] });
3021
3069
  }
3022
- var React53, import_jsx_runtime59;
3070
+ var React54, import_jsx_runtime59;
3023
3071
  var init_TeamMembersPanel = __esm({
3024
3072
  "src/components/organization/TeamMembersPanel.tsx"() {
3025
3073
  "use strict";
3026
3074
  "use client";
3027
- React53 = __toESM(require("react"), 1);
3075
+ React54 = __toESM(require("react"), 1);
3028
3076
  init_hooks();
3029
3077
  init_i18n();
3030
3078
  init_FormError();
@@ -3049,11 +3097,11 @@ function TeamsSection({
3049
3097
  const { teams, error: teamsError, reload } = useTeamsResource(organization.id);
3050
3098
  const { dynamicRoles } = useOrganizationRoles(organization.id);
3051
3099
  const capabilities = teamManagementCapabilities(membership, dynamicRoles);
3052
- const [name, setName] = React54.useState("");
3053
- const [selectedTeamId, setSelectedTeamId] = React54.useState(null);
3054
- const [editingTeamId, setEditingTeamId] = React54.useState(null);
3055
- const [editingName, setEditingName] = React54.useState("");
3056
- React54.useEffect(() => {
3100
+ const [name, setName] = React55.useState("");
3101
+ const [selectedTeamId, setSelectedTeamId] = React55.useState(null);
3102
+ const [editingTeamId, setEditingTeamId] = React55.useState(null);
3103
+ const [editingName, setEditingName] = React55.useState("");
3104
+ React55.useEffect(() => {
3057
3105
  setSelectedTeamId(null);
3058
3106
  setEditingTeamId(null);
3059
3107
  setEditingName("");
@@ -3155,12 +3203,12 @@ function TeamsSection({
3155
3203
  )
3156
3204
  ] });
3157
3205
  }
3158
- var React54, import_jsx_runtime60;
3206
+ var React55, import_jsx_runtime60;
3159
3207
  var init_TeamsSection = __esm({
3160
3208
  "src/components/organization/TeamsSection.tsx"() {
3161
3209
  "use strict";
3162
3210
  "use client";
3163
- React54 = __toESM(require("react"), 1);
3211
+ React55 = __toESM(require("react"), 1);
3164
3212
  init_hooks();
3165
3213
  init_i18n();
3166
3214
  init_FormError();
@@ -3181,7 +3229,7 @@ __export(index_exports, {
3181
3229
  AuthLoading: () => AuthLoading,
3182
3230
  AuthOwlBadge: () => AuthOwlBadge,
3183
3231
  AuthOwlBranding: () => AuthOwlBranding,
3184
- AuthOwlError: () => import_core7.AuthOwlError,
3232
+ AuthOwlError: () => import_core8.AuthOwlError,
3185
3233
  AuthOwlProvider: () => AuthOwlProvider,
3186
3234
  BackupCodesManager: () => BackupCodesManager,
3187
3235
  Bidi: () => Bidi,
@@ -3192,7 +3240,7 @@ __export(index_exports, {
3192
3240
  EmailOtpForm: () => EmailOtpForm,
3193
3241
  ForgotPassword: () => ForgotPassword,
3194
3242
  GoogleOneTap: () => GoogleOneTap,
3195
- InvalidKeyError: () => import_core7.InvalidKeyError,
3243
+ InvalidKeyError: () => import_core8.InvalidKeyError,
3196
3244
  InvitationPrompt: () => InvitationPrompt,
3197
3245
  KNOWN_METHODS: () => KNOWN_METHODS,
3198
3246
  MFAChallenge: () => MFAChallenge,
@@ -3206,7 +3254,7 @@ __export(index_exports, {
3206
3254
  PasskeyManager: () => PasskeyManager,
3207
3255
  PhoneOTP: () => PhoneOTP,
3208
3256
  Protect: () => Protect,
3209
- RateLimitedError: () => import_core7.RateLimitedError,
3257
+ RateLimitedError: () => import_core8.RateLimitedError,
3210
3258
  ResetPassword: () => ResetPassword,
3211
3259
  SignIn: () => SignIn,
3212
3260
  SignOutButton: () => SignOutButton,
@@ -3220,11 +3268,11 @@ __export(index_exports, {
3220
3268
  VerificationPending: () => VerificationPending,
3221
3269
  VerifyEmail: () => VerifyEmail,
3222
3270
  Waitlist: () => Waitlist,
3223
- createMembershipHas: () => import_core8.createMembershipHas,
3271
+ createMembershipHas: () => import_core9.createMembershipHas,
3224
3272
  emailAutocomplete: () => emailAutocomplete,
3225
- membershipHas: () => import_core8.membershipHas,
3226
- membershipHasPermission: () => import_core8.membershipHasPermission,
3227
- membershipHasTeam: () => import_core8.membershipHasTeam,
3273
+ membershipHas: () => import_core9.membershipHas,
3274
+ membershipHasPermission: () => import_core9.membershipHasPermission,
3275
+ membershipHasTeam: () => import_core9.membershipHasTeam,
3228
3276
  resolveSignInMethods: () => resolveSignInMethods,
3229
3277
  useAccount: () => useAccount,
3230
3278
  useAuth: () => useAuth,
@@ -3233,6 +3281,7 @@ __export(index_exports, {
3233
3281
  useConsent: () => useConsent,
3234
3282
  useEmailVerification: () => useEmailVerification,
3235
3283
  useInvitationRecipientHint: () => useInvitationRecipientHint,
3284
+ useLastUsedSignInMethod: () => useLastUsedSignInMethod,
3236
3285
  useLocale: () => useLocale,
3237
3286
  useMFA: () => useMFA,
3238
3287
  useOrganization: () => useOrganization,
@@ -3254,7 +3303,7 @@ init_brand();
3254
3303
  init_hooks();
3255
3304
 
3256
3305
  // src/project-capabilities.ts
3257
- var import_core3 = require("@authowl/core");
3306
+ var import_core4 = require("@authowl/core");
3258
3307
 
3259
3308
  // src/signin-methods.ts
3260
3309
  var KNOWN_METHODS = [
@@ -3286,7 +3335,7 @@ function resolveSignInMethods(config, pageHost) {
3286
3335
  const methods = config?.enabledMethods ?? ["password"];
3287
3336
  const social = config?.socialProviders ?? [];
3288
3337
  const has = (m) => methods.includes(m);
3289
- const capabilities = (0, import_core3.resolveProjectCapabilities)(config);
3338
+ const capabilities = (0, import_core4.resolveProjectCapabilities)(config);
3290
3339
  const password = capabilities.passwordSignIn;
3291
3340
  const username = capabilities.usernameSignIn;
3292
3341
  const magicLink = capabilities.magicLinkSignIn;
@@ -3325,7 +3374,7 @@ function resolveSignInMethods(config, pageHost) {
3325
3374
  }
3326
3375
 
3327
3376
  // src/components/SignIn.tsx
3328
- var React19 = __toESM(require("react"), 1);
3377
+ var React20 = __toESM(require("react"), 1);
3329
3378
  init_hooks();
3330
3379
  init_i18n();
3331
3380
 
@@ -3391,15 +3440,15 @@ async function finishSignIn(opts) {
3391
3440
  init_use_submit_action();
3392
3441
 
3393
3442
  // src/components/passkey-autofill.ts
3394
- var React7 = __toESM(require("react"), 1);
3443
+ var React8 = __toESM(require("react"), 1);
3395
3444
  init_hooks();
3396
3445
  function usePasskeyAutofill(opts) {
3397
3446
  const { signInPasskey } = useSignIn();
3398
3447
  const { sessionStore } = useAuthClient();
3399
3448
  const { enabled } = opts;
3400
- const ref = React7.useRef({ ...opts, signInPasskey, sessionStore });
3449
+ const ref = React8.useRef({ ...opts, signInPasskey, sessionStore });
3401
3450
  ref.current = { ...opts, signInPasskey, sessionStore };
3402
- React7.useEffect(() => {
3451
+ React8.useEffect(() => {
3403
3452
  if (!enabled || typeof window === "undefined") return;
3404
3453
  const pkc = window.PublicKeyCredential;
3405
3454
  if (!pkc?.isConditionalMediationAvailable) return;
@@ -3417,9 +3466,13 @@ function usePasskeyAutofill(opts) {
3417
3466
  }, [enabled]);
3418
3467
  }
3419
3468
 
3469
+ // src/components/SignIn.tsx
3470
+ init_last_used_method();
3471
+
3420
3472
  // src/components/SocialButtons.tsx
3421
- var React8 = __toESM(require("react"), 1);
3473
+ var React9 = __toESM(require("react"), 1);
3422
3474
  init_hooks();
3475
+ init_last_used_method();
3423
3476
  init_i18n();
3424
3477
 
3425
3478
  // src/components/social-icons.tsx
@@ -3498,9 +3551,10 @@ function SocialButtons({ providers, callbackURL }) {
3498
3551
  const t = useT();
3499
3552
  const toServerError = useServerError();
3500
3553
  const { signInSocial } = useSignIn();
3501
- const [pending, setPending] = React8.useState(null);
3502
- const [error, setError] = React8.useState(null);
3503
- React8.useEffect(() => {
3554
+ const recordSignInMethod = useSignInMethodRecorder();
3555
+ const [pending, setPending] = React9.useState(null);
3556
+ const [error, setError] = React9.useState(null);
3557
+ React9.useEffect(() => {
3504
3558
  if (typeof window === "undefined") return;
3505
3559
  const url = new URL(window.location.href);
3506
3560
  if (!url.searchParams.has("authowl_error")) return;
@@ -3530,6 +3584,8 @@ function SocialButtons({ providers, callbackURL }) {
3530
3584
  if (res?.error) {
3531
3585
  setError(toServerError(res.error, t("social.error.startFailed")));
3532
3586
  setPending(null);
3587
+ } else {
3588
+ recordSignInMethod(`social:${provider}`, true);
3533
3589
  }
3534
3590
  } catch {
3535
3591
  setError(t("social.error.startFailed"));
@@ -3583,14 +3639,14 @@ function PasskeyButton({ redirectTo, onSignedIn }) {
3583
3639
  }
3584
3640
 
3585
3641
  // src/components/ForgotPassword.tsx
3586
- var React10 = __toESM(require("react"), 1);
3642
+ var React11 = __toESM(require("react"), 1);
3587
3643
  init_hooks();
3588
3644
  init_i18n();
3589
3645
  init_use_submit_action();
3590
3646
  init_Spinner();
3591
3647
 
3592
3648
  // src/components/AuthChallenge.tsx
3593
- var React9 = __toESM(require("react"), 1);
3649
+ var React10 = __toESM(require("react"), 1);
3594
3650
  init_hooks();
3595
3651
  init_i18n();
3596
3652
  init_FormError();
@@ -3626,30 +3682,30 @@ function captchaTheme(root, fallback) {
3626
3682
  function useAuthChallenge() {
3627
3683
  const { config, isLoading, retry } = usePublicConfig();
3628
3684
  const t = useT();
3629
- const container = React9.useRef(null);
3630
- const active = React9.useRef(null);
3631
- const [status, setStatus] = React9.useState("idle");
3685
+ const container = React10.useRef(null);
3686
+ const active = React10.useRef(null);
3687
+ const [status, setStatus] = React10.useState("idle");
3632
3688
  const captcha = config?.captcha ?? null;
3633
3689
  const providerSupported = captcha ? isSupportedCaptchaProvider(captcha.provider) : false;
3634
3690
  const unavailableProvider = captcha && !providerSupported ? captcha.provider : null;
3635
- const refetched = React9.useRef(null);
3636
- const refetchIfConfigMayBeStale = React9.useCallback(() => {
3691
+ const refetched = React10.useRef(null);
3692
+ const refetchIfConfigMayBeStale = React10.useCallback(() => {
3637
3693
  if (!config || refetched.current === config) return;
3638
3694
  refetched.current = config;
3639
3695
  retry();
3640
3696
  }, [config, retry]);
3641
- const removeActive = React9.useCallback((reason) => {
3697
+ const removeActive = React10.useCallback((reason) => {
3642
3698
  const current = active.current;
3643
3699
  active.current = null;
3644
3700
  if (!current) return;
3645
3701
  current.adapter.teardown(current.api, current.id);
3646
3702
  if (reason) current.reject(reason);
3647
3703
  }, []);
3648
- React9.useEffect(
3704
+ React10.useEffect(
3649
3705
  () => () => removeActive(new Error("Captcha challenge was cancelled")),
3650
3706
  [removeActive]
3651
3707
  );
3652
- const tokenFor = React9.useCallback(
3708
+ const tokenFor = React10.useCallback(
3653
3709
  async (action) => {
3654
3710
  if (!captcha) return null;
3655
3711
  if (!providerSupported) throw new Error(`Unsupported captcha provider: ${captcha.provider}`);
@@ -3706,7 +3762,7 @@ function useAuthChallenge() {
3706
3762
  },
3707
3763
  [captcha, config?.branding?.theme, config?.locale, providerSupported, removeActive]
3708
3764
  );
3709
- const run = React9.useCallback(
3765
+ const run = React10.useCallback(
3710
3766
  async (action, request) => {
3711
3767
  if (isLoading) {
3712
3768
  return {
@@ -3745,8 +3801,8 @@ function ForgotPassword({ resetPasswordUrl, onBack }) {
3745
3801
  const { requestPasswordReset } = usePasswordReset();
3746
3802
  const { pending, error, run } = useSubmitAction();
3747
3803
  const authChallenge = useAuthChallenge();
3748
- const [email, setEmail] = React10.useState("");
3749
- const [sent, setSent] = React10.useState(false);
3804
+ const [email, setEmail] = React11.useState("");
3805
+ const [sent, setSent] = React11.useState(false);
3750
3806
  if (sent) {
3751
3807
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "ba-fields", "data-testid": "forgot-sent", children: [
3752
3808
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "ba-muted", children: richMessage(t("forgotPassword.sent"), { email: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Bidi, { children: email }) }) }),
@@ -3849,7 +3905,7 @@ function OtpCodeForm({
3849
3905
  }
3850
3906
 
3851
3907
  // src/components/MFAChallenge.tsx
3852
- var React11 = __toESM(require("react"), 1);
3908
+ var React12 = __toESM(require("react"), 1);
3853
3909
  init_hooks();
3854
3910
  init_i18n();
3855
3911
  init_use_submit_action();
@@ -3860,9 +3916,9 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
3860
3916
  const t = useT();
3861
3917
  const { verifyTotp, verifyBackupCode, sendOtp, verifyOtp } = useMFA();
3862
3918
  const { pending, error, setError, run } = useSubmitAction();
3863
- const [mode, setMode] = React11.useState("totp");
3864
- const [code, setCode] = React11.useState("");
3865
- const [trustDevice, setTrustDevice] = React11.useState(false);
3919
+ const [mode, setMode] = React12.useState("totp");
3920
+ const [code, setCode] = React12.useState("");
3921
+ const [trustDevice, setTrustDevice] = React12.useState(false);
3866
3922
  const switchMode = (next) => {
3867
3923
  setMode(next);
3868
3924
  setCode("");
@@ -3922,12 +3978,12 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
3922
3978
  }
3923
3979
 
3924
3980
  // src/components/mfa-enrollment-step.tsx
3925
- var React14 = __toESM(require("react"), 1);
3981
+ var React15 = __toESM(require("react"), 1);
3926
3982
  init_hooks();
3927
3983
  init_i18n();
3928
3984
 
3929
3985
  // src/components/MFAEnrollment.tsx
3930
- var React13 = __toESM(require("react"), 1);
3986
+ var React14 = __toESM(require("react"), 1);
3931
3987
  init_hooks();
3932
3988
  init_i18n();
3933
3989
  init_use_submit_action();
@@ -3940,13 +3996,13 @@ function shouldDiscardSetup(args) {
3940
3996
  }
3941
3997
 
3942
3998
  // src/components/QrCode.tsx
3943
- var React12 = __toESM(require("react"), 1);
3999
+ var React13 = __toESM(require("react"), 1);
3944
4000
  init_i18n();
3945
4001
  var import_jsx_runtime14 = require("react/jsx-runtime");
3946
4002
  function QrCode({ value, size = 200 }) {
3947
4003
  const t = useT();
3948
- const [path, setPath] = React12.useState(null);
3949
- React12.useEffect(() => {
4004
+ const [path, setPath] = React13.useState(null);
4005
+ React13.useEffect(() => {
3950
4006
  let active = true;
3951
4007
  setPath(null);
3952
4008
  void Promise.resolve().then(() => (init_qr(), qr_exports)).then(
@@ -3997,11 +4053,11 @@ function MFAEnrollment({ onEnrolled, title }) {
3997
4053
  const { enable, verifyTotp } = useMFA();
3998
4054
  const { user, isLoaded } = useUser();
3999
4055
  const { pending, error, run } = useSubmitAction();
4000
- const [password, setPassword] = React13.useState("");
4001
- const [setup, setSetup] = React13.useState(null);
4002
- const [code, setCode] = React13.useState("");
4003
- const [done, setDone] = React13.useState(false);
4004
- const setupOwnerId = React13.useRef(null);
4056
+ const [password, setPassword] = React14.useState("");
4057
+ const [setup, setSetup] = React14.useState(null);
4058
+ const [code, setCode] = React14.useState("");
4059
+ const [done, setDone] = React14.useState(false);
4060
+ const setupOwnerId = React14.useRef(null);
4005
4061
  const userId = user?.id ?? null;
4006
4062
  const stale = shouldDiscardSetup({
4007
4063
  isLoaded,
@@ -4010,7 +4066,7 @@ function MFAEnrollment({ onEnrolled, title }) {
4010
4066
  currentUserId: userId
4011
4067
  });
4012
4068
  const activeSetup = stale ? null : setup;
4013
- React13.useEffect(() => {
4069
+ React14.useEffect(() => {
4014
4070
  if (stale) {
4015
4071
  setSetup(null);
4016
4072
  setPassword("");
@@ -4134,8 +4190,8 @@ function useConfirmedMfaPending(onUnknown = "pending") {
4134
4190
  const client = useAuthClient();
4135
4191
  const { needsMfaEnrollment } = useUser();
4136
4192
  const { refetch } = useSession();
4137
- const [confirmed, setConfirmed] = React14.useState(null);
4138
- React14.useEffect(() => {
4193
+ const [confirmed, setConfirmed] = React15.useState(null);
4194
+ React15.useEffect(() => {
4139
4195
  if (!needsMfaEnrollment) {
4140
4196
  setConfirmed(null);
4141
4197
  return;
@@ -4206,8 +4262,8 @@ function AuthOwlBadge({ href = "https://authowl.dev", force } = {}) {
4206
4262
  init_Spinner();
4207
4263
 
4208
4264
  // src/components/PhoneOTP.tsx
4209
- var React16 = __toESM(require("react"), 1);
4210
- var import_core4 = require("@authowl/core");
4265
+ var React17 = __toESM(require("react"), 1);
4266
+ var import_core5 = require("@authowl/core");
4211
4267
  init_hooks();
4212
4268
  init_i18n();
4213
4269
 
@@ -4257,7 +4313,7 @@ function LegalConsentCheckbox({
4257
4313
  }
4258
4314
 
4259
4315
  // src/components/Turnstile.tsx
4260
- var React15 = __toESM(require("react"), 1);
4316
+ var React16 = __toESM(require("react"), 1);
4261
4317
  var import_jsx_runtime20 = require("react/jsx-runtime");
4262
4318
  var LOCAL_TURNSTILE_TEST_TOKEN = "XXXX.DUMMY.TOKEN.XXXX";
4263
4319
  async function loadTurnstile() {
@@ -4274,10 +4330,10 @@ function Turnstile({
4274
4330
  onToken,
4275
4331
  onUnavailable
4276
4332
  }) {
4277
- const container = React15.useRef(null);
4278
- const callbacks = React15.useRef({ onToken, onUnavailable });
4333
+ const container = React16.useRef(null);
4334
+ const callbacks = React16.useRef({ onToken, onUnavailable });
4279
4335
  callbacks.current = { onToken, onUnavailable };
4280
- React15.useEffect(() => {
4336
+ React16.useEffect(() => {
4281
4337
  callbacks.current.onToken(null);
4282
4338
  if (!siteKey) {
4283
4339
  callbacks.current.onToken(LOCAL_TURNSTILE_TEST_TOKEN);
@@ -4327,20 +4383,20 @@ function PhoneOTP({
4327
4383
  const { config, isLoading } = usePublicConfig();
4328
4384
  const { preparePhoneOtp, startPhoneOtp, verifyPhoneOtp } = useSignIn();
4329
4385
  const { pending, error, setError, run } = useSubmitAction();
4330
- const [stage, setStage] = React16.useState("phone");
4331
- const [phoneNumber, setPhoneNumber] = React16.useState("");
4332
- const [code, setCode] = React16.useState("");
4333
- const [turnstileToken, setTurnstileToken] = React16.useState(null);
4334
- const [guardState, setGuardState] = React16.useState({ status: "loading" });
4335
- const [accepted, setAccepted] = React16.useState(false);
4336
- const attempt = React16.useRef(null);
4337
- const guardRequest = React16.useRef(0);
4386
+ const [stage, setStage] = React17.useState("phone");
4387
+ const [phoneNumber, setPhoneNumber] = React17.useState("");
4388
+ const [code, setCode] = React17.useState("");
4389
+ const [turnstileToken, setTurnstileToken] = React17.useState(null);
4390
+ const [guardState, setGuardState] = React17.useState({ status: "loading" });
4391
+ const [accepted, setAccepted] = React17.useState(false);
4392
+ const attempt = React17.useRef(null);
4393
+ const guardRequest = React17.useRef(0);
4338
4394
  const legal = config?.legal;
4339
4395
  const consentBlocked = Boolean(legal?.required && !accepted);
4340
4396
  const guard = guardState.status === "ready" ? guardState.data : null;
4341
4397
  const turnstileBlocked = guardState.status === "ready" && guardState.data.kind === "authowl_turnstile" && !turnstileToken;
4342
4398
  const humanCheckError = t("phoneOtp.error.humanCheck");
4343
- const loadGuard = React16.useCallback(async () => {
4399
+ const loadGuard = React17.useCallback(async () => {
4344
4400
  const request = ++guardRequest.current;
4345
4401
  setGuardState({ status: "loading" });
4346
4402
  setError(null);
@@ -4359,7 +4415,7 @@ function PhoneOTP({
4359
4415
  setError(humanCheckError);
4360
4416
  }
4361
4417
  }, [humanCheckError, preparePhoneOtp, setError]);
4362
- React16.useEffect(() => {
4418
+ React17.useEffect(() => {
4363
4419
  void loadGuard();
4364
4420
  return () => {
4365
4421
  guardRequest.current += 1;
@@ -4468,7 +4524,7 @@ function PhoneOTP({
4468
4524
  return;
4469
4525
  }
4470
4526
  if (!attempt.current || attempt.current.phoneNumber !== phoneNumber) {
4471
- attempt.current = { phoneNumber, idempotencyKey: (0, import_core4.createIdempotencyKey)() };
4527
+ attempt.current = { phoneNumber, idempotencyKey: (0, import_core5.createIdempotencyKey)() };
4472
4528
  }
4473
4529
  const idempotencyKey = attempt.current.idempotencyKey;
4474
4530
  void run(
@@ -4481,7 +4537,7 @@ function PhoneOTP({
4481
4537
  const current = selected?.data ?? guard;
4482
4538
  if (selected?.data) setGuardState({ status: "ready", data: selected.data });
4483
4539
  if (current?.kind === "akedly_shield_v1_2") {
4484
- const akedlyShield = await (0, import_core4.solvePhoneOtpChallenge)(current);
4540
+ const akedlyShield = await (0, import_core5.solvePhoneOtpChallenge)(current);
4485
4541
  return startPhoneOtp({ phoneNumber, akedlyShield, idempotencyKey });
4486
4542
  }
4487
4543
  if (current?.kind === "authowl_turnstile" && turnstileToken) {
@@ -4566,7 +4622,7 @@ function PhoneOTP({
4566
4622
  init_FormError();
4567
4623
 
4568
4624
  // src/components/AuthOwlBranding.tsx
4569
- var React17 = __toESM(require("react"), 1);
4625
+ var React18 = __toESM(require("react"), 1);
4570
4626
  init_hooks();
4571
4627
  init_i18n();
4572
4628
  var import_jsx_runtime22 = require("react/jsx-runtime");
@@ -4577,8 +4633,8 @@ function AuthOwlBranding({ href, showEnvironment = true } = {}) {
4577
4633
  const appName = config?.branding?.appName?.trim() ?? "";
4578
4634
  const showAppName = config?.branding?.showAppName !== false && appName.length > 0;
4579
4635
  const alignment = config?.branding?.alignment ?? "left";
4580
- const [logoFailed, setLogoFailed] = React17.useState(false);
4581
- React17.useEffect(() => setLogoFailed(false), [logoUrl]);
4636
+ const [logoFailed, setLogoFailed] = React18.useState(false);
4637
+ React18.useEffect(() => setLogoFailed(false), [logoUrl]);
4582
4638
  if (!config) return null;
4583
4639
  if (!logoUrl && !showAppName && (!showEnvironment || !config.environmentType)) return null;
4584
4640
  const identity = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "ba-branding-identity", children: [
@@ -4618,15 +4674,15 @@ function AuthOwlBranding({ href, showEnvironment = true } = {}) {
4618
4674
  }
4619
4675
 
4620
4676
  // src/components/InvitationBanner.tsx
4621
- var React18 = __toESM(require("react"), 1);
4622
- var import_core5 = require("@authowl/core");
4677
+ var React19 = __toESM(require("react"), 1);
4678
+ var import_core6 = require("@authowl/core");
4623
4679
  init_i18n();
4624
4680
  var import_jsx_runtime23 = require("react/jsx-runtime");
4625
4681
  function InvitationBanner() {
4626
4682
  const t = useT();
4627
- const [pending, setPending] = React18.useState(false);
4628
- React18.useEffect(() => {
4629
- setPending((0, import_core5.readInvitationClaim)() !== null);
4683
+ const [pending, setPending] = React19.useState(false);
4684
+ React19.useEffect(() => {
4685
+ setPending((0, import_core6.readInvitationClaim)() !== null);
4630
4686
  }, []);
4631
4687
  if (!pending) return null;
4632
4688
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "ba-muted", "data-testid": "authowl-invitation-banner", children: t("organization.invitationBanner") });
@@ -4673,18 +4729,27 @@ function SignIn({
4673
4729
  const { config, isLoading, isError } = usePublicConfig();
4674
4730
  const { pending, error, setError, run } = useSubmitAction();
4675
4731
  const authChallenge = useAuthChallenge();
4676
- const [email, setEmail] = React19.useState("");
4677
- const [username, setUsername] = React19.useState("");
4678
- const [password, setPassword] = React19.useState("");
4679
- const [credentialMode, setCredentialMode] = React19.useState("email");
4680
- const [otp, setOtp] = React19.useState("");
4681
- const [view, setView] = React19.useState(
4732
+ const [email, setEmail] = React20.useState("");
4733
+ const [username, setUsername] = React20.useState("");
4734
+ const [password, setPassword] = React20.useState("");
4735
+ const [credentialMode, setCredentialMode] = React20.useState("email");
4736
+ const [otp, setOtp] = React20.useState("");
4737
+ const [view, setView] = React20.useState(
4682
4738
  "sign-in"
4683
4739
  );
4684
- const [inFlight, setInFlight] = React19.useState(null);
4685
- const [challenge, setChallenge] = React19.useState(false);
4740
+ const [inFlight, setInFlight] = React20.useState(null);
4741
+ const [challenge, setChallenge] = React20.useState(false);
4686
4742
  const mfaEnrolment = useConfirmedMfaPending("clear");
4687
- const emailRef = React19.useRef(null);
4743
+ const emailRef = React20.useRef(null);
4744
+ const recordSignInMethod = useSignInMethodRecorder();
4745
+ const onPasskeySignedIn = React20.useCallback(() => {
4746
+ recordSignInMethod("passkey");
4747
+ onSignedIn?.();
4748
+ }, [onSignedIn, recordSignInMethod]);
4749
+ const onPhoneOtpSignedIn = React20.useCallback(() => {
4750
+ recordSignInMethod("phone-otp");
4751
+ onSignedIn?.();
4752
+ }, [onSignedIn, recordSignInMethod]);
4688
4753
  const plan = resolveSignInMethods(
4689
4754
  config,
4690
4755
  typeof window === "undefined" ? void 0 : window.location.hostname
@@ -4692,7 +4757,7 @@ function SignIn({
4692
4757
  usePasskeyAutofill({
4693
4758
  enabled: credentialMode === "email" && plan.autofillHost !== null,
4694
4759
  redirectTo,
4695
- onSignedIn
4760
+ onSignedIn: onPasskeySignedIn
4696
4761
  });
4697
4762
  const badge = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AuthOwlBadge, { force: showBadge });
4698
4763
  const branding = showBranding ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AuthOwlBranding, {}) : null;
@@ -4744,7 +4809,10 @@ function SignIn({
4744
4809
  error,
4745
4810
  onSubmit: () => void run(() => signInEmailOtp({ email, otp }), {
4746
4811
  failure: t("emailOtp.error.invalidCode"),
4747
- onSuccess: () => finishSignIn({ sessionStore, redirectTo, onSignedIn })
4812
+ onSuccess: () => {
4813
+ recordSignInMethod("email-otp");
4814
+ finishSignIn({ sessionStore, redirectTo, onSignedIn });
4815
+ }
4748
4816
  }),
4749
4817
  onChangeEmail: () => {
4750
4818
  setOtp("");
@@ -4772,7 +4840,7 @@ function SignIn({
4772
4840
  PhoneOTP,
4773
4841
  {
4774
4842
  redirectTo,
4775
- onSignedIn,
4843
+ onSignedIn: onPhoneOtpSignedIn,
4776
4844
  onBack: () => setView("sign-in"),
4777
4845
  onMfaPasswordRequired: () => {
4778
4846
  setView("sign-in");
@@ -4800,6 +4868,7 @@ function SignIn({
4800
4868
  failure: t("signIn.error.failed"),
4801
4869
  onSuccess: (res) => {
4802
4870
  const data = res.data;
4871
+ recordSignInMethod(credentialMode === "username" ? "username" : "password");
4803
4872
  if (data && "twoFactorRedirect" in data && data.twoFactorRedirect) {
4804
4873
  setChallenge(true);
4805
4874
  } else {
@@ -4812,7 +4881,10 @@ function SignIn({
4812
4881
  "magic",
4813
4882
  () => void run(() => authChallenge.run(AUTH_CHALLENGE_ACTIONS.passwordless, (options) => signInMagicLink({ email, callbackURL: redirectTo }, options)), {
4814
4883
  failure: t("magicLink.error.sendFailed"),
4815
- onSuccess: () => setView("magic-sent")
4884
+ onSuccess: () => {
4885
+ recordSignInMethod("magic-link", true);
4886
+ setView("magic-sent");
4887
+ }
4816
4888
  })
4817
4889
  );
4818
4890
  const doRequestOtp = () => start(
@@ -4829,6 +4901,7 @@ function SignIn({
4829
4901
  {
4830
4902
  failure: t("sso.error.startFailed"),
4831
4903
  mapError: (error2) => error2.status === 404 ? t("sso.error.notFound") : null,
4904
+ onSuccess: () => recordSignInMethod("sso", true),
4832
4905
  // SSO always redirects the browser to the IdP; keep the spinner up
4833
4906
  // through that navigation instead of flashing back to idle.
4834
4907
  keepPendingOnSuccess: true
@@ -4967,7 +5040,7 @@ function SignIn({
4967
5040
  ]
4968
5041
  }
4969
5042
  ),
4970
- plan.passkey && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PasskeyButton, { redirectTo, onSignedIn }),
5043
+ plan.passkey && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PasskeyButton, { redirectTo, onSignedIn: onPasskeySignedIn }),
4971
5044
  plan.phoneOtp && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4972
5045
  "button",
4973
5046
  {
@@ -4983,12 +5056,12 @@ function SignIn({
4983
5056
  }
4984
5057
 
4985
5058
  // src/components/SignUp.tsx
4986
- var React23 = __toESM(require("react"), 1);
5059
+ var React24 = __toESM(require("react"), 1);
4987
5060
  init_hooks();
4988
5061
  init_i18n();
4989
5062
 
4990
5063
  // src/components/VerificationPending.tsx
4991
- var React20 = __toESM(require("react"), 1);
5064
+ var React21 = __toESM(require("react"), 1);
4992
5065
  init_hooks();
4993
5066
  init_i18n();
4994
5067
  init_use_submit_action();
@@ -5008,9 +5081,9 @@ function VerificationPending({
5008
5081
  } = useEmailVerification();
5009
5082
  const { pending, error, run } = useSubmitAction();
5010
5083
  const authChallenge = useAuthChallenge();
5011
- const [resent, setResent] = React20.useState(false);
5012
- const [code, setCode] = React20.useState("");
5013
- const [verified, setVerified] = React20.useState(false);
5084
+ const [resent, setResent] = React21.useState(false);
5085
+ const [code, setCode] = React21.useState("");
5086
+ const [verified, setVerified] = React21.useState(false);
5014
5087
  if (verified) {
5015
5088
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "ba-success", role: "status", "data-testid": "verify-code-success", children: t("verifyEmail.success") });
5016
5089
  }
@@ -5113,7 +5186,7 @@ function VerificationPending({
5113
5186
  }
5114
5187
 
5115
5188
  // src/components/PasswordlessSignUp.tsx
5116
- var React21 = __toESM(require("react"), 1);
5189
+ var React22 = __toESM(require("react"), 1);
5117
5190
  init_hooks();
5118
5191
  init_i18n();
5119
5192
  init_use_submit_action();
@@ -5125,9 +5198,9 @@ function PasswordlessSignUp({ onAuthenticated }) {
5125
5198
  const { sendEmailOtp, signInEmailOtp } = useSignIn();
5126
5199
  const { pending, error, setError, run } = useSubmitAction();
5127
5200
  const authChallenge = useAuthChallenge();
5128
- const [email, setEmail] = React21.useState("");
5129
- const [code, setCode] = React21.useState("");
5130
- const [codeSent, setCodeSent] = React21.useState(false);
5201
+ const [email, setEmail] = React22.useState("");
5202
+ const [code, setCode] = React22.useState("");
5203
+ const [codeSent, setCodeSent] = React22.useState(false);
5131
5204
  if (codeSent) {
5132
5205
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "ba-fields", "data-testid": "signup-emailotp-code", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5133
5206
  OtpCodeForm,
@@ -5232,7 +5305,7 @@ init_Spinner();
5232
5305
  init_FormError();
5233
5306
 
5234
5307
  // src/components/Waitlist.tsx
5235
- var React22 = __toESM(require("react"), 1);
5308
+ var React23 = __toESM(require("react"), 1);
5236
5309
  init_hooks();
5237
5310
  init_i18n();
5238
5311
  init_FormError();
@@ -5244,8 +5317,8 @@ function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
5244
5317
  const { join } = useWaitlist();
5245
5318
  const { pending, error, run } = useSubmitAction();
5246
5319
  const authChallenge = useAuthChallenge();
5247
- const [email, setEmail] = React22.useState("");
5248
- const [joined, setJoined] = React22.useState(false);
5320
+ const [email, setEmail] = React23.useState("");
5321
+ const [joined, setJoined] = React23.useState(false);
5249
5322
  if (joined) {
5250
5323
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "ba-form", "data-testid": "waitlist-accepted", children: [
5251
5324
  showBranding ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AuthOwlBranding, {}) : null,
@@ -5329,24 +5402,24 @@ function SignUp({
5329
5402
  const { signUp } = useSignUp();
5330
5403
  const { config, isLoading, isError } = usePublicConfig();
5331
5404
  const authChallenge = useAuthChallenge();
5332
- const [email, setEmail] = React23.useState("");
5333
- const [password, setPassword] = React23.useState("");
5334
- const [name, setName] = React23.useState("");
5335
- const [firstName, setFirstName] = React23.useState("");
5336
- const [lastName, setLastName] = React23.useState("");
5337
- const [username, setUsername] = React23.useState("");
5338
- const [error, setError] = React23.useState(null);
5339
- const [submitting, setSubmitting] = React23.useState(false);
5340
- const [accepted, setAccepted] = React23.useState(false);
5405
+ const [email, setEmail] = React24.useState("");
5406
+ const [password, setPassword] = React24.useState("");
5407
+ const [name, setName] = React24.useState("");
5408
+ const [firstName, setFirstName] = React24.useState("");
5409
+ const [lastName, setLastName] = React24.useState("");
5410
+ const [username, setUsername] = React24.useState("");
5411
+ const [error, setError] = React24.useState(null);
5412
+ const [submitting, setSubmitting] = React24.useState(false);
5413
+ const [accepted, setAccepted] = React24.useState(false);
5341
5414
  const legal = config?.legal;
5342
5415
  const consentRequired = Boolean(legal?.required);
5343
5416
  const consentBlocked = consentRequired && !accepted;
5344
- const capabilities = (0, import_core3.resolveProjectCapabilities)(config);
5417
+ const capabilities = (0, import_core4.resolveProjectCapabilities)(config);
5345
5418
  const passwordMinLength = capabilities.passwordMinLength;
5346
5419
  const passwordMaxLength = capabilities.passwordMaxLength;
5347
5420
  const passkeysEnabled = capabilities.passkeyAdd;
5348
- const [pendingEmail, setPendingEmail] = React23.useState(null);
5349
- const [completeWithPasskey, setCompleteWithPasskey] = React23.useState(false);
5421
+ const [pendingEmail, setPendingEmail] = React24.useState(null);
5422
+ const [completeWithPasskey, setCompleteWithPasskey] = React24.useState(false);
5350
5423
  function finishSignUp() {
5351
5424
  onSignedUp?.();
5352
5425
  if (redirectTo) window.location.assign(redirectTo);
@@ -5633,7 +5706,7 @@ function MFARequiredGate({ children, title }) {
5633
5706
  }
5634
5707
 
5635
5708
  // src/components/BackupCodesManager.tsx
5636
- var React24 = __toESM(require("react"), 1);
5709
+ var React25 = __toESM(require("react"), 1);
5637
5710
  init_hooks();
5638
5711
  init_i18n();
5639
5712
  init_use_submit_action();
@@ -5645,8 +5718,8 @@ function BackupCodesManager({ title }) {
5645
5718
  const { user } = useUser();
5646
5719
  const { regenerateBackupCodes } = useMFA();
5647
5720
  const { pending, error, run } = useSubmitAction();
5648
- const [password, setPassword] = React24.useState("");
5649
- const [codes, setCodes] = React24.useState(null);
5721
+ const [password, setPassword] = React25.useState("");
5722
+ const [codes, setCodes] = React25.useState(null);
5650
5723
  if (!user?.twoFactorEnabled) return null;
5651
5724
  const submit = (e) => {
5652
5725
  e.preventDefault();
@@ -5690,7 +5763,7 @@ function BackupCodesManager({ title }) {
5690
5763
  }
5691
5764
 
5692
5765
  // src/components/MagicLinkForm.tsx
5693
- var React25 = __toESM(require("react"), 1);
5766
+ var React26 = __toESM(require("react"), 1);
5694
5767
  init_hooks();
5695
5768
  init_i18n();
5696
5769
  init_use_submit_action();
@@ -5702,8 +5775,8 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
5702
5775
  const { signInMagicLink } = useSignIn();
5703
5776
  const { pending, error, run } = useSubmitAction();
5704
5777
  const authChallenge = useAuthChallenge();
5705
- const [email, setEmail] = React25.useState("");
5706
- const [sent, setSent] = React25.useState(false);
5778
+ const [email, setEmail] = React26.useState("");
5779
+ const [sent, setSent] = React26.useState(false);
5707
5780
  if (sent) {
5708
5781
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "ba-muted", "data-testid": "magiclink-sent", children: t("magicLink.sent") });
5709
5782
  }
@@ -5753,7 +5826,7 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
5753
5826
  }
5754
5827
 
5755
5828
  // src/components/EmailOtpForm.tsx
5756
- var React26 = __toESM(require("react"), 1);
5829
+ var React27 = __toESM(require("react"), 1);
5757
5830
  init_hooks();
5758
5831
  init_i18n();
5759
5832
  init_use_submit_action();
@@ -5766,9 +5839,9 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
5766
5839
  const { sendEmailOtp, signInEmailOtp } = useSignIn();
5767
5840
  const { pending, error, setError, run } = useSubmitAction();
5768
5841
  const authChallenge = useAuthChallenge();
5769
- const [email, setEmail] = React26.useState("");
5770
- const [otp, setOtp] = React26.useState("");
5771
- const [stage, setStage] = React26.useState("email");
5842
+ const [email, setEmail] = React27.useState("");
5843
+ const [otp, setOtp] = React27.useState("");
5844
+ const [stage, setStage] = React27.useState("email");
5772
5845
  if (stage === "code") {
5773
5846
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5774
5847
  OtpCodeForm,
@@ -5842,7 +5915,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
5842
5915
  }
5843
5916
 
5844
5917
  // src/components/ResetPassword.tsx
5845
- var React27 = __toESM(require("react"), 1);
5918
+ var React28 = __toESM(require("react"), 1);
5846
5919
  init_hooks();
5847
5920
  init_i18n();
5848
5921
  init_use_submit_action();
@@ -5853,15 +5926,15 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
5853
5926
  const t = useT();
5854
5927
  const { resetPassword } = usePasswordReset();
5855
5928
  const { config } = usePublicConfig();
5856
- const capabilities = (0, import_core3.resolveProjectCapabilities)(config);
5929
+ const capabilities = (0, import_core4.resolveProjectCapabilities)(config);
5857
5930
  const { passwordMinLength, passwordMaxLength } = capabilities;
5858
5931
  const { pending, error, setError, run } = useSubmitAction();
5859
- const [token, setToken] = React27.useState(tokenProp ?? null);
5860
- const [ready, setReady] = React27.useState(tokenProp != null);
5861
- const [password, setPassword] = React27.useState("");
5862
- const [confirm, setConfirm] = React27.useState("");
5863
- const [done, setDone] = React27.useState(false);
5864
- React27.useEffect(() => {
5932
+ const [token, setToken] = React28.useState(tokenProp ?? null);
5933
+ const [ready, setReady] = React28.useState(tokenProp != null);
5934
+ const [password, setPassword] = React28.useState("");
5935
+ const [confirm, setConfirm] = React28.useState("");
5936
+ const [done, setDone] = React28.useState(false);
5937
+ React28.useEffect(() => {
5865
5938
  if (tokenProp != null) return;
5866
5939
  const params = new URLSearchParams(window.location.search);
5867
5940
  setToken(params.get("token"));
@@ -5948,7 +6021,7 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
5948
6021
  }
5949
6022
 
5950
6023
  // src/components/VerifyEmail.tsx
5951
- var React28 = __toESM(require("react"), 1);
6024
+ var React29 = __toESM(require("react"), 1);
5952
6025
  init_hooks();
5953
6026
  init_i18n();
5954
6027
  init_use_submit_action();
@@ -5960,11 +6033,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
5960
6033
  const { sendVerificationEmail } = useEmailVerification();
5961
6034
  const { pending, error, run } = useSubmitAction();
5962
6035
  const authChallenge = useAuthChallenge();
5963
- const [ready, setReady] = React28.useState(false);
5964
- const [failed, setFailed] = React28.useState(false);
5965
- const [email, setEmail] = React28.useState("");
5966
- const [resent, setResent] = React28.useState(false);
5967
- React28.useEffect(() => {
6036
+ const [ready, setReady] = React29.useState(false);
6037
+ const [failed, setFailed] = React29.useState(false);
6038
+ const [email, setEmail] = React29.useState("");
6039
+ const [resent, setResent] = React29.useState(false);
6040
+ React29.useEffect(() => {
5968
6041
  const didFail = new URLSearchParams(window.location.search).has("error");
5969
6042
  setFailed(didFail);
5970
6043
  setReady(true);
@@ -6029,7 +6102,7 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
6029
6102
  }
6030
6103
 
6031
6104
  // src/components/PasskeyManager.tsx
6032
- var React29 = __toESM(require("react"), 1);
6105
+ var React30 = __toESM(require("react"), 1);
6033
6106
  init_hooks();
6034
6107
  init_i18n();
6035
6108
  init_use_submit_action();
@@ -6054,12 +6127,12 @@ function PasskeyManagerBody({
6054
6127
  const t = useT();
6055
6128
  const toServerError = useServerError();
6056
6129
  const api = usePasskeys();
6057
- const apiRef = React29.useRef(api);
6130
+ const apiRef = React30.useRef(api);
6058
6131
  apiRef.current = api;
6059
6132
  const { pending, error, setError, run } = useSubmitAction();
6060
- const [passkeys, setPasskeys] = React29.useState(null);
6061
- const loadTokenRef = React29.useRef(0);
6062
- const load = React29.useCallback(async () => {
6133
+ const [passkeys, setPasskeys] = React30.useState(null);
6134
+ const loadTokenRef = React30.useRef(0);
6135
+ const load = React30.useCallback(async () => {
6063
6136
  const token = ++loadTokenRef.current;
6064
6137
  try {
6065
6138
  const res = await apiRef.current.listPasskeys();
@@ -6075,7 +6148,7 @@ function PasskeyManagerBody({
6075
6148
  setError(t("passkeys.error.loadFailed"));
6076
6149
  }
6077
6150
  }, [setError, toServerError, t]);
6078
- React29.useEffect(() => {
6151
+ React30.useEffect(() => {
6079
6152
  void load();
6080
6153
  }, [load]);
6081
6154
  function onRename(id, current) {
@@ -6146,7 +6219,7 @@ function PasskeyManagerBody({
6146
6219
  }
6147
6220
 
6148
6221
  // src/components/control.tsx
6149
- var import_core6 = require("@authowl/core");
6222
+ var import_core7 = require("@authowl/core");
6150
6223
  init_hooks();
6151
6224
  init_i18n();
6152
6225
  init_Spinner();
@@ -6171,7 +6244,7 @@ function Protect({
6171
6244
  const membership = useSession().data?.session?.membership ?? null;
6172
6245
  if (!isLoaded) return null;
6173
6246
  if (!isSignedIn || !user) return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: fallback });
6174
- if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !(0, import_core6.membershipHas)(membership, { role, permission, teamId })) {
6247
+ if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !(0, import_core7.membershipHas)(membership, { role, permission, teamId })) {
6175
6248
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: fallback });
6176
6249
  }
6177
6250
  if (condition && !condition(user)) return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: fallback });
@@ -6195,7 +6268,7 @@ function AuthLoaded({ children }) {
6195
6268
  init_Spinner();
6196
6269
 
6197
6270
  // src/components/SignOutButton.tsx
6198
- var React30 = __toESM(require("react"), 1);
6271
+ var React31 = __toESM(require("react"), 1);
6199
6272
  init_hooks();
6200
6273
  init_i18n();
6201
6274
  init_Spinner();
@@ -6203,7 +6276,7 @@ var import_jsx_runtime40 = require("react/jsx-runtime");
6203
6276
  function SignOutButton({ children, redirectTo, onSignedOut, className }) {
6204
6277
  const t = useT();
6205
6278
  const { signOut } = useSignOut();
6206
- const [pending, setPending] = React30.useState(false);
6279
+ const [pending, setPending] = React31.useState(false);
6207
6280
  const content = children ?? t("signOut.button");
6208
6281
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
6209
6282
  "button",
@@ -6229,17 +6302,17 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
6229
6302
  }
6230
6303
 
6231
6304
  // src/components/UserButton.tsx
6232
- var React43 = __toESM(require("react"), 1);
6305
+ var React44 = __toESM(require("react"), 1);
6233
6306
  init_hooks();
6234
6307
  init_i18n();
6235
6308
 
6236
6309
  // src/components/UserProfile.tsx
6237
- var React42 = __toESM(require("react"), 1);
6310
+ var React43 = __toESM(require("react"), 1);
6238
6311
  init_hooks();
6239
6312
  init_i18n();
6240
6313
 
6241
6314
  // src/components/user-profile/EmailSection.tsx
6242
- var React31 = __toESM(require("react"), 1);
6315
+ var React32 = __toESM(require("react"), 1);
6243
6316
  init_hooks();
6244
6317
  init_i18n();
6245
6318
  init_use_submit_action();
@@ -6251,9 +6324,9 @@ function EmailSection({ allowChange }) {
6251
6324
  const account = useAccount();
6252
6325
  const { user } = useUser();
6253
6326
  const { pending, error, run } = useSubmitAction();
6254
- const [newEmail, setNewEmail] = React31.useState("");
6255
- const [sent, setSent] = React31.useState(false);
6256
- const titleId = React31.useId();
6327
+ const [newEmail, setNewEmail] = React32.useState("");
6328
+ const [sent, setSent] = React32.useState(false);
6329
+ const titleId = React32.useId();
6257
6330
  if (!user?.email) {
6258
6331
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
6259
6332
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
@@ -6318,7 +6391,7 @@ function EmailSection({ allowChange }) {
6318
6391
  }
6319
6392
 
6320
6393
  // src/components/user-profile/DeleteAccountSection.tsx
6321
- var React32 = __toESM(require("react"), 1);
6394
+ var React33 = __toESM(require("react"), 1);
6322
6395
  init_hooks();
6323
6396
  init_i18n();
6324
6397
  init_use_submit_action();
@@ -6331,8 +6404,8 @@ function DeleteAccountSection({ onDeleted }) {
6331
6404
  const session = useSession();
6332
6405
  const { user } = useUser();
6333
6406
  const { pending, error, run } = useSubmitAction();
6334
- const [confirmation, setConfirmation] = React32.useState("");
6335
- const titleId = React32.useId();
6407
+ const [confirmation, setConfirmation] = React33.useState("");
6408
+ const titleId = React33.useId();
6336
6409
  const identifier = user?.email ?? user?.phoneNumber ?? user?.id ?? "";
6337
6410
  const confirmed = identifier.length > 0 && confirmation.trim().toLowerCase() === identifier.toLowerCase();
6338
6411
  const submit = (event) => {
@@ -6390,7 +6463,7 @@ function DeleteAccountSection({ onDeleted }) {
6390
6463
  }
6391
6464
 
6392
6465
  // src/components/user-profile/MfaSection.tsx
6393
- var React33 = __toESM(require("react"), 1);
6466
+ var React34 = __toESM(require("react"), 1);
6394
6467
  init_hooks();
6395
6468
  init_i18n();
6396
6469
  init_use_submit_action();
@@ -6404,10 +6477,10 @@ function MfaSection() {
6404
6477
  const { config } = usePublicConfig();
6405
6478
  const { disable } = useMFA();
6406
6479
  const { pending, error, run } = useSubmitAction();
6407
- const [password, setPassword] = React33.useState("");
6408
- const [showDisable, setShowDisable] = React33.useState(false);
6409
- const titleId = React33.useId();
6410
- const required = (0, import_core3.resolveProjectCapabilities)(config).mfaRequired;
6480
+ const [password, setPassword] = React34.useState("");
6481
+ const [showDisable, setShowDisable] = React34.useState(false);
6482
+ const titleId = React34.useId();
6483
+ const required = (0, import_core4.resolveProjectCapabilities)(config).mfaRequired;
6411
6484
  if (!user?.twoFactorEnabled) {
6412
6485
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
6413
6486
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("header", { className: "ba-profile-section-header", children: [
@@ -6501,7 +6574,7 @@ function MfaSection() {
6501
6574
  }
6502
6575
 
6503
6576
  // src/components/user-profile/PasswordSection.tsx
6504
- var React34 = __toESM(require("react"), 1);
6577
+ var React35 = __toESM(require("react"), 1);
6505
6578
  init_hooks();
6506
6579
  init_i18n();
6507
6580
  init_use_submit_action();
@@ -6512,13 +6585,13 @@ function PasswordSection() {
6512
6585
  const t = useT();
6513
6586
  const account = useAccount();
6514
6587
  const { config } = usePublicConfig();
6515
- const { passwordMinLength, passwordMaxLength } = (0, import_core3.resolveProjectCapabilities)(config);
6588
+ const { passwordMinLength, passwordMaxLength } = (0, import_core4.resolveProjectCapabilities)(config);
6516
6589
  const { pending, error, setError, run } = useSubmitAction();
6517
- const [currentPassword, setCurrentPassword] = React34.useState("");
6518
- const [newPassword, setNewPassword] = React34.useState("");
6519
- const [confirmPassword, setConfirmPassword] = React34.useState("");
6520
- const [saved, setSaved] = React34.useState(false);
6521
- const titleId = React34.useId();
6590
+ const [currentPassword, setCurrentPassword] = React35.useState("");
6591
+ const [newPassword, setNewPassword] = React35.useState("");
6592
+ const [confirmPassword, setConfirmPassword] = React35.useState("");
6593
+ const [saved, setSaved] = React35.useState(false);
6594
+ const titleId = React35.useId();
6522
6595
  const submit = (event) => {
6523
6596
  event.preventDefault();
6524
6597
  setSaved(false);
@@ -6587,12 +6660,12 @@ function PasswordSection() {
6587
6660
  }
6588
6661
 
6589
6662
  // src/components/user-profile/PasskeysSection.tsx
6590
- var React35 = __toESM(require("react"), 1);
6663
+ var React36 = __toESM(require("react"), 1);
6591
6664
  init_i18n();
6592
6665
  var import_jsx_runtime45 = require("react/jsx-runtime");
6593
6666
  function PasskeysSection({ allowAdd }) {
6594
6667
  const t = useT();
6595
- const titleId = React35.useId();
6668
+ const titleId = React36.useId();
6596
6669
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
6597
6670
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("header", { className: "ba-profile-section-header", children: [
6598
6671
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
@@ -6603,7 +6676,7 @@ function PasskeysSection({ allowAdd }) {
6603
6676
  }
6604
6677
 
6605
6678
  // src/components/user-profile/ProfileSection.tsx
6606
- var React36 = __toESM(require("react"), 1);
6679
+ var React37 = __toESM(require("react"), 1);
6607
6680
  init_hooks();
6608
6681
  init_i18n();
6609
6682
  init_use_submit_action();
@@ -6620,15 +6693,15 @@ function ProfileSection({
6620
6693
  const { user } = useUser();
6621
6694
  const session = useSession();
6622
6695
  const { pending, error, run } = useSubmitAction();
6623
- const [name, setName] = React36.useState(user?.name ?? "");
6624
- const [firstName, setFirstName] = React36.useState(user?.firstName ?? "");
6625
- const [lastName, setLastName] = React36.useState(user?.lastName ?? "");
6626
- const [username, setUsername] = React36.useState(
6696
+ const [name, setName] = React37.useState(user?.name ?? "");
6697
+ const [firstName, setFirstName] = React37.useState(user?.firstName ?? "");
6698
+ const [lastName, setLastName] = React37.useState(user?.lastName ?? "");
6699
+ const [username, setUsername] = React37.useState(
6627
6700
  user?.displayUsername ?? user?.username ?? ""
6628
6701
  );
6629
- const [image, setImage] = React36.useState(user?.image ?? "");
6630
- const [saved, setSaved] = React36.useState(false);
6631
- const titleId = React36.useId();
6702
+ const [image, setImage] = React37.useState(user?.image ?? "");
6703
+ const [saved, setSaved] = React37.useState(false);
6704
+ const titleId = React37.useId();
6632
6705
  const submit = (event) => {
6633
6706
  event.preventDefault();
6634
6707
  setSaved(false);
@@ -6738,14 +6811,14 @@ function ProfileSection({
6738
6811
  }
6739
6812
 
6740
6813
  // src/components/user-profile/RecoverySection.tsx
6741
- var React37 = __toESM(require("react"), 1);
6814
+ var React38 = __toESM(require("react"), 1);
6742
6815
  init_hooks();
6743
6816
  init_i18n();
6744
6817
  var import_jsx_runtime47 = require("react/jsx-runtime");
6745
6818
  function RecoverySection() {
6746
6819
  const t = useT();
6747
6820
  const { user } = useUser();
6748
- const titleId = React37.useId();
6821
+ const titleId = React38.useId();
6749
6822
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
6750
6823
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("header", { className: "ba-profile-section-header", children: [
6751
6824
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
@@ -6763,7 +6836,7 @@ function RecoverySection() {
6763
6836
  }
6764
6837
 
6765
6838
  // src/components/user-profile/SessionsSection.tsx
6766
- var React39 = __toESM(require("react"), 1);
6839
+ var React40 = __toESM(require("react"), 1);
6767
6840
  init_hooks();
6768
6841
  init_i18n();
6769
6842
  init_use_submit_action();
@@ -6813,19 +6886,19 @@ function formatSessionTime(date, locale) {
6813
6886
  }
6814
6887
 
6815
6888
  // src/components/user-profile/use-account-resource.ts
6816
- var React38 = __toESM(require("react"), 1);
6889
+ var React39 = __toESM(require("react"), 1);
6817
6890
  init_i18n();
6818
6891
  function useAccountResource(loader, failure) {
6819
- const loaderRef = React38.useRef(loader);
6892
+ const loaderRef = React39.useRef(loader);
6820
6893
  loaderRef.current = loader;
6821
- const failureRef = React38.useRef(failure);
6894
+ const failureRef = React39.useRef(failure);
6822
6895
  failureRef.current = failure;
6823
6896
  const toServerError = useServerError();
6824
- const [data, setData] = React38.useState(null);
6825
- const [error, setError] = React38.useState(null);
6826
- const [loading, setLoading] = React38.useState(true);
6827
- const requestRef = React38.useRef(0);
6828
- const load = React38.useCallback(async () => {
6897
+ const [data, setData] = React39.useState(null);
6898
+ const [error, setError] = React39.useState(null);
6899
+ const [loading, setLoading] = React39.useState(true);
6900
+ const requestRef = React39.useRef(0);
6901
+ const load = React39.useCallback(async () => {
6829
6902
  const request = ++requestRef.current;
6830
6903
  setLoading(true);
6831
6904
  try {
@@ -6844,7 +6917,7 @@ function useAccountResource(loader, failure) {
6844
6917
  if (request === requestRef.current) setLoading(false);
6845
6918
  }
6846
6919
  }, [toServerError]);
6847
- React38.useEffect(() => {
6920
+ React39.useEffect(() => {
6848
6921
  void load();
6849
6922
  return () => {
6850
6923
  requestRef.current += 1;
@@ -6862,7 +6935,7 @@ function SessionsSection() {
6862
6935
  const account = useAccount();
6863
6936
  const sessionState = useSession();
6864
6937
  const mutation = useSubmitAction();
6865
- const titleId = React39.useId();
6938
+ const titleId = React40.useId();
6866
6939
  const resource = useAccountResource(
6867
6940
  () => account.listSessions(),
6868
6941
  t("userProfile.sessions.loadError")
@@ -6933,7 +7006,7 @@ function SessionsSection() {
6933
7006
  }
6934
7007
 
6935
7008
  // src/components/user-profile/SocialSection.tsx
6936
- var React40 = __toESM(require("react"), 1);
7009
+ var React41 = __toESM(require("react"), 1);
6937
7010
  init_hooks();
6938
7011
  init_i18n();
6939
7012
  init_use_submit_action();
@@ -6947,7 +7020,7 @@ function SocialSection() {
6947
7020
  const account = useAccount();
6948
7021
  const { config } = usePublicConfig();
6949
7022
  const mutation = useSubmitAction();
6950
- const titleId = React40.useId();
7023
+ const titleId = React41.useId();
6951
7024
  const resource = useAccountResource(
6952
7025
  () => account.listSocialAccounts(),
6953
7026
  t("userProfile.social.loadError")
@@ -7019,7 +7092,7 @@ function SocialSection() {
7019
7092
  }
7020
7093
 
7021
7094
  // src/components/user-profile/UserProfileModal.tsx
7022
- var React41 = __toESM(require("react"), 1);
7095
+ var React42 = __toESM(require("react"), 1);
7023
7096
  init_i18n();
7024
7097
  init_ModalSurface();
7025
7098
  var import_jsx_runtime50 = require("react/jsx-runtime");
@@ -7029,7 +7102,7 @@ function UserProfileModal({
7029
7102
  branding
7030
7103
  }) {
7031
7104
  const t = useT();
7032
- const titleId = React41.useId();
7105
+ const titleId = React42.useId();
7033
7106
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
7034
7107
  ModalSurface,
7035
7108
  {
@@ -7102,16 +7175,16 @@ function UserProfile(props = {}) {
7102
7175
  const t = useT();
7103
7176
  const { user, isLoaded, isSignedIn } = useUser();
7104
7177
  const { config } = usePublicConfig();
7105
- const [internalSection, setInternalSection] = React42.useState(() => initialSection(defaultSection));
7178
+ const [internalSection, setInternalSection] = React43.useState(() => initialSection(defaultSection));
7106
7179
  const active = section ?? internalSection;
7107
- const capabilities = (0, import_core3.resolveProjectCapabilities)(config);
7180
+ const capabilities = (0, import_core4.resolveProjectCapabilities)(config);
7108
7181
  const passwordEnabled = config !== null && capabilities.passwordSignIn;
7109
7182
  const passkeysEnabled = capabilities.passkeySignIn || capabilities.passkeyAdd;
7110
7183
  const mfaEnabled = capabilities.totp;
7111
7184
  const recoveryEnabled = capabilities.backupCodes && user?.twoFactorEnabled === true;
7112
7185
  const deletionEnabled = capabilities.accountDeletion;
7113
7186
  const socialEnabled = (config?.socialProviders?.length ?? 0) > 0;
7114
- const sections = React42.useMemo(
7187
+ const sections = React43.useMemo(
7115
7188
  () => userProfileSectionsFor({
7116
7189
  password: passwordEnabled,
7117
7190
  passkeys: passkeysEnabled,
@@ -7122,7 +7195,7 @@ function UserProfile(props = {}) {
7122
7195
  }),
7123
7196
  [deletionEnabled, mfaEnabled, passkeysEnabled, passwordEnabled, recoveryEnabled, socialEnabled]
7124
7197
  );
7125
- React42.useEffect(() => {
7198
+ React43.useEffect(() => {
7126
7199
  if (section || mode !== "page") return;
7127
7200
  const onHashChange = () => {
7128
7201
  const next = userProfileSectionFromHash(window.location.hash);
@@ -7221,10 +7294,10 @@ function UserButton() {
7221
7294
  const t = useT();
7222
7295
  const { user, isLoaded } = useUser();
7223
7296
  const { signOut } = useSignOut();
7224
- const [open, setOpen] = React43.useState(false);
7225
- const [profileOpen, setProfileOpen] = React43.useState(false);
7226
- const [failedImage, setFailedImage] = React43.useState(null);
7227
- const triggerRef = React43.useRef(null);
7297
+ const [open, setOpen] = React44.useState(false);
7298
+ const [profileOpen, setProfileOpen] = React44.useState(false);
7299
+ const [failedImage, setFailedImage] = React44.useState(null);
7300
+ const triggerRef = React44.useRef(null);
7228
7301
  if (!isLoaded || !user) return null;
7229
7302
  const identity = user.email ?? user.phoneNumber ?? user.name ?? "?";
7230
7303
  const image = user.image ?? null;
@@ -7280,12 +7353,12 @@ function UserButton() {
7280
7353
  }
7281
7354
 
7282
7355
  // src/components/OrganizationSwitcher.tsx
7283
- var React56 = __toESM(require("react"), 1);
7356
+ var React57 = __toESM(require("react"), 1);
7284
7357
  init_hooks();
7285
7358
  init_i18n();
7286
7359
 
7287
7360
  // src/components/CreateOrganization.tsx
7288
- var React44 = __toESM(require("react"), 1);
7361
+ var React45 = __toESM(require("react"), 1);
7289
7362
  init_hooks();
7290
7363
  init_i18n();
7291
7364
  init_model();
@@ -7299,10 +7372,10 @@ function CreateOrganization({ onCreated, title } = {}) {
7299
7372
  const { isLoaded, isSignedIn } = useUser();
7300
7373
  const api = useAuthClient().organization;
7301
7374
  const { pending, error, run } = useSubmitAction();
7302
- const [name, setName] = React44.useState("");
7303
- const [slug, setSlug] = React44.useState("");
7304
- const [logo, setLogo] = React44.useState("");
7305
- const [slugTouched, setSlugTouched] = React44.useState(false);
7375
+ const [name, setName] = React45.useState("");
7376
+ const [slug, setSlug] = React45.useState("");
7377
+ const [logo, setLogo] = React45.useState("");
7378
+ const [slugTouched, setSlugTouched] = React45.useState(false);
7306
7379
  if (configLoading || !isLoaded) {
7307
7380
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
7308
7381
  }
@@ -7402,7 +7475,7 @@ function CreateOrganization({ onCreated, title } = {}) {
7402
7475
  }
7403
7476
 
7404
7477
  // src/components/organization/OrganizationModal.tsx
7405
- var React45 = __toESM(require("react"), 1);
7478
+ var React46 = __toESM(require("react"), 1);
7406
7479
  init_i18n();
7407
7480
  init_ModalSurface();
7408
7481
  var import_jsx_runtime54 = require("react/jsx-runtime");
@@ -7413,7 +7486,7 @@ function OrganizationModal({
7413
7486
  children
7414
7487
  }) {
7415
7488
  const t = useT();
7416
- const titleId = React45.useId();
7489
+ const titleId = React46.useId();
7417
7490
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
7418
7491
  ModalSurface,
7419
7492
  {
@@ -7444,21 +7517,21 @@ function OrganizationModal({
7444
7517
  }
7445
7518
 
7446
7519
  // src/components/organization/use-organizations-resource.ts
7447
- var React46 = __toESM(require("react"), 1);
7520
+ var React47 = __toESM(require("react"), 1);
7448
7521
  init_hooks();
7449
7522
  init_i18n();
7450
7523
  function useOrganizationsResource(enabled = true) {
7451
7524
  const api = useAuthClient().organization;
7452
- const apiRef = React46.useRef(api);
7525
+ const apiRef = React47.useRef(api);
7453
7526
  apiRef.current = api;
7454
7527
  const { user, isLoaded, isSignedIn } = useUser();
7455
7528
  const t = useT();
7456
7529
  const toServerError = useServerError();
7457
- const [organizations, setOrganizations] = React46.useState(null);
7458
- const [error, setError] = React46.useState(null);
7459
- const requestRef = React46.useRef(0);
7530
+ const [organizations, setOrganizations] = React47.useState(null);
7531
+ const [error, setError] = React47.useState(null);
7532
+ const requestRef = React47.useRef(0);
7460
7533
  const identity = user?.id ?? null;
7461
- const refresh = React46.useCallback(async () => {
7534
+ const refresh = React47.useCallback(async () => {
7462
7535
  const token = ++requestRef.current;
7463
7536
  if (!enabled || !identity || !isSignedIn) {
7464
7537
  setOrganizations([]);
@@ -7478,7 +7551,7 @@ function useOrganizationsResource(enabled = true) {
7478
7551
  if (token === requestRef.current) setError(t("organization.error.load"));
7479
7552
  }
7480
7553
  }, [enabled, identity, isSignedIn, t, toServerError]);
7481
- React46.useEffect(() => {
7554
+ React47.useEffect(() => {
7482
7555
  setOrganizations(null);
7483
7556
  setError(null);
7484
7557
  if (!isLoaded) return;
@@ -7487,7 +7560,7 @@ function useOrganizationsResource(enabled = true) {
7487
7560
  requestRef.current += 1;
7488
7561
  };
7489
7562
  }, [identity, isLoaded, refresh]);
7490
- React46.useEffect(
7563
+ React47.useEffect(
7491
7564
  () => api.subscribe(() => void refresh()),
7492
7565
  [api, refresh]
7493
7566
  );
@@ -7500,12 +7573,12 @@ function useOrganizationsResource(enabled = true) {
7500
7573
  }
7501
7574
 
7502
7575
  // src/components/OrganizationProfile.tsx
7503
- var React55 = __toESM(require("react"), 1);
7576
+ var React56 = __toESM(require("react"), 1);
7504
7577
  init_hooks();
7505
7578
  init_i18n();
7506
7579
 
7507
7580
  // src/components/organization/DangerSection.tsx
7508
- var React47 = __toESM(require("react"), 1);
7581
+ var React48 = __toESM(require("react"), 1);
7509
7582
  init_hooks();
7510
7583
  init_i18n();
7511
7584
  init_use_submit_action();
@@ -7523,7 +7596,7 @@ function DangerSection({
7523
7596
  const api = useAuthClient().organization;
7524
7597
  const session = useSession();
7525
7598
  const { pending, error, run } = useSubmitAction();
7526
- const [confirmation, setConfirmation] = React47.useState("");
7599
+ const [confirmation, setConfirmation] = React48.useState("");
7527
7600
  const isOwner = hasOrganizationRole(membership, "owner");
7528
7601
  const confirmed = confirmation.trim().toLowerCase() === organization.slug.toLowerCase();
7529
7602
  const leave = () => {
@@ -7588,7 +7661,7 @@ function DangerSection({
7588
7661
  }
7589
7662
 
7590
7663
  // src/components/organization/GeneralSection.tsx
7591
- var React48 = __toESM(require("react"), 1);
7664
+ var React49 = __toESM(require("react"), 1);
7592
7665
  init_hooks();
7593
7666
  init_i18n();
7594
7667
  init_use_submit_action();
@@ -7604,10 +7677,10 @@ function GeneralSection({
7604
7677
  const t = useT();
7605
7678
  const api = useAuthClient().organization;
7606
7679
  const { pending, error, run } = useSubmitAction();
7607
- const [name, setName] = React48.useState(organization.name);
7608
- const [slug, setSlug] = React48.useState(organization.slug);
7609
- const [logo, setLogo] = React48.useState(organization.logo ?? "");
7610
- React48.useEffect(() => {
7680
+ const [name, setName] = React49.useState(organization.name);
7681
+ const [slug, setSlug] = React49.useState(organization.slug);
7682
+ const [logo, setLogo] = React49.useState(organization.logo ?? "");
7683
+ React49.useEffect(() => {
7611
7684
  setName(organization.name);
7612
7685
  setSlug(organization.slug);
7613
7686
  setLogo(organization.logo ?? "");
@@ -7684,7 +7757,7 @@ function GeneralSection({
7684
7757
  }
7685
7758
 
7686
7759
  // src/components/organization/InvitationsSection.tsx
7687
- var React50 = __toESM(require("react"), 1);
7760
+ var React51 = __toESM(require("react"), 1);
7688
7761
  init_hooks();
7689
7762
  init_i18n();
7690
7763
  init_use_submit_action();
@@ -7715,8 +7788,8 @@ function InvitationsSection({
7715
7788
  const api = useAuthClient().organization;
7716
7789
  const { pending, error, run } = useSubmitAction();
7717
7790
  const { roles } = useOrganizationRoles(organization.id);
7718
- const [email, setEmail] = React50.useState("");
7719
- const [role, setRole] = React50.useState("member");
7791
+ const [email, setEmail] = React51.useState("");
7792
+ const [role, setRole] = React51.useState("member");
7720
7793
  const invitations = organization.invitations.filter((invitation) => invitation.status === "pending");
7721
7794
  const invite = (event) => {
7722
7795
  event.preventDefault();
@@ -7857,7 +7930,7 @@ var SECTION_KEYS2 = {
7857
7930
  invitations: "organization.profile.nav.invitations",
7858
7931
  danger: "organization.profile.nav.danger"
7859
7932
  };
7860
- var TeamsSection2 = React55.lazy(() => Promise.resolve().then(() => (init_TeamsSection(), TeamsSection_exports)));
7933
+ var TeamsSection2 = React56.lazy(() => Promise.resolve().then(() => (init_TeamsSection(), TeamsSection_exports)));
7861
7934
  function OrganizationProfile({ organizationId, defaultSection = "general", onDeleted, onLeft } = {}) {
7862
7935
  const t = useT();
7863
7936
  const toServerError = useServerError();
@@ -7865,17 +7938,17 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
7865
7938
  const { user, isLoaded, isSignedIn } = useUser();
7866
7939
  const session = useSession();
7867
7940
  const api = useAuthClient().organization;
7868
- const apiRef = React55.useRef(api);
7941
+ const apiRef = React56.useRef(api);
7869
7942
  apiRef.current = api;
7870
7943
  const activeOrganizationId = session.data?.session.activeOrganizationId ?? null;
7871
7944
  const requestedId = organizationId ?? activeOrganizationId;
7872
7945
  const enabled = config?.organizations === true && isSignedIn;
7873
- const [organization, setOrganization] = React55.useState(null);
7874
- const [error, setError] = React55.useState(null);
7875
- const [wasRemoved, setWasRemoved] = React55.useState(false);
7876
- const [section, setSection] = React55.useState(defaultSection);
7877
- const requestRef = React55.useRef(0);
7878
- const load = React55.useCallback(async () => {
7946
+ const [organization, setOrganization] = React56.useState(null);
7947
+ const [error, setError] = React56.useState(null);
7948
+ const [wasRemoved, setWasRemoved] = React56.useState(false);
7949
+ const [section, setSection] = React56.useState(defaultSection);
7950
+ const requestRef = React56.useRef(0);
7951
+ const load = React56.useCallback(async () => {
7879
7952
  const token = ++requestRef.current;
7880
7953
  if (!enabled || !requestedId) {
7881
7954
  setOrganization(null);
@@ -7895,7 +7968,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
7895
7968
  if (token === requestRef.current) setError(t("organization.profile.loadError"));
7896
7969
  }
7897
7970
  }, [enabled, requestedId, t, toServerError]);
7898
- React55.useEffect(() => {
7971
+ React56.useEffect(() => {
7899
7972
  setOrganization(null);
7900
7973
  setError(null);
7901
7974
  setWasRemoved(false);
@@ -7949,7 +8022,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
7949
8022
  /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "ba-organization-profile-content", children: [
7950
8023
  activeSection === "general" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(GeneralSection, { organization, canManage, onChanged: load }),
7951
8024
  activeSection === "members" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
7952
- activeSection === "teams" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(React55.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TeamsSection2, { organization, membership }) }),
8025
+ activeSection === "teams" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(React56.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TeamsSection2, { organization, membership }) }),
7953
8026
  activeSection === "invitations" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(InvitationsSection, { organization, onChanged: load }),
7954
8027
  activeSection === "danger" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
7955
8028
  DangerSection,
@@ -7978,15 +8051,15 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
7978
8051
  const enabled = config?.organizations === true && isSignedIn;
7979
8052
  const { organizations, isLoading, error: loadError, refresh } = useOrganizationsResource(enabled);
7980
8053
  const { pending, error, run } = useSubmitAction();
7981
- const [open, setOpen] = React56.useState(false);
7982
- const [dialog, setDialog] = React56.useState(null);
7983
- const rootRef = React56.useRef(null);
7984
- const triggerRef = React56.useRef(null);
7985
- const menuRef = React56.useRef(null);
7986
- const menuId = React56.useId();
8054
+ const [open, setOpen] = React57.useState(false);
8055
+ const [dialog, setDialog] = React57.useState(null);
8056
+ const rootRef = React57.useRef(null);
8057
+ const triggerRef = React57.useRef(null);
8058
+ const menuRef = React57.useRef(null);
8059
+ const menuId = React57.useId();
7987
8060
  const activeId = session.data?.session.activeOrganizationId ?? null;
7988
8061
  const active = organizations?.find((organization) => organization.id === activeId) ?? null;
7989
- React56.useEffect(() => {
8062
+ React57.useEffect(() => {
7990
8063
  if (!open) return;
7991
8064
  const onPointerDown = (event) => {
7992
8065
  if (!rootRef.current?.contains(event.target)) setOpen(false);
@@ -8123,7 +8196,7 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
8123
8196
  init_InvitationPrompt();
8124
8197
 
8125
8198
  // src/components/OrganizationList.tsx
8126
- var React57 = __toESM(require("react"), 1);
8199
+ var React58 = __toESM(require("react"), 1);
8127
8200
  init_hooks();
8128
8201
  init_i18n();
8129
8202
  init_use_submit_action();
@@ -8136,19 +8209,19 @@ function OrganizationList({ onOrganizationChange } = {}) {
8136
8209
  const { user, isLoaded, isSignedIn } = useUser();
8137
8210
  const session = useSession();
8138
8211
  const api = useAuthClient().organization;
8139
- const apiRef = React57.useRef(api);
8212
+ const apiRef = React58.useRef(api);
8140
8213
  apiRef.current = api;
8141
8214
  const enabled = config?.organizations === true && isSignedIn;
8142
8215
  const { organizations, isLoading, error: organizationError, refresh } = useOrganizationsResource(enabled);
8143
8216
  const { pending, error, run } = useSubmitAction();
8144
- const [invitations, setInvitations] = React57.useState(null);
8145
- const [invitationError, setInvitationError] = React57.useState(null);
8146
- const [dialog, setDialog] = React57.useState(null);
8147
- const [profileId, setProfileId] = React57.useState(null);
8148
- const dialogReturnFocusRef = React57.useRef(null);
8149
- const invitationRequestRef = React57.useRef(0);
8217
+ const [invitations, setInvitations] = React58.useState(null);
8218
+ const [invitationError, setInvitationError] = React58.useState(null);
8219
+ const [dialog, setDialog] = React58.useState(null);
8220
+ const [profileId, setProfileId] = React58.useState(null);
8221
+ const dialogReturnFocusRef = React58.useRef(null);
8222
+ const invitationRequestRef = React58.useRef(0);
8150
8223
  const activeId = session.data?.session.activeOrganizationId ?? null;
8151
- const loadInvitations = React57.useCallback(async () => {
8224
+ const loadInvitations = React58.useCallback(async () => {
8152
8225
  const token = ++invitationRequestRef.current;
8153
8226
  if (!enabled) {
8154
8227
  setInvitations([]);
@@ -8168,7 +8241,7 @@ function OrganizationList({ onOrganizationChange } = {}) {
8168
8241
  if (token === invitationRequestRef.current) setInvitationError(t("organization.list.invitationsError"));
8169
8242
  }
8170
8243
  }, [enabled, t, toServerError]);
8171
- React57.useEffect(() => {
8244
+ React58.useEffect(() => {
8172
8245
  setInvitations(null);
8173
8246
  setInvitationError(null);
8174
8247
  if (!isLoaded) return;
@@ -8284,7 +8357,7 @@ function OrganizationList({ onOrganizationChange } = {}) {
8284
8357
  }
8285
8358
 
8286
8359
  // src/components/GoogleOneTap.tsx
8287
- var React58 = __toESM(require("react"), 1);
8360
+ var React59 = __toESM(require("react"), 1);
8288
8361
  init_hooks();
8289
8362
 
8290
8363
  // src/components/google-one-tap.ts
@@ -8434,6 +8507,14 @@ function normalizeDismissReason(reason) {
8434
8507
  }
8435
8508
  return "unknown";
8436
8509
  }
8510
+ var warnedMissingNonce = /* @__PURE__ */ new Set();
8511
+ function warnOneTapWithoutNonce(clientId) {
8512
+ if (warnedMissingNonce.has(clientId)) return;
8513
+ warnedMissingNonce.add(clientId);
8514
+ console.warn(
8515
+ "[AuthOwl] <GoogleOneTap/> is running without a `nonce`. Google\u2019s ID token is then not bound to a value chosen for this prompt. Generate a fresh random value per prompt and pass it as `nonce`; AuthOwl forwards it to Google and verifies the match. The direct browser exchange does not keep separate one-time server state, so do not treat this prop by itself as replay protection. (This warning is dev-only.)"
8516
+ );
8517
+ }
8437
8518
  function GoogleOneTap({
8438
8519
  disabled = false,
8439
8520
  nonce,
@@ -8453,11 +8534,16 @@ function GoogleOneTap({
8453
8534
  const { config, isLoading: configLoading, isError: configError } = usePublicConfig();
8454
8535
  const { user, isLoaded: sessionLoaded } = useUser();
8455
8536
  const { signInSocial } = useSignIn();
8456
- const callbacks = React58.useRef({ onSignedIn, onSkipped, onDismissed, onError });
8537
+ const callbacks = React59.useRef({ onSignedIn, onSkipped, onDismissed, onError });
8457
8538
  callbacks.current = { onSignedIn, onSkipped, onDismissed, onError };
8458
8539
  const googleEnabled = config?.socialProviders.includes("google") === true;
8459
8540
  const clientId = config?.socialProviderClientIds?.google;
8460
- React58.useEffect(() => {
8541
+ React59.useEffect(() => {
8542
+ if (process.env.NODE_ENV === "production") return;
8543
+ if (disabled || !googleEnabled || !clientId || nonce) return;
8544
+ warnOneTapWithoutNonce(clientId);
8545
+ }, [clientId, disabled, googleEnabled, nonce]);
8546
+ React59.useEffect(() => {
8461
8547
  if (configLoading || !sessionLoaded) return;
8462
8548
  if (disabled) {
8463
8549
  callbacks.current.onSkipped?.("disabled");
@@ -8573,8 +8659,9 @@ function GoogleOneTap({
8573
8659
  }
8574
8660
 
8575
8661
  // src/index.ts
8576
- var import_core7 = require("@authowl/core");
8577
8662
  var import_core8 = require("@authowl/core");
8663
+ var import_core9 = require("@authowl/core");
8664
+ init_last_used_method();
8578
8665
  // Annotate the CommonJS export names for ESM import in node:
8579
8666
  0 && (module.exports = {
8580
8667
  AuthLoaded,
@@ -8633,6 +8720,7 @@ var import_core8 = require("@authowl/core");
8633
8720
  useConsent,
8634
8721
  useEmailVerification,
8635
8722
  useInvitationRecipientHint,
8723
+ useLastUsedSignInMethod,
8636
8724
  useLocale,
8637
8725
  useMFA,
8638
8726
  useOrganization,