import * as React from 'react';
import { requestActionPostMessage } from "../../common/postMessage.js";
import { IframeContext } from "../context/iframeContext/index.js";
export function usePostMessageEvents() {
    const { iframeElement } = React.useContext(IframeContext);
    return {
        requestPostMessage: (action, data) => {
            if (iframeElement && iframeElement.contentWindow) {
                return requestActionPostMessage(action, data, iframeElement.contentWindow);
            }
            return undefined;
        },
    };
}
//# sourceMappingURL=usePostMessageEvents.js.map
