export type IframeOptions = { /** * The width of the iframe. * * @example "500px" */ width: `${number}px`; /** * The height of the iframe. * * @example "500px" */ height: `${number}px`; /** * Message handler for messages sent from the iframe. * * @param message - The message sent from the iframe. * @param hideIframe - Function to hide the iframe. * @param sendMessage - Function to send a message to the iframe. * */ onMessage?: (message: unknown, { hideIframe, sendMessage }: { hideIframe: () => void; sendMessage: (message: unknown) => void; }) => void; } & ({ /** * The url that will be loaded in the iframe. */ url: string; } | { /** * The html that will be loaded in the iframe. */ html: string; /** * Initial data that will be sent to the iframe. iframe code can access * this data from global `window.ATTIO_INITIAL_DATA` object. */ initialData?: unknown; }); /** * Shows a iframe to the user with given html or url. * * @returns A promise that resolves when the iframe is closed. * * @throws If the iframe cannot be shown. * * @example * showIframe({ * url: "https://www.example.com", * width: "500px", * height: "300px", * onMessage: (message, {hideIframe, sendMessage}) => { * if (message.type === "close") { * hideIframe() * } * }, * }) * * @example * showIframe({ * html: "