import { Logger } from '@elliemae/pui-diagnostics'; import { Events, ScriptingObjectTypes, IScriptingObjectProxy } from '@elliemae/pui-scripting-object'; import { EventListeners, AddScriptingObjectParams, DispatchEventParam, EventOptions, ScriptingObjects } from '@elliemae/microfe-common'; import { IMicroFEGuest } from './typings/guest.js'; import { OpenAppParams } from './typings/host.js'; import { ValueOf } from './typings/common.js'; /** * AppBridge constructor parameter */ export type AppBridgeParams = { /** * Base url of the application config file * @defaultValue document base url * @example https://encompass.ice.com/ */ appConfigBaseUrl?: string; /** * release version of the product * @defaultValue latest */ version?: string; /** * instance of the pui diagnostics logger */ logger: Logger; /** * Extend parent session when user interacts with the guest application * @defaultValue true */ extendSession?: boolean; }; /** * AppBridge implementation. This class is responsible for creating & managing the Micro FrontEnd Guest instances. It also exposes scripting objects to all the Micro FrontEnd Guests. * @typeParam AppObjects - type of the scripting objects that the application supports * @typeParam AppEvents - type of the events that the application supports */ export declare class CAppBridge, AppEvents extends EventListeners = Events> { #private; /** * Create a new instance of the AppBridge * @param {AppBridgeParams} options - App Bridge constructor parameters */ constructor(options: AppBridgeParams); /** * registers scripting object to the host * @param {ValueOf} so scripting object * @param {AddScriptingObjectParams} params params to add scripting object */ addScriptingObject: >(so: SO, params?: AddScriptingObjectParams) => void; /** * Create new Scripting Object from SSF scripting object proxy * @param proxy - reference to the scripting object obtained through getObject method * @returns cloned version of the scripting object */ cloneScriptingObject: >(proxy: IScriptingObjectProxy) => AppObjects[ObjectId]; /** * Close all active guest micro frontend applications */ closeAllApps: () => Promise; /** * Close guest micro frontend application * @param instanceId unique instance id of the application */ closeApp: (instanceId: string) => Promise; /** * dispatch event to guest microfrontend application * @param {DispatchEventParams} params - event parameters */ dispatchEvent: , Params extends Parameters[0]["eventParams"], Options extends EventOptions>(params: DispatchEventParam) => Promise; /** * Get App by instanceId * @param id unique id of guest * @param instanceId * @returns guest instance */ getApp: (instanceId: string) => T; /** * Get list of active apps * @returns list of active guests */ getApps: () => IMicroFEGuest, Events>[]; /** * Initialize appBridge. * @param preloadedAppConfig - Already-parsed config object. When provided * the bridge skips its own HTTP fetch of app.config.json. */ init: (preloadedAppConfig?: Record) => Promise; /** * Mount guest micro frontend application into DOM * @param instanceId unique instance id of guest micro frontend application * @throws Error if application with given instance id is not found in configuration */ mountApp: (instanceId: string) => Promise; /** * Open guest micro frontend application * @param {OpenAppParams} params - options to open guest application */ openApp: (params: OpenAppParams) => Promise; /** * remove all listeners */ removeAllEventSubscriptions: () => void; /** * removes all scripting objects from host * @param guestId unique id of the guest application */ removeAllScriptingObjects: (guestId?: string) => void; /** * removes scripting object from the host * @param objectId unique id of the scripting object * @param guestId */ removeScriptingObject: (objectId: Extract, guestId?: string) => void; /** * Pre-fetch the manifest for a guest application so that a subsequent * {@link openApp} call can skip the manifest network round-trip. * Safe to call multiple times — results are cached. * @param id application id as defined in app.config.json */ warmUp: (id: string) => void; /** * Unmount guest micro frontend application from DOM * @param instanceId unique instance id of guest micro frontend application * @throws Error if application with given id is not found in configuration */ unmountApp: (instanceId: string) => Promise; }