@elliemae/ssf-host 2.9.2 → 2.9.4

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
@@ -422,7 +422,7 @@ class SSFHost {
422
422
  targetWin: sourceWin,
423
423
  targetOrigin: guest.origin,
424
424
  requestId,
425
- ex: this.#encodeException(ex)
425
+ ex
426
426
  });
427
427
  this.#logger.audit({
428
428
  message: `Exception thrown for Scripting Object method call`,
package/dist/esm/host.js CHANGED
@@ -409,7 +409,7 @@ class SSFHost {
409
409
  targetWin: sourceWin,
410
410
  targetOrigin: guest.origin,
411
411
  requestId,
412
- ex: this.#encodeException(ex)
412
+ ex
413
413
  });
414
414
  this.#logger.audit({
415
415
  message: `Exception thrown for Scripting Object method call`,
@@ -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://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.38b1fe99dc97a75a91e8.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://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.ed1648532a780f393d2d.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,3 +1,3 @@
1
- (function(E,v){typeof exports=="object"&&typeof module=="object"?module.exports=v():typeof define=="function"&&define.amd?define([],v):typeof exports=="object"?exports.ice=v():(E.ice=E.ice||{},E.ice.host=v())})(globalThis,()=>(()=>{"use strict";var m={};m.d=(n,e)=>{for(var t in e)m.o(e,t)&&!m.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},m.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),m.r=n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var E={};m.r(E),m.d(E,{Event:()=>v,Guest:()=>P,IFrameSandboxValues:()=>y,OpenMode:()=>w,SSFHost:()=>Y,ScriptingObject:()=>I});class v{scriptingObject;name;objectId;requiresFeedback;id;constructor(e){const{name:t,requiresFeedback:i=!1,so:s}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object is required");this.scriptingObject=s,this.objectId=s.id,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase(),this.requiresFeedback=i}}class M{static[Symbol.hasInstance](e){return e.getType?.()==="ProxyEvent"}objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:i}=e;this.objectId=i,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}const _=n=>n instanceof v,Q=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`,x="function",L=(n,e)=>typeof n===x&&!!e&&!e.startsWith("_");class I{#t;#e="Object";constructor(e,t){this.#t=e,this.#e=t||this.#e}get id(){return this.#t}get objectType(){return this.#e}_toJSON=()=>{const e=[],t=[];return Object.keys(this).forEach(i=>{const s=this[i];_(s)?t.push(i):L(s,i)&&e.push(i)}),{objectId:this.#t,objectType:this.#e,functions:e,events:t}};_dispose=()=>{};dispose=()=>{}}var p=(n=>(n.GuestReady="guest:ready",n.GuestClose="guest:close",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.GuestFocus="guest:focus",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.ObjectInvoke="object:invoke",n.ObjectGet="object:get",n.ObjectEvent="object:event",n.HostConfig="host:config",n.HostClose="host:close",n))(p||{}),w=(n=>(n.Popup="popup",n.Embed="embed",n))(w||{}),y=(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))(y||{});const z=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}},$=(n,e=[])=>{const t=e||[];return n&&n.forEach?n.forEach(i=>{$(i,t)}):typeof n<"u"&&t.push(n),t},Z=n=>typeof n?._toJSON=="function";function k(n){return typeof n=="function"}const N=n=>n?.constructor?.name==="Proxy",V=n=>n?.id??n;class P{id;title;url;searchParams;domElement;window;openMode;origin;initialized=!1;ready=!1;capabilities;#t;#e;constructor(e){const{guestId:t,domElement:i=null,title:s,url:o,window:r,searchParams:c={},openMode:a=w.Embed,remoting:d,analyticsObj:l}=e;this.id=t,this.title=s,this.url=o,this.origin=z(o),this.searchParams=c,this.domElement=i,this.window=r,this.openMode=a,this.capabilities={},this.#e=l,this.#t=d}dispose=()=>{if(this.openMode===w.Popup&&!this.window.closed)try{this.window.document,this.window.close()}catch{this.#t.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HostClose,messageBody:{}})}else this.domElement?.remove?.();this.#t.removeSender({origin:this.origin,window:this.window})};getInfo=()=>({guestId:this.id,guestTitle:this.title,guestUrl:this.url});handShake=()=>new Promise(e=>{let t=0;const i=5,s=setInterval(()=>{t>=i?(clearInterval(s),e(!1)):(this.#t.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HandShake,messageBody:{}}),t+=1)},1e3);this.#t.listen({messageType:p.HandShakeAck,callback:()=>{clearInterval(s),e(!0)}})});init=()=>{this.#t.addSender({origin:this.origin,window:this.window}),this.openMode===w.Popup&&this.handShake().catch(()=>{})};dispatchEvent=(e,t)=>(this.#e.startTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{}),this.#t.invoke({targetWin:this.window,targetOrigin:this.origin,messageType:p.ObjectEvent,messageBody:e,responseTimeoutMs:t}).finally(()=>{this.#e.endTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{})}));send=e=>{this.#t.send({targetWin:this.window,targetOrigin:this.origin,...e})}}const G={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let S;const D=new Uint8Array(16);function B(){if(!S&&(S=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!S))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return S(D)}const h=[];for(let n=0;n<256;++n)h.push((n+256).toString(16).slice(1));function A(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 te(n,e=0){const t=A(n,e);if(!validate(t))throw TypeError("Stringified UUID is invalid");return t}const ie=null;function F(n,e,t){if(G.randomUUID&&!e&&!n)return G.randomUUID();n=n||{};const i=n.random||(n.rng||B)();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 A(i)}const T=F,R="elli:remoting",q="elli:remoting:response",U="elli:remoting:exception",O=({messageType:n,messageBody:e,onewayMsg:t=!1})=>({requestId:t?null:T(),source:R,type:n,body:e}),se=n=>{const{targetWin:e,targetOrigin:t,messageType:i,messageBody:s}=n,o=O({messageType:i,messageBody:s});e.postMessage(o,t)};class H{#t;#e;#i=new Map;#n=new Map;#s=null;#o=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#t=t,this.#e=e}#a=()=>{const e=Date.now(),t=[];this.#n.forEach((i,s)=>{const{requestId:o,cancelTime:r}=i;this.#e.debug(`Checking response timeout for requestId: ${o}) @ ${r??""}`),i.cancelTime&&i.cancelTime<e&&(this.#e.debug(`Detected response timeout for requestId: ${o}...`),t.push(s),i.resolve(),this.#e.debug(`Aborted waiting for response to requestid: ${o})`))}),t.forEach(i=>{this.#e.debug(`removing invocations with requestId ${i} from cache since response time has expired`),this.#n.delete(i)}),this.#n.size===0&&(this.#e.debug("stopping response monitor"),this.#g())};#h=()=>{this.#s===null&&(this.#e.debug("Staring response timeout evaluator"),this.#s=window.setInterval(this.#a,200))};#g=()=>{this.#s!==null&&(window.clearInterval(this.#s),this.#s=null,this.#e.debug("Stopped response timeout evaluator"))};#c=e=>{const t=this.#n.get(e);return this.#e.debug(`serving requestId: ${e}`),this.#n.delete(e),t};#d=e=>{const{requestId:t}=e;this.#e.debug(`Response received for invocation requestId: ${t}`);const i=this.#c(t);return i?(i.resolve(e.body),!0):(this.#e.warn(`Received response to stale/invalid request with requestId: ${t}`),!1)};#l=e=>{this.#e.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#c(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#e.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#r=({sourceWin:e,sourceOrigin:t,message:i})=>{this.#e.debug(`Received message of type "${i.type}"`);const s=this.#i.get(i.type);return s?(s.forEach(o=>{this.#e.debug(`Invoking message handler ${o.name}`),o({sourceWin:e,sourceOrigin:t,requestId:i.requestId,type:i.type,body:i.body})}),!0):!1};#u=e=>{if(this.#e.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!==R?!1:(e.data.type===q?this.#d(e.data):e.data.type===U?this.#l(e.data):this.#r({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.#u),e.addEventListener("message",this.#u),this.#e.debug(`initialized remoting id: ${this.#t}`)};close=()=>{window.removeEventListener("message",this.#u),this.#e.debug(`closed remoting id: ${this.#t}`)};invoke=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o,responseTimeoutMs:r}=e;return new Promise((c,a)=>{const d=O({messageType:s,messageBody:o});this.#n.set(d.requestId,{requestId:d.requestId,resolve:c,reject:a,cancelTime:r?Date.now()+Number.parseInt(r,10):null}),t.postMessage(d,i);const{requestId:l}=d;this.#e.debug(`Posted invocation message of type ${s} requestId: ${l||""}`),r&&(this.#e.debug(`starting response monitor for requestId: ${l||""} for ${r} ms`),this.#h())})};listen=e=>{const{messageType:t,callback:i}=e,s=this.#i.get(t)||[];s.push(i),this.#i.set(t,s)};send=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o}=e,r=O({messageType:s,messageBody:o,onewayMsg:!0});t.postMessage(r,i),this.#e.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=O({messageType:q,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#e.debug(`Response sent to caller for invocation requestId: ${s}`)};raiseException=e=>{const{targetWin:t,targetOrigin:i,requestId:s,ex:o}=e,r=O({messageType:U,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#e.debug(`Exception sent to caller for invocation. requestId: ${s}`)}}const C="module";var W=(n=>(n.USER="USER",n.PARTNER="PARTNER",n))(W||{});class J{#t=new Map;#e=new Map;#i=e=>{const{so:t,guestId:i}=e,s=t.id.toLowerCase(),o=this.#e.get(i);if(!o)this.#e.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===C&&!t)for(const[,s]of this.#e){const o=s.get(e);if(o)return o}const i=t?this.#e.get(t):null;return i?i.get(e)??null:null};#o=({objectId:e,guestId:t}={})=>{if(t){if(!e){const s=this.#e.get(t);s&&s.forEach(this.#n),this.#e.delete(t);return}const i=this.#e.get(t);if(i){const s=i.get(e);s&&this.#n(s),i.delete(e)}}else e&&this.#e.forEach(i=>{const s=i.get(e);s&&this.#n(s),i.delete(e)})};#a=({so:e,guest:t})=>new Proxy(e,{get(i,s,o){const r=i[s];return r instanceof Function&&s!=="constructor"?function(...c){const a=this;return Object.defineProperty(r,"callContext",{value:t,enumerable:!1,writable:!0}),r.apply(a===o?i:a,c)}:r}});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()===C&&!i)throw new Error("Guest id is required to add Module scripting object");if(i){this.#i({so:e,...t,guestId:i});return}if(this.#t.has(s))throw new Error(`Scripting Object ${e.id} already exists`);this.#t.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.#t.get(i)??null;const{so:o}=s||{};if(!o)return null;if(!t)return o;const r=this.#a({so:o,guest:t});return Object.defineProperty(r,"target",{value:o,enumerable:!1,configurable:!1,writable:!0}),r};removeScriptingObject=(e,t)=>{const i=e.toLowerCase();if(t)this.#o({objectId:i,guestId:t});else{this.#o({objectId:i});const s=this.#t.get(i);s&&this.#n(s),this.#t.delete(i)}};removeAllScriptingObjects=e=>{e?this.#o({guestId:e}):(this.#t.forEach(this.#n),this.#t.clear())}}const X=[y.AllowScripts,y.AllowPopups,y.AllowModals,y.AllowForms,y.AllowDownloads,y.AllowSameOrigin].join(" ");class Y{hostId;#t;#e;#i;#n;#s=new Map;#o;#a=null;#h=null;constructor(e,t){if(this.hostId=e,!t?.logger)throw new Error("Logger is required");if(!t?.analyticsObj)throw new Error("Analytics object is required");if(this.#i=t.logger,this.#n=t.analyticsObj,this.#e=T(),this.#t=new H(this.#i,this.#e),t?.readyStateCallback&&typeof t?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");this.#a=t?.readyStateCallback||null,this.#o=new J,this.#t.initialize(window),this.#P(),window.addEventListener("beforeunload",this.#l),this.#A(),this.#i.debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#e}`)}#g=(e,t)=>{const i={event:e,...t};this.#n.sendBAEvent(i).catch(()=>{})};#c=(e,t)=>{this.#n.startTiming(e,t).catch(()=>{})};#d=(e,t)=>{this.#n.endTiming(e,t).catch(()=>{})};#l=()=>{for(const e of this.#s.values())e.openMode===w.Popup&&this.unloadGuest(e.id)};#r=e=>Array.from(this.#s.values()).find(t=>t.window===e);#u=e=>{for(const t of this.#s.values())if(t.url===e)return t;return null};#v=e=>typeof e?._toJSON=="function";#p=e=>this.#v(e)?{type:"object",object:e._toJSON()}:{type:"value",value:e};#y=e=>typeof e=="string"?e:e instanceof Error?e.message:"An unexpected error occurred in the host application";#f=e=>{e.ready&&this.#t.send({targetWin:e.window,targetOrigin:e.origin,messageType:p.HostConfig,messageBody:{logLevel:this.#i.getLogLevel(),...e.getInfo()}})};#E=({guest:e,obj:t,functionName:i,functionParams:s})=>{const o=t[i];return k(o)?(this.#i.debug(`Invoking host implementation of ${t.id}.${String(i)}()`),new Promise(r=>{Object.prototype.hasOwnProperty.call(o,"callContext")||Object.defineProperty(o,"callContext",{value:{guest:e},enumerable:!0}),r(o(...s))})):(this.#i.warn(`Attempt to call invalid function on object type ${t.objectType}: ${String(i)}`),Promise.reject(new Error(`Method '${i}' not found in Scripting Object '${t.id}'`)))};#w=({sourceWin:e,sourceOrigin:t,requestId:i})=>{const s=this.#r(e);if(!s){this.#i.warn(`Received ready event for unknown guest. requestId: ${i}`);return}if(!s.initialized){this.#i.warn("Guest must be initialized before it is marked as ready"),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Guest must be initialized before it is marked as ready"});return}if(!s.ready){s.ready=!0;const o=s.getInfo();this.#d("SSF.Guest.Load",{appId:o.guestId,appUrl:o.guestUrl}),this.#f(s),this.#a?.(s),this.#i.audit({message:"Guest is ready",...o})}};#j=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const o=this.#r(e);if(!o){this.#i.warn(`Received ready event for unknown guest. requestid = ${i}`);return}o.initialized||(o.initialized=!0,o.capabilities=s||{},this.#i.audit({message:"Guest is initialized",...o.getInfo()})),(!s||!s.onReady)&&this.#w({sourceWin:e,sourceOrigin:t,requestId:i,type:"",body:null})};#O=async({sourceWin:e})=>{if(e?.window){const t=this.#m(e);t&&!await t.handShake()&&this.unloadGuest(e)}};#S=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s;this.#i.debug(`Processing getObject request for object ${o}. requestId = ${i}`);const r=this.#r(e);if(!r)return this.#i.warn("Rejected object request from unknown guest window"),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Specified window is not a known guest"}),!1;const c=this.getScriptingObject(o,{guest:r});return c?(this.#t.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#p(c)}),this.#i.audit({message:"Scripting Object returned",requestId:i,scriptingObject:o,...r.getInfo()}),!0):(this.#i.warn(`unknown or unauthorized object ${o} from guest ${r.id}`),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1)};#I=({sourceWin:e,requestId:t,body:i})=>{const s=this.#r(e);if(!s){this.#i.warn(`Received resize event from unknown guest. requestid = ${t}`);return}s.domElement&&(s.domElement.style.height=`${i.height}px`),this.#i.debug(`Guest ${s.id} resized to ${i.width}x${i.height}`)};#$=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s,r=this.#r(e);if(!r)return this.#i.warn("Rejected method invocation request from unknown guest window"),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Specified window is not a known guest"}),!1;this.#i.debug(`Function ${o}.${String(s.functionName)}() called from guest "${r.id}" (requestId = ${i})`);const c=this.getScriptingObject(o);if(!c)return this.#i.warn(`Invocation of unknown or unauthorized object ${o} from guest ${r.id}`),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1;const a=r.getInfo();return this.#c(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl}),this.#E({guest:r,obj:c,functionName:s.functionName,functionParams:s.functionParams}).then(d=>{this.#t.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#p(d)}),this.#i.audit({message:"Value returned for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).catch(d=>{this.#t.raiseException({targetWin:e,targetOrigin:r.origin,requestId:i,ex:this.#y(d)}),this.#i.audit({message:"Exception thrown for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).finally(()=>{this.#d(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl})}),!0};#k=()=>{this.#t.listen({messageType:p.GuestResize,callback:this.#I})};#P=()=>{this.#t.listen({messageType:p.GuestReady,callback:this.#j}),this.#t.listen({messageType:p.GuestReadyComplete,callback:this.#w}),this.#t.listen({messageType:p.GuestClose,callback:this.#O}),this.#t.listen({messageType:p.ObjectGet,callback:this.#S}),this.#t.listen({messageType:p.ObjectInvoke,callback:this.#$})};#G=e=>e instanceof M||typeof e?.subscribe=="function";#b=e=>{const t=new P({...e,remoting:this.#t,analyticsObj:this.#n});return t.init(),this.#s.set(e.guestId,t),t};#m=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};#A=()=>{this.#h=setInterval(()=>{const e=[];this.#s.forEach(t=>{t.openMode===w.Popup&&t.window.closed&&e.push(t)}),e.forEach(t=>{this.unloadGuest(t.id)})},1e3)};#T=e=>{const{url:t,title:i,popupWindowFeatures:s={},searchParams:o,guestId:r}=e,{width:c=800,height:a=600,top:d=100,left:l=100}=s;let u=this.#u(t);if(u)u.window.closed||u.send({messageType:p.GuestFocus,messageBody:{}});else{const j=[{key:"width",value:c},{key:"height",value:a},{key:"top",value:d},{key:"left",value:l}].reduce((g,b,K)=>(K>0&&b.value&&(g+=","),b.value?`${g}${b.key}=${b.value}`:g),""),f=window.open(t,i,`popup, ${j}`);if(!f)throw new Error("Failed to open guest application in popup window");f.opener=null,u=this.#b({guestId:r,window:f,title:i,url:t,searchParams:o,openMode:w.Popup})}return u};#R=e=>{const{url:t,title:i,targetElement:s,searchParams:o,guestId:r,options:c={}}=e,a=s.ownerDocument??document,{fitToContent:d=!1,disableSandbox:l=!1,sandboxValues:u=[],style:j=""}=c;if(!i)throw new Error("title is required");d&&this.#k();const f=a.createElement("iframe");f.setAttribute("id",r);const g=()=>{this.#i.debug(`frame loaded for guest with id '${r}'`),f.removeEventListener("load",g)};f.addEventListener("load",g),f.setAttribute("style",`min-width: 100%; height: 100%; border: 0px; ${j}`),l||f.setAttribute("sandbox",`${X} ${u.join(" ")}`),f.setAttribute("title",i),f.setAttribute("src",t),s.appendChild(f);const b=a.getElementById(r);return this.#b({guestId:r,domElement:b,window:b.contentWindow,title:i,url:t,searchParams:o,openMode:w.Embed})};#q=(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)=>{this.#o.addScriptingObject(e,t)};cloneScriptingObject=(e,t)=>{if(!e)throw new Error("proxy is required");if(!t)throw new Error("guest is required");const i=new I(e.id,e.objectType);let s=[];return Object.keys(e).forEach(o=>{const r=e[o];if(this.#G(r)){let c;if(r?.subscribe!=="function"?c=new v({name:r.name||o,requiresFeedback:!1,so:i}):c=new automation.Event,Object.defineProperty(i,o,{value:c,enumerable:!0}),t.subscribe){const a=({eventParams:l,eventOptions:u})=>this.dispatchEvent({event:c,eventParams:l,eventOptions:u}),d=t.subscribe({eventId:r.id,callback:a});s.push(()=>{t.unsubscribe({eventId:r.id,token:d})})}else{const a=r.subscribe?.((d,l,u)=>this.dispatchEvent({event:c,eventParams:l,eventOptions:u}));s.push(()=>{r.unsubscribe?.(a)})}}else if(k(r)&&(Object.defineProperty(i,o,{value:async(...c)=>{const a=await r(...c);return N(a)?this.cloneScriptingObject(a,t):a},enumerable:!0}),o==="dispose")){const c=i.dispose;Object.defineProperty(i,o,{value:()=>(i._dispose(),c.apply(i)),enumerable:!0})}}),i._dispose=()=>{s.forEach(o=>{o?.()}),s=[]},i};close=()=>{clearInterval(this.#h),this.#l(),this.#t.close(),window.removeEventListener("beforeunload",this.#l),this.#i.debug(`host is closed. hostId: ${this.hostId}, correlationId: ${this.#e}`)};dispatchEvent=async e=>{const{event:{id:t,name:i,scriptingObject:s},eventParams:o,eventOptions:r={}}=e,{eventHandler:c=null,timeout:a=null,window:d=null}=r,l={object:s._toJSON(),eventName:i,eventParams:o,eventHandler:c,eventOptions:{allowsFeedback:!1}};a&&!Number.isNaN(a)&&(l.eventOptions={allowsFeedback:!0,timeout:Number(a)});const u=[];let j=!1;return this.#s.forEach(g=>{const b=g.getInfo();(!d||d===g.window)&&(a&&g?.capabilities?.eventFeedback?(u.push(g.dispatchEvent(l,a)),j||(this.#c(`ScriptingObject.Event.${s.id}.${i}`,{appId:this.hostId,appUrl:window.location.href}),j=!0),this.#i.audit({message:"Event dispatched and awaiting feedback",scriptingEventId:t,...b})):(g.send({messageType:p.ObjectEvent,messageBody:l}),this.#i.audit({message:"Event dispatched",scriptingEventId:t,...b})))}),await Promise.all(u).then(g=>(this.#i.audit({message:"Event feedback received",scriptingEventId:t}),$(g))).catch(g=>{throw this.#i.error({message:"Error processing event",eventId:t,exception:g}),g}).finally(()=>{j&&this.#d(`ScriptingObject.Event.${s.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.#o.getObject(e,t?.guest);loadGuest=e=>{const{id:t,url:i,targetElement:s,title:o,searchParams:r={},options:c={}}=e;if(!t)throw new Error("id for guest application is required");const{openMode:a=w.Embed,popupWindowFeatures:d={}}=c,l=this.#q(i,r);let u=null;if(this.#c("SSF.Guest.Load",{appId:t,appUrl:l}),a===w.Popup)u=this.#T({guestId:t,url:l,title:o,searchParams:r,popupWindowFeatures:d});else if(a===w.Embed)u=this.#R({guestId:t,url:l,title:o,targetElement:s,searchParams:r,options:c});else throw new Error(`Invalid openMode: ${a}`);return this.#i.audit({message:"Guest loaded",...u.getInfo()}),u};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.#o.removeAllScriptingObjects(e)};removeScriptingObject=(e,t)=>{this.#o.removeScriptingObject(e,t)};setLogLevel=e=>{this.#i.setLogLevel(e),this.#s.forEach(this.#f),this.#i.debug("Dispatched config events to all guests")};unloadGuest=e=>{const t=this.#m(e);t&&(t.dispose(),this.#s.delete(t.id),this.#i.audit({message:"Guest is removed from host",...t.getInfo()}))}}return E})());
1
+ (function(E,v){typeof exports=="object"&&typeof module=="object"?module.exports=v():typeof define=="function"&&define.amd?define([],v):typeof exports=="object"?exports.ice=v():(E.ice=E.ice||{},E.ice.host=v())})(globalThis,()=>(()=>{"use strict";var m={};m.d=(n,e)=>{for(var t in e)m.o(e,t)&&!m.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},m.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),m.r=n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var E={};m.r(E),m.d(E,{Event:()=>v,Guest:()=>P,IFrameSandboxValues:()=>y,OpenMode:()=>w,SSFHost:()=>Y,ScriptingObject:()=>I});class v{scriptingObject;name;objectId;requiresFeedback;id;constructor(e){const{name:t,requiresFeedback:i=!1,so:s}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object is required");this.scriptingObject=s,this.objectId=s.id,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase(),this.requiresFeedback=i}}class M{static[Symbol.hasInstance](e){return e.getType?.()==="ProxyEvent"}objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:i}=e;this.objectId=i,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}const _=n=>n instanceof v,Q=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`,x="function",L=(n,e)=>typeof n===x&&!!e&&!e.startsWith("_");class I{#t;#e="Object";constructor(e,t){this.#t=e,this.#e=t||this.#e}get id(){return this.#t}get objectType(){return this.#e}_toJSON=()=>{const e=[],t=[];return Object.keys(this).forEach(i=>{const s=this[i];_(s)?t.push(i):L(s,i)&&e.push(i)}),{objectId:this.#t,objectType:this.#e,functions:e,events:t}};_dispose=()=>{};dispose=()=>{}}var p=(n=>(n.GuestReady="guest:ready",n.GuestClose="guest:close",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.GuestFocus="guest:focus",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.ObjectInvoke="object:invoke",n.ObjectGet="object:get",n.ObjectEvent="object:event",n.HostConfig="host:config",n.HostClose="host:close",n))(p||{}),w=(n=>(n.Popup="popup",n.Embed="embed",n))(w||{}),y=(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))(y||{});const z=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}},$=(n,e=[])=>{const t=e||[];return n&&n.forEach?n.forEach(i=>{$(i,t)}):typeof n<"u"&&t.push(n),t},Z=n=>typeof n?._toJSON=="function";function k(n){return typeof n=="function"}const N=n=>n?.constructor?.name==="Proxy",V=n=>n?.id??n;class P{id;title;url;searchParams;domElement;window;openMode;origin;initialized=!1;ready=!1;capabilities;#t;#e;constructor(e){const{guestId:t,domElement:i=null,title:s,url:o,window:r,searchParams:c={},openMode:a=w.Embed,remoting:d,analyticsObj:l}=e;this.id=t,this.title=s,this.url=o,this.origin=z(o),this.searchParams=c,this.domElement=i,this.window=r,this.openMode=a,this.capabilities={},this.#e=l,this.#t=d}dispose=()=>{if(this.openMode===w.Popup&&!this.window.closed)try{this.window.document,this.window.close()}catch{this.#t.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HostClose,messageBody:{}})}else this.domElement?.remove?.();this.#t.removeSender({origin:this.origin,window:this.window})};getInfo=()=>({guestId:this.id,guestTitle:this.title,guestUrl:this.url});handShake=()=>new Promise(e=>{let t=0;const i=5,s=setInterval(()=>{t>=i?(clearInterval(s),e(!1)):(this.#t.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HandShake,messageBody:{}}),t+=1)},1e3);this.#t.listen({messageType:p.HandShakeAck,callback:()=>{clearInterval(s),e(!0)}})});init=()=>{this.#t.addSender({origin:this.origin,window:this.window}),this.openMode===w.Popup&&this.handShake().catch(()=>{})};dispatchEvent=(e,t)=>(this.#e.startTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{}),this.#t.invoke({targetWin:this.window,targetOrigin:this.origin,messageType:p.ObjectEvent,messageBody:e,responseTimeoutMs:t}).finally(()=>{this.#e.endTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{})}));send=e=>{this.#t.send({targetWin:this.window,targetOrigin:this.origin,...e})}}const G={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let S;const D=new Uint8Array(16);function B(){if(!S&&(S=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!S))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return S(D)}const h=[];for(let n=0;n<256;++n)h.push((n+256).toString(16).slice(1));function A(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 te(n,e=0){const t=A(n,e);if(!validate(t))throw TypeError("Stringified UUID is invalid");return t}const ie=null;function F(n,e,t){if(G.randomUUID&&!e&&!n)return G.randomUUID();n=n||{};const i=n.random||(n.rng||B)();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 A(i)}const T=F,R="elli:remoting",q="elli:remoting:response",U="elli:remoting:exception",O=({messageType:n,messageBody:e,onewayMsg:t=!1})=>({requestId:t?null:T(),source:R,type:n,body:e}),se=n=>{const{targetWin:e,targetOrigin:t,messageType:i,messageBody:s}=n,o=O({messageType:i,messageBody:s});e.postMessage(o,t)};class H{#t;#e;#i=new Map;#n=new Map;#s=null;#o=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#t=t,this.#e=e}#a=()=>{const e=Date.now(),t=[];this.#n.forEach((i,s)=>{const{requestId:o,cancelTime:r}=i;this.#e.debug(`Checking response timeout for requestId: ${o}) @ ${r??""}`),i.cancelTime&&i.cancelTime<e&&(this.#e.debug(`Detected response timeout for requestId: ${o}...`),t.push(s),i.resolve(),this.#e.debug(`Aborted waiting for response to requestid: ${o})`))}),t.forEach(i=>{this.#e.debug(`removing invocations with requestId ${i} from cache since response time has expired`),this.#n.delete(i)}),this.#n.size===0&&(this.#e.debug("stopping response monitor"),this.#g())};#h=()=>{this.#s===null&&(this.#e.debug("Staring response timeout evaluator"),this.#s=window.setInterval(this.#a,200))};#g=()=>{this.#s!==null&&(window.clearInterval(this.#s),this.#s=null,this.#e.debug("Stopped response timeout evaluator"))};#c=e=>{const t=this.#n.get(e);return this.#e.debug(`serving requestId: ${e}`),this.#n.delete(e),t};#d=e=>{const{requestId:t}=e;this.#e.debug(`Response received for invocation requestId: ${t}`);const i=this.#c(t);return i?(i.resolve(e.body),!0):(this.#e.warn(`Received response to stale/invalid request with requestId: ${t}`),!1)};#l=e=>{this.#e.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#c(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#e.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#r=({sourceWin:e,sourceOrigin:t,message:i})=>{this.#e.debug(`Received message of type "${i.type}"`);const s=this.#i.get(i.type);return s?(s.forEach(o=>{this.#e.debug(`Invoking message handler ${o.name}`),o({sourceWin:e,sourceOrigin:t,requestId:i.requestId,type:i.type,body:i.body})}),!0):!1};#u=e=>{if(this.#e.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!==R?!1:(e.data.type===q?this.#d(e.data):e.data.type===U?this.#l(e.data):this.#r({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.#u),e.addEventListener("message",this.#u),this.#e.debug(`initialized remoting id: ${this.#t}`)};close=()=>{window.removeEventListener("message",this.#u),this.#e.debug(`closed remoting id: ${this.#t}`)};invoke=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o,responseTimeoutMs:r}=e;return new Promise((c,a)=>{const d=O({messageType:s,messageBody:o});this.#n.set(d.requestId,{requestId:d.requestId,resolve:c,reject:a,cancelTime:r?Date.now()+Number.parseInt(r,10):null}),t.postMessage(d,i);const{requestId:l}=d;this.#e.debug(`Posted invocation message of type ${s} requestId: ${l||""}`),r&&(this.#e.debug(`starting response monitor for requestId: ${l||""} for ${r} ms`),this.#h())})};listen=e=>{const{messageType:t,callback:i}=e,s=this.#i.get(t)||[];s.push(i),this.#i.set(t,s)};send=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o}=e,r=O({messageType:s,messageBody:o,onewayMsg:!0});t.postMessage(r,i),this.#e.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=O({messageType:q,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#e.debug(`Response sent to caller for invocation requestId: ${s}`)};raiseException=e=>{const{targetWin:t,targetOrigin:i,requestId:s,ex:o}=e,r=O({messageType:U,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#e.debug(`Exception sent to caller for invocation. requestId: ${s}`)}}const C="module";var W=(n=>(n.USER="USER",n.PARTNER="PARTNER",n))(W||{});class J{#t=new Map;#e=new Map;#i=e=>{const{so:t,guestId:i}=e,s=t.id.toLowerCase(),o=this.#e.get(i);if(!o)this.#e.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===C&&!t)for(const[,s]of this.#e){const o=s.get(e);if(o)return o}const i=t?this.#e.get(t):null;return i?i.get(e)??null:null};#o=({objectId:e,guestId:t}={})=>{if(t){if(!e){const s=this.#e.get(t);s&&s.forEach(this.#n),this.#e.delete(t);return}const i=this.#e.get(t);if(i){const s=i.get(e);s&&this.#n(s),i.delete(e)}}else e&&this.#e.forEach(i=>{const s=i.get(e);s&&this.#n(s),i.delete(e)})};#a=({so:e,guest:t})=>new Proxy(e,{get(i,s,o){const r=i[s];return r instanceof Function&&s!=="constructor"?function(...c){const a=this;return Object.defineProperty(r,"callContext",{value:t,enumerable:!1,writable:!0}),r.apply(a===o?i:a,c)}:r}});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()===C&&!i)throw new Error("Guest id is required to add Module scripting object");if(i){this.#i({so:e,...t,guestId:i});return}if(this.#t.has(s))throw new Error(`Scripting Object ${e.id} already exists`);this.#t.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.#t.get(i)??null;const{so:o}=s||{};if(!o)return null;if(!t)return o;const r=this.#a({so:o,guest:t});return Object.defineProperty(r,"target",{value:o,enumerable:!1,configurable:!1,writable:!0}),r};removeScriptingObject=(e,t)=>{const i=e.toLowerCase();if(t)this.#o({objectId:i,guestId:t});else{this.#o({objectId:i});const s=this.#t.get(i);s&&this.#n(s),this.#t.delete(i)}};removeAllScriptingObjects=e=>{e?this.#o({guestId:e}):(this.#t.forEach(this.#n),this.#t.clear())}}const X=[y.AllowScripts,y.AllowPopups,y.AllowModals,y.AllowForms,y.AllowDownloads,y.AllowSameOrigin].join(" ");class Y{hostId;#t;#e;#i;#n;#s=new Map;#o;#a=null;#h=null;constructor(e,t){if(this.hostId=e,!t?.logger)throw new Error("Logger is required");if(!t?.analyticsObj)throw new Error("Analytics object is required");if(this.#i=t.logger,this.#n=t.analyticsObj,this.#e=T(),this.#t=new H(this.#i,this.#e),t?.readyStateCallback&&typeof t?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");this.#a=t?.readyStateCallback||null,this.#o=new J,this.#t.initialize(window),this.#k(),window.addEventListener("beforeunload",this.#l),this.#G(),this.#i.debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#e}`)}#g=(e,t)=>{const i={event:e,...t};this.#n.sendBAEvent(i).catch(()=>{})};#c=(e,t)=>{this.#n.startTiming(e,t).catch(()=>{})};#d=(e,t)=>{this.#n.endTiming(e,t).catch(()=>{})};#l=()=>{for(const e of this.#s.values())e.openMode===w.Popup&&this.unloadGuest(e.id)};#r=e=>Array.from(this.#s.values()).find(t=>t.window===e);#u=e=>{for(const t of this.#s.values())if(t.url===e)return t;return null};#v=e=>typeof e?._toJSON=="function";#p=e=>this.#v(e)?{type:"object",object:e._toJSON()}:{type:"value",value:e};#q=e=>typeof e=="string"?e:e instanceof Error?e.message:"An unexpected error occurred in the host application";#f=e=>{e.ready&&this.#t.send({targetWin:e.window,targetOrigin:e.origin,messageType:p.HostConfig,messageBody:{logLevel:this.#i.getLogLevel(),...e.getInfo()}})};#y=({guest:e,obj:t,functionName:i,functionParams:s})=>{const o=t[i];return k(o)?(this.#i.debug(`Invoking host implementation of ${t.id}.${String(i)}()`),new Promise(r=>{Object.prototype.hasOwnProperty.call(o,"callContext")||Object.defineProperty(o,"callContext",{value:{guest:e},enumerable:!0}),r(o(...s))})):(this.#i.warn(`Attempt to call invalid function on object type ${t.objectType}: ${String(i)}`),Promise.reject(new Error(`Method '${i}' not found in Scripting Object '${t.id}'`)))};#w=({sourceWin:e,sourceOrigin:t,requestId:i})=>{const s=this.#r(e);if(!s){this.#i.warn(`Received ready event for unknown guest. requestId: ${i}`);return}if(!s.initialized){this.#i.warn("Guest must be initialized before it is marked as ready"),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Guest must be initialized before it is marked as ready"});return}if(!s.ready){s.ready=!0;const o=s.getInfo();this.#d("SSF.Guest.Load",{appId:o.guestId,appUrl:o.guestUrl}),this.#f(s),this.#a?.(s),this.#i.audit({message:"Guest is ready",...o})}};#E=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const o=this.#r(e);if(!o){this.#i.warn(`Received ready event for unknown guest. requestid = ${i}`);return}o.initialized||(o.initialized=!0,o.capabilities=s||{},this.#i.audit({message:"Guest is initialized",...o.getInfo()})),(!s||!s.onReady)&&this.#w({sourceWin:e,sourceOrigin:t,requestId:i,type:"",body:null})};#j=async({sourceWin:e})=>{if(e?.window){const t=this.#m(e);t&&!await t.handShake()&&this.unloadGuest(e)}};#O=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s;this.#i.debug(`Processing getObject request for object ${o}. requestId = ${i}`);const r=this.#r(e);if(!r)return this.#i.warn("Rejected object request from unknown guest window"),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Specified window is not a known guest"}),!1;const c=this.getScriptingObject(o,{guest:r});return c?(this.#t.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#p(c)}),this.#i.audit({message:"Scripting Object returned",requestId:i,scriptingObject:o,...r.getInfo()}),!0):(this.#i.warn(`unknown or unauthorized object ${o} from guest ${r.id}`),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1)};#S=({sourceWin:e,requestId:t,body:i})=>{const s=this.#r(e);if(!s){this.#i.warn(`Received resize event from unknown guest. requestid = ${t}`);return}s.domElement&&(s.domElement.style.height=`${i.height}px`),this.#i.debug(`Guest ${s.id} resized to ${i.width}x${i.height}`)};#I=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s,r=this.#r(e);if(!r)return this.#i.warn("Rejected method invocation request from unknown guest window"),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Specified window is not a known guest"}),!1;this.#i.debug(`Function ${o}.${String(s.functionName)}() called from guest "${r.id}" (requestId = ${i})`);const c=this.getScriptingObject(o);if(!c)return this.#i.warn(`Invocation of unknown or unauthorized object ${o} from guest ${r.id}`),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1;const a=r.getInfo();return this.#c(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl}),this.#y({guest:r,obj:c,functionName:s.functionName,functionParams:s.functionParams}).then(d=>{this.#t.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#p(d)}),this.#i.audit({message:"Value returned for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).catch(d=>{this.#t.raiseException({targetWin:e,targetOrigin:r.origin,requestId:i,ex:d}),this.#i.audit({message:"Exception thrown for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).finally(()=>{this.#d(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl})}),!0};#$=()=>{this.#t.listen({messageType:p.GuestResize,callback:this.#S})};#k=()=>{this.#t.listen({messageType:p.GuestReady,callback:this.#E}),this.#t.listen({messageType:p.GuestReadyComplete,callback:this.#w}),this.#t.listen({messageType:p.GuestClose,callback:this.#j}),this.#t.listen({messageType:p.ObjectGet,callback:this.#O}),this.#t.listen({messageType:p.ObjectInvoke,callback:this.#I})};#P=e=>e instanceof M||typeof e?.subscribe=="function";#b=e=>{const t=new P({...e,remoting:this.#t,analyticsObj:this.#n});return t.init(),this.#s.set(e.guestId,t),t};#m=e=>{let t=typeof e=="string"?this.#s.get(e):null;return t||(t=Array.from(this.#s.values()).find(i=>i.window===e||i.domElement===e)),t};#G=()=>{this.#h=setInterval(()=>{const e=[];this.#s.forEach(t=>{t.openMode===w.Popup&&t.window.closed&&e.push(t)}),e.forEach(t=>{this.unloadGuest(t.id)})},1e3)};#A=e=>{const{url:t,title:i,popupWindowFeatures:s={},searchParams:o,guestId:r}=e,{width:c=800,height:a=600,top:d=100,left:l=100}=s;let u=this.#u(t);if(u)u.window.closed||u.send({messageType:p.GuestFocus,messageBody:{}});else{const j=[{key:"width",value:c},{key:"height",value:a},{key:"top",value:d},{key:"left",value:l}].reduce((g,b,K)=>(K>0&&b.value&&(g+=","),b.value?`${g}${b.key}=${b.value}`:g),""),f=window.open(t,i,`popup, ${j}`);if(!f)throw new Error("Failed to open guest application in popup window");f.opener=null,u=this.#b({guestId:r,window:f,title:i,url:t,searchParams:o,openMode:w.Popup})}return u};#T=e=>{const{url:t,title:i,targetElement:s,searchParams:o,guestId:r,options:c={}}=e,a=s.ownerDocument??document,{fitToContent:d=!1,disableSandbox:l=!1,sandboxValues:u=[],style:j=""}=c;if(!i)throw new Error("title is required");d&&this.#$();const f=a.createElement("iframe");f.setAttribute("id",r);const g=()=>{this.#i.debug(`frame loaded for guest with id '${r}'`),f.removeEventListener("load",g)};f.addEventListener("load",g),f.setAttribute("style",`min-width: 100%; height: 100%; border: 0px; ${j}`),l||f.setAttribute("sandbox",`${X} ${u.join(" ")}`),f.setAttribute("title",i),f.setAttribute("src",t),s.appendChild(f);const b=a.getElementById(r);return this.#b({guestId:r,domElement:b,window:b.contentWindow,title:i,url:t,searchParams:o,openMode:w.Embed})};#R=(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)=>{this.#o.addScriptingObject(e,t)};cloneScriptingObject=(e,t)=>{if(!e)throw new Error("proxy is required");if(!t)throw new Error("guest is required");const i=new I(e.id,e.objectType);let s=[];return Object.keys(e).forEach(o=>{const r=e[o];if(this.#P(r)){let c;if(r?.subscribe!=="function"?c=new v({name:r.name||o,requiresFeedback:!1,so:i}):c=new automation.Event,Object.defineProperty(i,o,{value:c,enumerable:!0}),t.subscribe){const a=({eventParams:l,eventOptions:u})=>this.dispatchEvent({event:c,eventParams:l,eventOptions:u}),d=t.subscribe({eventId:r.id,callback:a});s.push(()=>{t.unsubscribe({eventId:r.id,token:d})})}else{const a=r.subscribe?.((d,l,u)=>this.dispatchEvent({event:c,eventParams:l,eventOptions:u}));s.push(()=>{r.unsubscribe?.(a)})}}else if(k(r)&&(Object.defineProperty(i,o,{value:async(...c)=>{const a=await r(...c);return N(a)?this.cloneScriptingObject(a,t):a},enumerable:!0}),o==="dispose")){const c=i.dispose;Object.defineProperty(i,o,{value:()=>(i._dispose(),c.apply(i)),enumerable:!0})}}),i._dispose=()=>{s.forEach(o=>{o?.()}),s=[]},i};close=()=>{clearInterval(this.#h),this.#l(),this.#t.close(),window.removeEventListener("beforeunload",this.#l),this.#i.debug(`host is closed. hostId: ${this.hostId}, correlationId: ${this.#e}`)};dispatchEvent=async e=>{const{event:{id:t,name:i,scriptingObject:s},eventParams:o,eventOptions:r={}}=e,{eventHandler:c=null,timeout:a=null,window:d=null}=r,l={object:s._toJSON(),eventName:i,eventParams:o,eventHandler:c,eventOptions:{allowsFeedback:!1}};a&&!Number.isNaN(a)&&(l.eventOptions={allowsFeedback:!0,timeout:Number(a)});const u=[];let j=!1;return this.#s.forEach(g=>{const b=g.getInfo();(!d||d===g.window)&&(a&&g?.capabilities?.eventFeedback?(u.push(g.dispatchEvent(l,a)),j||(this.#c(`ScriptingObject.Event.${s.id}.${i}`,{appId:this.hostId,appUrl:window.location.href}),j=!0),this.#i.audit({message:"Event dispatched and awaiting feedback",scriptingEventId:t,...b})):(g.send({messageType:p.ObjectEvent,messageBody:l}),this.#i.audit({message:"Event dispatched",scriptingEventId:t,...b})))}),await Promise.all(u).then(g=>(this.#i.audit({message:"Event feedback received",scriptingEventId:t}),$(g))).catch(g=>{throw this.#i.error({message:"Error processing event",eventId:t,exception:g}),g}).finally(()=>{j&&this.#d(`ScriptingObject.Event.${s.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.#o.getObject(e,t?.guest);loadGuest=e=>{const{id:t,url:i,targetElement:s,title:o,searchParams:r={},options:c={}}=e;if(!t)throw new Error("id for guest application is required");const{openMode:a=w.Embed,popupWindowFeatures:d={}}=c,l=this.#R(i,r);let u=null;if(this.#c("SSF.Guest.Load",{appId:t,appUrl:l}),a===w.Popup)u=this.#A({guestId:t,url:l,title:o,searchParams:r,popupWindowFeatures:d});else if(a===w.Embed)u=this.#T({guestId:t,url:l,title:o,targetElement:s,searchParams:r,options:c});else throw new Error(`Invalid openMode: ${a}`);return this.#i.audit({message:"Guest loaded",...u.getInfo()}),u};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.#o.removeAllScriptingObjects(e)};removeScriptingObject=(e,t)=>{this.#o.removeScriptingObject(e,t)};setLogLevel=e=>{this.#i.setLogLevel(e),this.#s.forEach(this.#f),this.#i.debug("Dispatched config events to all guests")};unloadGuest=e=>{const t=this.#m(e);t&&(t.dispose(),this.#s.delete(t.id),this.#i.audit({message:"Guest is removed from host",...t.getInfo()}))}}return E})());
2
2
 
3
- //# sourceMappingURL=emuiSsfHost.38b1fe99dc97a75a91e8.js.map
3
+ //# sourceMappingURL=em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xJ,EACA,IAAKwL,EACL,MAAAtL,EACA,cAAAuJ,EACA,aAAArJ,EACA,QAAAqB,CACF,CAAC,MAED,OAAM,IAAI,MAAM,qBAAqBpB,CAAkB,EAAE,EAG3D,YAAKoC,GAAQ,MAAM,CACjB,QAAS,eACT,GAAGqD,EAAM,QAAQ,CACnB,CAAC,EACMA,CACT,EAMA,WACEvI,GACG,CACH,KAAM,CACJ,GAAA2I,EACA,IAAAlH,EACA,cAAAyK,EACA,MAAAvJ,EACA,iBAAAuL,EAAmB,CAAC,EACpB,QAAAhK,EAAU,CAAC,CACb,EAAIlE,EAEJkO,EAAiB,QAAQ,CAACrL,EAAcsL,IAAU,CAChD,KAAK,UAAU,CACb,GAAI,GAAGxF,CAAE,IAAIwF,CAAK,GAClB,IAAA1M,EACA,MAAAkB,EACA,cAAAuJ,EACA,aAAArJ,EACA,QAAAqB,CACF,CAAC,CACH,EAAG,IAAI,CACT,EAMA,0BAA6BzB,GAAqB,CAChD,KAAKuG,GAAW,0BAA0BvG,CAAO,CACnD,EAOA,sBAAwB,CACtBpC,EACAoC,IACG,CACH,KAAKuG,GAAW,sBAAsB3I,EAAUoC,CAAO,CACzD,EAMA,YAAe2L,GAAqB,CAElC,KAAKlJ,GAAQ,YAAYkJ,CAAK,EAE9B,KAAKrF,GAAQ,QAAQ,KAAKqB,EAAoB,EAC9C,KAAKlF,GAAQ,MAAM,wCAAwC,CAC7D,EAOA,YAAemG,GAA8D,CAE3E,MAAM9C,EAAQ,KAAKuC,GAAWO,CAAoB,EAC9C9C,IAEFA,EAAM,QAAQ,EAEd,KAAKQ,GAAQ,OAAOR,EAAM,EAAE,EAC5B,KAAKrD,GAAQ,MAAM,CACjB,QAAS,6BACT,GAAGqD,EAAM,QAAQ,CACnB,CAAC,EAEL,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/./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 * scripting object that owns this event\n */\n scriptingObject;\n /**\n * name of the event\n */\n name;\n /**\n * scripting object id that owns this event\n */\n objectId;\n /**\n * flag indicating this event requires feedback from all of the listeners\n */\n requiresFeedback;\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, requiresFeedback = false, so } = param;\n if (!name) throw new Error(\"Event name is required\");\n if (!so) throw new Error(\"Scripting object is required\");\n this.scriptingObject = so;\n this.objectId = so.id;\n this.name = name;\n this.id = `${this.objectId}.${this.name}`.toLowerCase();\n this.requiresFeedback = requiresFeedback;\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-enable indent */\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 } = param;\n this.objectId = objectId;\n this.name = name;\n this.id = `${this.objectId}.${this.name}`.toLowerCase();\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};\n","var MessageType = /* @__PURE__ */ ((MessageType2) => {\n MessageType2[\"GuestReady\"] = \"guest:ready\";\n MessageType2[\"GuestClose\"] = \"guest:close\";\n MessageType2[\"GuestReadyComplete\"] = \"guest:readyComplete\";\n MessageType2[\"GuestResize\"] = \"guest:resize\";\n MessageType2[\"GuestFocus\"] = \"guest:focus\";\n MessageType2[\"HandShake\"] = \"handshake\";\n MessageType2[\"HandShakeAck\"] = \"handshake:ack\";\n MessageType2[\"ObjectInvoke\"] = \"object:invoke\";\n MessageType2[\"ObjectGet\"] = \"object:get\";\n MessageType2[\"ObjectEvent\"] = \"object:event\";\n MessageType2[\"HostConfig\"] = \"host:config\";\n MessageType2[\"HostClose\"] = \"host:close\";\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 * sandbox values for iframe\n * @default [IFrameSandboxValues.AllowScripts, IFrameSandboxValues.AllowPopups, IFrameSandboxValues.AllowModals, IFrameSandboxValues.AllowForms, IFrameSandboxValues.AllowDownloads, IFrameSandboxValues.AllowSameOrigin ]\n */\n sandboxValues?: 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\n/**\n * event properties\n */\nexport type EventOptions = {\n /**\n * guest window to send the event to\n */\n window?: Window;\n /**\n * time in milliseconds to wait for the guest to respond back for the event\n */\n timeout?: number;\n /**\n * global function that handles the event on the guest\n */\n eventHandler?: 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\nexport type EventDetail<EventId, Params, Options extends EventOptions> = {\n event: {\n id: EventId;\n name: string;\n scriptingObject: IScriptingObject;\n };\n eventParams: Params;\n eventOptions?: Options;\n};\n","import type {\n IScriptingObjectProxy,\n ScriptingObjectTypes,\n} 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 isProxy = (value: any): value is IScriptingObjectProxy =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n value?.constructor?.name === 'Proxy';\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 /**\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 */\n constructor(logger, correlationId) {\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 }\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.warn(\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, 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, 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, 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, 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 * attach guest context to the scripting object methods\n * @param root0\n * @param root0.so\n * @param root0.guest\n * @returns proxies scripting object that has call context set to the guest\n */\n #attachCallContext = ({\n so,\n guest\n }) => new Proxy(so, {\n get(target, prop, receiver) {\n const value = target[prop];\n if (value instanceof Function && prop !== \"constructor\") {\n return function(...args) {\n const proxyRef = this;\n Object.defineProperty(value, \"callContext\", {\n value: guest,\n enumerable: false,\n writable: true\n });\n return value.apply(proxyRef === receiver ? target : proxyRef, args);\n };\n }\n return value;\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 if (!guest) return so;\n const guestSO = this.#attachCallContext({ so, guest });\n Object.defineProperty(guestSO, \"target\", {\n value: so,\n enumerable: false,\n configurable: false,\n writable: true\n });\n return guestSO;\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","/* 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} from '@elliemae/microfe-common';\nimport type {\n ListenerCallbackParams,\n ISSFGuest,\n EventListeners,\n IScriptingObjectProxyEvent,\n AddScriptingObjectParams,\n GetObjectParams,\n} from '@elliemae/microfe-common';\nimport { Logger, LogLevels } from '@elliemae/pui-diagnostics';\nimport {\n EventObject,\n GenericFunction,\n IFrameSandboxValues,\n GuestOptions,\n ValueOf,\n EventOptions,\n ScriptingObjects,\n EventDetail,\n AttachParam,\n OpenMode,\n WindowFeatures,\n} from './types.js';\nimport {\n ISSFHost,\n HostOption,\n LoadGuestParam,\n LoadGuestsParam,\n} from './ihost.js';\nimport { Guest } from './guest.js';\nimport { flatten, isFunction, isProxy } from './utils.js';\n\nconst SANDBOX_DEFAULT = [\n IFrameSandboxValues.AllowScripts,\n IFrameSandboxValues.AllowPopups,\n IFrameSandboxValues.AllowModals,\n IFrameSandboxValues.AllowForms,\n IFrameSandboxValues.AllowDownloads,\n IFrameSandboxValues.AllowSameOrigin,\n].join(' ');\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 * 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 * 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 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.#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) => {\n if (this.#isScriptingObject(val)) {\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 if (!Object.prototype.hasOwnProperty.call(func, 'callContext')) {\n Object.defineProperty(func, 'callContext', {\n value: { guest },\n enumerable: 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 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 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 // 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),\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 // 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);\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),\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.ObjectGet,\n callback: this.#handleObjectGet,\n });\n this.#remoting.listen({\n messageType: MessageType.ObjectInvoke,\n callback: this.#handleObjectInvoke,\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 this.unloadGuest(guest.id);\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 }) => {\n const {\n url,\n title,\n popupWindowFeatures = {},\n searchParams,\n guestId,\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 throw new Error('Failed to open guest application in popup window');\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 options?: GuestOptions;\n }) => {\n const {\n url,\n title,\n targetElement,\n searchParams,\n guestId,\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 style = '',\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 const onFrameLoad = () => {\n this.#logger.debug(`frame loaded for guest with id '${guestId}'`);\n frame.removeEventListener('load', onFrameLoad);\n };\n frame.addEventListener('load', onFrameLoad);\n frame.setAttribute(\n 'style',\n `min-width: 100%; height: 100%; border: 0px; ${style}`,\n );\n if (!disableSandbox) {\n frame.setAttribute(\n 'sandbox',\n `${SANDBOX_DEFAULT} ${sandboxValues.join(' ')}`,\n );\n }\n frame.setAttribute('title', title);\n frame.setAttribute('src', url);\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 this.#soManager.addScriptingObject(so, params);\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 guest: ISSFGuest<AppObjects, AppEvents>,\n ): AppObjects[ObjectId] => {\n if (!proxy) throw new Error('proxy is required');\n if (!guest) throw new Error('guest is required');\n // Create a new, base ScriptingObject\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 let event: Event<AppEvents>;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if ((propValue as any)?.subscribe !== 'function') {\n event = new Event<AppEvents>({\n name: propValue.name || propName,\n requiresFeedback: false,\n so,\n });\n } else {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n event = new automation.Event();\n }\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 (guest.subscribe) {\n // v2 scripting object\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 = guest.subscribe({\n eventId: propValue.id,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n callback: listener as any,\n });\n unsubscribers.push(() => {\n guest.unsubscribe({ eventId: propValue.id, token });\n });\n } else {\n // v1 scripting object\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 isProxy(retVal)\n ? this.cloneScriptingObject(retVal, guest)\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} details 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 details: EventDetail<EventId, Params, Options>,\n ) => {\n const {\n event: { id, name, scriptingObject },\n eventParams,\n eventOptions = {} as Options,\n } = details;\n const {\n eventHandler = null,\n timeout = null,\n window: targetWindow = null,\n } = eventOptions;\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 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 });\n } else if (openMode === OpenMode.Embed) {\n guest = this.#openEmbedGuest({\n guestId,\n url: srcUrl,\n title,\n targetElement,\n searchParams,\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"],"names":["root","factory","__webpack_require__","exports","definition","key","obj","prop","Event","param","name","requiresFeedback","so","ProxyEvent","objectId","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","isProxy","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","logger","correlationId","#evaluateTimeouts","ts","canceledItems","eventData","requestId","cancelTime","#stopResponseMonitor","#startResponseMonitor","#popInvocation","e","#processResponse","message","#processException","#receive","sourceWin","sourceOrigin","callbacks","callback","#processMessage","senderOrigin","window2","win","responseTimeoutMs","reject","items","response","ex","MODULE_OBJECT","SecurityContext","SecurityContext2","ScriptingObjectManager","#scriptingObjects","#guestScriptingObjects","#addGuestScriptingObject","params","guestSOs","#disposeSO","#getGuestScriptingObject","mSOs","mSO","SOs","#removeGuestScriptingObject","sosInfo","moduleSOs","soInfo","#attachCallContext","guest","receiver","args","proxyRef","id","guestSO","SANDBOX_DEFAULT","SSFHost","#guests","#soManager","#readyStateCallback","#popupGuestMonitor","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","#handleObjectGet","#handleGuestResize","#handleObjectInvoke","#subscribeToGuestResizeEvent","#isProxyEvent","#attachGuest","guestIdOrWindowOrEle","guestsToRemove","#openPopupGuest","popupWindowFeatures","width","height","top","left","windowFeatures","acc","cur","curIndex","#openEmbedGuest","targetElement","targetElementDocument","fitToContent","disableSandbox","sandboxValues","style","frame","onFrameLoad","guestFrameEle","#getGuestUrl","querystring","queryParam","proxy","unsubscribers","propName","propValue","listener","eventParams","eventOptions","token","defaultImpl","unsub","details","scriptingObject","eventHandler","targetWindow","eventObj","guestPromises","timingMetricStarted","values","guestList","srcUrl","searchParamsList","index","level"],"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://qa.assets.rd.elliemae.io/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.38b1fe99dc97a75a91e8.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://qa.assets.rd.elliemae.io/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.ed1648532a780f393d2d.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://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.38b1fe99dc97a75a91e8.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://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.ed1648532a780f393d2d.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>