import { sendMessageToHost } from "../message-to-host-app/index.js";
const onGuestUnloadStart = () => new Promise((resolve) => {
  window.addEventListener("message", (msg) => {
    if (msg.data.id === "unload-guest" || msg.data.id === "close_loan") {
      resolve(msg.data.id);
    }
  });
});
const notifyGuestUnloadComplete = (guestAppConfirmation, guestAppId, unloadType = "close_loan") => {
  sendMessageToHost({
    guestAppId,
    message: { id: unloadType, auth: guestAppConfirmation }
  });
};
export {
  notifyGuestUnloadComplete,
  onGuestUnloadStart
};
