import { default as AnalyticsApi } from '../api/AnalyticsApi'; import { default as WidgetApi } from '../api/WidgetApi'; import { EngagementMedium, WidgetContext, WidgetType } from '../types'; export interface Params { type: WidgetType; domain: string; npmCdn: string; content: string; api: WidgetApi; rsCode?: string; context: WidgetContext; container?: string | HTMLElement | null | undefined; } export type ProgramLoadEvent = { programId: string; tenantAlias?: string; accountId?: string; userId?: string; engagementMedium?: EngagementMedium; }; export type GenericLoadEvent = { mode: any; analytics: any; }; export type WidthSetting = { value: number; unit: "px" | "%"; }; export type WidgetWidths = { minWidth: WidthSetting; maxWidth: WidthSetting; }; export default abstract class Widget { type: WidgetType; content: string; analyticsApi: AnalyticsApi; widgetApi: WidgetApi; context: WidgetContext; npmCdn: string; container: string | HTMLElement | undefined | null; loadEventListener: EventListener | null; protected constructor(params: Params); _findElement(): HTMLElement; _createFrame(options?: { minWidth?: string; maxWidth?: string; }): HTMLIFrameElement; _findFrame(): HTMLIFrameElement | null; abstract load(): void; protected _detachLoadEventListener(frameDoc: Document): void; protected _attachLoadEventListener(frameDoc: Document, sqh: ProgramLoadEvent | GenericLoadEvent): void; protected _loadEvent(sqh: ProgramLoadEvent | GenericLoadEvent): void; protected _shareEvent(sqh: any, medium: any): void; protected _error(rs: any, mode?: string, style?: string): string; protected _findInnerContainer(frame: HTMLIFrameElement): Promise; /** * Reloads the current widget, makes updated request to API and renders result. * Primarily for Classic widgets with registration * @param param0 Form field values * @param jwt JWT for API authentication */ reload({ email, firstName, lastName }: { email: any; firstName: any; lastName: any; }, jwt: any): void; private __deprecated__register; }