@influenzanet/case-web-app-core 2.9.7-staging → 2.9.9-staging

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.
@@ -4,14 +4,18 @@ export declare const BACKEND_ERRORS: {
4
4
  readonly PHONE_ALREADY_TAKEN: "phone number already taken";
5
5
  readonly PHONE_ALREADY_VERIFIED: "phone number already verified";
6
6
  readonly NO_PHONE_TO_EDIT: "user has no phone number to edit";
7
+ readonly USER_HAS_PHONE: "user already has a phone number";
7
8
  readonly WHATSAPP_UNAVAILABLE: "WhatsApp is not configured";
8
9
  readonly SEND_FAILED: "failed to send verification code";
9
10
  readonly TOO_MANY_ATTEMPTS: "too many attempts, phone number removed";
10
11
  readonly CODE_EXPIRED: "verification code expired";
11
12
  readonly INVALID_CODE: "invalid verification code";
12
13
  readonly RATE_LIMITED: "too many phone verification attempts, try again later";
14
+ readonly COOLDOWN: "cannot send verification so often";
15
+ readonly PHONE_NOT_PENDING: "phone number is not pending verification";
16
+ readonly NO_VERIFICATION_IN_PROGRESS: "no phone verification in progress";
13
17
  readonly RECIPIENT_NOT_ALLOWED: "phone number not enabled to receive WhatsApp messages";
14
18
  };
15
19
  export declare const logRequestFailure: (context: string, error: unknown) => void;
16
- export declare type PhoneErrorKind = "rateLimited" | "recipientNotAllowed" | "invalidCode" | "codeExpired" | "tooManyAttempts" | "unknown";
20
+ export declare type PhoneErrorKind = "rateLimited" | "recipientNotAllowed" | "invalidCode" | "codeExpired" | "tooManyAttempts" | "cooldown" | "noPendingVerification" | "unknown";
17
21
  export declare const classifyPhoneError: (error: unknown) => PhoneErrorKind;
@@ -0,0 +1,7 @@
1
+ export declare const resendCooldownSeconds = 60;
2
+ export interface ResendCooldown {
3
+ secondsLeft: number;
4
+ isCoolingDown: boolean;
5
+ start: () => void;
6
+ }
7
+ export declare const useResendCooldown: (seconds?: number) => ResendCooldown;