@elliemae/ssf-guest 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -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>Credit Service</title><style>body{margin:0}</style><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script>window.addEventListener("DOMContentLoaded",(async()=>{window.__ICE__={diagnosticsUrl:"https://int.api.ellielabs.com/diagnostics/v2/logging"};const e=new URL(window.location),i=e?.searchParams?.get?.("src");window.__ICE__.ssfGuest=new ice.guest.SSFGuest({logger:{index:"creditServiceGuest",team:"ui platform",appName:"credit-service"}}),await window.__ICE__.ssfGuest.addScript(i,document.body)}))</script><script defer="defer" src="js/emuiSsfGuest.13609a0865c6dc4ecf4c.js"></script></head><body></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>Credit Service</title><style>body{margin:0}</style><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script>window.addEventListener("DOMContentLoaded",(async()=>{window.__ICE__={diagnosticsUrl:"https://int.api.ellielabs.com/diagnostics/v2/logging"};const e=new URL(window.location),i=e?.searchParams?.get?.("src");window.__ICE__.ssfGuest=new ice.guest.SSFGuest({logger:{index:"creditServiceGuest",team:"ui platform",appName:"credit-service"}}),await window.__ICE__.ssfGuest.addScript(i,document.body)}))</script><script defer="defer" src="js/emuiSsfGuest.fffbea0b33100b3a1ff1.js"></script></head><body></body></html>
@@ -1 +1 @@
1
- <!doctype html><html lang="en" style="height:100%"><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>Plugin</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiSsfGuest.13609a0865c6dc4ecf4c.js"></script></head><body class="px-2 h-full"><main class="h-full"><h1 class="text-md font-bold">Credit Score Service</h1><div class="h-full mt-2"><output id="msg" class="mt-2 p-2"></output></div></main></body></html>
1
+ <!doctype html><html lang="en" style="height:100%"><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>Plugin</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiSsfGuest.fffbea0b33100b3a1ff1.js"></script></head><body class="px-2 h-full"><main class="h-full"><h1 class="text-md font-bold">Credit Score Service</h1><div class="h-full mt-2"><output id="msg" class="mt-2 p-2"></output></div></main></body></html>
@@ -1,3 +1,3 @@
1
1
  (function(f,b){typeof exports=="object"&&typeof module=="object"?module.exports=b(require("emuiDiagnostics")):typeof define=="function"&&define.amd?define(["emuiDiagnostics"],b):typeof exports=="object"?exports.ice=b(require("emuiDiagnostics")):(f.ice=f.ice||{},f.ice.guest=b(f.emuiDiagnostics))})(globalThis,j=>(()=>{"use strict";var f={270:a=>{a.exports=j}},b={};function p(a){var h=b[a];if(h!==void 0)return h.exports;var d=b[a]={exports:{}};return f[a](d,d.exports,p),d.exports}p.d=(a,h)=>{for(var d in h)p.o(h,d)&&!p.o(a,d)&&Object.defineProperty(a,d,{enumerable:!0,get:h[d]})},p.o=(a,h)=>Object.prototype.hasOwnProperty.call(a,h),p.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var I={};return(()=>{p.r(I),p.d(I,{ProxyEvent:()=>$,SSFGuest:()=>N});const h={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let d;const U=new Uint8Array(16);function G(){if(!d&&(d=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!d))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return d(U)}const c=[];for(let i=0;i<256;++i)c.push((i+256).toString(16).slice(1));function O(i,e=0){return c[i[e+0]]+c[i[e+1]]+c[i[e+2]]+c[i[e+3]]+"-"+c[i[e+4]]+c[i[e+5]]+"-"+c[i[e+6]]+c[i[e+7]]+"-"+c[i[e+8]]+c[i[e+9]]+"-"+c[i[e+10]]+c[i[e+11]]+c[i[e+12]]+c[i[e+13]]+c[i[e+14]]+c[i[e+15]]}function X(i,e=0){const t=O(i,e);if(!validate(t))throw TypeError("Stringified UUID is invalid");return t}const K=null;function P(i,e,t){if(h.randomUUID&&!e&&!i)return h.randomUUID();i=i||{};const s=i.random||(i.rng||G)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e){t=t||0;for(let n=0;n<16;++n)e[t+n]=s[n];return e}return O(s)}const E=P,_="elli:remoting",S="elli:remoting:response",q="elli:remoting:exception",v=({messageType:i,messageBody:e,onewayMsg:t=!1})=>({requestId:t?null:E(),source:_,type:i,body:e}),k=i=>{const{targetWin:e,targetOrigin:t,messageType:s,messageBody:n}=i,o=v({messageType:s,messageBody:n});e.postMessage(o,t)};class D{#a;#e;#t=new Map;#s=new Map;#i=null;#n=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#a=t,this.#e=e}#d=()=>{const e=Date.now(),t=[];this.#s.forEach((s,n)=>{const{requestId:o,cancelTime:r}=s;this.#e.debug(`Checking response timeout for requestId: ${o}) @ ${r??""}`),s.cancelTime&&s.cancelTime<e&&(this.#e.debug(`Detected response timeout for requestId: ${o}...`),t.push(n),s.resolve(),this.#e.debug(`Aborted waiting for response to requestid: ${o})`))}),t.forEach(s=>{this.#e.debug(`removing invocations with requestId ${s} from cache since response time has expired`),this.#s.delete(s)}),this.#s.size===0&&(this.#e.debug("stopping response monitor"),this.#g())};#h=()=>{this.#i===null&&(this.#e.debug("Staring response timeout evaluator"),this.#i=window.setInterval(this.#d,200))};#g=()=>{this.#i!==null&&(window.clearInterval(this.#i),this.#i=null,this.#e.debug("Stopped response timeout evaluator"))};#l=e=>{const t=this.#s.get(e);return this.#e.debug(`serving requestId: ${e}`),this.#s.delete(e),t};#o=e=>{const{requestId:t}=e;this.#e.debug(`Response received for invocation requestId: ${t}`);const s=this.#l(t);return s?(s.resolve(e.body),!0):(this.#e.warn(`Received response to stale/invalid request with requestId: ${t}`),!1)};#r=e=>{this.#e.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#l(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#e.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#c=({sourceWin:e,sourceOrigin:t,message:s})=>{this.#e.debug(`Received message of type "${s.type}"`);const n=this.#t.get(s.type);return n?(n.forEach(o=>{this.#e.debug(`Invoking message handler ${o.name}`),o({sourceWin:e,sourceOrigin:t,requestId:s.requestId,type:s.type,body:s.body})}),!0):!1};#u=e=>{if(this.#e.debug(`Remoting: Received message ${JSON.stringify(e.data)}`),this.#n.size===0||!e.source)return!1;const t=this.#n.get(e.source);return!t||e?.data?.source!==_?!1:(e.data.type===S?this.#o(e.data):e.data.type===q?this.#r(e.data):this.#c({sourceWin:e.source,sourceOrigin:t,message:e.data}),!0)};addSender=e=>{const{origin:t,window:s}=e;if(!t)throw new Error("origin is required");if(!s)throw new Error("window is required");this.#n.set(s,t)};initialize=e=>{e.removeEventListener("message",this.#u),e.addEventListener("message",this.#u),this.#e.debug(`initialized remoting id: ${this.#a}`)};close=()=>{window.removeEventListener("message",this.#u),this.#e.debug(`closed remoting id: ${this.#a}`)};invoke=e=>{const{targetWin:t,targetOrigin:s,messageType:n,messageBody:o,responseTimeoutMs:r}=e;return new Promise((u,m)=>{const l=v({messageType:n,messageBody:o});this.#s.set(l.requestId,{requestId:l.requestId,resolve:u,reject:m,cancelTime:r?Date.now()+Number.parseInt(r,10):null}),t.postMessage(l,s);const{requestId:w}=l;this.#e.debug(`Posted invocation message of type ${n} requestId: ${w||""}`),r&&(this.#e.debug(`starting response monitor for requestId: ${w||""} for ${r} ms`),this.#h())})};listen=e=>{const{messageType:t,callback:s}=e,n=this.#t.get(t)||[];n.push(s),this.#t.set(t,n)};send=e=>{const{targetWin:t,targetOrigin:s,messageType:n,messageBody:o}=e,r=v({messageType:n,messageBody:o,onewayMsg:!0});t.postMessage(r,s),this.#e.debug(`Posted one-way message of type "${n}"`)};removeSender=e=>{const{window:t}=e;t&&this.#n.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:s,requestId:n,response:o}=e,r=v({messageType:S,messageBody:o});r.requestId=n,t.postMessage(r,s),this.#e.debug(`Response sent to caller for invocation requestId: ${n}`)};raiseException=e=>{const{targetWin:t,targetOrigin:s,requestId:n,ex:o}=e,r=v({messageType:q,messageBody:o});r.requestId=n,t.postMessage(r,s),this.#e.debug(`Exception sent to caller for invocation. requestId: ${n}`)}}var g=(i=>(i.GuestReady="guest:ready",i.GuestClose="guest:close",i.GuestReadyComplete="guest:readyComplete",i.GuestResize="guest:resize",i.GuestFocus="guest:focus",i.HandShake="handshake",i.HandShakeAck="handshake:ack",i.ObjectInvoke="object:invoke",i.ObjectGet="object:get",i.ObjectEvent="object:event",i.HostConfig="host:config",i))(g||{});class M{scriptingObject;name;objectId;requiresFeedback;id;constructor(e){const{name:t,requiresFeedback:s=!1,so:n}=e;if(!t)throw new Error("Event name is required");if(!n)throw new Error("Scripting object is required");this.scriptingObject=n,this.objectId=n.id,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase(),this.requiresFeedback=s}}const Q=i=>i instanceof M,W=(i,e)=>`${i.toLowerCase()}.${e.toLowerCase()}`;var y=p(270);class H{id;objectType;constructor(e,t){this.id=e,this.objectType=t}}class ${objectId;name;id;constructor(e){const{name:t,objectId:s}=e;this.objectId=s,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}const x=()=>{const{parent:i}=window;try{return i?.location?.href}catch{return null}},R=i=>{if(!i||i==="about:blank")return"*";const{origin:e}=new URL(i);return e==="null"||!e?i:e},L=()=>window.self!==window.parent,C=(i,e)=>{const t=e||document.body,s=document.defaultView?.getComputedStyle?.(t,null),n=s?s[i]:"0";return parseInt(n,10)},B=new RegExp("^https?://(.*.elliemae.io|.*.ellielabs.com|.*.ellieservices.com|.*.encompassloconnect.com|.*.ice.com|localhost:[0-9]+)","i"),z="elli:remoting",A=()=>new Promise(i=>{L()?i({origin:R(document.referrer||x()),window:window.parent}):window.addEventListener("message",e=>{if(B.test(e.origin)){const{source:t,type:s}=e.data||{};if(t===z&&s===g.HandShake){const{origin:n}=e,o=e.source;k({targetWin:o,targetOrigin:n,messageType:g.HandShakeAck,messageBody:{}}),i({origin:n,window:o})}}})});var V=(i=>(i.OBJECT="object",i.VALUE="value",i))(V||{});const F={eventFeedback:!0},T=()=>{const{document:i}=window,e=i.body,t=i.documentElement,n={height:e.offsetHeight+C("marginTop")+C("marginBottom"),width:Math.max(e.scrollWidth,t.scrollWidth)};k({targetWin:window.parent,targetOrigin:R(i.referrer||x()),messageType:g.GuestResize,messageBody:n}),window.removeEventListener("load",T)};L()&&window.addEventListener("load",T);const Y="https://api.ellielabs.com/diagnostics/v2/logging";class N{#a;#e;#t;#s=!1;#i=null;#n=!1;#d=new Map;#h=null;#g=null;#l=null;#o=null;#r=null;constructor(e){const{console:t=!1,url:s=window.__ICE__?.diagnosticsUrl||Y,index:n,team:o,appName:r}=e?.logger||{},u=t?(0,y.Console)():(0,y.http)(s);this.#e=(0,y.logger)({transport:u,index:n,team:o,appName:r}),(0,y.webvitals)(this.#e),(0,y.logUnhandledErrors)(this.#e),this.#a=E(),this.#t=new D(this.#e,this.#a),this.#e.audit({message:"Guest created",guestUrl:window.location.href,correlationId:this.#a})}#c=()=>({guestId:this.#h,guestTitle:this.#g,guestUrl:this.#l});#u=e=>{if(!e||!e.objectId)throw this.#e.error("Deserialization of scripting object failed. Object does not have an Object ID."),new Error("Cannot deserialize object JSON into proxy.");const t=new H(e.objectId,e.objectType);return e.functions&&e.functions.forEach(s=>{Object.defineProperty(t,s,{value:async(...n)=>this.#p({objectId:t.id,functionName:s,functionParams:[].slice.call(n)}),enumerable:!0})}),e.events&&e.events.forEach(s=>{Object.defineProperty(t,s,{value:new $({objectId:t.id,name:s}),enumerable:!0})}),this.#e.debug(`Created guest proxy for scripting object (id = "${t.id}")`),t};#p=async({objectId:e,functionName:t,functionParams:s})=>{this.#e.debug(`Invoking scripting object method ${e}.${t}()...`);const n=[];if(s)for(let u=0;u<s.length;u+=1){const m=s[u];m instanceof Promise&&n.push(m.then(l=>{s[u]=l}))}await Promise.all(n);const o=await this.#t.invoke({targetWin:this.#r,targetOrigin:this.#o,messageType:g.ObjectInvoke,messageBody:{objectId:e,functionName:t,functionParams:s}}),r=this.#m(o);return this.#e.audit({message:"Guest proxy invoked Scripting Object method",scriptingObject:e,scriptingMethod:t,...this.#c()}),r};#m=e=>e?.type==="object"&&"object"in e?this.#u(e.object):e?.type==="value"?e.value:e;#b=({body:e})=>{e?.logLevel&&(this.#e.setLogLevel(e.logLevel),this.#e.debug(`Log level changed by host to ${e.logLevel}`)),this.#h=e?.guestId??null,this.#g=e?.guestTitle??null,this.#l=e?.guestUrl??null,this.#e.audit({message:"Received configuration from Host",...this.#c()})};#w=()=>{window.focus()};#f=async({sourceWin:e,sourceOrigin:t,requestId:s,body:n})=>{const o=this.#u(n.object);if(o){const r=W(o.id,n.eventName);this.#e.debug(`Received event "${r}" from host`);let u;n.eventHandler?u=[{callback:window[n.eventHandler],token:E()}]:u=this.#d.get(r)||[];const m=[];if(u.forEach(l=>{if(l?.callback){this.#e.debug(`Invoking event subscriber ${l.callback.name} for event ${r}`);const w=l.callback({obj:o,eventName:n.eventName,eventParams:n.eventParams,eventOptions:n.eventOptions});w instanceof Promise?m.push(w):typeof w<"u"&&m.push(Promise.resolve(w))}}),s){const l=await Promise.all(m);this.#t.respond({targetWin:e,targetOrigin:t,requestId:s,response:l}),this.#e.audit({message:"Guest proxy processed event from host and responded",scriptingEventId:r,scriptingObject:o.id,...this.#c()})}else this.#e.audit({message:"Guest proxy processed event from host",scriptingEventId:r,scriptingObject:o.id,...this.#c()})}};addScript=async(e,t)=>{if(!this.#s&&e){await this.connect();const s=document.createElement("script");s.setAttribute("src",e),await new Promise(n=>{const o=()=>{s?.removeEventListener?.("load",o),this.#s=!0,n()};s.addEventListener("load",o),this.#i=t.appendChild(s)})}};close=()=>{this.#n&&(this.#t.send({targetWin:this.#r,targetOrigin:this.#o,messageType:g.GuestClose,messageBody:{}}),this.#t.removeSender({origin:this.#o,window:this.#r}),this.#t.close(),this.#n=!1,this.#e.audit({message:"Guest disconnected from host",...this.#c()}),this.#h=null,this.#l=null,this.#g=null)};connect=async e=>{if(!this.#n){let t=window,s={...F};if(e){t=e.window||t;const o={...e};delete o.window,s=Object.assign(s,o)}const n=await A();this.#o=n.origin,this.#r=n.window,this.#t.initialize(t),this.#t.addSender({origin:this.#o,window:this.#r}),this.#t.listen({messageType:g.ObjectEvent,callback:this.#f.bind(this)}),this.#t.listen({messageType:g.HostConfig,callback:this.#b.bind(this)}),this.#t.listen({messageType:g.GuestFocus,callback:this.#w.bind(this)}),this.#t.send({targetWin:this.#r,targetOrigin:this.#o,messageType:g.GuestReady,messageBody:s}),this.#n=!0,this.#e.audit({message:"Guest connected to host",guestUrl:window.location.href})}};getObject=async e=>{this.#e.debug(`Retrieving scripting object "${e}" from host...`);const t=await this.#t.invoke({targetWin:this.#r,targetOrigin:this.#o,messageType:g.ObjectGet,messageBody:{objectId:e}}),s=this.#u(t.object);return this.#e.audit({message:"Received scripting object from host",scriptingObject:e,...this.#c()}),s};removeScript=()=>{if(this.#s&&this.#i){const{parentNode:e}=this.#i;e?.removeChild?.(this.#i)}};setLogLevel=e=>{this.#e.setLogLevel(e),this.#e.debug(`Log level changed by guest to ${e}`)};subscribe=e=>{const{eventId:t,callback:s}=e;this.#e.debug(`Registering subscription for event ${t}`);const n=this.#d.get(t)||[],o=E();return n.push({callback:s,token:o}),this.#d.set(t,n),o};unsubscribe=e=>{const{eventId:t,token:s}=e;let n=this.#d.get(t);n&&(n=n.filter(o=>o.token!==s),this.#d.set(t,n))}}})(),I})());
2
2
 
3
- //# sourceMappingURL=emuiSsfGuest.13609a0865c6dc4ecf4c.js.map
3
+ //# sourceMappingURL=emuiSsfGuest.fffbea0b33100b3a1ff1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js/emuiSsfGuest.fffbea0b33100b3a1ff1.js","mappings":"CAAC,SAA0CA,EAAMC,EAAS,CACtD,OAAO,SAAY,UAAY,OAAO,QAAW,SACnD,OAAO,QAAUA,EAAQ,QAAQ,iBAAiB,CAAC,EAC5C,OAAO,QAAW,YAAc,OAAO,IAC9C,OAAO,CAAC,iBAAiB,EAAGA,CAAO,EAC5B,OAAO,SAAY,SAC1B,QAAQ,IAASA,EAAQ,QAAQ,iBAAiB,CAAC,GAEnDD,EAAK,IAASA,EAAK,KAAU,CAAC,EAAGA,EAAK,IAAO,MAAWC,EAAQD,EAAK,eAAkB,EACzF,GAAG,WAAaE,I,iCCThBC,EAAO,QAAUD,C,GCCbE,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,EAAU,CAEtC,IAAIC,EAAeH,EAAyBE,CAAQ,EACpD,GAAIC,IAAiB,OACpB,OAAOA,EAAa,QAGrB,IAAIJ,EAASC,EAAyBE,CAAQ,EAAI,CAGjD,QAAS,CAAC,CACX,EAGA,OAAAE,EAAoBF,CAAQ,EAAEH,EAAQA,EAAO,QAASE,CAAmB,EAGlEF,EAAO,OACf,CCrBAE,EAAoB,EAAI,CAACI,EAASC,IAAe,CAChD,QAAQC,KAAOD,EACXL,EAAoB,EAAEK,EAAYC,CAAG,GAAK,CAACN,EAAoB,EAAEI,EAASE,CAAG,GAC/E,OAAO,eAAeF,EAASE,EAAK,CAAE,WAAY,GAAM,IAAKD,EAAWC,CAAG,CAAE,CAAC,CAGjF,ECPAN,EAAoB,EAAI,CAACO,E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MA,YACE/H,GACG,CACH,KAAM,CAAE,QAAAiH,EAAS,MAAAc,CAAM,EAAI/H,EAC3B,IAAIkH,EAAY,KAAK7B,GAAgB,IAAI4B,CAAO,EAC5CC,IACFA,EAAYA,EAAU,OACnBC,GAAiBA,EAAa,QAAUY,CAC3C,EACA,KAAK1C,GAAgB,IAAI4B,EAASC,CAAS,EAE/C,CACF,C","sources":["webpack://ice.guest/webpack/universalModuleDefinition","webpack://ice.guest/external umd \"emuiDiagnostics\"","webpack://ice.guest/webpack/bootstrap","webpack://ice.guest/webpack/runtime/define property getters","webpack://ice.guest/webpack/runtime/hasOwnProperty shorthand","webpack://ice.guest/webpack/runtime/make namespace object","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js","webpack://ice.guest/../common/dist/esm/remoting.js","webpack://ice.guest/../common/dist/esm/messageType.js","webpack://ice.guest/../common/dist/esm/event.js","webpack://ice.guest/./lib/proxy.ts","webpack://ice.guest/./lib/proxyEvent.ts","webpack://ice.guest/./lib/utils.ts","webpack://ice.guest/./lib/guest.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"emuiDiagnostics\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"emuiDiagnostics\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ice\"] = factory(require(\"emuiDiagnostics\"));\n\telse\n\t\troot[\"ice\"] = root[\"ice\"] || {}, root[\"ice\"][\"guest\"] = factory(root[\"emuiDiagnostics\"]);\n})(globalThis, (__WEBPACK_EXTERNAL_MODULE__270__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__270__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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};","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)\n throw new Error(\"logger is required\");\n if (!correlationId)\n 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)\n 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)\n return false;\n if (!message.source)\n return false;\n const senderOrigin = this.#allowedSenders.get(message.source);\n if (!senderOrigin)\n return false;\n if (message?.data?.source !== MESSAGE_SOURCE)\n 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)\n throw new Error(\"origin is required\");\n if (!window2)\n 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)\n 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","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 return MessageType2;\n})(MessageType || {});\nexport {\n MessageType\n};\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)\n throw new Error(\"Event name is required\");\n if (!so)\n 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}\nconst isEvent = (value) => value instanceof Event;\nconst getEventId = (objectId, eventName) => `${objectId.toLowerCase()}.${eventName.toLowerCase()}`;\nexport {\n Event,\n getEventId,\n isEvent\n};\n","// Defines the class for a Control\nimport type { IScriptingObjectProxy } from '@elliemae/pui-scripting-object';\n\n/**\n * Scripting Object Proxy implementation\n */\nexport class Proxy implements IScriptingObjectProxy {\n /**\n * unique id of scripting object\n */\n public readonly id: string;\n\n /**\n * type of scripting object\n */\n public readonly objectType: string;\n\n /**\n * Creates a new instance of the Scripting Object Proxy\n * @param objectId unique id of scripting object\n * @param objectType type of scripting object\n */\n constructor(objectId: string, objectType: string) {\n this.id = objectId;\n this.objectType = objectType;\n }\n}\n","import type { Events } from '@elliemae/pui-scripting-object';\nimport type {\n IScriptingObjectProxyEvent,\n EventListeners,\n} from '@elliemae/microfe-common';\n\n/**\n * ProxyEvent constructor parameter\n */\nexport type ProxyEventParam = {\n /**\n * name of the event\n */\n name: string;\n /**\n * unique id of scripting object\n */\n objectId: string;\n};\n\n/**\n * Scripting Object Proxy Event implementation\n * @typeParam AppEvents - type of the events that the scripting object supports\n */\n/* eslint-disable indent */\nexport class ProxyEvent<AppEvents extends EventListeners = Events>\n implements IScriptingObjectProxyEvent<AppEvents>\n{\n /* eslint-enable indent */\n /**\n * unique id of scripting object\n */\n public readonly objectId: string;\n\n /**\n * name of the event\n */\n public readonly name: string;\n\n /**\n * unique id of the event\n */\n public readonly id: Extract<keyof AppEvents, string>;\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: ProxyEventParam) {\n const { name, objectId } = param;\n this.objectId = objectId;\n this.name = name;\n this.id = `${this.objectId}.${this.name}`.toLowerCase() as Extract<\n keyof AppEvents,\n string\n >;\n }\n}\n","import { MessageType, sendMessage } from '@elliemae/microfe-common';\n\nexport const getParentWindowLocation = () => {\n const { parent } = window;\n try {\n return parent?.location?.href;\n } catch (e) {\n return null;\n }\n};\n\nexport const getOrigin = (url: string | null) => {\n if (!url || url === 'about:blank') return '*';\n const { origin } = new URL(url);\n return origin === 'null' || !origin ? url : origin;\n};\n\nexport const isEmbedded = () => window.self !== window.parent;\n\nexport const getComputedStyle = (\n prop: keyof CSSStyleDeclaration,\n el?: HTMLBodyElement,\n) => {\n const bodyElement = el || document.body;\n const retVal = document.defaultView?.getComputedStyle?.(bodyElement, null);\n const propValue = retVal ? (retVal[prop] as string) : '0';\n return parseInt(propValue, 10);\n};\n\n// eslint-disable-next-line prefer-regex-literals\nconst originsRegex = new RegExp(\n `^https?://(.*.elliemae.io|.*.ellielabs.com|.*.ellieservices.com|.*.encompassloconnect.com|.*.ice.com|localhost:[0-9]+)`,\n 'i',\n);\nconst MESSAGE_SOURCE = 'elli:remoting';\n\nexport const getHostDetails = () =>\n new Promise<{ origin: string; window: Window }>((resolve) => {\n if (!isEmbedded()) {\n window.addEventListener(\n 'message',\n (event: MessageEvent<{ source: string; type: string }>) => {\n if (originsRegex.test(event.origin)) {\n const { source, type } = event.data || {};\n if (source === MESSAGE_SOURCE && type === MessageType.HandShake) {\n const { origin } = event;\n const window = event.source as Window;\n // send handshake acknoledgement\n sendMessage({\n targetWin: window,\n targetOrigin: origin,\n messageType: MessageType.HandShakeAck,\n messageBody: {},\n });\n resolve({ origin, window });\n }\n }\n },\n );\n } else {\n resolve({\n origin: getOrigin(document.referrer || getParentWindowLocation()),\n window: window.parent,\n });\n }\n });\n","/* eslint-disable max-lines */\nimport { v4 as uuidv4 } from 'uuid';\nimport type {\n IScriptingObjectProxy,\n RemotingScriptingObject,\n Listener,\n Events,\n} from '@elliemae/pui-scripting-object';\nimport {\n Remoting,\n sendMessage,\n MessageType,\n getEventId,\n} from '@elliemae/microfe-common';\nimport type {\n ListenerCallbackParams,\n RemotingEventMessage,\n ConnectParam,\n GuestSubscribeParam,\n GuestUnsubscribeParam,\n EventListeners,\n ISSFGuest,\n} from '@elliemae/microfe-common';\nimport {\n logger as puiLogger,\n Console,\n http,\n LogLevels,\n Logger,\n webvitals,\n logUnhandledErrors,\n} from '@elliemae/pui-diagnostics';\nimport { Proxy } from './proxy.js';\nimport { ProxyEvent } from './proxyEvent.js';\nimport {\n getOrigin,\n isEmbedded,\n getComputedStyle,\n getHostDetails,\n getParentWindowLocation,\n} from './utils.js';\n\nenum ResponseType {\n OBJECT = 'object',\n VALUE = 'value',\n}\n\ntype ObjectResponse = {\n type: ResponseType.OBJECT;\n object: RemotingScriptingObject;\n};\n\ntype ValueResponse = {\n type: ResponseType.VALUE;\n value: any;\n};\n\ntype Response = ObjectResponse | ValueResponse;\ntype Config = {\n logLevel: LogLevels;\n guestId: string;\n guestTitle: string;\n guestUrl: string;\n};\n\nexport type ListenerInfo = {\n callback: Listener<any, any, any, any>;\n token: string;\n};\n\n// Provides a list of capabilities of this version of teh scripting framework\nconst capabilities = {\n eventFeedback: true,\n};\n\nconst onLoad = () => {\n const { document } = window;\n const iframeBody = document.body;\n const iframeHTML = document.documentElement;\n const bodyOffsetHeight =\n iframeBody.offsetHeight +\n getComputedStyle('marginTop') +\n getComputedStyle('marginBottom');\n const size = {\n height: bodyOffsetHeight,\n width: Math.max(iframeBody.scrollWidth, iframeHTML.scrollWidth),\n };\n sendMessage({\n targetWin: window.parent,\n targetOrigin: getOrigin(document.referrer || getParentWindowLocation()),\n messageType: MessageType.GuestResize,\n messageBody: size,\n });\n window.removeEventListener('load', onLoad);\n};\n\n// if hosted in iframe then wait for load event to send resize message\nif (isEmbedded()) {\n window.addEventListener('load', onLoad);\n}\n\n/**\n * options for the guest\n */\nexport type GuestOption = {\n /**\n * options for the logger\n */\n logger: {\n /**\n * log to console\n */\n console?: boolean;\n /**\n * url to send logs to\n */\n url?: string;\n /**\n * index to use for logging\n */\n index: string;\n /**\n * app name to use for logging\n */\n appName: string;\n /**\n * team name that owns the app\n */\n team: string;\n };\n};\n\nconst DIAGNOSTICS_URL = 'https://api.ellielabs.com/diagnostics/v2/logging';\n\n/**\n * Creates a new guest that can be used to communicate with the parent host application\n * @typeParm AppEvents - The events that the guest application listens\n */\n/* eslint-disable indent */\nexport class SSFGuest<AppEvents extends EventListeners = Events>\n implements ISSFGuest<AppEvents>\n{\n /* eslint-enable indent */\n #correlationId: string;\n\n #logger: Logger;\n\n #remoting: Remoting;\n\n #created = false;\n\n #scriptElement: HTMLScriptElement | null = null;\n\n #isConnected = false;\n\n #eventListeners = new Map<string, ListenerInfo[]>();\n\n #id: string | null = null;\n\n #title: string | null = null;\n\n #url: string | null = null;\n\n #hostOrigin: string | null = null;\n\n #hostWindow: Window | null = null;\n\n /**\n * Create new guest\n * @param {GuestOption} options - options for the guest\n */\n constructor(options: GuestOption) {\n const {\n console: logToConsole = false,\n // eslint-disable-next-line no-underscore-dangle\n url = window.__ICE__?.diagnosticsUrl || DIAGNOSTICS_URL,\n index,\n team,\n appName,\n } = options?.logger || {};\n const transport = logToConsole ? Console() : http(url);\n this.#logger = puiLogger({\n transport,\n index,\n team,\n appName,\n });\n webvitals(this.#logger);\n logUnhandledErrors(this.#logger);\n this.#correlationId = uuidv4();\n this.#remoting = new Remoting(this.#logger, this.#correlationId);\n this.#logger.audit({\n message: 'Guest created',\n guestUrl: window.location.href,\n correlationId: this.#correlationId,\n });\n }\n\n #getGuestInfo = () => ({\n guestId: this.#id,\n guestTitle: this.#title,\n guestUrl: this.#url,\n });\n\n /**\n * Marshals scripting object JSON into a proxy object\n * @param soJSON scripting object JSON\n * @returns marshaled proxy object\n */\n #fromJSON = (soJSON: RemotingScriptingObject): IScriptingObjectProxy => {\n // Ensure we have JSON\n if (!soJSON || !soJSON.objectId) {\n this.#logger.error(\n 'Deserialization of scripting object failed. Object does not have an Object ID.',\n );\n throw new Error('Cannot deserialize object JSON into proxy.');\n }\n\n // Create a new object\n const ctrl = new Proxy(soJSON.objectId, soJSON.objectType);\n\n // Dynamically build the function set on the control\n if (soJSON.functions) {\n soJSON.functions.forEach((functionName) => {\n Object.defineProperty(ctrl, functionName, {\n value: async <T>(...args: any[]) =>\n this.#invoke<T>({\n objectId: ctrl.id,\n functionName,\n functionParams: [].slice.call(args),\n }),\n enumerable: true,\n });\n });\n }\n\n // Dynamically create the event proxies\n if (soJSON.events) {\n soJSON.events.forEach((eventName) => {\n Object.defineProperty(ctrl, eventName, {\n value: new ProxyEvent({\n objectId: ctrl.id,\n name: eventName,\n }),\n enumerable: true,\n });\n });\n }\n\n this.#logger.debug(\n `Created guest proxy for scripting object (id = \"${ctrl.id}\")`,\n );\n return ctrl;\n };\n\n #invoke = async <T>({\n objectId,\n functionName,\n functionParams,\n }: {\n objectId: string;\n functionName: string;\n functionParams: Array<any>;\n }) => {\n this.#logger.debug(\n `Invoking scripting object method ${objectId}.${functionName}()...`,\n );\n\n // Find any function params that are promises\n const promises = [];\n if (functionParams) {\n for (let i = 0; i < functionParams.length; i += 1) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const p = functionParams[i];\n if (p instanceof Promise) {\n promises.push(\n p.then((val) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n functionParams[i] = val;\n }),\n );\n }\n }\n }\n\n // Now wait to resolve all of the promises and then call our invoke\n await Promise.all(promises);\n const response = await this.#remoting.invoke<Response>({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.ObjectInvoke,\n messageBody: {\n objectId,\n functionName,\n functionParams,\n },\n });\n const retVal = this.#handleResponse<T>(response);\n this.#logger.audit({\n message: 'Guest proxy invoked Scripting Object method',\n scriptingObject: objectId,\n scriptingMethod: functionName,\n ...this.#getGuestInfo(),\n });\n return retVal;\n };\n\n #handleResponse = <T>(response: ObjectResponse | ValueResponse) => {\n if (response?.type === ResponseType.OBJECT && 'object' in response) {\n return this.#fromJSON(response.object);\n }\n if (response?.type === ResponseType.VALUE) {\n return response.value as T;\n }\n return response;\n };\n\n #handleConfigChangeEvent = ({ body }: ListenerCallbackParams<Config>) => {\n // Handle log level changes\n if (body?.logLevel) {\n this.#logger.setLogLevel(body.logLevel);\n this.#logger.debug(`Log level changed by host to ${body.logLevel}`);\n }\n this.#id = body?.guestId ?? null;\n this.#title = body?.guestTitle ?? null;\n this.#url = body?.guestUrl ?? null;\n this.#logger.audit({\n message: 'Received configuration from Host',\n ...this.#getGuestInfo(),\n });\n };\n\n #handleFocusEvent = () => {\n window.focus();\n };\n\n #handleObjectEvent = async ({\n sourceWin,\n sourceOrigin,\n requestId,\n body,\n }: ListenerCallbackParams<RemotingEventMessage>) => {\n // Deserialize the object\n const object = this.#fromJSON(body.object);\n if (object) {\n // Get the listeners for the event\n const eventId = getEventId(object.id, body.eventName);\n this.#logger.debug(`Received event \"${eventId}\" from host`);\n\n // If an event handler is specified in the request body, then we will target\n // the event to that function only.\n let listeners: Array<ListenerInfo>;\n if (body.eventHandler) {\n listeners = [\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n callback: (window as { [key: string]: any })[body.eventHandler],\n token: uuidv4(),\n },\n ];\n } else {\n listeners = this.#eventListeners.get(eventId) || [];\n }\n\n // Notify each listener, recording a promise for each response\n const promises: Array<Promise<any>> = [];\n\n listeners.forEach((callbackInfo) => {\n if (callbackInfo?.callback) {\n this.#logger.debug(\n `Invoking event subscriber ${callbackInfo.callback.name} for event ${eventId}`,\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const retVal = callbackInfo.callback({\n obj: object,\n eventName: body.eventName,\n eventParams: body.eventParams,\n eventOptions: body.eventOptions,\n });\n\n if (retVal instanceof Promise) {\n promises.push(retVal);\n } else if (typeof retVal !== 'undefined') {\n promises.push(Promise.resolve(retVal));\n }\n }\n });\n\n // Resolve all promises and return a response to the calling window\n if (requestId) {\n const values = await Promise.all(promises);\n this.#remoting.respond({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n response: values,\n });\n this.#logger.audit({\n message: 'Guest proxy processed event from host and responded',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n } else {\n this.#logger.audit({\n message: 'Guest proxy processed event from host',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n }\n }\n };\n\n /**\n * Initialize guest using script\n * @param scriptUri uri of the script\n * @param containerElement dom element to inject the script at\n */\n addScript = async (scriptUri: string, containerElement: HTMLElement) => {\n if (!this.#created && scriptUri) {\n await this.connect();\n // Load the script and await its load event before signaling that the window is\n // ready to receive events\n const scriptEle = document.createElement('script');\n scriptEle.setAttribute('src', scriptUri);\n await new Promise<void>((resolve) => {\n const onScriptLoad = () => {\n scriptEle?.removeEventListener?.('load', onScriptLoad);\n // Set the created flag\n this.#created = true;\n resolve();\n };\n scriptEle.addEventListener('load', onScriptLoad);\n this.#scriptElement = containerElement.appendChild(scriptEle);\n });\n }\n };\n\n /**\n * Close the connection to the host\n */\n close = () => {\n if (!this.#isConnected) return;\n this.#remoting.send({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.GuestClose,\n messageBody: {},\n });\n this.#remoting.removeSender({\n origin: this.#hostOrigin!,\n window: this.#hostWindow!,\n });\n this.#remoting.close();\n this.#isConnected = false;\n this.#logger.audit({\n message: 'Guest disconnected from host',\n ...this.#getGuestInfo(),\n });\n this.#id = null;\n this.#url = null;\n this.#title = null;\n };\n\n /**\n * Connect to the host\n * @param {ConnectParam} param - reference to the guest window or options\n */\n connect = async (param?: ConnectParam) => {\n if (!this.#isConnected) {\n let guestWindow: Window = window;\n let guestOptions = { ...capabilities };\n\n if (param) {\n // Pull the guestWindow from the options, if present\n guestWindow = param.window || guestWindow;\n // Clone the guest options and delete the window reference\n const clonedOptions = { ...param };\n delete (clonedOptions as Partial<ConnectParam>).window;\n // Merge into the guest options object\n guestOptions = Object.assign(guestOptions, clonedOptions);\n }\n\n const hostDetails = await getHostDetails();\n this.#hostOrigin = hostDetails.origin;\n this.#hostWindow = hostDetails.window;\n // Initialize messenger\n this.#remoting.initialize(guestWindow);\n this.#remoting.addSender({\n origin: this.#hostOrigin,\n window: this.#hostWindow,\n });\n // Listen for the events the guest knows how to process\n this.#remoting.listen<RemotingEventMessage>({\n messageType: MessageType.ObjectEvent,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n callback: this.#handleObjectEvent.bind(this),\n });\n this.#remoting.listen<Config>({\n messageType: MessageType.HostConfig,\n callback: this.#handleConfigChangeEvent.bind(this),\n });\n this.#remoting.listen<void>({\n messageType: MessageType.GuestFocus,\n callback: this.#handleFocusEvent.bind(this),\n });\n // Let the host know the guest is ready for events, and send along\n // the guests's capabilities to allow for compatibility with future\n // host versions\n this.#remoting.send({\n targetWin: this.#hostWindow,\n targetOrigin: this.#hostOrigin,\n messageType: MessageType.GuestReady,\n messageBody: guestOptions,\n });\n this.#isConnected = true;\n this.#logger.audit({\n message: 'Guest connected to host',\n guestUrl: window.location.href,\n });\n }\n };\n\n /**\n * Get scripting object proxy by id\n * @param objectId unique id of the scripting object\n * @returns scripting object proxy\n */\n getObject = async (objectId: string) => {\n this.#logger.debug(\n `Retrieving scripting object \"${objectId}\" from host...`,\n );\n const response = await this.#remoting.invoke<ObjectResponse>({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.ObjectGet,\n messageBody: {\n objectId,\n },\n });\n const obj = this.#fromJSON(response.object);\n this.#logger.audit({\n message: 'Received scripting object from host',\n scriptingObject: objectId,\n ...this.#getGuestInfo(),\n });\n return obj;\n };\n\n /**\n * remove the guest from the host\n */\n removeScript = () => {\n if (!this.#created) return;\n if (this.#scriptElement) {\n const { parentNode } = this.#scriptElement;\n parentNode?.removeChild?.(this.#scriptElement);\n }\n };\n\n /**\n * Set the log level\n * @param {LogLevels} logLevel - log level\n * @param level\n */\n setLogLevel = (level: LogLevels) => {\n this.#logger.setLogLevel(level);\n this.#logger.debug(`Log level changed by guest to ${level}`);\n };\n\n /**\n * subscribe to an scripting object event\n * @param {GuestSubscribeParam<EventId, AppEvents[EventId]>} param - parameters for subscribing to an event\n * @returns subscription token\n */\n subscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: GuestSubscribeParam<EventId, AppEvents[EventId]>,\n ) => {\n const { eventId, callback } = param;\n this.#logger.debug(`Registering subscription for event ${eventId}`);\n const listeners = this.#eventListeners.get(eventId) || [];\n const token = uuidv4();\n listeners.push({ callback, token });\n this.#eventListeners.set(eventId, listeners);\n return token;\n };\n\n /**\n * unsubscribe from an scripting object event\n * @param {GuestUnsubscribeParam<EventId>} param - parameters for unsubscribing from an event\n */\n unsubscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: GuestUnsubscribeParam<EventId>,\n ) => {\n const { eventId, token } = param;\n let listeners = this.#eventListeners.get(eventId);\n if (listeners) {\n listeners = listeners.filter(\n (callbackInfo) => callbackInfo.token !== token,\n );\n this.#eventListeners.set(eventId, listeners);\n }\n };\n}\n"],"names":["root","factory","__WEBPACK_EXTERNAL_MODULE__270__","module","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","exports","definition","key","obj","prop","getRandomValues","rnds8","rng","byteToHex","unsafeStringify","arr","offset","stringify","uuid","v4","options","buf","rnds","i","MESSAGE_SOURCE","RESPONSE_MESSAGE_TYPE","EXCEPTION_MESSAGE_TYPE","createMessage","messageType","messageBody","onewayMsg","sendMessage","param","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","origin","window2","win","responseTimeoutMs","resolve","reject","items","response","ex","MessageType","MessageType2","Event","name","requiresFeedback","so","isEvent","value","getEventId","objectId","eventName","Proxy","objectType","ProxyEvent","getParentWindowLocation","parent","getOrigin","url","isEmbedded","getComputedStyle","el","bodyElement","retVal","propValue","originsRegex","getHostDetails","event","source","type","window","ResponseType","capabilities","onLoad","document","iframeBody","iframeHTML","size","DIAGNOSTICS_URL","SSFGuest","#remoting","#created","#scriptElement","#isConnected","#eventListeners","#id","#title","#url","#hostOrigin","#hostWindow","logToConsole","index","team","appName","transport","#getGuestInfo","#fromJSON","soJSON","ctrl","functionName","args","#invoke","functionParams","promises","p","val","#handleResponse","#handleConfigChangeEvent","body","#handleFocusEvent","#handleObjectEvent","object","eventId","listeners","callbackInfo","values","scriptUri","containerElement","scriptEle","onScriptLoad","guestWindow","guestOptions","clonedOptions","hostDetails","parentNode","level","token"],"sourceRoot":""}
@@ -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>Loan Validation</title><style>body{margin:0}</style><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.13609a0865c6dc4ecf4c.js"></script></head><body class="px-2"><script src="./loanValidation.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>Loan Validation</title><style>body{margin:0}</style><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.fffbea0b33100b3a1ff1.js"></script></head><body class="px-2"><script src="./loanValidation.js" type="module"></script></body></html>
Binary file
@@ -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>Pricing Service</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/emuiSsfGuest.13609a0865c6dc4ecf4c.js"></script></head><body class="px-2"><main><h3 class="text-lg font-medium leading-6 text-gray-900">Mortgage Pricing</h3><div class="mt-5 bg-orange-100 shadow sm:rounded-lg"><div class="px-4 py-5 sm:px-6"><h3 class="text-lg font-medium leading-6 text-gray-900">Average Rates</h3><p class="mt-1 max-w-2xl text-sm text-gray-500">for $<span id="loanAmount"></span>; Term: <span id="term"></span> years; Down Payment: $<span id="downPayment"></span></p></div><div class="border-t border-gray-200"><dl><div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"><dt class="text-sm font-medium text-gray-500">30-yr fixed</dt><dd id="30yearRate" class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">7.01%</dd></div><div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"><dt class="text-sm font-medium text-gray-500">15-yr fixed</dt><dd id="15yearRate" class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">5.61%</dd></div><div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"><dt class="text-sm font-medium text-gray-500">10/6 ARM</dt><dd id="106ARMRate" class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">6.42%</dd></div></dl></div></div></main><script src="./pricingService.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>Pricing Service</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/emuiSsfGuest.fffbea0b33100b3a1ff1.js"></script></head><body class="px-2"><main><h3 class="text-lg font-medium leading-6 text-gray-900">Mortgage Pricing</h3><div class="mt-5 bg-orange-100 shadow sm:rounded-lg"><div class="px-4 py-5 sm:px-6"><h3 class="text-lg font-medium leading-6 text-gray-900">Average Rates</h3><p class="mt-1 max-w-2xl text-sm text-gray-500">for $<span id="loanAmount"></span>; Term: <span id="term"></span> years; Down Payment: $<span id="downPayment"></span></p></div><div class="border-t border-gray-200"><dl><div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"><dt class="text-sm font-medium text-gray-500">30-yr fixed</dt><dd id="30yearRate" class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">7.01%</dd></div><div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"><dt class="text-sm font-medium text-gray-500">15-yr fixed</dt><dd id="15yearRate" class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">5.61%</dd></div><div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"><dt class="text-sm font-medium text-gray-500">10/6 ARM</dt><dd id="106ARMRate" class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">6.42%</dd></div></dl></div></div></main><script src="./pricingService.js" type="module"></script></body></html>
Binary file
@@ -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>Title Service</title><style>body{margin:0}</style><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/emuiSsfGuest.13609a0865c6dc4ecf4c.js"></script></head><body class="px-2"><h3 class="text-lg font-medium leading-6 text-gray-900">Title</h3><div class="mt-5 flex flex-col"><button id="order" 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">Order</button></div><script src="./titleService.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>Title Service</title><style>body{margin:0}</style><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/emuiSsfGuest.fffbea0b33100b3a1ff1.js"></script></head><body class="px-2"><h3 class="text-lg font-medium leading-6 text-gray-900">Title</h3><div class="mt-5 flex flex-col"><button id="order" 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">Order</button></div><script src="./titleService.js" type="module"></script></body></html>
Binary file
Binary file
@@ -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 V2</title><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.13609a0865c6dc4ecf4c.js"></script></head><body><h2>Guest V2</h2><div id="result"><p id="loan-details"></p><p id="loan-pre-save-event-details"></p></div><script type="module">window.__ICE__={diagnosticsUrl:"https://int.api.ellielabs.com/diagnostics/v2/logging"},window.addEventListener("load",(async()=>{const e=new ice.guest.SSFGuest({logger:{index:"v2-guest",team:"ui platform",appName:"v2 guest app"}});await e.connect();const t=await e.getObject("Loan"),a=await t.getLoanDetails();document.getElementById("loan-details").innerText=`Loan Data: ${JSON.stringify(a)}`,e.subscribe({eventId:t.onPreSave.id,callback:({eventParams:e})=>(document.getElementById("loan-pre-save-event-details").innerText=`Presave event data: ${JSON.stringify(e)}`,!1)})}))</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 V2</title><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.fffbea0b33100b3a1ff1.js"></script></head><body><h2>Guest V2</h2><div id="result"><p id="loan-details"></p><p id="loan-pre-save-event-details"></p></div><script type="module">window.__ICE__={diagnosticsUrl:"https://int.api.ellielabs.com/diagnostics/v2/logging"},window.addEventListener("load",(async()=>{const e=new ice.guest.SSFGuest({logger:{index:"v2-guest",team:"ui platform",appName:"v2 guest app"}});await e.connect();const t=await e.getObject("Loan"),a=await t.getLoanDetails();document.getElementById("loan-details").innerText=`Loan Data: ${JSON.stringify(a)}`,e.subscribe({eventId:t.onPreSave.id,callback:({eventParams:e})=>(document.getElementById("loan-pre-save-event-details").innerText=`Presave event data: ${JSON.stringify(e)}`,!1)})}))</script></body></html>
Binary file
Binary file
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","mappings":"CAAC,SAA0CA,EAAMC,EAAS,CACtD,OAAO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AM,KAAKyC,GAAU,OAAuB,CAC3D,UAAW,KAAKS,GAChB,aAAc,KAAKD,GACnB,YAAa/C,EAAY,UACzB,YAAa,CACX,SAAAS,CACF,CACF,CAAC,EACK3E,EAAM,KAAKyH,GAAUzD,EAAS,MAAM,EAC1C,YAAKlC,GAAQ,MAAM,CACjB,QAAS,sCACT,gBAAiB6C,EACjB,GAAG,KAAK6C,GAAc,CACxB,CAAC,EACMxH,CACT,EAKA,aAAe,IAAM,CACnB,GAAK,KAAK0G,IACN,KAAKC,GAAgB,CACvB,KAAM,CAAE,WAAA0C,CAAW,EAAI,KAAK1C,GAC5B0C,GAAY,cAAc,KAAK1C,EAAc,CAC/C,CACF,EAOA,YAAe2C,GAAqB,CAClC,KAAKxH,GAAQ,YAAYwH,CAAK,EAC9B,KAAKxH,GAAQ,MAAM,iCAAiCwH,CAAK,EAAE,CAC7D,EAOA,UACE9H,GACG,CACH,KAAM,CAAE,QAAAiH,EAAS,SAAAnF,CAAS,EAAI9B,EAC9B,KAAKM,GAAQ,MAAM,sCAAsC2G,CAAO,EAAE,EAClE,MAAMC,EAAY,KAAK7B,GAAgB,IAAI4B,CAAO,GAAK,CAAC,EAClDc,EAAQ,EAAO,EACrB,OAAAb,EAAU,KAAK,CAAE,SAAApF,EAAU,MAAAiG,CAAM,CAAC,EAClC,KAAK1C,GAAgB,IAAI4B,EAASC,CAAS,EACpCa,CACT,EAMA,YACE/H,GACG,CACH,KAAM,CAAE,QAAAiH,EAAS,MAAAc,CAAM,EAAI/H,EAC3B,IAAIkH,EAAY,KAAK7B,GAAgB,IAAI4B,CAAO,EAC5CC,IACFA,EAAYA,EAAU,OACnBC,GAAiBA,EAAa,QAAUY,CAC3C,EACA,KAAK1C,GAAgB,IAAI4B,EAASC,CAAS,EAE/C,CACF,C","sources":["webpack://ice.guest/webpack/universalModuleDefinition","webpack://ice.guest/external umd \"emuiDiagnostics\"","webpack://ice.guest/webpack/bootstrap","webpack://ice.guest/webpack/runtime/define property getters","webpack://ice.guest/webpack/runtime/hasOwnProperty shorthand","webpack://ice.guest/webpack/runtime/make namespace object","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js","webpack://ice.guest/../common/dist/esm/remoting.js","webpack://ice.guest/../common/dist/esm/messageType.js","webpack://ice.guest/../common/dist/esm/event.js","webpack://ice.guest/./lib/proxy.ts","webpack://ice.guest/./lib/proxyEvent.ts","webpack://ice.guest/./lib/utils.ts","webpack://ice.guest/./lib/guest.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"emuiDiagnostics\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"emuiDiagnostics\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ice\"] = factory(require(\"emuiDiagnostics\"));\n\telse\n\t\troot[\"ice\"] = root[\"ice\"] || {}, root[\"ice\"][\"guest\"] = factory(root[\"emuiDiagnostics\"]);\n})(globalThis, (__WEBPACK_EXTERNAL_MODULE__270__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__270__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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};","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 *\n * @param logger pui-diagnostic logger\n * @param correlationId unique id for the current session\n */\n constructor(logger, correlationId) {\n if (!logger)\n throw new Error(\"logger is required\");\n if (!correlationId)\n 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)\n 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)\n return false;\n if (!message.source)\n return false;\n const senderOrigin = this.#allowedSenders.get(message.source);\n if (!senderOrigin)\n return false;\n if (message?.data?.source !== MESSAGE_SOURCE)\n 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 *\n * @param {AddSenderParam} param - The sender to add\n */\n addSender = (param) => {\n const { origin, window: window2 } = param;\n if (!origin)\n throw new Error(\"origin is required\");\n if (!window2)\n throw new Error(\"window is required\");\n this.#allowedSenders.set(window2, origin);\n };\n /**\n * Initializes the remoting service for a window\n *\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 *\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 *\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 *\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 *\n * @param {AddSenderParam} param - The sender to remove\n */\n removeSender = (param) => {\n const { window: window2 } = param;\n if (window2)\n this.#allowedSenders.delete(window2);\n };\n /**\n * Send a response message to a window\n *\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 *\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","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 return MessageType2;\n})(MessageType || {});\nexport {\n MessageType\n};\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 *\n * @param {EventParam} param - parameters for creating an event\n */\n constructor(param) {\n const { name, requiresFeedback = false, so } = param;\n if (!name)\n throw new Error(\"Event name is required\");\n if (!so)\n 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}\nconst isEvent = (value) => value instanceof Event;\nconst getEventId = (objectId, eventName) => `${objectId.toLowerCase()}.${eventName.toLowerCase()}`;\nexport {\n Event,\n getEventId,\n isEvent\n};\n","// Defines the class for a Control\nimport type { IScriptingObjectProxy } from '@elliemae/pui-scripting-object';\n\n/**\n * Scripting Object Proxy implementation\n */\nexport class Proxy implements IScriptingObjectProxy {\n /**\n * unique id of scripting object\n */\n public readonly id: string;\n\n /**\n * type of scripting object\n */\n public readonly objectType: string;\n\n /**\n * Creates a new instance of the Scripting Object Proxy\n * @param objectId unique id of scripting object\n * @param objectType type of scripting object\n */\n constructor(objectId: string, objectType: string) {\n this.id = objectId;\n this.objectType = objectType;\n }\n}\n","import type { Events } from '@elliemae/pui-scripting-object';\nimport type {\n IScriptingObjectProxyEvent,\n EventListeners,\n} from '@elliemae/microfe-common';\n\n/**\n * ProxyEvent constructor parameter\n */\nexport type ProxyEventParam = {\n /**\n * name of the event\n */\n name: string;\n /**\n * unique id of scripting object\n */\n objectId: string;\n};\n\n/**\n * Scripting Object Proxy Event implementation\n * @typeParam AppEvents - type of the events that the scripting object supports\n */\n/* eslint-disable indent */\nexport class ProxyEvent<AppEvents extends EventListeners = Events>\n implements IScriptingObjectProxyEvent<AppEvents>\n{\n /* eslint-enable indent */\n /**\n * unique id of scripting object\n */\n public readonly objectId: string;\n\n /**\n * name of the event\n */\n public readonly name: string;\n\n /**\n * unique id of the event\n */\n public readonly id: Extract<keyof AppEvents, string>;\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: ProxyEventParam) {\n const { name, objectId } = param;\n this.objectId = objectId;\n this.name = name;\n this.id = `${this.objectId}.${this.name}`.toLowerCase() as Extract<\n keyof AppEvents,\n string\n >;\n }\n}\n","import { MessageType, sendMessage } from '@elliemae/microfe-common';\n\nexport const getParentWindowLocation = () => {\n const { parent } = window;\n try {\n return parent?.location?.href;\n } catch (e) {\n return null;\n }\n};\n\nexport const getOrigin = (url: string | null) => {\n if (!url || url === 'about:blank') return '*';\n const { origin } = new URL(url);\n return origin === 'null' || !origin ? url : origin;\n};\n\nexport const isEmbedded = () => window.self !== window.parent;\n\nexport const getComputedStyle = (\n prop: keyof CSSStyleDeclaration,\n el?: HTMLBodyElement,\n) => {\n const bodyElement = el || document.body;\n const retVal = document.defaultView?.getComputedStyle?.(bodyElement, null);\n const propValue = retVal ? (retVal[prop] as string) : '0';\n return parseInt(propValue, 10);\n};\n\n// eslint-disable-next-line prefer-regex-literals\nconst originsRegex = new RegExp(\n `^https?://(.*.elliemae.io|.*.ellielabs.com|.*.ellieservices.com|.*.encompassloconnect.com|.*.ice.com|localhost:[0-9]+)`,\n 'i',\n);\nconst MESSAGE_SOURCE = 'elli:remoting';\n\nexport const getHostDetails = () =>\n new Promise<{ origin: string; window: Window }>((resolve) => {\n if (!isEmbedded()) {\n window.addEventListener(\n 'message',\n (event: MessageEvent<{ source: string; type: string }>) => {\n if (originsRegex.test(event.origin)) {\n const { source, type } = event.data || {};\n if (source === MESSAGE_SOURCE && type === MessageType.HandShake) {\n const { origin } = event;\n const window = event.source as Window;\n // send handshake acknoledgement\n sendMessage({\n targetWin: window,\n targetOrigin: origin,\n messageType: MessageType.HandShakeAck,\n messageBody: {},\n });\n resolve({ origin, window });\n }\n }\n },\n );\n } else {\n resolve({\n origin: getOrigin(document.referrer || getParentWindowLocation()),\n window: window.parent,\n });\n }\n });\n","/* eslint-disable max-lines */\nimport { v4 as uuidv4 } from 'uuid';\nimport type {\n IScriptingObjectProxy,\n RemotingScriptingObject,\n Listener,\n Events,\n} from '@elliemae/pui-scripting-object';\nimport {\n Remoting,\n sendMessage,\n MessageType,\n getEventId,\n} from '@elliemae/microfe-common';\nimport type {\n ListenerCallbackParams,\n RemotingEventMessage,\n ConnectParam,\n GuestSubscribeParam,\n GuestUnsubscribeParam,\n EventListeners,\n ISSFGuest,\n} from '@elliemae/microfe-common';\nimport {\n logger as puiLogger,\n Console,\n http,\n LogLevels,\n Logger,\n webvitals,\n logUnhandledErrors,\n} from '@elliemae/pui-diagnostics';\nimport { Proxy } from './proxy.js';\nimport { ProxyEvent } from './proxyEvent.js';\nimport {\n getOrigin,\n isEmbedded,\n getComputedStyle,\n getHostDetails,\n getParentWindowLocation,\n} from './utils.js';\n\nenum ResponseType {\n OBJECT = 'object',\n VALUE = 'value',\n}\n\ntype ObjectResponse = {\n type: ResponseType.OBJECT;\n object: RemotingScriptingObject;\n};\n\ntype ValueResponse = {\n type: ResponseType.VALUE;\n value: any;\n};\n\ntype Response = ObjectResponse | ValueResponse;\ntype Config = {\n logLevel: LogLevels;\n guestId: string;\n guestTitle: string;\n guestUrl: string;\n};\n\nexport type ListenerInfo = {\n callback: Listener<any, any, any, any>;\n token: string;\n};\n\n// Provides a list of capabilities of this version of teh scripting framework\nconst capabilities = {\n eventFeedback: true,\n};\n\nconst onLoad = () => {\n const { document } = window;\n const iframeBody = document.body;\n const iframeHTML = document.documentElement;\n const bodyOffsetHeight =\n iframeBody.offsetHeight +\n getComputedStyle('marginTop') +\n getComputedStyle('marginBottom');\n const size = {\n height: bodyOffsetHeight,\n width: Math.max(iframeBody.scrollWidth, iframeHTML.scrollWidth),\n };\n sendMessage({\n targetWin: window.parent,\n targetOrigin: getOrigin(document.referrer || getParentWindowLocation()),\n messageType: MessageType.GuestResize,\n messageBody: size,\n });\n window.removeEventListener('load', onLoad);\n};\n\n// if hosted in iframe then wait for load event to send resize message\nif (isEmbedded()) {\n window.addEventListener('load', onLoad);\n}\n\n/**\n * options for the guest\n */\nexport type GuestOption = {\n /**\n * options for the logger\n */\n logger: {\n /**\n * log to console\n */\n console?: boolean;\n /**\n * url to send logs to\n */\n url?: string;\n /**\n * index to use for logging\n */\n index: string;\n /**\n * app name to use for logging\n */\n appName: string;\n /**\n * team name that owns the app\n */\n team: string;\n };\n};\n\nconst DIAGNOSTICS_URL = 'https://api.ellielabs.com/diagnostics/v2/logging';\n\n/**\n * Creates a new guest that can be used to communicate with the parent host application\n * @typeParm AppEvents - The events that the guest application listens\n */\n/* eslint-disable indent */\nexport class SSFGuest<AppEvents extends EventListeners = Events>\n implements ISSFGuest<AppEvents>\n{\n /* eslint-enable indent */\n #correlationId: string;\n\n #logger: Logger;\n\n #remoting: Remoting;\n\n #created = false;\n\n #scriptElement: HTMLScriptElement | null = null;\n\n #isConnected = false;\n\n #eventListeners = new Map<string, ListenerInfo[]>();\n\n #id: string | null = null;\n\n #title: string | null = null;\n\n #url: string | null = null;\n\n #hostOrigin: string | null = null;\n\n #hostWindow: Window | null = null;\n\n /**\n * Create new guest\n * @param {GuestOption} options - options for the guest\n */\n constructor(options: GuestOption) {\n const {\n console: logToConsole = false,\n // eslint-disable-next-line no-underscore-dangle\n url = window.__ICE__?.diagnosticsUrl || DIAGNOSTICS_URL,\n index,\n team,\n appName,\n } = options?.logger || {};\n const transport = logToConsole ? Console() : http(url);\n this.#logger = puiLogger({\n transport,\n index,\n team,\n appName,\n });\n webvitals(this.#logger);\n logUnhandledErrors(this.#logger);\n this.#correlationId = uuidv4();\n this.#remoting = new Remoting(this.#logger, this.#correlationId);\n this.#logger.audit({\n message: 'Guest created',\n guestUrl: window.location.href,\n correlationId: this.#correlationId,\n });\n }\n\n #getGuestInfo = () => ({\n guestId: this.#id,\n guestTitle: this.#title,\n guestUrl: this.#url,\n });\n\n /**\n * Marshals scripting object JSON into a proxy object\n * @param soJSON scripting object JSON\n * @returns marshaled proxy object\n */\n #fromJSON = (soJSON: RemotingScriptingObject): IScriptingObjectProxy => {\n // Ensure we have JSON\n if (!soJSON || !soJSON.objectId) {\n this.#logger.error(\n 'Deserialization of scripting object failed. Object does not have an Object ID.',\n );\n throw new Error('Cannot deserialize object JSON into proxy.');\n }\n\n // Create a new object\n const ctrl = new Proxy(soJSON.objectId, soJSON.objectType);\n\n // Dynamically build the function set on the control\n if (soJSON.functions) {\n soJSON.functions.forEach((functionName) => {\n Object.defineProperty(ctrl, functionName, {\n value: async <T>(...args: any[]) =>\n this.#invoke<T>({\n objectId: ctrl.id,\n functionName,\n functionParams: [].slice.call(args),\n }),\n enumerable: true,\n });\n });\n }\n\n // Dynamically create the event proxies\n if (soJSON.events) {\n soJSON.events.forEach((eventName) => {\n Object.defineProperty(ctrl, eventName, {\n value: new ProxyEvent({\n objectId: ctrl.id,\n name: eventName,\n }),\n enumerable: true,\n });\n });\n }\n\n this.#logger.debug(\n `Created guest proxy for scripting object (id = \"${ctrl.id}\")`,\n );\n return ctrl;\n };\n\n #invoke = async <T>({\n objectId,\n functionName,\n functionParams,\n }: {\n objectId: string;\n functionName: string;\n functionParams: Array<any>;\n }) => {\n this.#logger.debug(\n `Invoking scripting object method ${objectId}.${functionName}()...`,\n );\n\n // Find any function params that are promises\n const promises = [];\n if (functionParams) {\n for (let i = 0; i < functionParams.length; i += 1) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const p = functionParams[i];\n if (p instanceof Promise) {\n promises.push(\n p.then((val) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n functionParams[i] = val;\n }),\n );\n }\n }\n }\n\n // Now wait to resolve all of the promises and then call our invoke\n await Promise.all(promises);\n const response = await this.#remoting.invoke<Response>({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.ObjectInvoke,\n messageBody: {\n objectId,\n functionName,\n functionParams,\n },\n });\n const retVal = this.#handleResponse<T>(response);\n this.#logger.audit({\n message: 'Guest proxy invoked Scripting Object method',\n scriptingObject: objectId,\n scriptingMethod: functionName,\n ...this.#getGuestInfo(),\n });\n return retVal;\n };\n\n #handleResponse = <T>(response: ObjectResponse | ValueResponse) => {\n if (response?.type === ResponseType.OBJECT && 'object' in response) {\n return this.#fromJSON(response.object);\n }\n if (response?.type === ResponseType.VALUE) {\n return response.value as T;\n }\n return response;\n };\n\n #handleConfigChangeEvent = ({ body }: ListenerCallbackParams<Config>) => {\n // Handle log level changes\n if (body?.logLevel) {\n this.#logger.setLogLevel(body.logLevel);\n this.#logger.debug(`Log level changed by host to ${body.logLevel}`);\n }\n this.#id = body?.guestId ?? null;\n this.#title = body?.guestTitle ?? null;\n this.#url = body?.guestUrl ?? null;\n this.#logger.audit({\n message: 'Received configuration from Host',\n ...this.#getGuestInfo(),\n });\n };\n\n #handleFocusEvent = () => {\n window.focus();\n };\n\n #handleObjectEvent = async ({\n sourceWin,\n sourceOrigin,\n requestId,\n body,\n }: ListenerCallbackParams<RemotingEventMessage>) => {\n // Deserialize the object\n const object = this.#fromJSON(body.object);\n if (object) {\n // Get the listeners for the event\n const eventId = getEventId(object.id, body.eventName);\n this.#logger.debug(`Received event \"${eventId}\" from host`);\n\n // If an event handler is specified in the request body, then we will target\n // the event to that function only.\n let listeners: Array<ListenerInfo>;\n if (body.eventHandler) {\n listeners = [\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n callback: (window as { [key: string]: any })[body.eventHandler],\n token: uuidv4(),\n },\n ];\n } else {\n listeners = this.#eventListeners.get(eventId) || [];\n }\n\n // Notify each listener, recording a promise for each response\n const promises: Array<Promise<any>> = [];\n\n listeners.forEach((callbackInfo) => {\n if (callbackInfo?.callback) {\n this.#logger.debug(\n `Invoking event subscriber ${callbackInfo.callback.name} for event ${eventId}`,\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const retVal = callbackInfo.callback({\n obj: object,\n eventName: body.eventName,\n eventParams: body.eventParams,\n eventOptions: body.eventOptions,\n });\n\n if (retVal instanceof Promise) {\n promises.push(retVal);\n } else if (typeof retVal !== 'undefined') {\n promises.push(Promise.resolve(retVal));\n }\n }\n });\n\n // Resolve all promises and return a response to the calling window\n if (requestId) {\n const values = await Promise.all(promises);\n this.#remoting.respond({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n response: values,\n });\n this.#logger.audit({\n message: 'Guest proxy processed event from host and responded',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n } else {\n this.#logger.audit({\n message: 'Guest proxy processed event from host',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n }\n }\n };\n\n /**\n * Initialize guest using script\n * @param scriptUri uri of the script\n * @param containerElement dom element to inject the script at\n */\n addScript = async (scriptUri: string, containerElement: HTMLElement) => {\n if (!this.#created && scriptUri) {\n await this.connect();\n // Load the script and await its load event before signaling that the window is\n // ready to receive events\n const scriptEle = document.createElement('script');\n scriptEle.setAttribute('src', scriptUri);\n await new Promise<void>((resolve) => {\n const onScriptLoad = () => {\n scriptEle?.removeEventListener?.('load', onScriptLoad);\n // Set the created flag\n this.#created = true;\n resolve();\n };\n scriptEle.addEventListener('load', onScriptLoad);\n this.#scriptElement = containerElement.appendChild(scriptEle);\n });\n }\n };\n\n /**\n * Close the connection to the host\n */\n close = () => {\n if (!this.#isConnected) return;\n this.#remoting.send({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.GuestClose,\n messageBody: {},\n });\n this.#remoting.removeSender({\n origin: this.#hostOrigin!,\n window: this.#hostWindow!,\n });\n this.#remoting.close();\n this.#isConnected = false;\n this.#logger.audit({\n message: 'Guest disconnected from host',\n ...this.#getGuestInfo(),\n });\n this.#id = null;\n this.#url = null;\n this.#title = null;\n };\n\n /**\n * Connect to the host\n * @param {ConnectParam} param - reference to the guest window or options\n */\n connect = async (param?: ConnectParam) => {\n if (!this.#isConnected) {\n let guestWindow: Window = window;\n let guestOptions = { ...capabilities };\n\n if (param) {\n // Pull the guestWindow from the options, if present\n guestWindow = param.window || guestWindow;\n // Clone the guest options and delete the window reference\n const clonedOptions = { ...param };\n delete (clonedOptions as Partial<ConnectParam>).window;\n // Merge into the guest options object\n guestOptions = Object.assign(guestOptions, clonedOptions);\n }\n\n const hostDetails = await getHostDetails();\n this.#hostOrigin = hostDetails.origin;\n this.#hostWindow = hostDetails.window;\n // Initialize messenger\n this.#remoting.initialize(guestWindow);\n this.#remoting.addSender({\n origin: this.#hostOrigin,\n window: this.#hostWindow,\n });\n // Listen for the events the guest knows how to process\n this.#remoting.listen<RemotingEventMessage>({\n messageType: MessageType.ObjectEvent,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n callback: this.#handleObjectEvent.bind(this),\n });\n this.#remoting.listen<Config>({\n messageType: MessageType.HostConfig,\n callback: this.#handleConfigChangeEvent.bind(this),\n });\n this.#remoting.listen<void>({\n messageType: MessageType.GuestFocus,\n callback: this.#handleFocusEvent.bind(this),\n });\n // Let the host know the guest is ready for events, and send along\n // the guests's capabilities to allow for compatibility with future\n // host versions\n this.#remoting.send({\n targetWin: this.#hostWindow,\n targetOrigin: this.#hostOrigin,\n messageType: MessageType.GuestReady,\n messageBody: guestOptions,\n });\n this.#isConnected = true;\n this.#logger.audit({\n message: 'Guest connected to host',\n guestUrl: window.location.href,\n });\n }\n };\n\n /**\n * Get scripting object proxy by id\n * @param objectId unique id of the scripting object\n * @returns scripting object proxy\n */\n getObject = async (objectId: string) => {\n this.#logger.debug(\n `Retrieving scripting object \"${objectId}\" from host...`,\n );\n const response = await this.#remoting.invoke<ObjectResponse>({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.ObjectGet,\n messageBody: {\n objectId,\n },\n });\n const obj = this.#fromJSON(response.object);\n this.#logger.audit({\n message: 'Received scripting object from host',\n scriptingObject: objectId,\n ...this.#getGuestInfo(),\n });\n return obj;\n };\n\n /**\n * remove the guest from the host\n */\n removeScript = () => {\n if (!this.#created) return;\n if (this.#scriptElement) {\n const { parentNode } = this.#scriptElement;\n parentNode?.removeChild?.(this.#scriptElement);\n }\n };\n\n /**\n * Set the log level\n * @param {LogLevels} logLevel - log level\n * @param level\n */\n setLogLevel = (level: LogLevels) => {\n this.#logger.setLogLevel(level);\n this.#logger.debug(`Log level changed by guest to ${level}`);\n };\n\n /**\n * subscribe to an scripting object event\n * @param {GuestSubscribeParam<EventId, AppEvents[EventId]>} param - parameters for subscribing to an event\n * @returns subscription token\n */\n subscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: GuestSubscribeParam<EventId, AppEvents[EventId]>,\n ) => {\n const { eventId, callback } = param;\n this.#logger.debug(`Registering subscription for event ${eventId}`);\n const listeners = this.#eventListeners.get(eventId) || [];\n const token = uuidv4();\n listeners.push({ callback, token });\n this.#eventListeners.set(eventId, listeners);\n return token;\n };\n\n /**\n * unsubscribe from an scripting object event\n * @param {GuestUnsubscribeParam<EventId>} param - parameters for unsubscribing from an event\n */\n unsubscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: GuestUnsubscribeParam<EventId>,\n ) => {\n const { eventId, token } = param;\n let listeners = this.#eventListeners.get(eventId);\n if (listeners) {\n listeners = listeners.filter(\n (callbackInfo) => callbackInfo.token !== token,\n );\n this.#eventListeners.set(eventId, listeners);\n }\n };\n}\n"],"names":["root","factory","__WEBPACK_EXTERNAL_MODULE__270__","module","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","exports","definition","key","obj","prop","getRandomValues","rnds8","rng","byteToHex","unsafeStringify","arr","offset","stringify","uuid","v4","options","buf","rnds","i","MESSAGE_SOURCE","RESPONSE_MESSAGE_TYPE","EXCEPTION_MESSAGE_TYPE","createMessage","messageType","messageBody","onewayMsg","sendMessage","param","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","origin","window2","win","responseTimeoutMs","resolve","reject","items","response","ex","MessageType","MessageType2","Event","name","requiresFeedback","so","isEvent","value","getEventId","objectId","eventName","Proxy","objectType","ProxyEvent","getParentWindowLocation","parent","getOrigin","url","isEmbedded","getComputedStyle","el","bodyElement","retVal","propValue","originsRegex","getHostDetails","event","source","type","window","ResponseType","capabilities","onLoad","document","iframeBody","iframeHTML","size","DIAGNOSTICS_URL","SSFGuest","#remoting","#created","#scriptElement","#isConnected","#eventListeners","#id","#title","#url","#hostOrigin","#hostWindow","logToConsole","index","team","appName","transport","#getGuestInfo","#fromJSON","soJSON","ctrl","functionName","args","#invoke","functionParams","promises","p","val","#handleResponse","#handleConfigChangeEvent","body","#handleFocusEvent","#handleObjectEvent","object","eventId","listeners","callbackInfo","values","scriptUri","containerElement","scriptEle","onScriptLoad","guestWindow","guestOptions","clonedOptions","hostDetails","parentNode","level","token"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":"CAAC,SAA0CA,EAAMC,EAAS,CACtD,OAAO,SAAY,UAAY,OAAO,QAAW,SACnD,OAAO,QAAUA,EAAQ,QAAQ,iBAAiB,CAAC,EAC5C,OAAO,QAAW,YAAc,OAAO,IAC9C,OAAO,CAAC,iBAAiB,EAAGA,CAAO,EAC5B,OAAO,SAAY,SAC1B,QAAQ,IAASA,EAAQ,QAAQ,iBAAiB,CAAC,GAEnDD,EAAK,IAASA,EAAK,KAAU,CAAC,EAAGA,EAAK,IAAO,MA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EAKA,aAAe,IAAM,CACnB,GAAK,KAAK0G,IACN,KAAKC,GAAgB,CACvB,KAAM,CAAE,WAAA0C,CAAW,EAAI,KAAK1C,GAC5B0C,GAAY,cAAc,KAAK1C,EAAc,CAC/C,CACF,EAOA,YAAe2C,GAAqB,CAClC,KAAKxH,GAAQ,YAAYwH,CAAK,EAC9B,KAAKxH,GAAQ,MAAM,iCAAiCwH,CAAK,EAAE,CAC7D,EAOA,UACE9H,GACG,CACH,KAAM,CAAE,QAAAiH,EAAS,SAAAnF,CAAS,EAAI9B,EAC9B,KAAKM,GAAQ,MAAM,sCAAsC2G,CAAO,EAAE,EAClE,MAAMC,EAAY,KAAK7B,GAAgB,IAAI4B,CAAO,GAAK,CAAC,EAClDc,EAAQ,EAAO,EACrB,OAAAb,EAAU,KAAK,CAAE,SAAApF,EAAU,MAAAiG,CAAM,CAAC,EAClC,KAAK1C,GAAgB,IAAI4B,EAASC,CAAS,EACpCa,CACT,EAMA,YACE/H,GACG,CACH,KAAM,CAAE,QAAAiH,EAAS,MAAAc,CAAM,EAAI/H,EAC3B,IAAIkH,EAAY,KAAK7B,GAAgB,IAAI4B,CAAO,EAC5CC,IACFA,EAAYA,EAAU,OACnBC,GAAiBA,EAAa,QAAUY,CAC3C,EACA,KAAK1C,GAAgB,IAAI4B,EAASC,CAAS,EAE/C,CACF,C","sources":["webpack://ice.guest/webpack/universalModuleDefinition","webpack://ice.guest/external umd \"emuiDiagnostics\"","webpack://ice.guest/webpack/bootstrap","webpack://ice.guest/webpack/runtime/define property getters","webpack://ice.guest/webpack/runtime/hasOwnProperty shorthand","webpack://ice.guest/webpack/runtime/make namespace object","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js","webpack://ice.guest/../common/dist/esm/remoting.js","webpack://ice.guest/../common/dist/esm/messageType.js","webpack://ice.guest/../common/dist/esm/event.js","webpack://ice.guest/./lib/proxy.ts","webpack://ice.guest/./lib/proxyEvent.ts","webpack://ice.guest/./lib/utils.ts","webpack://ice.guest/./lib/guest.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"emuiDiagnostics\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"emuiDiagnostics\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ice\"] = factory(require(\"emuiDiagnostics\"));\n\telse\n\t\troot[\"ice\"] = root[\"ice\"] || {}, root[\"ice\"][\"guest\"] = factory(root[\"emuiDiagnostics\"]);\n})(globalThis, (__WEBPACK_EXTERNAL_MODULE__270__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__270__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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};","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)\n throw new Error(\"logger is required\");\n if (!correlationId)\n 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)\n 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)\n return false;\n if (!message.source)\n return false;\n const senderOrigin = this.#allowedSenders.get(message.source);\n if (!senderOrigin)\n return false;\n if (message?.data?.source !== MESSAGE_SOURCE)\n 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)\n throw new Error(\"origin is required\");\n if (!window2)\n 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)\n 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","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 return MessageType2;\n})(MessageType || {});\nexport {\n MessageType\n};\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)\n throw new Error(\"Event name is required\");\n if (!so)\n 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}\nconst isEvent = (value) => value instanceof Event;\nconst getEventId = (objectId, eventName) => `${objectId.toLowerCase()}.${eventName.toLowerCase()}`;\nexport {\n Event,\n getEventId,\n isEvent\n};\n","// Defines the class for a Control\nimport type { IScriptingObjectProxy } from '@elliemae/pui-scripting-object';\n\n/**\n * Scripting Object Proxy implementation\n */\nexport class Proxy implements IScriptingObjectProxy {\n /**\n * unique id of scripting object\n */\n public readonly id: string;\n\n /**\n * type of scripting object\n */\n public readonly objectType: string;\n\n /**\n * Creates a new instance of the Scripting Object Proxy\n * @param objectId unique id of scripting object\n * @param objectType type of scripting object\n */\n constructor(objectId: string, objectType: string) {\n this.id = objectId;\n this.objectType = objectType;\n }\n}\n","import type { Events } from '@elliemae/pui-scripting-object';\nimport type {\n IScriptingObjectProxyEvent,\n EventListeners,\n} from '@elliemae/microfe-common';\n\n/**\n * ProxyEvent constructor parameter\n */\nexport type ProxyEventParam = {\n /**\n * name of the event\n */\n name: string;\n /**\n * unique id of scripting object\n */\n objectId: string;\n};\n\n/**\n * Scripting Object Proxy Event implementation\n * @typeParam AppEvents - type of the events that the scripting object supports\n */\n/* eslint-disable indent */\nexport class ProxyEvent<AppEvents extends EventListeners = Events>\n implements IScriptingObjectProxyEvent<AppEvents>\n{\n /* eslint-enable indent */\n /**\n * unique id of scripting object\n */\n public readonly objectId: string;\n\n /**\n * name of the event\n */\n public readonly name: string;\n\n /**\n * unique id of the event\n */\n public readonly id: Extract<keyof AppEvents, string>;\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: ProxyEventParam) {\n const { name, objectId } = param;\n this.objectId = objectId;\n this.name = name;\n this.id = `${this.objectId}.${this.name}`.toLowerCase() as Extract<\n keyof AppEvents,\n string\n >;\n }\n}\n","import { MessageType, sendMessage } from '@elliemae/microfe-common';\n\nexport const getParentWindowLocation = () => {\n const { parent } = window;\n try {\n return parent?.location?.href;\n } catch (e) {\n return null;\n }\n};\n\nexport const getOrigin = (url: string | null) => {\n if (!url || url === 'about:blank') return '*';\n const { origin } = new URL(url);\n return origin === 'null' || !origin ? url : origin;\n};\n\nexport const isEmbedded = () => window.self !== window.parent;\n\nexport const getComputedStyle = (\n prop: keyof CSSStyleDeclaration,\n el?: HTMLBodyElement,\n) => {\n const bodyElement = el || document.body;\n const retVal = document.defaultView?.getComputedStyle?.(bodyElement, null);\n const propValue = retVal ? (retVal[prop] as string) : '0';\n return parseInt(propValue, 10);\n};\n\n// eslint-disable-next-line prefer-regex-literals\nconst originsRegex = new RegExp(\n `^https?://(.*.elliemae.io|.*.ellielabs.com|.*.ellieservices.com|.*.encompassloconnect.com|.*.ice.com|localhost:[0-9]+)`,\n 'i',\n);\nconst MESSAGE_SOURCE = 'elli:remoting';\n\nexport const getHostDetails = () =>\n new Promise<{ origin: string; window: Window }>((resolve) => {\n if (!isEmbedded()) {\n window.addEventListener(\n 'message',\n (event: MessageEvent<{ source: string; type: string }>) => {\n if (originsRegex.test(event.origin)) {\n const { source, type } = event.data || {};\n if (source === MESSAGE_SOURCE && type === MessageType.HandShake) {\n const { origin } = event;\n const window = event.source as Window;\n // send handshake acknoledgement\n sendMessage({\n targetWin: window,\n targetOrigin: origin,\n messageType: MessageType.HandShakeAck,\n messageBody: {},\n });\n resolve({ origin, window });\n }\n }\n },\n );\n } else {\n resolve({\n origin: getOrigin(document.referrer || getParentWindowLocation()),\n window: window.parent,\n });\n }\n });\n","/* eslint-disable max-lines */\nimport { v4 as uuidv4 } from 'uuid';\nimport type {\n IScriptingObjectProxy,\n RemotingScriptingObject,\n Listener,\n Events,\n} from '@elliemae/pui-scripting-object';\nimport {\n Remoting,\n sendMessage,\n MessageType,\n getEventId,\n} from '@elliemae/microfe-common';\nimport type {\n ListenerCallbackParams,\n RemotingEventMessage,\n ConnectParam,\n GuestSubscribeParam,\n GuestUnsubscribeParam,\n EventListeners,\n ISSFGuest,\n} from '@elliemae/microfe-common';\nimport {\n logger as puiLogger,\n Console,\n http,\n LogLevels,\n Logger,\n webvitals,\n logUnhandledErrors,\n} from '@elliemae/pui-diagnostics';\nimport { Proxy } from './proxy.js';\nimport { ProxyEvent } from './proxyEvent.js';\nimport {\n getOrigin,\n isEmbedded,\n getComputedStyle,\n getHostDetails,\n getParentWindowLocation,\n} from './utils.js';\n\nenum ResponseType {\n OBJECT = 'object',\n VALUE = 'value',\n}\n\ntype ObjectResponse = {\n type: ResponseType.OBJECT;\n object: RemotingScriptingObject;\n};\n\ntype ValueResponse = {\n type: ResponseType.VALUE;\n value: any;\n};\n\ntype Response = ObjectResponse | ValueResponse;\ntype Config = {\n logLevel: LogLevels;\n guestId: string;\n guestTitle: string;\n guestUrl: string;\n};\n\nexport type ListenerInfo = {\n callback: Listener<any, any, any, any>;\n token: string;\n};\n\n// Provides a list of capabilities of this version of teh scripting framework\nconst capabilities = {\n eventFeedback: true,\n};\n\nconst onLoad = () => {\n const { document } = window;\n const iframeBody = document.body;\n const iframeHTML = document.documentElement;\n const bodyOffsetHeight =\n iframeBody.offsetHeight +\n getComputedStyle('marginTop') +\n getComputedStyle('marginBottom');\n const size = {\n height: bodyOffsetHeight,\n width: Math.max(iframeBody.scrollWidth, iframeHTML.scrollWidth),\n };\n sendMessage({\n targetWin: window.parent,\n targetOrigin: getOrigin(document.referrer || getParentWindowLocation()),\n messageType: MessageType.GuestResize,\n messageBody: size,\n });\n window.removeEventListener('load', onLoad);\n};\n\n// if hosted in iframe then wait for load event to send resize message\nif (isEmbedded()) {\n window.addEventListener('load', onLoad);\n}\n\n/**\n * options for the guest\n */\nexport type GuestOption = {\n /**\n * options for the logger\n */\n logger: {\n /**\n * log to console\n */\n console?: boolean;\n /**\n * url to send logs to\n */\n url?: string;\n /**\n * index to use for logging\n */\n index: string;\n /**\n * app name to use for logging\n */\n appName: string;\n /**\n * team name that owns the app\n */\n team: string;\n };\n};\n\nconst DIAGNOSTICS_URL = 'https://api.ellielabs.com/diagnostics/v2/logging';\n\n/**\n * Creates a new guest that can be used to communicate with the parent host application\n * @typeParm AppEvents - The events that the guest application listens\n */\n/* eslint-disable indent */\nexport class SSFGuest<AppEvents extends EventListeners = Events>\n implements ISSFGuest<AppEvents>\n{\n /* eslint-enable indent */\n #correlationId: string;\n\n #logger: Logger;\n\n #remoting: Remoting;\n\n #created = false;\n\n #scriptElement: HTMLScriptElement | null = null;\n\n #isConnected = false;\n\n #eventListeners = new Map<string, ListenerInfo[]>();\n\n #id: string | null = null;\n\n #title: string | null = null;\n\n #url: string | null = null;\n\n #hostOrigin: string | null = null;\n\n #hostWindow: Window | null = null;\n\n /**\n * Create new guest\n * @param {GuestOption} options - options for the guest\n */\n constructor(options: GuestOption) {\n const {\n console: logToConsole = false,\n // eslint-disable-next-line no-underscore-dangle\n url = window.__ICE__?.diagnosticsUrl || DIAGNOSTICS_URL,\n index,\n team,\n appName,\n } = options?.logger || {};\n const transport = logToConsole ? Console() : http(url);\n this.#logger = puiLogger({\n transport,\n index,\n team,\n appName,\n });\n webvitals(this.#logger);\n logUnhandledErrors(this.#logger);\n this.#correlationId = uuidv4();\n this.#remoting = new Remoting(this.#logger, this.#correlationId);\n this.#logger.audit({\n message: 'Guest created',\n guestUrl: window.location.href,\n correlationId: this.#correlationId,\n });\n }\n\n #getGuestInfo = () => ({\n guestId: this.#id,\n guestTitle: this.#title,\n guestUrl: this.#url,\n });\n\n /**\n * Marshals scripting object JSON into a proxy object\n * @param soJSON scripting object JSON\n * @returns marshaled proxy object\n */\n #fromJSON = (soJSON: RemotingScriptingObject): IScriptingObjectProxy => {\n // Ensure we have JSON\n if (!soJSON || !soJSON.objectId) {\n this.#logger.error(\n 'Deserialization of scripting object failed. Object does not have an Object ID.',\n );\n throw new Error('Cannot deserialize object JSON into proxy.');\n }\n\n // Create a new object\n const ctrl = new Proxy(soJSON.objectId, soJSON.objectType);\n\n // Dynamically build the function set on the control\n if (soJSON.functions) {\n soJSON.functions.forEach((functionName) => {\n Object.defineProperty(ctrl, functionName, {\n value: async <T>(...args: any[]) =>\n this.#invoke<T>({\n objectId: ctrl.id,\n functionName,\n functionParams: [].slice.call(args),\n }),\n enumerable: true,\n });\n });\n }\n\n // Dynamically create the event proxies\n if (soJSON.events) {\n soJSON.events.forEach((eventName) => {\n Object.defineProperty(ctrl, eventName, {\n value: new ProxyEvent({\n objectId: ctrl.id,\n name: eventName,\n }),\n enumerable: true,\n });\n });\n }\n\n this.#logger.debug(\n `Created guest proxy for scripting object (id = \"${ctrl.id}\")`,\n );\n return ctrl;\n };\n\n #invoke = async <T>({\n objectId,\n functionName,\n functionParams,\n }: {\n objectId: string;\n functionName: string;\n functionParams: Array<any>;\n }) => {\n this.#logger.debug(\n `Invoking scripting object method ${objectId}.${functionName}()...`,\n );\n\n // Find any function params that are promises\n const promises = [];\n if (functionParams) {\n for (let i = 0; i < functionParams.length; i += 1) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const p = functionParams[i];\n if (p instanceof Promise) {\n promises.push(\n p.then((val) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n functionParams[i] = val;\n }),\n );\n }\n }\n }\n\n // Now wait to resolve all of the promises and then call our invoke\n await Promise.all(promises);\n const response = await this.#remoting.invoke<Response>({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.ObjectInvoke,\n messageBody: {\n objectId,\n functionName,\n functionParams,\n },\n });\n const retVal = this.#handleResponse<T>(response);\n this.#logger.audit({\n message: 'Guest proxy invoked Scripting Object method',\n scriptingObject: objectId,\n scriptingMethod: functionName,\n ...this.#getGuestInfo(),\n });\n return retVal;\n };\n\n #handleResponse = <T>(response: ObjectResponse | ValueResponse) => {\n if (response?.type === ResponseType.OBJECT && 'object' in response) {\n return this.#fromJSON(response.object);\n }\n if (response?.type === ResponseType.VALUE) {\n return response.value as T;\n }\n return response;\n };\n\n #handleConfigChangeEvent = ({ body }: ListenerCallbackParams<Config>) => {\n // Handle log level changes\n if (body?.logLevel) {\n this.#logger.setLogLevel(body.logLevel);\n this.#logger.debug(`Log level changed by host to ${body.logLevel}`);\n }\n this.#id = body?.guestId ?? null;\n this.#title = body?.guestTitle ?? null;\n this.#url = body?.guestUrl ?? null;\n this.#logger.audit({\n message: 'Received configuration from Host',\n ...this.#getGuestInfo(),\n });\n };\n\n #handleFocusEvent = () => {\n window.focus();\n };\n\n #handleObjectEvent = async ({\n sourceWin,\n sourceOrigin,\n requestId,\n body,\n }: ListenerCallbackParams<RemotingEventMessage>) => {\n // Deserialize the object\n const object = this.#fromJSON(body.object);\n if (object) {\n // Get the listeners for the event\n const eventId = getEventId(object.id, body.eventName);\n this.#logger.debug(`Received event \"${eventId}\" from host`);\n\n // If an event handler is specified in the request body, then we will target\n // the event to that function only.\n let listeners: Array<ListenerInfo>;\n if (body.eventHandler) {\n listeners = [\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n callback: (window as { [key: string]: any })[body.eventHandler],\n token: uuidv4(),\n },\n ];\n } else {\n listeners = this.#eventListeners.get(eventId) || [];\n }\n\n // Notify each listener, recording a promise for each response\n const promises: Array<Promise<any>> = [];\n\n listeners.forEach((callbackInfo) => {\n if (callbackInfo?.callback) {\n this.#logger.debug(\n `Invoking event subscriber ${callbackInfo.callback.name} for event ${eventId}`,\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const retVal = callbackInfo.callback({\n obj: object,\n eventName: body.eventName,\n eventParams: body.eventParams,\n eventOptions: body.eventOptions,\n });\n\n if (retVal instanceof Promise) {\n promises.push(retVal);\n } else if (typeof retVal !== 'undefined') {\n promises.push(Promise.resolve(retVal));\n }\n }\n });\n\n // Resolve all promises and return a response to the calling window\n if (requestId) {\n const values = await Promise.all(promises);\n this.#remoting.respond({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n response: values,\n });\n this.#logger.audit({\n message: 'Guest proxy processed event from host and responded',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n } else {\n this.#logger.audit({\n message: 'Guest proxy processed event from host',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n }\n }\n };\n\n /**\n * Initialize guest using script\n * @param scriptUri uri of the script\n * @param containerElement dom element to inject the script at\n */\n addScript = async (scriptUri: string, containerElement: HTMLElement) => {\n if (!this.#created && scriptUri) {\n await this.connect();\n // Load the script and await its load event before signaling that the window is\n // ready to receive events\n const scriptEle = document.createElement('script');\n scriptEle.setAttribute('src', scriptUri);\n await new Promise<void>((resolve) => {\n const onScriptLoad = () => {\n scriptEle?.removeEventListener?.('load', onScriptLoad);\n // Set the created flag\n this.#created = true;\n resolve();\n };\n scriptEle.addEventListener('load', onScriptLoad);\n this.#scriptElement = containerElement.appendChild(scriptEle);\n });\n }\n };\n\n /**\n * Close the connection to the host\n */\n close = () => {\n if (!this.#isConnected) return;\n this.#remoting.send({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.GuestClose,\n messageBody: {},\n });\n this.#remoting.removeSender({\n origin: this.#hostOrigin!,\n window: this.#hostWindow!,\n });\n this.#remoting.close();\n this.#isConnected = false;\n this.#logger.audit({\n message: 'Guest disconnected from host',\n ...this.#getGuestInfo(),\n });\n this.#id = null;\n this.#url = null;\n this.#title = null;\n };\n\n /**\n * Connect to the host\n * @param {ConnectParam} param - reference to the guest window or options\n */\n connect = async (param?: ConnectParam) => {\n if (!this.#isConnected) {\n let guestWindow: Window = window;\n let guestOptions = { ...capabilities };\n\n if (param) {\n // Pull the guestWindow from the options, if present\n guestWindow = param.window || guestWindow;\n // Clone the guest options and delete the window reference\n const clonedOptions = { ...param };\n delete (clonedOptions as Partial<ConnectParam>).window;\n // Merge into the guest options object\n guestOptions = Object.assign(guestOptions, clonedOptions);\n }\n\n const hostDetails = await getHostDetails();\n this.#hostOrigin = hostDetails.origin;\n this.#hostWindow = hostDetails.window;\n // Initialize messenger\n this.#remoting.initialize(guestWindow);\n this.#remoting.addSender({\n origin: this.#hostOrigin,\n window: this.#hostWindow,\n });\n // Listen for the events the guest knows how to process\n this.#remoting.listen<RemotingEventMessage>({\n messageType: MessageType.ObjectEvent,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n callback: this.#handleObjectEvent.bind(this),\n });\n this.#remoting.listen<Config>({\n messageType: MessageType.HostConfig,\n callback: this.#handleConfigChangeEvent.bind(this),\n });\n this.#remoting.listen<void>({\n messageType: MessageType.GuestFocus,\n callback: this.#handleFocusEvent.bind(this),\n });\n // Let the host know the guest is ready for events, and send along\n // the guests's capabilities to allow for compatibility with future\n // host versions\n this.#remoting.send({\n targetWin: this.#hostWindow,\n targetOrigin: this.#hostOrigin,\n messageType: MessageType.GuestReady,\n messageBody: guestOptions,\n });\n this.#isConnected = true;\n this.#logger.audit({\n message: 'Guest connected to host',\n guestUrl: window.location.href,\n });\n }\n };\n\n /**\n * Get scripting object proxy by id\n * @param objectId unique id of the scripting object\n * @returns scripting object proxy\n */\n getObject = async (objectId: string) => {\n this.#logger.debug(\n `Retrieving scripting object \"${objectId}\" from host...`,\n );\n const response = await this.#remoting.invoke<ObjectResponse>({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.ObjectGet,\n messageBody: {\n objectId,\n },\n });\n const obj = this.#fromJSON(response.object);\n this.#logger.audit({\n message: 'Received scripting object from host',\n scriptingObject: objectId,\n ...this.#getGuestInfo(),\n });\n return obj;\n };\n\n /**\n * remove the guest from the host\n */\n removeScript = () => {\n if (!this.#created) return;\n if (this.#scriptElement) {\n const { parentNode } = this.#scriptElement;\n parentNode?.removeChild?.(this.#scriptElement);\n }\n };\n\n /**\n * Set the log level\n * @param {LogLevels} logLevel - log level\n * @param level\n */\n setLogLevel = (level: LogLevels) => {\n this.#logger.setLogLevel(level);\n this.#logger.debug(`Log level changed by guest to ${level}`);\n };\n\n /**\n * subscribe to an scripting object event\n * @param {GuestSubscribeParam<EventId, AppEvents[EventId]>} param - parameters for subscribing to an event\n * @returns subscription token\n */\n subscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: GuestSubscribeParam<EventId, AppEvents[EventId]>,\n ) => {\n const { eventId, callback } = param;\n this.#logger.debug(`Registering subscription for event ${eventId}`);\n const listeners = this.#eventListeners.get(eventId) || [];\n const token = uuidv4();\n listeners.push({ callback, token });\n this.#eventListeners.set(eventId, listeners);\n return token;\n };\n\n /**\n * unsubscribe from an scripting object event\n * @param {GuestUnsubscribeParam<EventId>} param - parameters for unsubscribing from an event\n */\n unsubscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: GuestUnsubscribeParam<EventId>,\n ) => {\n const { eventId, token } = param;\n let listeners = this.#eventListeners.get(eventId);\n if (listeners) {\n listeners = listeners.filter(\n (callbackInfo) => callbackInfo.token !== token,\n );\n this.#eventListeners.set(eventId, listeners);\n }\n };\n}\n"],"names":["root","factory","__WEBPACK_EXTERNAL_MODULE__270__","module","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","exports","definition","key","obj","prop","getRandomValues","rnds8","rng","byteToHex","unsafeStringify","arr","offset","stringify","uuid","v4","options","buf","rnds","i","MESSAGE_SOURCE","RESPONSE_MESSAGE_TYPE","EXCEPTION_MESSAGE_TYPE","createMessage","messageType","messageBody","onewayMsg","sendMessage","param","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","origin","window2","win","responseTimeoutMs","resolve","reject","items","response","ex","MessageType","MessageType2","Event","name","requiresFeedback","so","isEvent","value","getEventId","objectId","eventName","Proxy","objectType","ProxyEvent","getParentWindowLocation","parent","getOrigin","url","isEmbedded","getComputedStyle","el","bodyElement","retVal","propValue","originsRegex","getHostDetails","event","source","type","window","ResponseType","capabilities","onLoad","document","iframeBody","iframeHTML","size","DIAGNOSTICS_URL","SSFGuest","#remoting","#created","#scriptElement","#isConnected","#eventListeners","#id","#title","#url","#hostOrigin","#hostWindow","logToConsole","index","team","appName","transport","#getGuestInfo","#fromJSON","soJSON","ctrl","functionName","args","#invoke","functionParams","promises","p","val","#handleResponse","#handleConfigChangeEvent","body","#handleFocusEvent","#handleObjectEvent","object","eventId","listeners","callbackInfo","values","scriptUri","containerElement","scriptEle","onScriptLoad","guestWindow","guestOptions","clonedOptions","hostDetails","parentNode","level","token"],"sourceRoot":""}
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ssf-guest",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "ICE MT SSF Guest Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,11 +38,11 @@
38
38
  "dependencies": {
39
39
  "@elliemae/pui-diagnostics": "~3.4.1",
40
40
  "uuid": "~9.0.1",
41
- "@elliemae/microfe-common": "2.3.0"
41
+ "@elliemae/microfe-common": "2.4.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@elliemae/browserslist-config-elliemae-latest-browsers": "~1.8.0",
45
- "@elliemae/pui-scripting-object": "~1.31.0",
45
+ "@elliemae/pui-scripting-object": "~1.31.3",
46
46
  "@types/uuid": "~9.0.7"
47
47
  },
48
48
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"js/emuiSsfGuest.13609a0865c6dc4ecf4c.js","mappings":"CAAC,SAA0CA,EAAMC,EAAS,CACtD,OAAO,SAAY,UAA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,GAAU,OAAuB,CAC3D,UAAW,KAAKS,GAChB,aAAc,KAAKD,GACnB,YAAa/C,EAAY,UACzB,YAAa,CACX,SAAAS,CACF,CACF,CAAC,EACK3E,EAAM,KAAKyH,GAAUzD,EAAS,MAAM,EAC1C,YAAKlC,GAAQ,MAAM,CACjB,QAAS,sCACT,gBAAiB6C,EACjB,GAAG,KAAK6C,GAAc,CACxB,CAAC,EACMxH,CACT,EAKA,aAAe,IAAM,CACnB,GAAK,KAAK0G,IACN,KAAKC,GAAgB,CACvB,KAAM,CAAE,WAAA0C,CAAW,EAAI,KAAK1C,GAC5B0C,GAAY,cAAc,KAAK1C,EAAc,CAC/C,CACF,EAOA,YAAe2C,GAAqB,CAClC,KAAKxH,GAAQ,YAAYwH,CAAK,EAC9B,KAAKxH,GAAQ,MAAM,iCAAiCwH,CAAK,EAAE,CAC7D,EAOA,UACE9H,GACG,CACH,KAAM,CAAE,QAAAiH,EAAS,SAAAnF,CAAS,EAAI9B,EAC9B,KAAKM,GAAQ,MAAM,sCAAsC2G,CAAO,EAAE,EAClE,MAAMC,EAAY,KAAK7B,GAAgB,IAAI4B,CAAO,GAAK,CAAC,EAClDc,EAAQ,EAAO,EACrB,OAAAb,EAAU,KAAK,CAAE,SAAApF,EAAU,MAAAiG,CAAM,CAAC,EAClC,KAAK1C,GAAgB,IAAI4B,EAASC,CAAS,EACpCa,CACT,EAMA,YACE/H,GACG,CACH,KAAM,CAAE,QAAAiH,EAAS,MAAAc,CAAM,EAAI/H,EAC3B,IAAIkH,EAAY,KAAK7B,GAAgB,IAAI4B,CAAO,EAC5CC,IACFA,EAAYA,EAAU,OACnBC,GAAiBA,EAAa,QAAUY,CAC3C,EACA,KAAK1C,GAAgB,IAAI4B,EAASC,CAAS,EAE/C,CACF,C","sources":["webpack://ice.guest/webpack/universalModuleDefinition","webpack://ice.guest/external umd \"emuiDiagnostics\"","webpack://ice.guest/webpack/bootstrap","webpack://ice.guest/webpack/runtime/define property getters","webpack://ice.guest/webpack/runtime/hasOwnProperty shorthand","webpack://ice.guest/webpack/runtime/make namespace object","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js","webpack://ice.guest/../common/dist/esm/remoting.js","webpack://ice.guest/../common/dist/esm/messageType.js","webpack://ice.guest/../common/dist/esm/event.js","webpack://ice.guest/./lib/proxy.ts","webpack://ice.guest/./lib/proxyEvent.ts","webpack://ice.guest/./lib/utils.ts","webpack://ice.guest/./lib/guest.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"emuiDiagnostics\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"emuiDiagnostics\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ice\"] = factory(require(\"emuiDiagnostics\"));\n\telse\n\t\troot[\"ice\"] = root[\"ice\"] || {}, root[\"ice\"][\"guest\"] = factory(root[\"emuiDiagnostics\"]);\n})(globalThis, (__WEBPACK_EXTERNAL_MODULE__270__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__270__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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};","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 *\n * @param logger pui-diagnostic logger\n * @param correlationId unique id for the current session\n */\n constructor(logger, correlationId) {\n if (!logger)\n throw new Error(\"logger is required\");\n if (!correlationId)\n 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)\n 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)\n return false;\n if (!message.source)\n return false;\n const senderOrigin = this.#allowedSenders.get(message.source);\n if (!senderOrigin)\n return false;\n if (message?.data?.source !== MESSAGE_SOURCE)\n 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 *\n * @param {AddSenderParam} param - The sender to add\n */\n addSender = (param) => {\n const { origin, window: window2 } = param;\n if (!origin)\n throw new Error(\"origin is required\");\n if (!window2)\n throw new Error(\"window is required\");\n this.#allowedSenders.set(window2, origin);\n };\n /**\n * Initializes the remoting service for a window\n *\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 *\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 *\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 *\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 *\n * @param {AddSenderParam} param - The sender to remove\n */\n removeSender = (param) => {\n const { window: window2 } = param;\n if (window2)\n this.#allowedSenders.delete(window2);\n };\n /**\n * Send a response message to a window\n *\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 *\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","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 return MessageType2;\n})(MessageType || {});\nexport {\n MessageType\n};\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 *\n * @param {EventParam} param - parameters for creating an event\n */\n constructor(param) {\n const { name, requiresFeedback = false, so } = param;\n if (!name)\n throw new Error(\"Event name is required\");\n if (!so)\n 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}\nconst isEvent = (value) => value instanceof Event;\nconst getEventId = (objectId, eventName) => `${objectId.toLowerCase()}.${eventName.toLowerCase()}`;\nexport {\n Event,\n getEventId,\n isEvent\n};\n","// Defines the class for a Control\nimport type { IScriptingObjectProxy } from '@elliemae/pui-scripting-object';\n\n/**\n * Scripting Object Proxy implementation\n */\nexport class Proxy implements IScriptingObjectProxy {\n /**\n * unique id of scripting object\n */\n public readonly id: string;\n\n /**\n * type of scripting object\n */\n public readonly objectType: string;\n\n /**\n * Creates a new instance of the Scripting Object Proxy\n * @param objectId unique id of scripting object\n * @param objectType type of scripting object\n */\n constructor(objectId: string, objectType: string) {\n this.id = objectId;\n this.objectType = objectType;\n }\n}\n","import type { Events } from '@elliemae/pui-scripting-object';\nimport type {\n IScriptingObjectProxyEvent,\n EventListeners,\n} from '@elliemae/microfe-common';\n\n/**\n * ProxyEvent constructor parameter\n */\nexport type ProxyEventParam = {\n /**\n * name of the event\n */\n name: string;\n /**\n * unique id of scripting object\n */\n objectId: string;\n};\n\n/**\n * Scripting Object Proxy Event implementation\n * @typeParam AppEvents - type of the events that the scripting object supports\n */\n/* eslint-disable indent */\nexport class ProxyEvent<AppEvents extends EventListeners = Events>\n implements IScriptingObjectProxyEvent<AppEvents>\n{\n /* eslint-enable indent */\n /**\n * unique id of scripting object\n */\n public readonly objectId: string;\n\n /**\n * name of the event\n */\n public readonly name: string;\n\n /**\n * unique id of the event\n */\n public readonly id: Extract<keyof AppEvents, string>;\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: ProxyEventParam) {\n const { name, objectId } = param;\n this.objectId = objectId;\n this.name = name;\n this.id = `${this.objectId}.${this.name}`.toLowerCase() as Extract<\n keyof AppEvents,\n string\n >;\n }\n}\n","import { MessageType, sendMessage } from '@elliemae/microfe-common';\n\nexport const getParentWindowLocation = () => {\n const { parent } = window;\n try {\n return parent?.location?.href;\n } catch (e) {\n return null;\n }\n};\n\nexport const getOrigin = (url: string | null) => {\n if (!url || url === 'about:blank') return '*';\n const { origin } = new URL(url);\n return origin === 'null' || !origin ? url : origin;\n};\n\nexport const isEmbedded = () => window.self !== window.parent;\n\nexport const getComputedStyle = (\n prop: keyof CSSStyleDeclaration,\n el?: HTMLBodyElement,\n) => {\n const bodyElement = el || document.body;\n const retVal = document.defaultView?.getComputedStyle?.(bodyElement, null);\n const propValue = retVal ? (retVal[prop] as string) : '0';\n return parseInt(propValue, 10);\n};\n\n// eslint-disable-next-line prefer-regex-literals\nconst originsRegex = new RegExp(\n `^https?://(.*.elliemae.io|.*.ellielabs.com|.*.ellieservices.com|.*.encompassloconnect.com|.*.ice.com|localhost:[0-9]+)`,\n 'i',\n);\nconst MESSAGE_SOURCE = 'elli:remoting';\n\nexport const getHostDetails = () =>\n new Promise<{ origin: string; window: Window }>((resolve) => {\n if (!isEmbedded()) {\n window.addEventListener(\n 'message',\n (event: MessageEvent<{ source: string; type: string }>) => {\n if (originsRegex.test(event.origin)) {\n const { source, type } = event.data || {};\n if (source === MESSAGE_SOURCE && type === MessageType.HandShake) {\n const { origin } = event;\n const window = event.source as Window;\n // send handshake acknoledgement\n sendMessage({\n targetWin: window,\n targetOrigin: origin,\n messageType: MessageType.HandShakeAck,\n messageBody: {},\n });\n resolve({ origin, window });\n }\n }\n },\n );\n } else {\n resolve({\n origin: getOrigin(document.referrer || getParentWindowLocation()),\n window: window.parent,\n });\n }\n });\n","/* eslint-disable max-lines */\nimport { v4 as uuidv4 } from 'uuid';\nimport type {\n IScriptingObjectProxy,\n RemotingScriptingObject,\n Listener,\n Events,\n} from '@elliemae/pui-scripting-object';\nimport {\n Remoting,\n sendMessage,\n MessageType,\n getEventId,\n} from '@elliemae/microfe-common';\nimport type {\n ListenerCallbackParams,\n RemotingEventMessage,\n ConnectParam,\n GuestSubscribeParam,\n GuestUnsubscribeParam,\n EventListeners,\n ISSFGuest,\n} from '@elliemae/microfe-common';\nimport {\n logger as puiLogger,\n Console,\n http,\n LogLevels,\n Logger,\n webvitals,\n logUnhandledErrors,\n} from '@elliemae/pui-diagnostics';\nimport { Proxy } from './proxy.js';\nimport { ProxyEvent } from './proxyEvent.js';\nimport {\n getOrigin,\n isEmbedded,\n getComputedStyle,\n getHostDetails,\n getParentWindowLocation,\n} from './utils.js';\n\nenum ResponseType {\n OBJECT = 'object',\n VALUE = 'value',\n}\n\ntype ObjectResponse = {\n type: ResponseType.OBJECT;\n object: RemotingScriptingObject;\n};\n\ntype ValueResponse = {\n type: ResponseType.VALUE;\n value: any;\n};\n\ntype Response = ObjectResponse | ValueResponse;\ntype Config = {\n logLevel: LogLevels;\n guestId: string;\n guestTitle: string;\n guestUrl: string;\n};\n\nexport type ListenerInfo = {\n callback: Listener<any, any, any, any>;\n token: string;\n};\n\n// Provides a list of capabilities of this version of teh scripting framework\nconst capabilities = {\n eventFeedback: true,\n};\n\nconst onLoad = () => {\n const { document } = window;\n const iframeBody = document.body;\n const iframeHTML = document.documentElement;\n const bodyOffsetHeight =\n iframeBody.offsetHeight +\n getComputedStyle('marginTop') +\n getComputedStyle('marginBottom');\n const size = {\n height: bodyOffsetHeight,\n width: Math.max(iframeBody.scrollWidth, iframeHTML.scrollWidth),\n };\n sendMessage({\n targetWin: window.parent,\n targetOrigin: getOrigin(document.referrer || getParentWindowLocation()),\n messageType: MessageType.GuestResize,\n messageBody: size,\n });\n window.removeEventListener('load', onLoad);\n};\n\n// if hosted in iframe then wait for load event to send resize message\nif (isEmbedded()) {\n window.addEventListener('load', onLoad);\n}\n\n/**\n * options for the guest\n */\nexport type GuestOption = {\n /**\n * options for the logger\n */\n logger: {\n /**\n * log to console\n */\n console?: boolean;\n /**\n * url to send logs to\n */\n url?: string;\n /**\n * index to use for logging\n */\n index: string;\n /**\n * app name to use for logging\n */\n appName: string;\n /**\n * team name that owns the app\n */\n team: string;\n };\n};\n\nconst DIAGNOSTICS_URL = 'https://api.ellielabs.com/diagnostics/v2/logging';\n\n/**\n * Creates a new guest that can be used to communicate with the parent host application\n * @typeParm AppEvents - The events that the guest application listens\n */\n/* eslint-disable indent */\nexport class SSFGuest<AppEvents extends EventListeners = Events>\n implements ISSFGuest<AppEvents>\n{\n /* eslint-enable indent */\n #correlationId: string;\n\n #logger: Logger;\n\n #remoting: Remoting;\n\n #created = false;\n\n #scriptElement: HTMLScriptElement | null = null;\n\n #isConnected = false;\n\n #eventListeners = new Map<string, ListenerInfo[]>();\n\n #id: string | null = null;\n\n #title: string | null = null;\n\n #url: string | null = null;\n\n #hostOrigin: string | null = null;\n\n #hostWindow: Window | null = null;\n\n /**\n * Create new guest\n * @param {GuestOption} options - options for the guest\n */\n constructor(options: GuestOption) {\n const {\n console: logToConsole = false,\n // eslint-disable-next-line no-underscore-dangle\n url = window.__ICE__?.diagnosticsUrl || DIAGNOSTICS_URL,\n index,\n team,\n appName,\n } = options?.logger || {};\n const transport = logToConsole ? Console() : http(url);\n this.#logger = puiLogger({\n transport,\n index,\n team,\n appName,\n });\n webvitals(this.#logger);\n logUnhandledErrors(this.#logger);\n this.#correlationId = uuidv4();\n this.#remoting = new Remoting(this.#logger, this.#correlationId);\n this.#logger.audit({\n message: 'Guest created',\n guestUrl: window.location.href,\n correlationId: this.#correlationId,\n });\n }\n\n #getGuestInfo = () => ({\n guestId: this.#id,\n guestTitle: this.#title,\n guestUrl: this.#url,\n });\n\n /**\n * Marshals scripting object JSON into a proxy object\n * @param soJSON scripting object JSON\n * @returns marshaled proxy object\n */\n #fromJSON = (soJSON: RemotingScriptingObject): IScriptingObjectProxy => {\n // Ensure we have JSON\n if (!soJSON || !soJSON.objectId) {\n this.#logger.error(\n 'Deserialization of scripting object failed. Object does not have an Object ID.',\n );\n throw new Error('Cannot deserialize object JSON into proxy.');\n }\n\n // Create a new object\n const ctrl = new Proxy(soJSON.objectId, soJSON.objectType);\n\n // Dynamically build the function set on the control\n if (soJSON.functions) {\n soJSON.functions.forEach((functionName) => {\n Object.defineProperty(ctrl, functionName, {\n value: async <T>(...args: any[]) =>\n this.#invoke<T>({\n objectId: ctrl.id,\n functionName,\n functionParams: [].slice.call(args),\n }),\n enumerable: true,\n });\n });\n }\n\n // Dynamically create the event proxies\n if (soJSON.events) {\n soJSON.events.forEach((eventName) => {\n Object.defineProperty(ctrl, eventName, {\n value: new ProxyEvent({\n objectId: ctrl.id,\n name: eventName,\n }),\n enumerable: true,\n });\n });\n }\n\n this.#logger.debug(\n `Created guest proxy for scripting object (id = \"${ctrl.id}\")`,\n );\n return ctrl;\n };\n\n #invoke = async <T>({\n objectId,\n functionName,\n functionParams,\n }: {\n objectId: string;\n functionName: string;\n functionParams: Array<any>;\n }) => {\n this.#logger.debug(\n `Invoking scripting object method ${objectId}.${functionName}()...`,\n );\n\n // Find any function params that are promises\n const promises = [];\n if (functionParams) {\n for (let i = 0; i < functionParams.length; i += 1) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const p = functionParams[i];\n if (p instanceof Promise) {\n promises.push(\n p.then((val) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n functionParams[i] = val;\n }),\n );\n }\n }\n }\n\n // Now wait to resolve all of the promises and then call our invoke\n await Promise.all(promises);\n const response = await this.#remoting.invoke<Response>({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.ObjectInvoke,\n messageBody: {\n objectId,\n functionName,\n functionParams,\n },\n });\n const retVal = this.#handleResponse<T>(response);\n this.#logger.audit({\n message: 'Guest proxy invoked Scripting Object method',\n scriptingObject: objectId,\n scriptingMethod: functionName,\n ...this.#getGuestInfo(),\n });\n return retVal;\n };\n\n #handleResponse = <T>(response: ObjectResponse | ValueResponse) => {\n if (response?.type === ResponseType.OBJECT && 'object' in response) {\n return this.#fromJSON(response.object);\n }\n if (response?.type === ResponseType.VALUE) {\n return response.value as T;\n }\n return response;\n };\n\n #handleConfigChangeEvent = ({ body }: ListenerCallbackParams<Config>) => {\n // Handle log level changes\n if (body?.logLevel) {\n this.#logger.setLogLevel(body.logLevel);\n this.#logger.debug(`Log level changed by host to ${body.logLevel}`);\n }\n this.#id = body?.guestId ?? null;\n this.#title = body?.guestTitle ?? null;\n this.#url = body?.guestUrl ?? null;\n this.#logger.audit({\n message: 'Received configuration from Host',\n ...this.#getGuestInfo(),\n });\n };\n\n #handleFocusEvent = () => {\n window.focus();\n };\n\n #handleObjectEvent = async ({\n sourceWin,\n sourceOrigin,\n requestId,\n body,\n }: ListenerCallbackParams<RemotingEventMessage>) => {\n // Deserialize the object\n const object = this.#fromJSON(body.object);\n if (object) {\n // Get the listeners for the event\n const eventId = getEventId(object.id, body.eventName);\n this.#logger.debug(`Received event \"${eventId}\" from host`);\n\n // If an event handler is specified in the request body, then we will target\n // the event to that function only.\n let listeners: Array<ListenerInfo>;\n if (body.eventHandler) {\n listeners = [\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n callback: (window as { [key: string]: any })[body.eventHandler],\n token: uuidv4(),\n },\n ];\n } else {\n listeners = this.#eventListeners.get(eventId) || [];\n }\n\n // Notify each listener, recording a promise for each response\n const promises: Array<Promise<any>> = [];\n\n listeners.forEach((callbackInfo) => {\n if (callbackInfo?.callback) {\n this.#logger.debug(\n `Invoking event subscriber ${callbackInfo.callback.name} for event ${eventId}`,\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const retVal = callbackInfo.callback({\n obj: object,\n eventName: body.eventName,\n eventParams: body.eventParams,\n eventOptions: body.eventOptions,\n });\n\n if (retVal instanceof Promise) {\n promises.push(retVal);\n } else if (typeof retVal !== 'undefined') {\n promises.push(Promise.resolve(retVal));\n }\n }\n });\n\n // Resolve all promises and return a response to the calling window\n if (requestId) {\n const values = await Promise.all(promises);\n this.#remoting.respond({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n response: values,\n });\n this.#logger.audit({\n message: 'Guest proxy processed event from host and responded',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n } else {\n this.#logger.audit({\n message: 'Guest proxy processed event from host',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n }\n }\n };\n\n /**\n * Initialize guest using script\n * @param scriptUri uri of the script\n * @param containerElement dom element to inject the script at\n */\n addScript = async (scriptUri: string, containerElement: HTMLElement) => {\n if (!this.#created && scriptUri) {\n await this.connect();\n // Load the script and await its load event before signaling that the window is\n // ready to receive events\n const scriptEle = document.createElement('script');\n scriptEle.setAttribute('src', scriptUri);\n await new Promise<void>((resolve) => {\n const onScriptLoad = () => {\n scriptEle?.removeEventListener?.('load', onScriptLoad);\n // Set the created flag\n this.#created = true;\n resolve();\n };\n scriptEle.addEventListener('load', onScriptLoad);\n this.#scriptElement = containerElement.appendChild(scriptEle);\n });\n }\n };\n\n /**\n * Close the connection to the host\n */\n close = () => {\n if (!this.#isConnected) return;\n this.#remoting.send({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.GuestClose,\n messageBody: {},\n });\n this.#remoting.removeSender({\n origin: this.#hostOrigin!,\n window: this.#hostWindow!,\n });\n this.#remoting.close();\n this.#isConnected = false;\n this.#logger.audit({\n message: 'Guest disconnected from host',\n ...this.#getGuestInfo(),\n });\n this.#id = null;\n this.#url = null;\n this.#title = null;\n };\n\n /**\n * Connect to the host\n * @param {ConnectParam} param - reference to the guest window or options\n */\n connect = async (param?: ConnectParam) => {\n if (!this.#isConnected) {\n let guestWindow: Window = window;\n let guestOptions = { ...capabilities };\n\n if (param) {\n // Pull the guestWindow from the options, if present\n guestWindow = param.window || guestWindow;\n // Clone the guest options and delete the window reference\n const clonedOptions = { ...param };\n delete (clonedOptions as Partial<ConnectParam>).window;\n // Merge into the guest options object\n guestOptions = Object.assign(guestOptions, clonedOptions);\n }\n\n const hostDetails = await getHostDetails();\n this.#hostOrigin = hostDetails.origin;\n this.#hostWindow = hostDetails.window;\n // Initialize messenger\n this.#remoting.initialize(guestWindow);\n this.#remoting.addSender({\n origin: this.#hostOrigin,\n window: this.#hostWindow,\n });\n // Listen for the events the guest knows how to process\n this.#remoting.listen<RemotingEventMessage>({\n messageType: MessageType.ObjectEvent,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n callback: this.#handleObjectEvent.bind(this),\n });\n this.#remoting.listen<Config>({\n messageType: MessageType.HostConfig,\n callback: this.#handleConfigChangeEvent.bind(this),\n });\n this.#remoting.listen<void>({\n messageType: MessageType.GuestFocus,\n callback: this.#handleFocusEvent.bind(this),\n });\n // Let the host know the guest is ready for events, and send along\n // the guests's capabilities to allow for compatibility with future\n // host versions\n this.#remoting.send({\n targetWin: this.#hostWindow,\n targetOrigin: this.#hostOrigin,\n messageType: MessageType.GuestReady,\n messageBody: guestOptions,\n });\n this.#isConnected = true;\n this.#logger.audit({\n message: 'Guest connected to host',\n guestUrl: window.location.href,\n });\n }\n };\n\n /**\n * Get scripting object proxy by id\n * @param objectId unique id of the scripting object\n * @returns scripting object proxy\n */\n getObject = async (objectId: string) => {\n this.#logger.debug(\n `Retrieving scripting object \"${objectId}\" from host...`,\n );\n const response = await this.#remoting.invoke<ObjectResponse>({\n targetWin: this.#hostWindow!,\n targetOrigin: this.#hostOrigin!,\n messageType: MessageType.ObjectGet,\n messageBody: {\n objectId,\n },\n });\n const obj = this.#fromJSON(response.object);\n this.#logger.audit({\n message: 'Received scripting object from host',\n scriptingObject: objectId,\n ...this.#getGuestInfo(),\n });\n return obj;\n };\n\n /**\n * remove the guest from the host\n */\n removeScript = () => {\n if (!this.#created) return;\n if (this.#scriptElement) {\n const { parentNode } = this.#scriptElement;\n parentNode?.removeChild?.(this.#scriptElement);\n }\n };\n\n /**\n * Set the log level\n * @param {LogLevels} logLevel - log level\n * @param level\n */\n setLogLevel = (level: LogLevels) => {\n this.#logger.setLogLevel(level);\n this.#logger.debug(`Log level changed by guest to ${level}`);\n };\n\n /**\n * subscribe to an scripting object event\n * @param {GuestSubscribeParam<EventId, AppEvents[EventId]>} param - parameters for subscribing to an event\n * @returns subscription token\n */\n subscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: GuestSubscribeParam<EventId, AppEvents[EventId]>,\n ) => {\n const { eventId, callback } = param;\n this.#logger.debug(`Registering subscription for event ${eventId}`);\n const listeners = this.#eventListeners.get(eventId) || [];\n const token = uuidv4();\n listeners.push({ callback, token });\n this.#eventListeners.set(eventId, listeners);\n return token;\n };\n\n /**\n * unsubscribe from an scripting object event\n * @param {GuestUnsubscribeParam<EventId>} param - parameters for unsubscribing from an event\n */\n unsubscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: GuestUnsubscribeParam<EventId>,\n ) => {\n const { eventId, token } = param;\n let listeners = this.#eventListeners.get(eventId);\n if (listeners) {\n listeners = listeners.filter(\n (callbackInfo) => callbackInfo.token !== token,\n );\n this.#eventListeners.set(eventId, listeners);\n }\n };\n}\n"],"names":["root","factory","__WEBPACK_EXTERNAL_MODULE__270__","module","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","exports","definition","key","obj","prop","getRandomValues","rnds8","rng","byteToHex","unsafeStringify","arr","offset","stringify","uuid","v4","options","buf","rnds","i","MESSAGE_SOURCE","RESPONSE_MESSAGE_TYPE","EXCEPTION_MESSAGE_TYPE","createMessage","messageType","messageBody","onewayMsg","sendMessage","param","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","origin","window2","win","responseTimeoutMs","resolve","reject","items","response","ex","MessageType","MessageType2","Event","name","requiresFeedback","so","isEvent","value","getEventId","objectId","eventName","Proxy","objectType","ProxyEvent","getParentWindowLocation","parent","getOrigin","url","isEmbedded","getComputedStyle","el","bodyElement","retVal","propValue","originsRegex","getHostDetails","event","source","type","window","ResponseType","capabilities","onLoad","document","iframeBody","iframeHTML","size","DIAGNOSTICS_URL","SSFGuest","#remoting","#created","#scriptElement","#isConnected","#eventListeners","#id","#title","#url","#hostOrigin","#hostWindow","logToConsole","index","team","appName","transport","#getGuestInfo","#fromJSON","soJSON","ctrl","functionName","args","#invoke","functionParams","promises","p","val","#handleResponse","#handleConfigChangeEvent","body","#handleFocusEvent","#handleObjectEvent","object","eventId","listeners","callbackInfo","values","scriptUri","containerElement","scriptEle","onScriptLoad","guestWindow","guestOptions","clonedOptions","hostDetails","parentNode","level","token"],"sourceRoot":""}