declare global { interface Window { AppContext : IAppContext ; } } /**
 * Unsubscribes from an dispatcher.
 * Retreived from IDispatcher::Subscirbe function
 */ export type Unsubsciber = ( ) => void ; /**
 * Generic function declaration that receives one typed argument
 */ export type Callback < T > = ( data : T ) => any ; /**
 * Generic key-value object with specific types as values
 */ export type KeyValue < T = any > = { [ key ] : T ; } ; /**
 * Dispatches data events (optional: event data type T. Defaults to "any").
 * Work similar to RxJs.Subject
 */ export interface IDispatcher < T = any > { param callback subscribe ( callback ) : Unsubsciber ; param callback unsubscribe ( callback ) : void ; param data notify ( data ? ) : void ; } /**
 * Information describing the micro application to be loaded
 */ export type AppDescriptor = { /** appId Matching name for the [app-id] attribute on the app-container iframe DOM element */ appId : string ; /** baseUrl URI for retreiving the application content. example: https://my.server.org/someProduct/index.html */ baseUrl : string ; /** optional micro-app specific injection to the window object. */ staticData ? : any ; } ; /**
 * Route information describing a router's state
 */ export type RouteInfo = { /**
     * First-level route
     * Used to determine with micro-app(s) should be activated
     */ base : string ; /**
     * Full path (not including domain)
     */ full : string ; /**
     * Route configuration, defaults to an empty config.
     */ config : RouteConfig ; } ; /**
 * Configuration for a specific route
 */ export type RouteConfig = { /**
     * Active apps for that route
     */ active ? : Array < AppDescriptor > ; /**
     * Inactive apps are UNLOADED and released from the memory.
     * WARNING: Use with caution:
     *   when there are cross references between the shell and the micro-app,
     *   or references from another micro-app to an object within the unloaded micro-app,
     *   the behavior is unstable and can cause severe runtime errors.
     */ inactive ? : Array < AppDescriptor > ; } ; /**
 * Asynchronous checking if a route can be changed, used ONLY when the routing is done via Router::navigate
 * NOTE:
 *   Independent navigation triggered from a micro-app without calling Router::navigate will NOT be
 *   verified by guards.
 */ export interface RouteGuard { check : ( info : { from : RouteInfo ; to : RouteInfo ; } ) => Promise < boolean > ; } /**
 * Router used in the Microfronts orchestrator
 */ export interface IRouter extends IDispatcher < RouteInfo > { /**
     * Until initialized, router may not work properly.
     * Initializing the router should be executed after the registration of routes.
     */ init ( ) : void ; param target markDOM ( target ? ) : void ; /**
     * Listens to route changes on the window.
     * If a user manually updates the route, the router will react and propagate the change to the app-containers.
     */ watchRoot ( ) : void ; param base param routeConfig see RouteConfig registerRoute ( base , routeConfig ) : void ; param guard see RouteGuard addGuard ( guard ) : void ; param guard see RouteGuard removeGuard ( guard ) : void ; param path navigate ( path ) : Promise < boolean > ; /**
     * Current application route
     */ currentRoute : RouteInfo ; } /**
 * The application context is injected to all app-containers and accessible in all loaded modules.
 * The appContext enables applications communicate, pass objects, promises and callbacks.
 */ export interface IAppContext { /**
     * Retreives a shared object by name
     */ get < T = any > ( name ) : T ; /**
     * Sets a shared object by name. Can be retreived anywhere using IAppContext::get
     */ set ( name , value ) : void ; /**
     * Retreives a shared object, asynchronously. The promise will be resolved one a corresponding provide will be triggered.
     * Useful for accessing objects from other modules that may be loaded in the future, or for asynchronous tasks.
     */ require < T = any > ( name ) : Promise < T > ; /**
     * Provides a shared object, asynchronously. Fulfills any require called in the past or the future with a value.
     */ provide ( name , value ) : void ; /**
     * Access to the micro-frontends router
     */ readonly router : IRouter ; } ignore export interface IAppContainer { load ( appDescriptor ) : void ; unload ( ) : void ; enable ( ) : void ; disabled ( ) : void ; }