@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
42 lines (40 loc) • 1.55 kB
TypeScript
import { HookEvents, Options, PostMessageAction, ViewModel } from '../types/types';
import { EventEmitter } from '../hooks/eventEmitter';
export type IframeOptions = {
className: string;
title: string;
};
export declare const DEFAULT_OPTIONS: IframeOptions;
export declare const assertValidFunction: (candidate: Function) => void;
declare class Iframe extends EventEmitter<HookEvents> {
containerElement: HTMLElement;
verificationUrl: URL;
isMobileDevice: boolean;
iframe: HTMLIFrameElement;
verificationIframeUid: string;
locale: string;
hasLoaded: boolean;
onLoadEvents: Function[];
onCleanupEvents: (() => void)[];
installType: string;
constructor(containerElement: HTMLElement, url: string);
cleanup(): void;
static createUniqueId(): string;
static isValidHttpUrl(urlString: string): boolean;
createIframe(options: IframeOptions): HTMLIFrameElement;
getIframeUrl(): string;
addOnLoadEvent(callback: Function): void;
onLoad(): void;
/**
* Using this to add parent window message listeners gives us
* - Event Cleanup for modals
* - verification of origin, verificationIframeUid, and message data structure
*/
addWindowMessageListener(actionCb: (action: PostMessageAction) => void): void;
addActionListener(): void;
setViewModel(viewModel: Partial<ViewModel> | ViewModel): void;
setOptions(options: Options): void;
setInstallType(installType: string): void;
init(createIframe?: boolean): void;
}
export default Iframe;