@elliemae/ssf-guest 2.4.0 → 2.5.2

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.
Files changed (35) hide show
  1. package/dist/cjs/guest.js +115 -0
  2. package/dist/cjs/tests/utils.js +76 -5
  3. package/dist/cjs/types.js +16 -0
  4. package/dist/esm/guest.js +115 -0
  5. package/dist/esm/tests/utils.js +76 -5
  6. package/dist/esm/typings/window.js +0 -0
  7. package/dist/public/creditService.html +1 -1
  8. package/dist/public/index.html +1 -1
  9. package/dist/public/js/emuiSsfGuest.11dd502cfb083007c6d1.js +29 -0
  10. package/dist/public/js/emuiSsfGuest.11dd502cfb083007c6d1.js.br +0 -0
  11. package/dist/public/js/emuiSsfGuest.11dd502cfb083007c6d1.js.gz +0 -0
  12. package/dist/public/js/emuiSsfGuest.11dd502cfb083007c6d1.js.map +1 -0
  13. package/dist/public/loanValidation.html +1 -1
  14. package/dist/public/loanValidation.js.map +1 -1
  15. package/dist/public/pricingService.html +1 -1
  16. package/dist/public/pricingService.js.map +1 -1
  17. package/dist/public/titleService.html +1 -1
  18. package/dist/public/v2-guest.html +1 -1
  19. package/dist/types/guest.d.ts +21 -3
  20. package/dist/types/tests/utils.d.ts +14 -4
  21. package/dist/types/types.d.ts +6 -0
  22. package/dist/umd/index.js +27 -1
  23. package/dist/umd/index.js.br +0 -0
  24. package/dist/umd/index.js.gz +0 -0
  25. package/dist/umd/index.js.map +1 -1
  26. package/dist/umd/loanValidation.js.map +1 -1
  27. package/dist/umd/pricingService.js.map +1 -1
  28. package/package.json +7 -4
  29. package/dist/public/js/emuiSsfGuest.fffbea0b33100b3a1ff1.js +0 -3
  30. package/dist/public/js/emuiSsfGuest.fffbea0b33100b3a1ff1.js.br +0 -0
  31. package/dist/public/js/emuiSsfGuest.fffbea0b33100b3a1ff1.js.gz +0 -0
  32. package/dist/public/js/emuiSsfGuest.fffbea0b33100b3a1ff1.js.map +0 -1
  33. /package/dist/cjs/{window.js → typings/window.js} +0 -0
  34. /package/dist/esm/{window.js → types.js} +0 -0
  35. /package/dist/types/{window.d.ts → typings/window.d.ts} +0 -0
