dodopayments-checkout
Version:
A TypeScript library for embedding Dodo Payments checkout (overlay and inline).
42 lines (41 loc) • 1.42 kB
TypeScript
/**
* Event handling system for checkout process
*/
import { CheckoutState, EventType, DodoCheckoutWebSDK } from "./types";
declare global {
interface Window {
DodoCheckoutWebSDK?: DodoCheckoutWebSDK;
}
}
/**
* Set checkout state reference for the event module
*/
export declare function setCheckoutState(state: CheckoutState | null): void;
/**
* Get current checkout state
*/
export declare function getCheckoutState(): CheckoutState | null;
/**
* Recompute the inline wrapper height as the checkout iframe height plus the
* wallet element's height. Driven both by iframe-resizer (checkout iframe
* resizes) and a ResizeObserver on the wallet container, so the height stays
* correct even when the wallet element appears or resizes after the checkout
* iframe has already stabilized (otherwise the wallet buttons get clipped).
*/
export declare function applyWalletWrapperHeight(): void;
/**
* Handle incoming postMessage events from the checkout iframe
*/
export declare function handleMessage(event: MessageEvent): void;
/**
* Emit an event to all registered handlers
*/
export declare function emitEvent(eventType: EventType, data?: Record<string, unknown>): void;
/**
* Close the checkout iframe
*/
export declare function closeCheckout(shouldEmitEvent?: boolean): void;
/**
* Set up message listener for iframe communication
*/
export declare function setupMessageListener(): void;