@elliemae/ssf-host 2.17.4 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/host.js CHANGED
@@ -575,7 +575,9 @@ class SSFHost {
575
575
  title,
576
576
  popupWindowFeatures = {},
577
577
  searchParams,
578
- guestId
578
+ guestId,
579
+ onLoad,
580
+ onError
579
581
  } = param;
580
582
  const {
581
583
  width = 800,
@@ -602,8 +604,28 @@ class SSFHost {
602
604
  return cur.value ? `${acc}${cur.key}=${cur.value}` : acc;
603
605
  }, "");
604
606
  const guestWindow = window.open(url, title, `popup, ${windowFeatures}`);
605
- if (!guestWindow)
607
+ if (!guestWindow) {
608
+ try {
609
+ setTimeout(() => {
610
+ onError?.(guestId);
611
+ }, 0);
612
+ } catch (error) {
613
+ this.#logger.debug(
614
+ `Error occurred in onError for guest with id '${guestId}': ${error.message}`
615
+ );
616
+ }
606
617
  throw new Error("Failed to open guest application in popup window");
618
+ } else {
619
+ try {
620
+ setTimeout(() => {
621
+ onLoad?.(guestId);
622
+ }, 0);
623
+ } catch (error) {
624
+ this.#logger.debug(
625
+ `Error occurred in onLoad for guest with id '${guestId}': ${error.message}`
626
+ );
627
+ }
628
+ }
607
629
  guestWindow.opener = null;
608
630
  guest = this.#attachGuest({
609
631
  guestId,
@@ -623,6 +645,8 @@ class SSFHost {
623
645
  targetElement,
624
646
  searchParams,
625
647
  guestId,
648
+ onLoad,
649
+ onError,
626
650
  options = {}
627
651
  } = param;
628
652
  const targetElementDocument = targetElement.ownerDocument ?? document;
@@ -638,10 +662,33 @@ class SSFHost {
638
662
  const frame = targetElementDocument.createElement("iframe");
639
663
  frame.setAttribute("id", guestId);
640
664
  const onFrameLoad = () => {
665
+ setTimeout(() => {
666
+ try {
667
+ onLoad?.(guestId);
668
+ } catch (error) {
669
+ this.#logger.debug(
670
+ `Error occurred in onLoad for guest with id '${guestId}': ${error.message}`
671
+ );
672
+ }
673
+ }, 0);
641
674
  this.#logger.debug(`frame loaded for guest with id '${guestId}'`);
642
675
  frame.removeEventListener("load", onFrameLoad);
643
676
  };
677
+ const onFrameLoadFailure = () => {
678
+ setTimeout(() => {
679
+ try {
680
+ onError?.(guestId);
681
+ } catch (error) {
682
+ this.#logger.debug(
683
+ `Error occurred in onError for guest with id '${guestId}': ${error.message}`
684
+ );
685
+ }
686
+ }, 0);
687
+ this.#logger.error(`frame load failed for guest with id '${guestId}'`);
688
+ frame.removeEventListener("error", onFrameLoadFailure);
689
+ };
644
690
  frame.addEventListener("load", onFrameLoad);
691
+ frame.addEventListener("error", onFrameLoadFailure);
645
692
  frame.setAttribute(
646
693
  "style",
647
694
  `min-width: 100%; height: 100%; border: 0px; ${style}`
@@ -914,6 +961,8 @@ class SSFHost {
914
961
  targetElement,
915
962
  title,
916
963
  searchParams = {},
964
+ onLoad,
965
+ onError,
917
966
  options = {}
918
967
  } = param;
919
968
  if (!guestId) throw new Error("id for guest application is required");
@@ -930,7 +979,9 @@ class SSFHost {
930
979
  url: srcUrl,
931
980
  title,
932
981
  searchParams,
933
- popupWindowFeatures
982
+ popupWindowFeatures,
983
+ onLoad,
984
+ onError
934
985
  });
935
986
  } else if (openMode === import_types.OpenMode.Embed) {
936
987
  guest = this.#openEmbedGuest({
@@ -939,6 +990,8 @@ class SSFHost {
939
990
  title,
940
991
  targetElement,
941
992
  searchParams,
993
+ onLoad,
994
+ onError,
942
995
  options
943
996
  });
944
997
  } else {
package/dist/esm/host.js CHANGED
@@ -563,7 +563,9 @@ class SSFHost {
563
563
  title,
564
564
  popupWindowFeatures = {},
565
565
  searchParams,
566
- guestId
566
+ guestId,
567
+ onLoad,
568
+ onError
567
569
  } = param;
568
570
  const {
569
571
  width = 800,
@@ -590,8 +592,28 @@ class SSFHost {
590
592
  return cur.value ? `${acc}${cur.key}=${cur.value}` : acc;
591
593
  }, "");
592
594
  const guestWindow = window.open(url, title, `popup, ${windowFeatures}`);
593
- if (!guestWindow)
595
+ if (!guestWindow) {
596
+ try {
597
+ setTimeout(() => {
598
+ onError?.(guestId);
599
+ }, 0);
600
+ } catch (error) {
601
+ this.#logger.debug(
602
+ `Error occurred in onError for guest with id '${guestId}': ${error.message}`
603
+ );
604
+ }
594
605
  throw new Error("Failed to open guest application in popup window");
606
+ } else {
607
+ try {
608
+ setTimeout(() => {
609
+ onLoad?.(guestId);
610
+ }, 0);
611
+ } catch (error) {
612
+ this.#logger.debug(
613
+ `Error occurred in onLoad for guest with id '${guestId}': ${error.message}`
614
+ );
615
+ }
616
+ }
595
617
  guestWindow.opener = null;