package/dist/cjs/guest.js CHANGED
@@ -22,6 +22,7 @@ __export(guest_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(guest_exports);
24
24
  var import_uuid = require("uuid");
25
+ var import_lodash = require("lodash");
25
26
  var import_microfe_common = require("@elliemae/microfe-common");
26
27
  var import_pui_diagnostics = require("@elliemae/pui-diagnostics");
27
28
  var import_proxy = require("./proxy.js");
@@ -32,6 +33,7 @@ var ResponseType = /* @__PURE__ */ ((ResponseType2) => {
32
33
  ResponseType2["VALUE"] = "value";
33
34
  return ResponseType2;
34
35
  })(ResponseType || {});
36
+ const KEEP_ALIVE_INTERVAL = 12e4;
35
37
  const capabilities = {
36
38
  eventFeedback: true
37
39
  };
@@ -56,6 +58,7 @@ if ((0, import_utils.isEmbedded)()) {
56
58
  window.addEventListener("load", onLoad);
57
59
  }
58
60
  const DIAGNOSTICS_URL = "https://api.ellielabs.com/diagnostics/v2/logging";
61
+ const userInteractionEvents = ["click", "scroll", "keypress", "touchstart"];
59
62
  class SSFGuest {
60
63
  /* eslint-enable indent */
61
64
  #correlationId;
@@ -70,6 +73,34 @@ class SSFGuest {
70
73
  #url = null;
71
74
  #hostOrigin = null;
72
75
  #hostWindow = null;
76
+ /**
77
+ * flag to get & cache auth token
78
+ */
79
+ #cacheAuthToken = false;
80
+ /**
81
+ * auth token to access api
82
+ */
83
+ #authToken = null;
84
+ /**
85
+ * oauth client id
86
+ */
87
+ #authClientId = null;
88
+ /**
89
+ * api host domain
90
+ */
91
+ #hostDomain = null;
92
+ /**
93
+ * flag to keep host session alive
94
+ */
95
+ #keepAlive = false;
96
+ /**
97
+ * interval to keep host session alive.
98
+ */
99
+ #keepAliveInterval = KEEP_ALIVE_INTERVAL;
100
+ /**
101
+ * throttled keep alive function
102
+ */
103
+ #throttledKeepAlive = null;
73
104
  /**
74
105
  * Create new guest
75
106
  * @param {GuestOption} options - options for the guest
@@ -83,6 +114,9 @@ class SSFGuest {
83
114
  team,
84
115
  appName
85
116
  } = options?.logger || {};
117
+ this.#cacheAuthToken = options?.cacheAuthToken ?? false;
118
+ this.#keepAlive = options?.keepAlive ?? false;
119
+ this.#keepAliveInterval = options?.keepAliveInterval ?? KEEP_ALIVE_INTERVAL;
86
120
  const transport = logToConsole ? (0, import_pui_diagnostics.Console)() : (0, import_pui_diagnostics.http)(url);
87
121
  this.#logger = (0, import_pui_diagnostics.logger)({
88
122
  transport,
@@ -277,6 +311,54 @@ class SSFGuest {
277
311
  }
278
312
  }
279
313
  };
314
+ /**
315
+ * Extend token lifetime
316
+ */
317
+ #extendTokenLifetime = async () => {
318
+ if (!this.#authToken || !this.#authClientId || !this.#hostDomain)
319
+ return;
320
+ await fetch(`${this.#hostDomain}/oauth2/v1/token/introspection`, {
321
+ headers: {
322
+ "content-type": "application/x-www-form-urlencoded;charset=UTF-8"
323
+ },
324
+ body: `token=${this.#authToken}&client_id=${this.#authClientId}`,
325
+ method: "POST"
326
+ });
327
+ };
328
+ /**
329
+ * Start session keep alive
330
+ */
331
+ #startKeepSessionAlive = async () => {
332
+ if (this.#keepAlive) {
333
+ try {
334
+ const appObj = await this.getObject("Application");
335
+ if (appObj) {
336
+ this.#throttledKeepAlive = (0, import_lodash.throttle)(
337
+ async () => {
338
+ try {
339
+ await appObj.keepSessionAlive();
340
+ await this.#extendTokenLifetime();
341
+ } catch (e) {
342
+ this.#logger.error(
343
+ `Error keeping session alive. ${e.message}`
344
+ );
345
+ }
346
+ },
347
+ this.#keepAliveInterval,
348
+ // throttle time
349
+ { leading: false }
350
+ );
351
+ userInteractionEvents.forEach((eventType) => {
352
+ document.addEventListener(eventType, this.#throttledKeepAlive);
353
+ });
354
+ }
355
+ } catch (e) {
356
+ this.#logger.error(
357
+ `Error getting application object. ${e.message}`
358
+ );
359
+ }
360
+ }
361
+ };
280
362
  /**
281
363
  * Initialize guest using script
282
364
  * @param scriptUri uri of the script
@@ -315,6 +397,11 @@ class SSFGuest {
315
397
  window: this.#hostWindow
316
398
  });
317
399
  this.#remoting.close();
400
+ if (this.#throttledKeepAlive) {
401
+ userInteractionEvents.forEach((eventType) => {
402
+ document.removeEventListener(eventType, this.#throttledKeepAlive);
403
+ });
404
+ }
318
405
  this.#isConnected = false;
319
406
  this.#logger.audit({
320
407
  message: "Guest disconnected from host",
@@ -328,6 +415,7 @@ class SSFGuest {
328
415
  * Connect to the host
329
416
  * @param {ConnectParam} param - reference to the guest window or options
330
417
  */
