react-waitlist
Version:
A customizable waitlist form component for React applications
52 lines (51 loc) • 1.59 kB
TypeScript
import { SecurityConfig } from './types';
/**
* Interface for reCAPTCHA response
*/
export interface ReCaptchaResponse {
success: boolean;
score: number;
action: string;
challenge_ts: string;
hostname: string;
'error-codes'?: string[];
}
/**
* Load the reCAPTCHA script dynamically
*/
export declare const loadReCaptchaScript: (siteKey: string) => Promise<void>;
/**
* Execute reCAPTCHA and get a token
*/
export declare const executeReCaptcha: (siteKey: string, action?: string) => Promise<string>;
/**
* Verify reCAPTCHA token on the server or via proxy
*/
export declare const verifyReCaptchaToken: (token: string, secretKey?: string, proxyEndpoint?: string, expectedAction?: string, minScore?: number) => Promise<{
valid: boolean;
score?: number;
error?: string;
}>;
/**
* Check if reCAPTCHA is enabled in security config
*/
export declare const isReCaptchaEnabled: (security?: SecurityConfig) => boolean;
declare global {
interface Window {
grecaptcha: {
ready: (callback: () => void) => void;
execute: (widgetIdOrSiteKey: number | string, options?: {
action: string;
}) => Promise<string>;
render: (container: string | HTMLElement, parameters: {
sitekey: string;
callback?: string;
size?: string;
badge?: string;
action?: string;
}) => number;
reset: (widgetId?: number) => void;
getResponse: (widgetId?: number) => string;
};
}
}