596
618
  guest = this.#attachGuest({
597
619
  guestId,
@@ -611,6 +633,8 @@ class SSFHost {
611
633
  targetElement,
612
634
  searchParams,
613
635
  guestId,
636
+ onLoad,
637
+ onError,
614
638
  options = {}
615
639
  } = param;
616
640
  const targetElementDocument = targetElement.ownerDocument ?? document;
@@ -626,10 +650,33 @@ class SSFHost {
626
650
  const frame = targetElementDocument.createElement("iframe");
627
651
  frame.setAttribute("id", guestId);
628
652
  const onFrameLoad = () => {
653
+ setTimeout(() => {
654
+ try {
655
+ onLoad?.(guestId);
656
+ } catch (error) {
657
+ this.#logger.debug(
658
+ `Error occurred in onLoad for guest with id '${guestId}': ${error.message}`
659
+ );
660
+ }
661
+ }, 0);
629
662
  this.#logger.debug(`frame loaded for guest with id '${guestId}'`);
630
663
  frame.removeEventListener("load", onFrameLoad);
631
664
  };
665
+ const onFrameLoadFailure = () => {
666
+ setTimeout(() => {
667
+ try {
668
+ onError?.(guestId);
669
+ } catch (error) {
670
+ this.#logger.debug(
671
+ `Error occurred in onError for guest with id '${guestId}': ${error.message}`
672
+ );
673
+ }
674
+ }, 0);
675
+ this.#logger.error(`frame load failed for guest with id '${guestId}'`);
676
+ frame.removeEventListener("error", onFrameLoadFailure);
677
+ };
632
678
  frame.addEventListener("load", onFrameLoad);
679
+ frame.addEventListener("error", onFrameLoadFailure);
633
680
  frame.setAttribute(
634
681
  "style",
635
682
  `min-width: 100%; height: 100%; border: 0px; ${style}`
@@ -902,6 +949,8 @@ class SSFHost {
902
949
  targetElement,
903
950
  title,
904
951
  searchParams = {},
952
+ onLoad,
953
+ onError,
905
954
  options = {}
906
955
  } = param;
907
956
  if (!guestId) throw new Error("id for guest application is required");
@@ -918,7 +967,9 @@ class SSFHost {
918
967
  url: srcUrl,
919
968
  title,
920
969
  searchParams,
921
- popupWindowFeatures
970
+ popupWindowFeatures,
971
+ onLoad,
972
+ onError
922
973
  });
923
974
  } else if (openMode === OpenMode.Embed) {
924
975
  guest = this.#openEmbedGuest({
@@ -927,6 +978,8 @@ class SSFHost {
927
978
  title,
928
979
  targetElement,
929
980
  searchParams,
981
+ onLoad,
982
+ onError,
930
983
  options
931
984
  });
