@elliemae/ssf-host 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # Manual Testing
2
+
3
+ - [V2 Host V2 Guest](http://localhost:4000/index.html)
4
+ - [V2 Host V1 Guest](http://localhost:4000/v2-host-v1-guest.html)
5
+ - [V1 Host V2 Guest](http://localhost:4000/v1-host.html)
package/dist/cjs/host.js CHANGED
@@ -72,8 +72,7 @@ class SSFHost {
72
72
  */
73
73
  constructor(hostId, option) {
74
74
  this.hostId = hostId;
75
- if (!option?.logger)
76
- throw new Error("Logger is required");
75
+ if (!option?.logger) throw new Error("Logger is required");
77
76
  this.#logger = option.logger;
78
77
  this.#correlationId = (0, import_uuid.v4)();
79
78
  this.#remoting = new import_microfe_common.Remoting(this.#logger, this.#correlationId);
@@ -102,8 +101,7 @@ class SSFHost {
102
101
  */
103
102
  #getGuestForWindow = (guestWindow) => {
104
103
  for (const guest of this.#guests.values()) {
105
- if (guest.window === guestWindow)
106
- return guest;
104
+ if (guest.window === guestWindow) return guest;
107
105
  }
108
106
  return null;
109
107
  };
@@ -114,8 +112,7 @@ class SSFHost {
114
112
  */
115
113
  #getGuestForUrl = (url) => {
116
114
  for (const guest of this.#guests.values()) {
117
- if (guest.url === url)
118
- return guest;
115
+ if (guest.url === url) return guest;
119
116
  }
120
117
  return null;
121
118
  };
@@ -253,8 +250,7 @@ class SSFHost {
253
250
  }
254
251
  };
255
252
  #handleGuestClose = ({ sourceWin }) => {
256
- if (sourceWin?.window)
257
- this.unloadGuest(sourceWin);
253
+ if (sourceWin?.window) this.unloadGuest(sourceWin);
258
254
  };
259
255
  // Handles object get requests from the remote automation framework
260
256
  #handleObjectGet = ({
@@ -486,8 +482,7 @@ class SSFHost {
486
482
  { key: "top", value: top },
487
483
  { key: "left", value: left }
488
484
  ].reduce((acc, cur, curIndex) => {
489
- if (curIndex > 0 && cur.value)
490
- acc += ",";
485
+ if (curIndex > 0 && cur.value) acc += ",";
491
486
  return cur.value ? `${acc}${cur.key}=${cur.value}` : acc;
492
487
  }, "");
493
488
  const guestWindow = window.open(url, title, `popup, ${windowFeatures}`);
@@ -521,10 +516,8 @@ class SSFHost {
521
516
  sandboxValues = [],
522
517
  style = ""
523
518
  } = options;
524
- if (!title)
525
- throw new Error("title is required");
526
- if (fitToContent)
527
- this.#subscribeToGuestResizeEvent();
519
+ if (!title) throw new Error("title is required");
520
+ if (fitToContent) this.#subscribeToGuestResizeEvent();
528
521
  const frame = targetElementDocument.createElement("iframe");
529
522
  frame.setAttribute("id", guestId);
530
523
  frame.addEventListener("load", () => {
@@ -578,10 +571,8 @@ class SSFHost {
578
571
  * @returns cloned version of the scripting object
579
572
  */
580
573
  cloneScriptingObject = (proxy, guest) => {
581
- if (!proxy)
582
- throw new Error("proxy is required");
583
- if (!guest)
584
- throw new Error("guest is required");
574
+ if (!proxy) throw new Error("proxy is required");
575
+ if (!guest) throw new Error("guest is required");
585
576
  const so = new import_microfe_common.ScriptingObject(proxy.id, proxy.objectType);
586
577
  let unsubscribers = [];
587
578
  Object.keys(proxy).forEach((propName) => {
@@ -776,8 +767,7 @@ class SSFHost {
776
767
  searchParams = {},
777
768
  options = {}
778
769
  } = param;
779
- if (!guestId)
780
- throw new Error("id for guest application is required");
770
+ if (!guestId) throw new Error("id for guest application is required");
781
771
  const { openMode = import_types.OpenMode.Embed, popupWindowFeatures = {} } = options;
782
772
  const srcUrl = this.#getGuestUrl(url, searchParams);
783
773
  let guest = null;
@@ -77,6 +77,8 @@ class AppraisalService extends import_microfe_common.ScriptingObject {
77
77
  delete = () => {
78
78
  throw new Error("Not implemented");
79
79
  };
80
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
81
+ showError = (data) => Promise.resolve();
80
82
  unload = async () => {
81
83
  };
82
84
  }
@@ -43,6 +43,8 @@ class FloodService extends import_microfe_common.ScriptingObject {
43
43
  });
44
44
  getCapabilities = () => Promise.resolve({});
45
45
  getParameters = () => Promise.resolve({});
46
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
47
+ showError = (data) => Promise.resolve();
46
48
  unload = () => Promise.resolve();
47
49
  _dispose = () => {
48
50
  };
@@ -59,8 +59,7 @@ const postMessage = ({
59
59
  };
60
60
  const initGuest = (guestId) => {
61
61
  const { contentWindow: guestWindow } = document.getElementById(guestId) || {};
62
- if (!guestWindow)
63
- throw new Error("Could not find guest window");
62
+ if (!guestWindow) throw new Error("Could not find guest window");
64
63
  postMessage({
65
64
  srcWindow: guestWindow,
66
65
  targetWindow: guestWindow.parent,
package/dist/cjs/utils.js CHANGED
@@ -27,8 +27,7 @@ __export(utils_exports, {
27
27
  });
28
28
  module.exports = __toCommonJS(utils_exports);
29
29
  const getOrigin = (url) => {
30
- if (url === "about:blank")
31
- return "*";
30
+ if (url === "about:blank") return "*";
32
31
  const { origin } = new URL(url);
33
32
  return origin === "null" || !origin ? url : origin;
34
33
  };
package/dist/esm/host.js CHANGED
@@ -58,8 +58,7 @@ class SSFHost {
58
58
  */
59
59
  constructor(hostId, option) {
60
60
  this.hostId = hostId;
61
- if (!option?.logger)
62
- throw new Error("Logger is required");
61
+ if (!option?.logger) throw new Error("Logger is required");
63
62
  this.#logger = option.logger;
64
63
  this.#correlationId = uuidv4();
65
64
  this.#remoting = new Remoting(this.#logger, this.#correlationId);
@@ -88,8 +87,7 @@ class SSFHost {
88
87
  */
89
88
  #getGuestForWindow = (guestWindow) => {
90
89
  for (const guest of this.#guests.values()) {
91
- if (guest.window === guestWindow)
92
- return guest;
90
+ if (guest.window === guestWindow) return guest;
93
91
  }
94
92
  return null;
95
93
  };
@@ -100,8 +98,7 @@ class SSFHost {
100
98
  */
101
99
  #getGuestForUrl = (url) => {
102
100
  for (const guest of this.#guests.values()) {
103
- if (guest.url === url)
104
- return guest;
101
+ if (guest.url === url) return guest;
105
102
  }
106
103
  return null;
107
104
  };
@@ -239,8 +236,7 @@ class SSFHost {
239
236
  }
240
237
  };
241
238
  #handleGuestClose = ({ sourceWin }) => {
242
- if (sourceWin?.window)
243
- this.unloadGuest(sourceWin);
239
+ if (sourceWin?.window) this.unloadGuest(sourceWin);
244
240
  };
245
241
  // Handles object get requests from the remote automation framework
246
242
  #handleObjectGet = ({
@@ -472,8 +468,7 @@ class SSFHost {
472
468
  { key: "top", value: top },
473
469
  { key: "left", value: left }
474
470
  ].reduce((acc, cur, curIndex) => {
475
- if (curIndex > 0 && cur.value)
476
- acc += ",";
471
+ if (curIndex > 0 && cur.value) acc += ",";
477
472
  return cur.value ? `${acc}${cur.key}=${cur.value}` : acc;
478
473
  }, "");
479
474
  const guestWindow = window.open(url, title, `popup, ${windowFeatures}`);
@@ -507,10 +502,8 @@ class SSFHost {
507
502
  sandboxValues = [],
508
503
  style = ""
509
504
  } = options;
510
- if (!title)
511
- throw new Error("title is required");
512
- if (fitToContent)
513
- this.#subscribeToGuestResizeEvent();
505
+ if (!title) throw new Error("title is required");
506
+ if (fitToContent) this.#subscribeToGuestResizeEvent();
514
507
  const frame = targetElementDocument.createElement("iframe");
515
508
  frame.setAttribute("id", guestId);
516
509
  frame.addEventListener("load", () => {
@@ -564,10 +557,8 @@ class SSFHost {
564
557
  * @returns cloned version of the scripting object
565
558
  */
566
559
  cloneScriptingObject = (proxy, guest) => {
567
- if (!proxy)
568
- throw new Error("proxy is required");
569
- if (!guest)
570
- throw new Error("guest is required");
560
+ if (!proxy) throw new Error("proxy is required");
561
+ if (!guest) throw new Error("guest is required");
571
562
  const so = new ScriptingObject(proxy.id, proxy.objectType);
572
563
  let unsubscribers = [];
573
564
  Object.keys(proxy).forEach((propName) => {
@@ -762,8 +753,7 @@ class SSFHost {
762
753
  searchParams = {},
763
754
  options = {}
764
755
  } = param;
765
- if (!guestId)
766
- throw new Error("id for guest application is required");
756
+ if (!guestId) throw new Error("id for guest application is required");
767
757
  const { openMode = OpenMode.Embed, popupWindowFeatures = {} } = options;
768
758
  const srcUrl = this.#getGuestUrl(url, searchParams);
769
759
  let guest = null;
@@ -56,6 +56,8 @@ class AppraisalService extends ScriptingObject {
56
56
  delete = () => {
57
57
  throw new Error("Not implemented");
58
58
  };
59
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
60
+ showError = (data) => Promise.resolve();
59
61
  unload = async () => {
60
62
  };
61
63
  }
@@ -19,6 +19,8 @@ class FloodService extends ScriptingObject {
19
19
  });
20
20
  getCapabilities = () => Promise.resolve({});
21
21
  getParameters = () => Promise.resolve({});
22
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
23
+ showError = (data) => Promise.resolve();
22
24
  unload = () => Promise.resolve();
23
25
  _dispose = () => {
24
26
  };
@@ -33,8 +33,7 @@ const postMessage = ({
33
33
  };
34
34
  const initGuest = (guestId) => {
35
35
  const { contentWindow: guestWindow } = document.getElementById(guestId) || {};
36
- if (!guestWindow)
37
- throw new Error("Could not find guest window");
36
+ if (!guestWindow) throw new Error("Could not find guest window");
38
37
  postMessage({
39
38
  srcWindow: guestWindow,
40
39
  targetWindow: guestWindow.parent,
package/dist/esm/utils.js CHANGED
@@ -1,6 +1,5 @@
1
1
  const getOrigin = (url) => {
2
- if (url === "about:blank")
3
- return "*";
2
+ if (url === "about:blank") return "*";
4
3
  const { origin } = new URL(url);
5
4
  return origin === "null" || !origin ? url : origin;
6
5
  };
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.eaa0b00b260857069b85.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center"><div class="px-2">ICE Mortgage Product</div></header><main class="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8"><div class="min-w-0 flex-1 mt-4"><h1 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">Loan Application</h1></div><div id="successFeedback" class="hidden rounded-md bg-green-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg></div><div class="ml-3"><p class="text-sm font-medium text-green-800">Loan Saved Successfully</p></div></div></div><div id="errorFeedback" class="hidden rounded-md bg-red-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/></svg></div><div class="ml-3"><h3 class="text-sm font-medium text-red-800">Credit Score is not meeting the requirement</h3></div></div></div><div class="mt-2 sm:grid sm:grid-cols-2 sm:gap-2"><form class="px-2 py-2 space-y-8 divide-y divide-gray-200 bg-gray-50"><div class="space-y-8 divide-y divide-gray-200 sm:space-y-5"><div class="space-y-6 sm:space-y-5"><div><h3 class="text-lg font-medium leading-6 text-gray-900">Personal Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="firstName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">First name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="firstName" id="firstName" autocomplete="given-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="John" placeholder="John"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="lastName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Last name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="lastName" id="lastName" autocomplete="family-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="Doe" placeholder="Doe"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="ssn" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">SSN</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="ssn" id="ssn" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="123456789" placeholder="123456789"/></div></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Loan Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="amount" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Amount</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="amount" id="amount" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="500000" placeholder="500000"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="Term" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Term (years)</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="term" id="term" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="30" placeholder="30"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="downPayment" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Down Payment</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="downPayment" id="downPayment" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="50000" placeholder="50000"/></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Order Services</h3></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><div class="mt-1 sm:mt-0"><button id="title" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M7.502 6h7.128A3.375 3.375 0 0118 9.375v9.375a3 3 0 003-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 00-.673-.05A3 3 0 0015 1.5h-1.5a3 3 0 00-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6zM13.5 3A1.5 1.5 0 0012 4.5h4.5A1.5 1.5 0 0015 3h-1.5z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 013 20.625V9.375zM6 12a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V12zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 15a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V15zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 18a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V18zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75z" clip-rule="evenodd"/></svg> Title</button></div><div class="mt-1 sm:mt-0"><button id="credit" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M2.25 13.5a8.25 8.25 0 018.25-8.25.75.75 0 01.75.75v6.75H18a.75.75 0 01.75.75 8.25 8.25 0 01-16.5 0z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M12.75 3a.75.75 0 01.75-.75 8.25 8.25 0 018.25 8.25.75.75 0 01-.75.75h-7.5a.75.75 0 01-.75-.75V3z" clip-rule="evenodd"/></svg> Credit Score</button></div></div></div></div></div><div class="flex flex-col"><button id="saveLoan" type="button" class="rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Save</button></div></form><div id="aside-container" class="flex flex-col gap-4 items-start mt-4 border-2 p-2 rounded-lg border-dashed border-cyan-300 sm:mt-0"></div></div><div id="bottom-container" class="flex flex-col gap-4 items-start mt-4 p-2 sm:mt-0"></div></main><script src="./init.js" type="module"></script></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.2501bfc6efe7a16df1a3.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center"><div class="px-2">ICE Mortgage Product</div></header><main class="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8"><div class="min-w-0 flex-1 mt-4"><h1 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">Loan Application</h1></div><div id="successFeedback" class="hidden rounded-md bg-green-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg></div><div class="ml-3"><p class="text-sm font-medium text-green-800">Loan Saved Successfully</p></div></div></div><div id="errorFeedback" class="hidden rounded-md bg-red-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/></svg></div><div class="ml-3"><h3 class="text-sm font-medium text-red-800">Credit Score is not meeting the requirement</h3></div></div></div><div class="mt-2 sm:grid sm:grid-cols-2 sm:gap-2"><form class="px-2 py-2 space-y-8 divide-y divide-gray-200 bg-gray-50"><div class="space-y-8 divide-y divide-gray-200 sm:space-y-5"><div class="space-y-6 sm:space-y-5"><div><h3 class="text-lg font-medium leading-6 text-gray-900">Personal Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="firstName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">First name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="firstName" id="firstName" autocomplete="given-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="John" placeholder="John"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="lastName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Last name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="lastName" id="lastName" autocomplete="family-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="Doe" placeholder="Doe"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="ssn" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">SSN</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="ssn" id="ssn" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="123456789" placeholder="123456789"/></div></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Loan Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="amount" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Amount</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="amount" id="amount" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="500000" placeholder="500000"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="Term" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Term (years)</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="term" id="term" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="30" placeholder="30"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="downPayment" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Down Payment</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="downPayment" id="downPayment" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="50000" placeholder="50000"/></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Order Services</h3></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><div class="mt-1 sm:mt-0"><button id="title" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M7.502 6h7.128A3.375 3.375 0 0118 9.375v9.375a3 3 0 003-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 00-.673-.05A3 3 0 0015 1.5h-1.5a3 3 0 00-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6zM13.5 3A1.5 1.5 0 0012 4.5h4.5A1.5 1.5 0 0015 3h-1.5z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 013 20.625V9.375zM6 12a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V12zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 15a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V15zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 18a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V18zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75z" clip-rule="evenodd"/></svg> Title</button></div><div class="mt-1 sm:mt-0"><button id="credit" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M2.25 13.5a8.25 8.25 0 018.25-8.25.75.75 0 01.75.75v6.75H18a.75.75 0 01.75.75 8.25 8.25 0 01-16.5 0z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M12.75 3a.75.75 0 01.75-.75 8.25 8.25 0 018.25 8.25.75.75 0 01-.75.75h-7.5a.75.75 0 01-.75-.75V3z" clip-rule="evenodd"/></svg> Credit Score</button></div></div></div></div></div><div class="flex flex-col"><button id="saveLoan" type="button" class="rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Save</button></div></form><div id="aside-container" class="flex flex-col gap-4 items-start mt-4 border-2 p-2 rounded-lg border-dashed border-cyan-300 sm:mt-0"></div></div><div id="bottom-container" class="flex flex-col gap-4 items-start mt-4 p-2 sm:mt-0"></div></main><script src="./init.js" type="module"></script></body></html>
@@ -1,3 +1,3 @@
1
1
  (function(v,b){typeof exports=="object"&&typeof module=="object"?module.exports=b():typeof define=="function"&&define.amd?define([],b):typeof exports=="object"?exports.ice=b():(v.ice=v.ice||{},v.ice.host=b())})(globalThis,()=>(()=>{"use strict";var w={};w.d=(n,e)=>{for(var t in e)w.o(e,t)&&!w.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},w.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),w.r=n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var v={};w.r(v),w.d(v,{Event:()=>b,Guest:()=>P,IFrameSandboxValues:()=>m,OpenMode:()=>f,SSFHost:()=>J,ScriptingObject:()=>I});class b{scriptingObject;name;objectId;requiresFeedback;id;constructor(e){const{name:t,requiresFeedback:i=!1,so:s}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object is required");this.scriptingObject=s,this.objectId=s.id,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase(),this.requiresFeedback=i}}const _=n=>n instanceof b,Y=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`,x="function",C=(n,e)=>typeof n===x&&!!e&&!e.startsWith("_");class I{#e;#t="Object";constructor(e,t){this.#e=e,this.#t=t||this.#t}get id(){return this.#e}get objectType(){return this.#t}_toJSON=()=>{const e=[],t=[];return Object.keys(this).forEach(i=>{const s=this[i];_(s)?t.push(i):C(s,i)&&e.push(i)}),{objectId:this.#e,objectType:this.#t,functions:e,events:t}};_dispose=()=>{};dispose=()=>{}}var p=(n=>(n.GuestReady="guest:ready",n.GuestClose="guest:close",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.GuestFocus="guest:focus",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.ObjectInvoke="object:invoke",n.ObjectGet="object:get",n.ObjectEvent="object:event",n.HostConfig="host:config",n))(p||{}),f=(n=>(n.Popup="popup",n.Embed="embed",n))(f||{}),m=(n=>(n.AllowDownloadsWithoutUserActivation="allow-downloads-without-user-activation",n.AllowDownloads="allow-downloads",n.AllowForms="allow-forms",n.AllowModals="allow-modals",n.AllowOrientationLock="allow-orientation-lock",n.AllowPointerLock="allow-pointer-lock",n.AllowPopups="allow-popups",n.AllowPopupsToEscapeSandbox="allow-popups-to-escape-sandbox",n.AllowPresentation="allow-presentation",n.AllowSameOrigin="allow-same-origin",n.AllowScripts="allow-scripts",n.AllowStorageAccessByUserActivation="allow-storage-access-by-user-activation",n.AllowTopNavigation="allow-top-navigation",n.AllowTopNavigationByUserActivation="allow-top-navigation-by-user-activation",n))(m||{});const U=n=>{if(n==="about:blank")return"*";const{origin:e}=new URL(n);return e==="null"||!e?n:e},$=(n,e=[])=>{const t=e||[];return n&&n.forEach?n.forEach(i=>{$(i,t)}):typeof n<"u"&&t.push(n),t},K=n=>typeof n?._toJSON=="function";function k(n){return typeof n=="function"}const L=n=>n?.constructor?.name==="Proxy",Q=n=>n?.id??n;class P{id;title;url;searchParams;domElement;window;openMode;origin;initialized=!1;ready=!1;capabilities;#e;constructor(e){const{guestId:t,domElement:i=null,title:s,url:o,window:r,searchParams:c={},openMode:a=f.Embed,remoting:l}=e;this.id=t,this.title=s,this.url=o,this.origin=U(o),this.searchParams=c,this.domElement=i,this.window=r,this.openMode=a,this.capabilities={},this.#e=l}dispose=()=>{this.#e.removeSender({origin:this.origin,window:this.window}),this.openMode===f.Popup?this.window.close():this.domElement?.remove?.()};getInfo=()=>({guestId:this.id,guestTitle:this.title,guestUrl:this.url});init=()=>{if(this.#e.addSender({origin:this.origin,window:this.window}),this.openMode===f.Popup){const e=setInterval(()=>{this.#e.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HandShake,messageBody:{}})},1e3);this.#e.listen({messageType:p.HandShakeAck,callback:()=>{clearInterval(e)}})}};dispatchEvent=(e,t)=>this.#e.invoke({targetWin:this.window,targetOrigin:this.origin,messageType:p.ObjectEvent,messageBody:e,responseTimeoutMs:t});send=e=>{this.#e.send({targetWin:this.window,targetOrigin:this.origin,...e})}}const G={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let j;const z=new Uint8Array(16);function D(){if(!j&&(j=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!j))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return j(z)}const h=[];for(let n=0;n<256;++n)h.push((n+256).toString(16).slice(1));function A(n,e=0){return h[n[e+0]]+h[n[e+1]]+h[n[e+2]]+h[n[e+3]]+"-"+h[n[e+4]]+h[n[e+5]]+"-"+h[n[e+6]]+h[n[e+7]]+"-"+h[n[e+8]]+h[n[e+9]]+"-"+h[n[e+10]]+h[n[e+11]]+h[n[e+12]]+h[n[e+13]]+h[n[e+14]]+h[n[e+15]]}function V(n,e=0){const t=A(n,e);if(!validate(t))throw TypeError("Stringified UUID is invalid");return t}const ee=null;function N(n,e,t){if(G.randomUUID&&!e&&!n)return G.randomUUID();n=n||{};const i=n.random||(n.rng||D)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=i[s];return e}return A(i)}const R=N,q="elli:remoting",T="elli:remoting:response",M="elli:remoting:exception",E=({messageType:n,messageBody:e,onewayMsg:t=!1})=>({requestId:t?null:R(),source:q,type:n,body:e}),te=n=>{const{targetWin:e,targetOrigin:t,messageType:i,messageBody:s}=n,o=E({messageType:i,messageBody:s});e.postMessage(o,t)};class B{#e;#t;#i=new Map;#s=new Map;#n=null;#o=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#e=t,this.#t=e}#a=()=>{const e=Date.now(),t=[];this.#s.forEach((i,s)=>{const{requestId:o,cancelTime:r}=i;this.#t.debug(`Checking response timeout for requestId: ${o}) @ ${r??""}`),i.cancelTime&&i.cancelTime<e&&(this.#t.debug(`Detected response timeout for requestId: ${o}...`),t.push(s),i.resolve(),this.#t.debug(`Aborted waiting for response to requestid: ${o})`))}),t.forEach(i=>{this.#t.debug(`removing invocations with requestId ${i} from cache since response time has expired`),this.#s.delete(i)}),this.#s.size===0&&(this.#t.debug("stopping response monitor"),this.#r())};#d=()=>{this.#n===null&&(this.#t.debug("Staring response timeout evaluator"),this.#n=window.setInterval(this.#a,200))};#r=()=>{this.#n!==null&&(window.clearInterval(this.#n),this.#n=null,this.#t.debug("Stopped response timeout evaluator"))};#l=e=>{const t=this.#s.get(e);return this.#t.debug(`serving requestId: ${e}`),this.#s.delete(e),t};#h=e=>{const{requestId:t}=e;this.#t.debug(`Response received for invocation requestId: ${t}`);const i=this.#l(t);return i?(i.resolve(e.body),!0):(this.#t.warn(`Received response to stale/invalid request with requestId: ${t}`),!1)};#u=e=>{this.#t.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#l(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#t.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#g=({sourceWin:e,sourceOrigin:t,message:i})=>{this.#t.debug(`Received message of type "${i.type}"`);const s=this.#i.get(i.type);return s?(s.forEach(o=>{this.#t.debug(`Invoking message handler ${o.name}`),o({sourceWin:e,sourceOrigin:t,requestId:i.requestId,type:i.type,body:i.body})}),!0):!1};#c=e=>{if(this.#t.debug(`Remoting: Received message ${JSON.stringify(e.data)}`),this.#o.size===0||!e.source)return!1;const t=this.#o.get(e.source);return!t||e?.data?.source!==q?!1:(e.data.type===T?this.#h(e.data):e.data.type===M?this.#u(e.data):this.#g({sourceWin:e.source,sourceOrigin:t,message:e.data}),!0)};addSender=e=>{const{origin:t,window:i}=e;if(!t)throw new Error("origin is required");if(!i)throw new Error("window is required");this.#o.set(i,t)};initialize=e=>{e.removeEventListener("message",this.#c),e.addEventListener("message",this.#c),this.#t.debug(`initialized remoting id: ${this.#e}`)};close=()=>{window.removeEventListener("message",this.#c),this.#t.debug(`closed remoting id: ${this.#e}`)};invoke=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o,responseTimeoutMs:r}=e;return new Promise((c,a)=>{const l=E({messageType:s,messageBody:o});this.#s.set(l.requestId,{requestId:l.requestId,resolve:c,reject:a,cancelTime:r?Date.now()+Number.parseInt(r,10):null}),t.postMessage(l,i);const{requestId:g}=l;this.#t.debug(`Posted invocation message of type ${s} requestId: ${g||""}`),r&&(this.#t.debug(`starting response monitor for requestId: ${g||""} for ${r} ms`),this.#d())})};listen=e=>{const{messageType:t,callback:i}=e,s=this.#i.get(t)||[];s.push(i),this.#i.set(t,s)};send=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o}=e,r=E({messageType:s,messageBody:o,onewayMsg:!0});t.postMessage(r,i),this.#t.debug(`Posted one-way message of type "${s}"`)};removeSender=e=>{const{window:t}=e;t&&this.#o.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:i,requestId:s,response:o}=e,r=E({messageType:T,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#t.debug(`Response sent to caller for invocation requestId: ${s}`)};raiseException=e=>{const{targetWin:t,targetOrigin:i,requestId:s,ex:o}=e,r=E({messageType:M,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#t.debug(`Exception sent to caller for invocation. requestId: ${s}`)}}var F=(n=>(n.USER="USER",n.PARTNER="PARTNER",n))(F||{});class W{#e=new Map;#t=new Map;#i=e=>{const{so:t,guestId:i}=e,s=t.id.toLowerCase(),o=this.#t.get(i);if(!o)this.#t.set(i,new Map([[s,e]]));else{if(o.has(s))throw new Error(`Scripting Object ${t.id} already exists for guest ${i}`);o.set(s,e)}};#s=({so:e})=>{e._dispose&&typeof e._dispose=="function"&&e._dispose()};#n=({objectId:e,guestId:t})=>{const i=this.#t.get(t);return i?i.get(e)??null:null};#o=({objectId:e,guestId:t}={})=>{if(t){if(!e){const s=this.#t.get(t);s&&s.forEach(this.#s),this.#t.delete(t);return}const i=this.#t.get(t);if(i){const s=i.get(e);s&&this.#s(s),i.delete(e)}}else e&&this.#t.forEach(i=>{const s=i.get(e);s&&this.#s(s),i.delete(e)})};#a=({so:e,guest:t})=>new Proxy(e,{get(i,s,o){const r=i[s];return r instanceof Function&&s!=="constructor"?function(...c){const a=this;return Object.defineProperty(r,"callContext",{value:t,enumerable:!1,writable:!0}),r.apply(a===o?i:a,c)}:r}});addScriptingObject=(e,t)=>{const{guestId:i}=t||{};if(!e?.id||!e?._toJSON)throw new Error("Object is not derived from ScriptingObject");const s=e.id.toLowerCase();if(s==="module"&&!i)throw new Error("Guest id is required to add Module scripting object");if(i){this.#i({so:e,...t,guestId:i});return}if(this.#e.has(s))throw new Error(`Scripting Object ${e.id} already exists`);this.#e.set(s,{so:e,...t})};getObject=(e,t)=>{const i=e.toLowerCase();let s=null;t?.id&&(s=this.#n({objectId:i,guestId:t.id})),s=s??this.#e.get(i);const{so:o}=s||{};if(!o)return null;if(!t)return o;const r=this.#a({so:o,guest:t});return Object.defineProperty(r,"target",{value:o,enumerable:!1,configurable:!1,writable:!0}),r};removeScriptingObject=(e,t)=>{const i=e.toLowerCase();if(t)this.#o({objectId:i,guestId:t});else{this.#o({objectId:i});const s=this.#e.get(i);s&&this.#s(s),this.#e.delete(i)}};removeAllScriptingObjects=e=>{e?this.#o({guestId:e}):(this.#e.forEach(this.#s),this.#e.clear())}}const H=[m.AllowScripts,m.AllowPopups,m.AllowModals,m.AllowForms,m.AllowDownloads,m.AllowSameOrigin].join(" ");class J{hostId;#e;#t;#i;#s=new Map;#n;#o=null;#a=null;constructor(e,t){if(this.hostId=e,!t?.logger)throw new Error("Logger is required");if(this.#i=t.logger,this.#t=R(),this.#e=new B(this.#i,this.#t),t?.readyStateCallback&&typeof t?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");this.#o=t?.readyStateCallback||null,this.#n=new W,this.#e.initialize(window),this.#O(),this.#I(),this.#i.debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#t}`)}#d=()=>{for(const e of this.#s.values())e.openMode===f.Popup&&this.unloadGuest(e.id)};#r=e=>{for(const t of this.#s.values())if(t.window===e)return t;return null};#l=e=>{for(const t of this.#s.values())if(t.url===e)return t;return null};#h=e=>typeof e?._toJSON=="function";#u=e=>this.#h(e)?{type:"object",object:e._toJSON()}:{type:"value",value:e};#g=e=>typeof e=="string"?e:e instanceof Error?e.message:"An unexpected error occurred in the host application";#c=e=>{e.ready&&this.#e.send({targetWin:e.window,targetOrigin:e.origin,messageType:p.HostConfig,messageBody:{logLevel:this.#i.getLogLevel(),...e.getInfo()}})};#w=({guest:e,obj:t,functionName:i,functionParams:s})=>{const o=t[i];return k(o)?(this.#i.debug(`Invoking host implementation of ${t.id}.${String(i)}()`),new Promise(r=>{Object.prototype.hasOwnProperty.call(o,"callContext")||Object.defineProperty(o,"callContext",{value:{guest:e},enumerable:!0}),r(o(...s))})):(this.#i.warn(`Attempt to call invalid function on object type ${t.objectType}: ${String(i)}`),Promise.reject(new Error(`Method '${i}' not found in Scripting Object '${t.id}'`)))};#p=({sourceWin:e,sourceOrigin:t,requestId:i})=>{const s=this.#r(e);if(!s){this.#i.warn(`Received ready event for unknown guest. requestId: ${i}`);return}if(!s.initialized){this.#i.warn("Guest must be initialized before it is marked as ready"),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Guest must be initialized before it is marked as ready"});return}s.ready||(s.ready=!0,this.#c(s),this.#o?.(s),this.#i.audit({message:"Guest is ready",...s.getInfo()}))};#b=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const o=this.#r(e);if(!o){this.#i.warn(`Received ready event for unknown guest. requestid = ${i}`);return}o.initialized||(o.initialized=!0,o.capabilities=s||{},this.#i.audit({message:"Guest is initialized",...o.getInfo()})),(!s||!s.onReady)&&this.#p({sourceWin:e,sourceOrigin:t,requestId:i,type:"",body:null})};#m=({sourceWin:e})=>{e?.window&&this.unloadGuest(e)};#v=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s;this.#i.debug(`Processing getObject request for object ${o}. requestId = ${i}`);const r=this.#r(e);if(!r)return this.#i.warn("Rejected object request from unknown guest window"),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Specified window is not a known guest"}),!1;const c=this.getScriptingObject(o);return c?(this.#e.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#u(c)}),this.#i.audit({message:"Scripting Object returned",requestId:i,scriptingObject:o,...r.getInfo()}),!0):(this.#i.warn(`unknown or unauthorized object ${o} from guest ${r.id}`),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1)};#y=({sourceWin:e,requestId:t,body:i})=>{const s=this.#r(e);if(!s){this.#i.warn(`Received resize event from unknown guest. requestid = ${t}`);return}s.domElement&&(s.domElement.style.height=`${i.height}px`),this.#i.debug(`Guest ${s.id} resized to ${i.width}x${i.height}`)};#E=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s,r=this.#r(e);if(!r)return this.#i.warn("Rejected method invocation request from unknown guest window"),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Specified window is not a known guest"}),!1;this.#i.debug(`Function ${o}.${String(s.functionName)}() called from guest "${r.id}" (requestId = ${i})`);const c=this.getScriptingObject(o);return c?(this.#w({guest:r,obj:c,functionName:s.functionName,functionParams:s.functionParams}).then(a=>{this.#e.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#u(a)}),this.#i.audit({message:"Value returned for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...r.getInfo()})}).catch(a=>{this.#e.raiseException({targetWin:e,targetOrigin:r.origin,requestId:i,ex:this.#g(a)}),this.#i.audit({message:"Exception thrown for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...r.getInfo()})}),!0):(this.#i.warn(`Invocation of unknown or unauthorized object ${o} from guest ${r.id}`),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1)};#j=()=>{this.#e.listen({messageType:p.GuestResize,callback:this.#y})};#O=()=>{this.#e.listen({messageType:p.GuestReady,callback:this.#b}),this.#e.listen({messageType:p.GuestReadyComplete,callback:this.#p}),this.#e.listen({messageType:p.GuestClose,callback:this.#m}),this.#e.listen({messageType:p.ObjectGet,callback:this.#v}),this.#e.listen({messageType:p.ObjectInvoke,callback:this.#E}),window.addEventListener("visibilitychange",this.#d)};#S=e=>e?.constructor?.name==="ProxyEvent"||typeof e?.subscribe=="function";#f=e=>{const t=new P({...e,remoting:this.#e});return t.init(),this.#s.set(e.guestId,t),t};#I=()=>{this.#a=setInterval(()=>{const e=[];this.#s.forEach(t=>{t.openMode===f.Popup&&t.window.closed&&e.push(t)}),e.forEach(t=>{this.unloadGuest(t.id)})},1e3)};#$=e=>{const{url:t,title:i,popupWindowFeatures:s={},searchParams:o,guestId:r}=e,{width:c=800,height:a=600,top:l=100,left:g=100}=s;let u=this.#l(t);if(u)u.window.closed||u.send({messageType:p.GuestFocus,messageBody:{}});else{const O=[{key:"width",value:c},{key:"height",value:a},{key:"top",value:l},{key:"left",value:g}].reduce((y,S,X)=>(X>0&&S.value&&(y+=","),S.value?`${y}${S.key}=${S.value}`:y),""),d=window.open(t,i,`popup, ${O}`);if(!d)throw new Error("Failed to open guest application in popup window");d.opener=null,u=this.#f({guestId:r,window:d,title:i,url:t,searchParams:o,openMode:f.Popup})}return u};#k=e=>{const{url:t,title:i,targetElement:s,searchParams:o,guestId:r,options:c={}}=e,a=s.ownerDocument??document,{fitToContent:l=!1,disableSandbox:g=!1,sandboxValues:u=[],style:O=""}=c;if(!i)throw new Error("title is required");l&&this.#j();const d=a.createElement("iframe");d.setAttribute("id",r),d.addEventListener("load",()=>{this.#i.debug(`frame loaded for guest with id '${r}'`)}),d.setAttribute("style",`min-width: 100%; height: 100%; border: 0px; ${O}`),g||d.setAttribute("sandbox",`${H} ${u.join(" ")}`),d.setAttribute("title",i),d.setAttribute("src",t),s.appendChild(d);const y=a.getElementById(r);return this.#f({guestId:r,domElement:y,window:y.contentWindow,title:i,url:t,searchParams:o,openMode:f.Embed})};#P=(e,t)=>{let i="";return Object.keys(t).forEach(s=>{i+=`${(i.length?"&":"")+encodeURIComponent(s)}=${encodeURIComponent(t[s])}`}),e+(i?(e.indexOf("?")>=0?"&":"?")+i:"")};addScriptingObject=(e,t)=>{this.#n.addScriptingObject(e,t)};cloneScriptingObject=(e,t)=>{if(!e)throw new Error("proxy is required");if(!t)throw new Error("guest is required");const i=new I(e.id,e.objectType);let s=[];return Object.keys(e).forEach(o=>{const r=e[o];if(this.#S(r)){let c;if(r?.subscribe!=="function"?c=new b({name:r.name||o,requiresFeedback:!1,so:i}):c=new automation.Event,Object.defineProperty(i,o,{value:c,enumerable:!0}),t.subscribe){const a=({eventParams:g,eventOptions:u})=>this.dispatchEvent({event:c,eventParams:g,eventOptions:u}),l=t.subscribe({eventId:r.id,callback:a});s.push(()=>{t.unsubscribe({eventId:r.id,token:l})})}else{const a=r.subscribe?.((l,g,u)=>this.dispatchEvent({event:c,eventParams:g,eventOptions:u}));s.push(()=>{r.unsubscribe?.(a)})}}else if(k(r)&&(Object.defineProperty(i,o,{value:async(...c)=>{const a=await r(...c);return L(a)?this.cloneScriptingObject(a,t):a},enumerable:!0}),o==="dispose")){const c=i.dispose;Object.defineProperty(i,o,{value:()=>(i._dispose(),c.apply(i)),enumerable:!0})}}),i._dispose=()=>{s.forEach(o=>{o?.()}),s=[]},i};close=()=>{clearInterval(this.#a),this.#e.close(),window.removeEventListener("visibilitychange",this.#d),this.#i.debug(`host is closed. hostId: ${this.hostId}, correlationId: ${this.#t}`)};dispatchEvent=async e=>{const{event:{id:t,name:i,scriptingObject:s},eventParams:o,eventOptions:r={}}=e,{eventHandler:c=null,timeout:a=null,window:l=null}=r,g={object:s._toJSON(),eventName:i,eventParams:o,eventHandler:c,eventOptions:{allowsFeedback:!1}};a&&!Number.isNaN(a)&&(g.eventOptions={allowsFeedback:!0,timeout:Number(a)});const u=[];return this.#s.forEach(d=>{(!l||l===d.window)&&(a&&d?.capabilities?.eventFeedback?(u.push(d.dispatchEvent(g,a)),this.#i.audit({message:"Event dispatched and awaiting feedback",scriptingEventId:t,...d.getInfo()})):(d.send({messageType:p.ObjectEvent,messageBody:g}),this.#i.audit({message:"Event dispatched",scriptingEventId:t,...d.getInfo()})))}),await Promise.all(u).then(d=>(this.#i.audit({message:"Event feedback received",scriptingEventId:t}),$(d))).catch(d=>{throw this.#i.error({message:"Error processing event",eventId:t,exception:d}),d})};getGuests=()=>{const e=[];return this.#s.forEach(t=>{e.push(t)}),e};getScriptingObject=e=>this.#n.getObject(e);loadGuest=e=>{const{id:t,url:i,targetElement:s,title:o,searchParams:r={},options:c={}}=e;if(!t)throw new Error("id for guest application is required");const{openMode:a=f.Embed,popupWindowFeatures:l={}}=c,g=this.#P(i,r);let u=null;if(a===f.Popup)u=this.#$({guestId:t,url:g,title:o,searchParams:r,popupWindowFeatures:l});else if(a===f.Embed)u=this.#k({guestId:t,url:g,title:o,targetElement:s,searchParams:r,options:c});else throw new Error(`Invalid openMode: ${a}`);return this.#i.audit({message:"Guest loaded",...u.getInfo()}),u};loadGuests=e=>{const{id:t,url:i,targetElement:s,title:o,searchParamsList:r=[],options:c={}}=e;r.forEach((a,l)=>{this.loadGuest({id:`${t}-${l}`,url:i,title:o,targetElement:s,searchParams:a,options:c})},this)};removeAllScriptingObjects=e=>{this.#n.removeAllScriptingObjects(e)};removeScriptingObject=(e,t)=>{this.#n.removeScriptingObject(e,t)};setLogLevel=e=>{this.#i.setLogLevel(e),this.#s.forEach(this.#c),this.#i.debug("Dispatched config events to all guests")};unloadGuest=e=>{let t=typeof e=="string"?this.#s.get(e):null;if(!t&&(t=Array.from(this.#s.values()).find(i=>i.window===e||i.domElement===e),!t))throw new Error("Invalid guestId or guestWindow reference");t.dispose(),this.#s.delete(t.id),this.#i.audit({message:"Guest is removed from host",...t.getInfo()})}}return v})());
2
2
 
3
- //# sourceMappingURL=emuiSsfHost.eaa0b00b260857069b85.js.map
3
+ //# sourceMappingURL=emuiSsfHost.2501bfc6efe7a16df1a3.js.map