import { useAdalongWidget } from '../adalongWidget'; import { IDebug, ISettings } from './config'; import { Direction, IWidgetEvents } from './events'; /** * API exposed globally for widget management */ export interface AdalongWidgetAPI { /** List of all widget instances on the page */ widgets: ReturnType[]; /** Currently loaded widget library version */ version?: string; } /** * Widget instance interface for controlling and interacting with a widget */ export interface AdalongWidgetInstance extends Pick { /** Unique widget instance identifier */ id: string; /** Widget layout type */ layout?: ISettings['type']; /** Whether the widget has finished loading */ loaded: boolean; /** Load the widget into a DOM element */ load: (element: string | HTMLElement, settings?: Partial) => Promise; /** Get the state of the carousel slider */ getSlideState: () => { canSlideLeft: boolean; canSlideRight: boolean }; /** Change the currently viewed post */ changePost: (dir: Direction) => void; /** Set the slider direction */ setSlider: (dir: Direction) => void; /** Set debug configuration */ setDebug: (debug: IDebug) => void; /** Set the flag that the user has granted analytics consent */ setHasAnalyticsConsent: (granted: boolean) => void; } /** * Image size descriptor */ export interface ImageSize { w: number; h: number; }