/** * This file contains the Initialiser class, which is responsible for initializing various components and configurations * required for the application to run. It includes methods for setting up routing, services, environment information, * and other core functionalities. The Initialiser class also provides methods for launching views, portals, and mashups, * as well as importing necessary assets and configurations. * * Key functionalities include: * - Initializing routing, action target models, and services. * - Fetching bootstrap configuration from the server. * - Initializing core containers and configurations. * - Importing React root and design system component maps. * - Building semantic URLs. * - Launching views, portals, and mashups. * - Registering for debug information and toggling tracer headers. * - Loading environment information. * * This class is essential for setting up and managing the application's core infrastructure and ensuring that all necessary * components and configurations are properly initialized and ready for use. */ import type { CookieComplianceMethod } from '../environment-info/types'; import { type ConfigurationType } from './configurations'; /** * The Initialiser class is responsible for initializing various components and configurations * required for the application to run. It includes methods for setting up routing, services, * environment information, and other core functionalities. */ declare class Initialiser { #private; /** * Initializes the application with the provided configuration. * @function * @param configObj - The configuration object containing various settings and parameters. * @example * const config = { ... }; * initialiser.init(config); * @returns void */ init(configObj: ConfigurationType): void; /** * Fetches the bootstrap configuration from the server. * @function * @param restServerUrl - The URL of the REST server to fetch the configuration from. * @param tokenInfo - An object containing the token type and access token for authorization. * @returns A promise that resolves with the bootstrap configuration data. * @example * const restServerUrl = 'https://example.com'; * const tokenInfo = { token_type: 'Bearer', access_token: 'abc123' }; * initialiser.getBootstrapConfig(restServerUrl, tokenInfo).then(config => console.log(config)); */ getBootstrapConfig: (restServerUrl: string, tokenInfo: { token_type: string; access_token: string; }) => Promise; /** * Initializes core containers with the specified options. * @function * @param options - An object containing options for initializing core containers. * @returns An object containing the getPConnect function. * @example * const options = { containerType: 'single' }; * const coreContainers = initialiser.initCoreContainers(options); * console.log(coreContainers.props.getPConnect()); */ initCoreContainers: (options?: { containerType?: string; }) => { props: { getPConnect: () => any; }; }; /** * Imports the React root component. * @function * @returns A promise that resolves when the React root component is imported. * @example * initialiser.importReactRoot().then(() => console.log('React root imported')); */ importReactRoot: () => Promise; /** * Imports the design system component map. * @function * @param appStaticContentServer - The URL of the static content server. * @param environmentId - The ID of the environment. * @param alternateDesignSystemName - The name of the alternate design system. * @returns A promise that resolves when the design system component map is imported. * @example * const serverUrl = 'https://static.example.com'; * const envId = 'env123'; * const designSystemName = 'alternateDS'; * initialiser.importDesignSystemComponentMap(serverUrl, envId, designSystemName).then(() => console.log('Design system imported')); */ importDesignSystemComponentMap: (appStaticContentServer: string, environmentId: string, alternateDesignSystemName: string) => Promise; /** * Builds a semantic URL based on the provided parameters. * @function * @param constellationPathInfo - The path information for the constellation. * @param queryParams - The query parameters to include in the URL. * @param noPortal - A flag indicating whether the portal should be excluded. * @param restServer - The URL of the REST server. * @param viewName - The name of the view to include in the URL. * @returns The constructed semantic URL as a string. * @example * const pathInfo = '/case123'; * const queryParams = new URLSearchParams({ key: 'value' }); * const noPortal = 'true'; * const restServer = 'https://api.example.com'; * const viewName = 'view123'; * const url = initialiser.buildSemanticUrl(pathInfo, queryParams, noPortal, restServer, viewName); * console.log(url); */ buildSemanticUrl: (constellationPathInfo: string, queryParams: URLSearchParams, noPortal: string, restServer: string, viewName: string) => string; /** * Initializes the core configuration with the provided configuration object. * @function * @param config - The configuration object containing various settings and parameters. * @example * const config = { ... }; * initialiser.initCoreConfig(config); * @returns void */ initCoreConfig: (config: ConfigurationType) => void; /** * Launches a view by name. * @function * @param targetDom - The target DOM element where the view will be rendered. * @param viewName - The name of the view to launch. * @param portalName - The name of the portal associated with the view. * @param viewClass - The class of the view to launch. * @param additionalComponents - Additional components to include in the view. * @param portalTarget - The target element for the portal. * @param styleSheetTarget - The target element for the stylesheet. * @param containerTargetName - The name of the container target. * @example * const targetDom = 'app-root'; * const viewName = 'HomeView'; * const portalName = 'MainPortal'; * const viewClass = 'HomeViewClass'; * const additionalComponents = { component1: {}, component2: {} }; * const portalTarget = 'portal-root'; * const styleSheetTarget = 'style-root'; * const containerTargetName = 'homeContainer'; * initialiser.launchViewByName(targetDom, viewName, portalName, viewClass, additionalComponents, portalTarget, styleSheetTarget, containerTargetName); * @returns void */ launchViewByName: (targetDom: string, viewName: string, portalName: string, viewClass: string, additionalComponents: string[], portalTarget: string, styleSheetTarget: string, containerTargetName: string) => void; /** * Launches a view into a target DOM element. * @function * @param targetDom - The target DOM element where the view will be rendered. * @param viewMetadata - Metadata for the view being loaded. * @param preLoadComponents - (Optional) List of components to preload. * @param runtimeParams - (Optional) Runtime parameters for the view. * @param portalTarget - (Optional) The target element for the portal. * @param styleSheetTarget - (Optional) The target element for the stylesheet. * @param containerTargetName - The name of the container target. * @example * const targetDom = 'app-root'; * const viewMetadata = { name: 'HomeView', config: { ... } }; * const preLoadComponents = ['Component1', 'Component2']; * const runtimeParams = { param1: 'value1' }; * const portalTarget = 'portal-root'; * const styleSheetTarget = 'style-root'; * const containerTargetName = 'homeContainer'; * initialiser.launchView(targetDom, viewMetadata, preLoadComponents, runtimeParams, portalTarget, styleSheetTarget, containerTargetName); * @returns void */ launchView: (targetDom: string, viewMetadata: { [key: string]: any; }, preLoadComponents: string[] | undefined, runtimeParams: { [key: string]: any; }, portalTarget: string, styleSheetTarget: string, containerTargetName: string) => void; /** * Launches a portal in constellation. * @function * @param targetDom - The target DOM element where the portal will be rendered. * @param portalName - The name of the portal to launch. * @param containerTargetName - The name of the container target. * @param preLoadComponents - Additional components to preload. * @returns A promise that resolves when the portal is launched. * @example * const targetDom = 'app-root'; * const portalName = 'MainPortal'; * const containerTargetName = 'portalContainer'; * const preLoadComponents = ['Component1', 'Component2']; * initialiser.launchPortal(targetDom, portalName, containerTargetName, preLoadComponents).then(() => console.log('Portal launched')); */ launchPortal: (targetDom: string, portalName: string, containerTargetName?: string, preLoadComponents?: string[]) => Promise; /** * Launches a mashup/embed for constellation. * @function * @param targetDom - The target DOM element where the mashup will be rendered. * @param usePegaMashupStyling - Whether to apply Pega mashup styling. * @example * const targetDom = 'app-root'; * const useStyling = true; * initialiser.launchMashup(targetDom, usePegaMashupStyling); * @returns void */ launchMashup: (targetDom: string, usePegaMashupStyling?: boolean) => void; /** * Initiates the bootstrapping of constellation. * @function * @param config - The configuration object containing various settings and parameters. * @param callback - A callback function to handle the completion of the bootstrapping process. * @returns A promise associated with the bootstrapping action. * @example * const config = { ... }; * const callback = () => console.log('Bootstrapping complete'); * initialiser.start(config, callback).then(() => console.log('Start complete')); */ start: (config: any, callback: () => void) => Promise; /** * Registers for debug information and sets the application to preview mode. * @function * @param channel - The BroadcastChannel used to post debug information. * @example * const channel = new BroadcastChannel('debugChannel'); * initialiser.registerForDebugInfo(channel); * @returns void */ registerForDebugInfo: (channel: { [key: string]: any; }) => void; /** * Toggles the tracer headers based on messages received through the channel. * @function * @param channel - The BroadcastChannel used to toggle tracer headers. * @example * const channel = new BroadcastChannel('tracerChannel'); * initialiser.toggleTracerHeaders(channel); * @returns void */ toggleTracerHeaders: (channel: BroadcastChannel) => void; /** * Loads environment information based on the provided configuration. * @function loadEnvironmentInfo * @param config - Configuration object containing environment information. * @param config.theme - Theme information. * @param config.theme.definition - Definition of the theme in JSON format. * @param config.keyMapping - Key mapping information. * @param config.cookieComplianceMethod - Method for cookie compliance. * @example * const config = { * theme: { definition: '{"Branding": {}, "Theme": {}}' }, * keyMapping: { ... }, * cookieComplianceMethod: 'strict' * }; * initialiser.loadEnvironmentInfo(config).then(() => console.log('Environment info loaded')); * @returns Promise */ loadEnvironmentInfo: (config: { theme: { definition: string; }; keyMapping: any; cookieComplianceMethod: CookieComplianceMethod; }) => Promise; } declare const _default: Initialiser; export default _default;