UNPKG

@frank-auth/react

Version:

Flexible and customizable React UI components for Frank Authentication

95 lines 3.45 kB
/** * @frank-auth/react - Verification & Invitation Hooks * * Custom React hooks for identity verification and organization invitations. * These hooks provide state management and API integration for the new components. */ export interface UseIdentityVerificationOptions { email?: string; phoneNumber?: string; userId?: string; organizationId?: string; methods?: ('email' | 'phone')[]; autoSubmit?: boolean; codeLength?: number; resendDelay?: number; maxResendAttempts?: number; expirationTime?: number; } export interface IdentityVerificationState { activeMethod: 'email' | 'phone' | null; emailStatus: 'idle' | 'sending' | 'sent' | 'verifying' | 'verified' | 'error' | 'expired'; phoneStatus: 'idle' | 'sending' | 'sent' | 'verifying' | 'verified' | 'error' | 'expired'; emailCode: string; phoneCode: string; emailError: string | null; phoneError: string | null; emailResendAttempts: number; phoneResendAttempts: number; emailTimeRemaining: number; phoneTimeRemaining: number; isVerified: boolean; verifiedMethods: ('email' | 'phone')[]; } export declare function useIdentityVerification(options: UseIdentityVerificationOptions): { sendEmailCode: () => Promise<void>; sendPhoneCode: () => Promise<void>; verifyEmail: () => Promise<void>; verifyPhone: () => Promise<void>; resendEmailCode: () => Promise<void>; resendPhoneCode: () => Promise<void>; setEmailCode: (code: string) => void; setPhoneCode: (code: string) => void; reset: () => void; canResendEmail: boolean; canResendPhone: boolean; availableMethods: ("email" | "phone")[]; isLoading: boolean; activeMethod: "email" | "phone" | null; emailStatus: "idle" | "sending" | "sent" | "verifying" | "verified" | "error" | "expired"; phoneStatus: "idle" | "sending" | "sent" | "verifying" | "verified" | "error" | "expired"; emailCode: string; phoneCode: string; emailError: string | null; phoneError: string | null; emailResendAttempts: number; phoneResendAttempts: number; emailTimeRemaining: number; phoneTimeRemaining: number; isVerified: boolean; verifiedMethods: ("email" | "phone")[]; }; export interface UseInvitationOptions { token?: string; autoValidate?: boolean; } export interface InvitationState { invitation: any | null; status: 'idle' | 'validating' | 'valid' | 'accepting' | 'declining' | 'accepted' | 'declined' | 'expired' | 'invalid' | 'error'; error: string | null; isLoading: boolean; } export declare function useInvitation(options?: UseInvitationOptions): { validateInvitation: (invitationToken: string) => Promise<void>; acceptInvitation: (userData?: { firstName?: string; lastName?: string; password?: string; }) => Promise<{ organizationId: any; userId: any; } | undefined>; declineInvitation: () => Promise<void>; reset: () => void; invitation: any | null; status: "idle" | "validating" | "valid" | "accepting" | "declining" | "accepted" | "declined" | "expired" | "invalid" | "error"; error: string | null; isLoading: boolean; }; export declare const VerificationHooks: { useIdentityVerification: typeof useIdentityVerification; }; export declare const InvitationHooks: { useInvitation: typeof useInvitation; }; //# sourceMappingURL=use-invitation.d.ts.map