932
985
  } else {
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.qa1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.29d46bdf0e76b4f904aa.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center"><div class="px-2">ICE Mortgage Product</div></header><main class="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8"><div class="min-w-0 flex-1 mt-4"><h1 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">Loan Application</h1></div><div id="successFeedback" class="hidden rounded-md bg-green-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg></div><div class="ml-3"><p class="text-sm font-medium text-green-800">Loan Saved Successfully</p></div></div></div><div id="errorFeedback" class="hidden rounded-md bg-red-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/></svg></div><div class="ml-3"><h3 class="text-sm font-medium text-red-800">Credit Score is not meeting the requirement</h3></div></div></div><div class="mt-2 sm:grid sm:grid-cols-2 sm:gap-2"><form class="px-2 py-2 space-y-8 divide-y divide-gray-200 bg-gray-50"><div class="space-y-8 divide-y divide-gray-200 sm:space-y-5"><div class="space-y-6 sm:space-y-5"><div><h3 class="text-lg font-medium leading-6 text-gray-900">Personal Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="firstName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">First name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="firstName" id="firstName" autocomplete="given-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="John" placeholder="John"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="lastName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Last name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="lastName" id="lastName" autocomplete="family-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="Doe" placeholder="Doe"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="ssn" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">SSN</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="ssn" id="ssn" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="123456789" placeholder="123456789"/></div></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Loan Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="amount" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Amount</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="amount" id="amount" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="500000" placeholder="500000"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="Term" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Term (years)</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="term" id="term" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="30" placeholder="30"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="downPayment" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Down Payment</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="downPayment" id="downPayment" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="50000" placeholder="50000"/></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Order Services</h3></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><div class="mt-1 sm:mt-0"><button id="title" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M7.502 6h7.128A3.375 3.375 0 0118 9.375v9.375a3 3 0 003-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 00-.673-.05A3 3 0 0015 1.5h-1.5a3 3 0 00-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6zM13.5 3A1.5 1.5 0 0012 4.5h4.5A1.5 1.5 0 0015 3h-1.5z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 013 20.625V9.375zM6 12a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V12zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 15a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V15zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 18a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V18zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75z" clip-rule="evenodd"/></svg> Title</button></div><div class="mt-1 sm:mt-0"><button id="credit" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M2.25 13.5a8.25 8.25 0 018.25-8.25.75.75 0 01.75.75v6.75H18a.75.75 0 01.75.75 8.25 8.25 0 01-16.5 0z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M12.75 3a.75.75 0 01.75-.75 8.25 8.25 0 018.25 8.25.75.75 0 01-.75.75h-7.5a.75.75 0 01-.75-.75V3z" clip-rule="evenodd"/></svg> Credit Score</button></div></div></div></div></div><div class="flex flex-col"><button id="saveLoan" type="button" class="rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Save</button></div></form><div id="aside-container" class="flex flex-col gap-4 items-start mt-4 border-2 p-2 rounded-lg border-dashed border-cyan-300 sm:mt-0"></div></div><div id="bottom-container" class="flex flex-col gap-4 items-start mt-4 p-2 sm:mt-0"></div></main><script src="./init.js" type="module"></script></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.qa1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.246f6f862bb7525e4088.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center"><div class="px-2">ICE Mortgage Product</div></header><main class="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8"><div class="min-w-0 flex-1 mt-4"><h1 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">Loan Application</h1></div><div id="successFeedback" class="hidden rounded-md bg-green-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg></div><div class="ml-3"><p class="text-sm font-medium text-green-800">Loan Saved Successfully</p></div></div></div><div id="errorFeedback" class="hidden rounded-md bg-red-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/></svg></div><div class="ml-3"><h3 class="text-sm font-medium text-red-800">Credit Score is not meeting the requirement</h3></div></div></div><div class="mt-2 sm:grid sm:grid-cols-2 sm:gap-2"><form class="px-2 py-2 space-y-8 divide-y divide-gray-200 bg-gray-50"><div class="space-y-8 divide-y divide-gray-200 sm:space-y-5"><div class="space-y-6 sm:space-y-5"><div><h3 class="text-lg font-medium leading-6 text-gray-900">Personal Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="firstName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">First name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="firstName" id="firstName" autocomplete="given-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="John" placeholder="John"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="lastName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Last name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="lastName" id="lastName" autocomplete="family-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="Doe" placeholder="Doe"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="ssn" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">SSN</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="ssn" id="ssn" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="123456789" placeholder="123456789"/></div></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Loan Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="amount" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Amount</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="amount" id="amount" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="500000" placeholder="500000"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="Term" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Term (years)</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="term" id="term" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="30" placeholder="30"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="downPayment" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Down Payment</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="downPayment" id="downPayment" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="50000" placeholder="50000"/></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Order Services</h3></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><div class="mt-1 sm:mt-0"><button id="title" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M7.502 6h7.128A3.375 3.375 0 0118 9.375v9.375a3 3 0 003-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 00-.673-.05A3 3 0 0015 1.5h-1.5a3 3 0 00-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6zM13.5 3A1.5 1.5 0 0012 4.5h4.5A1.5 1.5 0 0015 3h-1.5z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 013 20.625V9.375zM6 12a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V12zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 15a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V15zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 18a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V18zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75z" clip-rule="evenodd"/></svg> Title</button></div><div class="mt-1 sm:mt-0"><button id="credit" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M2.25 13.5a8.25 8.25 0 018.25-8.25.75.75 0 01.75.75v6.75H18a.75.75 0 01.75.75 8.25 8.25 0 01-16.5 0z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M12.75 3a.75.75 0 01.75-.75 8.25 8.25 0 018.25 8.25.75.75 0 01-.75.75h-7.5a.75.75 0 01-.75-.75V3z" clip-rule="evenodd"/></svg> Credit Score</button></div></div></div></div></div><div class="flex flex-col"><button id="saveLoan" type="button" class="rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Save</button></div></form><div id="aside-container" class="flex flex-col gap-4 items-start mt-4 border-2 p-2 rounded-lg border-dashed border-cyan-300 sm:mt-0"></div></div><div id="bottom-container" class="flex flex-col gap-4 items-start mt-4 p-2 sm:mt-0"></div></main><script src="./init.js" type="module"></script></body></html>
@@ -0,0 +1,3 @@
1
+ (function(S,y){typeof exports=="object"&&typeof module=="object"?module.exports=y():typeof define=="function"&&define.amd?define([],y):typeof exports=="object"?exports.ice=y():(S.ice=S.ice||{},S.ice.host=y())})(globalThis,()=>(()=>{"use strict";var v={};v.d=(n,e)=>{for(var t in e)v.o(e,t)&&!v.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},v.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),v.r=n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var S={};v.r(S),v.d(S,{Event:()=>y,Guest:()=>_,IFrameSandboxValues:()=>j,OpenMode:()=>b,SSFHost:()=>ee,ScriptingObject:()=>G});class y{name;objectId;id;constructor(e){const{name:t,objectId:i}=e;if(!t)throw new Error("Event name is required");if(!i)throw new Error("Scripting object id is required");this.objectId=i,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}class T{static[Symbol.hasInstance](e){return e.getType?.()==="ProxyEvent"}#e;objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:i,eventSrc:s}=e;this.objectId=i,this.name=t,this.#e=s,this.id=`${this.objectId}.${this.name}`.toLowerCase()}subscribe=e=>this.#e.subscribe({eventId:this.id,callback:e});unsubscribe=e=>{this.#e.unsubscribe({eventId:this.id,token:e})}}const B=n=>n instanceof y,te=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`,F="function",H=(n,e)=>typeof n===F&&!!e&&!e.startsWith("_");class G{#e;#t="Object";constructor(e,t){this.#e=e,this.#t=t||this.#t}get id(){return this.#e}get objectType(){return this.#t}_toJSON=()=>{const e=[],t=[];return Object.keys(this).forEach(i=>{const s=this[i];B(s)?t.push(i):H(s,i)&&e.push(i)}),{objectId:this.#e,objectType:this.#t,functions:e,events:t}};_dispose=()=>{};dispose=()=>{}}var p=(n=>(n.GuestClose="guest:close",n.GuestFocus="guest:focus",n.GuestReady="guest:ready",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.HostClose="host:close",n.HostConfig="host:config",n.ListObjects="list:objects",n.ObjectEvent="object:event",n.ObjectGet="object:get",n.ObjectInvoke="object:invoke",n))(p||{}),b=(n=>(n.Popup="popup",n.Embed="embed",n))(b||{}),j=(n=>(n.AllowDownloadsWithoutUserActivation="allow-downloads-without-user-activation",n.AllowDownloads="allow-downloads",n.AllowForms="allow-forms",n.AllowModals="allow-modals",n.AllowOrientationLock="allow-orientation-lock",n.AllowPointerLock="allow-pointer-lock",n.AllowPopups="allow-popups",n.AllowPopupsToEscapeSandbox="allow-popups-to-escape-sandbox",n.AllowPresentation="allow-presentation",n.AllowSameOrigin="allow-same-origin",n.AllowScripts="allow-scripts",n.AllowStorageAccessByUserActivation="allow-storage-access-by-user-activation",n.AllowTopNavigation="allow-top-navigation",n.AllowTopNavigationByUserActivation="allow-top-navigation-by-user-activation",n))(j||{});const W=n=>{if(n==="about:blank")return"*";try{const{origin:e}=new URL(n);return e==="null"||!e?n:e}catch{const{origin:t}=new URL(n,document.baseURI);return t}},R=(n,e=[])=>{const t=e||[];return n&&n.forEach?n.forEach(i=>{R(i,t)}):typeof n<"u"&&t.push(n),t},ie=n=>typeof n?._toJSON=="function";function L(n){return typeof n=="function"}const se=n=>n?.id??n;class _{id;title;url;searchParams;domElement;window;openMode;origin;initialized=!1;ready=!1;capabilities;#e;#t;constructor(e){const{guestId:t,domElement:i=null,title:s,url:o,window:r,searchParams:c={},openMode:a=b.Embed,remoting:d,analyticsObj:u}=e;this.id=t,this.title=s,this.url=o,this.origin=W(o),this.searchParams=c,this.domElement=i,this.window=r,this.openMode=a,this.capabilities={},this.#t=u,this.#e=d}dispose=()=>{if(this.openMode===b.Popup&&!this.window.closed)try{this.window.document,this.window.close()}catch{this.#e.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HostClose,messageBody:{}})}else this.domElement?.remove?.();this.#e.removeSender({origin:this.origin,window:this.window})};getInfo=()=>({guestId:this.id,guestTitle:this.title,guestUrl:this.url});handShake=()=>new Promise(e=>{let t=0;const i=5,s=setInterval(()=>{t>=i?(clearInterval(s),e(!1)):(this.#e.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HandShake,messageBody:{}}),t+=1)},1e3);this.#e.listen({messageType:p.HandShakeAck,callback:()=>{clearInterval(s),e(!0)}})});init=()=>{this.#e.addSender({origin:this.origin,window:this.window}),this.openMode===b.Popup&&this.handShake().catch(()=>{})};dispatchEvent=(e,t)=>(this.#t.startTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{}),this.#e.invoke({targetWin:this.window,targetOrigin:this.origin,messageType:p.ObjectEvent,messageBody:e,responseTimeoutMs:t}).finally(()=>{this.#t.endTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{})}));send=e=>{this.#e.send({targetWin:this.window,targetOrigin:this.origin,...e})}}const U={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let P;const J=new Uint8Array(16);function Y(){if(!P&&(P=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!P))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return P(J)}const h=[];for(let n=0;n<256;++n)h.push((n+256).toString(16).slice(1));function q(n,e=0){return h[n[e+0]]+h[n[e+1]]+h[n[e+2]]+h[n[e+3]]+"-"+h[n[e+4]]+h[n[e+5]]+"-"+h[n[e+6]]+h[n[e+7]]+"-"+h[n[e+8]]+h[n[e+9]]+"-"+h[n[e+10]]+h[n[e+11]]+h[n[e+12]]+h[n[e+13]]+h[n[e+14]]+h[n[e+15]]}function oe(n,e=0){const t=q(n,e);if(!validate(t))throw TypeError("Stringified UUID is invalid");return t}const re=null;function X(n,e,t){if(U.randomUUID&&!e&&!n)return U.randomUUID();n=n||{};const i=n.random||(n.rng||Y)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=i[s];return e}return q(i)}const C=X,M="elli:remoting",x="elli:remoting:response",z="elli:remoting:exception",$=({messageType:n,messageBody:e,onewayMsg:t=!1})=>({requestId:t?null:C(),source:M,type:n,body:e}),ce=n=>{const{targetWin:e,targetOrigin:t,messageType:i,messageBody:s}=n,o=$({messageType:i,messageBody:s});e.postMessage(o,t)};class K{#e;#t;#i=new Map;#n=new Map;#s=null;#o=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#e=t,this.#t=e}#r=()=>{const e=Date.now(),t=[];this.#n.forEach((i,s)=>{const{requestId:o,cancelTime:r}=i;this.#t.debug(`Checking response timeout for requestId: ${o}) @ ${r??""}`),i.cancelTime&&i.cancelTime<e&&(this.#t.debug(`Detected response timeout for requestId: ${o}...`),t.push(s),i.resolve(),this.#t.debug(`Aborted waiting for response to requestid: ${o})`))}),t.forEach(i=>{this.#t.debug(`removing invocations with requestId ${i} from cache since response time has expired`),this.#n.delete(i)}),this.#n.size===0&&(this.#t.debug("stopping response monitor"),this.#h())};#u=()=>{this.#s===null&&(this.#t.debug("Staring response timeout evaluator"),this.#s=window.setInterval(this.#r,200))};#h=()=>{this.#s!==null&&(window.clearInterval(this.#s),this.#s=null,this.#t.debug("Stopped response timeout evaluator"))};#g=e=>{const t=this.#n.get(e);return this.#t.debug(`serving requestId: ${e}`),this.#n.delete(e),t};#a=e=>{const{requestId:t}=e;this.#t.debug(`Response received for invocation requestId: ${t}`);const i=this.#g(t);return i?(i.resolve(e.body),!0):(this.#t.debug(`Received response to stale/invalid request with requestId: ${t}`),!1)};#d=e=>{this.#t.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#g(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#t.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#l=({sourceWin:e,sourceOrigin:t,message:i})=>{this.#t.debug(`Received message of type "${i.type}"`);const s=this.#i.get(i.type);return s?(s.forEach(o=>{this.#t.debug(`Invoking message handler ${o.name}`),o({sourceWin:e,sourceOrigin:t,requestId:i.requestId,type:i.type,body:i.body})}),!0):!1};#c=e=>{if(this.#t.debug(`Remoting: Received message ${JSON.stringify(e.data)}`),this.#o.size===0||!e.source)return!1;const t=this.#o.get(e.source);return!t||e?.data?.source!==M?!1:(e.data.type===x?this.#a(e.data):e.data.type===z?this.#d(e.data):this.#l({sourceWin:e.source,sourceOrigin:t,message:e.data}),!0)};addSender=e=>{const{origin:t,window:i}=e;if(!t)throw new Error("origin is required");if(!i)throw new Error("window is required");this.#o.set(i,t)};initialize=e=>{e.removeEventListener("message",this.#c),e.addEventListener("message",this.#c),this.#t.debug(`initialized remoting id: ${this.#e}`)};close=()=>{window.removeEventListener("message",this.#c),this.#t.debug(`closed remoting id: ${this.#e}`)};invoke=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o,responseTimeoutMs:r}=e;return new Promise((c,a)=>{const d=$({messageType:s,messageBody:o});this.#n.set(d.requestId,{requestId:d.requestId,resolve:c,reject:a,cancelTime:r?Date.now()+Number.parseInt(r,10):null}),t.postMessage(d,i);const{requestId:u}=d;this.#t.debug(`Posted invocation message of type ${s} requestId: ${u||""}`),r&&(this.#t.debug(`starting response monitor for requestId: ${u||""} for ${r} ms`),this.#u())})};listen=e=>{const{messageType:t,callback:i}=e,s=this.#i.get(t)||[];s.push(i),this.#i.set(t,s)};send=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o}=e,r=$({messageType:s,messageBody:o,onewayMsg:!0});t.postMessage(r,i),this.#t.debug(`Posted one-way message of type "${s}"`)};removeSender=e=>{const{window:t}=e;t&&this.#o.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:i,requestId:s,response:o}=e,r=$({messageType:x,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#t.debug(`Response sent to caller for invocation requestId: ${s}`)};raiseException=e=>{const{targetWin:t,targetOrigin:i,requestId:s,ex:o}=e,r=$({messageType:z,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#t.debug(`Exception sent to caller for invocation. requestId: ${s}`)}}const N="module";var Q=(n=>(n.USER="USER",n.PARTNER="PARTNER",n))(Q||{});class Z{#e=new Map;#t=new Map;#i=e=>{const{so:t,guestId:i}=e,s=t.id.toLowerCase(),o=this.#t.get(i);if(!o)this.#t.set(i,new Map([[s,e]]));else{if(o.has(s))throw new Error(`Scripting Object ${t.id} already exists for guest ${i}`);o.set(s,e)}};#n=({so:e})=>{e._dispose&&typeof e._dispose=="function"&&e._dispose()};#s=({objectId:e,guestId:t})=>{if(e===N&&!t)for(const[,s]of this.#t){const o=s.get(e);if(o)return o}const i=t?this.#t.get(t):null;return i?i.get(e)??null:null};#o=({objectId:e,guestId:t}={})=>{if(t){if(!e){const s=this.#t.get(t);s&&s.forEach(this.#n),this.#t.delete(t);return}const i=this.#t.get(t);if(i){const s=i.get(e);s&&this.#n(s),i.delete(e)}}else e&&this.#t.forEach(i=>{const s=i.get(e);s&&this.#n(s),i.delete(e)})};addScriptingObject=(e,t)=>{const{guestId:i}=t||{};if(!e?.id||!e?._toJSON)throw new Error("Object is not derived from ScriptingObject");const s=e.id.toLowerCase();if(s.trim().toLowerCase()===N&&!i)throw new Error("Guest id is required to add Module scripting object");if(i){this.#i({so:e,...t,guestId:i});return}if(this.#e.has(s))throw new Error(`Scripting Object ${e.id} already exists`);this.#e.set(s,{so:e,...t})};getObject=(e,t)=>{const i=e.trim().toLowerCase();let s=this.#s({objectId:i,guestId:t?.id});s=s??this.#e.get(i)??null;const{so:o}=s||{};return o||null};has=(e,t)=>this.getObject(e,t)!==null;listScriptingObjects=e=>{let t=Array.from(this.#e.keys());const i=this.#t.get(e);return t=i?t.concat(Array.from(i.keys())):t,Array.from(new Set(t))};removeScriptingObject=(e,t)=>{const i=e.toLowerCase();if(t)this.#o({objectId:i,guestId:t});else{this.#o({objectId:i});const s=this.#e.get(i);s&&this.#n(s),this.#e.delete(i)}};removeAllScriptingObjects=e=>{e?this.#o({guestId:e}):(this.#e.forEach(this.#n),this.#e.clear())}}class ae{__TYPE__="Proxy";id;objectType;constructor(e,t){this.id=e,this.objectType=t}}const D=n=>n?.constructor?.name==="Proxy"||n?.constructor?.name==="ScriptingObjectProxy"||n?.__TYPE__==="Proxy",V=[j.AllowScripts,j.AllowPopups,j.AllowModals,j.AllowForms,j.AllowDownloads,j.AllowSameOrigin].join(" ");class ee{hostId;#e;#t;#i;#n;#s=new Map;#o=new Map;#r;#u=null;#h=null;constructor(e,t){if(this.hostId=e,!t?.logger)throw new Error("Logger is required");if(!t?.analyticsObj)throw new Error("Analytics object is required");if(this.#i=t.logger,this.#n=t.analyticsObj,this.#t=C(),this.#e=new K(this.#i,this.#t),t?.readyStateCallback&&typeof t?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");this.#u=t?.readyStateCallback||null,this.#r=new Z,this.#e.initialize(window),this.#A(),window.addEventListener("beforeunload",this.#l),this.#G(),this.#i.debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#t}`)}#g=(e,t)=>{const i={event:e,...t};this.#n.sendBAEvent(i).catch(()=>{})};#a=(e,t)=>{this.#n.startTiming(e,t).catch(()=>{})};#d=(e,t)=>{this.#n.endTiming(e,t).catch(()=>{})};#l=()=>{for(const e of this.#s.values())e.openMode===b.Popup&&this.unloadGuest(e.id)};#c=e=>Array.from(this.#s.values()).find(t=>t.window===e);#v=e=>{for(const t of this.#s.values())if(t.url===e)return t;return null};#y=e=>typeof e?._toJSON=="function";#f=(e,t)=>this.#y(e)?(this.#r.has(e?.id,t)||this.#r.addScriptingObject(e,t?{guestId:t?.id}:{}),{type:"object",object:e._toJSON()}):{type:"value",value:e};#U=e=>typeof e=="string"?e:e instanceof Error?e.message:"An unexpected error occurred in the host application";#b=e=>{e.ready&&this.#e.send({targetWin:e.window,targetOrigin:e.origin,messageType:p.HostConfig,messageBody:{logLevel:this.#i.getLogLevel(),...e.getInfo()}})};#j=({guest:e,obj:t,functionName:i,functionParams:s})=>{const o=t[i];return L(o)?(this.#i.debug(`Invoking host implementation of ${t.id}.${String(i)}()`),new Promise(r=>{Object.defineProperty(o,"callContext",{value:{guest:e},configurable:!0,enumerable:!0,writable:!0}),r(o(...s))})):(this.#i.warn(`Attempt to call invalid function on object type ${t.objectType}: ${String(i)}`),Promise.reject(new Error(`Method '${i}' not found in Scripting Object '${t.id}'`)))};#w=({sourceWin:e,sourceOrigin:t,requestId:i})=>{const s=this.#c(e);if(!s){this.#i.warn(`Received ready event for unknown guest. requestId: ${i}`);return}if(!s.initialized){this.#i.warn("Guest must be initialized before it is marked as ready"),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Guest must be initialized before it is marked as ready"});return}if(!s.ready){s.ready=!0;const o=s.getInfo();this.#d("SSF.Guest.Load",{appId:o.guestId,appUrl:o.guestUrl}),this.#b(s),this.#u?.(s),this.#i.audit({message:"Guest is ready",...o})}};#E=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const o=this.#c(e);if(!o){this.#i.warn(`Received ready event for unknown guest. requestid = ${i}`);return}o.initialized||(o.initialized=!0,o.capabilities=s||{},this.#i.audit({message:"Guest is initialized",...o.getInfo()})),(!s||!s.onReady)&&this.#w({sourceWin:e,sourceOrigin:t,requestId:i,type:"",body:null})};#O=async({sourceWin:e})=>{if(e?.window){const t=this.#p(e);t&&!await t.handShake()&&this.unloadGuest(e)}};#S=({sourceWin:e,sourceOrigin:t,requestId:i})=>{this.#i.debug(`Processing listObjects request. requestId = ${i}`);const s=this.#c(e);if(!s)return this.#i.warn("Rejected object request from unknown guest window"),!1;const o=this.#r.listScriptingObjects(s.id);return this.#e.respond({targetWin:e,targetOrigin:t,requestId:i,response:o}),this.#i.audit({message:"name of scripting objects returned",requestId:i,objects:o,...s.getInfo()}),!0};#I=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s;this.#i.debug(`Processing getObject request for object ${o}. requestId = ${i}`);const r=this.#c(e);if(!r)return this.#i.warn("Rejected object request from unknown guest window"),!1;const c=this.getScriptingObject(o,{guest:r});return c?(this.#e.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#f(c)}),this.#i.audit({message:"Scripting Object returned",requestId:i,scriptingObject:o,...r.getInfo()}),!0):(this.#i.warn(`unknown or unauthorized object ${o} from guest ${r.id}`),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1)};#$=({sourceWin:e,requestId:t,body:i})=>{const s=this.#c(e);if(!s){this.#i.warn(`Received resize event from unknown guest. requestid = ${t}`);return}s.domElement&&(s.domElement.style.height=`${i.height}px`),this.#i.debug(`Guest ${s.id} resized to ${i.width}x${i.height}`)};#k=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s,r=this.#c(e);if(!r)return this.#i.warn("Rejected method invocation request from unknown guest window"),!1;this.#i.debug(`Function ${o}.${String(s.functionName)}() called from guest "${r.id}" (requestId = ${i})`);const c=this.getScriptingObject(o,{guest:r});if(!c)return this.#i.warn(`Invocation of unknown or unauthorized object ${o} from guest ${r.id}`),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1;const a=r.getInfo();return this.#a(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl}),this.#j({guest:r,obj:c,functionName:s.functionName,functionParams:s.functionParams}).then(d=>{this.#e.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#f(d,r)}),this.#i.audit({message:"Value returned for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).catch(d=>{this.#e.raiseException({targetWin:e,targetOrigin:r.origin,requestId:i,ex:d}),this.#i.audit({message:"Exception thrown for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).finally(()=>{this.#d(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl})}),!0};#P=()=>{this.#e.listen({messageType:p.GuestResize,callback:this.#$})};#A=()=>{this.#e.listen({messageType:p.GuestReady,callback:this.#E}),this.#e.listen({messageType:p.GuestReadyComplete,callback:this.#w}),this.#e.listen({messageType:p.GuestClose,callback:this.#O}),this.#e.listen({messageType:p.ListObjects,callback:this.#S}),this.#e.listen({messageType:p.ObjectGet,callback:this.#I}),this.#e.listen({messageType:p.ObjectInvoke,callback:this.#k})};#T=e=>e instanceof T||typeof e?.subscribe=="function";#m=e=>{const t=new _({...e,remoting:this.#e,analyticsObj:this.#n});return t.init(),this.#s.set(e.guestId,t),t};#p=e=>{let t=typeof e=="string"?this.#s.get(e):null;return t||(t=Array.from(this.#s.values()).find(i=>i.window===e||i.domElement===e)),t};#G=()=>{this.#h=setInterval(()=>{const e=[];this.#s.forEach(t=>{t.openMode===b.Popup&&t.window.closed&&e.push(t)}),e.forEach(t=>{const{id:i}=t;this.unloadGuest(i),this.#o.get(i)?.forEach(o=>{o({id:i}).catch(()=>{})})})},1e3)};#R=e=>{const{url:t,title:i,popupWindowFeatures:s={},searchParams:o,guestId:r,onLoad:c,onError:a}=e,{width:d=800,height:u=600,top:E=100,left:w=100}=s;let g=this.#v(t);if(g)g.window.closed||g.send({messageType:p.GuestFocus,messageBody:{}});else{const I=[{key:"width",value:d},{key:"height",value:u},{key:"top",value:E},{key:"left",value:w}].reduce((l,O,f)=>(f>0&&O.value&&(l+=","),O.value?`${l}${O.key}=${O.value}`:l),""),m=window.open(t,i,`popup, ${I}`);if(m)try{setTimeout(()=>{c?.(r)},0)}catch(l){this.#i.debug(`Error occurred in onLoad for guest with id '${r}': ${l.message}`)}else{try{setTimeout(()=>{a?.(r)},0)}catch(l){this.#i.debug(`Error occurred in onError for guest with id '${r}': ${l.message}`)}throw new Error("Failed to open guest application in popup window")}m.opener=null,g=this.#m({guestId:r,window:m,title:i,url:t,searchParams:o,openMode:b.Popup})}return g};#L=e=>{const{url:t,title:i,targetElement:s,searchParams:o,guestId:r,onLoad:c,onError:a,options:d={}}=e,u=s.ownerDocument??document,{fitToContent:E=!1,disableSandbox:w=!1,sandboxValues:g=[],style:I="",permissionPolicy:m=""}=d;if(!i)throw new Error("title is required");E&&this.#P();const l=u.createElement("iframe");l.setAttribute("id",r);const O=()=>{setTimeout(()=>{try{c?.(r)}catch(A){this.#i.debug(`Error occurred in onLoad for guest with id '${r}': ${A.message}`)}},0),this.#i.debug(`frame loaded for guest with id '${r}'`),l.removeEventListener("load",O)},f=()=>{setTimeout(()=>{try{a?.(r)}catch(A){this.#i.debug(`Error occurred in onError for guest with id '${r}': ${A.message}`)}},0),this.#i.error(`frame load failed for guest with id '${r}'`),l.removeEventListener("error",f)};l.addEventListener("load",O),l.addEventListener("error",f),l.setAttribute("style",`min-width: 100%; height: 100%; border: 0px; ${I}`),w||l.setAttribute("sandbox",`${V} ${g.join(" ")}`),l.setAttribute("title",i),l.setAttribute("src",t),m&&l.setAttribute("allow",m),s.appendChild(l);const k=u.getElementById(r);return this.#m({guestId:r,domElement:k,window:k.contentWindow,title:i,url:t,searchParams:o,openMode:b.Embed})};#_=(e,t)=>{let i="";return Object.keys(t).forEach(s=>{i+=`${(i.length?"&":"")+encodeURIComponent(s)}=${encodeURIComponent(t[s])}`}),e+(i?(e.indexOf("?")>=0?"&":"?")+i:"")};addScriptingObject=(e,t)=>{if(D(e)){const i=this.cloneScriptingObject(e);this.#r.addScriptingObject(i,t)}else this.#r.addScriptingObject(e,t)};cloneScriptingObject=e=>{if(!e)throw new Error("proxy is required");const t=new G(e.id,e.objectType);let i=[];return Object.keys(e).forEach(s=>{const o=e[s];if(this.#T(o)){const r=new y({name:o.name||s,objectId:t.id});if(Object.defineProperty(t,s,{value:r,enumerable:!0}),o instanceof T){const c=({eventParams:d,eventOptions:u})=>this.dispatchEvent({event:r,eventParams:d,eventOptions:u}),a=o.subscribe(c);i.push(()=>{o.unsubscribe(a)})}else{const c=o.subscribe?.((a,d,u)=>this.dispatchEvent({event:r,eventParams:d,eventOptions:u}));i.push(()=>{o.unsubscribe?.(c)})}}else if(L(o)&&(Object.defineProperty(t,s,{value:async(...r)=>{const c=await o(...r);return D(c)?this.cloneScriptingObject(c):c},enumerable:!0}),s==="dispose")){const r=t.dispose;Object.defineProperty(t,s,{value:()=>(t._dispose(),r.apply(t)),enumerable:!0})}}),t._dispose=()=>{i.forEach(s=>{s?.()}),i=[]},t};close=()=>{clearInterval(this.#h),this.#l(),this.#e.close(),window.removeEventListener("beforeunload",this.#l),this.#i.debug(`host is closed. hostId: ${this.hostId}, correlationId: ${this.#t}`)};dispatchEvent=async e=>{const{event:{id:t,name:i},eventParams:s,eventOptions:o={}}=e,{eventHandler:r=null,timeout:c=null,window:a=null,guestId:d}=o,u=t.split(".")[0],E=d||a,w=E?this.#p(E):null,g=w?this.getScriptingObject(u,{guest:w}):this.getScriptingObject(u);if(!g)return this.#i.warn(`Attempt to dispatch event ${i} on unknown object ${u}`),Promise.resolve([]);const I={object:g._toJSON(),eventName:i,eventParams:s,eventHandler:r,eventOptions:{allowsFeedback:!1}};c&&!Number.isNaN(c)&&(I.eventOptions={allowsFeedback:!0,timeout:Number(c)});const m=[];let l=!1;return this.#s.forEach(f=>{const k=f.getInfo();(!a||a===f.window)&&(c&&f?.capabilities?.eventFeedback?(m.push(f.dispatchEvent(I,c)),l||(this.#a(`ScriptingObject.Event.${g.id}.${i}`,{appId:this.hostId,appUrl:window.location.href}),l=!0),this.#i.audit({message:"Event dispatched and awaiting feedback",scriptingEventId:t,...k})):(f.send({messageType:p.ObjectEvent,messageBody:I}),this.#i.audit({message:"Event dispatched",scriptingEventId:t,...k})))}),await Promise.all(m).then(f=>(this.#i.audit({message:"Event feedback received",scriptingEventId:t}),R(f))).catch(f=>{throw this.#i.error({message:"Error processing event",eventId:t,exception:f}),f}).finally(()=>{l&&this.#d(`ScriptingObject.Event.${g.id}.${i}`,{appId:this.hostId,appUrl:window.location.href})})};getGuests=()=>{const e=[];return this.#s.forEach(t=>{e.push(t)}),e};getScriptingObject=(e,t)=>this.#r.getObject(e,t?.guest);loadGuest=e=>{const{id:t,url:i,targetElement:s,title:o,searchParams:r={},onLoad:c,onError:a,options:d={}}=e;if(!t)throw new Error("id for guest application is required");const{openMode:u=b.Embed,popupWindowFeatures:E={}}=d,w=this.#_(i,r);let g=null;if(this.#a("SSF.Guest.Load",{appId:t,appUrl:w}),u===b.Popup)g=this.#R({guestId:t,url:w,title:o,searchParams:r,popupWindowFeatures:E,onLoad:c,onError:a});else if(u===b.Embed)g=this.#L({guestId:t,url:w,title:o,targetElement:s,searchParams:r,onLoad:c,onError:a,options:d});else throw new Error(`Invalid openMode: ${u}`);return this.#i.audit({message:"Guest loaded",...g.getInfo()}),g};loadGuests=e=>{const{id:t,url:i,targetElement:s,title:o,searchParamsList:r=[],options:c={}}=e;r.forEach((a,d)=>{this.loadGuest({id:`${t}-${d}`,url:i,title:o,targetElement:s,searchParams:a,options:c})},this)};removeAllScriptingObjects=e=>{this.#r.removeAllScriptingObjects(e)};removeScriptingObject=(e,t)=>{this.#r.removeScriptingObject(e,t)};setLogLevel=e=>{this.#i.setLogLevel(e),this.#s.forEach(this.#b),this.#i.debug("Dispatched config events to all guests")};unloadGuest=e=>{const t=this.#p(e);t&&(t.dispose(),this.#s.delete(t.id),this.#i.audit({message:"Guest is removed from host",...t.getInfo()}))};onGuestClose=e=>{const{id:t,guestCloseCallback:i}=e,s=this.#o.get(t)||[];s.push(i),this.#o.set(t,s)}}return S})());
2
+
3
+ //# sourceMappingURL=emuiSsfHost.246f6f862bb7525e4088.js.map