@elliemae/ssf-host 2.35.0 → 2.35.1
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 +63 -25
- package/dist/esm/host.js +63 -25
- package/dist/public/callchain-host.html +1 -1
- package/dist/public/callchain-intermediate.html +1 -1
- package/dist/public/e2e-host.html +1 -1
- package/dist/public/e2e-index.html +1 -1
- package/dist/public/index.html +1 -1
- package/dist/public/js/emuiSsfHost.cc299d33bc6c79fa47d8.js +3 -0
- package/dist/public/js/emuiSsfHost.cc299d33bc6c79fa47d8.js.br +0 -0
- package/dist/public/js/emuiSsfHost.cc299d33bc6c79fa47d8.js.gz +0 -0
- package/dist/public/js/emuiSsfHost.cc299d33bc6c79fa47d8.js.map +1 -0
- package/dist/public/popup-focus-host.html +1 -1
- package/dist/public/v1-guest-v2-host.html +1 -1
- package/dist/public/v2-host-v1-guest.html +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.br +0 -0
- package/dist/umd/index.js.gz +0 -0
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/public/js/emuiSsfHost.a710a0562fe60b877957.js +0 -3
- package/dist/public/js/emuiSsfHost.a710a0562fe60b877957.js.br +0 -0
- package/dist/public/js/emuiSsfHost.a710a0562fe60b877957.js.gz +0 -0
- package/dist/public/js/emuiSsfHost.a710a0562fe60b877957.js.map +0 -1
package/dist/cjs/host.js
CHANGED
|
@@ -106,6 +106,11 @@ class SSFHost {
|
|
|
106
106
|
* Guest ids currently being unloaded (guards observer + explicit double-unload).
|
|
107
107
|
*/
|
|
108
108
|
#guestsUnloading = /* @__PURE__ */ new Set();
|
|
109
|
+
/**
|
|
110
|
+
* Popup guests that sent GuestClose. The window is already closing, so
|
|
111
|
+
* module unload events are not waited on.
|
|
112
|
+
*/
|
|
113
|
+
#popupGuestCloseIds = /* @__PURE__ */ new Set();
|
|
109
114
|
/**
|
|
110
115
|
* Guest ids for which {@link onGuestClose} callbacks were already invoked
|
|
111
116
|
* for the current close attempt (dedupes concurrent exit paths).
|
|
@@ -382,6 +387,9 @@ class SSFHost {
|
|
|
382
387
|
if (!sourceWin) return;
|
|
383
388
|
const guest = this.#findGuest(sourceWin);
|
|
384
389
|
if (!guest) return;
|
|
390
|
+
if (guest.openMode === import_types.OpenMode.Popup) {
|
|
391
|
+
this.#popupGuestCloseIds.add(guest.id);
|
|
392
|
+
}
|
|
385
393
|
this.#unloadGuestAndNotifyHost(guest.id);
|
|
386
394
|
};
|
|
387
395
|
// Handles list objects requests from the remote automation framework
|
|
@@ -905,8 +913,24 @@ class SSFHost {
|
|
|
905
913
|
*/
|
|
906
914
|
#dropClosedPopupGuest = (guest) => {
|
|
907
915
|
if (!guest || !this.#isPopupWindowClosed(guest.window)) return guest;
|
|
908
|
-
this.#
|
|
909
|
-
|
|
916
|
+
if (!this.#guestsUnloading.has(guest.id)) {
|
|
917
|
+
this.#unloadGuestAndNotifyHost(guest.id);
|
|
918
|
+
}
|
|
919
|
+
if (this.#getGuestForUrl(guest.url) === guest) {
|
|
920
|
+
this.#detachClosedPopupGuest(guest);
|
|
921
|
+
}
|
|
922
|
+
return this.#getGuestForUrl(guest.url) === guest ? guest : null;
|
|
923
|
+
};
|
|
924
|
+
/**
|
|
925
|
+
* Removes a closed popup from host maps without waiting on module events.
|
|
926
|
+
* @param guest popup guest whose window is already closed
|
|
927
|
+
*/
|
|
928
|
+
#detachClosedPopupGuest = (guest) => {
|
|
929
|
+
if (!this.#guestCloseNotified.has(guest.id)) {
|
|
930
|
+
this.#guestCloseNotified.add(guest.id);
|
|
931
|
+
this.#fireGuestCloseCallbacks(guest.id);
|
|
932
|
+
}
|
|
933
|
+
this.#finalizeGuestRemoval(guest);
|
|
910
934
|
};
|
|
911
935
|
/**
|
|
912
936
|
* Frees a closed popup at this URL before a new one is opened.
|
|
@@ -945,33 +969,18 @@ class SSFHost {
|
|
|
945
969
|
} else {
|
|
946
970
|
const windowFeatures = Object.entries({ width, height, top, left }).filter(([, v]) => v).map(([k, v]) => `${k}=${v}`).join(",");
|
|
947
971
|
const { popupUrl, handshakeToken, trusted } = this.#buildPopupUrl(url);
|
|
948
|
-
const guestWindow =
|
|
972
|
+
const guestWindow = this.#openNamedPopup({
|
|
949
973
|
popupUrl,
|
|
950
974
|
title,
|
|
951
|
-
|
|
952
|
-
|
|
975
|
+
guestId,
|
|
976
|
+
features: `popup, ${windowFeatures}`,
|
|
977
|
+
retryClosedWindow: !trusted
|
|
978
|
+
});
|
|
953
979
|
if (!guestWindow) {
|
|
954
|
-
|
|
955
|
-
try {
|
|
956
|
-
onError?.(guestId);
|
|
957
|
-
} catch (error) {
|
|
958
|
-
this.#logger.debug(
|
|
959
|
-
`Error occurred in onError for guest with id '${guestId}': ${error.message}`
|
|
960
|
-
);
|
|
961
|
-
}
|
|
962
|
-
}, 0);
|
|
980
|
+
this.#notifyGuestFrameCallback(guestId, onError, "onError");
|
|
963
981
|
throw new Error("Failed to open guest application in popup window");
|
|
964
|
-
} else {
|
|
965
|
-
setTimeout(() => {
|
|
966
|
-
try {
|
|
967
|
-
onLoad?.(guestId);
|
|
968
|
-
} catch (error) {
|
|
969
|
-
this.#logger.debug(
|
|
970
|
-
`Error occurred in onLoad for guest with id '${guestId}': ${error.message}`
|
|
971
|
-
);
|
|
972
|
-
}
|
|
973
|
-
}, 0);
|
|
974
982
|
}
|
|
983
|
+
this.#notifyGuestFrameCallback(guestId, onLoad, "onLoad");
|
|
975
984
|
if (!trusted) {
|
|
976
985
|
guestWindow.opener = null;
|
|
977
986
|
}
|
|
@@ -989,6 +998,33 @@ class SSFHost {
|
|
|
989
998
|
}
|
|
990
999
|
return guest;
|
|
991
1000
|
};
|
|
1001
|
+
/**
|
|
1002
|
+
* Opens a popup. A cross-site window that comes back already closed is
|
|
1003
|
+
* opened once more under a new name, still in this turn. Trusted and
|
|
1004
|
+
* same-site popups use a single window.open, including when it returns
|
|
1005
|
+
* a closed window.
|
|
1006
|
+
* @param param popup url, names, and window features
|
|
1007
|
+
* @param param.popupUrl url passed to window.open
|
|
1008
|
+
* @param param.title window name to try first
|
|
1009
|
+
* @param param.guestId used to build a fresh window name on retry
|
|
1010
|
+
* @param param.features window.open features string
|
|
1011
|
+
* @param param.retryClosedWindow reopen under a new name when the first window is closed
|
|
1012
|
+
* @returns the window to attach, or null when the popup could not be opened
|
|
1013
|
+
*/
|
|
1014
|
+
#openNamedPopup = (param) => {
|
|
1015
|
+
const { popupUrl, title, guestId, features, retryClosedWindow } = param;
|
|
1016
|
+
let targetName = title;
|
|
1017
|
+
let guestWindow = window.open(popupUrl, targetName, features);
|
|
1018
|
+
if (retryClosedWindow && guestWindow && this.#isPopupWindowClosed(guestWindow)) {
|
|
1019
|
+
targetName = `${title}-${guestId}`;
|
|
1020
|
+
guestWindow = window.open(popupUrl, targetName, features);
|
|
1021
|
+
}
|
|
1022
|
+
if (!guestWindow) return null;
|
|
1023
|
+
if (retryClosedWindow && this.#isPopupWindowClosed(guestWindow)) {
|
|
1024
|
+
return null;
|
|
1025
|
+
}
|
|
1026
|
+
return guestWindow;
|
|
1027
|
+
};
|
|
992
1028
|
#notifyGuestFrameCallback = (guestId, callback, label) => {
|
|
993
1029
|
setTimeout(() => {
|
|
994
1030
|
try {
|
|
@@ -1573,7 +1609,8 @@ class SSFHost {
|
|
|
1573
1609
|
this.#guestsUnloading.add(guest.id);
|
|
1574
1610
|
try {
|
|
1575
1611
|
const windowClosed = guest.openMode === import_types.OpenMode.Popup ? this.#isPopupWindowClosed(guest.window) : Boolean(guest.window?.closed);
|
|
1576
|
-
const
|
|
1612
|
+
const popupCloseRequested = this.#popupGuestCloseIds.has(guest.id);
|
|
1613
|
+
const guestContextDestroyed = windowClosed || this.#isEmbedGuestDetached(guest) || popupCloseRequested;
|
|
1577
1614
|
if (!guestContextDestroyed) {
|
|
1578
1615
|
if (!await this.#canUnloadGuest(guest)) {
|
|
1579
1616
|
this.#guestCloseNotified.delete(guest.id);
|
|
@@ -1584,6 +1621,7 @@ class SSFHost {
|
|
|
1584
1621
|
this.#finalizeGuestRemoval(guest);
|
|
1585
1622
|
} finally {
|
|
1586
1623
|
this.#guestsUnloading.delete(guest.id);
|
|
1624
|
+
this.#popupGuestCloseIds.delete(guest.id);
|
|
1587
1625
|
}
|
|
1588
1626
|
};
|
|
1589
1627
|
/**
|
package/dist/esm/host.js
CHANGED
|
@@ -95,6 +95,11 @@ class SSFHost {
|
|
|
95
95
|
* Guest ids currently being unloaded (guards observer + explicit double-unload).
|
|
96
96
|
*/
|
|
97
97
|
#guestsUnloading = /* @__PURE__ */ new Set();
|
|
98
|
+
/**
|
|
99
|
+
* Popup guests that sent GuestClose. The window is already closing, so
|
|
100
|
+
* module unload events are not waited on.
|
|
101
|
+
*/
|
|
102
|
+
#popupGuestCloseIds = /* @__PURE__ */ new Set();
|
|
98
103
|
/**
|
|
99
104
|
* Guest ids for which {@link onGuestClose} callbacks were already invoked
|
|
100
105
|
* for the current close attempt (dedupes concurrent exit paths).
|
|
@@ -371,6 +376,9 @@ class SSFHost {
|
|
|
371
376
|
if (!sourceWin) return;
|
|
372
377
|
const guest = this.#findGuest(sourceWin);
|
|
373
378
|
if (!guest) return;
|
|
379
|
+
if (guest.openMode === OpenMode.Popup) {
|
|
380
|
+
this.#popupGuestCloseIds.add(guest.id);
|
|
381
|
+
}
|
|
374
382
|
this.#unloadGuestAndNotifyHost(guest.id);
|
|
375
383
|
};
|
|
376
384
|
// Handles list objects requests from the remote automation framework
|
|
@@ -894,8 +902,24 @@ class SSFHost {
|
|
|
894
902
|
*/
|
|
895
903
|
#dropClosedPopupGuest = (guest) => {
|
|
896
904
|
if (!guest || !this.#isPopupWindowClosed(guest.window)) return guest;
|
|
897
|
-
this.#
|
|
898
|
-
|
|
905
|
+
if (!this.#guestsUnloading.has(guest.id)) {
|
|
906
|
+
this.#unloadGuestAndNotifyHost(guest.id);
|
|
907
|
+
}
|
|
908
|
+
if (this.#getGuestForUrl(guest.url) === guest) {
|
|
909
|
+
this.#detachClosedPopupGuest(guest);
|
|
910
|
+
}
|
|
911
|
+
return this.#getGuestForUrl(guest.url) === guest ? guest : null;
|
|
912
|
+
};
|
|
913
|
+
/**
|
|
914
|
+
* Removes a closed popup from host maps without waiting on module events.
|
|
915
|
+
* @param guest popup guest whose window is already closed
|
|
916
|
+
*/
|
|
917
|
+
#detachClosedPopupGuest = (guest) => {
|
|
918
|
+
if (!this.#guestCloseNotified.has(guest.id)) {
|
|
919
|
+
this.#guestCloseNotified.add(guest.id);
|
|
920
|
+
this.#fireGuestCloseCallbacks(guest.id);
|
|
921
|
+
}
|
|
922
|
+
this.#finalizeGuestRemoval(guest);
|
|
899
923
|
};
|
|
900
924
|
/**
|
|
901
925
|
* Frees a closed popup at this URL before a new one is opened.
|
|
@@ -934,33 +958,18 @@ class SSFHost {
|
|
|
934
958
|
} else {
|
|
935
959
|
const windowFeatures = Object.entries({ width, height, top, left }).filter(([, v]) => v).map(([k, v]) => `${k}=${v}`).join(",");
|
|
936
960
|
const { popupUrl, handshakeToken, trusted } = this.#buildPopupUrl(url);
|
|
937
|
-
const guestWindow =
|
|
961
|
+
const guestWindow = this.#openNamedPopup({
|
|
938
962
|
popupUrl,
|
|
939
963
|
title,
|
|
940
|
-
|
|
941
|
-
|
|
964
|
+
guestId,
|
|
965
|
+
features: `popup, ${windowFeatures}`,
|
|
966
|
+
retryClosedWindow: !trusted
|
|
967
|
+
});
|
|
942
968
|
if (!guestWindow) {
|
|
943
|
-
|
|
944
|
-
try {
|
|
945
|
-
onError?.(guestId);
|
|
946
|
-
} catch (error) {
|
|
947
|
-
this.#logger.debug(
|
|
948
|
-
`Error occurred in onError for guest with id '${guestId}': ${error.message}`
|
|
949
|
-
);
|
|
950
|
-
}
|
|
951
|
-
}, 0);
|
|
969
|
+
this.#notifyGuestFrameCallback(guestId, onError, "onError");
|
|
952
970
|
throw new Error("Failed to open guest application in popup window");
|
|
953
|
-
} else {
|
|
954
|
-
setTimeout(() => {
|
|
955
|
-
try {
|
|
956
|
-
onLoad?.(guestId);
|
|
957
|
-
} catch (error) {
|
|
958
|
-
this.#logger.debug(
|
|
959
|
-
`Error occurred in onLoad for guest with id '${guestId}': ${error.message}`
|
|
960
|
-
);
|
|
961
|
-
}
|
|
962
|
-
}, 0);
|
|
963
971
|
}
|
|
972
|
+
this.#notifyGuestFrameCallback(guestId, onLoad, "onLoad");
|
|
964
973
|
if (!trusted) {
|
|
965
974
|
guestWindow.opener = null;
|
|
966
975
|
}
|
|
@@ -978,6 +987,33 @@ class SSFHost {
|
|
|
978
987
|
}
|
|
979
988
|
return guest;
|
|
980
989
|
};
|
|
990
|
+
/**
|
|
991
|
+
* Opens a popup. A cross-site window that comes back already closed is
|
|
992
|
+
* opened once more under a new name, still in this turn. Trusted and
|
|
993
|
+
* same-site popups use a single window.open, including when it returns
|
|
994
|
+
* a closed window.
|
|
995
|
+
* @param param popup url, names, and window features
|
|
996
|
+
* @param param.popupUrl url passed to window.open
|
|
997
|
+
* @param param.title window name to try first
|
|
998
|
+
* @param param.guestId used to build a fresh window name on retry
|
|
999
|
+
* @param param.features window.open features string
|
|
1000
|
+
* @param param.retryClosedWindow reopen under a new name when the first window is closed
|
|
1001
|
+
* @returns the window to attach, or null when the popup could not be opened
|
|
1002
|
+
*/
|
|
1003
|
+
#openNamedPopup = (param) => {
|
|
1004
|
+
const { popupUrl, title, guestId, features, retryClosedWindow } = param;
|
|
1005
|
+
let targetName = title;
|
|
1006
|
+
let guestWindow = window.open(popupUrl, targetName, features);
|
|
1007
|
+
if (retryClosedWindow && guestWindow && this.#isPopupWindowClosed(guestWindow)) {
|
|
1008
|
+
targetName = `${title}-${guestId}`;
|
|
1009
|
+
guestWindow = window.open(popupUrl, targetName, features);
|
|
1010
|
+
}
|
|
1011
|
+
if (!guestWindow) return null;
|
|
1012
|
+
if (retryClosedWindow && this.#isPopupWindowClosed(guestWindow)) {
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
1015
|
+
return guestWindow;
|
|
1016
|
+
};
|
|
981
1017
|
#notifyGuestFrameCallback = (guestId, callback, label) => {
|
|
982
1018
|
setTimeout(() => {
|
|
983
1019
|
try {
|
|
@@ -1562,7 +1598,8 @@ class SSFHost {
|
|
|
1562
1598
|
this.#guestsUnloading.add(guest.id);
|
|
1563
1599
|
try {
|
|
1564
1600
|
const windowClosed = guest.openMode === OpenMode.Popup ? this.#isPopupWindowClosed(guest.window) : Boolean(guest.window?.closed);
|
|
1565
|
-
const
|
|
1601
|
+
const popupCloseRequested = this.#popupGuestCloseIds.has(guest.id);
|
|
1602
|
+
const guestContextDestroyed = windowClosed || this.#isEmbedGuestDetached(guest) || popupCloseRequested;
|
|
1566
1603
|
if (!guestContextDestroyed) {
|
|
1567
1604
|
if (!await this.#canUnloadGuest(guest)) {
|
|
1568
1605
|
this.#guestCloseNotified.delete(guest.id);
|
|
@@ -1573,6 +1610,7 @@ class SSFHost {
|
|
|
1573
1610
|
this.#finalizeGuestRemoval(guest);
|
|
1574
1611
|
} finally {
|
|
1575
1612
|
this.#guestsUnloading.delete(guest.id);
|
|
1613
|
+
this.#popupGuestCloseIds.delete(guest.id);
|
|
1576
1614
|
}
|
|
1577
1615
|
};
|
|
1578
1616
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>CallChain E2E Test - Root Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>CallChain E2E Test - Root Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.cc299d33bc6c79fa47d8.js"></script></head><body class="bg-gray-50"><header class="bg-indigo-600 text-white px-4 py-3 flex items-center justify-between"><h1 class="text-lg font-semibold">CallChain E2E Test — Root Host (A)</h1><a href="./index.html" class="text-indigo-200 hover:text-white text-sm">← Back to main</a></header><main class="mx-auto max-w-7xl px-4 py-4"><div class="grid grid-cols-2 gap-4 mb-4"><div class="bg-blue-50 border border-blue-200 rounded-md p-3"><h2 class="text-sm font-bold text-blue-900 mb-2">Architecture</h2><pre class="text-xs text-blue-800 leading-relaxed">
|
|
2
2
|
Root Host (A) [localhost:4000]
|
|
3
3
|
├─ Exposes: <strong>TestService</strong> scripting object
|
|
4
4
|
├─ Loads guest <strong>"intermediateHost"</strong>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Intermediate Guest+Host (B)</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script src="http://localhost:4001/index.js"></script><script defer="defer" src="js/emuiSsfHost.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Intermediate Guest+Host (B)</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script src="http://localhost:4001/index.js"></script><script defer="defer" src="js/emuiSsfHost.cc299d33bc6c79fa47d8.js"></script></head><body class="bg-orange-50 p-2"><h2 class="text-sm font-semibold text-orange-800 mb-1">Intermediate (B) — Guest + Host</h2><div data-testid="intermediate-status" id="status" class="text-xs bg-orange-100 rounded p-2 mb-2 min-h-[30px]">Initializing...</div><div data-testid="grandchild-container" id="grandchild-container" class="border border-dashed border-orange-400 rounded h-[250px]"></div><script type="module">import{Analytics}from"./analytics-object-v2.js";import{getGuestBaseUrl,getHost}from"./utils.js";const statusEl=document.getElementById("status"),log=t=>{const e=(new Date).toLocaleTimeString();statusEl.innerHTML+=`<div>[${e}] ${t}</div>`};(async()=>{try{log("Connecting to Root Host (A) as V2 guest...");const t=new ice.guest.SSFGuest({logger:{index:"intermediate-guest",team:"ui platform",appName:"intermediate-b"},keepAlive:!1});await t.connect(),log("Connected to Root Host (A)");const e=await t.getObject("TestService");log("Got TestService proxy from Root Host (A)");const o=new Analytics,a=getHost(o);if(!a)return void log("ERROR: Failed to create intermediate SSFHost");log("Created intermediate SSFHost (B)");const n=a.cloneScriptingObject(e);a.addScriptingObject(n),log("Cloned TestService for grandchild guests");const i=await getGuestBaseUrl();a.loadGuest({id:"grandchildGuest",url:new URL("./callchain-grandchild.html",i).href,title:"Grandchild Guest (C)",targetElement:document.getElementById("grandchild-container"),metadata:{role:"validator",region:"US-East"},onLoad:()=>log("Grandchild guest (C) loaded"),onError:()=>log("ERROR: Grandchild guest (C) failed to load")}),log("Intermediate (B) ready")}catch(t){log(`ERROR: ${t.message}`)}})()</script></body></html>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>SSF E2E — Comprehensive Host Test</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.a710a0562fe60b877957.js"></script></head><body class="bg-gray-50 text-sm"><header class="bg-indigo-700 text-white px-4 py-3 flex items-center justify-between"><h1 class="text-lg font-semibold">Comprehensive E2E Host Test</h1><a href="./e2e-index.html" class="text-indigo-200 hover:text-white text-sm">← Test Suite</a></header><main class="mx-auto max-w-7xl px-4 py-3"><div class="grid grid-cols-2 gap-3 mb-3"><div class="bg-blue-50 border border-blue-200 rounded-md p-3"><h2 class="text-sm font-bold text-blue-900 mb-1">How to Use This Page</h2><ol class="text-xs text-blue-800 space-y-1 list-decimal list-inside"><li>Start the host dev server (port 4000) and guest dev server (port 4001).</li><li>Buttons in <strong>Column 1</strong> (left) execute host-side actions.</li><li><strong>Column 2</strong> (center) shows embedded guest iframes — interact with them to invoke methods, subscribe to events, etc.</li><li><strong>Column 3</strong> (right) shows live results: Event Log, callContext, dispatch results, and the guest list.</li><li>Work through the buttons <strong>top to bottom</strong> for the recommended flow. Each button is labelled with a test case ID (TC-xxx).</li></ol></div><div class="bg-amber-50 border border-amber-200 rounded-md p-3"><h2 class="text-sm font-bold text-amber-900 mb-1">Recommended Flow</h2><ol class="text-xs text-amber-800 space-y-1 list-decimal list-inside"><li><strong>Load guests</strong>: TC-LOAD-01 (embed) → TC-LOAD-02 (popup) → TC-LOAD-04 (with params). Check Event Log for "loaded" messages.</li><li><strong>Scripting objects</strong>: TC-SO-01 (add Inventory). In the guest iframe, call <code>getObject("Inventory")</code> and invoke <code>getStock()</code>. Check return value and callContext.</li><li><strong>Events</strong>: In the guest, subscribe to <code>Loan.onPreSave</code>. Then click TC-EVT-01 on the host. Guest should receive the event.</li><li><strong>Lifecycle</strong>: TC-LIFE-01 (unload), TC-LIFE-03 (close host). Verify guests are removed and host is destroyed.</li></ol></div></div><div class="grid grid-cols-3 gap-3"><div class="space-y-3"><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Guest Loading</h2><div class="space-y-2"><button data-testid="btn-load-embed" id="btnLoadEmbed" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-LOAD-01: Load Embedded Guest</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest iframe appears in center column, log shows "loaded"</p><button data-testid="btn-load-popup" id="btnLoadPopup" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-LOAD-02: Load Popup Guest</button><p class="text-[10px] text-gray-400 -mt-1">Expected: new browser popup window opens</p><button data-testid="btn-load-multiple" id="btnLoadMultiple" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-LOAD-03: loadGuests (3 instances)</button><p class="text-[10px] text-gray-400 -mt-1">Expected: 3 guest iframes load, "List all guests" shows 3+ entries</p><button data-testid="btn-load-with-params" id="btnLoadWithParams" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-LOAD-04: Load with searchParams</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest shows URL params in its "Params:" line</p><button data-testid="btn-load-with-metadata" id="btnLoadWithMetadata" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-META-01: Load with metadata</button><p class="text-[10px] text-gray-400 -mt-1">Expected: when guest invokes a method, callContext.callChain shows metadata</p><button data-testid="btn-load-bad-url" id="btnLoadBadUrl" class="w-full rounded bg-red-600 px-3 py-1.5 text-xs text-white hover:bg-red-700">TC-LOAD-05: Load invalid URL (onError)</button><p class="text-[10px] text-gray-400 -mt-1">Expected: log shows "ERROR" or onError callback fires</p></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Scripting Object Management</h2><div class="space-y-2"><button data-testid="btn-add-so" id="btnAddSO" class="w-full rounded bg-green-600 px-3 py-1.5 text-xs text-white hover:bg-green-700">TC-SO-01: Add "Inventory" Object</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest can now <code>getObject("Inventory")</code> and invoke its methods</p><button data-testid="btn-add-guest-so" id="btnAddGuestSO" class="w-full rounded bg-green-600 px-3 py-1.5 text-xs text-white hover:bg-green-700">TC-SO-04: Add Guest-Scoped Object</button><p class="text-[10px] text-gray-400 -mt-1">Expected: only the target guest can access this object, others get "not available"</p><button data-testid="btn-remove-so" id="btnRemoveSO" class="w-full rounded bg-yellow-600 px-3 py-1.5 text-xs text-white hover:bg-yellow-700">TC-SO-02: Remove "Inventory" Object</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest's <code>getObject("Inventory")</code> now fails</p><button data-testid="btn-remove-all-so" id="btnRemoveAllSO" class="w-full rounded bg-yellow-600 px-3 py-1.5 text-xs text-white hover:bg-yellow-700">TC-SO-02b: Remove All Objects</button><p class="text-[10px] text-gray-400 -mt-1">Expected: all getObject calls fail until objects are re-added</p></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Event Dispatching</h2><div class="space-y-2"><button data-testid="btn-dispatch-all" id="btnDispatchAll" class="w-full rounded bg-purple-600 px-3 py-1.5 text-xs text-white hover:bg-purple-700">TC-EVT-01: Dispatch onPreSave to all</button><p class="text-[10px] text-gray-400 -mt-1">Expected: all guests subscribed to onPreSave receive the event</p><button data-testid="btn-dispatch-targeted" id="btnDispatchTargeted" class="w-full rounded bg-purple-600 px-3 py-1.5 text-xs text-white hover:bg-purple-700">TC-EVT-02: Dispatch to specific guest</button><p class="text-[10px] text-gray-400 -mt-1">Expected: only the targeted guest receives the event</p><button data-testid="btn-dispatch-feedback" id="btnDispatchFeedback" class="w-full rounded bg-purple-600 px-3 py-1.5 text-xs text-white hover:bg-purple-700">TC-EVT-03: Dispatch with timeout (feedback)</button><p class="text-[10px] text-gray-400 -mt-1">Expected: Dispatch Results shows the guest's feedback return value</p><button data-testid="btn-dispatch-amount" id="btnDispatchAmount" class="w-full rounded bg-purple-600 px-3 py-1.5 text-xs text-white hover:bg-purple-700">TC-EVT-04: Dispatch onAmountChanged (criteria)</button><p class="text-[10px] text-gray-400 -mt-1">Expected: only guests subscribed with matching criteria receive it</p></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Guest Lifecycle</h2><div class="space-y-2"><button data-testid="btn-unload-guest" id="btnUnloadGuest" class="w-full rounded bg-orange-600 px-3 py-1.5 text-xs text-white hover:bg-orange-700">TC-LIFE-01: Unload first embedded guest</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest iframe removed, "List all guests" count decreases</p><button data-testid="btn-register-close" id="btnRegisterClose" class="w-full rounded bg-orange-600 px-3 py-1.5 text-xs text-white hover:bg-orange-700">TC-LIFE-02: Register onGuestClose</button><p class="text-[10px] text-gray-400 -mt-1">Expected: log shows callback registered; fires when guest calls close()</p><button data-testid="btn-list-guests" id="btnListGuests" class="w-full rounded bg-gray-600 px-3 py-1.5 text-xs text-white hover:bg-gray-700">List all guests</button><p class="text-[10px] text-gray-400 -mt-1">Expected: Guest List panel shows all currently loaded guests</p><button data-testid="btn-set-loglevel" id="btnSetLogLevel" class="w-full rounded bg-gray-600 px-3 py-1.5 text-xs text-white hover:bg-gray-700">Set Log Level (Debug)</button> <button data-testid="btn-close-host" id="btnCloseHost" class="w-full rounded bg-red-700 px-3 py-1.5 text-xs text-white hover:bg-red-800">TC-LIFE-03: Close host</button><p class="text-[10px] text-gray-400 -mt-1">Expected: all guests unloaded, host destroyed, further actions fail</p></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Sandbox Configuration</h2><div class="space-y-2"><button data-testid="btn-sandbox-default" id="btnSandboxDefault" class="w-full rounded bg-teal-600 px-3 py-1.5 text-xs text-white hover:bg-teal-700">TC-SB-01: Default sandbox</button><p class="text-[10px] text-gray-400 -mt-1">Expected: iframe has standard sandbox attributes</p><button data-testid="btn-sandbox-custom" id="btnSandboxCustom" class="w-full rounded bg-teal-600 px-3 py-1.5 text-xs text-white hover:bg-teal-700">TC-SB-02: Custom sandbox values</button><p class="text-[10px] text-gray-400 -mt-1">Expected: iframe sandbox attribute reflects custom permissions</p><button data-testid="btn-sandbox-disabled" id="btnSandboxDisabled" class="w-full rounded bg-teal-600 px-3 py-1.5 text-xs text-white hover:bg-teal-700">TC-SB-03: Sandbox disabled</button><p class="text-[10px] text-gray-400 -mt-1">Expected: iframe has no sandbox attribute (full permissions)</p></div></div></div><div class="space-y-3"><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Embedded Guests</h2><div data-testid="embed-container" id="embedContainer" class="border-2 border-dashed border-indigo-300 rounded min-h-[300px] space-y-2"></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Sandbox Test Container</h2><div data-testid="sandbox-container" id="sandboxContainer" class="border-2 border-dashed border-teal-300 rounded min-h-[150px] space-y-2"></div></div></div><div class="space-y-3"><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Event Log</h2><div data-testid="event-log" id="eventLog" class="text-xs bg-gray-100 rounded p-2 min-h-[200px] max-h-[350px] overflow-y-auto font-mono"></div><button data-testid="btn-clear-log" id="btnClearLog" class="mt-1 text-xs text-gray-400 hover:text-gray-600">Clear</button></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">callContext (last invocation)</h2><div data-testid="callcontext-panel"><h3 class="text-xs text-gray-500">callContext.guest</h3><pre data-testid="callcontext-guest" id="callContextGuest" class="text-xs bg-gray-100 rounded p-1 mb-1 whitespace-pre-wrap min-h-[30px]">
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>SSF E2E — Comprehensive Host Test</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.cc299d33bc6c79fa47d8.js"></script></head><body class="bg-gray-50 text-sm"><header class="bg-indigo-700 text-white px-4 py-3 flex items-center justify-between"><h1 class="text-lg font-semibold">Comprehensive E2E Host Test</h1><a href="./e2e-index.html" class="text-indigo-200 hover:text-white text-sm">← Test Suite</a></header><main class="mx-auto max-w-7xl px-4 py-3"><div class="grid grid-cols-2 gap-3 mb-3"><div class="bg-blue-50 border border-blue-200 rounded-md p-3"><h2 class="text-sm font-bold text-blue-900 mb-1">How to Use This Page</h2><ol class="text-xs text-blue-800 space-y-1 list-decimal list-inside"><li>Start the host dev server (port 4000) and guest dev server (port 4001).</li><li>Buttons in <strong>Column 1</strong> (left) execute host-side actions.</li><li><strong>Column 2</strong> (center) shows embedded guest iframes — interact with them to invoke methods, subscribe to events, etc.</li><li><strong>Column 3</strong> (right) shows live results: Event Log, callContext, dispatch results, and the guest list.</li><li>Work through the buttons <strong>top to bottom</strong> for the recommended flow. Each button is labelled with a test case ID (TC-xxx).</li></ol></div><div class="bg-amber-50 border border-amber-200 rounded-md p-3"><h2 class="text-sm font-bold text-amber-900 mb-1">Recommended Flow</h2><ol class="text-xs text-amber-800 space-y-1 list-decimal list-inside"><li><strong>Load guests</strong>: TC-LOAD-01 (embed) → TC-LOAD-02 (popup) → TC-LOAD-04 (with params). Check Event Log for "loaded" messages.</li><li><strong>Scripting objects</strong>: TC-SO-01 (add Inventory). In the guest iframe, call <code>getObject("Inventory")</code> and invoke <code>getStock()</code>. Check return value and callContext.</li><li><strong>Events</strong>: In the guest, subscribe to <code>Loan.onPreSave</code>. Then click TC-EVT-01 on the host. Guest should receive the event.</li><li><strong>Lifecycle</strong>: TC-LIFE-01 (unload), TC-LIFE-03 (close host). Verify guests are removed and host is destroyed.</li></ol></div></div><div class="grid grid-cols-3 gap-3"><div class="space-y-3"><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Guest Loading</h2><div class="space-y-2"><button data-testid="btn-load-embed" id="btnLoadEmbed" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-LOAD-01: Load Embedded Guest</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest iframe appears in center column, log shows "loaded"</p><button data-testid="btn-load-popup" id="btnLoadPopup" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-LOAD-02: Load Popup Guest</button><p class="text-[10px] text-gray-400 -mt-1">Expected: new browser popup window opens</p><button data-testid="btn-load-multiple" id="btnLoadMultiple" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-LOAD-03: loadGuests (3 instances)</button><p class="text-[10px] text-gray-400 -mt-1">Expected: 3 guest iframes load, "List all guests" shows 3+ entries</p><button data-testid="btn-load-with-params" id="btnLoadWithParams" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-LOAD-04: Load with searchParams</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest shows URL params in its "Params:" line</p><button data-testid="btn-load-with-metadata" id="btnLoadWithMetadata" class="w-full rounded bg-indigo-600 px-3 py-1.5 text-xs text-white hover:bg-indigo-700">TC-META-01: Load with metadata</button><p class="text-[10px] text-gray-400 -mt-1">Expected: when guest invokes a method, callContext.callChain shows metadata</p><button data-testid="btn-load-bad-url" id="btnLoadBadUrl" class="w-full rounded bg-red-600 px-3 py-1.5 text-xs text-white hover:bg-red-700">TC-LOAD-05: Load invalid URL (onError)</button><p class="text-[10px] text-gray-400 -mt-1">Expected: log shows "ERROR" or onError callback fires</p></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Scripting Object Management</h2><div class="space-y-2"><button data-testid="btn-add-so" id="btnAddSO" class="w-full rounded bg-green-600 px-3 py-1.5 text-xs text-white hover:bg-green-700">TC-SO-01: Add "Inventory" Object</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest can now <code>getObject("Inventory")</code> and invoke its methods</p><button data-testid="btn-add-guest-so" id="btnAddGuestSO" class="w-full rounded bg-green-600 px-3 py-1.5 text-xs text-white hover:bg-green-700">TC-SO-04: Add Guest-Scoped Object</button><p class="text-[10px] text-gray-400 -mt-1">Expected: only the target guest can access this object, others get "not available"</p><button data-testid="btn-remove-so" id="btnRemoveSO" class="w-full rounded bg-yellow-600 px-3 py-1.5 text-xs text-white hover:bg-yellow-700">TC-SO-02: Remove "Inventory" Object</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest's <code>getObject("Inventory")</code> now fails</p><button data-testid="btn-remove-all-so" id="btnRemoveAllSO" class="w-full rounded bg-yellow-600 px-3 py-1.5 text-xs text-white hover:bg-yellow-700">TC-SO-02b: Remove All Objects</button><p class="text-[10px] text-gray-400 -mt-1">Expected: all getObject calls fail until objects are re-added</p></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Event Dispatching</h2><div class="space-y-2"><button data-testid="btn-dispatch-all" id="btnDispatchAll" class="w-full rounded bg-purple-600 px-3 py-1.5 text-xs text-white hover:bg-purple-700">TC-EVT-01: Dispatch onPreSave to all</button><p class="text-[10px] text-gray-400 -mt-1">Expected: all guests subscribed to onPreSave receive the event</p><button data-testid="btn-dispatch-targeted" id="btnDispatchTargeted" class="w-full rounded bg-purple-600 px-3 py-1.5 text-xs text-white hover:bg-purple-700">TC-EVT-02: Dispatch to specific guest</button><p class="text-[10px] text-gray-400 -mt-1">Expected: only the targeted guest receives the event</p><button data-testid="btn-dispatch-feedback" id="btnDispatchFeedback" class="w-full rounded bg-purple-600 px-3 py-1.5 text-xs text-white hover:bg-purple-700">TC-EVT-03: Dispatch with timeout (feedback)</button><p class="text-[10px] text-gray-400 -mt-1">Expected: Dispatch Results shows the guest's feedback return value</p><button data-testid="btn-dispatch-amount" id="btnDispatchAmount" class="w-full rounded bg-purple-600 px-3 py-1.5 text-xs text-white hover:bg-purple-700">TC-EVT-04: Dispatch onAmountChanged (criteria)</button><p class="text-[10px] text-gray-400 -mt-1">Expected: only guests subscribed with matching criteria receive it</p></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Guest Lifecycle</h2><div class="space-y-2"><button data-testid="btn-unload-guest" id="btnUnloadGuest" class="w-full rounded bg-orange-600 px-3 py-1.5 text-xs text-white hover:bg-orange-700">TC-LIFE-01: Unload first embedded guest</button><p class="text-[10px] text-gray-400 -mt-1">Expected: guest iframe removed, "List all guests" count decreases</p><button data-testid="btn-register-close" id="btnRegisterClose" class="w-full rounded bg-orange-600 px-3 py-1.5 text-xs text-white hover:bg-orange-700">TC-LIFE-02: Register onGuestClose</button><p class="text-[10px] text-gray-400 -mt-1">Expected: log shows callback registered; fires when guest calls close()</p><button data-testid="btn-list-guests" id="btnListGuests" class="w-full rounded bg-gray-600 px-3 py-1.5 text-xs text-white hover:bg-gray-700">List all guests</button><p class="text-[10px] text-gray-400 -mt-1">Expected: Guest List panel shows all currently loaded guests</p><button data-testid="btn-set-loglevel" id="btnSetLogLevel" class="w-full rounded bg-gray-600 px-3 py-1.5 text-xs text-white hover:bg-gray-700">Set Log Level (Debug)</button> <button data-testid="btn-close-host" id="btnCloseHost" class="w-full rounded bg-red-700 px-3 py-1.5 text-xs text-white hover:bg-red-800">TC-LIFE-03: Close host</button><p class="text-[10px] text-gray-400 -mt-1">Expected: all guests unloaded, host destroyed, further actions fail</p></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Sandbox Configuration</h2><div class="space-y-2"><button data-testid="btn-sandbox-default" id="btnSandboxDefault" class="w-full rounded bg-teal-600 px-3 py-1.5 text-xs text-white hover:bg-teal-700">TC-SB-01: Default sandbox</button><p class="text-[10px] text-gray-400 -mt-1">Expected: iframe has standard sandbox attributes</p><button data-testid="btn-sandbox-custom" id="btnSandboxCustom" class="w-full rounded bg-teal-600 px-3 py-1.5 text-xs text-white hover:bg-teal-700">TC-SB-02: Custom sandbox values</button><p class="text-[10px] text-gray-400 -mt-1">Expected: iframe sandbox attribute reflects custom permissions</p><button data-testid="btn-sandbox-disabled" id="btnSandboxDisabled" class="w-full rounded bg-teal-600 px-3 py-1.5 text-xs text-white hover:bg-teal-700">TC-SB-03: Sandbox disabled</button><p class="text-[10px] text-gray-400 -mt-1">Expected: iframe has no sandbox attribute (full permissions)</p></div></div></div><div class="space-y-3"><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Embedded Guests</h2><div data-testid="embed-container" id="embedContainer" class="border-2 border-dashed border-indigo-300 rounded min-h-[300px] space-y-2"></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Sandbox Test Container</h2><div data-testid="sandbox-container" id="sandboxContainer" class="border-2 border-dashed border-teal-300 rounded min-h-[150px] space-y-2"></div></div></div><div class="space-y-3"><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Event Log</h2><div data-testid="event-log" id="eventLog" class="text-xs bg-gray-100 rounded p-2 min-h-[200px] max-h-[350px] overflow-y-auto font-mono"></div><button data-testid="btn-clear-log" id="btnClearLog" class="mt-1 text-xs text-gray-400 hover:text-gray-600">Clear</button></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">callContext (last invocation)</h2><div data-testid="callcontext-panel"><h3 class="text-xs text-gray-500">callContext.guest</h3><pre data-testid="callcontext-guest" id="callContextGuest" class="text-xs bg-gray-100 rounded p-1 mb-1 whitespace-pre-wrap min-h-[30px]">
|
|
2
2
|
—</pre><h3 class="text-xs text-gray-500">callContext.callChain</h3><pre data-testid="callcontext-chain" id="callContextChain" class="text-xs bg-gray-100 rounded p-1 mb-1 whitespace-pre-wrap min-h-[30px]">
|
|
3
3
|
—</pre></div></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Dispatch Results</h2><pre data-testid="dispatch-result" id="dispatchResult" class="text-xs bg-gray-100 rounded p-2 min-h-[60px] whitespace-pre-wrap">
|
|
4
4
|
—</pre></div><div class="bg-white rounded-lg shadow p-3"><h2 class="font-semibold text-gray-700 mb-2 border-b pb-1">Guest List</h2><pre data-testid="guest-list" id="guestList" class="text-xs bg-gray-100 rounded p-2 min-h-[60px] whitespace-pre-wrap">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>SSF E2E Test Suite</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiSsfHost.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>SSF E2E Test Suite</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiSsfHost.cc299d33bc6c79fa47d8.js"></script></head><body class="bg-gray-50"><header class="bg-gray-900 text-white px-6 py-4"><h1 class="text-xl font-bold">SSF End-to-End Test Suite</h1><p class="text-sm text-gray-400 mt-1">Comprehensive blackbox tests for SSF Host & Guest. Each page includes test steps, expected values, and a verification checklist.</p></header><main class="mx-auto max-w-5xl px-6 py-6"><section class="mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4"><h2 class="text-sm font-semibold text-yellow-800 mb-2">Setup Instructions</h2><ol class="text-xs text-yellow-700 list-decimal ml-4 space-y-1"><li>Install dependencies: <code class="bg-yellow-100 px-1 rounded">pnpm install</code></li><li>Start SSF Host dev server: <code class="bg-yellow-100 px-1 rounded">pnpm nx run ssf-host:start-server</code> (port 4000)</li><li>Start SSF Guest dev server: <code class="bg-yellow-100 px-1 rounded">pnpm nx run ssf-guest:start</code> (port 4001)</li><li>Open <code class="bg-yellow-100 px-1 rounded">http://localhost:4000/e2e-index.html</code> in the browser</li><li>Each test page has <code class="bg-yellow-100 px-1 rounded">data-testid</code> attributes for Playwright/Cypress selectors</li></ol></section><section class="mb-6"><h2 class="text-lg font-semibold text-gray-800 border-b pb-1 mb-3">1. Core Host-Guest Communication</h2><div class="grid grid-cols-1 md:grid-cols-2 gap-3"><a href="./e2e-host.html" data-testid="link-e2e-host" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Comprehensive E2E Host</h3><p class="text-xs text-gray-500 mt-1">All host-guest scenarios: guest loading, scripting objects, events, lifecycle, metadata, sandbox, guest-scoped objects.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Guests load in iframes/popups. Scripting objects can be added/removed/invoked. Events reach subscribed guests. Unload/close cleans up properly. Sandbox attrs applied.</p><div class="mt-2 text-xs text-gray-400"><strong>Test Cases:</strong> TC-LOAD-01..05 • TC-SO-01..08 • TC-EVT-01..04 • TC-LIFE-01..03 • TC-META-01 • TC-SB-01..03</div></a><a href="./index.html" data-testid="link-main-demo" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Main Demo App</h3><p class="text-xs text-gray-500 mt-1">Original Loan Application demo with embedded and popup guests, events, scripting objects.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Loan form data flows to guests. Events (onLoanAmountChanged, etc.) update guest UIs. Popup guests open and interact with the Loan object.</p></a></div></section><section class="mb-6"><h2 class="text-lg font-semibold text-gray-800 border-b pb-1 mb-3">2. Call Chain & Metadata Propagation</h2><div class="grid grid-cols-1 md:grid-cols-2 gap-3"><a href="./callchain-host.html" data-testid="link-callchain" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Nested CallChain Test (A → B → C)</h3><p class="text-xs text-gray-500 mt-1">Root Host (A) → Intermediate Guest+Host (B) → Grandchild Guest (C). Verifies callContext.callChain and metadata propagation.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Click buttons in Grandchild C. Host A should show <code>callContext.guest</code> = B and <code>callChain</code> containing C and B with their metadata. Return values should flow back to C.</p><div class="mt-2 text-xs text-gray-400"><strong>Test Cases:</strong> TC-CC-01..07</div></a></div></section><section class="mb-6"><h2 class="text-lg font-semibold text-gray-800 border-b pb-1 mb-3">3. Popup Guest Behavior</h2><div class="grid grid-cols-1 md:grid-cols-2 gap-3"><a href="./popup-focus-host.html" data-testid="link-popup-focus" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Popup Focus & Lifecycle</h3><p class="text-xs text-gray-500 mt-1">Open, close, and refocus popup guests. Tests trusted vs untrusted domain behavior.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Trusted popups (localhost): re-open brings existing popup to front. Untrusted popups: opener is nulled, focus falls back to WindowProxy. Closed popup detection updates guest status.</p><div class="mt-2 text-xs text-gray-400"><strong>Test Cases:</strong> TC-POP-01..11</div></a></div></section><section class="mb-6"><h2 class="text-lg font-semibold text-gray-800 border-b pb-1 mb-3">4. V1 / V2 Interoperability</h2><div class="grid grid-cols-1 md:grid-cols-2 gap-3"><a href="./v2-host-v1-guest.html" data-testid="link-v2-host-v1-guest" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">V2 Host → V1 Guest</h3><p class="text-xs text-gray-500 mt-1">V2 host loads V1 guest. Loan object, save flow, event feedback.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> V1 guest connects, gets objects, subscribes to events, and returns feedback correctly.</p><div class="mt-2 text-xs text-gray-400"><strong>Test Cases:</strong> TC-INTEROP-01..04</div></a><a href="./v2-host-v1-guest.html?nestV1GuestV2Host=true" data-testid="link-v2-v1-v2-chain" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">V2 Host → V1 Guest → V2 Host → V2 Guest</h3><p class="text-xs text-gray-500 mt-1">Full mixed-version chain. V1 guest acts as intermediate host for a V2 grandchild.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Scripting objects are cloned across V1/V2 boundary. Events flow through all layers.</p><div class="mt-2 text-xs text-gray-400"><strong>Test Cases:</strong> TC-INTEROP-05..07</div></a></div><div class="grid grid-cols-1 md:grid-cols-2 gap-3 mt-3"><a href="./v1-host.html" data-testid="link-v1-host" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">V1 Host → V1 Guest → V2 Host → V2 Guest</h3><p class="text-xs text-gray-500 mt-1">Starting from V1 host. Exercises the full V1-to-V2 upgrade path.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> V1 host initializes. V1 guest connects. V2 host/guest chain works through V1 intermediate.</p></a></div></section></main></body></html>
|
package/dist/public/index.html
CHANGED
|
@@ -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.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.
|
|
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.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.cc299d33bc6c79fa47d8.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center justify-between"><div class="px-2">ICE Mortgage Product</div><nav class="flex gap-3 px-2 text-xs"><a href="./e2e-index.html" data-testid="nav-e2e-suite" class="text-indigo-800 hover:text-indigo-950 underline font-bold">E2E Test Suite</a> <a href="./e2e-host.html" data-testid="nav-e2e-host" class="text-indigo-800 hover:text-indigo-950 underline">Comprehensive E2E</a> <a href="./callchain-host.html" data-testid="nav-callchain-test" class="text-indigo-800 hover:text-indigo-950 underline">CallChain</a> <a href="./popup-focus-host.html" data-testid="nav-popup-focus-test" class="text-indigo-800 hover:text-indigo-950 underline">Popup Focus</a> <a href="./v2-host-v1-guest.html" data-testid="nav-v1-interop" class="text-indigo-800 hover:text-indigo-950 underline">V1 Interop</a></nav></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(I,O){typeof exports=="object"&&typeof module=="object"?module.exports=O():typeof define=="function"&&define.amd?define([],O):typeof exports=="object"?exports.ice=O():(I.ice=I.ice||{},I.ice.host=O())})(globalThis,()=>(()=>{"use strict";const y={};y.d=(n,e)=>{for(var t in e)y.o(e,t)&&!y.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},y.o=(n,e)=>Object.hasOwn(n,e),y.r=n=>{Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};let I={};y.r(I),y.d(I,{Event:()=>O,Guest:()=>x,IFrameSandboxValues:()=>S,OnDuplicate:()=>M,OpenMode:()=>g,SANDBOX_DEFAULT:()=>J,SSFHost:()=>Ie,ScriptingObject:()=>P});class O{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 R{static[Symbol.hasInstance](e){return typeof e=="object"&&e!==null&&"getType"in e&&typeof e.getType=="function"&&e.getType()==="ProxyEvent"}#t;objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:i,eventSrc:s}=e;if(!t)throw new Error("Event name is required");if(!i)throw new Error("Scripting object id is required");if(!s)throw new Error("Event source is required");this.objectId=i,this.name=t,this.#t=s,this.id=`${this.objectId}.${this.name}`.toLowerCase()}subscribe=e=>this.#t.subscribe({eventId:this.id,callback:e});unsubscribe=e=>{this.#t.unsubscribe({eventId:this.id,token:e})}}const Y=n=>n instanceof O,Te=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`,K="function",Q=(n,e)=>typeof n===K&&!!e&&!e.startsWith("_");class P{#t;#i="Object";constructor(e,t){this.#t=e,this.#i=t||this.#i}get id(){return this.#t}get objectType(){return this.#i}_toJSON=()=>{const e=[],t=[];return Object.keys(this).forEach(i=>{const s=this[i];Y(s)?t.push(i):Q(s,i)&&e.push(i)}),{objectId:this.#t,objectType:this.#i,functions:e,events:t}};_dispose=()=>{};dispose=()=>{}}const C="module";var $e=null,M=(n=>(n.THROW="throw",n.IGNORE="ignore",n))(M||{});class Z{#t=e=>e.trim().toLowerCase();#i=new Map;#e=new Map;#o=e=>{const{so:t,guestId:i,onDuplicate:s="throw",securityContext:r}=e,o=this.#t(t.id),a={so:t,guestId:i,securityContext:r},c=this.#e.get(i);if(!c){this.#e.set(i,new Map([[o,a]]));return}if(c.has(o)){if(s==="ignore")return;throw new Error(`Scripting Object ${t.id} already exists for guest ${i}`)}c.set(o,a)};#s=({so:e})=>{if(e._dispose&&typeof e._dispose=="function")try{e._dispose()}catch{}};#r=({objectId:e,guestId:t})=>{if(e===C&&!t)for(const[,s]of this.#e){const r=s.get(e);if(r)return r}const i=t?this.#e.get(t):null;return i?i.get(e)??null:null};#n=({objectId:e,guestId:t}={})=>{if(t){if(!e){const s=this.#e.get(t);s&&s.forEach(this.#s),this.#e.delete(t);return}const i=this.#e.get(t);if(i){const s=i.get(e);s&&this.#s(s),i.delete(e)}}else e&&this.#e.forEach(i=>{const s=i.get(e);s&&this.#s(s),i.delete(e)})};addScriptingObject=(e,t)=>{const{guestId:i,onDuplicate:s="throw",securityContext:r}=t||{};if(!e?.id||!e?._toJSON)throw new Error("Object is not derived from ScriptingObject");const o=this.#t(e.id);if(o===C&&!i)throw new Error("Guest id is required to add Module scripting object");if(i){this.#o({so:e,...t,guestId:i,onDuplicate:s});return}if(this.#i.has(o)){if(s==="ignore")return;throw new Error(`Scripting Object ${e.id} already exists`)}this.#i.set(o,{so:e,guestId:i,securityContext:r})};getObject=(e,t)=>{const i=this.#t(e);let s=this.#r({objectId:i,guestId:t?.id});s=s??this.#i.get(i)??null;const{so:r}=s||{};return r||null};has=(e,t)=>this.getObject(e,t)!==null;listScriptingObjects=e=>{const t=new Set(this.#i.keys()),i=this.#e.get(e);if(i)for(const s of i.keys())t.add(s);return Array.from(t)};removeScriptingObject=(e,t)=>{const i=this.#t(e);if(t)this.#n({objectId:i,guestId:t});else{this.#n({objectId:i});const s=this.#i.get(i);s&&this.#s(s),this.#i.delete(i)}};removeAllScriptingObjects=e=>{e?this.#n({guestId:e}):(this.#i.forEach(this.#s),this.#i.clear())}}var p=(n=>(n.GuestClose="guest:close",n.GuestEventSubscribe="guest:eventSubscribe",n.GuestEventUnsubscribe="guest:eventUnsubscribe",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||{}),g=(n=>(n.Popup="popup",n.Embed="embed",n))(g||{}),S=(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))(S||{});const ee=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}},te=n=>n.flat(1/0).filter(e=>e!==void 0);function _(n){return typeof n=="function"}const ie=[".ice.com",".elliemae.com",".ellielabs.com",".elliemae.io",".ellieservices.com"],se=["localhost","127.0.0.1"],L=n=>n.split(".").slice(-2).join("."),ne=n=>se.includes(n)||ie.some(e=>n===e.slice(1)||n.endsWith(e)),re=n=>{const e=L(window.location.hostname),t=L(n);return e===t},D=n=>{if(!n)return!1;try{const{hostname:e}=new URL(n,document.baseURI);return ne(e)||re(e)}catch{return!1}},oe=1e3,ae=10,ce=30,de=n=>typeof n!="number"||!Number.isFinite(n)?n===void 0?ae:1:Math.min(ce,Math.max(1,Math.floor(n)));class x{id;title;url;searchParams;domElement;window;openMode;origin;initialized=!1;ready=!1;capabilities;#t;#i;#e;#o;#s=null;#r=null;#n=null;constructor(e){const{guestId:t,domElement:i=null,title:s,url:r,window:o,searchParams:a={},openMode:c=g.Embed,remoting:d,perfTracker:l,handshakeToken:h,handshakeRetries:E}=e;this.id=t,this.title=s,this.url=r,this.origin=ee(r),this.searchParams=a,this.domElement=i,this.window=o,this.openMode=c,this.capabilities={},this.#i=l,this.#t=d,this.#e=h,this.#o=de(E)}dispose=()=>{this.#c(!1);let e=!1;if(this.openMode===g.Popup)try{e=!this.window.closed}catch{e=!1}if(e)try{this.window.document,this.window.close()}catch{this.#t.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HostClose,messageBody:{}})}else this.domElement?.remove?.();this.#t.removeSender({origin:this.origin,window:this.window})};getInfo=()=>({guestId:this.id,guestTitle:this.title,guestUrl:this.url});#c=e=>{this.#s&&(clearInterval(this.#s),this.#s=null),this.#r&&(this.#t.unlisten({messageType:p.HandShakeAck,callback:this.#r}),this.#r=null);const t=this.#n;this.#n=null,t&&e!==void 0&&t(e)};#a=()=>{this.#n&&this.#t.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HandShake,messageBody:this.#e?{handshakeToken:this.#e}:{}})};handShake=()=>(this.#c(!1),this.openMode!==g.Popup?Promise.resolve(!1):new Promise(e=>{let t=0;this.#n=e;const i=()=>{this.#n&&this.#c(!0)};this.#r=i,this.#a(),t=1,this.#s=setInterval(()=>{if(this.#n){if(t>=this.#o){this.#c(!1);return}this.#a(),t+=1}},oe),this.#t.listen({messageType:p.HandShakeAck,callback:i})}));init=()=>{this.#t.addSender({origin:this.origin,window:this.window}),this.openMode===g.Popup&&this.handShake().catch(()=>{})};dispatchEvent=(e,t)=>{let i;if(this.#i.enabled){const s=`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`;i=this.#i.start(s,{appId:this.id,appUrl:this.url})}return this.#t.invoke({targetWin:this.window,targetOrigin:this.origin,messageType:p.ObjectEvent,messageBody:e,responseTimeoutMs:t}).finally(()=>{i&&this.#i.end(i,{appId:this.id,appUrl:this.url})})};send=e=>{this.#t.send({targetWin:this.window,targetOrigin:this.origin,...e})}}const N={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let G;const le=new Uint8Array(16);function he(){if(!G&&(G=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!G))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return G(le)}var ue;const f=[];for(let n=0;n<256;++n)f.push((n+256).toString(16).slice(1));function q(n,e=0){return f[n[e+0]]+f[n[e+1]]+f[n[e+2]]+f[n[e+3]]+"-"+f[n[e+4]]+f[n[e+5]]+"-"+f[n[e+6]]+f[n[e+7]]+"-"+f[n[e+8]]+f[n[e+9]]+"-"+f[n[e+10]]+f[n[e+11]]+f[n[e+12]]+f[n[e+13]]+f[n[e+14]]+f[n[e+15]]}function Ge(n,e=0){const t=q(n,e);if(!ue(t))throw TypeError("Stringified UUID is invalid");return t}const Pe=null;function pe(n,e,t){if(N.randomUUID&&!e&&!n)return N.randomUUID();n=n||{};const i=n.random||(n.rng||he)();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 U=pe,F="elli:remoting",W="elli:remoting:response",z="elli:remoting:exception",$=({messageType:n,messageBody:e,requestId:t,onewayMsg:i=!1})=>({requestId:t??(i?null:U()),source:F,type:n,body:e}),Ue=n=>{const{targetWin:e,targetOrigin:t,messageType:i,messageBody:s}=n,r=$({messageType:i,messageBody:s});e.postMessage(r,t)};class ge{#t;#i;#e=new Map;#o=new Map;#s=null;#r=null;#n=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#t=t,this.#i=e}#c=()=>{this.#s=null;const e=Date.now(),t=[];let i=null;if(this.#o.forEach((s,r)=>{const{requestId:o,cancelTime:a}=s;a&&a<=e?(this.#i.debug(`Detected response timeout for requestId: ${o}...`),t.push(r),s.resolve(void 0)):a&&(i=i===null?a:Math.min(i,a))}),t.forEach(s=>{this.#o.delete(s)}),i!==null){const s=Math.max(i-Date.now(),0);this.#a(s)}};#a=e=>{this.#s===null&&(this.#s=window.setTimeout(this.#c,e))};#E=()=>{this.#s!==null&&(window.clearTimeout(this.#s),this.#s=null)};#d=e=>{const t=this.#o.get(e);return this.#i.debug(`serving requestId: ${e}`),this.#o.delete(e),t};#g=e=>{const{requestId:t}=e;this.#i.debug(`Response received for invocation requestId: ${t}`);const i=this.#d(t);return i?(i.resolve(e.body),!0):(this.#i.debug(`Received response to stale/invalid request with requestId: ${t}`),!1)};#l=e=>{this.#i.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#d(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#i.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#u=({sourceWin:e,sourceOrigin:t,message:i})=>{this.#i.debug(`Received message of type "${i.type}"`);const s=this.#e.get(i.type);return s?(s.forEach(r=>{this.#i.debug(`Invoking message handler ${r.name}`),r({sourceWin:e,sourceOrigin:t,requestId:i.requestId,type:i.type,body:i.body})}),!0):!1};#f=e=>{if(this.#n.size===0||!e.source)return!1;const t=this.#n.get(e.source);return!t||e?.data?.source!==F?!1:(this.#i.debug(`Remoting: Received message of type "${e.data.type}"`),e.data.type===W?this.#g(e.data):e.data.type===z?this.#l(e.data):this.#u({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.#n.set(i,t)};initialize=e=>{this.#r&&this.#r.removeEventListener("message",this.#f),e.addEventListener("message",this.#f),this.#r=e,this.#i.debug(`initialized remoting id: ${this.#t}`)};close=()=>{this.#r&&(this.#r.removeEventListener("message",this.#f),this.#r=null),this.#E(),this.#o.forEach(({reject:e})=>{e(new Error("Remoting closed"))}),this.#o.clear(),this.#e.clear(),this.#n.clear(),this.#i.debug(`closed remoting id: ${this.#t}`)};invoke=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:r,responseTimeoutMs:o}=e;return new Promise((a,c)=>{const d=$({messageType:s,messageBody:r});this.#o.set(d.requestId,{requestId:d.requestId,resolve:a,reject:c,cancelTime:o?Date.now()+o:null}),t.postMessage(d,i);const{requestId:l}=d;this.#i.debug(`Posted invocation message of type ${s} requestId: ${l||""}`),o&&(this.#i.debug(`scheduling timeout check for requestId: ${l||""} in ${o} ms`),this.#a(o))})};listen=e=>{const{messageType:t,callback:i}=e,s=this.#e.get(t)||[];s.push(i),this.#e.set(t,s)};unlisten=e=>{const{messageType:t,callback:i}=e,s=this.#e.get(t);if(!s)return;const r=s.indexOf(i);r!==-1&&s.splice(r,1)};send=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:r}=e,o=$({messageType:s,messageBody:r,onewayMsg:!0});t.postMessage(o,i),this.#i.debug(`Posted one-way message of type "${s}"`)};removeSender=e=>{const{window:t}=e;t&&this.#n.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:i,requestId:s,response:r}=e,o=$({messageType:W,messageBody:r,requestId:s});t.postMessage(o,i),this.#i.debug(`Response sent to caller for invocation requestId: ${s}`)};raiseException=e=>{const{targetWin:t,targetOrigin:i,requestId:s,ex:r}=e,o=r instanceof Error?r.message:r,a=$({messageType:z,messageBody:o,requestId:s});t.postMessage(a,i),this.#i.debug(`Exception sent to caller for invocation. requestId: ${s}`)}}class Re{__TYPE__="Proxy";id;objectType;constructor(e,t){this.id=e,this.objectType=t}}const B=n=>n?.constructor?.name==="Proxy"||n?.constructor?.name==="ScriptingObjectProxy"||n?.__TYPE__==="Proxy",fe=new Map;function Ce(n){return typeof n=="object"&&n!==null&&("eq"in n||"in"in n||"includes"in n||"gt"in n||"lt"in n||"regex"in n)}function be(n,e,t){if("eq"in e)return n===e.eq;if("in"in e)return Array.isArray(e.in)&&e.in.includes(n);if("includes"in e)return Array.isArray(n)&&n.includes(e.includes);if("gt"in e){const i=typeof n=="number"?n:Number(n);return!Number.isNaN(i)&&i>e.gt}if("lt"in e){const i=typeof n=="number"?n:Number(n);return!Number.isNaN(i)&&i<e.lt}if("regex"in e){const i=t??fe;let s=i.get(e.regex);if(s===void 0){try{s=new RegExp(e.regex)}catch{s=null}i.set(e.regex,s)}return s!==null&&typeof n=="string"&&s.test(n)}return!1}function H(n){return n!=null&&Object.keys(n).length>0}function me(n,e,t){return Object.entries(e).every(([i,s])=>be(n[i],s,t?.regexCache))}const Me=null;function we(n,e){return H(e)?me(n,e):!0}const Ee=new Set(["SSF.Guest.Load"]);class A{#t;#i;#e;#o=new Set;#s;#r=new Map;#n;static DEFAULT_SAMPLING_RATIO=.05;static DEFAULT_DEDUP_WINDOW_MS=1e4;constructor(e){this.#t=e.analyticsObj,this.#i=e.enabled??!1,this.#e=e.samplingRatio??A.DEFAULT_SAMPLING_RATIO,this.#s=e.dedupWindowMs??A.DEFAULT_DEDUP_WINDOW_MS,this.#n=e.onError}get enabled(){return this.#i}start(e,t){if(this.#i)try{const i=Ee.has(e);return!i&&!this.shouldTrack(e)?void 0:(!i&&!this.#o.has(e)&&(this.#t.setTimingEventSamplingRatio({[e]:this.#e}),this.#o.add(e)),this.#t.startTiming(e,t).catch(s=>{this.reportError(`startTiming failed: ${s.message}`)}),e)}catch(i){this.reportError(`startTiming failed: ${i.message}`);return}}end(e,t){if(e)try{this.#t.endTiming(e,t).catch(i=>{this.reportError(`endTiming failed: ${i.message}`)})}catch(i){this.reportError(`endTiming failed: ${i.message}`)}}reportError(e){try{this.#n?.(e)}catch{}}shouldTrack(e){if(this.#s<=0)return!0;const t=performance.now(),i=this.#r.get(e);return i!==void 0&&t-i<this.#s?!1:(this.#r.set(e,t),!0)}}const J=[S.AllowScripts,S.AllowPopups,S.AllowModals,S.AllowForms,S.AllowDownloads,S.AllowSameOrigin],V="module",ve="module.unloading",ye="module.unmount",Oe=1e3,Se=new P(V),je=n=>Array.isArray(n)&&n.some(e=>e===!1),X=()=>{};class Ie{hostId;#t;#i;#e;#o;#s=new Map;#r=new Map;#n=new Map;#c=new Map;#a;#E=null;#d=null;#g=new Map;#l=new Set;#u=new Set;#f=new Set;#b=new Set;#I=null;#k=null;#v=new Map;#h;#T;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");this.#e=t.logger,this.#o=t.analyticsObj;const i={analyticsObj:t.analyticsObj,enabled:t?.measurePerformance,samplingRatio:t?.performanceSamplingRatio,onError:s=>this.#e.debug(s)};if(this.#h=new A({...i,dedupWindowMs:t?.performanceDedupWindowMs}),this.#T=new A({...i,dedupWindowMs:0}),this.#i=U(),this.#t=new ge(this.#e,this.#i),t?.readyStateCallback&&typeof t?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");this.#E=t?.readyStateCallback||null,this.#I=t?.onGuestEventSubscribe||null,this.#k=t?.onGuestEventUnsubscribe||null,this.#a=new Z,this.#t.initialize(window),this.#ee(),window.addEventListener("beforeunload",this.#w),window.addEventListener("pagehide",this.#w),this.#e.debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#i}`)}#we=(e,t)=>{const i={event:e,...t};this.#o.sendBAEvent(i).catch(s=>{this.#e.debug(`Analytics sendBAEvent failed: ${s.message}`)})};#q=()=>{this.#s.forEach(e=>{e.openMode!==g.Popup||this.#m(e.window)||e.dispose()})};#w=()=>{this.#q(),Array.from(this.#s.keys()).forEach(e=>this.#x(e))};#p=e=>this.#r.get(e);#y=e=>this.#n.get(e)??null;#F=e=>typeof e?._toJSON=="function";#$=(e,t)=>this.#F(e)?(this.#a.has(e?.id,t)||this.#a.addScriptingObject(e,t?{guestId:t?.id}:{}),{type:"object",object:e._toJSON()}):{type:"value",value:e};#Ee=e=>typeof e=="string"?e:e instanceof Error?e.message:"An unexpected error occurred in the host application";#A=e=>{e.ready&&this.#t.send({targetWin:e.window,targetOrigin:e.origin,messageType:p.HostConfig,messageBody:{logLevel:this.#e.getLogLevel(),...e.getInfo()}})};#W=({guest:e,obj:t,functionName:i,functionParams:s,callerChain:r})=>{const o=t[i];return _(o)?(this.#e.debug(`Invoking host implementation of ${t.id}.${String(i)}()`),new Promise(a=>{Object.defineProperty(o,"callContext",{value:{guest:e,...r?.length?{callChain:r}:{}},configurable:!0,enumerable:!0,writable:!0}),a(o(...s))})):(this.#e.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}'`)))};#G=({sourceWin:e,sourceOrigin:t,requestId:i})=>{const s=this.#p(e);if(!s){this.#e.warn(`Received ready event for unknown guest. requestId: ${i}`);return}if(!s.initialized){this.#e.warn("Guest must be initialized before it is marked as ready"),this.#t.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 r=s.getInfo();this.#h.end("SSF.Guest.Load",{appId:r.guestId,appUrl:r.guestUrl}),this.#A(s),this.#E?.(s),this.#e.audit({message:"Guest is ready",...r})}};#z=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const r=this.#p(e);if(!r){this.#e.warn(`Received ready event for unknown guest. requestid = ${i}`);return}r.initialized?s&&(r.capabilities={...r.capabilities,...s}):(r.initialized=!0,r.capabilities=s||{},this.#e.audit({message:"Guest is initialized",...r.getInfo()})),(!s||!s.onReady)&&this.#G({sourceWin:e,sourceOrigin:t,requestId:i,type:"",body:null})};#B=({sourceWin:e})=>{if(!e)return;const t=this.#j(e);t&&(t.openMode===g.Popup&&this.#f.add(t.id),this.#O(t.id))};#H=({sourceWin:e,sourceOrigin:t,requestId:i})=>{this.#e.debug(`Processing listObjects request. requestId = ${i}`);const s=this.#p(e);if(!s)return this.#e.warn("Rejected object request from unknown guest window"),!1;const r=this.#a.listScriptingObjects(s.id);return this.#t.respond({targetWin:e,targetOrigin:t,requestId:i,response:r}),this.#e.debug({message:"name of scripting objects returned",requestId:i,objects:r,...s.getInfo()}),!0};#J=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:r}=s;this.#e.debug(`Processing getObject request for object ${r}. requestId = ${i}`);const o=this.#p(e);if(!o)return this.#e.warn("Rejected object request from unknown guest window"),!1;const a=this.getScriptingObject(r,{guest:o});return a?(this.#t.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#$(a,o)}),this.#e.debug({message:"Scripting Object returned",requestId:i,scriptingObject:r,...o.getInfo()}),!0):(this.#e.warn(`unknown or unauthorized object ${r} from guest ${o.id}`),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${r}) is not available`}),!1)};#V=({sourceWin:e,requestId:t,body:i})=>{const{eventId:s,criteria:r,filterOnGuest:o,token:a}=i;this.#e.debug(`Processing guest event subscribe request for event ${s}. requestId = ${t}`);const c=this.#p(e);if(!c){this.#e.warn("Rejected event subscribe request from unknown guest window");return}setTimeout(()=>{try{this.#I?.({guestId:c.id,eventId:s,criteria:r,token:a,...o===!1?{filterOnGuest:!1}:{}})}catch(d){this.#e.warn(`Error in onGuestEventSubscribe callback for event ${s}: ${d.message}`)}},0)};#X=({sourceWin:e,requestId:t,body:i})=>{const{eventId:s,token:r}=i;this.#e.debug(`Processing guest event unsubscribe request for event ${s}. requestId = ${t}`);const o=this.#p(e);if(!o){this.#e.warn("Rejected event unsubscribe request from unknown guest window");return}setTimeout(()=>{try{this.#k?.({guestId:o.id,eventId:s,token:r})}catch(a){this.#e.warn(`Error in onGuestEventUnsubscribe callback for event ${s}: ${a.message}`)}},0)};#P=({sourceWin:e,requestId:t,body:i})=>{const s=this.#p(e);if(!s||!this.#l.has(s.id)||this.#u.has(s.id)){s?this.#e.debug(`Ignored resize event from guest ${s.id}. requestId = ${t}`):this.#e.warn(`Received resize event from unknown guest. requestid = ${t}`);return}s.domElement&&(s.domElement.style.height=`${i.height}px`),this.#e.debug(`Guest ${s.id} resized to ${i.width}x${i.height}`)};#Y=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:r,callerChain:o}=s,a=this.#p(e);if(!a)return this.#e.warn("Rejected method invocation request from unknown guest window"),!1;this.#e.debug(`Function ${r}.${String(s.functionName)}() called from guest "${a.id}" (requestId = ${i})`);const c=this.getScriptingObject(r,{guest:a});if(!c)return this.#e.warn(`Invocation of unknown or unauthorized object ${r} from guest ${a.id}`),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${r}) is not available`}),!1;const d=a.getInfo();let l;if(this.#h.enabled){const h=`ScriptingObject.API.${r}.${s.functionName}`;l=this.#h.start(h,{appId:d.guestId,appUrl:d.guestUrl})}return this.#W({guest:a,obj:c,functionName:s.functionName,functionParams:s.functionParams,callerChain:o}).then(h=>{this.#t.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#$(h,a)}),this.#e.debug({message:"Value returned for Scripting Object method call",requestId:i,scriptingObject:r,scriptingMethod:s.functionName,...d})}).catch(h=>{this.#t.raiseException({targetWin:e,targetOrigin:a.origin,requestId:i,ex:h}),this.#e.error({message:"Exception thrown for Scripting Object method call",requestId:i,scriptingObject:r,scriptingMethod:s.functionName,...d})}).finally(()=>{l&&this.#h.end(l,{appId:d.guestId,appUrl:d.guestUrl})}),!0};#K=()=>{this.#t.listen({messageType:p.GuestResize,callback:this.#P})};#U=()=>{this.#t.unlisten({messageType:p.GuestResize,callback:this.#P})};#Q=e=>{if(this.#l.has(e))return;const t=this.#l.size===0;this.#l.add(e),t&&this.#K()};#Z=e=>{this.#l.delete(e)&&this.#l.size===0&&this.#U()};#ee=()=>{this.#t.listen({messageType:p.GuestReady,callback:this.#z}),this.#t.listen({messageType:p.GuestReadyComplete,callback:this.#G}),this.#t.listen({messageType:p.GuestClose,callback:this.#B}),this.#t.listen({messageType:p.ListObjects,callback:this.#H}),this.#t.listen({messageType:p.ObjectGet,callback:this.#J}),this.#t.listen({messageType:p.ObjectInvoke,callback:this.#Y}),this.#t.listen({messageType:p.GuestEventSubscribe,callback:this.#V}),this.#t.listen({messageType:p.GuestEventUnsubscribe,callback:this.#X})};#te=e=>e instanceof R||typeof e?.subscribe=="function";#R=e=>{const t=new x({...e,remoting:this.#t,perfTracker:this.#T});return t.init(),this.#s.set(e.guestId,t),this.#r.set(t.window,t),this.#n.set(t.url,t),t};#j=e=>{if(typeof e=="string")return this.#s.get(e);const t=this.#r.get(e);return t||Array.from(this.#s.values()).find(i=>i.domElement===e)};#C=e=>e.openMode===g.Embed&&(!e.domElement||!e.domElement.isConnected);#M=e=>{this.#c.get(e)?.forEach(i=>{Promise.resolve(i({id:e})).catch(X)})};#O=e=>{this.#s.has(e)&&(this.#b.has(e)||(this.#b.add(e),this.#M(e)),this.#u.has(e)||this.#x(e))};#ie=e=>{const t=e.domElement,i=t?.parentNode;if(!t||!i)return;const s=new MutationObserver(()=>{this.#C(e)&&(this.#_(e.id),this.#O(e.id))});s.observe(i,{childList:!0}),this.#g.set(e.id,s)};#_=e=>{this.#g.get(e)?.disconnect(),this.#g.delete(e)};#se=()=>{this.#g.forEach(e=>e.disconnect()),this.#g.clear()};#m=e=>{try{return!!e?.closed}catch{return!0}};#ne=()=>{this.#d||(this.#d=setInterval(()=>{const e=[];this.#s.forEach(t=>{t.openMode===g.Popup&&this.#m(t.window)&&e.push(t)}),e.forEach(t=>{this.#O(t.id)})},1e3))};#re=()=>{if(!this.#d)return;Array.from(this.#s.values()).some(t=>t.openMode===g.Popup)||(clearInterval(this.#d),this.#d=null)};#oe=e=>{const t=D(e),i=t?void 0:U();return{popupUrl:i?`${e}#hs=${i}`:e,handshakeToken:i,trusted:t}};#L=e=>!e||!this.#m(e.window)?e:(this.#u.has(e.id)||this.#O(e.id),this.#y(e.url)===e&&this.#ae(e),this.#y(e.url)===e?e:null);#ae=e=>{this.#b.has(e.id)||(this.#b.add(e.id),this.#M(e.id)),this.#N(e)};#ce=(e,t)=>{e===g.Popup&&this.#L(this.#y(t))};#de=e=>{const{url:t,title:i,popupWindowFeatures:s={},searchParams:r,guestId:o,handshakeRetries:a,onLoad:c,onError:d}=e,{width:l=800,height:h=600,top:E=100,left:j=100}=s;let m=this.#L(this.#y(t));if(m)D(t)?window.open("",i):m.window.focus();else{const w=Object.entries({width:l,height:h,top:E,left:j}).filter(([,T])=>T).map(([T,ke])=>`${T}=${ke}`).join(","),{popupUrl:v,handshakeToken:u,trusted:k}=this.#oe(t),b=this.#le({popupUrl:v,title:i,guestId:o,features:`popup, ${w}`,retryClosedWindow:!k});if(!b)throw this.#S(o,d,"onError"),new Error("Failed to open guest application in popup window");this.#S(o,c,"onLoad"),k||(b.opener=null),m=this.#R({guestId:o,window:b,title:i,url:t,searchParams:r,openMode:g.Popup,handshakeToken:u,handshakeRetries:a}),this.#ne()}return m};#le=e=>{const{popupUrl:t,title:i,guestId:s,features:r,retryClosedWindow:o}=e;let a=i,c=window.open(t,a,r);return o&&c&&this.#m(c)&&(a=`${i}-${s}`,c=window.open(t,a,r)),!c||o&&this.#m(c)?null:c};#S=(e,t,i)=>{setTimeout(()=>{try{t?.(e)}catch(s){this.#e.debug(`Error occurred in ${i} for guest with id '${e}': ${s.message}`)}},0)};#he=(e,t,i={})=>{const{onLoad:s,onError:r}=i,o=()=>{this.#S(t,s,"onLoad"),this.#e.debug(`frame loaded for guest with id '${t}'`),e.removeEventListener("load",o)},a=()=>{this.#S(t,r,"onError"),this.#e.error(`frame load failed for guest with id '${t}'`),e.removeEventListener("error",a)};e.addEventListener("load",o),e.addEventListener("error",a)};#ue=e=>{const{url:t,title:i,targetElement:s,searchParams:r,guestId:o,onLoad:a,onError:c,options:d={}}=e,l=s.ownerDocument??document,{fitToContent:h=!1,disableSandbox:E=!1,sandboxValues:j=[],customSandboxValues:m=[],style:w="",permissionPolicy:v=""}=d;if(!i)throw new Error("title is required");const u=l.createElement("iframe");u.setAttribute("id",o),this.#he(u,o,{onLoad:a,onError:c}),u.setAttribute("style",`min-width: 100%; height: 100%; border: 0px; ${w}`),E||u.setAttribute("sandbox",m.length>0?m.join(" "):[...J,...j].join(" ")),u.setAttribute("title",i),u.setAttribute("src",t),v&&u.setAttribute("allow",v),s.appendChild(u);const k=l.getElementById(o),b=this.#R({guestId:o,domElement:k,window:k.contentWindow,title:i,url:t,searchParams:r,openMode:g.Embed});return h&&this.#Q(b.id),this.#ie(b),b};#pe=(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(B(e)){const i=this.cloneScriptingObject(e);this.#a.addScriptingObject(i,t)}else this.#a.addScriptingObject(e,t)};cloneScriptingObject=e=>{if(!e)throw new Error("proxy is required");const t=new P(e.id,e.objectType);let i=[];return Object.keys(e).forEach(s=>{const r=e[s];if(this.#te(r)){const o=new O({name:r.name||s,objectId:t.id});if(Object.defineProperty(t,s,{value:o,enumerable:!0}),r instanceof R){const a=({eventParams:d,eventOptions:l})=>this.dispatchEvent({event:o,eventParams:d,eventOptions:l}),c=r.subscribe(a);i.push(()=>{r.unsubscribe(c)})}else{const a=r.subscribe?.((c,d,l)=>this.dispatchEvent({event:o,eventParams:d,eventOptions:l}));i.push(()=>{r.unsubscribe?.(a)})}}else if(_(r)&&(Object.defineProperty(t,s,{value:async(...o)=>{const a=t[s]?.callContext;if(a?.guest){const d=a.callChain??[],l=a.guest.id,h=this.#v.get(l),E={id:l};h&&(E.metadata=h),Object.defineProperty(r,"callContext",{value:{callChain:[...d,E]},configurable:!0,enumerable:!0,writable:!0})}const c=await r(...o);return B(c)?this.cloneScriptingObject(c):c},enumerable:!0}),s==="dispose")){const o=t.dispose;Object.defineProperty(t,s,{value:()=>(t._dispose(),o.apply(t)),enumerable:!0})}}),t._dispose=()=>{i.forEach(s=>{s?.()}),i=[]},t};close=()=>{this.#d&&(clearInterval(this.#d),this.#d=null),this.#se(),this.#w(),this.#l.clear(),this.#b.clear(),this.#U(),this.#c.clear(),this.removeAllScriptingObjects(),this.#v.clear(),this.#t.close(),window.removeEventListener("beforeunload",this.#w),window.removeEventListener("pagehide",this.#w),this.#e.debug(`host is closed. hostId: ${this.hostId}, correlationId: ${this.#i}`)};#ge=({targetGuest:e,guestCapabilities:t,scriptingEventId:i,dispatchToGuest:s})=>{const r=o=>{if(H(t)&&!we(o.capabilities,t)){this.#e.debug({message:"Event skipped \u2014 guest capabilities do not match eventOptions.guestCapabilities",scriptingEventId:i,guestCapabilities:t,...o.getInfo()});return}s(o)};e?r(e):this.#s.forEach(r)};#fe=(e,t)=>(t?this.getScriptingObject(e,{guest:t}):this.getScriptingObject(e))??(e===V&&t?Se:null);dispatchEvent=async e=>{const{event:{id:t,name:i},eventParams:s,eventOptions:r={}}=e,{eventHandler:o=null,timeout:a=null,window:c=null,guestId:d,guestCapabilities:l}=r,h=t.split(".")[0],E=d||c,j=E?this.#j(E):null,m=this.#fe(h,j??null);if(!m)return this.#e.warn(`Attempt to dispatch event ${i} on unknown object ${h}`),Promise.resolve([]);const w={object:m._toJSON(),eventName:i,eventParams:s,eventHandler:o,eventOptions:{allowsFeedback:!1}};a&&!Number.isNaN(a)&&(w.eventOptions={allowsFeedback:!0,timeout:Number(a)});const v=[];let u;const k=b=>{const T=b.getInfo();a&&b?.capabilities?.eventFeedback?(v.push(b.dispatchEvent(w,a)),!u&&this.#h.enabled&&(u=this.#h.start(`ScriptingObject.Event.${m.id}.${i}`,{appId:this.hostId,appUrl:window.location.href})),this.#e.debug({message:"Event dispatched and awaiting feedback",scriptingEventId:t,...T})):(b.send({messageType:p.ObjectEvent,messageBody:w}),this.#e.debug({message:"Event dispatched",scriptingEventId:t,...T}))};return this.#ge({targetGuest:j??null,guestCapabilities:l,scriptingEventId:t,dispatchToGuest:k}),Promise.all(v).then(b=>(this.#e.debug({message:"Event feedback received",scriptingEventId:t}),te(b))).catch(b=>{throw this.#e.error({message:"Error processing event",eventId:t,exception:b}),b}).finally(()=>{u&&this.#h.end(u,{appId:this.hostId,appUrl:window.location.href})})};getGuests=()=>Array.from(this.#s.values());getScriptingObject=(e,t)=>this.#a.getObject(e,t?.guest);loadGuest=e=>{const{id:t,url:i,targetElement:s,title:r,searchParams:o={},onLoad:a,onError:c,options:d={},metadata:l}=e;if(!t)throw new Error("id for guest application is required");const{openMode:h=g.Embed,popupWindowFeatures:E={},handshakeRetries:j}=d,m=this.#pe(i,o);this.#ce(h,m);let w=t;if(this.#s.has(w)){let u=1;for(;this.#s.has(`${t}-${u}`);)u+=1;w=`${t}-${u}`}let v=null;if(this.#h.start("SSF.Guest.Load",{appId:w,appUrl:m}),h===g.Popup)v=this.#de({guestId:w,url:m,title:r,searchParams:o,popupWindowFeatures:E,handshakeRetries:j,onLoad:a,onError:c});else if(h===g.Embed)v=this.#ue({guestId:w,url:m,title:r,targetElement:s,searchParams:o,onLoad:a,onError:c,options:d});else throw new Error(`Invalid openMode: ${h}`);return l&&this.#v.set(w,l),this.#e.audit({message:"Guest loaded",...v.getInfo()}),v};loadGuests=e=>{const{id:t,url:i,targetElement:s,title:r,searchParamsList:o=[],options:a={}}=e;o.forEach((c,d)=>{this.loadGuest({id:`${t}-${d}`,url:i,title:r,targetElement:s,searchParams:c,options:a})},this)};removeAllScriptingObjects=e=>{this.#a.removeAllScriptingObjects(e)};removeScriptingObject=(e,t)=>{this.#a.removeScriptingObject(e,t)};setLogLevel=e=>{this.#e.setLogLevel(e),this.#s.forEach(this.#A),this.#e.debug("Dispatched config events to all guests")};#D=async(e,t,i)=>this.dispatchEvent({event:{id:t,name:i},eventParams:{moduleId:e.id},eventOptions:{timeout:Oe,guestId:e.id}});#be=async e=>{try{const t=await this.#D(e,ve,"unloading");if(je(t))return this.#e.info(`Unload denied by guest ${e.id} via module.unloading event`),!1}catch(t){this.#e.warn({message:`Error dispatching module.unloading event for ${e.id}; proceeding with unload`,exception:t})}return!0};#me=async e=>{try{await this.#D(e,ye,"unmount")}catch(t){this.#e.warn({message:`Error dispatching module.unmount event for ${e.id}`,exception:t})}};#x=e=>{this.unloadGuest(e).catch(X)};#N=e=>{e.dispose(),this.#r.get(e.window)===e&&this.#r.delete(e.window),this.#n.get(e.url)===e&&this.#n.delete(e.url),this.#s.get(e.id)===e&&(this.#_(e.id),this.#Z(e.id),this.removeAllScriptingObjects(e.id),this.#v.delete(e.id),this.#s.delete(e.id),this.#c.delete(e.id),this.#b.delete(e.id)),this.#e.audit({message:"Guest is removed from host",...e.getInfo()}),this.#re()};unloadGuest=async e=>{const t=this.#j(e);if(t&&!this.#u.has(t.id)){this.#u.add(t.id);try{const i=t.openMode===g.Popup?this.#m(t.window):!!t.window?.closed,s=this.#f.has(t.id);if(!(i||this.#C(t)||s)){if(!await this.#be(t)){this.#b.delete(t.id);return}await this.#me(t)}this.#N(t)}finally{this.#u.delete(t.id),this.#f.delete(t.id)}}};onGuestClose=e=>{const{id:t,guestCloseCallback:i}=e,s=this.#c.get(t)||[];s.push(i),this.#c.set(t,s)}}return I})());
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=emuiSsfHost.cc299d33bc6c79fa47d8.js.map
|
|
Binary file
|
|
Binary file
|