import { AdvantageMessage, AdvantageMessageAction, AdvantageFormatName } from '../../types'; export { AdvantageMessageAction, AdvantageFormatName }; /** * AdvantageCreativeMessenger is the class that should be used in creative ads to communicate with Advantage on the publisher side. This class is used to request formats and other information from the parent website. * @public * * @example * Here's an example on how to request a format from the parent website and then start the ad when the format is confirmed: * * ::: code-group * ```typescript * const advantageMessenger = new AdvantageCreativeMessenger(); * const session = await advantageMessenger.startSession(); * * if (session) { * // Request the midscroll format * const response = await advantageMessenger.sendMessage({ * action: AdvantageMessageAction.REQUEST_FORMAT, * format: AdvantageFormatName.Midscroll * }); * // The format is confirmed, start the ad * if (response?.action === AdvantageMessageAction.FORMAT_CONFIRMED) { * document.body.classList.add("midscroll"); * } * } else { * console.log("Session failed to start"); * } * ``` * ```javascript * const advantageMessenger = new AdvantageCreativeMessenger(); * advantageMessenger.startSession().then((confirmed) => { * if (confirmed) { * advantageMessenger.sendMessage({ * action: "REQUEST_FORMAT", * format: "MIDSCROLL" * }).then((response) => { * if (response.action === "FORMAT_CONFIRMED") { * // The format is confirmed, start the ad * document.body.classList.add("midscroll"); * } * }); * } else { * console.log("Session failed to start"); * } * }); * ``` */ export declare class AdvantageCreativeMessenger { #private; constructor(); startSession(): Promise; sendMessage(message: Partial): Promise; onMessage(callback: (message: AdvantageMessage) => void): void; setupWaypoints(waypoints: HTMLElement[]): { disconnect: () => void; }; listenToWaypoints(onWaypointTrigger: (waypointId: string, isIntersecting: boolean) => void): { disconnect: () => void; }; }