@authowl/react 0.18.4 → 0.18.5

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
@@ -3211,7 +3211,7 @@ function MFAEnrollment({ onEnrolled, title }) {
3211
3211
 
3212
3212
  // src/components/mfa-enrollment-step.tsx
3213
3213
  var import_jsx_runtime15 = require("react/jsx-runtime");
3214
- function useConfirmedMfaPending() {
3214
+ function useConfirmedMfaPending(onUnknown = "pending") {
3215
3215
  const client = useAuthClient();
3216
3216
  const { needsMfaEnrollment } = useUser();
3217
3217
  const { refetch } = useSession();
@@ -3224,16 +3224,16 @@ function useConfirmedMfaPending() {
3224
3224
  let active = true;
3225
3225
  client.getSession({ query: { disableCookieCache: true } }).then((res) => {
3226
3226
  if (!active) return;
3227
- const pending = res.error ? true : res.data?.session?.pendingMfaEnrollment === true;
3227
+ const pending = res.error ? onUnknown === "pending" : res.data?.session?.pendingMfaEnrollment === true;
3228
3228
  setConfirmed(pending);
3229
3229
  if (!pending && !res.error) refetch({ query: { disableCookieCache: true } });
3230
3230
  }).catch(() => {
3231
- if (active) setConfirmed(true);
3231
+ if (active) setConfirmed(onUnknown === "pending");
3232
3232
  });
3233
3233
  return () => {
3234
3234
  active = false;
3235
3235
  };
3236
- }, [client, needsMfaEnrollment, refetch]);
3236
+ }, [client, needsMfaEnrollment, refetch, onUnknown]);
3237
3237
  if (!needsMfaEnrollment) return "clear";
3238
3238
  return confirmed === true ? "pending" : "confirming";
3239
3239
  }
@@ -3645,7 +3645,7 @@ function SignIn({
3645
3645
  );
3646
3646
  const [inFlight, setInFlight] = React16.useState(null);
3647
3647
  const [challenge, setChallenge] = React16.useState(false);
3648
- const mfaEnrolment = useConfirmedMfaPending();
3648
+ const mfaEnrolment = useConfirmedMfaPending("clear");
3649
3649
  const emailRef = React16.useRef(null);
3650
3650
  const plan = resolveSignInMethods(
3651
3651
  config,
package/dist/index.js CHANGED
@@ -3130,7 +3130,7 @@ function MFAEnrollment({ onEnrolled, title }) {
3130
3130
 
3131
3131
  // src/components/mfa-enrollment-step.tsx
3132
3132
  import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
3133
- function useConfirmedMfaPending() {
3133
+ function useConfirmedMfaPending(onUnknown = "pending") {
3134
3134
  const client = useAuthClient();
3135
3135
  const { needsMfaEnrollment } = useUser();
3136
3136
  const { refetch } = useSession();
@@ -3143,16 +3143,16 @@ function useConfirmedMfaPending() {
3143
3143
  let active = true;
3144
3144
  client.getSession({ query: { disableCookieCache: true } }).then((res) => {
3145
3145
  if (!active) return;
3146
- const pending = res.error ? true : res.data?.session?.pendingMfaEnrollment === true;
3146
+ const pending = res.error ? onUnknown === "pending" : res.data?.session?.pendingMfaEnrollment === true;
3147
3147
  setConfirmed(pending);
3148
3148
  if (!pending && !res.error) refetch({ query: { disableCookieCache: true } });
3149
3149
  }).catch(() => {
3150
- if (active) setConfirmed(true);
3150
+ if (active) setConfirmed(onUnknown === "pending");
3151
3151
  });
3152
3152
  return () => {
3153
3153
  active = false;
3154
3154
  };
3155
- }, [client, needsMfaEnrollment, refetch]);
3155
+ }, [client, needsMfaEnrollment, refetch, onUnknown]);
3156
3156
  if (!needsMfaEnrollment) return "clear";
3157
3157
  return confirmed === true ? "pending" : "confirming";
3158
3158
  }
@@ -3567,7 +3567,7 @@ function SignIn({
3567
3567
  );
3568
3568
  const [inFlight, setInFlight] = React16.useState(null);
3569
3569
  const [challenge, setChallenge] = React16.useState(false);
3570
- const mfaEnrolment = useConfirmedMfaPending();
3570
+ const mfaEnrolment = useConfirmedMfaPending("clear");
3571
3571
  const emailRef = React16.useRef(null);
3572
3572
  const plan = resolveSignInMethods(
3573
3573
  config,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authowl/react",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "description": "React provider, hooks, and drop-in components for AuthOwl, the multi-tenant auth SaaS.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {