gebeya-whatsapp-verify
Version:
Reusable WhatsApp phone verification components for React applications (Supabase Edge Function integration)
72 lines • 2.34 kB
TypeScript
import { ReactNode } from 'react';
export interface WhatsAppUser {
id: string;
phone?: string;
phone_confirmed_at?: string;
}
export interface WhatsAppVerificationData {
user: WhatsAppUser;
phoneNumber: string;
sessionId: string;
verificationMethod: 'whatsapp';
actionLink?: string;
}
export interface WhatsAppConfig {
senderName?: string;
}
export interface WhatsAppVerifyButtonProps {
onVerificationComplete?: (userData: WhatsAppVerificationData) => void;
onVerificationStart?: () => void;
buttonText?: string;
variant?: 'default' | 'outline' | 'secondary' | 'ghost';
size?: 'sm' | 'default' | 'lg' | 'xl';
className?: string;
color?: 'default' | 'blue' | 'green' | 'red' | 'purple' | 'orange' | 'gray' | 'custom';
customColors?: CustomColors;
}
export interface WhatsAppVerificationModalProps {
isOpen: boolean;
onClose: () => void;
onVerificationComplete?: (userData: WhatsAppVerificationData) => void;
onVerificationStart?: () => void;
}
export interface WhatsAppVerificationProviderProps {
children: ReactNode;
supabaseClient: any;
whatsappConfig?: WhatsAppConfig;
onSuccess?: (userData: WhatsAppVerificationData) => void;
onError?: (error: string) => void;
theme?: {
primaryColor?: string;
borderRadius?: string;
fontSize?: string;
};
buttonConfig?: {
defaultColor?: 'default' | 'blue' | 'green' | 'red' | 'purple' | 'orange' | 'gray' | 'custom';
defaultVariant?: 'default' | 'outline' | 'secondary' | 'ghost';
defaultSize?: 'sm' | 'default' | 'lg' | 'xl';
customColors?: CustomColors;
};
}
export interface AuthFlowProps {
onComplete?: (userData: WhatsAppVerificationData) => void;
}
export type AuthStep = 'phone' | 'otp';
export interface CustomColors {
background?: string;
text?: string;
hover?: string;
border?: string;
}
export interface ButtonConfig {
defaultColor?: 'default' | 'blue' | 'green' | 'red' | 'purple' | 'orange' | 'gray' | 'custom';
defaultVariant?: 'default' | 'outline' | 'secondary' | 'ghost';
defaultSize?: 'sm' | 'default' | 'lg' | 'xl';
customColors?: CustomColors;
}
export interface CountryOption {
code: string;
name: string;
flag: string;
}
//# sourceMappingURL=index.d.ts.map