@elliemae/ssf-host 2.7.5 → 2.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/guest.js CHANGED
@@ -109,16 +109,22 @@ class Guest {
109
109
  * clean up resources
110
110
  */
111
111
  dispose = () => {
112
- this.#remoting.removeSender({ origin: this.origin, window: this.window });
113
112
  if (this.openMode === import_types.OpenMode.Popup && !this.window.closed) {
114
113
  try {
115
114
  this.window.document;
116
115
  this.window.close();
117
116
  } catch (e) {
117
+ this.#remoting.send({
118
+ targetWin: this.window,
119
+ targetOrigin: this.origin,
120
+ messageType: import_microfe_common.MessageType.HostClose,
121
+ messageBody: {}
122
+ });
118
123
  }
119
124
  } else {
120
125
  this.domElement?.remove?.();
121
126
  }
127
+ this.#remoting.removeSender({ origin: this.origin, window: this.window });
122
128
  };
123
129
  /**
124
130
  * Get information about the guest application
@@ -130,24 +136,41 @@ class Guest {
130
136
  guestUrl: this.url
131
137
  });
132
138
  /**
133
- * initialize guest messaging
134
- */
135
- init = () => {
136
- this.#remoting.addSender({ origin: this.origin, window: this.window });
137
- if (this.openMode === import_types.OpenMode.Popup) {
138
- const handShakeInterval = setInterval(() => {
139
+ * Handshake with the guest application in the popup window
140
+ * @returns true if the guest popup window is open & connected
141
+ */
142
+ handShake = () => new Promise((resolve) => {
143
+ let handShakeCount = 0;
144
+ const handShakeRetries = 5;
145
+ const handShakeHandle = setInterval(() => {
146
+ if (handShakeCount >= handShakeRetries) {
147
+ clearInterval(handShakeHandle);
148
+ resolve(false);
149
+ } else {
139
150
  this.#remoting.send({
140
151
  targetWin: this.window,
141
152
  targetOrigin: this.origin,
142
153
  messageType: import_microfe_common.MessageType.HandShake,
143
154
  messageBody: {}
144
155
  });
145
- }, 1e3);
146
- this.#remoting.listen({
147
- messageType: import_microfe_common.MessageType.HandShakeAck,
148
- callback: () => {
149
- clearInterval(handShakeInterval);
150
- }
156
+ handShakeCount += 1;
157
+ }
158
+ }, 1e3);
159
+ this.#remoting.listen({
160
+ messageType: import_microfe_common.MessageType.HandShakeAck,
161
+ callback: () => {
162
+ clearInterval(handShakeHandle);
163
+ resolve(true);
164
+ }
165
+ });
166
+ });
167
+ /**
168
+ * initialize guest messaging
169
+ */
170
+ init = () => {
171
+ this.#remoting.addSender({ origin: this.origin, window: this.window });
172
+ if (this.openMode === import_types.OpenMode.Popup) {
173
+ this.handShake().catch(() => {
151
174
  });
152
175
  }
153
176
  };
package/dist/cjs/host.js CHANGED
@@ -44,6 +44,9 @@ class SSFHost {
44
44
  * reference to the remoting object
45
45
  */
46
46
  #remoting;
47
+ /**
48
+ * unique identifier for the host
49
+ */
47
50
  #correlationId;
48
51
  /**
49
52
  * reference to the logger
@@ -88,6 +91,7 @@ class SSFHost {
88
91
  this.#soManager = new import_microfe_common.ScriptingObjectManager();
89
92
  this.#remoting.initialize(window);
90
93
  this.#connect();
94
+ window.addEventListener("beforeunload", this.#closeAllPopupGuests);
91
95
  this.#monitorPopupGuests();
92
96
  this.#logger.debug(
93
97
  `host is initialized. hostId: ${this.hostId}, correlationId: ${this.#correlationId}`
@@ -270,8 +274,18 @@ class SSFHost {
270
274
  });
271
275
  }
272
276
  };
273
- #handleGuestClose = ({ sourceWin }) => {
274
- if (sourceWin?.window) this.unloadGuest(sourceWin);
277
+ /**
278
+ * cleanup the guest reference when it is closed
279
+ * @param param0
280
+ * @param param0.sourceWin
281
+ */
282
+ #handleGuestClose = async ({ sourceWin }) => {
283
+ if (sourceWin?.window) {
284
+ const guest = this.#findGuest(sourceWin);
285
+ if (guest && !await guest.handShake()) {
286
+ this.unloadGuest(sourceWin);
287
+ }
288
+ }
275
289
  };
276
290
  // Handles object get requests from the remote automation framework
277
291
  #handleObjectGet = ({
@@ -428,12 +442,18 @@ class SSFHost {
428
442
  });
429
443
  return true;
430
444
  };
445
+ /**
446
+ * subscribe to guest resize event
447
+ */
431
448
  #subscribeToGuestResizeEvent = () => {
432
449
  this.#remoting.listen({
433
450
  messageType: import_microfe_common.MessageType.GuestResize,
434
451
  callback: this.#handleGuestResize
435
452
  });
436
453
  };
454
+ /**
455
+ * start listening to the remoting messages
456
+ */
437
457
  #connect = () => {
438
458
  this.#remoting.listen({
439
459
  messageType: import_microfe_common.MessageType.GuestReady,
@@ -445,6 +465,7 @@ class SSFHost {
445
465
  });
446
466
  this.#remoting.listen({
447
467
  messageType: import_microfe_common.MessageType.GuestClose,
468
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
448
469
  callback: this.#handleGuestClose
449
470
  });
450
471
  this.#remoting.listen({
@@ -455,8 +476,12 @@ class SSFHost {
455
476
  messageType: import_microfe_common.MessageType.ObjectInvoke,
456
477
  callback: this.#handleObjectInvoke
457
478
  });
458
- window.addEventListener("visibilitychange", this.#closeAllPopupGuests);
459
479
  };
480
+ /**
481
+ * check if the value is a proxy event
482
+ * @param value
483
+ * @returns
484
+ */
460
485
  #isProxyEvent = (value) => (
461
486
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
462
487
  value instanceof import_microfe_common.ProxyEvent || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
