@thind9xdev/react-turnstile
Version:
A modern React library for Cloudflare Turnstile, offering both a flexible Hook (useTurnstile) and an easy-to-use Component.
35 lines • 1.1 kB
TypeScript
export interface TurnstileResponse {
success: boolean;
error_codes?: string[];
challenge_ts?: string;
hostname?: string;
action?: string;
cdata?: string;
}
export interface TurnstileOptions {
onLoad?: () => void;
onSuccess?: (token: string) => void;
onError?: (errorCode?: string) => void;
onExpire?: () => void;
onTimeout?: () => void;
theme?: 'light' | 'dark' | 'auto';
size?: 'normal' | 'compact';
language?: string;
retry?: 'auto' | 'never';
'retry-interval'?: number;
'refresh-expired'?: 'auto' | 'manual' | 'never';
appearance?: 'always' | 'execute' | 'interaction-only';
execution?: 'render' | 'execute';
}
declare const useTurnstile: (siteKey: string, options?: TurnstileOptions) => {
ref: import("react").MutableRefObject<HTMLDivElement | null>;
token: string | null;
error: string | null;
isLoading: boolean;
reset: () => void;
execute: () => void;
getResponse: () => string | null;
widgetId: string | null;
};
export default useTurnstile;
//# sourceMappingURL=useTurnstile.d.ts.map