import { AdvantageFormatName, IAdvantageUILayer, IAdvantageWrapper, AdvantageMessage } from '../types'; import { AdvantageAdSlotResponder } from './messaging/publisher-side'; /** * Represents the AdvantageWrapper class, which extends the HTMLElement class and implements the IAdvantageWrapper interface. * This class is responsible for creating and managing the wrapper element for Advantage ads. * @noInheritDoc */ export declare class AdvantageWrapper extends HTMLElement implements IAdvantageWrapper { #private; static readonly DISCONNECT_TIMEOUT_MS = 100; allowedFormats: string[] | null; container: HTMLDivElement; content: HTMLDivElement; uiLayer: IAdvantageUILayer; currentFormat: AdvantageFormatName | string; messageHandler: AdvantageAdSlotResponder; simulating: boolean; /** * Creates an instance of AdvantageWrapper. */ constructor(); /** * Gets the content nodes assigned to the advantage-ad-slot. * @returns An array of content nodes. */ get contentNodes(): Node[]; /** * Simulates a specific ad format. * @param format - The format to simulate. */ simulateFormat: (format: string) => Promise; /** * Restrict this wrapper to the given list of formats. * Calling this method overrides any list previously set via attribute or API. * @param formats Array of format names that are allowed for this wrapper. */ setAllowedFormats(formats: string[]): void; /** * Clears the programmatic whitelist so the wrapper falls back to attribute or default behaviour. */ clearAllowedFormats(): void; /** * Morphs the wrapper into a specific ad format. * If `allowed-formats` is set (via attribute or API) it takes precedence over `exclude-formats`. * Comparisons are case-insensitive. * @param format - The format to morph into. * @param sessionID - The session ID for the ad. * @param backgroundAdURL - The URL for the background ad. * @returns A promise that resolves when the morphing is complete. */ morphIntoFormat: (format: AdvantageFormatName | string, message?: AdvantageMessage) => Promise; /** * Forces a specific ad format without waiting for a message from the iframe. * This allows publishers to directly control which format to display. * * @param format - The format to apply * @param iframe - The iframe element to use for the ad (optional) * @param options - Additional options to pass to the format's setup function * @returns A promise that resolves when the format has been applied */ forceFormat: (format: AdvantageFormatName | string, iframe?: HTMLIFrameElement, options?: any) => Promise; /** * Changes the content of the wrapper. * @param content - The new content to be added to the wrapper. */ changeContent(content: string | HTMLElement): void; /** * Resets the current ad format. */ reset(): void; animateClose(callback?: () => void): void; /** * Closes the current ad format. */ close(): void; /** * Applies styles to all child elements of the wrapper. * @param styles - The CSS styles to apply. */ applyStylesToAllChildElements(styles: string): void; /** * Inserts CSS into the shadow root of the wrapper. * @param CSS - The CSS to insert. */ insertCSS(CSS: string): void; /** * Resets the CSS in the shadow root of the wrapper. */ resetCSS(): void; /** * Lifecycle method called when the element is disconnected from the DOM. * Uses a timeout to distinguish between temporary removal and actual cleanup. */ disconnectedCallback(): void; /** * Lifecycle method called when the element is connected to the DOM. * Clears the disconnect timeout if the element reconnects quickly. */ connectedCallback(): void; }