@@ -478,6 +503,20 @@ class SSFHost {
478
503
  this.#guests.set(param.guestId, guest);
479
504
  return guest;
480
505
  };
506
+ /**
507
+ * find the guest object by its id, window or dom element
508
+ * @param guestIdOrWindowOrEle id, window or dom element of the guest
509
+ * @returns guest object
510
+ */
511
+ #findGuest = (guestIdOrWindowOrEle) => {
512
+ let guest = typeof guestIdOrWindowOrEle === "string" ? this.#guests.get(guestIdOrWindowOrEle) : null;
513
+ if (!guest) {
514
+ guest = Array.from(this.#guests.values()).find(
515
+ (value) => value.window === guestIdOrWindowOrEle || value.domElement === guestIdOrWindowOrEle
516
+ );
517
+ }
518
+ return guest;
519
+ };
481
520
  #monitorPopupGuests = () => {
482
521
  this.#popupGuestMonitor = setInterval(() => {
483
522
  const guestsToRemove = [];
@@ -558,9 +597,11 @@ class SSFHost {
558
597
  if (fitToContent) this.#subscribeToGuestResizeEvent();
559
598
  const frame = targetElementDocument.createElement("iframe");
560
599
  frame.setAttribute("id", guestId);
561
- frame.addEventListener("load", () => {
600
+ const onFrameLoad = () => {
562
601
  this.#logger.debug(`frame loaded for guest with id '${guestId}'`);
563
- });
602
+ frame.removeEventListener("load", onFrameLoad);
603
+ };
604
+ frame.addEventListener("load", onFrameLoad);
564
605
  frame.setAttribute(
565
606
  "style",
566
607
  `min-width: 100%; height: 100%; border: 0px; ${style}`
@@ -697,7 +738,7 @@ class SSFHost {
697
738
  close = () => {
698
739
  clearInterval(this.#popupGuestMonitor);
699
740
  this.#remoting.close();
700
- window.removeEventListener("visibilitychange", this.#closeAllPopupGuests);
741
+ window.removeEventListener("beforeunload", this.#closeAllPopupGuests);
701
742
  this.#logger.debug(
702
743
  `host is closed. hostId: ${this.hostId}, correlationId: ${this.#correlationId}`
703
744
  );
@@ -914,20 +955,14 @@ class SSFHost {
914
955
  * @throws Error if guestId or Window reference is invalid
915
956
  */
916
957
  unloadGuest = (guestIdOrWindowOrEle) => {
917
- let guest = typeof guestIdOrWindowOrEle === "string" ? this.#guests.get(guestIdOrWindowOrEle) : null;
918
- if (!guest) {
919
- guest = Array.from(this.#guests.values()).find(
920
- (value) => value.window === guestIdOrWindowOrEle || value.domElement === guestIdOrWindowOrEle
921
- );
922
- if (!guest) {
923
- throw new Error("Invalid guestId or guestWindow reference");
924
- }
958
+ const guest = this.#findGuest(guestIdOrWindowOrEle);
959
+ if (guest) {
960
+ guest.dispose();
961
+ this.#guests.delete(guest.id);
962
+ this.#logger.audit({
963
+ message: `Guest is removed from host`,
964
+ ...guest.getInfo()
965
+ });
925
966
  }
926
- guest.dispose();
927
- this.#guests.delete(guest.id);
928
- this.#logger.audit({
929
- message: `Guest is removed from host`,
930
- ...guest.getInfo()
931
- });
932
967
  };
933
968
  }
package/dist/esm/guest.js CHANGED
@@ -86,16 +86,22 @@ class Guest {
86
86
  * clean up resources
87
87
  */
88
88
  dispose = () => {
89
- this.#remoting.removeSender({ origin: this.origin, window: this.window });
90
89
  if (this.openMode === OpenMode.Popup && !this.window.closed) {
91
90
  try {
92
91
  this.window.document;
93
92
  this.window.close();
94
93
  } catch (e) {
94
+ this.#remoting.send({
95
+ targetWin: this.window,
96
+ targetOrigin: this.origin,
97
+ messageType: MessageType.HostClose,
98
+ messageBody: {}
99
+ });
95
100
  }
96
101
  } else {
97
102
  this.domElement?.remove?.();
98
103
  }
104
+ this.#remoting.removeSender({ origin: this.origin, window: this.window });
99
105
  };
100
106
  /**
101
107
  * Get information about the guest application
@@ -107,24 +113,41 @@ class Guest {
107
113
  guestUrl: this.url
108
114
  });
109
115
  /**
110
- * initialize guest messaging
111
- */
112
- init = () => {
113
- this.#remoting.addSender({ origin: this.origin, window: this.window });
114
- if (this.openMode === OpenMode.Popup) {
115
- const handShakeInterval = setInterval(() => {
116
+ * Handshake with the guest application in the popup window
117
+ * @returns true if the guest popup window is open & connected
118
+ */
119
+ handShake = () => new Promise((resolve) => {
120
+ let handShakeCount = 0;
121
+ const handShakeRetries = 5;
122
+ const handShakeHandle = setInterval(() => {
123
+ if (handShakeCount >= handShakeRetries) {
124
+ clearInterval(handShakeHandle);
125
+ resolve(false);
126
+ } else {
116
127
  this.#remoting.send({
117
128
  targetWin: this.window,
118
129
  targetOrigin: this.origin,
119
130
  messageType: MessageType.HandShake,
120
131
  messageBody: {}
121
132
  });
122
- }, 1e3);
123
- this.#remoting.listen({
124
- messageType: MessageType.HandShakeAck,
125
- callback: () => {
126
- clearInterval(handShakeInterval);
127
- }
133
+ handShakeCount += 1;
134
+ }
135
+ }, 1e3);
136
+ this.#remoting.listen({
137
+ messageType: MessageType.HandShakeAck,
138
+ callback: () => {
139
+ clearInterval(handShakeHandle);
140
+ resolve(true);
141
+ }
142
+ });
143
+ });
144
+ /**
145
+ * initialize guest messaging
146
+ */
147
+ init = () => {
148
+ this.#remoting.addSender({ origin: this.origin, window: this.window });
149
+ if (this.openMode === OpenMode.Popup) {
150
+ this.handShake().catch(() => {
128
151
  });
129
152
  }
130
153
  };
