@elliemae/ssf-host 2.22.0 → 2.22.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 CHANGED
@@ -97,7 +97,9 @@ class SSFHost {
97
97
  this.#logger = option.logger;
98
98
  this.#analyticsObj = option.analyticsObj;
99
99
  this.#correlationId = (0, import_uuid.v4)();
100
- this.#remoting = new import_microfe_common.Remoting(this.#logger, this.#correlationId);
100
+ this.#remoting = new import_microfe_common.Remoting(this.#logger, this.#correlationId, {
101
+ unsafeAllowAnyGuestOrigin: option?.unsafeAllowAnyGuestOrigin
102
+ });
101
103
  if (option?.readyStateCallback && typeof option?.readyStateCallback !== "function")
102
104
  throw new Error("readyStateCallback must be a function");
103
105
  this.#readyStateCallback = option?.readyStateCallback || null;
package/dist/esm/host.js CHANGED
@@ -84,7 +84,9 @@ class SSFHost {
84
84
  this.#logger = option.logger;
85
85
  this.#analyticsObj = option.analyticsObj;
86
86
  this.#correlationId = uuidv4();
87
- this.#remoting = new Remoting(this.#logger, this.#correlationId);
87
+ this.#remoting = new Remoting(this.#logger, this.#correlationId, {
88
+ unsafeAllowAnyGuestOrigin: option?.unsafeAllowAnyGuestOrigin
89
+ });
88
90
  if (option?.readyStateCallback && typeof option?.readyStateCallback !== "function")
89
91
  throw new Error("readyStateCallback must be a function");
90
92
  this.#readyStateCallback = option?.readyStateCallback || null;