418
+ // eslint-disable-next-line max-statements
331
419
  connect = async (param) => {
332
420
  if (!this.#isConnected) {
333
421
  let guestWindow = window;
@@ -370,7 +458,34 @@ class SSFGuest {
370
458
  message: "Guest connected to host",
371
459
  guestUrl: window.location.href
372
460
  });
461
+ await this.getAuthToken();
462
+ await this.#startKeepSessionAlive();
463
+ }
464
+ };
465
+ /**
466
+ * Get bearer token to access api
467
+ * @returns auth token
468
+ */
469
+ getAuthToken = async () => {
470
+ if (!this.#cacheAuthToken)
471
+ return null;
472
+ if (!this.#authToken) {
473
+ try {
474
+ const authObj = await this.getObject("Auth");
475
+ if (authObj) {
476
+ const tokenInfo = await authObj.getAccessToken();
477
+ this.#authToken = tokenInfo?.access_token;
478
+ this.#hostDomain = tokenInfo?.host_name;
479
+ this.#authClientId = tokenInfo?.client_id;
480
+ }
481
+ } catch (e) {
482
+ console.dir(e, { depth: null });
483
+ this.#logger.error(
484
+ `Error getting access token from auth object. ${e.message}`
485
+ );
486
+ }
373
487
  }
488
+ return this.#authToken;
374
489
  };
375
490
  /**
376
491
  * Get scripting object proxy by id
@@ -20,22 +20,30 @@ var utils_exports = {};
20
20
  __export(utils_exports, {
21
21
  appraisalServiceObject: () => appraisalServiceObject,
22
22
  connectGuest: () => connectGuest,
23
+ createGuest: () => createGuest,
23
24
  getAppraisalService: () => getAppraisalService,
24
25
  postMessage: () => postMessage,
25
- ssfGuest: () => ssfGuest
26
+ setupHost: () => setupHost
26
27
  });
27
28
  module.exports = __toCommonJS(utils_exports);
28
29
  var import_microfe_common = require("@elliemae/microfe-common");
29
30
  var import__ = require("../index.js");
30
31
  var import_constant = require("./constant.js");
31
32
  var import_utils = require("../utils.js");
32
- const ssfGuest = new import__.SSFGuest({
33
+ const createGuest = ({
34
+ keepAlive,
35
+ cacheAuthToken,
36
+ keepAliveInterval
37
+ }) => new import__.SSFGuest({
33
38
  logger: {
34
39
  console: true,
35
40
  index: "ssf",
36
41
  team: "UI Platform",
37
42
  appName: "SSF Guest"
38
- }
43
+ },
44
+ keepAlive,
45
+ cacheAuthToken,
46
+ keepAliveInterval
39
47
  });
40
48
  const postMessage = ({
41
49
  srcWindow,
@@ -54,7 +62,7 @@ const postMessage = ({
54
62
  })
55
63
  );
56
64
  };
57
- const connectGuest = (hostWindow) => new Promise((resolve) => {
65
+ const connectGuest = (hostWindow, ssfGuest) => new Promise((resolve) => {
58
66
  const onMessage = ({ data }) => {
59
67
  if (data.type === import_microfe_common.MessageType.GuestReady) {
60
68
  hostWindow?.removeEventListener?.("message", onMessage);
@@ -87,7 +95,7 @@ const appraisalServiceObject = {
87
95
  },
88
96
  type: "object"
89
97
  };
90
- const getAppraisalService = (hostWindow) => new Promise((resolve, reject) => {
98
+ const getAppraisalService = (hostWindow, ssfGuest) => new Promise((resolve, reject) => {
91
99
  const onMessage = ({ data }) => {
92
100
  if (data?.type !== import_microfe_common.MessageType.ObjectGet)
93
101
  return;
@@ -105,3 +113,66 @@ const getAppraisalService = (hostWindow) => new Promise((resolve, reject) => {
105
113
  hostWindow?.addEventListener?.("message", onMessage);
106
114
  ssfGuest.getObject(import_constant.OBJECT_NAME).then(resolve).catch(reject);
107
115
  });
116
+ const authScriptingObject = {
117
+ object: {
118
+ events: [],
119
+ functions: ["getAccessToken", "createAuthCode", "getUser"],
120
+ objectId: "Auth",
121
+ objectType: "Object"
122
+ },
123
+ type: "object"
124
+ };
125
+ const applicationScriptingObject = {
126
+ object: {
127
+ events: [],
128
+ functions: [
129
+ "closeModal",
130
+ "extend",
131
+ "getApplicationContext",
132
+ "getCapabilities",
133
+ "getCompanySettings",
134
+ "getDescriptor",
135
+ "getPersonaAccess",
136
+ "getPoliciesDetails",
137
+ "getUserAccessRights",
138
+ "hideSpinner",
139
+ "keepSessionAlive",
140
+ "log",
141
+ "navigate",
142
+ "open",
143
+ "openModal",
144
+ "performAction",
145
+ "print",
146
+ "showError",
147
+ "showSpinner",
148
+ "supportsAction",
149
+ "supportsNavigateTo"
150
+ ],
151
+ objectId: "Application",
152
+ objectType: "Object"
153
+ },
154
+ type: "object"
155
+ };
156
+ const hostObjects = {
157
+ Application: applicationScriptingObject,
158
+ Auth: authScriptingObject
159
+ };
160
+ const setupHost = (hostWindow) => {
161
+ const onMessage = ({ data }) => {
162
+ if (data?.type !== import_microfe_common.MessageType.ObjectGet)
163
+ return;
164
+ const scriptingObject = hostObjects[data?.body?.objectId ?? ""] ?? null;
165
+ if (scriptingObject)
166
+ postMessage({
167
+ srcWindow: hostWindow,
168
+ targetWindow: window,
169
+ message: {
170
+ body: scriptingObject,
171
+ type: "elli:remoting:response",
172
+ requestId: data.requestId
173
+ }
174
+ });
175
+ };
176
+ hostWindow?.addEventListener?.("message", onMessage);
177
+ return () => hostWindow?.removeEventListener?.("message", onMessage);
178
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
package/dist/esm/guest.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { v4 as uuidv4 } from "uuid";
2
+ import { throttle } from "lodash";
2
3
  import {
3
4
  Remoting,
4
5
  sendMessage,
@@ -26,6 +27,7 @@ var ResponseType = /* @__PURE__ */ ((ResponseType2) => {
26
27
  ResponseType2["VALUE"] = "value";
27
28
  return ResponseType2;
28
29
  })(ResponseType || {});
