type MessageHandler = (event: MessageEvent<unknown>) => void;
type OriginFilteredMessageHandler = {
    origin: string;
    handler: MessageHandler;
};
type ActionMessageHandler = (payload: any) => void;
type ActionMessageHandlerDeclaration = {
    origin?: string;
    handlers: Record<string, ActionMessageHandler>;
};
type IncomingPostMessageOptions = MessageHandler | OriginFilteredMessageHandler | ActionMessageHandlerDeclaration;
/**
 * A hook for handling incoming postMessage events.
 *
 * Can be used in three ways, based on your requirements:
 * 1. Raw handler: Direct access to MessageEvent
 * 2. Origin-filtered handler: Only handle messages from specific origin
 * 3. Action-based handlers: Route messages by type and extract payloads
 *
 * The idea behind action-based handlers is that you can declaratively define listeners that only react to specific
 * events that belong to a specific `type` of message event when the event looks like a {@link ActionMessage}.
 *
 * @param options Configuration object or function defining how to handle messages
 *
 * @example
 * // Raw handler
 * useIncomingPostMessages((event) => {
 *   console.log('Received:', event.data);
 * });
 *
 * @example
 * // Origin-filtered handler
 * useIncomingPostMessages({
 *   origin: 'https://trusted-domain.com',
 *   handler: (event) => console.log('From trusted origin:', event.data)
 * });
 *
 * @example
 * // Action-based handlers
 * useIncomingPostMessages({
 *   origin: 'https://widget-domain.com', // optional, defaults to '*'
 *   handlers: {
 *     'WIDGET_READY': () => setWidgetReady(true), // actions without payload are possible, too
 *     'WIDGET_DATA': (payload) => setData(payload), // utilizing the payload
 *   }
 * });
 */
declare const useIncomingPostMessages: (options: IncomingPostMessageOptions) => void;
export default useIncomingPostMessages;
