@elliemae/ssf-guest 2.7.5 → 2.7.6

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
@@ -179,6 +179,14 @@ class SSFGuest {
179
179
  );
180
180
  return ctrl;
181
181
  };
182
+ /**
183
+ * call scripting object api exposed by host
184
+ * @param param0
185
+ * @param param0.objectId
186
+ * @param param0.functionName
187
+ * @param param0.functionParams
188
+ * @returns
189
+ */
182
190
  #invoke = async ({
183
191
  objectId,
184
192
  functionName,
@@ -220,6 +228,11 @@ class SSFGuest {
220
228
  });
221
229
  return retVal;
222
230
  };
231
+ /**
232
+ * handle response from host
233
+ * @param response
234
+ * @returns
235
+ */
223
236
  #handleResponse = (response) => {
224
237
  if (response?.type === "object" /* OBJECT */ && "object" in response) {
225
238
  return this.#fromJSON(response.object);
@@ -229,6 +242,11 @@ class SSFGuest {
229
242
  }
230
243
  return response;
231
244
  };
245
+ /**
246
+ * handle config change event
247
+ * @param root0
248
+ * @param root0.body
249
+ */
232
250
  #handleConfigChangeEvent = ({ body }) => {
233
251
  if (body?.logLevel) {
234
252
  this.#logger.setLogLevel(body.logLevel);
@@ -242,9 +260,32 @@ class SSFGuest {
242
260
  ...this.#getGuestInfo()
243
261
  });
244
262
  };
263
+ /**
264
+ * Focus the guest window
265
+ */
245
266
  #handleFocusEvent = () => {
246
267
  window.focus();
247
268
  };
269
+ /**
270
+ * Check if the parent window is closed and close this popup window
271
+ */
272
+ #handleParentClose = () => {
273
+ if (!(0, import_utils.isEmbedded)()) {
274
+ setInterval(() => {
275
+ if (this.#hostWindow?.closed) {
276
+ window.close();
277
+ }
278
+ }, 1e3);
279
+ }
280
+ };
281
+ /**
282
+ * handle get object call
283
+ * @param param0
284
+ * @param param0.sourceWin
285
+ * @param param0.sourceOrigin
286
+ * @param param0.requestId
287
+ * @param param0.body
288
+ */
248
289
  #handleObjectEvent = async ({
249
290
  sourceWin,
250
291
  sourceOrigin,
@@ -486,6 +527,7 @@ class SSFGuest {
486
527
  message: "Guest connected to host",
487
528
  guestUrl: window.location.href
488
529
  });
530
+ this.#handleParentClose();
489
531
  if (this.#usesDevConnectAPI) await this.getAuthToken();
490
532
  await this.#startKeepSessionAlive();
491
533
  window.addEventListener("beforeunload", this.close);
package/dist/esm/guest.js CHANGED
@@ -174,6 +174,14 @@ class SSFGuest {
174
174
  );
175
175
  return ctrl;
176
176
  };
177
+ /**
178
+ * call scripting object api exposed by host
179
+ * @param param0
180
+ * @param param0.objectId
181
+ * @param param0.functionName
182
+ * @param param0.functionParams
183
+ * @returns
184
+ */
177
185
  #invoke = async ({
178
186
  objectId,
179
187
  functionName,
@@ -215,6 +223,11 @@ class SSFGuest {
215
223
  });
216
224
  return retVal;
217
225
  };
226
+ /**
227
+ * handle response from host
228
+ * @param response
229
+ * @returns
230
+ */
218
231
  #handleResponse = (response) => {
219
232
  if (response?.type === "object" /* OBJECT */ && "object" in response) {
220
233
  return this.#fromJSON(response.object);
@@ -224,6 +237,11 @@ class SSFGuest {
224
237
  }
225
238
  return response;
226
239
  };
240
+ /**
241
+ * handle config change event
242
+ * @param root0
243
+ * @param root0.body
244
+ */
227
245
  #handleConfigChangeEvent = ({ body }) => {
228
246
  if (body?.logLevel) {
229
247
  this.#logger.setLogLevel(body.logLevel);
@@ -237,9 +255,32 @@ class SSFGuest {
237
255
  ...this.#getGuestInfo()
238
256
  });
239
257
  };
258
+ /**
259
+ * Focus the guest window
260
+ */
240
261
  #handleFocusEvent = () => {
241
262
  window.focus();
242
263
  };
264
+ /**
265
+ * Check if the parent window is closed and close this popup window
266
+ */
267
+ #handleParentClose = () => {
268
+ if (!isEmbedded()) {
269
+ setInterval(() => {
270
+ if (this.#hostWindow?.closed) {
271
+ window.close();
272
+ }
273
+ }, 1e3);
274
+ }
275
+ };
276
+ /**
277
+ * handle get object call
278
+ * @param param0
279
+ * @param param0.sourceWin
280
+ * @param param0.sourceOrigin
281
+ * @param param0.requestId
282
+ * @param param0.body
283
+ */
243
284
  #handleObjectEvent = async ({
244
285
  sourceWin,
245
286
  sourceOrigin,
@@ -481,6 +522,7 @@ class SSFGuest {
481
522
  message: "Guest connected to host",
482
523
  guestUrl: window.location.href
483
524
  });
525
+ this.#handleParentClose();
484
526
  if (this.#usesDevConnectAPI) await this.getAuthToken();
485
527
  await this.#startKeepSessionAlive();
486
528
  window.addEventListener("beforeunload", this.close);
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Credit Service</title><style>body{margin:0}</style><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script>window.addEventListener("DOMContentLoaded",(async()=>{window.__ICE__={diagnosticsUrl:"https://int.api.ellielabs.com/diagnostics/v2/logging"};const e=new URL(window.location),i=e?.searchParams?.get?.("src");window.__ICE__.ssfGuest=new ice.guest.SSFGuest({logger:{index:"creditServiceGuest",team:"ui platform",appName:"credit-service"}}),await window.__ICE__.ssfGuest.addScript(i,document.body)}))</script><script defer="defer" src="js/emuiSsfGuest.7058fb8468c594be3a4c.js"></script></head><body></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Credit Service</title><style>body{margin:0}</style><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script>window.addEventListener("DOMContentLoaded",(async()=>{window.__ICE__={diagnosticsUrl:"https://int.api.ellielabs.com/diagnostics/v2/logging"};const e=new URL(window.location),i=e?.searchParams?.get?.("src");window.__ICE__.ssfGuest=new ice.guest.SSFGuest({logger:{index:"creditServiceGuest",team:"ui platform",appName:"credit-service"}}),await window.__ICE__.ssfGuest.addScript(i,document.body)}))</script><script defer="defer" src="js/emuiSsfGuest.f54d0c27442c05fb10e8.js"></script></head><body></body></html>
@@ -1 +1 @@
1
- <!doctype html><html lang="en" style="height:100%"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Plugin</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiSsfGuest.7058fb8468c594be3a4c.js"></script></head><body class="px-2 h-full"><main class="h-full"><h1 class="text-md font-bold">Credit Score Service</h1><div class="h-full mt-2"><output id="msg" class="mt-2 p-2"></output></div></main></body></html>
1
+ <!doctype html><html lang="en" style="height:100%"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Plugin</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiSsfGuest.f54d0c27442c05fb10e8.js"></script></head><body class="px-2 h-full"><main class="h-full"><h1 class="text-md font-bold">Credit Score Service</h1><div class="h-full mt-2"><output id="msg" class="mt-2 p-2"></output></div></main></body></html>