export function setupMraidCustomClose(): void {
  if (!window.mraid) return;

  const onReady = () => {
    window.mraid!.useCustomClose(false);
  };

  if (window.mraid.getState() === "loading") {
    window.mraid.addEventListener("ready", onReady);
  } else {
    onReady();
  }
}

export function openWithMraidOrWindow(url: string): void {
  if (window.mraid) {
    window.mraid.open(url);
    return;
  }
  window.open(url, "_blank");
}
