///
import type BaseEventEmitter from 'events';
import { Consumer } from 'magic-transport';
import type { Size, Promisify } from '../types';
import type { IFrameProviderAPI } from './provider';
import { IFrameResizer } from './consumer-resizer';
/**
* Configuration of the consumer inside an iframe
*/
export interface IFrameConsumerConfig {
/** Widget initialization function, should render the application */
initialize(this: IFrameConsumer): void;
/** Factory that exports a facade available externally to the widget user */
externalize?(this: IFrameConsumer): void;
/** Factory that exports a facade available to the widget */
externalizeAsConsumer?(this: IFrameConsumer): void;
}
/**
* Consumer facade available to the widget
*/
export interface IFrameConsumerAPI extends Record {
initialize(this: IFrameConsumer): void;
externalizedProps: Record;
getSize(): Size;
watchSize(): void;
resize(): void;
}
/**
* Consumer inside an iframe
*/
export declare class IFrameConsumer {
id: string;
resizer: IFrameResizer;
transport: Consumer;
consumer: BaseEventEmitter & IFrameConsumerAPI;
provider: Promisify;
private config;
private properties;
private parentUrl?;
private parentOrigin?;
/**
* Constructor
*
* @param config Configuration
* @param properties Additional properties
*/
constructor(config: IFrameConsumerConfig, properties?: Record);
parseId(): string;
/**
* Factory that exports a facade available externally to the widget (for the webmaster)
*/
externalize(): Record;
/**
* Factory that exports a facade available to the widget
*/
externalizeAsConsumer(): {
initialize: () => void;
externalizedProps: Record;
getSize: () => {
width: number;
height: number;
};
watchSize: () => void;
resize: () => void | undefined;
};
}
/**
* Iframe registration
*
* @param config Configuration
* @param properties Additional properties
*/
export declare function registerIFrame(config: IFrameConsumerConfig, properties?: Record): IFrameConsumer;