import { NormalisedRecipeConfig, RecipeConfig, RecipeFunctionOptions, RecipePreAPIHookContext, UserInput as RecipeModuleUserInput, } from "../recipeModule/types"; import OverrideableBuilder from "supertokens-js-override"; export declare type PreAndPostAPIHookAction = "VERIFY_EMAIL" | "SEND_VERIFY_EMAIL" | "IS_EMAIL_VERIFIED"; export declare type PreAPIHookContext = RecipePreAPIHookContext; export declare type PostAPIHookContext = RecipePreAPIHookContext; export declare type InputTypeOverride = { functions?: ( originalImplementation: RecipeInterface, builder: OverrideableBuilder ) => RecipeInterface; }; export declare type UserInput = { /** * Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/frontend-functions-override/about the documentation} */ override?: InputTypeOverride; } & RecipeModuleUserInput; export declare type InputType = RecipeConfig & UserInput; export declare type NormalisedInputType = NormalisedRecipeConfig & { override: { functions: ( originalImplementation: RecipeInterface, builder: OverrideableBuilder ) => RecipeInterface; }; }; export declare type RecipeInterface = { /** * Verify an email * * @param userContext Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/user-context the documentation} * * @param options Use this to configure additional properties (for example pre api hooks) * * @returns `{status: "OK"}` if successfull * @returns `{status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"}` if token is invalid * * @throws STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"` */ verifyEmail: (input: { options?: RecipeFunctionOptions; userContext: any }) => Promise<{ status: "OK" | "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; fetchResponse: Response; }>; /** * Send an email to the user for verification. * * @param userContext Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/user-context the documentation} * * @param options Use this to configure additional properties (for example pre api hooks) * * @returns `{status: "OK"}` if successfull * @returns `{status: "EMAIL_ALREADY_VERIFIED_ERROR"}` if the email has already been verified * * @throws STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"` */ sendVerificationEmail: (input: { options?: RecipeFunctionOptions; userContext: any }) => Promise<{ status: "EMAIL_ALREADY_VERIFIED_ERROR" | "OK"; fetchResponse: Response; }>; /** * Check if an email has been verified * * @param userContext Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/user-context the documentation} * * @param options Use this to configure additional properties (for example pre api hooks) * * @returns `{status: "OK", isVerified: boolean}` * * @throws STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"` */ isEmailVerified: (input: { options?: RecipeFunctionOptions; userContext: any }) => Promise<{ status: "OK"; isVerified: boolean; fetchResponse: Response; }>; /** * Reads and returns the email verification token from the current URL * * @param userContext Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/user-context the documentation} * * @returns The "token" query parameter from the current location */ getEmailVerificationTokenFromURL: (input: { userContext: any }) => string; /** * Reads and returns the tenant id from the current URL * * @param userContext Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/user-context the documentation} * * @returns The "tenantId" query parameter from the current location */ getTenantIdFromURL: (input: { userContext: any }) => string | undefined; };