30
+ const KEEP_ALIVE_INTERVAL = 12e4;
29
31
  const capabilities = {
30
32
  eventFeedback: true
31
33
  };
@@ -50,6 +52,7 @@ if (isEmbedded()) {
50
52
  window.addEventListener("load", onLoad);
51
53
  }
52
54
  const DIAGNOSTICS_URL = "https://api.ellielabs.com/diagnostics/v2/logging";
55
+ const userInteractionEvents = ["click", "scroll", "keypress", "touchstart"];
53
56
  class SSFGuest {
54
57
  /* eslint-enable indent */
55
58
  #correlationId;
@@ -64,6 +67,34 @@ class SSFGuest {
64
67
  #url = null;
65
68
  #hostOrigin = null;
66
69
  #hostWindow = null;
70
+ /**
71
+ * flag to get & cache auth token
72
+ */
73
+ #cacheAuthToken = false;
74
+ /**
75
+ * auth token to access api
76
+ */
77
+ #authToken = null;
78
+ /**
79
+ * oauth client id
80
+ */
81
+ #authClientId = null;
82
+ /**
83
+ * api host domain
84
+ */
85
+ #hostDomain = null;
86
+ /**
87
+ * flag to keep host session alive
88
+ */
89
+ #keepAlive = false;
90
+ /**
91
+ * interval to keep host session alive.
92
+ */
93
+ #keepAliveInterval = KEEP_ALIVE_INTERVAL;
94
+ /**
95
+ * throttled keep alive function
96
+ */
97
+ #throttledKeepAlive = null;
67
98
  /**
68
99
  * Create new guest
69
100
  * @param {GuestOption} options - options for the guest
@@ -77,6 +108,9 @@ class SSFGuest {
77
108
  team,
78
109
  appName
79
110
  } = options?.logger || {};
111
+ this.#cacheAuthToken = options?.cacheAuthToken ?? false;
112
+ this.#keepAlive = options?.keepAlive ?? false;
113
+ this.#keepAliveInterval = options?.keepAliveInterval ?? KEEP_ALIVE_INTERVAL;
80
114
  const transport = logToConsole ? Console() : http(url);
81
115
  this.#logger = puiLogger({
82
116
  transport,
@@ -271,6 +305,54 @@ class SSFGuest {
271
305
  }
272
306
  }
273
307
  };
308
+ /**
309
+ * Extend token lifetime
310
+ */
311
+ #extendTokenLifetime = async () => {
312
+ if (!this.#authToken || !this.#authClientId || !this.#hostDomain)
313
+ return;
314
+ await fetch(`${this.#hostDomain}/oauth2/v1/token/introspection`, {
315
+ headers: {
316
+ "content-type": "application/x-www-form-urlencoded;charset=UTF-8"
317
+ },
318
+ body: `token=${this.#authToken}&client_id=${this.#authClientId}`,
319
+ method: "POST"
320
+ });
321
+ };
322
+ /**
323
+ * Start session keep alive
324
+ */
325
+ #startKeepSessionAlive = async () => {
326
+ if (this.#keepAlive) {
327
+ try {
328
+ const appObj = await this.getObject("Application");
329
+ if (appObj) {
330
+ this.#throttledKeepAlive = throttle(
331
+ async () => {
332
+ try {
333
+ await appObj.keepSessionAlive();
334
+ await this.#extendTokenLifetime();
335
+ } catch (e) {
336
+ this.#logger.error(
337
+ `Error keeping session alive. ${e.message}`
338
+ );
339
+ }
340
+ },
341
+ this.#keepAliveInterval,
342
+ // throttle time
343
+ { leading: false }
344
+ );
345
+ userInteractionEvents.forEach((eventType) => {
346
+ document.addEventListener(eventType, this.#throttledKeepAlive);
347
+ });
348
+ }
349
+ } catch (e) {
350
+ this.#logger.error(
351
+ `Error getting application object. ${e.message}`
352
+ );
353
+ }
354
+ }
355
+ };
274
356
  /**
275
357
  * Initialize guest using script
276
358
  * @param scriptUri uri of the script
@@ -309,6 +391,11 @@ class SSFGuest {
309
391
  window: this.#hostWindow
310
392
  });
311
393
  this.#remoting.close();
394
+ if (this.#throttledKeepAlive) {
395
+ userInteractionEvents.forEach((eventType) => {
396
+ document.removeEventListener(eventType, this.#throttledKeepAlive);
397
+ });
398
+ }
312
399
  this.#isConnected = false;
313
400
  this.#logger.audit({
314
401
  message: "Guest disconnected from host",
@@ -322,6 +409,7 @@ class SSFGuest {
322
409
  * Connect to the host
323
410
  * @param {ConnectParam} param - reference to the guest window or options
324
411
  */
