/** * Shared wire protocol for the iframe-resize parent/child pair. * * Both ends are part of this codebase, so we use a private, namespaced * postMessage protocol rather than matching any third-party format. Every * message carries `kind: MSG_PREFIX` so unrelated postMessages are ignored. * * Keep this file in sync with the copy bundled into the checkout child app. */ /** Namespacing marker present on every message we send/accept. */ export declare const MSG_PREFIX: "[dodo-iframe-resize]"; export type Direction = "vertical" | "horizontal" | "both" | "none"; /** Messages the child sends up to the parent window. */ export type ChildToParentMessage = { kind: typeof MSG_PREFIX; type: "child-ready"; } | { kind: typeof MSG_PREFIX; type: "size"; height: number; width: number; } | { kind: typeof MSG_PREFIX; type: "message"; message: unknown; }; /** Messages the parent sends down to the child window. */ export type ParentToChildMessage = { kind: typeof MSG_PREFIX; type: "parent-ping"; } | { kind: typeof MSG_PREFIX; type: "parent-ack"; } | { kind: typeof MSG_PREFIX; type: "message"; message: unknown; };