@supertokens-plugins/captcha-react
Classes
Captcha
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:32
Constructors
Constructor
new Captcha(): Captcha;
Returns
Properties
Methods
addEventListener()
addEventListener<T>(event: T, listener: CaptchaEventListener<T>): void;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:188
Type Parameters
Parameters
Returns
void
getInputContainer()
getInputContainer(): Promise<HTMLDivElement>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:66
Returns
getToken()
getToken(): Promise<string>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:151
Returns
Promise<string>
init()
init(config: SuperTokensPluginCaptchaConfig): void;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:44
Parameters
Returns
void
load()
load(): Promise<void>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:85
Returns
Promise<void>
removeEventListener()
removeEventListener<T>(event: T, listener: CaptchaEventListener<T>): void;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:192
Type Parameters
Parameters
Returns
void
render()
render(onSubmit?: (token: string) => void, onError?: (error: Error) => void): Promise<void>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:120
Renders the captcha provider. The function accepts two callbacks that enable the following behaviors:
- Pass callbacks that update some UI state and move ahead with the rendering process. Used when you render the captcha from the start.
- Wrap the call in a promise and pass resolve/reject as callbacks. This way you can block your function and wait for the token value. This is used when the captcha is rendered after the user has submitted the authentication form.
Parameters
Returns
Promise<void>
ReCAPTCHAv2Provider
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:213
Implements
Constructors
Constructor
new ReCAPTCHAv2Provider(config: Parameters): ReCAPTCHAv2Provider;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:216
Parameters
Returns
Methods
getToken()
getToken(): Promise<string>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:275
Returns
Promise<string>
Implementation of
load()
load(): Promise<void>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:222
Returns
Promise<void>
Implementation of
render()
render(
containerElement: HTMLDivElement,
onSubmit: (token: string) => void,
onError: (error: Error) => void): void;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:239
Parameters
Returns
void
Implementation of
setToken()
setToken(token: string): void;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:218
Parameters
Returns
void
ReCAPTCHAv3Provider
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:283
Implements
Constructors
Constructor
new ReCAPTCHAv3Provider(config: ReCAPTCHAv3Config): ReCAPTCHAv3Provider;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:284
Parameters
Returns
Methods
getToken()
getToken(): Promise<string>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:294
Returns
Promise<string>
Implementation of
load()
load(): Promise<void>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:286
Returns
Promise<void>
Implementation of
TurnstileProvider
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:312
Implements
Constructors
Constructor
new TurnstileProvider(config: RenderParameters): TurnstileProvider;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:315
Parameters
Returns
Methods
getToken()
getToken(): Promise<string>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:395
Returns
Promise<string>
Implementation of
load()
load(): Promise<void>;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:321
Returns
Promise<void>
Implementation of
render()
render(
container: HTMLDivElement,
onSubmit: (token: string) => void,
onError: (error: Error) => void): void;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:338
Parameters
Returns
void
Implementation of
setToken()
setToken(token: string): void;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:317
Parameters
Returns
void
Interfaces
CaptchaProvider
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:17
Properties
Type Aliases
CaptchInputContainerProps
type CaptchInputContainerProps = {
form: | "EmailPasswordSignInForm"
| "EmailPasswordSignUpForm"
| "EmailPasswordResetPasswordEmail"
| "EmailPasswordSubmitNewPassword"
| "PasswordlessEmailForm"
| "PasswordlessPhoneForm"
| "PasswordlessEmailOrPhoneForm"
| "PasswordlessEPComboEmailForm"
| "PasswordlessEPComboEmailOrPhoneForm"
| "PasswordlessUserInputForm";
} & React.HTMLAttributes<HTMLDivElement>;
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:82
Type Declaration
EmailPasswordCaptchaPreAndPostAPIHookActions
type EmailPasswordCaptchaPreAndPostAPIHookActions = Extract<BaseFormSection,
| "EMAIL_PASSWORD_SIGN_UP"
| "EMAIL_PASSWORD_SIGN_IN"
| "SUBMIT_NEW_PASSWORD"
| "SEND_RESET_PASSWORD_EMAIL">;
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:50
PasswordlessCaptchaPreAndPostAPIHookActions
type PasswordlessCaptchaPreAndPostAPIHookActions = Extract<BaseFormSection, "PASSWORDLESS_CONSUME_CODE" | "PASSWORDLESS_CREATE_CODE">;
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:66
ReCAPTCHAv2Config
type ReCAPTCHAv2Config = ReCaptchaV2.Parameters;
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:23
ReCAPTCHAv3Config
type ReCAPTCHAv3Config = {
action?: string;
sitekey: string;
};
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:24
Properties
SuperTokensPluginCaptchaConfig
type SuperTokensPluginCaptchaConfig = CaptchaConfig & {
InputContainer?: React.ForwardRefExoticComponent<CaptchInputContainerProps & React.RefAttributes<HTMLDivElement>>;
inputContainerId?: | string
| () => Promise<string>;
};
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:77
Type Declaration
TurnstileConfig
type TurnstileConfig = Turnstile.RenderParameters;
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:34
Variables
captcha
const captcha: Captcha;
Defined in: supertokens-plugins/packages/captcha-react/src/captcha.ts:440
CAPTCHA_INPUT_CONTAINER_ID
const CAPTCHA_INPUT_CONTAINER_ID: "supertokens-captcha-container" = "supertokens-captcha-container";
Defined in: supertokens-plugins/packages/captcha-react/src/constants.ts:2
CAPTCHA_MODAL_INPUT_CONTAINER_ID
const CAPTCHA_MODAL_INPUT_CONTAINER_ID: "supertokens-captcha-modal-container" = "supertokens-captcha-modal-container";
Defined in: supertokens-plugins/packages/captcha-react/src/constants.ts:3
CaptchaInputContainer
const CaptchaInputContainer: ForwardRefExoticComponent<{
form: | "EmailPasswordSignInForm"
| "EmailPasswordSignUpForm"
| "EmailPasswordResetPasswordEmail"
| "EmailPasswordSubmitNewPassword"
| "PasswordlessEmailForm"
| "PasswordlessPhoneForm"
| "PasswordlessEmailOrPhoneForm"
| "PasswordlessEPComboEmailForm"
| "PasswordlessEPComboEmailOrPhoneForm"
| "PasswordlessUserInputForm";
} & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;
Defined in: supertokens-plugins/packages/captcha-react/src/components/CaptchaInputContainer.tsx:10
default
default: {
init: (config: SuperTokensPluginCaptchaConfig) => SuperTokensPlugin;
};
Defined in: supertokens-plugins/packages/captcha-react/src/index.ts:6
Type Declaration
PLUGIN_ID
const PLUGIN_ID: "supertokens-plugin-captcha" = "supertokens-plugin-captcha";
Defined in: supertokens-plugins/packages/captcha-react/src/constants.ts:1
Functions
EmailPasswordResetPasswordEmail()
function EmailPasswordResetPasswordEmail(): EmailPasswordComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:31
Returns
EmailPasswordComponentOverrideMap
EmailPasswordSignInForm()
function EmailPasswordSignInForm(): EmailPasswordComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:6
Returns
EmailPasswordComponentOverrideMap
EmailPasswordSignUpForm()
function EmailPasswordSignUpForm(): EmailPasswordComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:18
Returns
EmailPasswordComponentOverrideMap
EmailPasswordSubmitNewPassword()
function EmailPasswordSubmitNewPassword(): EmailPasswordComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:48
Returns
EmailPasswordComponentOverrideMap
getPluginConfig()
function getPluginConfig(): SuperTokensPluginCaptchaConfig;
Defined in: supertokens-plugins/packages/captcha-react/src/config.ts:34
Returns
SuperTokensPluginCaptchaConfig
init()
function init(config: SuperTokensPluginCaptchaConfig): SuperTokensPlugin;
Defined in: supertokens-plugins/packages/captcha-react/src/plugin.ts:16
Parameters
Returns
SuperTokensPlugin
isEmailPasswordCaptchaPreAndPostAPIHookAction()
function isEmailPasswordCaptchaPreAndPostAPIHookAction(action: string): action is any;
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:55
Parameters
Returns
action is any
isPasswordlessCaptchaPreAndPostAPIHookAction()
function isPasswordlessCaptchaPreAndPostAPIHookAction(action: string): action is any;
Defined in: supertokens-plugins/packages/captcha-react/src/types.ts:71
Parameters
Returns
action is any
PasswordlessEmailForm()
function PasswordlessEmailForm(): PasswordlessComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:64
Returns
PasswordlessComponentOverrideMap
PasswordlessEmailOrPhoneForm()
function PasswordlessEmailOrPhoneForm(): PasswordlessComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:89
Returns
PasswordlessComponentOverrideMap
PasswordlessEPComboEmailForm()
function PasswordlessEPComboEmailForm(): PasswordlessComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:106
Returns
PasswordlessComponentOverrideMap
PasswordlessEPComboEmailOrPhoneForm()
function PasswordlessEPComboEmailOrPhoneForm(): PasswordlessComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:123
Returns
PasswordlessComponentOverrideMap
PasswordlessPhoneForm()
function PasswordlessPhoneForm(): PasswordlessComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:76
Returns
PasswordlessComponentOverrideMap
PasswordlessUserInputCodeForm()
function PasswordlessUserInputCodeForm(): PasswordlessComponentOverrideMap;
Defined in: supertokens-plugins/packages/captcha-react/src/components/ComponentOverrides.tsx:140
Returns
PasswordlessComponentOverrideMap
setPluginConfig()
function setPluginConfig(config: SuperTokensPluginCaptchaConfig): void;
Defined in: supertokens-plugins/packages/captcha-react/src/config.ts:8
Parameters
Returns
void
useCaptcha()
function useCaptcha(onError?: (error: string) => void): {
containerId: | string
| () => Promise<string>;
load: (configOverride: Partial<SuperTokensPluginCaptchaConfig>) => Promise<boolean>;
render: () => Promise<void>;
state: CaptchaState;
};
Defined in: supertokens-plugins/packages/captcha-react/src/hooks/useCaptcha.ts:8
Parameters
Returns
{
containerId: | string
| () => Promise<string>;
load: (configOverride: Partial<SuperTokensPluginCaptchaConfig>) => Promise<boolean>;
render: () => Promise<void>;
state: CaptchaState;
}
useCaptchaInputContainer()
function useCaptchaInputContainer(): ForwardRefExoticComponent<{
form: | "EmailPasswordSignInForm"
| "EmailPasswordSignUpForm"
| "EmailPasswordResetPasswordEmail"
| "EmailPasswordSubmitNewPassword"
| "PasswordlessEmailForm"
| "PasswordlessPhoneForm"
| "PasswordlessEmailOrPhoneForm"
| "PasswordlessEPComboEmailForm"
| "PasswordlessEPComboEmailOrPhoneForm"
| "PasswordlessUserInputForm";
} & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;
Defined in: supertokens-plugins/packages/captcha-react/src/hooks/useCaptchaInputContainer.ts:6
Returns
ForwardRefExoticComponent<{ form: | "EmailPasswordSignInForm" | "EmailPasswordSignUpForm" | "EmailPasswordResetPasswordEmail" | "EmailPasswordSubmitNewPassword" | "PasswordlessEmailForm" | "PasswordlessPhoneForm" | "PasswordlessEmailOrPhoneForm" | "PasswordlessEPComboEmailForm" | "PasswordlessEPComboEmailOrPhoneForm" | "PasswordlessUserInputForm"; } & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>
validatePublicConfig()
function validatePublicConfig(config: SuperTokensPublicConfig): void;
Defined in: supertokens-plugins/packages/captcha-react/src/config.ts:41
Parameters
Returns
void