412
+ // eslint-disable-next-line max-statements
325
413
  connect = async (param) => {
326
414
  if (!this.#isConnected) {
327
415
  let guestWindow = window;
@@ -364,7 +452,34 @@ class SSFGuest {
364
452
  message: "Guest connected to host",
365
453
  guestUrl: window.location.href
366
454
  });
455
+ await this.getAuthToken();
456
+ await this.#startKeepSessionAlive();
457
+ }
458
+ };
459
+ /**
460
+ * Get bearer token to access api
461
+ * @returns auth token
462
+ */
463
+ getAuthToken = async () => {
464
+ if (!this.#cacheAuthToken)
465
+ return null;
466
+ if (!this.#authToken) {
467
+ try {
468
+ const authObj = await this.getObject("Auth");
469
+ if (authObj) {
470
+ const tokenInfo = await authObj.getAccessToken();
471
+ this.#authToken = tokenInfo?.access_token;
472
+ this.#hostDomain = tokenInfo?.host_name;
473
+ this.#authClientId = tokenInfo?.client_id;
474
+ }
475
+ } catch (e) {
476
+ console.dir(e, { depth: null });
477
+ this.#logger.error(
478
+ `Error getting access token from auth object. ${e.message}`
479
+ );
480
+ }
367
481
  }
482
+ return this.#authToken;
368
483
  };
