import { IDirectiveFactory, IDirectiveLinkFn } from 'angular'; import { Store, IBranch } from '../../store'; import { Builder } from './builder'; import { App, IMenuItem } from './app'; import { ServerFrameworkType } from '../../store/services/store-logger'; import * as React from 'react'; export type IComponentFactory = (app: App, store: Store) => IDirectiveFactory; export type IReactComponentFactory = () => IReactComponentConfig; export type IStateComponentFactory = (app: App, store: Store) => IStateComponentConfig; export type IStateFactory = (app: App, store: Store) => object; export type IBranchFactory = (app: App) => IBranch; export interface IPluginComponent { name: string; factory: IComponentFactory; } export interface IPluginReactComponent { name: string; factory: IReactComponentFactory; } export interface IPluginBranches { branches: { [key: string]: IBranchFactory; }; logUrl: string; server?: ServerFrameworkType; } export type IUrlParamListener = Function | { from: Function; to: Function; }; export type IScopeListener = (scope: any, current: any, previous: any, store: Store) => any; interface IScopeListeners extends Record { } export interface IStateComponentConfigBase { name: string; abstract?: boolean; url: { [key: string]: IUrlParamListener; }; scope: IScopeListeners; options?: Record; controller(scope: any, params: { [key: string]: any; }, api: { syncUrl(getArgs?: () => any): any; setTitle(getTitle?: (args: { appTitle?: string; stateName?: string; }) => string[]): any; }): any; onEnter?(): any; onExit?(): any; } export interface IAngularStateComponentConfig extends IStateComponentConfigBase { template: string; link: IDirectiveLinkFn; } export interface IReactStateComponentConfig extends IStateComponentConfigBase { template: React.ComponentType; } export type IStateComponentConfig = IAngularStateComponentConfig | IReactStateComponentConfig; export interface IReactComponentConfig { name: string; scope: string[]; template: React.ComponentType; } /** * A subset of Builder which is exposed to plugin factories */ export declare class PluginBuilder { private readonly id; private readonly builder; private readonly pluginStates; private readonly pluginComponents; private readonly pluginReactComponents; private readonly pluginStateComponents; private pluginBranches; constructor(id: string, builder: Builder); /** * Registers a ui-router state * * @param options ui-router state options */ state(options: Object): PluginBuilder; /** * Registers ui-router states * * @param states ui-router states */ states(states?: { [name: string]: IStateFactory; }): any[] | this; /** * Registers a react component * * @param name component name * @param factory component factory */ reactComponent(name: string, factory: IReactComponentFactory): PluginBuilder; /** * Registers react components * * @param components components */ reactComponents(components?: { [name: string]: IReactComponentFactory; }): this | IPluginReactComponent[]; /** * Registers an angular directive * * @param name component name * @param factory component factory */ component(name: string, factory: IComponentFactory): PluginBuilder; /** * Registers angular directives * * @param components directives */ components(components?: { [name: string]: IComponentFactory; }): this | IPluginComponent[]; /** * Registers a react state component * * @param factory component factory */ stateComponent(factory?: IStateComponentFactory): this; /** * Registers a react state components * * @param stateComponents components */ stateComponents(stateComponents?: { [name: string]: IStateComponentFactory; }): this | IStateComponentFactory[]; /** * Registers store branches * * @param branches store branches * @param logUrl log url * @param server */ store(branches?: Record, logUrl?: string, server?: ServerFrameworkType): this | IPluginBranches; modules(modules: any): this; menuItem(item: IMenuItem): this; getUser(): import("./user").User; getId(): string; /** * Subscribes to application ready event * * @param fn will be called with app's instance after app.build() was called */ ready(fn: (app: App) => any): void; /** * Subscribes to application ready event per plugin * * @param fn will be called with app's instance after app.build() was called */ onPluginReady(fn: (app: App, store: Store) => any): void; } export {};