import { useDispatch } from "../store/redux-separate-context";
import { useListenToPostMessage } from "../utils/post-message";
import { windowFocusChangeAction } from "../domains/global/actions";
export const useListenToFocusMessages = () => {
    const dispatch = useDispatch();
    useListenToPostMessage("iframe-focus-change", (payload) => {
        var _a;
        const hasWindowFocus = (_a = payload) === null || _a === void 0 ? void 0 : _a.hasWindowFocus;
        if (hasWindowFocus === true) {
            dispatch(windowFocusChangeAction({ hasWindowFocus: true }));
        }
        else if (hasWindowFocus === false) {
            dispatch(windowFocusChangeAction({ hasWindowFocus: false }));
        }
    });
};
//# sourceMappingURL=use-listen-to-focus-messages.js.map