@authowl/react 0.18.9 → 0.18.10

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/README.md CHANGED
@@ -71,7 +71,7 @@ When the server selects an Akedly Shield V1.2 route, these components fetch a fr
71
71
  challenge and complete its proof-of-work and optional Turnstile ceremony automatically.
72
72
  Provider API keys and pipeline credentials remain server-side. Custom phone UIs can call
73
73
  `phoneOtp.prepare()` and `solvePhoneOtpChallenge()` to implement the same guarded flow.
74
- See the [complete headless and retry guide](https://github.com/mstfash/authowl-sdk/blob/main/docs/phone-otp.md).
74
+ See the [complete headless and retry guide](https://github.com/authowl/authowl-sdk/blob/main/docs/phone-otp.md).
75
75
 
76
76
  `@akedly/shield` is installed with `@authowl/core` so every consumer bundler can
77
77
  resolve the integration safely. It remains behind a dynamic import, so its
package/dist/index.cjs CHANGED
@@ -648,7 +648,7 @@ function resolveSignInMethods(config, pageHost) {
648
648
  const username = capabilities.usernameSignIn;
649
649
  const magicLink = capabilities.magicLinkSignIn;
650
650
  const emailOtp = capabilities.emailOtpSignIn && !capabilities.totp && !capabilities.mfaRequired;
651
- const phoneOtp = capabilities.phoneSignIn;
651
+ const phoneOtp = capabilities.phoneSignIn && !capabilities.mfaRequired;
652
652
  const passkey = capabilities.passkeySignIn && passkeyReachableFrom(
653
653
  config?.authBaseUrl,
654
654
  pageHost,
@@ -3328,7 +3328,12 @@ function LegalConsentCheckbox({
3328
3328
 
3329
3329
  // src/components/PhoneOTP.tsx
3330
3330
  var import_jsx_runtime19 = require("react/jsx-runtime");
3331
- function PhoneOTP({ redirectTo, onSignedIn, onBack }) {
3331
+ function PhoneOTP({
3332
+ redirectTo,
3333
+ onSignedIn,
3334
+ onBack,
3335
+ onMfaPasswordRequired
3336
+ }) {
3332
3337
  const t = useT();
3333
3338
  const { sessionStore } = useAuthClient();
3334
3339
  const { config, isLoading } = usePublicConfig();
@@ -3395,6 +3400,12 @@ function PhoneOTP({ redirectTo, onSignedIn, onBack }) {
3395
3400
  }),
3396
3401
  {
3397
3402
  failure: t("phoneOtp.error.invalidCode"),
3403
+ mapError: (authError) => {
3404
+ if (authError.code === "TWO_FACTOR_REQUIRED") {
3405
+ onMfaPasswordRequired?.();
3406
+ }
3407
+ return null;
3408
+ },
3398
3409
  onSuccess: () => finishSignIn({ sessionStore, redirectTo, onSignedIn })
3399
3410
  }
3400
3411
  );
@@ -3732,7 +3743,12 @@ function SignIn({
3732
3743
  {
3733
3744
  redirectTo,
3734
3745
  onSignedIn,
3735
- onBack: () => setView("sign-in")
3746
+ onBack: () => setView("sign-in"),
3747
+ onMfaPasswordRequired: () => {
3748
+ setView("sign-in");
3749
+ setError(t("serverError.TWO_FACTOR_REQUIRED"));
3750
+ requestAnimationFrame(() => emailRef.current?.focus());
3751
+ }
3736
3752
  }
3737
3753
  ),
3738
3754
  badge
package/dist/index.d.cts CHANGED
@@ -353,9 +353,11 @@ type PhoneOTPProps = {
353
353
  onSignedIn?: () => void;
354
354
  /** Optional navigation affordance when embedded in another sign-in surface. */
355
355
  onBack?: () => void;
356
+ /** Called when this phone belongs to an account that must use password + MFA. */
357
+ onMfaPasswordRequired?: () => void;
356
358
  };
357
359
  /** Egyptian phone sign-in with managed Turnstile, retry-safe send, and code verification. */
358
- declare function PhoneOTP({ redirectTo, onSignedIn, onBack }: PhoneOTPProps): React.JSX.Element;
360
+ declare function PhoneOTP({ redirectTo, onSignedIn, onBack, onMfaPasswordRequired, }: PhoneOTPProps): React.JSX.Element;
359
361
 
360
362
  type SignUpProps = {
361
363
  redirectTo?: string;
package/dist/index.d.ts CHANGED
@@ -353,9 +353,11 @@ type PhoneOTPProps = {
353
353
  onSignedIn?: () => void;
354
354
  /** Optional navigation affordance when embedded in another sign-in surface. */
355
355
  onBack?: () => void;
356
+ /** Called when this phone belongs to an account that must use password + MFA. */
357
+ onMfaPasswordRequired?: () => void;
356
358
  };
357
359
  /** Egyptian phone sign-in with managed Turnstile, retry-safe send, and code verification. */
358
- declare function PhoneOTP({ redirectTo, onSignedIn, onBack }: PhoneOTPProps): React.JSX.Element;
360
+ declare function PhoneOTP({ redirectTo, onSignedIn, onBack, onMfaPasswordRequired, }: PhoneOTPProps): React.JSX.Element;
359
361
 
360
362
  type SignUpProps = {
361
363
  redirectTo?: string;
package/dist/index.js CHANGED
@@ -567,7 +567,7 @@ function resolveSignInMethods(config, pageHost) {
567
567
  const username = capabilities.usernameSignIn;
568
568
  const magicLink = capabilities.magicLinkSignIn;
569
569
  const emailOtp = capabilities.emailOtpSignIn && !capabilities.totp && !capabilities.mfaRequired;
570
- const phoneOtp = capabilities.phoneSignIn;
570
+ const phoneOtp = capabilities.phoneSignIn && !capabilities.mfaRequired;
571
571
  const passkey = capabilities.passkeySignIn && passkeyReachableFrom(
572
572
  config?.authBaseUrl,
573
573
  pageHost,
@@ -3250,7 +3250,12 @@ function LegalConsentCheckbox({
3250
3250
 
3251
3251
  // src/components/PhoneOTP.tsx
3252
3252
  import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
3253
- function PhoneOTP({ redirectTo, onSignedIn, onBack }) {
3253
+ function PhoneOTP({
3254
+ redirectTo,
3255
+ onSignedIn,
3256
+ onBack,
3257
+ onMfaPasswordRequired
3258
+ }) {
3254
3259
  const t = useT();
3255
3260
  const { sessionStore } = useAuthClient();
3256
3261
  const { config, isLoading } = usePublicConfig();
@@ -3317,6 +3322,12 @@ function PhoneOTP({ redirectTo, onSignedIn, onBack }) {
3317
3322
  }),
3318
3323
  {
3319
3324
  failure: t("phoneOtp.error.invalidCode"),
3325
+ mapError: (authError) => {
3326
+ if (authError.code === "TWO_FACTOR_REQUIRED") {
3327
+ onMfaPasswordRequired?.();
3328
+ }
3329
+ return null;
3330
+ },
3320
3331
  onSuccess: () => finishSignIn({ sessionStore, redirectTo, onSignedIn })
3321
3332
  }
3322
3333
  );
@@ -3654,7 +3665,12 @@ function SignIn({
3654
3665
  {
3655
3666
  redirectTo,
3656
3667
  onSignedIn,
3657
- onBack: () => setView("sign-in")
3668
+ onBack: () => setView("sign-in"),
3669
+ onMfaPasswordRequired: () => {
3670
+ setView("sign-in");
3671
+ setError(t("serverError.TWO_FACTOR_REQUIRED"));
3672
+ requestAnimationFrame(() => emailRef.current?.focus());
3673
+ }
3658
3674
  }
3659
3675
  ),
3660
3676
  badge
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authowl/react",
3
- "version": "0.18.9",
3
+ "version": "0.18.10",
4
4
  "description": "React provider, hooks, and drop-in components for AuthOwl, the multi-tenant auth SaaS.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/mstfash/authowl-sdk.git",
11
+ "url": "git+https://github.com/authowl/authowl-sdk.git",
12
12
  "directory": "packages/auth-react"
13
13
  },
14
- "homepage": "https://github.com/mstfash/authowl-sdk#readme",
14
+ "homepage": "https://authowl.dev",
15
15
  "keywords": [
16
16
  "authentication",
17
17
  "auth",
@@ -47,7 +47,7 @@
47
47
  "LICENSE"
48
48
  ],
49
49
  "dependencies": {
50
- "@authowl/core": "0.15.5"
50
+ "@authowl/core": "0.15.6"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "react": ">=18",