import { User } from "../../types"; import { RecipeFunctionOptions } from "../recipeModule/types"; import { PreAndPostAPIHookAction, PreAPIHookContext, PostAPIHookContext, StateObject, RecipeInterface, UserInput, } from "./types"; export default class RecipeWrapper { static init(config?: UserInput): import("../../types").CreateRecipeFunction; static signOut(input?: { userContext?: any }): Promise; /** * Get the current login state from storage, this is also used when calling signInUp * * @param userContext Refer to {@link https://supertokens.com/docs/thirdparty/advanced-customizations/user-context the documentation} * * @returns State object from storage */ static getStateAndOtherInfoFromStorage(input?: { userContext?: any; }): (StateObject & CustomStateProperties) | undefined; /** * Get the URL that should be opened for third party authentication * * @param thirdPartyId The identifier for the third party provider. The value must match one of the providers configured with the backend SDK * * @param frontendRedirectURI The URL that should be used for redirection after the third party flow finishes. * * @param redirectURIOnProviderDashboard (OPTIONAL) The redirect URL that is configured on the provider dashboard. Not required if the value is same as frontendRedirectURI * * @param shouldTryLinkingWithSessionUser (OPTIONAL) Whether the backend should try to link the user to the session user * * @param userContext (OPTIONAL) Refer to {@link https://supertokens.com/docs/thirdparty/advanced-customizations/user-context the documentation} * * @param options (OPTIONAL) Use this to configure additional properties (for example pre api hooks) * * @returns URL string * * @throws STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"` */ static getAuthorisationURLWithQueryParamsAndSetState(input: { thirdPartyId: string; frontendRedirectURI: string; redirectURIOnProviderDashboard?: string; shouldTryLinkingWithSessionUser?: boolean; userContext?: any; options?: RecipeFunctionOptions; }): Promise; /** * Sign up/Sign in the user, this method uses the login attempt information from storage * * @param userContext (OPTIONAL) Refer to {@link https://supertokens.com/docs/thirdparty/advanced-customizations/user-context the documentation} * * @param options (OPTIONAL) Use this to configure additional properties (for example pre api hooks) * * @returns `{status: OK, user, createdNewRecipeUser: boolean}` if successful * * @returns `{status: "NO_EMAIL_GIVEN_BY_PROVIDER"}` if the correct scopes are not configured for the third party provider * @returns `{status: "SIGN_IN_UP_NOT_ALLOWED", reason: string}` if signing in with this user is not allowed if because of account linking conflicts * * @throws STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"` */ static signInAndUp(input?: { userContext?: any; options?: RecipeFunctionOptions }): Promise< | { status: "OK"; user: User; createdNewRecipeUser: boolean; fetchResponse: Response; } | { status: "NO_EMAIL_GIVEN_BY_PROVIDER"; fetchResponse: Response; } | { status: "SIGN_IN_UP_NOT_ALLOWED"; reason: string; fetchResponse: Response; } >; } declare const init: typeof RecipeWrapper.init; declare const getAuthorisationURLWithQueryParamsAndSetState: typeof RecipeWrapper.getAuthorisationURLWithQueryParamsAndSetState; declare const getStateAndOtherInfoFromStorage: typeof RecipeWrapper.getStateAndOtherInfoFromStorage; declare const signInAndUp: typeof RecipeWrapper.signInAndUp; declare const signOut: typeof RecipeWrapper.signOut; export { init, getStateAndOtherInfoFromStorage, getAuthorisationURLWithQueryParamsAndSetState, signInAndUp, signOut, RecipeInterface, StateObject, PreAPIHookContext, PostAPIHookContext, PreAndPostAPIHookAction, RecipeFunctionOptions, UserInput, };