package/dist/esm/host.js CHANGED
@@ -31,6 +31,9 @@ class SSFHost {
31
31
  * reference to the remoting object
32
32
  */
33
33
  #remoting;
34
+ /**
35
+ * unique identifier for the host
36
+ */
34
37
  #correlationId;
35
38
  /**
36
39
  * reference to the logger
@@ -75,6 +78,7 @@ class SSFHost {
75
78
  this.#soManager = new ScriptingObjectManager();
76
79
  this.#remoting.initialize(window);
77
80
  this.#connect();
81
+ window.addEventListener("beforeunload", this.#closeAllPopupGuests);
78
82
  this.#monitorPopupGuests();
79
83
  this.#logger.debug(
80
84
  `host is initialized. hostId: ${this.hostId}, correlationId: ${this.#correlationId}`
@@ -257,8 +261,18 @@ class SSFHost {
257
261
  });
258
262
  }
259
263
  };
260
- #handleGuestClose = ({ sourceWin }) => {
261
- if (sourceWin?.window) this.unloadGuest(sourceWin);
264
+ /**
265
+ * cleanup the guest reference when it is closed
266
+ * @param param0
267
+ * @param param0.sourceWin
268
+ */
269
+ #handleGuestClose = async ({ sourceWin }) => {
270
+ if (sourceWin?.window) {
271
+ const guest = this.#findGuest(sourceWin);
272
+ if (guest && !await guest.handShake()) {
273
+ this.unloadGuest(sourceWin);
274
+ }
275
+ }
262
276
  };
263
277
  // Handles object get requests from the remote automation framework
264
278
  #handleObjectGet = ({
@@ -415,12 +429,18 @@ class SSFHost {
415
429
  });
416
430
  return true;
417
431
  };
432
+ /**
433
+ * subscribe to guest resize event
434
+ */
418
435
  #subscribeToGuestResizeEvent = () => {
419
436
  this.#remoting.listen({
420
437
  messageType: MessageType.GuestResize,
421
438
  callback: this.#handleGuestResize
422
439
  });
423
440
  };
441
+ /**
442
+ * start listening to the remoting messages
443
+ */
424
444
  #connect = () => {
425
445
  this.#remoting.listen({
426
446
  messageType: MessageType.GuestReady,
@@ -432,6 +452,7 @@ class SSFHost {
432
452
  });
433
453
  this.#remoting.listen({
434
454
  messageType: MessageType.GuestClose,
455
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
435
456
  callback: this.#handleGuestClose
436
457
  });
437
458
  this.#remoting.listen({
@@ -442,8 +463,12 @@ class SSFHost {
442
463
  messageType: MessageType.ObjectInvoke,
443
464
  callback: this.#handleObjectInvoke
444
465
  });
445
- window.addEventListener("visibilitychange", this.#closeAllPopupGuests);
446
466
  };
467
+ /**
468
+ * check if the value is a proxy event
469
+ * @param value
470
+ * @returns
471
+ */
447
472
  #isProxyEvent = (value) => (
448
473
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
449
474
  value instanceof ProxyEvent || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
@@ -465,6 +490,20 @@ class SSFHost {
465
490
  this.#guests.set(param.guestId, guest);
466
491
  return guest;
467
492
  };
493
+ /**
494
+ * find the guest object by its id, window or dom element
495
+ * @param guestIdOrWindowOrEle id, window or dom element of the guest
496
+ * @returns guest object
497
+ */
498
+ #findGuest = (guestIdOrWindowOrEle) => {
499
+ let guest = typeof guestIdOrWindowOrEle === "string" ? this.#guests.get(guestIdOrWindowOrEle) : null;
500
+ if (!guest) {
501
+ guest = Array.from(this.#guests.values()).find(
502
+ (value) => value.window === guestIdOrWindowOrEle || value.domElement === guestIdOrWindowOrEle
503
+ );
504
+ }
505
+ return guest;
506
+ };
468
507
  #monitorPopupGuests = () => {
469
508
  this.#popupGuestMonitor = setInterval(() => {
470
509
  const guestsToRemove = [];