@@ -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.01546664223ea88ed947.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.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.a1d3542194a2fb9e9816.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(I,y){typeof exports=="object"&&typeof module=="object"?module.exports=y():typeof define=="function"&&define.amd?define([],y):typeof exports=="object"?exports.ice=y():(I.ice=I.ice||{},I.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 I={};v.r(I),v.d(I,{Event:()=>y,Guest:()=>q,IFrameSandboxValues:()=>E,OpenMode:()=>w,SANDBOX_DEFAULT:()=>B,SSFHost:()=>te,ScriptingObject:()=>T});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 A{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 H=n=>n instanceof y,ie=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`,W="function",J=(n,e)=>typeof n===W&&!!e&&!e.startsWith("_");class T{#e;#i="Object";constructor(e,t){this.#e=e,this.#i=t||this.#i}get id(){return this.#e}get objectType(){return this.#i}_toJSON=()=>{const e=[],t=[];return Object.keys(this).forEach(i=>{const s=this[i];H(s)?t.push(i):J(s,i)&&e.push(i)}),{objectId:this.#e,objectType:this.#i,functions:e,events:t}};_dispose=()=>{};dispose=()=>{}}var l=(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))(l||{}),w=(n=>(n.Popup="popup",n.Embed="embed",n))(w||{}),E=(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))(E||{});const Y=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}},U=(n,e=[])=>{const t=e||[];return n&&n.forEach?n.forEach(i=>{U(i,t)}):typeof n<"u"&&t.push(n),t},se=n=>typeof n?._toJSON=="function";function R(n){return typeof n=="function"}const ne=n=>n?.id??n;class q{id;title;url;searchParams;domElement;window;openMode;origin;initialized=!1;ready=!1;capabilities;#e;#i;constructor(e){const{guestId:t,domElement:i=null,title:s,url:o,window:r,searchParams:c={},openMode:a=w.Embed,remoting:d,analyticsObj:u}=e;this.id=t,this.title=s,this.url=o,this.origin=Y(o),this.searchParams=c,this.domElement=i,this.window=r,this.openMode=a,this.capabilities={},this.#i=u,this.#e=d}dispose=()=>{if(this.openMode===w.Popup&&!this.window.closed)try{this.window.document,this.window.close()}catch{this.#e.send({targetWin:this.window,targetOrigin:this.origin,messageType:l.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:l.HandShake,messageBody:{}}),t+=1)},1e3);this.#e.listen({messageType:l.HandShakeAck,callback:()=>{clearInterval(s),e(!0)}})});init=()=>{this.#e.addSender({origin:this.origin,window:this.window}),this.openMode===w.Popup&&this.handShake().catch(()=>{})};dispatchEvent=(e,t)=>(this.#i.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:l.ObjectEvent,messageBody:e,responseTimeoutMs:t}).finally(()=>{this.#i.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 L={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let G;const X=new Uint8Array(16);function K(){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(X)}const h=[];for(let n=0;n<256;++n)h.push((n+256).toString(16).slice(1));function _(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 re(n,e=0){const t=_(n,e);if(!validate(t))throw TypeError("Stringified UUID is invalid");return t}const ce=null;function Q(n,e,t){if(L.randomUUID&&!e&&!n)return L.randomUUID();n=n||{};const i=n.random||(n.rng||K)();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 _(i)}const C=Q,M="elli:remoting",x="elli:remoting:response",N="elli:remoting:exception",$=({messageType:n,messageBody:e,onewayMsg:t=!1})=>({requestId:t?null:C(),source:M,type:n,body:e}),ae=n=>{const{targetWin:e,targetOrigin:t,messageType:i,messageBody:s}=n,o=$({messageType:i,messageBody:s});e.postMessage(o,t)};class V{#e;#i;#t=new Map;#n=new Map;#s=null;#o=new Map;#r;constructor(e,t,i){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#e=t,this.#i=e,this.#r=i?.unsafeAllowAnyGuestOrigin??!1}#a=e=>this.#r?"*":e;#h=()=>{const e=Date.now(),t=[];this.#n.forEach((i,s)=>{const{requestId:o,cancelTime:r}=i;this.#i.debug(`Checking response timeout for requestId: ${o}) @ ${r??""}`),i.cancelTime&&i.cancelTime<e&&(this.#i.debug(`Detected response timeout for requestId: ${o}...`),t.push(s),i.resolve(),this.#i.debug(`Aborted waiting for response to requestid: ${o})`))}),t.forEach(i=>{this.#i.debug(`removing invocations with requestId ${i} from cache since response time has expired`),this.#n.delete(i)}),this.#n.size===0&&(this.#i.debug("stopping response monitor"),this.#p())};#g=()=>{this.#s===null&&(this.#i.debug("Staring response timeout evaluator"),this.#s=window.setInterval(this.#h,200))};#p=()=>{this.#s!==null&&(window.clearInterval(this.#s),this.#s=null,this.#i.debug("Stopped response timeout evaluator"))};#b=e=>{const t=this.#n.get(e);return this.#i.debug(`serving requestId: ${e}`),this.#n.delete(e),t};#d=e=>{const{requestId:t}=e;this.#i.debug(`Response received for invocation requestId: ${t}`);const i=this.#b(t);return i?(i.resolve(e.body),!0):(this.#i.debug(`Received response to stale/invalid request with requestId: ${t}`),!1)};#u=e=>{this.#i.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#b(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#i.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#l=({sourceWin:e,sourceOrigin:t,message:i})=>{this.#i.debug(`Received message of type "${i.type}"`);const s=this.#t.get(i.type);return s?(s.forEach(o=>{this.#i.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.#i.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.#d(e.data):e.data.type===N?this.#u(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.#i.debug(`initialized remoting id: ${this.#e}`)};close=()=>{window.removeEventListener("message",this.#c),this.#i.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,this.#a(i));const{requestId:u}=d;this.#i.debug(`Posted invocation message of type ${s} requestId: ${u||""}`),r&&(this.#i.debug(`starting response monitor for requestId: ${u||""} for ${r} ms`),this.#g())})};listen=e=>{const{messageType:t,callback:i}=e,s=this.#t.get(t)||[];s.push(i),this.#t.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,this.#a(i)),this.#i.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,this.#a(i)),this.#i.debug(`Response sent to caller for invocation requestId: ${s}`)};raiseException=e=>{const{targetWin:t,targetOrigin:i,requestId:s,ex:o}=e,r=$({messageType:N,messageBody:o});r.requestId=s,t.postMessage(r,this.#a(i)),this.#i.debug(`Exception sent to caller for invocation. requestId: ${s}`)}}const z="module";var Z=(n=>(n.USER="USER",n.PARTNER="PARTNER",n))(Z||{});class ee{#e=new Map;#i=new Map;#t=e=>{const{so:t,guestId:i}=e,s=t.id.toLowerCase(),o=this.#i.get(i);if(!o)this.#i.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===z&&!t)for(const[,s]of this.#i){const o=s.get(e);if(o)return o}const i=t?this.#i.get(t):null;return i?i.get(e)??null:null};#o=({objectId:e,guestId:t}={})=>{if(t){if(!e){const s=this.#i.get(t);s&&s.forEach(this.#n),this.#i.delete(t);return}const i=this.#i.get(t);if(i){const s=i.get(e);s&&this.#n(s),i.delete(e)}}else e&&this.#i.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()===z&&!i)throw new Error("Guest id is required to add Module scripting object");if(i){this.#t({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.#i.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 de{__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",B=[E.AllowScripts,E.AllowPopups,E.AllowModals,E.AllowForms,E.AllowDownloads,E.AllowSameOrigin];class te{hostId;#e;#i;#t;#n;#s=new Map;#o=new Map;#r;#a=null;#h=null;#g=null;#p=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.#t=t.logger,this.#n=t.analyticsObj,this.#i=C(),this.#e=new V(this.#t,this.#i,{unsafeAllowAnyGuestOrigin:t?.unsafeAllowAnyGuestOrigin}),t?.readyStateCallback&&typeof t?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");this.#a=t?.readyStateCallback||null,this.#g=t?.onGuestEventSubscribe||null,this.#p=t?.onGuestEventUnsubscribe||null,this.#r=new ee,this.#e.initialize(window),this.#R(),window.addEventListener("beforeunload",this.#l),this.#L(),this.#t.debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#i}`)}#b=(e,t)=>{const i={event:e,...t};this.#n.sendBAEvent(i).catch(()=>{})};#d=(e,t)=>{this.#n.startTiming(e,t).catch(()=>{})};#u=(e,t)=>{this.#n.endTiming(e,t).catch(()=>{})};#l=()=>{for(const e of this.#s.values())e.openMode===w.Popup&&this.unloadGuest(e.id)};#c=e=>Array.from(this.#s.values()).find(t=>t.window===e);#E=e=>{for(const t of this.#s.values())if(t.url===e)return t;return null};#j=e=>typeof e?._toJSON=="function";#w=(e,t)=>this.#j(e)?(this.#r.has(e?.id,t)||this.#r.addScriptingObject(e,t?{guestId:t?.id}:{}),{type:"object",object:e._toJSON()}):{type:"value",value:e};#x=e=>typeof e=="string"?e:e instanceof Error?e.message:"An unexpected error occurred in the host application";#m=e=>{e.ready&&this.#e.send({targetWin:e.window,targetOrigin:e.origin,messageType:l.HostConfig,messageBody:{logLevel:this.#t.getLogLevel(),...e.getInfo()}})};#O=({guest:e,obj:t,functionName:i,functionParams:s})=>{const o=t[i];return R(o)?(this.#t.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.#t.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}'`)))};#v=({sourceWin:e,sourceOrigin:t,requestId:i})=>{const s=this.#c(e);if(!s){this.#t.warn(`Received ready event for unknown guest. requestId: ${i}`);return}if(!s.initialized){this.#t.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.#u("SSF.Guest.Load",{appId:o.guestId,appUrl:o.guestUrl}),this.#m(s),this.#a?.(s),this.#t.audit({message:"Guest is ready",...o})}};#S=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const o=this.#c(e);if(!o){this.#t.warn(`Received ready event for unknown guest. requestid = ${i}`);return}o.initialized||(o.initialized=!0,o.capabilities=s||{},this.#t.audit({message:"Guest is initialized",...o.getInfo()})),(!s||!s.onReady)&&this.#v({sourceWin:e,sourceOrigin:t,requestId:i,type:"",body:null})};#I=async({sourceWin:e})=>{if(e?.window){const t=this.#f(e);t&&!await t.handShake()&&this.unloadGuest(e)}};#$=({sourceWin:e,sourceOrigin:t,requestId:i})=>{this.#t.debug(`Processing listObjects request. requestId = ${i}`);const s=this.#c(e);if(!s)return this.#t.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.#t.audit({message:"name of scripting objects returned",requestId:i,objects:o,...s.getInfo()}),!0};#k=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s;this.#t.debug(`Processing getObject request for object ${o}. requestId = ${i}`);const r=this.#c(e);if(!r)return this.#t.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.#w(c,r)}),this.#t.audit({message:"Scripting Object returned",requestId:i,scriptingObject:o,...r.getInfo()}),!0):(this.#t.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)};#G=({sourceWin:e,requestId:t,body:i})=>{const{eventId:s,criteria:o,token:r}=i;this.#t.debug(`Processing guest event subscribe request for event ${s}. requestId = ${t}`);const c=this.#c(e);if(!c){this.#t.warn("Rejected event subscribe request from unknown guest window");return}setTimeout(()=>{try{this.#g?.({guestId:c.id,eventId:s,criteria:o,token:r})}catch{}},0)};#P=({sourceWin:e,requestId:t,body:i})=>{const{eventId:s,token:o}=i;this.#t.debug(`Processing guest event unsubscribe request for event ${s}. requestId = ${t}`);const r=this.#c(e);if(!r){this.#t.warn("Rejected event unsubscribe request from unknown guest window");return}setTimeout(()=>{try{this.#p?.({guestId:r.id,eventId:s,token:o})}catch{}},0)};#A=({sourceWin:e,requestId:t,body:i})=>{const s=this.#c(e);if(!s){this.#t.warn(`Received resize event from unknown guest. requestid = ${t}`);return}s.domElement&&(s.domElement.style.height=`${i.height}px`),this.#t.debug(`Guest ${s.id} resized to ${i.width}x${i.height}`)};#T=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s,r=this.#c(e);if(!r)return this.#t.warn("Rejected method invocation request from unknown guest window"),!1;this.#t.debug(`Function ${o}.${String(s.functionName)}() called from guest "${r.id}" (requestId = ${i})`);const c=this.getScriptingObject(o,{guest:r});if(!c)return this.#t.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.#d(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl}),this.#O({guest:r,obj:c,functionName:s.functionName,functionParams:s.functionParams}).then(d=>{this.#e.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#w(d,r)}),this.#t.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.#t.audit({message:"Exception thrown for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).finally(()=>{this.#u(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl})}),!0};#U=()=>{this.#e.listen({messageType:l.GuestResize,callback:this.#A})};#R=()=>{this.#e.listen({messageType:l.GuestReady,callback:this.#S}),this.#e.listen({messageType:l.GuestReadyComplete,callback:this.#v}),this.#e.listen({messageType:l.GuestClose,callback:this.#I}),this.#e.listen({messageType:l.ListObjects,callback:this.#$}),this.#e.listen({messageType:l.ObjectGet,callback:this.#k}),this.#e.listen({messageType:l.ObjectInvoke,callback:this.#T}),this.#e.listen({messageType:l.GuestEventSubscribe,callback:this.#G}),this.#e.listen({messageType:l.GuestEventUnsubscribe,callback:this.#P})};#q=e=>e instanceof A||typeof e?.subscribe=="function";#y=e=>{const t=new q({...e,remoting:this.#e,analyticsObj:this.#n});return t.init(),this.#s.set(e.guestId,t),t};#f=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};#L=()=>{this.#h=setInterval(()=>{const e=[];this.#s.forEach(t=>{t.openMode===w.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)};#_=e=>{const{url:t,title:i,popupWindowFeatures:s={},searchParams:o,guestId:r,onLoad:c,onError:a}=e,{width:d=800,height:u=600,top:j=100,left:m=100}=s;let g=this.#E(t);if(g)g.window.closed||g.send({messageType:l.GuestFocus,messageBody:{}});else{const O=[{key:"width",value:d},{key:"height",value:u},{key:"top",value:j},{key:"left",value:m}].reduce((f,p,b)=>(b>0&&p.value&&(f+=","),p.value?`${f}${p.key}=${p.value}`:f),""),S=window.open(t,i,`popup, ${O}`);if(S)try{setTimeout(()=>{c?.(r)},0)}catch(f){this.#t.debug(`Error occurred in onLoad for guest with id '${r}': ${f.message}`)}else{try{setTimeout(()=>{a?.(r)},0)}catch(f){this.#t.debug(`Error occurred in onError for guest with id '${r}': ${f.message}`)}throw new Error("Failed to open guest application in popup window")}S.opener=null,g=this.#y({guestId:r,window:S,title:i,url:t,searchParams:o,openMode:w.Popup})}return g};#C=e=>{const{url:t,title:i,targetElement:s,searchParams:o,guestId:r,onLoad:c,onError:a,options:d={}}=e,u=s.ownerDocument??document,{fitToContent:j=!1,disableSandbox:m=!1,sandboxValues:g=[],customSandboxValues:O=[],style:S="",permissionPolicy:f=""}=d;if(!i)throw new Error("title is required");j&&this.#U();const p=u.createElement("iframe");p.setAttribute("id",r);const b=()=>{setTimeout(()=>{try{c?.(r)}catch(P){this.#t.debug(`Error occurred in onLoad for guest with id '${r}': ${P.message}`)}},0),this.#t.debug(`frame loaded for guest with id '${r}'`),p.removeEventListener("load",b)},k=()=>{setTimeout(()=>{try{a?.(r)}catch(P){this.#t.debug(`Error occurred in onError for guest with id '${r}': ${P.message}`)}},0),this.#t.error(`frame load failed for guest with id '${r}'`),p.removeEventListener("error",k)};p.addEventListener("load",b),p.addEventListener("error",k),p.setAttribute("style",`min-width: 100%; height: 100%; border: 0px; ${S}`),m||p.setAttribute("sandbox",O.length>0?O.join(" "):[...B,...g].join(" ")),p.setAttribute("title",i),p.setAttribute("src",t),f&&p.setAttribute("allow",f),s.appendChild(p);const F=u.getElementById(r);return this.#y({guestId:r,domElement:F,window:F.contentWindow,title:i,url:t,searchParams:o,openMode:w.Embed})};#M=(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 T(e.id,e.objectType);let i=[];return Object.keys(e).forEach(s=>{const o=e[s];if(this.#q(o)){const r=new y({name:o.name||s,objectId:t.id});if(Object.defineProperty(t,s,{value:r,enumerable:!0}),o instanceof A){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(R(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.#t.debug(`host is closed. hostId: ${this.hostId}, correlationId: ${this.#i}`)};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],j=d||a,m=j?this.#f(j):null,g=m?this.getScriptingObject(u,{guest:m}):this.getScriptingObject(u);if(!g)return this.#t.warn(`Attempt to dispatch event ${i} on unknown object ${u}`),Promise.resolve([]);const O={object:g._toJSON(),eventName:i,eventParams:s,eventHandler:r,eventOptions:{allowsFeedback:!1}};c&&!Number.isNaN(c)&&(O.eventOptions={allowsFeedback:!0,timeout:Number(c)});const S=[];let f=!1;return this.#s.forEach(b=>{const k=b.getInfo();(!a||a===b.window)&&(c&&b?.capabilities?.eventFeedback?(S.push(b.dispatchEvent(O,c)),f||(this.#d(`ScriptingObject.Event.${g.id}.${i}`,{appId:this.hostId,appUrl:window.location.href}),f=!0),this.#t.audit({message:"Event dispatched and awaiting feedback",scriptingEventId:t,...k})):(b.send({messageType:l.ObjectEvent,messageBody:O}),this.#t.audit({message:"Event dispatched",scriptingEventId:t,...k})))}),await Promise.all(S).then(b=>(this.#t.audit({message:"Event feedback received",scriptingEventId:t}),U(b))).catch(b=>{throw this.#t.error({message:"Error processing event",eventId:t,exception:b}),b}).finally(()=>{f&&this.#u(`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=w.Embed,popupWindowFeatures:j={}}=d,m=this.#M(i,r);let g=null;if(this.#d("SSF.Guest.Load",{appId:t,appUrl:m}),u===w.Popup)g=this.#_({guestId:t,url:m,title:o,searchParams:r,popupWindowFeatures:j,onLoad:c,onError:a});else if(u===w.Embed)g=this.#C({guestId:t,url:m,title:o,targetElement:s,searchParams:r,onLoad:c,onError:a,options:d});else throw new Error(`Invalid openMode: ${u}`);return this.#t.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.#t.setLogLevel(e),this.#s.forEach(this.#m),this.#t.debug("Dispatched config events to all guests")};unloadGuest=e=>{const t=this.#f(e);t&&(t.dispose(),this.#s.delete(t.id),this.#t.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 I})());
2
+
3
+ //# sourceMappingURL=emuiSsfHost.a1d3542194a2fb9e9816.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js/emuiSsfHost.a1d3542194a2fb9e9816.js","mappings":"CAAC,SAA0CA,EAAMC,EAAS,CACtD,OAAO,SAAY,UAAY,OAAO,QAAW,SACnD,OAAO,QAAUA,EAAQ,EAClB,OAAO,QAAW,YAAc,OAAO,IAC9C,OAAO,CAAC,EAAGA,CAAO,EACX,OAAO,SAAY,SAC1B,QAAQ,IAASA,EAAQ,GAEzBD,EAAK,IAASA,E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AACrM,EAAcsM,IAAU,CAChD,KAAK,UAAU,CACb,GAAI,GAAG1G,CAAE,IAAI0G,CAAK,GAClB,IAAAzN,EACA,MAAAiB,EACA,cAAAkK,EACA,aAAAhK,EACA,QAAAqB,CACF,CAAC,CACH,EAAG,IAAI,CACT,EAMA,0BAA6BzB,GAAqB,CAChD,KAAKwG,GAAW,0BAA0BxG,CAAO,CACnD,EAOA,sBAAwB,CACtBxC,EACAwC,IACG,CACH,KAAKwG,GAAW,sBAAsBhJ,EAAUwC,CAAO,CACzD,EAMA,YAAe2M,GAAqB,CAElC,KAAKlK,GAAQ,YAAYkK,CAAK,EAE9B,KAAKrG,GAAQ,QAAQ,KAAKwB,EAAoB,EAC9C,KAAKrF,GAAQ,MAAM,wCAAwC,CAC7D,EAOA,YAAe2G,GAA8D,CAE3E,MAAMrD,EAAQ,KAAKyC,GAAWY,CAAoB,EAC9CrD,IAEFA,EAAM,QAAQ,EAEd,KAAKO,GAAQ,OAAOP,EAAM,EAAE,EAC5B,KAAKtD,GAAQ,MAAM,CACjB,QAAS,6BACT,GAAGsD,EAAM,QAAQ,CACnB,CAAC,EAEL,EAQA,aAAgBzI,GAA2B,CACzC,KAAM,CAAE,GAAA0I,EAAI,mBAAA4G,CAAmB,EAAItP,EAC7B4G,EAAY,KAAKqC,GAAwB,IAAIP,CAAE,GAAK,CAAC,EAC3D9B,EAAU,KAAK0I,CAAkB,EACjC,KAAKrG,GAAwB,IAAIP,EAAI9B,CAAS,CAChD,CACF,C","sources":["webpack://ice.host/webpack/universalModuleDefinition","webpack://ice.host/webpack/bootstrap","webpack://ice.host/webpack/runtime/define property getters","webpack://ice.host/webpack/runtime/hasOwnProperty shorthand","webpack://ice.host/webpack/runtime/make namespace object","webpack://ice.host/../common/dist/esm/event.js","webpack://ice.host/../common/dist/esm/scriptingObject.js","webpack://ice.host/../common/dist/esm/messageType.js","webpack://ice.host/./lib/types.ts","webpack://ice.host/./lib/utils.ts","webpack://ice.host/./lib/guest.ts","webpack://ice.host/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js","webpack://ice.host/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js","webpack://ice.host/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js","webpack://ice.host/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js","webpack://ice.host/../common/dist/esm/remoting.js","webpack://ice.host/../common/dist/esm/scriptingObjectManager.js","webpack://ice.host/../common/dist/esm/proxy.js","webpack://ice.host/./lib/host.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ice\"] = factory();\n\telse\n\t\troot[\"ice\"] = root[\"ice\"] || {}, root[\"ice\"][\"host\"] = factory();\n})(globalThis, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","class Event {\n /* eslint-enable indent */\n /**\n * name of the event\n */\n name;\n /**\n * scripting object id that owns this event\n */\n objectId;\n /**\n * unique id of the event\n */\n id;\n /**\n * Create an event object\n * @param {EventParam} param - parameters for creating an event\n */\n constructor(param) {\n const { name, objectId } = param;\n if (!name) throw new Error(\"Event name is required\");\n if (!objectId) throw new Error(\"Scripting object id is required\");\n this.objectId = objectId;\n this.name = name;\n this.id = `${this.objectId}.${this.name}`.toLowerCase();\n }\n}\nclass ProxyEvent {\n /**\n * check if given object is an instance of ProxyEvent\n * @param obj object to be compared\n * @returns true if given object is an instance of ProxyEvent\n */\n static [Symbol.hasInstance](obj) {\n return obj.getType?.() === \"ProxyEvent\";\n }\n /* eslint-enbale indent */\n /**\n * module that owns this event management. SSF Guest or App Bridge host\n */\n #eventSrc;\n /**\n * unique id of scripting object\n */\n objectId;\n /**\n * name of the event\n */\n name;\n /**\n * unique id of the event\n */\n id;\n /**\n * get type of the object\n * @returns type of the object\n */\n getType() {\n return \"ProxyEvent\";\n }\n /**\n * Create a new instance of the Scripting Object Proxy Event\n * @param {ProxyEventParam} param - parameter for the constructor\n */\n constructor(param) {\n const { name, objectId, eventSrc } = param;\n this.objectId = objectId;\n this.name = name;\n this.#eventSrc = eventSrc;\n this.id = `${this.objectId}.${this.name}`.toLowerCase();\n }\n /**\n * subscribe to an scripting object event\n * @param callback event listener\n * @returns subscription token\n */\n subscribe = (callback) => this.#eventSrc.subscribe({\n eventId: this.id,\n callback\n });\n /**\n * unsubscribe from an scripting object event\n * @param token subscription token\n */\n unsubscribe = (token) => {\n this.#eventSrc.unsubscribe({\n eventId: this.id,\n token\n });\n };\n}\nconst isEvent = (value) => value instanceof Event;\nconst getEventId = (objectId, eventName) => `${objectId.toLowerCase()}.${eventName.toLowerCase()}`;\nexport {\n Event,\n ProxyEvent,\n getEventId,\n isEvent\n};\n","import { isEvent } from \"./event.js\";\nconst FUNCTION = \"function\";\nconst isPublicFunction = (value, fnName) => typeof value === FUNCTION && !!fnName && !fnName.startsWith(\"_\");\nclass ScriptingObject {\n /**\n * unique id of the scripting object\n */\n #id;\n /**\n * type of the scripting object\n */\n #objectType = \"Object\";\n /**\n * Creates an instance of ScriptingObject.\n * @param objectId unique id of the scripting object\n * @param objectType type of the scripting object\n */\n constructor(objectId, objectType) {\n this.#id = objectId;\n this.#objectType = objectType || this.#objectType;\n }\n /**\n * get unique id of the scripting object\n */\n get id() {\n return this.#id;\n }\n /**\n * get type of the scripting object\n */\n get objectType() {\n return this.#objectType;\n }\n /**\n * transform the scripting object to a format suitable for transmitting over window.postMessage\n * @returns marshalled scripting object\n */\n // eslint-disable-next-line no-underscore-dangle\n _toJSON = () => {\n const functions = [];\n const events = [];\n Object.keys(this).forEach((property) => {\n const value = this[property];\n if (isEvent(value)) {\n events.push(property);\n } else if (isPublicFunction(value, property)) {\n functions.push(property);\n }\n });\n return {\n objectId: this.#id,\n objectType: this.#objectType,\n functions,\n events\n };\n };\n /**\n * dispose the scripting object\n */\n // eslint-disable-next-line no-underscore-dangle\n _dispose = () => {\n };\n /**\n * dispose the scripting object\n */\n dispose = () => {\n };\n}\nexport {\n ScriptingObject,\n isPublicFunction\n};\n","var MessageType = /* @__PURE__ */ ((MessageType2) => {\n MessageType2[\"GuestClose\"] = \"guest:close\";\n MessageType2[\"GuestEventSubscribe\"] = \"guest:eventSubscribe\";\n MessageType2[\"GuestEventUnsubscribe\"] = \"guest:eventUnsubscribe\";\n MessageType2[\"GuestFocus\"] = \"guest:focus\";\n MessageType2[\"GuestReady\"] = \"guest:ready\";\n MessageType2[\"GuestReadyComplete\"] = \"guest:readyComplete\";\n MessageType2[\"GuestResize\"] = \"guest:resize\";\n MessageType2[\"HandShake\"] = \"handshake\";\n MessageType2[\"HandShakeAck\"] = \"handshake:ack\";\n MessageType2[\"HostClose\"] = \"host:close\";\n MessageType2[\"HostConfig\"] = \"host:config\";\n MessageType2[\"ListObjects\"] = \"list:objects\";\n MessageType2[\"ObjectEvent\"] = \"object:event\";\n MessageType2[\"ObjectGet\"] = \"object:get\";\n MessageType2[\"ObjectInvoke\"] = \"object:invoke\";\n return MessageType2;\n})(MessageType || {});\nexport {\n MessageType\n};\n","import type {\n IScriptingObject,\n RemotingScriptingObject,\n} from '@elliemae/pui-scripting-object';\n\nexport enum OpenMode {\n /**\n * open as a popup window\n */\n Popup = 'popup',\n /**\n * open as an embedded iframe\n */\n Embed = 'embed',\n}\n\nexport type ValueOf<T> = T[keyof T];\n\n/**\n * allowed sandbox values for the guest application\n */\nexport enum IFrameSandboxValues {\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}\n\nexport type GenericFunction = (...args: unknown[]) => unknown;\n\nexport type EventObject = {\n object: RemotingScriptingObject;\n eventName: string;\n eventParams: Record<string, unknown>;\n eventHandler: string | null;\n eventOptions: {\n allowsFeedback: boolean;\n timeout?: number;\n };\n};\n\nexport type EventDetails = Record<string, unknown>;\n\n/**\n * features for the popup window\n */\nexport type WindowFeatures = {\n /**\n * width of the popup window\n */\n width?: number;\n /**\n * height of the popup window\n */\n height?: number;\n /**\n * top position of the popup window\n */\n top?: number;\n /**\n * left position of the popup window\n */\n left?: number;\n};\n\n/**\n * configuration options for rendering a guest application\n *\n */\nexport type GuestOptions = {\n /**\n * mode of opening the guest application, popup or embed\n * @default OpenMode.Embed\n */\n openMode?: OpenMode;\n /**\n * flag to disable sandboxing for iframe\n * @default false\n */\n disableSandbox?: boolean;\n /**\n * additional sandbox values for the iframe. These values will be added in addition to the default sandbox values.\n * @default [IFrameSandboxValues.AllowScripts, IFrameSandboxValues.AllowPopups, IFrameSandboxValues.AllowModals, IFrameSandboxValues.AllowForms, IFrameSandboxValues.AllowDownloads, IFrameSandboxValues.AllowSameOrigin ]\n */\n sandboxValues?: Array<IFrameSandboxValues>;\n /**\n * custom sandbox values for the iframe. These values will replace the default sandbox values entirely.\n */\n customSandboxValues?: Array<IFrameSandboxValues>;\n /**\n * resize the iframe to fit the content inside\n * @default true\n */\n fitToContent?: boolean;\n /**\n * css style for the iframe\n */\n style?: string;\n /**\n * features for the popup window\n * @default { width: 800, height: 600, top: 100, left: 100 }\n */\n popupWindowFeatures?: WindowFeatures;\n /**\n * permission policy for the guest iframe\n * check https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow for more details\n * @example \"microphone 'self' https://example.com; geolocation 'none'\"\n */\n permissionPolicy?: string;\n};\n\n/**\n * collection of scripting objects\n */\nexport type ScriptingObjects = Record<string, IScriptingObject>;\n\n/**\n * parameters for attaching a guest\n */\nexport type AttachParam = {\n /**\n * unique id of the guest application\n */\n guestId: string;\n /**\n * url of the guest application\n */\n url: string;\n /**\n * page title for the guest application\n */\n title: string;\n /**\n * dom element to attach the guest application to\n */\n domElement?: HTMLIFrameElement;\n /**\n * window object of the guest application\n */\n window: Window;\n /**\n * open mode of the guest application\n */\n openMode: OpenMode;\n /**\n * additional parameters for the guest application\n */\n searchParams?: Record<string, any>;\n};\n","import type { ScriptingObjectTypes } from '@elliemae/pui-scripting-object';\nimport { GenericFunction, ValueOf } from './types.js';\n\nexport const getOrigin = (url: string) => {\n if (url === 'about:blank') return '*';\n try {\n const { origin } = new URL(url);\n return origin === 'null' || !origin ? url : origin;\n } catch (e) {\n const { origin } = new URL(url, document.baseURI);\n return origin;\n }\n};\n\nexport const flatten = (source: any[], target: any[] = []) => {\n const retVal = target || [];\n if (source && source.forEach) {\n source.forEach((item) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n flatten(item, retVal);\n });\n } else if (typeof source !== 'undefined') {\n retVal.push(source);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return retVal;\n};\n\nexport const isScriptingObject = (\n value: any,\n): value is ValueOf<ScriptingObjectTypes> =>\n // eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-unsafe-member-access\n typeof value?._toJSON === 'function';\n\nexport function isFunction(value: any): value is GenericFunction {\n return typeof value === 'function';\n}\n\nexport const getObjectId = (elementOrId: HTMLElement | string) =>\n (elementOrId as HTMLElement)?.id ?? elementOrId;\n","import { IAnalytics } from '@elliemae/pui-scripting-object';\nimport { Remoting, MessageType } from '@elliemae/microfe-common';\nimport { EventObject, OpenMode } from './types.js';\nimport { getOrigin } from './utils.js';\n\n/**\n * options for creating a guest application\n */\ntype GuestOption = {\n /**\n * unique id of the guest application\n */\n guestId: string;\n /**\n * page title of the guest application\n */\n title: string;\n /**\n * url of the guest application\n */\n url: string;\n /**\n * iframe element of the guest application\n */\n domElement?: HTMLIFrameElement;\n /**\n * window object of the guest application\n */\n window: Window;\n /**\n * open mode of the guest application\n */\n openMode: OpenMode;\n /**\n * individual query parameters of the guest application's url parameter string\n */\n searchParams?: Record<string, unknown>;\n /**\n * remoting object\n */\n remoting: Remoting;\n /**\n * analytics object\n */\n analyticsObj: IAnalytics;\n};\n\n/**\n * message to be sent\n */\nexport type MessageParam = {\n /**\n * type of the message\n */\n messageType: string;\n /**\n * body of the message\n */\n messageBody: unknown;\n};\n\n/**\n * Object repesenting guest application\n */\nexport class Guest {\n /**\n * unique id of the guest application\n */\n public readonly id: string;\n\n /**\n * page title of the guest application\n */\n public readonly title: string;\n\n /**\n * url of the guest application\n */\n public readonly url: string;\n\n /**\n * individual query parameters of the guest application's url parameter string\n */\n public readonly searchParams: Record<string, unknown>;\n\n /**\n * iframe element of the guest application\n */\n public readonly domElement: HTMLIFrameElement | null;\n\n /**\n * window object of the guest application\n */\n public readonly window: Window;\n\n /**\n * open mode of the guest application\n */\n public readonly openMode: OpenMode;\n\n /**\n * origin of the guest application\n */\n public readonly origin: string;\n\n /**\n * flag indicating if the guest application is initialized\n */\n public initialized = false;\n\n /**\n * flag indicating if the guest application is ready\n */\n public ready = false;\n\n /**\n * capabilities of the guest application\n */\n public capabilities: Record<string, unknown>;\n\n /**\n * remoting object\n */\n #remoting: Remoting;\n\n /**\n * analytics object\n */\n #analyticsObj: IAnalytics;\n\n /**\n * Create object representing guest application\n * @param {GuestOption} option - options for creating a guest application\n */\n constructor(option: GuestOption) {\n const {\n guestId,\n domElement = null,\n title,\n url,\n window,\n searchParams = {},\n openMode = OpenMode.Embed,\n remoting,\n analyticsObj,\n } = option;\n this.id = guestId;\n this.title = title;\n this.url = url;\n this.origin = getOrigin(url);\n this.searchParams = searchParams;\n this.domElement = domElement;\n this.window = window;\n this.openMode = openMode;\n this.capabilities = {};\n this.#analyticsObj = analyticsObj;\n this.#remoting = remoting;\n }\n\n /**\n * clean up resources\n */\n dispose = () => {\n if (this.openMode === OpenMode.Popup && !this.window.closed) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this.window.document;\n this.window.close();\n } catch (e) {\n this.#remoting.send({\n targetWin: this.window,\n targetOrigin: this.origin,\n messageType: MessageType.HostClose,\n messageBody: {},\n });\n }\n } else {\n this.domElement?.remove?.();\n }\n // remove guest window from allowed list\n this.#remoting.removeSender({ origin: this.origin, window: this.window });\n };\n\n /**\n * Get information about the guest application\n * @returns guest properties\n */\n getInfo = () => ({\n guestId: this.id,\n guestTitle: this.title,\n guestUrl: this.url,\n });\n\n /**\n * Handshake with the guest application in the popup window\n * @returns true if the guest popup window is open & connected\n */\n handShake = () =>\n new Promise<boolean>((resolve) => {\n let handShakeCount = 0;\n const handShakeRetries = 5;\n const handShakeHandle = setInterval(() => {\n if (handShakeCount >= handShakeRetries) {\n clearInterval(handShakeHandle);\n // guest window closed\n resolve(false);\n } else {\n this.#remoting.send({\n targetWin: this.window,\n targetOrigin: this.origin,\n messageType: MessageType.HandShake,\n messageBody: {},\n });\n handShakeCount += 1;\n }\n }, 1000);\n this.#remoting.listen({\n messageType: MessageType.HandShakeAck,\n callback: () => {\n clearInterval(handShakeHandle);\n // guest window connected\n resolve(true);\n },\n });\n });\n\n /**\n * initialize guest messaging\n */\n init = () => {\n // add guest window to the allowed list\n this.#remoting.addSender({ origin: this.origin, window: this.window });\n // for popup guests, we need to provide the guest with the host's window\n if (this.openMode === OpenMode.Popup) {\n this.handShake().catch(() => {});\n }\n };\n\n /**\n * invokes event callback on the guest application\n * @param {EventObject} event - event object\n * @param {number} timeout - timeout in milliseconds\n */\n dispatchEvent = (event: EventObject, timeout: number) => {\n this.#analyticsObj\n .startTiming(\n `ScriptingObject.Event.${event.object.objectId}.${event.eventName}`,\n {\n appId: this.id,\n appUrl: this.url,\n },\n )\n .catch(() => {});\n return this.#remoting\n .invoke({\n targetWin: this.window,\n targetOrigin: this.origin,\n messageType: MessageType.ObjectEvent,\n messageBody: event,\n responseTimeoutMs: timeout,\n })\n .finally(() => {\n this.#analyticsObj\n .endTiming(\n `ScriptingObject.Event.${event.object.objectId}.${event.eventName}`,\n {\n appId: this.id,\n appUrl: this.url,\n },\n )\n .catch(() => {});\n });\n };\n\n /**\n * Send a message without any form of response. fire and forget\n * @param {MessageParam} param - message to be sent\n */\n send = (param: MessageParam) => {\n this.#remoting.send({\n targetWin: this.window,\n targetOrigin: this.origin,\n ...param,\n });\n };\n}\n","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import { v4 as uuidv4 } from \"uuid\";\nconst MESSAGE_SOURCE = \"elli:remoting\";\nconst RESPONSE_MESSAGE_TYPE = \"elli:remoting:response\";\nconst EXCEPTION_MESSAGE_TYPE = \"elli:remoting:exception\";\nconst createMessage = ({\n messageType,\n messageBody,\n onewayMsg = false\n}) => ({\n requestId: !onewayMsg ? uuidv4() : null,\n source: MESSAGE_SOURCE,\n type: messageType,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n body: messageBody\n});\nconst sendMessage = (param) => {\n const { targetWin, targetOrigin, messageType, messageBody } = param;\n const msg = createMessage({ messageType, messageBody });\n targetWin.postMessage(msg, targetOrigin);\n};\nclass Remoting {\n #correlationId;\n #logger;\n /**\n * set of listeners that are registered\n */\n #listeners = /* @__PURE__ */ new Map();\n /**\n * Represents the set of invocations that are waiting for a response\n */\n #invocations = /* @__PURE__ */ new Map();\n /**\n * The handle to the timeout monitor\n */\n #timeoutMonitorHandle = null;\n /**\n * The set of windows that are allowed to send messages to this window\n */\n #allowedSenders = /* @__PURE__ */ new Map();\n #disableOriginCheck;\n /**\n * Create a new instance of the Remoting class\n * @param logger pui-diagnostic logger\n * @param correlationId unique id for the current session\n * @param options optional configuration\n */\n constructor(logger, correlationId, options) {\n if (!logger) throw new Error(\"logger is required\");\n if (!correlationId) throw new Error(\"correlationId is required\");\n this.#correlationId = correlationId;\n this.#logger = logger;\n this.#disableOriginCheck = options?.unsafeAllowAnyGuestOrigin ?? false;\n }\n #getTargetOrigin = (targetOrigin) => this.#disableOriginCheck ? \"*\" : targetOrigin;\n // Evaluates the timeouts on any waiting invocations\n #evaluateTimeouts = () => {\n const ts = Date.now();\n const canceledItems = [];\n this.#invocations.forEach((eventData, key) => {\n const { requestId, cancelTime } = eventData;\n this.#logger.debug(\n `Checking response timeout for requestId: ${requestId}) @ ${cancelTime ?? \"\"}`\n );\n if (eventData.cancelTime && eventData.cancelTime < ts) {\n this.#logger.debug(\n `Detected response timeout for requestId: ${requestId}...`\n );\n canceledItems.push(key);\n eventData.resolve();\n this.#logger.debug(\n `Aborted waiting for response to requestid: ${requestId})`\n );\n }\n });\n canceledItems.forEach((key) => {\n this.#logger.debug(\n `removing invocations with requestId ${key} from cache since response time has expired`\n );\n this.#invocations.delete(key);\n });\n if (this.#invocations.size === 0) {\n this.#logger.debug(`stopping response monitor`);\n this.#stopResponseMonitor();\n }\n };\n // Set a timer interval to catch any invocations that didn't respond in a timely manner\n #startResponseMonitor = () => {\n if (this.#timeoutMonitorHandle === null) {\n this.#logger.debug(\"Staring response timeout evaluator\");\n this.#timeoutMonitorHandle = window.setInterval(\n this.#evaluateTimeouts,\n 200\n );\n }\n };\n // Stops the timeout monitor interval\n #stopResponseMonitor = () => {\n if (this.#timeoutMonitorHandle !== null) {\n window.clearInterval(this.#timeoutMonitorHandle);\n this.#timeoutMonitorHandle = null;\n this.#logger.debug(\"Stopped response timeout evaluator\");\n }\n };\n // Pops an invocation from the incovation list\n #popInvocation = (requestId) => {\n const e = this.#invocations.get(requestId);\n this.#logger.debug(`serving requestId: ${requestId}`);\n this.#invocations.delete(requestId);\n return e;\n };\n // Handles a response to a prior cross-frame invocation\n #processResponse = (message) => {\n const { requestId } = message;\n this.#logger.debug(\n `Response received for invocation requestId: ${requestId}`\n );\n const eventData = this.#popInvocation(requestId);\n if (!eventData) {\n this.#logger.debug(\n `Received response to stale/invalid request with requestId: ${requestId}`\n );\n return false;\n }\n eventData.resolve(message.body);\n return true;\n };\n // Handles a response to a prior cross-frame invocation\n #processException = (message) => {\n this.#logger.debug(\n `Exception received for invocation (requestId = ${message.requestId})`\n );\n const eventData = this.#popInvocation(message.requestId);\n if (!eventData) {\n this.#logger.warn(\n `Received exception for stale/invalid request (requestId = ${message.requestId})`\n );\n return false;\n }\n eventData.reject(new Error(message.body));\n return true;\n };\n // Receives a message from another window and invokes any event handlers\n #receive = ({\n sourceWin,\n sourceOrigin,\n message\n }) => {\n this.#logger.debug(`Received message of type \"${message.type}\"`);\n const callbacks = this.#listeners.get(message.type);\n if (!callbacks) return false;\n callbacks.forEach((callback) => {\n this.#logger.debug(`Invoking message handler ${callback.name}`);\n callback({\n sourceWin,\n sourceOrigin,\n requestId: message.requestId,\n type: message.type,\n body: message.body\n });\n });\n return true;\n };\n // Processes a message received thru the window's message event\n #processMessage = (message) => {\n this.#logger.debug(\n `Remoting: Received message ${JSON.stringify(message.data)}`\n );\n if (this.#allowedSenders.size === 0) return false;\n if (!message.source) return false;\n const senderOrigin = this.#allowedSenders.get(message.source);\n if (!senderOrigin) return false;\n if (message?.data?.source !== MESSAGE_SOURCE) return false;\n if (message.data.type === RESPONSE_MESSAGE_TYPE)\n this.#processResponse(message.data);\n else if (message.data.type === EXCEPTION_MESSAGE_TYPE)\n this.#processException(message.data);\n else\n this.#receive({\n sourceWin: message.source,\n sourceOrigin: senderOrigin,\n message: message.data\n });\n return true;\n };\n /**\n * Adds window and its origin list of allowed senders\n * @param {AddSenderParam} param - The sender to add\n */\n addSender = (param) => {\n const { origin, window: window2 } = param;\n if (!origin) throw new Error(\"origin is required\");\n if (!window2) throw new Error(\"window is required\");\n this.#allowedSenders.set(window2, origin);\n };\n /**\n * Initializes the remoting service for a window\n * @param win The window to initialize remoting for\n */\n initialize = (win) => {\n win.removeEventListener(\"message\", this.#processMessage);\n win.addEventListener(\"message\", this.#processMessage);\n this.#logger.debug(`initialized remoting id: ${this.#correlationId}`);\n };\n /**\n * Closes the remoting service for a window\n */\n close = () => {\n window.removeEventListener(\"message\", this.#processMessage);\n this.#logger.debug(`closed remoting id: ${this.#correlationId}`);\n };\n /**\n * Sends an invocation which generates a Promise to be used to get a response\n * @param {InvokeParam} param The parameters for the invocation\n * @returns promisifyed response\n */\n invoke = (param) => {\n const {\n targetWin,\n targetOrigin,\n messageType,\n messageBody,\n responseTimeoutMs\n } = param;\n return new Promise((resolve, reject) => {\n const msg = createMessage({ messageType, messageBody });\n this.#invocations.set(msg.requestId, {\n requestId: msg.requestId,\n resolve,\n reject,\n cancelTime: responseTimeoutMs ? Date.now() + Number.parseInt(responseTimeoutMs, 10) : null\n });\n targetWin.postMessage(msg, this.#getTargetOrigin(targetOrigin));\n const { requestId } = msg;\n this.#logger.debug(\n `Posted invocation message of type ${messageType} requestId: ${requestId || \"\"}`\n );\n if (responseTimeoutMs) {\n this.#logger.debug(\n `starting response monitor for requestId: ${requestId || \"\"} for ${responseTimeoutMs} ms`\n );\n this.#startResponseMonitor();\n }\n });\n };\n /**\n * Setup callback for a specific message type\n * @param {ListenParam<T>} param The parameters for the listener\n */\n listen = (param) => {\n const { messageType, callback } = param;\n const items = this.#listeners.get(messageType) || [];\n items.push(callback);\n this.#listeners.set(messageType, items);\n };\n /**\n * Send a message without any form of response. Fire and forget\n * @param {SendParam} param The parameters for the send\n */\n send = (param) => {\n const { targetWin, targetOrigin, messageType, messageBody } = param;\n const msg = createMessage({\n messageType,\n messageBody,\n onewayMsg: true\n });\n targetWin.postMessage(msg, this.#getTargetOrigin(targetOrigin));\n this.#logger.debug(`Posted one-way message of type \"${messageType}\"`);\n };\n /**\n * Removes a window from the list of allowed senders\n * @param {AddSenderParam} param - The sender to remove\n */\n removeSender = (param) => {\n const { window: window2 } = param;\n if (window2) this.#allowedSenders.delete(window2);\n };\n /**\n * Send a response message to a window\n * @param {RespondParam} param The parameters for the response\n */\n respond = (param) => {\n const { targetWin, targetOrigin, requestId, response } = param;\n const msg = createMessage({\n messageType: RESPONSE_MESSAGE_TYPE,\n messageBody: response\n });\n msg.requestId = requestId;\n targetWin.postMessage(msg, this.#getTargetOrigin(targetOrigin));\n this.#logger.debug(\n `Response sent to caller for invocation requestId: ${requestId}`\n );\n };\n /**\n * Send an exception message to a window\n * @param {RaiseExceptionParam} param The parameters for the exception\n */\n raiseException = (param) => {\n const { targetWin, targetOrigin, requestId, ex } = param;\n const msg = createMessage({\n messageType: EXCEPTION_MESSAGE_TYPE,\n messageBody: ex\n });\n msg.requestId = requestId;\n targetWin.postMessage(msg, this.#getTargetOrigin(targetOrigin));\n this.#logger.debug(\n `Exception sent to caller for invocation. requestId: ${requestId}`\n );\n };\n}\nexport {\n Remoting,\n sendMessage\n};\n","const MODULE_OBJECT = \"module\";\nvar SecurityContext = /* @__PURE__ */ ((SecurityContext2) => {\n SecurityContext2[\"USER\"] = \"USER\";\n SecurityContext2[\"PARTNER\"] = \"PARTNER\";\n return SecurityContext2;\n})(SecurityContext || {});\nclass ScriptingObjectManager {\n /**\n * collection of registered scripting objects\n */\n #scriptingObjects = /* @__PURE__ */ new Map();\n /**\n * collection of proxied scripting objects for each guest\n */\n #guestScriptingObjects = /* @__PURE__ */ new Map();\n #addGuestScriptingObject = (params) => {\n const { so, guestId } = params;\n const objectId = so.id.toLowerCase();\n const guestSOs = this.#guestScriptingObjects.get(guestId);\n if (!guestSOs) {\n this.#guestScriptingObjects.set(guestId, /* @__PURE__ */ new Map([[objectId, params]]));\n } else {\n if (guestSOs.has(objectId))\n throw new Error(\n `Scripting Object ${so.id} already exists for guest ${guestId}`\n );\n guestSOs.set(objectId, params);\n }\n };\n #disposeSO = ({ so }) => {\n if (so._dispose && typeof so._dispose === \"function\") {\n so._dispose();\n }\n };\n /**\n * get scripting object for the given object id and guest id\n * this method is backward compatible with the V1 guest, where the guest id is not provided. It will return the scripting object for the first guest\n * @param root0\n * @param root0.objectId\n * @param root0.guestId\n * @returns scripting object for the given object id and guest id. null if not found\n */\n #getGuestScriptingObject = ({\n objectId,\n guestId\n }) => {\n if (objectId === MODULE_OBJECT && !guestId) {\n for (const [, mSOs] of this.#guestScriptingObjects) {\n const mSO = mSOs.get(objectId);\n if (mSO) return mSO;\n }\n }\n const SOs = guestId ? this.#guestScriptingObjects.get(guestId) : null;\n if (SOs) {\n return SOs.get(objectId) ?? null;\n }\n return null;\n };\n #removeGuestScriptingObject = ({\n objectId,\n guestId\n } = {}) => {\n if (guestId) {\n if (!objectId) {\n const sosInfo = this.#guestScriptingObjects.get(guestId);\n if (sosInfo) {\n sosInfo.forEach(this.#disposeSO);\n }\n this.#guestScriptingObjects.delete(guestId);\n return;\n }\n const moduleSOs = this.#guestScriptingObjects.get(guestId);\n if (moduleSOs) {\n const soInfo = moduleSOs.get(objectId);\n if (soInfo) this.#disposeSO(soInfo);\n moduleSOs.delete(objectId);\n }\n } else if (objectId) {\n this.#guestScriptingObjects.forEach((moduleSOs) => {\n const soInfo = moduleSOs.get(objectId);\n if (soInfo) this.#disposeSO(soInfo);\n moduleSOs.delete(objectId);\n });\n }\n };\n /**\n * registers scripting object to the host\n * @param so scripting object to register\n * @param {AddScriptingObjectParams<ValueOf<AppObjects>>}\n * @param params\n */\n addScriptingObject = (so, params) => {\n const { guestId } = params || {};\n if (!so?.id || !so?._toJSON) {\n throw new Error(\"Object is not derived from ScriptingObject\");\n }\n const objectId = so.id.toLowerCase();\n if (objectId.trim().toLowerCase() === MODULE_OBJECT && !guestId) {\n throw new Error(`Guest id is required to add Module scripting object`);\n }\n if (guestId) {\n this.#addGuestScriptingObject({ so, ...params, guestId });\n return;\n }\n if (this.#scriptingObjects.has(objectId))\n throw new Error(`Scripting Object ${so.id} already exists`);\n this.#scriptingObjects.set(objectId, { so, ...params });\n };\n /**\n * Get reference to the scripting object proxy for a guest\n * @param {string} objectId scripting object id\n * @param {GuestContext} guest that is requesting the scripting object\n * @returns proxied scripting object reference\n */\n getObject = (objectId, guest) => {\n const id = objectId.trim().toLowerCase();\n let soInfo = this.#getGuestScriptingObject({\n objectId: id,\n guestId: guest?.id\n });\n soInfo = soInfo ?? this.#scriptingObjects.get(id) ?? null;\n const { so } = soInfo || {};\n if (!so) return null;\n return so;\n };\n /**\n * Check if a scripting object exists\n * @param objectId unique id of the scripting object\n * @param guest\n * @returns true if the scripting object exists, false otherwise\n */\n has = (objectId, guest) => this.getObject(objectId, guest) !== null;\n /**\n * list name of scripting objects for the given guest\n * @param guestId unique id of the guest\n * @returns name of scripting objects for the given guest\n */\n listScriptingObjects = (guestId) => {\n let objects = Array.from(this.#scriptingObjects.keys());\n const guestSOs = this.#guestScriptingObjects.get(guestId);\n objects = guestSOs ? objects.concat(Array.from(guestSOs.keys())) : objects;\n return Array.from(new Set(objects));\n };\n /**\n * removes scripting object\n * @param objectId unique id of the scripting object\n * @param guestId unique id of the guest\n */\n removeScriptingObject = (objectId, guestId) => {\n const id = objectId.toLowerCase();\n if (guestId) {\n this.#removeGuestScriptingObject({ objectId: id, guestId });\n } else {\n this.#removeGuestScriptingObject({ objectId: id });\n const soInfo = this.#scriptingObjects.get(id);\n if (soInfo) this.#disposeSO(soInfo);\n this.#scriptingObjects.delete(id);\n }\n };\n /**\n * removes all scripting objects\n * @param guestId unique id of the guest\n */\n removeAllScriptingObjects = (guestId) => {\n if (!guestId) {\n this.#scriptingObjects.forEach(this.#disposeSO);\n this.#scriptingObjects.clear();\n } else {\n this.#removeGuestScriptingObject({ guestId });\n }\n };\n}\nexport {\n MODULE_OBJECT,\n ScriptingObjectManager,\n SecurityContext\n};\n","class ScriptingObjectProxy {\n /**\n * proxy type\n */\n __TYPE__ = \"Proxy\";\n /**\n * unique id of scripting object\n */\n id;\n /**\n * type of scripting object\n */\n objectType;\n /**\n * Creates a new instance of the Scripting Object Proxy\n * @param objectId unique id of scripting object\n * @param objectType type of scripting object\n */\n constructor(objectId, objectType) {\n this.id = objectId;\n this.objectType = objectType;\n }\n}\nconst isScriptingObjectProxy = (value) => (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n value?.constructor?.name === \"Proxy\" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n value?.constructor?.name === \"ScriptingObjectProxy\" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-underscore-dangle\n value?.__TYPE__ === \"Proxy\"\n);\nexport {\n ScriptingObjectProxy,\n isScriptingObjectProxy\n};\n","/* eslint-disable max-lines */\nimport { v4 as uuidv4 } from 'uuid';\nimport type {\n IScriptingObject,\n IScriptingObjectProxy,\n ScriptingObjectTypes,\n Events,\n IAnalytics,\n TimingOptions,\n} from '@elliemae/pui-scripting-object';\nimport {\n Remoting,\n ScriptingObject,\n MessageType,\n Event,\n ScriptingObjectManager,\n ProxyEvent,\n isScriptingObjectProxy,\n GuestContext,\n} from '@elliemae/microfe-common';\nimport type {\n ListenerCallbackParams,\n EventListeners,\n IScriptingObjectProxyEvent,\n AddScriptingObjectParams,\n GetObjectParams,\n DispatchEventParam,\n EventOptions,\n FilterCriteria,\n} from '@elliemae/microfe-common';\nimport { Logger, LogLevels } from '@elliemae/pui-diagnostics';\nimport {\n EventObject,\n GenericFunction,\n IFrameSandboxValues,\n GuestOptions,\n ValueOf,\n ScriptingObjects,\n AttachParam,\n OpenMode,\n WindowFeatures,\n} from './types.js';\nimport {\n ISSFHost,\n HostOption,\n LoadGuestParam,\n LoadGuestsParam,\n GuestCloseParam,\n GuestEventSubscribeCallback,\n GuestEventUnsubscribeCallback,\n} from './ihost.js';\nimport { Guest } from './guest.js';\nimport { flatten, isFunction } from './utils.js';\n\nexport const SANDBOX_DEFAULT = [\n IFrameSandboxValues.AllowScripts,\n IFrameSandboxValues.AllowPopups,\n IFrameSandboxValues.AllowModals,\n IFrameSandboxValues.AllowForms,\n IFrameSandboxValues.AllowDownloads,\n IFrameSandboxValues.AllowSameOrigin,\n];\n\ntype GuestWindowSize = {\n width: number;\n height: number;\n};\n\n/**\n * Host class for embedding guest application and enabling bi-directional communication using scripting objects methods and events\n * @typeParam AppObjects - scripting objects that are published by the host application\n * @typeParam AppEvents - events that are published by the host application\n */\n/* eslint-disable indent */\nexport class SSFHost<\n AppObjects extends ScriptingObjects = ScriptingObjectTypes,\n AppEvents extends EventListeners = Events,\n> implements ISSFHost<AppObjects, AppEvents>\n{\n /* eslint-enable indent */\n /**\n * unique identifier for the host\n */\n public hostId: string;\n\n /**\n * reference to the remoting object\n */\n #remoting: Remoting;\n\n /**\n * unique identifier for the host\n */\n #correlationId: string;\n\n /**\n * reference to the logger\n */\n #logger: Logger;\n\n /**\n * reference to the analytics object\n */\n #analyticsObj: IAnalytics;\n\n /**\n * list of guests\n */\n #guests = new Map<string, Guest>();\n\n /**\n * list of callbacks for guest close.\n */\n #guestCloseCallbackList = new Map<\n string,\n (({ id }: { id: string }) => Promise<void>)[]\n >();\n\n /**\n * scripting object manager\n */\n #soManager: ScriptingObjectManager<AppObjects>;\n\n /**\n * callback for ready state\n */\n #readyStateCallback: null | ((guest: Guest) => void) = null;\n\n /**\n *\n */\n #popupGuestMonitor: ReturnType<typeof setInterval> | null = null;\n\n /**\n * callback for guest event subscription\n */\n #onGuestEventSubscribe: GuestEventSubscribeCallback | null = null;\n\n /**\n * callback for guest event unsubscription\n */\n #onGuestEventUnsubscribe: GuestEventUnsubscribeCallback | null = null;\n\n /**\n * Create a new host\n * @param hostId unique identifier for the host\n * @param {HostOption} option - options for the host\n */\n constructor(hostId: string, option: HostOption) {\n // Set the local variables\n this.hostId = hostId;\n if (!option?.logger) throw new Error('Logger is required');\n if (!option?.analyticsObj) throw new Error('Analytics object is required');\n this.#logger = option.logger;\n this.#analyticsObj = option.analyticsObj;\n this.#correlationId = uuidv4();\n this.#remoting = new Remoting(this.#logger, this.#correlationId, {\n unsafeAllowAnyGuestOrigin: option?.unsafeAllowAnyGuestOrigin,\n });\n if (\n option?.readyStateCallback &&\n typeof option?.readyStateCallback !== 'function'\n )\n throw new Error('readyStateCallback must be a function');\n this.#readyStateCallback = option?.readyStateCallback || null;\n this.#onGuestEventSubscribe = option?.onGuestEventSubscribe || null;\n this.#onGuestEventUnsubscribe = option?.onGuestEventUnsubscribe || null;\n this.#soManager = new ScriptingObjectManager<AppObjects>();\n // Initialize the messenger\n this.#remoting.initialize(window);\n this.#connect();\n // close all popup guest when host window gets reloaded\n window.addEventListener('beforeunload', this.#closeAllPopupGuests);\n // monitor popup guests\n this.#monitorPopupGuests();\n this.#logger.debug(\n `host is initialized. hostId: ${this.hostId}, correlationId: ${\n this.#correlationId\n }`,\n );\n }\n\n #sendBAEvent = (event: string, data: Record<string, unknown>) => {\n const baEvent = { event, ...data };\n this.#analyticsObj.sendBAEvent(baEvent).catch(() => {});\n };\n\n #startTiming = (name: string, options: TimingOptions) => {\n this.#analyticsObj.startTiming(name, options).catch(() => {});\n };\n\n #endTiming = (start: string, options: TimingOptions) => {\n this.#analyticsObj.endTiming(start, options).catch(() => {});\n };\n\n #closeAllPopupGuests = () => {\n // eslint-disable-next-line no-restricted-syntax\n for (const guest of this.#guests.values()) {\n if (guest.openMode === OpenMode.Popup) {\n this.unloadGuest(guest.id);\n }\n }\n };\n\n /**\n * get the reference to the guest application by its window\n * @param guestWindow reference to the guest window\n * @returns reference to the guest\n */\n #getGuestForWindow = (guestWindow: Window) =>\n Array.from(this.#guests.values()).find(\n (guest) => guest.window === guestWindow,\n );\n\n /**\n * get the reference to the guest application by its window\n * @param url url of the guest application\n * @returns reference to the guest\n */\n #getGuestForUrl = (url: string) => {\n // eslint-disable-next-line no-restricted-syntax\n for (const guest of this.#guests.values()) {\n if (guest.url === url) return guest;\n }\n return null;\n };\n\n /**\n * check if a object is a scripting object\n * @param value javascript object\n * @returns true if the object is a scripting object\n */\n #isScriptingObject = (value: any): value is ValueOf<AppObjects> =>\n // eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-unsafe-member-access\n typeof value?._toJSON === 'function';\n\n #encodeResponse = (val: unknown, guest?: GuestContext) => {\n if (this.#isScriptingObject(val)) {\n // add scripting objects returned from scripting object methods\n if (\n !this.#soManager.has(\n val?.id as Extract<keyof AppObjects, string>,\n guest,\n )\n )\n this.#soManager.addScriptingObject(\n val,\n guest ? { guestId: guest?.id } : {},\n );\n // eslint-disable-next-line no-underscore-dangle\n return { type: 'object', object: val._toJSON() };\n }\n return { type: 'value', value: val };\n };\n\n #encodeException = (ex: string | Error) => {\n if (typeof ex === 'string') {\n return ex;\n }\n if (ex instanceof Error) {\n return ex.message;\n }\n return 'An unexpected error occurred in the host application';\n };\n\n #dispatchConfigEvent = (guest: Guest) => {\n if (guest.ready) {\n this.#remoting.send({\n targetWin: guest.window,\n targetOrigin: guest.origin,\n messageType: MessageType.HostConfig,\n messageBody: {\n logLevel: this.#logger.getLogLevel(),\n ...guest.getInfo(),\n },\n });\n }\n };\n\n #invoke = <T extends IScriptingObject>({\n guest,\n obj,\n functionName,\n functionParams,\n }: {\n guest: Guest;\n obj: T;\n functionName: keyof IScriptingObject;\n functionParams: unknown[];\n }) => {\n const func = obj[functionName];\n // Ensure the function exists\n if (!isFunction(func)) {\n this.#logger.warn(\n `Attempt to call invalid function on object type ${\n obj.objectType\n }: ${String(functionName)}`,\n );\n return Promise.reject(\n new Error(\n `Method '${functionName}' not found in Scripting Object '${obj.id}'`,\n ),\n );\n }\n\n // Invoke the object's function\n this.#logger.debug(\n `Invoking host implementation of ${obj.id}.${String(functionName)}()`,\n );\n return new Promise((resolve) => {\n Object.defineProperty(func, 'callContext', {\n value: { guest },\n configurable: true,\n enumerable: true,\n writable: true,\n });\n\n resolve((func as GenericFunction)(...functionParams));\n });\n };\n\n #handleGuestReadyComplete = ({\n sourceWin,\n sourceOrigin,\n requestId,\n }: ListenerCallbackParams<any>) => {\n // Verify the guest belongs to this host\n const guest = this.#getGuestForWindow(sourceWin);\n if (!guest) {\n this.#logger.warn(\n `Received ready event for unknown guest. requestId: ${requestId}`,\n );\n return;\n }\n\n // Ensure this guest is initialized\n if (!guest.initialized) {\n this.#logger.warn(\n 'Guest must be initialized before it is marked as ready',\n );\n this.#remoting.raiseException({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n ex: 'Guest must be initialized before it is marked as ready',\n });\n return;\n }\n\n if (!guest.ready) {\n // Set the ready state\n guest.ready = true;\n const guestInfo = guest.getInfo();\n this.#endTiming('SSF.Guest.Load', {\n appId: guestInfo.guestId,\n appUrl: guestInfo.guestUrl,\n });\n // Invoke the control function on the guest\n this.#dispatchConfigEvent(guest);\n // Invoke the registered callback, if any\n this.#readyStateCallback?.(guest);\n this.#logger.audit({\n message: `Guest is ready`,\n ...guestInfo,\n });\n }\n };\n\n // Initializes a guest when the guest is full loaded\n #handleGuestReady = ({\n sourceWin,\n sourceOrigin,\n requestId,\n body,\n }: ListenerCallbackParams<Record<string, any>>) => {\n // Verify the guest belongs to this host\n const guest = this.#getGuestForWindow(sourceWin);\n if (!guest) {\n this.#logger.warn(\n `Received ready event for unknown guest. requestid = ${requestId}`,\n );\n return;\n }\n if (!guest.initialized) {\n // Initialize the capabilities object\n guest.initialized = true;\n guest.capabilities = body || {};\n this.#logger.audit({\n message: `Guest is initialized`,\n ...guest.getInfo(),\n });\n }\n // If the guest has not indicated that it will provide explicit notification\n // when it's ready, we'll fire the ready event now\n if (!body || !body.onReady) {\n this.#handleGuestReadyComplete({\n sourceWin,\n sourceOrigin,\n requestId,\n type: '',\n body: null,\n });\n }\n };\n\n /**\n * cleanup the guest reference when it is closed\n * @param param0\n * @param param0.sourceWin\n */\n #handleGuestClose = async ({ sourceWin }: ListenerCallbackParams<any>) => {\n if (sourceWin?.window) {\n const guest = this.#findGuest(sourceWin);\n if (guest && !(await guest.handShake())) {\n this.unloadGuest(sourceWin);\n }\n }\n };\n\n // Handles list objects requests from the remote automation framework\n #handleListObjects = ({\n sourceWin,\n sourceOrigin,\n requestId,\n }: ListenerCallbackParams<{\n objects: keyof AppObjects;\n }>) => {\n this.#logger.debug(\n `Processing listObjects request. requestId = ${requestId}`,\n );\n\n // Get the guest from which the request came\n const guest = this.#getGuestForWindow(sourceWin);\n if (!guest) {\n this.#logger.warn('Rejected object request from unknown guest window');\n return false;\n }\n\n // Get the list of objects available for the guest\n const objects = this.#soManager.listScriptingObjects(guest.id);\n\n this.#remoting.respond({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n response: objects,\n });\n\n this.#logger.audit({\n message: `name of scripting objects returned`,\n requestId,\n objects,\n ...guest.getInfo(),\n });\n return true;\n };\n\n // Handles object get requests from the remote automation framework\n #handleObjectGet = ({\n sourceWin,\n sourceOrigin,\n requestId,\n body,\n }: ListenerCallbackParams<{\n objectId: Extract<keyof AppObjects, string>;\n }>) => {\n const { objectId } = body;\n this.#logger.debug(\n `Processing getObject request for object ${objectId}. requestId = ${requestId}`,\n );\n\n // Get the guest from which the request came\n const guest = this.#getGuestForWindow(sourceWin);\n if (!guest) {\n this.#logger.warn('Rejected object request from unknown guest window');\n return false;\n }\n\n // Get the object from the guest's host\n const obj = this.getScriptingObject(objectId, { guest });\n if (!obj) {\n this.#logger.warn(\n `unknown or unauthorized object ${objectId} from guest ${guest.id}`,\n );\n this.#remoting.raiseException({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n ex: `The requested object (${objectId}) is not available`,\n });\n return false;\n }\n\n this.#remoting.respond({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n response: this.#encodeResponse(obj, guest),\n });\n\n this.#logger.audit({\n message: `Scripting Object returned`,\n requestId,\n scriptingObject: objectId,\n ...guest.getInfo(),\n });\n return true;\n };\n\n /**\n * Handles a guest event subscription request.\n *\n * This method processes a request from a guest window to subscribe to a specific event.\n * It verifies the guest window, logs the request, and invokes the subscription callback asynchronously.\n * If the guest window is unknown, the request is rejected and a warning is logged.\n * @param params - The parameters for the event subscription request.\n * @param params.sourceWin - The window object from which the request originated.\n * @param params.requestId - The unique identifier for the request.\n * @param params.body - The body of the request containing event subscription details.\n * @param params.body.eventId - The identifier of the event to subscribe to.\n * @param params.body.criteria - Optional filter criteria for the event subscription.\n * @param params.body.token - The authentication token for the request.\n * @returns Returns `false` if the guest window is unknown; otherwise, no explicit return value.\n */\n #handleGuestEventSubscribe = ({\n sourceWin,\n requestId,\n body,\n }: ListenerCallbackParams<{\n eventId: string;\n criteria?: FilterCriteria;\n token: string;\n }>) => {\n const { eventId, criteria, token } = body;\n this.#logger.debug(\n `Processing guest event subscribe request for event ${eventId}. requestId = ${requestId}`,\n );\n // Get the guest from which the request came\n const guest = this.#getGuestForWindow(sourceWin);\n if (!guest) {\n this.#logger.warn(\n 'Rejected event subscribe request from unknown guest window',\n );\n return;\n }\n // invoke the callback\n setTimeout(() => {\n try {\n this.#onGuestEventSubscribe?.({\n guestId: guest.id,\n eventId,\n criteria,\n token,\n });\n } catch (error) {\n // ignore exceptions\n }\n }, 0);\n };\n\n /**\n * Handles a guest event unsubscribe request.\n *\n * This method processes an unsubscribe request from a guest window for a specific event.\n * It verifies the source window, retrieves the corresponding guest, and invokes the\n * `#onGuestEventUnsubscribe` callback asynchronously. If the source window is not recognized,\n * the request is rejected and a warning is logged.\n * @param params - The parameters for the unsubscribe request, including:\n * - `sourceWin`: The window from which the request originated.\n * - `requestId`: The unique identifier for the request.\n * - `body`: An object containing the `eventId` and `token` for the event to unsubscribe.\n * @param params.sourceWin\n * @param params.requestId\n * @param params.body\n * @returns `false` if the guest window is unknown; otherwise, no explicit return value.\n */\n #handleGuestEventUnsubscribe = ({\n sourceWin,\n requestId,\n body,\n }: ListenerCallbackParams<{ eventId: string; token: string }>) => {\n const { eventId, token } = body;\n this.#logger.debug(\n `Processing guest event unsubscribe request for event ${eventId}. requestId = ${requestId}`,\n );\n // Get the guest from which the request came\n const guest = this.#getGuestForWindow(sourceWin);\n if (!guest) {\n this.#logger.warn(\n 'Rejected event unsubscribe request from unknown guest window',\n );\n return;\n }\n // invoke the callback\n setTimeout(() => {\n try {\n this.#onGuestEventUnsubscribe?.({\n guestId: guest.id,\n eventId,\n token,\n });\n } catch (error) {\n // ignore exceptions\n }\n }, 0);\n };\n\n // handles guest resize event\n #handleGuestResize = ({\n sourceWin,\n requestId,\n body,\n }: ListenerCallbackParams<GuestWindowSize>) => {\n const guest = this.#getGuestForWindow(sourceWin);\n if (!guest) {\n this.#logger.warn(\n `Received resize event from unknown guest. requestid = ${requestId}`,\n );\n return;\n }\n if (guest.domElement) {\n guest.domElement.style.height = `${body.height}px`;\n }\n this.#logger.debug(\n `Guest ${guest.id} resized to ${body.width}x${body.height}`,\n );\n };\n\n // Handles object invoke requests from the remote automation framework\n #handleObjectInvoke = ({\n sourceWin,\n sourceOrigin,\n requestId,\n body,\n }: ListenerCallbackParams<{\n objectId: Extract<keyof AppObjects, string>;\n functionName: keyof IScriptingObject;\n functionParams: unknown[];\n }>) => {\n const { objectId } = body;\n\n // Get the guest from which the request came\n const guest = this.#getGuestForWindow(sourceWin);\n if (!guest) {\n this.#logger.warn(\n 'Rejected method invocation request from unknown guest window',\n );\n // this.#remoting.raiseException({\n // targetWin: sourceWin,\n // targetOrigin: sourceOrigin,\n // requestId,\n // ex: 'Specified window is not a known guest',\n // });\n return false;\n }\n\n this.#logger.debug(\n `Function ${objectId}.${String(body.functionName)}() called from guest \"${\n guest.id\n }\" (requestId = ${requestId})`,\n );\n\n // Get the object from the guest's host\n const obj = this.getScriptingObject(objectId, { guest });\n if (!obj) {\n this.#logger.warn(\n `Invocation of unknown or unauthorized object ${objectId} from guest ${guest.id}`,\n );\n this.#remoting.raiseException({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n ex: `The requested object (${objectId}) is not available`,\n });\n return false;\n }\n\n const guestInfo = guest.getInfo();\n this.#startTiming(`ScriptingObject.API.${objectId}.${body.functionName}`, {\n appId: guestInfo.guestId,\n appUrl: guestInfo.guestUrl,\n });\n // Invoke the function, which will always return a Promise\n this.#invoke({\n guest,\n obj,\n functionName: body.functionName,\n functionParams: body.functionParams,\n })\n .then((val) => {\n this.#remoting.respond({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n response: this.#encodeResponse(val, guest),\n });\n this.#logger.audit({\n message: `Value returned for Scripting Object method call`,\n requestId,\n scriptingObject: objectId,\n scriptingMethod: body.functionName,\n ...guestInfo,\n });\n })\n .catch((ex) => {\n this.#remoting.raiseException({\n targetWin: sourceWin,\n targetOrigin: guest.origin,\n requestId,\n ex: ex as Error,\n });\n this.#logger.audit({\n message: `Exception thrown for Scripting Object method call`,\n requestId,\n scriptingObject: objectId,\n scriptingMethod: body.functionName,\n ...guestInfo,\n });\n })\n .finally(() => {\n this.#endTiming(\n `ScriptingObject.API.${objectId}.${body.functionName}`,\n {\n appId: guestInfo.guestId,\n appUrl: guestInfo.guestUrl,\n },\n );\n });\n return true;\n };\n\n /**\n * subscribe to guest resize event\n */\n #subscribeToGuestResizeEvent = () => {\n this.#remoting.listen({\n messageType: MessageType.GuestResize,\n callback: this.#handleGuestResize,\n });\n };\n\n /**\n * start listening to the remoting messages\n */\n #connect = () => {\n this.#remoting.listen({\n messageType: MessageType.GuestReady,\n callback: this.#handleGuestReady,\n });\n this.#remoting.listen({\n messageType: MessageType.GuestReadyComplete,\n callback: this.#handleGuestReadyComplete,\n });\n this.#remoting.listen({\n messageType: MessageType.GuestClose,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n callback: this.#handleGuestClose,\n });\n this.#remoting.listen({\n messageType: MessageType.ListObjects,\n callback: this.#handleListObjects,\n });\n this.#remoting.listen({\n messageType: MessageType.ObjectGet,\n callback: this.#handleObjectGet,\n });\n this.#remoting.listen({\n messageType: MessageType.ObjectInvoke,\n callback: this.#handleObjectInvoke,\n });\n this.#remoting.listen({\n messageType: MessageType.GuestEventSubscribe,\n callback: this.#handleGuestEventSubscribe,\n });\n this.#remoting.listen({\n messageType: MessageType.GuestEventUnsubscribe,\n callback: this.#handleGuestEventUnsubscribe,\n });\n };\n\n /**\n * check if the value is a proxy event\n * @param value\n * @returns\n */\n #isProxyEvent = (\n value: any,\n ): value is IScriptingObjectProxyEvent<AppEvents> =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n value instanceof ProxyEvent ||\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeof value?.subscribe === 'function'; // support v1 scripting objects\n\n /**\n * Register pre-rendered guest application to host\n * @param {AttachParam} param - parameters for attaching the guest\n * @returns reference to the guest object\n */\n #attachGuest = (param: AttachParam): Guest => {\n const guest = new Guest({\n ...param,\n remoting: this.#remoting,\n analyticsObj: this.#analyticsObj,\n });\n // Register the guest with host\n guest.init();\n // Add the guest\n this.#guests.set(param.guestId, guest);\n return guest;\n };\n\n /**\n * find the guest object by its id, window or dom element\n * @param guestIdOrWindowOrEle id, window or dom element of the guest\n * @returns guest object\n */\n #findGuest = (guestIdOrWindowOrEle: string | Window | HTMLIFrameElement) => {\n // Find the guest object\n let guest =\n typeof guestIdOrWindowOrEle === 'string'\n ? this.#guests.get(guestIdOrWindowOrEle)\n : null;\n if (!guest) {\n guest = Array.from(this.#guests.values()).find(\n (value) =>\n value.window === guestIdOrWindowOrEle ||\n value.domElement === guestIdOrWindowOrEle,\n );\n }\n return guest;\n };\n\n #monitorPopupGuests = () => {\n this.#popupGuestMonitor = setInterval(() => {\n const guestsToRemove: Guest[] = [];\n this.#guests.forEach((guest) => {\n if (guest.openMode === OpenMode.Popup && guest.window.closed) {\n guestsToRemove.push(guest);\n }\n });\n guestsToRemove.forEach((guest) => {\n const { id } = guest;\n this.unloadGuest(id);\n const callbacks = this.#guestCloseCallbackList.get(id);\n callbacks?.forEach((callback) => {\n // eslint-disable-next-line max-nested-callbacks\n callback({ id }).catch(() => {});\n });\n });\n }, 1000);\n };\n\n #openPopupGuest = <\n SearchParams extends Record<string, string | number | boolean>,\n >(param: {\n guestId: string;\n url: string;\n title: string;\n searchParams: SearchParams;\n popupWindowFeatures?: WindowFeatures;\n onLoad?: (guestId: string) => void;\n onError?: (guestId: string) => void;\n }) => {\n const {\n url,\n title,\n popupWindowFeatures = {},\n searchParams,\n guestId,\n onLoad,\n onError,\n } = param;\n const {\n width = 800,\n height = 600,\n top = 100,\n left = 100,\n } = popupWindowFeatures;\n let guest = this.#getGuestForUrl(url);\n if (guest) {\n // bring guest popup window to front\n if (!guest.window.closed) {\n guest.send({\n messageType: MessageType.GuestFocus,\n messageBody: {},\n });\n }\n } else {\n // construct window features as comma separated string\n const windowFeatures = [\n { key: 'width', value: width },\n { key: 'height', value: height },\n { key: 'top', value: top },\n { key: 'left', value: left },\n ].reduce((acc, cur, curIndex) => {\n // eslint-disable-next-line no-param-reassign\n if (curIndex > 0 && cur.value) acc += ',';\n return cur.value ? `${acc}${cur.key}=${cur.value}` : acc;\n }, '');\n // open new guest popup window\n const guestWindow = window.open(url, title, `popup, ${windowFeatures}`);\n if (!guestWindow) {\n // notify load failure to the caller\n try {\n setTimeout(() => {\n onError?.(guestId);\n }, 0);\n } catch (error) {\n this.#logger.debug(\n `Error occurred in onError for guest with id '${guestId}': ${\n (error as Error).message\n }`,\n );\n }\n throw new Error('Failed to open guest application in popup window');\n } else {\n // notify load complete to the caller\n try {\n setTimeout(() => {\n onLoad?.(guestId);\n }, 0);\n } catch (error) {\n this.#logger.debug(\n `Error occurred in onLoad for guest with id '${guestId}': ${\n (error as Error).message\n }`,\n );\n }\n }\n guestWindow.opener = null;\n guest = this.#attachGuest({\n guestId,\n window: guestWindow,\n title,\n url,\n searchParams,\n openMode: OpenMode.Popup,\n });\n }\n return guest;\n };\n\n #openEmbedGuest = <\n SearchParams extends Record<string, string | number | boolean>,\n >(param: {\n guestId: string;\n url: string;\n title: string;\n searchParams: SearchParams;\n targetElement: HTMLElement;\n onLoad?: (guestId: string) => void;\n onError?: (guestId: string) => void;\n options?: GuestOptions;\n }) => {\n const {\n url,\n title,\n targetElement,\n searchParams,\n guestId,\n onLoad,\n onError,\n options = {} as GuestOptions,\n } = param;\n // create the iframe\n const targetElementDocument = targetElement.ownerDocument ?? document;\n const {\n fitToContent = false,\n disableSandbox = false,\n sandboxValues = [],\n customSandboxValues = [],\n style = '',\n permissionPolicy = '',\n } = options;\n if (!title) throw new Error('title is required');\n if (fitToContent) this.#subscribeToGuestResizeEvent();\n // create guest frame\n const frame = targetElementDocument.createElement('iframe');\n frame.setAttribute('id', guestId);\n // handle frame load and error events\n const onFrameLoad = () => {\n // notify load complete to the caller\n setTimeout(() => {\n try {\n onLoad?.(guestId);\n } catch (error) {\n this.#logger.debug(\n `Error occurred in onLoad for guest with id '${guestId}': ${\n (error as Error).message\n }`,\n );\n }\n }, 0);\n this.#logger.debug(`frame loaded for guest with id '${guestId}'`);\n frame.removeEventListener('load', onFrameLoad);\n };\n const onFrameLoadFailure = () => {\n // notify load failure to the caller\n setTimeout(() => {\n try {\n onError?.(guestId);\n } catch (error) {\n this.#logger.debug(\n `Error occurred in onError for guest with id '${guestId}': ${\n (error as Error).message\n }`,\n );\n }\n }, 0);\n this.#logger.error(`frame load failed for guest with id '${guestId}'`);\n frame.removeEventListener('error', onFrameLoadFailure);\n };\n frame.addEventListener('load', onFrameLoad);\n frame.addEventListener('error', onFrameLoadFailure);\n frame.setAttribute(\n 'style',\n `min-width: 100%; height: 100%; border: 0px; ${style}`,\n );\n if (!disableSandbox) {\n frame.setAttribute(\n 'sandbox',\n customSandboxValues.length > 0\n ? customSandboxValues.join(' ')\n : [...SANDBOX_DEFAULT, ...sandboxValues].join(' '),\n );\n }\n frame.setAttribute('title', title);\n frame.setAttribute('src', url);\n if (permissionPolicy) frame.setAttribute('allow', permissionPolicy);\n targetElement.appendChild(frame);\n // Find the window object and create the guest\n const guestFrameEle = targetElementDocument.getElementById(\n guestId,\n ) as HTMLIFrameElement;\n return this.#attachGuest({\n guestId,\n domElement: guestFrameEle,\n window: guestFrameEle.contentWindow as Window,\n title,\n url,\n searchParams,\n openMode: OpenMode.Embed,\n });\n };\n\n #getGuestUrl = <Params extends Record<string, string | number | boolean>>(\n url: string,\n params: Params,\n ) => {\n let querystring = '';\n Object.keys(params).forEach((queryParam) => {\n querystring += `${\n (querystring.length ? '&' : '') + encodeURIComponent(queryParam)\n }=${encodeURIComponent(params[queryParam])}`;\n });\n\n return (\n url +\n (!querystring ? '' : (url.indexOf('?') >= 0 ? '&' : '?') + querystring)\n );\n };\n\n /**\n * registers scripting object to the host\n * @param {ValueOf<AppObjects>} so scripting object to be registered\n * @param {AddScriptingObjectParams} params params to add scripting object\n */\n addScriptingObject = <SO extends ValueOf<AppObjects>>(\n so: SO,\n params?: AddScriptingObjectParams,\n ) => {\n // if scripting object is proxy then clone it\n if (isScriptingObjectProxy(so)) {\n const clonedSo = this.cloneScriptingObject(so);\n this.#soManager.addScriptingObject(clonedSo, params);\n } else {\n // if scripting object is not a proxy object, add it directly\n this.#soManager.addScriptingObject(so, params);\n }\n };\n\n /**\n * Clone parent host's scripting object for exposing to grand children\n * @param proxy - reference to the scripting object obtained through getObject method\n * @param guest - reference to the ssf guest\n * @returns cloned version of the scripting object\n */\n cloneScriptingObject = <ObjectId extends Extract<keyof AppObjects, string>>(\n proxy: IScriptingObjectProxy,\n ): AppObjects[ObjectId] => {\n if (!proxy) throw new Error('proxy is required');\n // Create a new, base ScriptingObject with V2 properties\n const so = new ScriptingObject(proxy.id, proxy.objectType);\n type UnsubscribeFn = () => void;\n // Store the tokens for unsubscription\n let unsubscribers: Array<UnsubscribeFn> = [];\n\n // Copy the functions and events over\n // let propName: keyof typeof proxy;\n Object.keys(proxy).forEach((propName) => {\n const propValue = proxy[propName as keyof IScriptingObjectProxy];\n if (this.#isProxyEvent(propValue)) {\n // v1 or v2 object event\n const event = new Event<AppEvents>({\n name: propValue.name || propName,\n objectId: so.id,\n });\n // Create the event on the object\n Object.defineProperty(so, propName, {\n value: event,\n enumerable: true,\n });\n\n // Subscribe to the event and pass the callback down\n if ((propValue as any) instanceof ProxyEvent) {\n // proxy was obtained from v2 guest\n const listener = ({\n eventParams,\n eventOptions,\n }: {\n eventParams: any;\n eventOptions?: any;\n }) =>\n this.dispatchEvent({\n event,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n eventParams,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n eventOptions,\n });\n\n const token = (propValue as unknown as ProxyEvent).subscribe(\n listener,\n );\n unsubscribers.push(() => {\n (propValue as unknown as ProxyEvent).unsubscribe(token);\n });\n } else {\n // proxy was obtained from v1 guest\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n const token = (propValue as any).subscribe?.(\n (obj: ScriptingObject, params: any, options: any) =>\n this.dispatchEvent({\n event,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n eventParams: params,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n eventOptions: options,\n }),\n );\n unsubscribers.push(() => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n (propValue as any).unsubscribe?.(token);\n });\n }\n } else if (isFunction(propValue)) {\n // Create a function that proxies the call to the proxy\n Object.defineProperty(so, propName, {\n value: async (...args: unknown[]) => {\n const retVal = await propValue(...args);\n return isScriptingObjectProxy(retVal)\n ? this.cloneScriptingObject(retVal)\n : retVal;\n },\n enumerable: true,\n });\n\n // Override the dispose function\n if (propName === 'dispose') {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const defaultImpl = so.dispose;\n Object.defineProperty(so, propName, {\n value: () => {\n // Dispose of the object in the proxy tier\n // eslint-disable-next-line no-underscore-dangle\n so._dispose();\n return defaultImpl.apply(so);\n },\n enumerable: true,\n });\n }\n }\n });\n\n // Override the dispose function// Add a destroy method to clean up the proxy by unsubscribing to the\n // proxied object's events and unpublishing the object\n // eslint-disable-next-line no-underscore-dangle\n so._dispose = () => {\n unsubscribers.forEach((unsub) => {\n unsub?.();\n });\n unsubscribers = [];\n };\n\n return so as unknown as AppObjects[ObjectId];\n };\n\n /**\n * dispose the resources used by the host application\n */\n close = () => {\n clearInterval(this.#popupGuestMonitor!);\n this.#closeAllPopupGuests();\n this.#remoting.close();\n window.removeEventListener('beforeunload', this.#closeAllPopupGuests);\n this.#logger.debug(\n `host is closed. hostId: ${this.hostId}, correlationId: ${\n this.#correlationId\n }`,\n );\n };\n\n /**\n * dispatch event to guest application(s)\n * @param {EventDetail} params details of the event to be dispatched\n * @returns promise that resolves to an array with result from each guest application\n */\n dispatchEvent = async <\n EventId extends Extract<keyof AppEvents, string>,\n Params extends Parameters<AppEvents[EventId]>[0]['eventParams'],\n Options extends EventOptions,\n >(\n params: DispatchEventParam<EventId, Params, Options>,\n ) => {\n const {\n event: { id, name },\n eventParams,\n eventOptions = {} as Options,\n } = params;\n const {\n eventHandler = null,\n timeout = null,\n window: targetWindow = null,\n guestId,\n } = eventOptions;\n // Get the scripting object\n const objectId = id.split('.')[0] as Extract<keyof AppObjects, string>;\n // get the guest object to which the event should be dispatched to\n const guestIdorWnd = guestId || targetWindow;\n const targetGuest = guestIdorWnd ? this.#findGuest(guestIdorWnd) : null;\n // get scripting object\n const scriptingObject = targetGuest\n ? this.getScriptingObject(objectId, { guest: targetGuest })\n : this.getScriptingObject(objectId);\n if (!scriptingObject) {\n this.#logger.warn(\n `Attempt to dispatch event ${name} on unknown object ${objectId}`,\n );\n return Promise.resolve([]);\n }\n\n const eventObj: EventObject = {\n // eslint-disable-next-line no-underscore-dangle\n object: scriptingObject._toJSON(),\n eventName: name,\n eventParams,\n eventHandler,\n eventOptions: {\n allowsFeedback: false,\n },\n };\n\n if (timeout && !Number.isNaN(timeout)) {\n eventObj.eventOptions = {\n allowsFeedback: true,\n timeout: Number(timeout),\n };\n }\n\n // Invoke the event handler in all guests which are exposed to this object\n const guestPromises: Array<Promise<unknown>> = [];\n\n let timingMetricStarted = false;\n this.#guests.forEach((guest) => {\n const guestInfo = guest.getInfo();\n // If a target is supplied, be sure to honor that target to send the message only to\n // the intended window\n if (!targetWindow || targetWindow === guest.window) {\n if (timeout && guest?.capabilities?.eventFeedback) {\n // For an event with feedback, we call the invoke() method, which returns\n // a Promise that will be fulfilled when the guest responds\n guestPromises.push(guest.dispatchEvent(eventObj, timeout));\n if (!timingMetricStarted) {\n this.#startTiming(\n `ScriptingObject.Event.${scriptingObject.id}.${name}`,\n {\n appId: this.hostId,\n appUrl: window.location.href,\n },\n );\n timingMetricStarted = true;\n }\n this.#logger.audit({\n message: 'Event dispatched and awaiting feedback',\n scriptingEventId: id,\n ...guestInfo,\n });\n } else {\n // If no feedback is needed, we fire and forget\n guest.send({\n messageType: MessageType.ObjectEvent,\n messageBody: eventObj,\n });\n this.#logger.audit({\n message: 'Event dispatched',\n scriptingEventId: id,\n ...guestInfo,\n });\n }\n }\n });\n\n // Return a promise that aggregates all of the guest promises\n const retValue = await Promise.all(guestPromises)\n .then((values) => {\n this.#logger.audit({\n message: 'Event feedback received',\n scriptingEventId: id,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return flatten(values);\n })\n .catch((ex: Error) => {\n this.#logger.error({\n message: 'Error processing event',\n eventId: id,\n exception: ex,\n });\n throw ex;\n })\n .finally(() => {\n if (timingMetricStarted)\n this.#endTiming(\n `ScriptingObject.Event.${scriptingObject.id}.${name}`,\n {\n appId: this.hostId,\n appUrl: window.location.href,\n },\n );\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return retValue;\n };\n\n /**\n * get reference to all guest applications\n * @returns list of guest application references\n */\n getGuests = () => {\n const guestList: Array<Guest> = [];\n this.#guests.forEach((guest: Guest) => {\n guestList.push(guest);\n });\n return guestList;\n };\n\n /**\n * get the scripting object by id\n * @param objectId - id of the scripting object\n * @param params\n * @returns scripting object\n */\n getScriptingObject = <Id extends Extract<keyof AppObjects, string>>(\n objectId: Id,\n params?: GetObjectParams,\n ): AppObjects[Id] | null =>\n this.#soManager.getObject(objectId, params?.guest);\n\n /**\n * loads guest application inside sandboxed iframe\n * @param {LoadGuestParam} param - parameters for loading the guest application\n * @returns reference to the guest object\n */\n loadGuest = <SearchParams extends Record<string, string | number | boolean>>(\n param: LoadGuestParam<SearchParams>,\n ): Guest => {\n const {\n id: guestId,\n url,\n targetElement,\n title,\n searchParams = {} as SearchParams,\n onLoad,\n onError,\n options = {} as GuestOptions,\n } = param;\n if (!guestId) throw new Error('id for guest application is required');\n const { openMode = OpenMode.Embed, popupWindowFeatures = {} } = options;\n\n const srcUrl = this.#getGuestUrl(url, searchParams);\n let guest: Guest | null = null;\n\n this.#startTiming('SSF.Guest.Load', {\n appId: guestId,\n appUrl: srcUrl,\n });\n if (openMode === OpenMode.Popup) {\n guest = this.#openPopupGuest({\n guestId,\n url: srcUrl,\n title,\n searchParams,\n popupWindowFeatures,\n onLoad,\n onError,\n });\n } else if (openMode === OpenMode.Embed) {\n guest = this.#openEmbedGuest({\n guestId,\n url: srcUrl,\n title,\n targetElement,\n searchParams,\n onLoad,\n onError,\n options,\n });\n } else {\n throw new Error(`Invalid openMode: ${openMode as string}`);\n }\n\n this.#logger.audit({\n message: 'Guest loaded',\n ...guest.getInfo(),\n });\n return guest;\n };\n\n /**\n * loads guest application inside sandboxed iframe with different params\n * @param {LoadGuestsParam} param - parameters for loading the guest application\n */\n loadGuests = <SearchParams extends Record<string, string | number | boolean>>(\n param: LoadGuestsParam<SearchParams>,\n ) => {\n const {\n id,\n url,\n targetElement,\n title,\n searchParamsList = [] as SearchParams[],\n options = {} as GuestOptions,\n } = param;\n // Render the plugins into sandboxed iframe elements\n searchParamsList.forEach((searchParams, index) => {\n this.loadGuest({\n id: `${id}-${index}`,\n url,\n title,\n targetElement,\n searchParams,\n options,\n });\n }, this);\n };\n\n /**\n * removes all scripting objects from host\n * @param guestId unique id of the guest application\n */\n removeAllScriptingObjects = (guestId?: string) => {\n this.#soManager.removeAllScriptingObjects(guestId);\n };\n\n /**\n * removes scripting object from the host\n * @param objectId unique id of the scripting object\n * @param guestId unique id of the guest application\n */\n removeScriptingObject = (\n objectId: Extract<keyof AppObjects, string>,\n guestId?: string,\n ) => {\n this.#soManager.removeScriptingObject(objectId, guestId);\n };\n\n /**\n * set the log level for the host application\n * @param level - log level\n */\n setLogLevel = (level: LogLevels) => {\n // Set the logging level at the host\n this.#logger.setLogLevel(level);\n // Notify all guests of the change\n this.#guests.forEach(this.#dispatchConfigEvent);\n this.#logger.debug('Dispatched config events to all guests');\n };\n\n /**\n * unloads guest application from host\n * @param guestIdOrWindowOrEle unique id of the guest application or window object or dom element of the guest application\n * @throws Error if guestId or Window reference is invalid\n */\n unloadGuest = (guestIdOrWindowOrEle: string | Window | HTMLIFrameElement) => {\n // Find the guest object\n const guest = this.#findGuest(guestIdOrWindowOrEle);\n if (guest) {\n // dispose the guest\n guest.dispose();\n // Remove from the host's guest list\n this.#guests.delete(guest.id);\n this.#logger.audit({\n message: `Guest is removed from host`,\n ...guest.getInfo(),\n });\n }\n };\n\n /**\n * monitors guest window close action and executes the callback from host.\n * @param callback host callback method\n * @param id unique id of the guest application\n * @param param\n */\n onGuestClose = (param: GuestCloseParam) => {\n const { id, guestCloseCallback } = param;\n const callbacks = this.#guestCloseCallbackList.get(id) || [];\n callbacks.push(guestCloseCallback);\n this.#guestCloseCallbackList.set(id, callbacks);\n };\n}\n"],"names":["root","factory","__webpack_require__","exports","definition","key","obj","prop","Event","param","name","objectId","ProxyEvent","#eventSrc","eventSrc","callback","token","isEvent","value","getEventId","eventName","FUNCTION","isPublicFunction","fnName","ScriptingObject","#id","#objectType","objectType","functions","events","property","MessageType","MessageType2","OpenMode","IFrameSandboxValues","getOrigin","url","origin","flatten","source","target","retVal","item","isScriptingObject","isFunction","getObjectId","elementOrId","Guest","#remoting","#analyticsObj","option","guestId","domElement","title","window","searchParams","openMode","remoting","analyticsObj","resolve","handShakeCount","handShakeRetries","handShakeHandle","event","timeout","getRandomValues","rnds8","rng","byteToHex","i","unsafeStringify","arr","offset","stringify","uuid","v4","options","buf","rnds","MESSAGE_SOURCE","RESPONSE_MESSAGE_TYPE","EXCEPTION_MESSAGE_TYPE","createMessage","messageType","messageBody","onewayMsg","sendMessage","targetWin","targetOrigin","msg","Remoting","#correlationId","#logger","#listeners","#invocations","#timeoutMonitorHandle","#allowedSenders","#disableOriginCheck","logger","correlationId","#getTargetOrigin","#evaluateTimeouts","ts","canceledItems","eventData","requestId","cancelTime","#stopResponseMonitor","#startResponseMonitor","#popInvocation","e","#processResponse","message","#processException","#receive","sourceWin","sourceOrigin","callbacks","#processMessage","senderOrigin","window2","win","responseTimeoutMs","reject","items","response","ex","MODULE_OBJECT","SecurityContext","SecurityContext2","ScriptingObjectManager","#scriptingObjects","#guestScriptingObjects","#addGuestScriptingObject","params","so","guestSOs","#disposeSO","#getGuestScriptingObject","mSOs","mSO","SOs","#removeGuestScriptingObject","sosInfo","moduleSOs","soInfo","guest","id","objects","ScriptingObjectProxy","isScriptingObjectProxy","SANDBOX_DEFAULT","SSFHost","#guests","#guestCloseCallbackList","#soManager","#readyStateCallback","#popupGuestMonitor","#onGuestEventSubscribe","#onGuestEventUnsubscribe","hostId","#connect","#closeAllPopupGuests","#monitorPopupGuests","#sendBAEvent","data","baEvent","#startTiming","#endTiming","start","#getGuestForWindow","guestWindow","#getGuestForUrl","#isScriptingObject","#encodeResponse","val","#encodeException","#dispatchConfigEvent","#invoke","functionName","functionParams","func","#handleGuestReadyComplete","guestInfo","#handleGuestReady","body","#handleGuestClose","#findGuest","#handleListObjects","#handleObjectGet","#handleGuestEventSubscribe","eventId","criteria","#handleGuestEventUnsubscribe","#handleGuestResize","#handleObjectInvoke","#subscribeToGuestResizeEvent","#isProxyEvent","#attachGuest","guestIdOrWindowOrEle","guestsToRemove","#openPopupGuest","popupWindowFeatures","onLoad","onError","width","height","top","left","windowFeatures","acc","cur","curIndex","error","#openEmbedGuest","targetElement","targetElementDocument","fitToContent","disableSandbox","sandboxValues","customSandboxValues","style","permissionPolicy","frame","onFrameLoad","onFrameLoadFailure","guestFrameEle","#getGuestUrl","querystring","queryParam","clonedSo","proxy","unsubscribers","propName","propValue","listener","eventParams","eventOptions","args","defaultImpl","unsub","eventHandler","targetWindow","guestIdorWnd","targetGuest","scriptingObject","eventObj","guestPromises","timingMetricStarted","values","guestList","srcUrl","searchParamsList","index","level","guestCloseCallback"],"sourceRoot":""}
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Guest V1 -> V2 Host</title><style>body,html,main{height:100%;margin:2px;padding:0}iframe{width:100%;height:100%;border:none}#guest-container{height:100%}</style><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script src="https://cdn.elliemae.io/elliemae/core/ssf/1.0/elli.ssf.guest.js"></script><script defer="defer" src="js/emuiSsfHost.01546664223ea88ed947.js"></script></head><body><h2>Guest V1 nesting Host V2</h2><div id="result"><p id="loan-details"></p><p id="loan-pre-save-event-details"></p></div><div id="guest-container"></div><script type="module">import{getGuestBaseUrl,getHost}from"./utils.js";import{Analytics}from"./analytics-object-v2.js";const analyticsObj=new Analytics,hostV2=getHost(analyticsObj),loadV2Guest=async()=>{const t=await getGuestBaseUrl(),{id:e}=hostV2.loadGuest({id:"guestV2",url:new URL("./v2-guest.html",t).href,title:"Guest V2",targetElement:document.getElementById("guest-container")})};window.addEventListener("load",async()=>{await elli.script.connect();const t=await elli.script.getObject("Application"),e=await elli.script.getObject("Loan"),a=await e.getLoanDetails();document.getElementById("loan-details").innerText=`Loan Data: ${JSON.stringify(a)}`,elli.script.subscribe("loan","onPreSave",(t,e)=>(document.getElementById("loan-pre-save-event-details").innerText=`Presave event data: ${JSON.stringify(e)}`,!1)),hostV2.addScriptingObject(hostV2.cloneScriptingObject(t,{})),hostV2.addScriptingObject(hostV2.cloneScriptingObject(e,{})),await loadV2Guest()})</script></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Guest V1 -> V2 Host</title><style>body,html,main{height:100%;margin:2px;padding:0}iframe{width:100%;height:100%;border:none}#guest-container{height:100%}</style><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script src="https://cdn.elliemae.io/elliemae/core/ssf/1.0/elli.ssf.guest.js"></script><script defer="defer" src="js/emuiSsfHost.a1d3542194a2fb9e9816.js"></script></head><body><h2>Guest V1 nesting Host V2</h2><div id="result"><p id="loan-details"></p><p id="loan-pre-save-event-details"></p></div><div id="guest-container"></div><script type="module">import{getGuestBaseUrl,getHost}from"./utils.js";import{Analytics}from"./analytics-object-v2.js";const analyticsObj=new Analytics,hostV2=getHost(analyticsObj),loadV2Guest=async()=>{const t=await getGuestBaseUrl(),{id:e}=hostV2.loadGuest({id:"guestV2",url:new URL("./v2-guest.html",t).href,title:"Guest V2",targetElement:document.getElementById("guest-container")})};window.addEventListener("load",async()=>{await elli.script.connect();const t=await elli.script.getObject("Application"),e=await elli.script.getObject("Loan"),a=await e.getLoanDetails();document.getElementById("loan-details").innerText=`Loan Data: ${JSON.stringify(a)}`,elli.script.subscribe("loan","onPreSave",(t,e)=>(document.getElementById("loan-pre-save-event-details").innerText=`Presave event data: ${JSON.stringify(e)}`,!1)),hostV2.addScriptingObject(hostV2.cloneScriptingObject(t,{})),hostV2.addScriptingObject(hostV2.cloneScriptingObject(e,{})),await loadV2Guest()})</script></body></html>
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host V2 -> V1 Guest</title><style>body,html,main{height:100%;margin:4px;padding:0}iframe{width:100%;height:100%;border:none}#guest-container{height:100%}</style><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.01546664223ea88ed947.js"></script></head><body><main><h1>Host V2 nesting V1 Guest</h1><button id="save-btn" type="button" onclick="saveLoan()">Save Loan</button><div id="results"><p id="pre-save-feedback-result"></p></div><div id="guest-container"></div></main><script type="module">import{Loan}from"./loan-object.js";import{getGuestBaseUrl,getHost}from"./utils.js";import{Analytics}from"./analytics-object-v2.js";const analyticsObj=new Analytics,hostV2=getHost(analyticsObj),loanObj=new Loan;hostV2.addScriptingObject(loanObj);const params=new URLSearchParams(document.location.search),{id:id}=hostV2.loadGuest({id:"guestV1",url:new URL("true"!==params.get("nestV1GuestV2Host")?"./v1-guest.html":"./v1-guest-v2-host.html",window.location.href).href,searchParams:{nestHostV1:!0},title:"Guest V1",targetElement:document.getElementById("guest-container")});window.saveLoan=async()=>{const e=loanObj.getLoanDetails();(await hostV2.dispatchEvent({event:loanObj.onPreSave,eventParams:e,eventOptions:{timeout:1e3}})).some(e=>!1===e)?document.getElementById("pre-save-feedback-result").innerText="Pre save failed":document.getElementById("pre-save-feedback-result").innerText="Pre save succeeded"}</script></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host V2 -> V1 Guest</title><style>body,html,main{height:100%;margin:4px;padding:0}iframe{width:100%;height:100%;border:none}#guest-container{height:100%}</style><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.a1d3542194a2fb9e9816.js"></script></head><body><main><h1>Host V2 nesting V1 Guest</h1><button id="save-btn" type="button" onclick="saveLoan()">Save Loan</button><div id="results"><p id="pre-save-feedback-result"></p></div><div id="guest-container"></div></main><script type="module">import{Loan}from"./loan-object.js";import{getGuestBaseUrl,getHost}from"./utils.js";import{Analytics}from"./analytics-object-v2.js";const analyticsObj=new Analytics,hostV2=getHost(analyticsObj),loanObj=new Loan;hostV2.addScriptingObject(loanObj);const params=new URLSearchParams(document.location.search),{id:id}=hostV2.loadGuest({id:"guestV1",url:new URL("true"!==params.get("nestV1GuestV2Host")?"./v1-guest.html":"./v1-guest-v2-host.html",window.location.href).href,searchParams:{nestHostV1:!0},title:"Guest V1",targetElement:document.getElementById("guest-container")});window.saveLoan=async()=>{const e=loanObj.getLoanDetails();(await hostV2.dispatchEvent({event:loanObj.onPreSave,eventParams:e,eventOptions:{timeout:1e3}})).some(e=>!1===e)?document.getElementById("pre-save-feedback-result").innerText="Pre save failed":document.getElementById("pre-save-feedback-result").innerText="Pre save succeeded"}</script></body></html>
@@ -60,6 +60,14 @@ export type HostOption = {
60
60
  */
61
61
  onGuestEventSubscribe?: GuestEventSubscribeCallback;
62
62
  onGuestEventUnsubscribe?: GuestEventUnsubscribeCallback;
63
+ /**
64
+ * **UNSAFE**: When true, uses '*' as the targetOrigin for all outbound postMessage calls from host to guest,
65
+ * allowing messages to be delivered regardless of the guest window's current origin. This means any window
66
+ * can receive messages intended for the guest, potentially exposing sensitive data.
67
+ * Only enable this if you fully understand the security implications.
68
+ * @default false
69
+ */
70
+ unsafeAllowAnyGuestOrigin?: boolean;
63
71
  };
64
72
  /**
65
73
  * parameters for rendering a guest