import SessionWebJS from "supertokens-web-js/recipe/session"; import WebJSSessionRecipe from "supertokens-web-js/recipe/session"; import RecipeModule from "../recipeModule"; import type { NormalisedSessionConfig } from "./types"; import type { RecipeEventWithSessionContext, InputType } from "./types"; import type { Navigate, NormalisedConfigWithAppInfoAndRecipeID, RecipeInitResult, SuccessRedirectContextInApp, SuccessRedirectContextOAuth2, UserContext, } from "../../types"; import type { ClaimValidationError, SessionClaimValidator } from "supertokens-web-js/recipe/session"; import type { SessionClaim } from "supertokens-web-js/recipe/session"; export default class Session extends RecipeModule { readonly webJSRecipe: Omit; static instance?: Session; static RECIPE_ID: "session"; recipeID: "session"; private eventListeners; constructor( config: NormalisedConfigWithAppInfoAndRecipeID, webJSRecipe?: Omit ); getUserId: (input: { userContext: UserContext }) => Promise; getAccessToken: (input: { userContext: UserContext }) => Promise; getClaimValue: (input: { claim: SessionWebJS.SessionClaim; userContext: UserContext; }) => Promise; getAccessTokenPayloadSecurely: (input: { userContext: UserContext }) => Promise; doesSessionExist: (input: { userContext: UserContext }) => Promise; signOut: (input: { userContext: UserContext }) => Promise; attemptRefreshingSession: () => Promise; validateClaims: (input: { overrideGlobalClaimValidators?: | ((globalClaimValidators: SessionClaimValidator[], userContext: UserContext) => SessionClaimValidator[]) | undefined; userContext: UserContext; }) => Promise | ClaimValidationError[]; getInvalidClaimsFromResponse: (input: { response: | { data: any; } | Response; userContext: UserContext; }) => Promise; /** * @returns Function to remove event listener */ addEventListener: (listener: (ctx: RecipeEventWithSessionContext) => void) => () => void; validateGlobalClaimsAndHandleSuccessRedirection: ( successRedirectContext: | ((Omit | Omit) & { recipeId: string; tenantIdFromQueryParams: string | undefined; }) | undefined, fallbackRecipeId: string, redirectToPath: string | undefined, userContext: UserContext | undefined, navigate: Navigate | undefined ) => Promise; /** * This should only get called if validateGlobalClaimsAndHandleSuccessRedirection couldn't get a redirectInfo * @returns "/" */ getDefaultRedirectionURL: () => Promise; private notifyListeners; private getSessionContext; static addAxiosInterceptors(axiosInstance: any, userContext: UserContext): void; static init(config?: InputType): RecipeInitResult; static getInstanceOrThrow(): Session; static getInstance(): Session | undefined; static reset(): void; }