import { ContextOptions, RedirectOptions, RequestSource, SessionContext } from '../interfaces'; import { IUserProfile } from '../users/interfaces'; /** * Entitlements config from frontegg provider */ export interface EntitlementsOptions { enabled?: boolean; } export declare class ContextHolder { private static _apps; private context; private accessToken; private user; private requestSource; onRedirectTo: (path: string, opts?: RedirectOptions) => void; logout: (callback?: () => void) => void; private entitlementsOptions; private appName; private sessionContext?; private basename; private cdnUrl; private assetsUrl; private constructor(); static default(): ContextHolder; static for(appName: string): ContextHolder; /** * @deprecated - use ContextHolder.for(appName) / ContextHolder.default() instead * @param appName */ static getInstance(appName?: string): ContextHolder; static createInstance(appName?: string): ContextHolder; /** * @deprecated - use ContextHolder.for(appName).setContext instead */ static setContext(context: ContextOptions, appName?: string): void; setContext: (context: ContextOptions) => void; /** * @deprecated - use ContextHolder.for(appName).setAccessToken instead */ static setAccessToken(accessToken: string | null, appName?: string): void; setAccessToken: (accessToken: string | null) => void; /** * @deprecated - use ContextHolder.for(appName).setUser instead */ static setUser(user: IUserProfile | null, appName?: string): void; setUser: (user: IUserProfile | null) => void; /** * @deprecated - use ContextHolder.for(appName).setRequestSource instead */ static setRequestSource(requestSource: RequestSource | null, appName?: string): void; setRequestSource: (requestSource: RequestSource | null) => void; /** * @deprecated - use ContextHolder.for(appName).setOnRedirectTo instead */ static setOnRedirectTo(onRedirectTo: (path: string, opts?: RedirectOptions) => void, appName?: string): void; setOnRedirectTo: (onRedirectTo: (path: string, opts?: RedirectOptions) => void) => void; /** * @deprecated - use ContextHolder.for(appName).setLogout instead */ static setLogout(logout: (callback?: () => void) => void, logoutUrl: string, appName?: string): void; setLogout: (logout: (callback?: () => void) => void) => void; /** * App name should also be set for entitlements * @deprecated - use ContextHolder.for(appName).setEntitlementsOptions instead * @param entitlementsOptions frontegg options entitlements config * @param appName - app name */ static setEntitlementsOptions(entitlementsOptions: EntitlementsOptions, appName?: string): void; setEntitlementsOptions: (entitlementsOptions: EntitlementsOptions) => void; /** * @deprecated - use ContextHolder.for(appName).setSessionContext instead * @param sessionContext frontegg options SessionContext config * @param appName - app name */ static setSessionContext(sessionContext: SessionContext, appName?: string): void; setSessionContext: (sessionContext: SessionContext) => void; /** * @deprecated - use ContextHolder.for(appName).setAppName instead */ static setAppName(appName: string): void; setAppName: (appName: string) => void; /** * @deprecated - use ContextHolder.for(appName).getContext instead */ static getContext(appName?: string): ContextOptions; getContext: () => ContextOptions; /** * @deprecated - use ContextHolder.for(appName).getAccessToken instead */ static getAccessToken(appName?: string): string | null; getAccessToken: () => string | null; /** * @deprecated - use ContextHolder.for(appName).requestSource instead */ static getRequestSource(appName?: string): RequestSource | null; getRequestSource: () => RequestSource | null; /** * @deprecated - use ContextHolder.for(appName).getBasename instead */ static getBasename(appName?: string): string | null; getBasename(): string | null; /** * @deprecated - use ContextHolder.for(appName).setBasename instead */ static setBasename(basename: string | null, appName?: string): void; setBasename(basename: string | null): void; /** * @deprecated - use ContextHolder.for(appName).getUser instead */ static getUser(appName?: string): IUserProfile | null; getUser: () => IUserProfile | null; /** * @deprecated - use ContextHolder.for(appName).onRedirectTo instead */ static onRedirectTo(path: string, opts?: RedirectOptions, appName?: string): void; /** * @deprecated - use ContextHolder.for(appName).logout instead */ static logout(callback?: () => void, appName?: string): void; /** * @deprecated - use ContextHolder.for(appName).shouldLoadEntitlements instead * @returns shouldLoadEntitlements. Default to false. */ static shouldLoadEntitlements(appName?: string): boolean; shouldLoadEntitlements: () => boolean; /** * @deprecated - use ContextHolder.for(appName).isSessionPerTenantEnabled instead * @returns isSessionPerTenantEnabled. Default to false. */ static isSessionPerTenantEnabled(appName?: string): boolean; isSessionPerTenantEnabled: () => boolean; shouldSkipUserLoad: () => boolean; /** * @deprecated - use ContextHolder.for(appName).getAppName instead * @returns app name value */ static getAppName(appName?: string): string | null; getAppName: () => string | null; setCdnUrl: (cdnUrl: string | null) => void; getCdnUrl: () => string | null; setAssetsUrl: (assets: string | null) => void; getAssetsUrl: () => string | null; } /** * Frontegg context to be used in the application * * @deprecated use ContextHolder.for instead */ export declare const FronteggContext: { getContext: () => ContextOptions; getAccessToken: () => string | null; setAccessToken: (accessToken: string | null) => void; getUser: () => IUserProfile | null; setUser: (user: IUserProfile | null) => void; onRedirectTo: (path: string, opts?: RedirectOptions) => void; setOnRedirectTo: (onRedirectTo: (path: string, opts?: RedirectOptions) => void) => void; logout: (callback?: () => void) => void; getRequestSource: () => RequestSource | null; setRequestSource: (requestSource: RequestSource | null) => void; isSessionPerTenantEnabled: () => boolean; shouldLoadEntitlements: () => boolean; getAppName: () => string | null; setEntitlementsOptions: (entitlementsOptions: EntitlementsOptions) => void; setSessionContext: (sessionContext: SessionContext) => void; getBasename: () => string | null; setBasename: (basename: string | null) => void; };