import * as i0 from '@angular/core'; import { TbxSsoUserModel, TbxSsoAuthService } from '@lacera/ngx-toolbox/sso'; import { TbxUrlModel, TbxUrlService } from '@lacera/ngx-toolbox/http'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { Observable } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { Location } from '@angular/common'; /** * Represents information retrieved from the server about the back-end application. */ interface TbxAppModel { /** Gets or sets the application name. */ name: string; /** Gets or sets the application version. */ version: string; /** Gets or sets a value indicating whether the server is in production mode. */ production: boolean; /** Gets or sets the environment region (55, 37, 2, etc.). */ region: number; /** Gets or sets the region short name (Dev, Prod, Train, Dev). */ regionLabel: string; /** Gets or sets the name of the SQL Server being used. */ sqlServer: string; /** Gets or sets the URL to the FileNet P8 server. */ p8ServerUrl?: string; /** Gets or sets the URL of the SSRS Manager. */ ssrsManager?: string; /** Gets or sets the URL of the SSRS Server. */ ssrsServer?: string; /** Gets or sets the name of the SMTP server being used. */ smtpServer?: string; /** Gets or sets the email for the application administrators. */ adminEmails?: string; } /** * Represents information retrieved from the server about the application. */ interface TbxAppStateModel { /** Application information such as title, version, etc. */ application: TbxAppModel; /** Gets or sets a list of all available server endpoints. */ routes: TbxUrlModel[]; /** The currently signed-in user. */ user: TbxSsoUserModel; /** Gets or sets the security token assigned to user by server. */ userToken?: string; /** * Gets or sets the page to display when user is unauthorized. This page * is sent by the server on startup stating the user cannot load the website. */ unauthorizedPage?: string; } interface TbxEnvironment { /** Indicates whether the application is running in production mode */ production?: boolean; /** The application to display throughout the application */ applicationName?: string; /** Indicate whether withCredentials should be included */ withCredentials?: boolean; /** The URL to call on startup to get details for the application */ startupApiUrl?: string; /** * The base HREF specifies a base path for resolving relative URLs to * assets such as images, scripts, and style sheets. This should be * the same path found in index.html * https://angular.io/guide/deployment#the-base-tag */ baseHref?: string; /** * Indicates to the URL service to use the base HREF when composing * URLs to the backend service from the API service. */ useBaseHref?: boolean; /** The application administrators */ adminEmails?: string; } /** * Provides functions to obtain application information such as name, version, etc., * that is retrieved from the server. */ declare class TbxAppStateService { private readonly sanitizer; /** Gets or sets the environment object configured in the project. */ static environment: TbxEnvironment; /** * Gets or sets a value indicating whether the application is running * in production mode. */ static clientProduction: boolean; /** Stores the state to provide it to subscribers. */ private internalState; private readonly stateSubject; constructor(sanitizer: DomSanitizer); /** Gets the application state as an observable. */ get state$(): Observable; /** Gets the back-end server routes. */ get routes(): readonly TbxUrlModel[]; /** Gets the application details. */ get application(): TbxAppModel; /** Get the application name retrieved from the server. */ get applicationName(): string; /** Gets the current user. */ get user(): TbxSsoUserModel; /** Gets a value indicating whether the application is production mode. */ get productionMode(): boolean; /** Get a value indicating whether the user has been authenticated. */ get userAuthenticated(): boolean; /** * Gets the unauthorized page returned by the server to display when the * user does not have access to application. */ get unauthorizedPage(): SafeHtml; /** Gets the application state received from the server. */ get state(): TbxAppStateModel; /** Sets the application state and notifies the subscribers. */ set state(state: TbxAppStateModel); /** * Initializes the default application state. * @param unauthorizedPage The unauthorized page received from the server. * @returns The initialized state. */ static initializeState(unauthorizedPage?: string): TbxAppStateModel; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Retrieves critical information from the back-end on application startup. */ declare class TbxAppStartup { private readonly http; private readonly location; private readonly urlService; private readonly ssoService; private readonly stateService; /** * The number of times to try to get application details from the server. */ retryCount: number; constructor(http: HttpClient, location: Location, urlService: TbxUrlService, ssoService: TbxSsoAuthService, stateService: TbxAppStateService); /** * Initializes the ToolBox services by retrieving application information, * user permissions, and all available endpoints (URLs). * * @param environment The application environment definitions. * @returns A Promise from the HTTP call. */ init(environment: TbxEnvironment): Promise; /** * Updates the services with the information retrieved from the server. * @param environment The application environment definitions. * @param config The configuration retrieved from the server. */ private setServices; private handleError; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const tbxAppInitializer: (environment: TbxEnvironment) => i0.EnvironmentProviders; export { TbxAppStartup, TbxAppStateService, tbxAppInitializer }; export type { TbxAppModel, TbxAppStateModel, TbxEnvironment };