infinity-forge
Version:
44 lines (43 loc) • 2.21 kB
TypeScript
import React from "react";
import { TurnstileObject, SupportedLanguages, RenderParameters } from "./type.js";
export declare function Turnstile({ id, className, style: customStyle, sitekey, action, cData, theme, language, tabIndex, responseField, responseFieldName, size, fixedSize, retry, retryInterval, refreshExpired, appearance, execution, userRef, onVerify, onSuccess, onLoad, onError, onExpire, onTimeout, onAfterInteractive, onBeforeInteractive, onUnsupported, }: TurnstileProps): import("react/jsx-runtime").JSX.Element;
interface TurnstileProps extends TurnstileCallbacks {
sitekey: string;
action?: string;
cData?: string;
theme?: "light" | "dark" | "auto";
language?: SupportedLanguages | "auto";
tabIndex?: number;
responseField?: boolean;
responseFieldName?: string;
size?: "normal" | "compact" | "flexible" | "invisible";
fixedSize?: boolean;
retry?: "auto" | "never";
retryInterval?: number;
refreshExpired?: "auto" | "manual" | "never";
appearance?: "always" | "execute" | "interaction-only";
execution?: "render" | "execute";
id?: string;
userRef?: React.MutableRefObject<HTMLDivElement>;
className?: string;
style?: React.CSSProperties;
}
interface TurnstileCallbacks {
onVerify?: (token: string, boundTurnstile: BoundTurnstileObject) => void;
onSuccess?: (token: string, preClearanceObtained: boolean, boundTurnstile: BoundTurnstileObject) => void;
onLoad?: (widgetId: string, boundTurnstile: BoundTurnstileObject) => void;
onError?: (error?: Error | any, boundTurnstile?: BoundTurnstileObject) => void;
onExpire?: (token: string, boundTurnstile: BoundTurnstileObject) => void;
onTimeout?: (boundTurnstile: BoundTurnstileObject) => void;
onAfterInteractive?: (boundTurnstile: BoundTurnstileObject) => void;
onBeforeInteractive?: (boundTurnstile: BoundTurnstileObject) => void;
onUnsupported?: (boundTurnstile: BoundTurnstileObject) => void;
}
interface BoundTurnstileObject {
execute: (options?: RenderParameters) => void;
reset: () => void;
getResponse: () => void;
isExpired: () => boolean;
}
export declare function useTurnstile(): TurnstileObject;
export {};