import { EntitledToOptions, Entitlement, FronteggStore, IsSteppedUpOptions, StepUpOptions } from '@frontegg/redux-store'; import { FronteggAppOptions, FronteggCheckoutDialogOptions, LoadEntitlementsCallback, LocalizationsOverrides, ShowAdminPortalOptions, SwitchTenantOptions, UseInviteUserDialogStoreOptions, UseTableStoreOptions, CMCComponentProps } from '@frontegg/types'; import { FetchClient, FronteggApiClient, IFeatureFlagsAttributes } from '@frontegg/rest-api'; import { CustomAttributes } from '@frontegg/entitlements-javascript-commons'; type FronteggAppContainers = { adminPortalEl: HTMLElement; loginBoxEl: HTMLElement; checkoutDialogEl: HTMLElement; adminPortalContainer: HTMLElement; loginBoxContainer: HTMLElement; checkoutDialogContainer: HTMLElement; }; export declare class FronteggApp { readonly name: string; readonly iframeRendering: boolean; options: FronteggAppOptions; loading: boolean; cdnUrl: string; assetsUrl: string; customElementName: string; adminPortalEl?: HTMLElement; adminPortalRenderer?: any; loginBoxEl?: HTMLElement; checkoutDialogEl?: HTMLElement; checkoutDialogRenderer?: any; adminPortalContainer?: HTMLElement; loginBoxContainer?: HTMLElement; checkoutDialogContainer?: HTMLElement; loginBoxRenderer?: any; store: FronteggStore; loadingListeners: (() => void)[]; fetchClient: FetchClient; apiClient: FronteggApiClient; updateLocalizations?: (localizations: LocalizationsOverrides) => void; constructor(_options: FronteggAppOptions, name: string, iframeRendering?: boolean, allowMultipleRenderers?: boolean); /** * Set entitlements related options in context holder according to frontegg options * @param entitlementsOptions - entitlements options from frontegg options */ private setEntitlementsOptions; private setSessionContext; private dispatchErrorByRequestName; loadAdminBoxMetadata: () => Promise; /** * Loading required information on first load, mainly for refresh token and initial data. * In case of hosted login - we let the user decide if he wants to load the user on first load or keep the old behaviour of loading * The user by loginWithRedirect on demand. This param loadUserOnFirstLoad is mainly to not breaking an API and give 2 options. */ requestAuthorize: () => Promise; loadFeatureFlags: () => Promise; /** * @internal use loadFeatureFlags instead * @description need for testing on dashboard builder * @param previewFeatureFlags */ setFeatureFlagsForPreview: (previewFeatureFlags: IFeatureFlagsAttributes) => void; /** * @param flags keys to check * @returns an array of feature flags on/off boolean values */ queryFeatureFlags: (flags: string[]) => boolean[]; initContainers(elements: FronteggAppContainers): Promise; updateLocalizationsSetter: (localizationUpdateFn: (localizations: LocalizationsOverrides) => void) => void; updateMetadata(metadata: FronteggAppOptions['metadata']): void; addOnLoadedListener(listener: () => void): void; ready(listener: () => void): void; loginWithRedirect(additionalParams?: Record): void; loginWithRedirectV2(payload?: { additionalParams: Record; shouldRedirectToLogin?: boolean; firstTime?: boolean; }): void; logout(callback?: () => void): void; loadScript(component: string): Promise; loadLoginBox(): Promise; showAdminPortal(options?: ShowAdminPortalOptions): Promise; /** * Open the hosted portal must be called synchronously with user interaction * * @param newTab - open the portal in a new tab = true */ openHostedAdminPortal(newTab?: boolean): void; hideAdminPortal(): void; showCheckoutDialog(opts: FronteggCheckoutDialogOptions): Promise; hideCheckoutDialog(): void; /** * @returns entitlements store data */ private getEntitlementsFromStore; /** * @returns user store data */ private getUserFromStore; /** * @param customAttributes consumer attributes * @returns is entitled query data including: entitltments state, final attributes (consumer and frontegg) and API version to use */ private getEntitlementsQueryData; /** @param key feature key @param customAttributes user attributes @returns if the user is entitled to the given feature. Attaching the justification if not @throws when entitlement is not enabled via frontegg options */ getFeatureEntitlements(key: string, customAttributes?: CustomAttributes): Entitlement; /** @param key permission key @param customAttributes user attributes @returns if the user is entitled to the given permission. Attaching the justification if not @throws when entitlement is not enabled via frontegg options */ getPermissionEntitlements(key: string, customAttributes?: CustomAttributes): Entitlement; /** @param options - including permission or feature key @param customAttributes user attributes @returns if the user is entitled to the given permission or feature. Attaching the justification if not @throws when entitlement is not enabled via frontegg options */ getEntitlements(options: EntitledToOptions, customAttributes?: CustomAttributes): Entitlement; /** * Load entitlements * @param callback called on request completed with true if succeeded, false if failed */ loadEntitlements(callback?: LoadEntitlementsCallback): void; /** * Redirects to the step up page with the max age param and set the redirect url in the local storage * @param options.maxAge optional max age */ stepUp(options?: StepUpOptions): void; /** * @param options.maxAge optional max age * @return true when user is stepped up, false otherwise */ isSteppedUp(options?: IsSteppedUpOptions): boolean; /** * Switch tenant * @param payload.tenantId tenant id to switch for * @param payload.callback optional callback to be called with true / false for success / failure tenant switching operation */ switchTenant(payload: SwitchTenantOptions): void; close(): void; private createCMCRenderOptions; renderUsersTable: (container: HTMLElement, props: any, options: Partial) => Promise; renderInviteUserDialog: (container: HTMLElement, props: any, options: Partial) => Promise; renderChangePasswordForm: (container: HTMLElement, props: any, options: Partial) => Promise; renderProfilePage: (container: HTMLElement, props: any, options: Partial) => Promise; renderEditEmailForm: (container: HTMLElement, props: any, options: Partial) => Promise; renderSsoGuideDialog: (container: HTMLElement, props: any, options: Partial) => Promise; getUsersTableStore: (options: UseTableStoreOptions) => Promise; getInviteUserDialogStore: (options: UseInviteUserDialogStoreOptions) => Promise; getSsoGuideDialogStore: (options: any) => Promise; } export {};