gebeya-whatsapp-otp
Version:
React WhatsApp OTP verification component with Supabase integration
42 lines • 1.25 kB
TypeScript
export interface CountryOption {
code: string;
country: string;
flag: string;
}
export interface WhatsAppOTPConfig {
supabaseUrl: string;
supabaseKey: string;
countries?: CountryOption[];
defaultCountry?: string;
redirectUrl?: string;
}
export interface WhatsAppOTPCallbacks {
onSuccess?: (phoneNumber: string) => void;
onError?: (error: string) => void;
onSuspension?: (message: string) => void;
onStepChange?: (step: VerificationStep) => void;
}
export type VerificationStep = "phone" | "verify" | "success";
export interface VerificationState {
step: VerificationStep;
phoneNumber: string;
countryCode: string;
otpCode: string;
isLoading: boolean;
attemptsLeft: number;
maxAttemptsReached: boolean;
isSuspended: boolean;
suspensionMessage: string;
}
export interface WhatsAppOTPContextType extends VerificationState {
setCountryCode: (code: string) => void;
setPhoneNumber: (number: string) => void;
setOtpCode: (code: string) => void;
sendOTP: () => Promise<void>;
verifyOTP: () => Promise<void>;
resetFlow: () => void;
openModal: () => void;
closeModal: () => void;
isModalOpen: boolean;
}
//# sourceMappingURL=types.d.ts.map