@@ -545,9 +584,11 @@ class SSFHost {
545
584
  if (fitToContent) this.#subscribeToGuestResizeEvent();
546
585
  const frame = targetElementDocument.createElement("iframe");
547
586
  frame.setAttribute("id", guestId);
548
- frame.addEventListener("load", () => {
587
+ const onFrameLoad = () => {
549
588
  this.#logger.debug(`frame loaded for guest with id '${guestId}'`);
550
- });
589
+ frame.removeEventListener("load", onFrameLoad);
590
+ };
591
+ frame.addEventListener("load", onFrameLoad);
551
592
  frame.setAttribute(
552
593
  "style",
553
594
  `min-width: 100%; height: 100%; border: 0px; ${style}`
@@ -684,7 +725,7 @@ class SSFHost {
684
725
  close = () => {
685
726
  clearInterval(this.#popupGuestMonitor);
686
727
  this.#remoting.close();
687
- window.removeEventListener("visibilitychange", this.#closeAllPopupGuests);
728
+ window.removeEventListener("beforeunload", this.#closeAllPopupGuests);
688
729
  this.#logger.debug(
689
730
  `host is closed. hostId: ${this.hostId}, correlationId: ${this.#correlationId}`
690
731
  );
@@ -901,21 +942,15 @@ class SSFHost {
901
942
  * @throws Error if guestId or Window reference is invalid
902
943
  */
903
944
  unloadGuest = (guestIdOrWindowOrEle) => {
904
- let guest = typeof guestIdOrWindowOrEle === "string" ? this.#guests.get(guestIdOrWindowOrEle) : null;
905
- if (!guest) {
906
- guest = Array.from(this.#guests.values()).find(
907
- (value) => value.window === guestIdOrWindowOrEle || value.domElement === guestIdOrWindowOrEle
908
- );
909
- if (!guest) {
910
- throw new Error("Invalid guestId or guestWindow reference");
911
- }
945
+ const guest = this.#findGuest(guestIdOrWindowOrEle);
946
+ if (guest) {
947
+ guest.dispose();
948
+ this.#guests.delete(guest.id);
949
+ this.#logger.audit({
950
+ message: `Guest is removed from host`,
951
+ ...guest.getInfo()
952
+ });
912
953
  }
913
- guest.dispose();
914
- this.#guests.delete(guest.id);
915
- this.#logger.audit({
916
- message: `Guest is removed from host`,
917
- ...guest.getInfo()
918
- });
919
954
  };
920
955
  }
921
956
  export {
@@ -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.7f8cc77d6015c6099eab.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.5b1e09b1238643895b89.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center"><div class="px-2">ICE Mortgage Product</div></header><main class="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8"><div class="min-w-0 flex-1 mt-4"><h1 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">Loan Application</h1></div><div id="successFeedback" class="hidden rounded-md bg-green-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg></div><div class="ml-3"><p class="text-sm font-medium text-green-800">Loan Saved Successfully</p></div></div></div><div id="errorFeedback" class="hidden rounded-md bg-red-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/></svg></div><div class="ml-3"><h3 class="text-sm font-medium text-red-800">Credit Score is not meeting the requirement</h3></div></div></div><div class="mt-2 sm:grid sm:grid-cols-2 sm:gap-2"><form class="px-2 py-2 space-y-8 divide-y divide-gray-200 bg-gray-50"><div class="space-y-8 divide-y divide-gray-200 sm:space-y-5"><div class="space-y-6 sm:space-y-5"><div><h3 class="text-lg font-medium leading-6 text-gray-900">Personal Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="firstName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">First name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="firstName" id="firstName" autocomplete="given-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="John" placeholder="John"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="lastName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Last name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="lastName" id="lastName" autocomplete="family-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="Doe" placeholder="Doe"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="ssn" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">SSN</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="ssn" id="ssn" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="123456789" placeholder="123456789"/></div></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Loan Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="amount" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Amount</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="amount" id="amount" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="500000" placeholder="500000"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="Term" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Term (years)</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="term" id="term" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="30" placeholder="30"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="downPayment" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Down Payment</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="downPayment" id="downPayment" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="50000" placeholder="50000"/></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Order Services</h3></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><div class="mt-1 sm:mt-0"><button id="title" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M7.502 6h7.128A3.375 3.375 0 0118 9.375v9.375a3 3 0 003-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 00-.673-.05A3 3 0 0015 1.5h-1.5a3 3 0 00-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6zM13.5 3A1.5 1.5 0 0012 4.5h4.5A1.5 1.5 0 0015 3h-1.5z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 013 20.625V9.375zM6 12a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V12zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 15a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V15zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 18a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V18zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75z" clip-rule="evenodd"/></svg> Title</button></div><div class="mt-1 sm:mt-0"><button id="credit" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M2.25 13.5a8.25 8.25 0 018.25-8.25.75.75 0 01.75.75v6.75H18a.75.75 0 01.75.75 8.25 8.25 0 01-16.5 0z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M12.75 3a.75.75 0 01.75-.75 8.25 8.25 0 018.25 8.25.75.75 0 01-.75.75h-7.5a.75.75 0 01-.75-.75V3z" clip-rule="evenodd"/></svg> Credit Score</button></div></div></div></div></div><div class="flex flex-col"><button id="saveLoan" type="button" class="rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Save</button></div></form><div id="aside-container" class="flex flex-col gap-4 items-start mt-4 border-2 p-2 rounded-lg border-dashed border-cyan-300 sm:mt-0"></div></div><div id="bottom-container" class="flex flex-col gap-4 items-start mt-4 p-2 sm:mt-0"></div></main><script src="./init.js" type="module"></script></body></html>
@@ -0,0 +1,3 @@
1
+ (function(E,v){typeof exports=="object"&&typeof module=="object"?module.exports=v():typeof define=="function"&&define.amd?define([],v):typeof exports=="object"?exports.ice=v():(E.ice=E.ice||{},E.ice.host=v())})(globalThis,()=>(()=>{"use strict";var m={};m.d=(n,e)=>{for(var t in e)m.o(e,t)&&!m.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},m.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),m.r=n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var E={};m.r(E),m.d(E,{Event:()=>v,Guest:()=>P,IFrameSandboxValues:()=>y,OpenMode:()=>w,SSFHost:()=>Y,ScriptingObject:()=>I});class v{scriptingObject;name;objectId;requiresFeedback;id;constructor(e){const{name:t,requiresFeedback:i=!1,so:s}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object is required");this.scriptingObject=s,this.objectId=s.id,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase(),this.requiresFeedback=i}}class M{static[Symbol.hasInstance](e){return e.getType?.()==="ProxyEvent"}objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:i}=e;this.objectId=i,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}const _=n=>n instanceof v,Q=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`,x="function",L=(n,e)=>typeof n===x&&!!e&&!e.startsWith("_");class I{#t;#e="Object";constructor(e,t){this.#t=e,this.#e=t||this.#e}get id(){return this.#t}get objectType(){return this.#e}_toJSON=()=>{const e=[],t=[];return Object.keys(this).forEach(i=>{const s=this[i];_(s)?t.push(i):L(s,i)&&e.push(i)}),{objectId:this.#t,objectType:this.#e,functions:e,events:t}};_dispose=()=>{};dispose=()=>{}}var p=(n=>(n.GuestReady="guest:ready",n.GuestClose="guest:close",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.GuestFocus="guest:focus",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.ObjectInvoke="object:invoke",n.ObjectGet="object:get",n.ObjectEvent="object:event",n.HostConfig="host:config",n.HostClose="host:close",n))(p||{}),w=(n=>(n.Popup="popup",n.Embed="embed",n))(w||{}),y=(n=>(n.AllowDownloadsWithoutUserActivation="allow-downloads-without-user-activation",n.AllowDownloads="allow-downloads",n.AllowForms="allow-forms",n.AllowModals="allow-modals",n.AllowOrientationLock="allow-orientation-lock",n.AllowPointerLock="allow-pointer-lock",n.AllowPopups="allow-popups",n.AllowPopupsToEscapeSandbox="allow-popups-to-escape-sandbox",n.AllowPresentation="allow-presentation",n.AllowSameOrigin="allow-same-origin",n.AllowScripts="allow-scripts",n.AllowStorageAccessByUserActivation="allow-storage-access-by-user-activation",n.AllowTopNavigation="allow-top-navigation",n.AllowTopNavigationByUserActivation="allow-top-navigation-by-user-activation",n))(y||{});const z=n=>{if(n==="about:blank")return"*";try{const{origin:e}=new URL(n);return e==="null"||!e?n:e}catch{const{origin:t}=new URL(n,document.baseURI);return t}},$=(n,e=[])=>{const t=e||[];return n&&n.forEach?n.forEach(i=>{$(i,t)}):typeof n<"u"&&t.push(n),t},Z=n=>typeof n?._toJSON=="function";function k(n){return typeof n=="function"}const N=n=>n?.constructor?.name==="Proxy",V=n=>n?.id??n;class P{id;title;url;searchParams;domElement;window;openMode;origin;initialized=!1;ready=!1;capabilities;#t;#e;constructor(e){const{guestId:t,domElement:i=null,title:s,url:o,window:r,searchParams:c={},openMode:a=w.Embed,remoting:d,analyticsObj:l}=e;this.id=t,this.title=s,this.url=o,this.origin=z(o),this.searchParams=c,this.domElement=i,this.window=r,this.openMode=a,this.capabilities={},this.#e=l,this.#t=d}dispose=()=>{if(this.openMode===w.Popup&&!this.window.closed)try{this.window.document,this.window.close()}catch{this.#t.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HostClose,messageBody:{}})}else this.domElement?.remove?.();this.#t.removeSender({origin:this.origin,window:this.window})};getInfo=()=>({guestId:this.id,guestTitle:this.title,guestUrl:this.url});handShake=()=>new Promise(e=>{let t=0;const i=5,s=setInterval(()=>{t>=i?(clearInterval(s),e(!1)):(this.#t.send({targetWin:this.window,targetOrigin:this.origin,messageType:p.HandShake,messageBody:{}}),t+=1)},1e3);this.#t.listen({messageType:p.HandShakeAck,callback:()=>{clearInterval(s),e(!0)}})});init=()=>{this.#t.addSender({origin:this.origin,window:this.window}),this.openMode===w.Popup&&this.handShake().catch(()=>{})};dispatchEvent=(e,t)=>(this.#e.startTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{}),this.#t.invoke({targetWin:this.window,targetOrigin:this.origin,messageType:p.ObjectEvent,messageBody:e,responseTimeoutMs:t}).finally(()=>{this.#e.endTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{})}));send=e=>{this.#t.send({targetWin:this.window,targetOrigin:this.origin,...e})}}const G={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let S;const D=new Uint8Array(16);function B(){if(!S&&(S=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!S))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return S(D)}const h=[];for(let n=0;n<256;++n)h.push((n+256).toString(16).slice(1));function A(n,e=0){return h[n[e+0]]+h[n[e+1]]+h[n[e+2]]+h[n[e+3]]+"-"+h[n[e+4]]+h[n[e+5]]+"-"+h[n[e+6]]+h[n[e+7]]+"-"+h[n[e+8]]+h[n[e+9]]+"-"+h[n[e+10]]+h[n[e+11]]+h[n[e+12]]+h[n[e+13]]+h[n[e+14]]+h[n[e+15]]}function te(n,e=0){const t=A(n,e);if(!validate(t))throw TypeError("Stringified UUID is invalid");return t}const ie=null;function F(n,e,t){if(G.randomUUID&&!e&&!n)return G.randomUUID();n=n||{};const i=n.random||(n.rng||B)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=i[s];return e}return A(i)}const T=F,R="elli:remoting",q="elli:remoting:response",U="elli:remoting:exception",O=({messageType:n,messageBody:e,onewayMsg:t=!1})=>({requestId:t?null:T(),source:R,type:n,body:e}),se=n=>{const{targetWin:e,targetOrigin:t,messageType:i,messageBody:s}=n,o=O({messageType:i,messageBody:s});e.postMessage(o,t)};class H{#t;#e;#i=new Map;#n=new Map;#s=null;#o=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#t=t,this.#e=e}#a=()=>{const e=Date.now(),t=[];this.#n.forEach((i,s)=>{const{requestId:o,cancelTime:r}=i;this.#e.debug(`Checking response timeout for requestId: ${o}) @ ${r??""}`),i.cancelTime&&i.cancelTime<e&&(this.#e.debug(`Detected response timeout for requestId: ${o}...`),t.push(s),i.resolve(),this.#e.debug(`Aborted waiting for response to requestid: ${o})`))}),t.forEach(i=>{this.#e.debug(`removing invocations with requestId ${i} from cache since response time has expired`),this.#n.delete(i)}),this.#n.size===0&&(this.#e.debug("stopping response monitor"),this.#g())};#u=()=>{this.#s===null&&(this.#e.debug("Staring response timeout evaluator"),this.#s=window.setInterval(this.#a,200))};#g=()=>{this.#s!==null&&(window.clearInterval(this.#s),this.#s=null,this.#e.debug("Stopped response timeout evaluator"))};#c=e=>{const t=this.#n.get(e);return this.#e.debug(`serving requestId: ${e}`),this.#n.delete(e),t};#d=e=>{const{requestId:t}=e;this.#e.debug(`Response received for invocation requestId: ${t}`);const i=this.#c(t);return i?(i.resolve(e.body),!0):(this.#e.warn(`Received response to stale/invalid request with requestId: ${t}`),!1)};#h=e=>{this.#e.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#c(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#e.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#r=({sourceWin:e,sourceOrigin:t,message:i})=>{this.#e.debug(`Received message of type "${i.type}"`);const s=this.#i.get(i.type);return s?(s.forEach(o=>{this.#e.debug(`Invoking message handler ${o.name}`),o({sourceWin:e,sourceOrigin:t,requestId:i.requestId,type:i.type,body:i.body})}),!0):!1};#l=e=>{if(this.#e.debug(`Remoting: Received message ${JSON.stringify(e.data)}`),this.#o.size===0||!e.source)return!1;const t=this.#o.get(e.source);return!t||e?.data?.source!==R?!1:(e.data.type===q?this.#d(e.data):e.data.type===U?this.#h(e.data):this.#r({sourceWin:e.source,sourceOrigin:t,message:e.data}),!0)};addSender=e=>{const{origin:t,window:i}=e;if(!t)throw new Error("origin is required");if(!i)throw new Error("window is required");this.#o.set(i,t)};initialize=e=>{e.removeEventListener("message",this.#l),e.addEventListener("message",this.#l),this.#e.debug(`initialized remoting id: ${this.#t}`)};close=()=>{window.removeEventListener("message",this.#l),this.#e.debug(`closed remoting id: ${this.#t}`)};invoke=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o,responseTimeoutMs:r}=e;return new Promise((c,a)=>{const d=O({messageType:s,messageBody:o});this.#n.set(d.requestId,{requestId:d.requestId,resolve:c,reject:a,cancelTime:r?Date.now()+Number.parseInt(r,10):null}),t.postMessage(d,i);const{requestId:l}=d;this.#e.debug(`Posted invocation message of type ${s} requestId: ${l||""}`),r&&(this.#e.debug(`starting response monitor for requestId: ${l||""} for ${r} ms`),this.#u())})};listen=e=>{const{messageType:t,callback:i}=e,s=this.#i.get(t)||[];s.push(i),this.#i.set(t,s)};send=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o}=e,r=O({messageType:s,messageBody:o,onewayMsg:!0});t.postMessage(r,i),this.#e.debug(`Posted one-way message of type "${s}"`)};removeSender=e=>{const{window:t}=e;t&&this.#o.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:i,requestId:s,response:o}=e,r=O({messageType:q,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#e.debug(`Response sent to caller for invocation requestId: ${s}`)};raiseException=e=>{const{targetWin:t,targetOrigin:i,requestId:s,ex:o}=e,r=O({messageType:U,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#e.debug(`Exception sent to caller for invocation. requestId: ${s}`)}}const C="module";var W=(n=>(n.USER="USER",n.PARTNER="PARTNER",n))(W||{});class J{#t=new Map;#e=new Map;#i=e=>{const{so:t,guestId:i}=e,s=t.id.toLowerCase(),o=this.#e.get(i);if(!o)this.#e.set(i,new Map([[s,e]]));else{if(o.has(s))throw new Error(`Scripting Object ${t.id} already exists for guest ${i}`);o.set(s,e)}};#n=({so:e})=>{e._dispose&&typeof e._dispose=="function"&&e._dispose()};#s=({objectId:e,guestId:t})=>{if(e===C&&!t)for(const[,s]of this.#e){const o=s.get(e);if(o)return o}const i=t?this.#e.get(t):null;return i?i.get(e)??null:null};#o=({objectId:e,guestId:t}={})=>{if(t){if(!e){const s=this.#e.get(t);s&&s.forEach(this.#n),this.#e.delete(t);return}const i=this.#e.get(t);if(i){const s=i.get(e);s&&this.#n(s),i.delete(e)}}else e&&this.#e.forEach(i=>{const s=i.get(e);s&&this.#n(s),i.delete(e)})};#a=({so:e,guest:t})=>new Proxy(e,{get(i,s,o){const r=i[s];return r instanceof Function&&s!=="constructor"?function(...c){const a=this;return Object.defineProperty(r,"callContext",{value:t,enumerable:!1,writable:!0}),r.apply(a===o?i:a,c)}:r}});addScriptingObject=(e,t)=>{const{guestId:i}=t||{};if(!e?.id||!e?._toJSON)throw new Error("Object is not derived from ScriptingObject");const s=e.id.toLowerCase();if(s.trim().toLowerCase()===C&&!i)throw new Error("Guest id is required to add Module scripting object");if(i){this.#i({so:e,...t,guestId:i});return}if(this.#t.has(s))throw new Error(`Scripting Object ${e.id} already exists`);this.#t.set(s,{so:e,...t})};getObject=(e,t)=>{const i=e.trim().toLowerCase();let s=this.#s({objectId:i,guestId:t?.id});s=s??this.#t.get(i)??null;const{so:o}=s||{};if(!o)return null;if(!t)return o;const r=this.#a({so:o,guest:t});return Object.defineProperty(r,"target",{value:o,enumerable:!1,configurable:!1,writable:!0}),r};removeScriptingObject=(e,t)=>{const i=e.toLowerCase();if(t)this.#o({objectId:i,guestId:t});else{this.#o({objectId:i});const s=this.#t.get(i);s&&this.#n(s),this.#t.delete(i)}};removeAllScriptingObjects=e=>{e?this.#o({guestId:e}):(this.#t.forEach(this.#n),this.#t.clear())}}const X=[y.AllowScripts,y.AllowPopups,y.AllowModals,y.AllowForms,y.AllowDownloads,y.AllowSameOrigin].join(" ");class Y{hostId;#t;#e;#i;#n;#s=new Map;#o;#a=null;#u=null;constructor(e,t){if(this.hostId=e,!t?.logger)throw new Error("Logger is required");if(!t?.analyticsObj)throw new Error("Analytics object is required");if(this.#i=t.logger,this.#n=t.analyticsObj,this.#e=T(),this.#t=new H(this.#i,this.#e),t?.readyStateCallback&&typeof t?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");this.#a=t?.readyStateCallback||null,this.#o=new J,this.#t.initialize(window),this.#P(),window.addEventListener("beforeunload",this.#h),this.#A(),this.#i.debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#e}`)}#g=(e,t)=>{const i={event:e,...t};this.#n.sendBAEvent(i).catch(()=>{})};#c=(e,t)=>{this.#n.startTiming(e,t).catch(()=>{})};#d=(e,t)=>{this.#n.endTiming(e,t).catch(()=>{})};#h=()=>{for(const e of this.#s.values())e.openMode===w.Popup&&this.unloadGuest(e.id)};#r=e=>Array.from(this.#s.values()).find(t=>t.window===e);#l=e=>{for(const t of this.#s.values())if(t.url===e)return t;return null};#v=e=>typeof e?._toJSON=="function";#p=e=>this.#v(e)?{type:"object",object:e._toJSON()}:{type:"value",value:e};#y=e=>typeof e=="string"?e:e instanceof Error?e.message:"An unexpected error occurred in the host application";#f=e=>{e.ready&&this.#t.send({targetWin:e.window,targetOrigin:e.origin,messageType:p.HostConfig,messageBody:{logLevel:this.#i.getLogLevel(),...e.getInfo()}})};#E=({guest:e,obj:t,functionName:i,functionParams:s})=>{const o=t[i];return k(o)?(this.#i.debug(`Invoking host implementation of ${t.id}.${String(i)}()`),new Promise(r=>{Object.prototype.hasOwnProperty.call(o,"callContext")||Object.defineProperty(o,"callContext",{value:{guest:e},enumerable:!0}),r(o(...s))})):(this.#i.warn(`Attempt to call invalid function on object type ${t.objectType}: ${String(i)}`),Promise.reject(new Error(`Method '${i}' not found in Scripting Object '${t.id}'`)))};#w=({sourceWin:e,sourceOrigin:t,requestId:i})=>{const s=this.#r(e);if(!s){this.#i.warn(`Received ready event for unknown guest. requestId: ${i}`);return}if(!s.initialized){this.#i.warn("Guest must be initialized before it is marked as ready"),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Guest must be initialized before it is marked as ready"});return}if(!s.ready){s.ready=!0;const o=s.getInfo();this.#d("SSF.Guest.Load",{appId:o.guestId,appUrl:o.guestUrl}),this.#f(s),this.#a?.(s),this.#i.audit({message:"Guest is ready",...o})}};#j=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const o=this.#r(e);if(!o){this.#i.warn(`Received ready event for unknown guest. requestid = ${i}`);return}o.initialized||(o.initialized=!0,o.capabilities=s||{},this.#i.audit({message:"Guest is initialized",...o.getInfo()})),(!s||!s.onReady)&&this.#w({sourceWin:e,sourceOrigin:t,requestId:i,type:"",body:null})};#O=async({sourceWin:e})=>{if(e?.window){const t=this.#m(e);t&&!await t.handShake()&&this.unloadGuest(e)}};#S=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s;this.#i.debug(`Processing getObject request for object ${o}. requestId = ${i}`);const r=this.#r(e);if(!r)return this.#i.warn("Rejected object request from unknown guest window"),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Specified window is not a known guest"}),!1;const c=this.getScriptingObject(o,{guest:r});return c?(this.#t.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#p(c)}),this.#i.audit({message:"Scripting Object returned",requestId:i,scriptingObject:o,...r.getInfo()}),!0):(this.#i.warn(`unknown or unauthorized object ${o} from guest ${r.id}`),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1)};#I=({sourceWin:e,requestId:t,body:i})=>{const s=this.#r(e);if(!s){this.#i.warn(`Received resize event from unknown guest. requestid = ${t}`);return}s.domElement&&(s.domElement.style.height=`${i.height}px`),this.#i.debug(`Guest ${s.id} resized to ${i.width}x${i.height}`)};#$=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s,r=this.#r(e);if(!r)return this.#i.warn("Rejected method invocation request from unknown guest window"),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Specified window is not a known guest"}),!1;this.#i.debug(`Function ${o}.${String(s.functionName)}() called from guest "${r.id}" (requestId = ${i})`);const c=this.getScriptingObject(o);if(!c)return this.#i.warn(`Invocation of unknown or unauthorized object ${o} from guest ${r.id}`),this.#t.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1;const a=r.getInfo();return this.#c(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl}),this.#E({guest:r,obj:c,functionName:s.functionName,functionParams:s.functionParams}).then(d=>{this.#t.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#p(d)}),this.#i.audit({message:"Value returned for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).catch(d=>{this.#t.raiseException({targetWin:e,targetOrigin:r.origin,requestId:i,ex:this.#y(d)}),this.#i.audit({message:"Exception thrown for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).finally(()=>{this.#d(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl})}),!0};#k=()=>{this.#t.listen({messageType:p.GuestResize,callback:this.#I})};#P=()=>{this.#t.listen({messageType:p.GuestReady,callback:this.#j}),this.#t.listen({messageType:p.GuestReadyComplete,callback:this.#w}),this.#t.listen({messageType:p.GuestClose,callback:this.#O}),this.#t.listen({messageType:p.ObjectGet,callback:this.#S}),this.#t.listen({messageType:p.ObjectInvoke,callback:this.#$})};#G=e=>e instanceof M||typeof e?.subscribe=="function";#b=e=>{const t=new P({...e,remoting:this.#t,analyticsObj:this.#n});return t.init(),this.#s.set(e.guestId,t),t};#m=e=>{let t=typeof e=="string"?this.#s.get(e):null;return t||(t=Array.from(this.#s.values()).find(i=>i.window===e||i.domElement===e)),t};#A=()=>{this.#u=setInterval(()=>{const e=[];this.#s.forEach(t=>{t.openMode===w.Popup&&t.window.closed&&e.push(t)}),e.forEach(t=>{this.unloadGuest(t.id)})},1e3)};#T=e=>{const{url:t,title:i,popupWindowFeatures:s={},searchParams:o,guestId:r}=e,{width:c=800,height:a=600,top:d=100,left:l=100}=s;let u=this.#l(t);if(u)u.window.closed||u.send({messageType:p.GuestFocus,messageBody:{}});else{const j=[{key:"width",value:c},{key:"height",value:a},{key:"top",value:d},{key:"left",value:l}].reduce((g,b,K)=>(K>0&&b.value&&(g+=","),b.value?`${g}${b.key}=${b.value}`:g),""),f=window.open(t,i,`popup, ${j}`);if(!f)throw new Error("Failed to open guest application in popup window");f.opener=null,u=this.#b({guestId:r,window:f,title:i,url:t,searchParams:o,openMode:w.Popup})}return u};#R=e=>{const{url:t,title:i,targetElement:s,searchParams:o,guestId:r,options:c={}}=e,a=s.ownerDocument??document,{fitToContent:d=!1,disableSandbox:l=!1,sandboxValues:u=[],style:j=""}=c;if(!i)throw new Error("title is required");d&&this.#k();const f=a.createElement("iframe");f.setAttribute("id",r);const g=()=>{this.#i.debug(`frame loaded for guest with id '${r}'`),f.removeEventListener("load",g)};f.addEventListener("load",g),f.setAttribute("style",`min-width: 100%; height: 100%; border: 0px; ${j}`),l||f.setAttribute("sandbox",`${X} ${u.join(" ")}`),f.setAttribute("title",i),f.setAttribute("src",t),s.appendChild(f);const b=a.getElementById(r);return this.#b({guestId:r,domElement:b,window:b.contentWindow,title:i,url:t,searchParams:o,openMode:w.Embed})};#q=(e,t)=>{let i="";return Object.keys(t).forEach(s=>{i+=`${(i.length?"&":"")+encodeURIComponent(s)}=${encodeURIComponent(t[s])}`}),e+(i?(e.indexOf("?")>=0?"&":"?")+i:"")};addScriptingObject=(e,t)=>{this.#o.addScriptingObject(e,t)};cloneScriptingObject=(e,t)=>{if(!e)throw new Error("proxy is required");if(!t)throw new Error("guest is required");const i=new I(e.id,e.objectType);let s=[];return Object.keys(e).forEach(o=>{const r=e[o];if(this.#G(r)){let c;if(r?.subscribe!=="function"?c=new v({name:r.name||o,requiresFeedback:!1,so:i}):c=new automation.Event,Object.defineProperty(i,o,{value:c,enumerable:!0}),t.subscribe){const a=({eventParams:l,eventOptions:u})=>this.dispatchEvent({event:c,eventParams:l,eventOptions:u}),d=t.subscribe({eventId:r.id,callback:a});s.push(()=>{t.unsubscribe({eventId:r.id,token:d})})}else{const a=r.subscribe?.((d,l,u)=>this.dispatchEvent({event:c,eventParams:l,eventOptions:u}));s.push(()=>{r.unsubscribe?.(a)})}}else if(k(r)&&(Object.defineProperty(i,o,{value:async(...c)=>{const a=await r(...c);return N(a)?this.cloneScriptingObject(a,t):a},enumerable:!0}),o==="dispose")){const c=i.dispose;Object.defineProperty(i,o,{value:()=>(i._dispose(),c.apply(i)),enumerable:!0})}}),i._dispose=()=>{s.forEach(o=>{o?.()}),s=[]},i};close=()=>{clearInterval(this.#u),this.#t.close(),window.removeEventListener("beforeunload",this.#h),this.#i.debug(`host is closed. hostId: ${this.hostId}, correlationId: ${this.#e}`)};dispatchEvent=async e=>{const{event:{id:t,name:i,scriptingObject:s},eventParams:o,eventOptions:r={}}=e,{eventHandler:c=null,timeout:a=null,window:d=null}=r,l={object:s._toJSON(),eventName:i,eventParams:o,eventHandler:c,eventOptions:{allowsFeedback:!1}};a&&!Number.isNaN(a)&&(l.eventOptions={allowsFeedback:!0,timeout:Number(a)});const u=[];let j=!1;return this.#s.forEach(g=>{const b=g.getInfo();(!d||d===g.window)&&(a&&g?.capabilities?.eventFeedback?(u.push(g.dispatchEvent(l,a)),j||(this.#c(`ScriptingObject.Event.${s.id}.${i}`,{appId:this.hostId,appUrl:window.location.href}),j=!0),this.#i.audit({message:"Event dispatched and awaiting feedback",scriptingEventId:t,...b})):(g.send({messageType:p.ObjectEvent,messageBody:l}),this.#i.audit({message:"Event dispatched",scriptingEventId:t,...b})))}),await Promise.all(u).then(g=>(this.#i.audit({message:"Event feedback received",scriptingEventId:t}),$(g))).catch(g=>{throw this.#i.error({message:"Error processing event",eventId:t,exception:g}),g}).finally(()=>{j&&this.#d(`ScriptingObject.Event.${s.id}.${i}`,{appId:this.hostId,appUrl:window.location.href})})};getGuests=()=>{const e=[];return this.#s.forEach(t=>{e.push(t)}),e};getScriptingObject=(e,t)=>this.#o.getObject(e,t?.guest);loadGuest=e=>{const{id:t,url:i,targetElement:s,title:o,searchParams:r={},options:c={}}=e;if(!t)throw new Error("id for guest application is required");const{openMode:a=w.Embed,popupWindowFeatures:d={}}=c,l=this.#q(i,r);let u=null;if(this.#c("SSF.Guest.Load",{appId:t,appUrl:l}),a===w.Popup)u=this.#T({guestId:t,url:l,title:o,searchParams:r,popupWindowFeatures:d});else if(a===w.Embed)u=this.#R({guestId:t,url:l,title:o,targetElement:s,searchParams:r,options:c});else throw new Error(`Invalid openMode: ${a}`);return this.#i.audit({message:"Guest loaded",...u.getInfo()}),u};loadGuests=e=>{const{id:t,url:i,targetElement:s,title:o,searchParamsList:r=[],options:c={}}=e;r.forEach((a,d)=>{this.loadGuest({id:`${t}-${d}`,url:i,title:o,targetElement:s,searchParams:a,options:c})},this)};removeAllScriptingObjects=e=>{this.#o.removeAllScriptingObjects(e)};removeScriptingObject=(e,t)=>{this.#o.removeScriptingObject(e,t)};setLogLevel=e=>{this.#i.setLogLevel(e),this.#s.forEach(this.#f),this.#i.debug("Dispatched config events to all guests")};unloadGuest=e=>{const t=this.#m(e);t&&(t.dispose(),this.#s.delete(t.id),this.#i.audit({message:"Guest is removed from host",...t.getInfo()}))}}return E})());
2
+
3
+ //# sourceMappingURL=emuiSsfHost.5b1e09b1238643895b89.js.map