mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Added the `hl?: string;;` prop, with description sourced from * Update description to the description defined by the official docs
98 lines
2.7 KiB
TypeScript
98 lines
2.7 KiB
TypeScript
// Type definitions for React Google Recaptcha 1.1
|
|
// Project: https://github.com/dozoisch/react-google-recaptcha
|
|
// Definitions by: Koala Human <https://github.com/KoalaHuman>
|
|
// Tom Sturge <https://github.com/tomsturge>
|
|
// Max Bo <https://github.com/MaxwellBo>
|
|
// Meir Keller <https://github.com/meirkl>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.8
|
|
|
|
import * as React from 'react';
|
|
|
|
export default ReCAPTCHA;
|
|
|
|
declare class ReCAPTCHA extends React.Component<ReCAPTCHAProps> {
|
|
/**
|
|
* Resets the reCAPTCHA widget
|
|
*/
|
|
reset(): void;
|
|
/**
|
|
* Programatically invoke the reCAPTCHA check. Used if the invisible reCAPTCHA is on a div instead of a button
|
|
*/
|
|
execute(): void;
|
|
|
|
/**
|
|
* Gets the response for the reCAPTCHA widget.
|
|
* @return the response of the reCAPTCHA widget.
|
|
*/
|
|
getValue(): string | null;
|
|
|
|
/**
|
|
* Gets the widgetId of reCAPTCHA widget
|
|
* @return widgetId | null
|
|
*/
|
|
getWidgetId(): number | null;
|
|
}
|
|
|
|
type Theme = "light" | "dark";
|
|
type Type = "image" | "audio";
|
|
type Size = "compact" | "normal" | "invisible";
|
|
type Badge = "bottomright" | "bottomleft" | "inline";
|
|
|
|
export interface ReCAPTCHAProps {
|
|
/**
|
|
* The API client key
|
|
*/
|
|
sitekey: string;
|
|
/**
|
|
* The function to be called when the user successfully completes the normal or compat captcha.
|
|
* It will also be called with null, when captcha expires
|
|
* @param token string or null
|
|
*/
|
|
onChange?: (token: string|null) => void;
|
|
/**
|
|
* Optional light or dark theme of the widget
|
|
* @default "light"
|
|
*/
|
|
theme?: Theme;
|
|
/**
|
|
* Optional image or audio The type of initial captcha
|
|
* @default "image"
|
|
*/
|
|
type?: Type;
|
|
/**
|
|
* Optional the tabindex of the element
|
|
* @default 0
|
|
*/
|
|
tabindex?: number;
|
|
/**
|
|
* Optional callback, called when a challenge expires and has to be redone by the user.
|
|
*/
|
|
onExpired?: () => void;
|
|
/**
|
|
* Optional callback, called when reCAPTCHA encounters an error (usually network connectivity)
|
|
* and cannot continue until connectivity is restored. If you specify a function here, you are
|
|
* responsible for informing the user that they should retry.
|
|
*/
|
|
onErrored?: () => void;
|
|
/**
|
|
* Optional set the stoken parameter, which allows the captcha to be used from different domains,
|
|
* @see reCAPTCHA secure-token
|
|
*/
|
|
stoken?: string;
|
|
/**
|
|
* Optional. Forces the widget to render in a specific language. Auto-detects the user's language if unspecified.
|
|
*/
|
|
hl?: string;
|
|
/**
|
|
* Optional compact, normal or invisible. This allows you to change the size or do an invisible captcha
|
|
*/
|
|
size?: Size;
|
|
/**
|
|
* Optional. The badge location for g-recaptcha with size of "invisible".
|
|
*
|
|
* @default "bottomright"
|
|
*/
|
|
badge?: Badge;
|
|
}
|