369
484
  /**
370
485
  * Get scripting object proxy by id
@@ -7,13 +7,20 @@ import {
7
7
  UNLOADING_EVENT_NAME
8
8
  } from "./constant.js";
9
9
  import { getOrigin } from "../utils.js";
10
- const ssfGuest = new SSFGuest({
10
+ const createGuest = ({
11
+ keepAlive,
12
+ cacheAuthToken,
13
+ keepAliveInterval
14
+ }) => new SSFGuest({
11
15
  logger: {
12
16
  console: true,
13
17
  index: "ssf",
14
18
  team: "UI Platform",
15
19
  appName: "SSF Guest"
16
- }
20
+ },
21
+ keepAlive,
22
+ cacheAuthToken,
23
+ keepAliveInterval
17
24
  });
18
25
  const postMessage = ({
19
26
  srcWindow,
@@ -32,7 +39,7 @@ const postMessage = ({
32
39
  })
33
40
  );
34
41
  };
35
- const connectGuest = (hostWindow) => new Promise((resolve) => {
42
+ const connectGuest = (hostWindow, ssfGuest) => new Promise((resolve) => {
36
43
  const onMessage = ({ data }) => {
37
44
  if (data.type === MessageType.GuestReady) {
38
45
  hostWindow?.removeEventListener?.("message", onMessage);
@@ -65,7 +72,7 @@ const appraisalServiceObject = {
65
72
  },
66
73
  type: "object"
67
74
  };
68
- const getAppraisalService = (hostWindow) => new Promise((resolve, reject) => {
75
+ const getAppraisalService = (hostWindow, ssfGuest) => new Promise((resolve, reject) => {
69
76
  const onMessage = ({ data }) => {
70
77
  if (data?.type !== MessageType.ObjectGet)
71
78
  return;
@@ -83,10 +90,74 @@ const getAppraisalService = (hostWindow) => new Promise((resolve, reject) => {
83
90
  hostWindow?.addEventListener?.("message", onMessage);
84
91
  ssfGuest.getObject(OBJECT_NAME).then(resolve).catch(reject);
85
92
  });
93
+ const authScriptingObject = {
94
+ object: {
95
+ events: [],
96
+ functions: ["getAccessToken", "createAuthCode", "getUser"],
97
+ objectId: "Auth",
98
+ objectType: "Object"
99
+ },
100
+ type: "object"
101
+ };
102
+ const applicationScriptingObject = {
103
+ object: {
104
+ events: [],
105
+ functions: [
106
+ "closeModal",
107
+ "extend",
108
+ "getApplicationContext",
109
+ "getCapabilities",
110
+ "getCompanySettings",
111
+ "getDescriptor",
112
+ "getPersonaAccess",
113
+ "getPoliciesDetails",
114
+ "getUserAccessRights",
115
+ "hideSpinner",
116
+ "keepSessionAlive",
117
+ "log",
118
+ "navigate",
119
+ "open",
120
+ "openModal",
121
+ "performAction",
122
+ "print",
123
+ "showError",
124
+ "showSpinner",
125
+ "supportsAction",
126
+ "supportsNavigateTo"
127
+ ],
128
+ objectId: "Application",
129
+ objectType: "Object"
130
+ },
131
+ type: "object"
132
+ };
133
+ const hostObjects = {
134
+ Application: applicationScriptingObject,
135
+ Auth: authScriptingObject
136
+ };
137
+ const setupHost = (hostWindow) => {
138
+ const onMessage = ({ data }) => {
139
+ if (data?.type !== MessageType.ObjectGet)
140
+ return;
141
+ const scriptingObject = hostObjects[data?.body?.objectId ?? ""] ?? null;
142
+ if (scriptingObject)
143
+ postMessage({
144
+ srcWindow: hostWindow,
145
+ targetWindow: window,
146
+ message: {
147
+ body: scriptingObject,
148
+ type: "elli:remoting:response",
149
+ requestId: data.requestId
150
+ }
151
+ });
152
+ };
153
+ hostWindow?.addEventListener?.("message", onMessage);
154
+ return () => hostWindow?.removeEventListener?.("message", onMessage);
155
+ };
86
156
  export {
87
157
  appraisalServiceObject,
88
158
  connectGuest,
159
+ createGuest,
89
160
  getAppraisalService,
90
161
  postMessage,
91
- ssfGuest
162
+ setupHost
92
163
  };
File without changes
@@ -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.fffbea0b33100b3a1ff1.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.11dd502cfb083007c6d1.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.fffbea0b33100b3a1ff1.js"></script></head><body class="px-2 h-full"><main class="h-full"><h1 class="text-md font-bold">Credit Score Service</h1><div class="h-full mt-2"><output id="msg" class="mt-2 p-2"></output></div></main></body></html>
1
+ <!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.11dd502cfb083007c6d1.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>