"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.usePostMessageEvents = usePostMessageEvents;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const postMessage_1 = require("../../common/postMessage.js");
const iframeContext_1 = require("../context/iframeContext/index.js");
function usePostMessageEvents() {
    const { iframeElement } = React.useContext(iframeContext_1.IframeContext);
    return {
        requestPostMessage: (action, data) => {
            if (iframeElement && iframeElement.contentWindow) {
                return (0, postMessage_1.requestActionPostMessage)(action, data, iframeElement.contentWindow);
            }
            return undefined;
        },
    };
}
//# sourceMappingURL=usePostMessageEvents.js.map
