@movmo_app/react-common 0.14.0 → 0.15.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.d.ts CHANGED
@@ -28,7 +28,11 @@ export declare class AuthError extends Error {
28
28
  code: AuthErrorCode | 'network' | 'unknown';
29
29
  retryAfter?: number | undefined;
30
30
  attemptsRemaining?: number | undefined;
31
- constructor(status: number, code: AuthErrorCode | 'network' | 'unknown', retryAfter?: number | undefined, attemptsRemaining?: number | undefined);
31
+ /** RFC3339 end of the account-recovery cool-down (`recovery_cooldown` bodies). */
32
+ until?: string | undefined;
33
+ constructor(status: number, code: AuthErrorCode | 'network' | 'unknown', retryAfter?: number | undefined, attemptsRemaining?: number | undefined,
34
+ /** RFC3339 end of the account-recovery cool-down (`recovery_cooldown` bodies). */
35
+ until?: string | undefined);
32
36
  }
33
37
 
34
38
  /** Autofill options live 5 min on the server; refresh at 4½. */
@@ -343,6 +347,16 @@ export declare interface ModalProps {
343
347
  export declare interface MovmoAuthApi {
344
348
  login(email: string): Promise<MovmoLoginResponse>;
345
349
  sendCode(flowId: string): Promise<MovmoCodeFlow>;
350
+ /**
351
+ * `POST /v1/auth/recovery {flow_id, time_zone?}`: starts account recovery for
352
+ * an enrolled email's unsent flow; the answer is a code flow (MOVMO-687).
353
+ */
354
+ startRecovery(flowId: string): Promise<MovmoCodeFlow>;
355
+ /**
356
+ * `POST /v1/auth/recovery/cancel {token}`. A token that isn't `rc1.` +
357
+ * base64url rejects with `invalid_request` before any request.
358
+ */
359
+ cancelRecovery(token: string): Promise<void>;
346
360
  passkeyOptions(): Promise<PasskeyOptionsResponse>;
347
361
  verifyCode(flowId: string, code: string): Promise<MovmoVerifyResponse>;
348
362
  verifyPasskey(flowId: string, credential: CredentialJSON): Promise<MovmoVerifyResponse>;
@@ -373,11 +387,20 @@ export declare interface MovmoSignIn {
373
387
  canUsePasskeyButton: boolean;
374
388
  /** Passkey step: the last ceremony failed; offer Try again (`retryPasskey`). */
375
389
  passkeyFailed: boolean;
390
+ /** False on re-auth (`lockedEmail`/`expectedUserId`): the passkey step offers no recovery entry. */
391
+ recoveryAvailable: boolean;
392
+ /** Recovery step: the server refused recovery (`recovery_blocked`); terminal, only Close remains. */
393
+ recoveryBlocked: boolean;
376
394
  liveMessage: string;
377
395
  submitEmail(): void;
378
396
  signInWithPasskey(): void;
379
397
  retryPasskey(): void;
380
- useCodeInstead(): void;
398
+ /** Passkey step: "I can't use my passkey" → the recovery step (aborts the ceremony). No-op on re-auth. */
399
+ cantUsePasskey(): void;
400
+ /** Recovery step: `POST /v1/auth/recovery`, then the code step. */
401
+ sendRecoveryCode(): void;
402
+ /** Recovery step: back to the passkey step (email step when passkeys can't be used here). */
403
+ back(): void;
381
404
  /** Passkey/code step: back to email with the email kept. */
382
405
  changeEmail(): void;
383
406
  submitCode(code: string): void;
@@ -571,6 +594,13 @@ export declare interface PasskeyListProps {
571
594
  * sign-in.
572
595
  */
573
596
  onAccountMismatch: () => void;
597
+ /**
598
+ * RFC3339 end of the account-recovery cool-down (the host's
599
+ * `security-preferences.recovery_until`). While it is in the future the card
600
+ * shows the in-progress status line and disables Add and Remove up front,
601
+ * without waiting for a `403 recovery_cooldown`.
602
+ */
603
+ recoveryUntil?: string | null;
574
604
  }
575
605
 
576
606
  export declare const PhoneInput: default_2.FC<PhoneInputProps>;
@@ -645,8 +675,8 @@ export declare function readPromptState(cookie?: string, now?: number): PromptSt
645
675
  *
646
676
  * The sign-in flow runs email-first only, with the account's email locked,
647
677
  * and continues at once (`autoContinue`): the login's `allowCredentials` limit
648
- * a passkey choice to this account, and **Use a code instead** stays
649
- * available. No autofill, no discoverable "Sign in with passkey", no
678
+ * a passkey choice to this account. The passkey step offers no recovery
679
+ * entry ("I can't use my passkey"): recovery starts from the sign-in page. No autofill, no discoverable "Sign in with passkey", no
650
680
  * enrollment prompt. The flow is single-use and is mounted only while open,
651
681
  * so every open starts fresh. In a framed window it only says "Manage
652
682
  * passkeys on the Movmo Security page." and makes no sign-in or WebAuthn call.
@@ -758,8 +788,10 @@ export declare const signInCopy: {
758
788
  readonly passkeyExists: "This passkey is already on your account.";
759
789
  readonly enrollExpired: "That took too long. Try again.";
760
790
  readonly invalidEmail: "Enter a valid email address.";
761
- readonly passkeyUnavailable: "This browser couldn't use a passkey. Use a code instead.";
791
+ readonly passkeyUnavailable: "This browser couldn't use a passkey. Choose 'I can't use my passkey' to sign in with a code.";
762
792
  readonly discoverableNotRecognized: "That passkey isn't recognized. Continue with your email instead.";
793
+ readonly recoveryStarted: "Sign in without your passkey";
794
+ readonly recoveryBlocked: "We can't recover this account right now";
763
795
  };
764
796
 
765
797
  export declare type SignInErrorCode = AuthErrorCode | 'network' | 'unknown' | WebAuthnFailure | 'account_mismatch';
@@ -786,7 +818,14 @@ export declare interface SignInFlowProps extends UseMovmoSignInOptions {
786
818
  onCancel?: () => void;
787
819
  }
788
820
 
789
- export declare type SignInMethod = 'otp' | 'passkey';
821
+ /** What `onVerified`/`onSignedIn` receive. `recoveryUntil` (RFC3339) is set only for `method: 'recovery'`. */
822
+ export declare interface SignInInfo {
823
+ method: SignInMethod;
824
+ newUser: boolean;
825
+ recoveryUntil?: string;
826
+ }
827
+
828
+ export declare type SignInMethod = 'otp' | 'passkey' | 'recovery';
790
829
 
791
830
  /**
792
831
  * "Sign in to Movmo": `SignInFlow` inside the focus-trapping `Modal`. Code or
@@ -816,14 +855,11 @@ export declare interface SignInModalProps extends Omit<UseMovmoSignInOptions, 'o
816
855
  * the prompt; `onAccountMismatch` (re-auth with `expectedUserId`) fires
817
856
  * after the package has ended the other account's session.
818
857
  */
819
- onLoginSuccess: (user: User, info: {
820
- method: SignInMethod;
821
- newUser: boolean;
822
- }) => void;
858
+ onLoginSuccess: (user: User, info: SignInInfo) => void;
823
859
  }
824
860
 
825
861
  /** `mismatch` is terminal: re-auth signed in a different account (see `onAccountMismatch`). */
826
- export declare type SignInStep = 'email' | 'passkey' | 'code' | 'enroll' | 'enrolled' | 'done' | 'mismatch';
862
+ export declare type SignInStep = 'email' | 'passkey' | 'recovery' | 'code' | 'enroll' | 'enrolled' | 'done' | 'mismatch';
827
863
 
828
864
  export declare const Textarea: React_2.ForwardRefExoticComponent<TextareaProps & React_2.RefAttributes<HTMLTextAreaElement>>;
829
865
 
@@ -874,20 +910,14 @@ export declare interface UseMovmoSignInOptions {
874
910
  surface: 'top-level' | 'embedded';
875
911
  getCurrentUser: () => Promise<User>;
876
912
  /** The traveler is signed in: fires exactly once, after the enrollment prompt when one is shown. */
877
- onSignedIn: (user: User, info: {
878
- method: SignInMethod;
879
- newUser: boolean;
880
- }) => void;
913
+ onSignedIn: (user: User, info: SignInInfo) => void;
881
914
  /**
882
915
  * Fires once, right after a successful verify and `getCurrentUser()` (the
883
916
  * server session exists), BEFORE the enrollment prompt. Use it for work that
884
917
  * mustn't wait for the traveler to answer the prompt; `onSignedIn` keeps its
885
918
  * meaning.
886
919
  */
887
- onVerified?: (user: User, info: {
888
- method: SignInMethod;
889
- newUser: boolean;
890
- }) => void;
920
+ onVerified?: (user: User, info: SignInInfo) => void;
891
921
  /**
892
922
  * Re-auth only (`expectedUserId`): a different account signed in. The server
893
923
  * session has already been ended by the package (`api.logout()`) when this