@elliemae/ssf-guest 2.0.0-next.29

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 (110) hide show
  1. package/dist/cjs/app.config.json +20 -0
  2. package/dist/cjs/creditService.html +34 -0
  3. package/dist/cjs/guest.js +497 -0
  4. package/dist/cjs/index.html +18 -0
  5. package/dist/cjs/index.js +26 -0
  6. package/dist/cjs/loanValidation.html +18 -0
  7. package/dist/cjs/package.json +4 -0
  8. package/dist/cjs/pricingService.html +69 -0
  9. package/dist/cjs/proxy.js +43 -0
  10. package/dist/cjs/proxyEvent.js +49 -0
  11. package/dist/cjs/tests/constant.js +38 -0
  12. package/dist/cjs/tests/utils.js +107 -0
  13. package/dist/cjs/titleService.html +31 -0
  14. package/dist/cjs/utils.js +73 -0
  15. package/dist/cjs/window.js +16 -0
  16. package/dist/esm/app.config.json +20 -0
  17. package/dist/esm/creditService.html +34 -0
  18. package/dist/esm/guest.js +492 -0
  19. package/dist/esm/index.html +18 -0
  20. package/dist/esm/index.js +6 -0
  21. package/dist/esm/loanValidation.html +18 -0
  22. package/dist/esm/package.json +4 -0
  23. package/dist/esm/pricingService.html +69 -0
  24. package/dist/esm/proxy.js +23 -0
  25. package/dist/esm/proxyEvent.js +29 -0
  26. package/dist/esm/tests/constant.js +18 -0
  27. package/dist/esm/tests/utils.js +92 -0
  28. package/dist/esm/titleService.html +31 -0
  29. package/dist/esm/utils.js +53 -0
  30. package/dist/esm/window.js +0 -0
  31. package/dist/public/app.config.json +20 -0
  32. package/dist/public/businessObjects.js +3 -0
  33. package/dist/public/businessObjects.js.br +0 -0
  34. package/dist/public/businessObjects.js.gz +0 -0
  35. package/dist/public/businessObjects.js.map +1 -0
  36. package/dist/public/creditScoreService.js +3 -0
  37. package/dist/public/creditScoreService.js.br +0 -0
  38. package/dist/public/creditScoreService.js.gz +0 -0
  39. package/dist/public/creditScoreService.js.map +1 -0
  40. package/dist/public/creditService.html +1 -0
  41. package/dist/public/index.html +1 -0
  42. package/dist/public/js/emuiSsfGuest.376046c57fd914219e6b.js +3 -0
  43. package/dist/public/js/emuiSsfGuest.376046c57fd914219e6b.js.br +0 -0
  44. package/dist/public/js/emuiSsfGuest.376046c57fd914219e6b.js.gz +0 -0
  45. package/dist/public/js/emuiSsfGuest.376046c57fd914219e6b.js.map +1 -0
  46. package/dist/public/loanValidation.html +1 -0
  47. package/dist/public/loanValidation.js +3 -0
  48. package/dist/public/loanValidation.js.br +1 -0
  49. package/dist/public/loanValidation.js.gz +0 -0
  50. package/dist/public/loanValidation.js.map +1 -0
  51. package/dist/public/pricingService.html +1 -0
  52. package/dist/public/pricingService.js +3 -0
  53. package/dist/public/pricingService.js.br +0 -0
  54. package/dist/public/pricingService.js.gz +0 -0
  55. package/dist/public/pricingService.js.map +1 -0
  56. package/dist/public/titleService.html +1 -0
  57. package/dist/public/titleService.js +3 -0
  58. package/dist/public/titleService.js.br +2 -0
  59. package/dist/public/titleService.js.gz +0 -0
  60. package/dist/public/titleService.js.map +1 -0
  61. package/dist/public/util.js +3 -0
  62. package/dist/public/util.js.br +0 -0
  63. package/dist/public/util.js.gz +0 -0
  64. package/dist/public/util.js.map +1 -0
  65. package/dist/types/guest.d.ts +99 -0
  66. package/dist/types/index.d.ts +5 -0
  67. package/dist/types/proxy.d.ts +21 -0
  68. package/dist/types/proxyEvent.d.ts +40 -0
  69. package/dist/types/tests/constant.d.ts +8 -0
  70. package/dist/types/tests/guest.test.d.ts +7 -0
  71. package/dist/types/tests/scriptOnlyGuest.test.d.ts +1 -0
  72. package/dist/types/tests/scriptingObject.test.d.ts +7 -0
  73. package/dist/types/tests/utils.d.ts +52 -0
  74. package/dist/types/utils.d.ts +7 -0
  75. package/dist/types/window.d.ts +8 -0
  76. package/dist/umd/app.config.json +20 -0
  77. package/dist/umd/businessObjects.js +3 -0
  78. package/dist/umd/businessObjects.js.br +0 -0
  79. package/dist/umd/businessObjects.js.gz +0 -0
  80. package/dist/umd/businessObjects.js.map +1 -0
  81. package/dist/umd/creditScoreService.js +3 -0
  82. package/dist/umd/creditScoreService.js.br +0 -0
  83. package/dist/umd/creditScoreService.js.gz +0 -0
  84. package/dist/umd/creditScoreService.js.map +1 -0
  85. package/dist/umd/creditService.html +1 -0
  86. package/dist/umd/index.html +1 -0
  87. package/dist/umd/index.js +3 -0
  88. package/dist/umd/index.js.br +0 -0
  89. package/dist/umd/index.js.gz +0 -0
  90. package/dist/umd/index.js.map +1 -0
  91. package/dist/umd/loanValidation.html +1 -0
  92. package/dist/umd/loanValidation.js +3 -0
  93. package/dist/umd/loanValidation.js.br +1 -0
  94. package/dist/umd/loanValidation.js.gz +0 -0
  95. package/dist/umd/loanValidation.js.map +1 -0
  96. package/dist/umd/pricingService.html +1 -0
  97. package/dist/umd/pricingService.js +3 -0
  98. package/dist/umd/pricingService.js.br +0 -0
  99. package/dist/umd/pricingService.js.gz +0 -0
  100. package/dist/umd/pricingService.js.map +1 -0
  101. package/dist/umd/titleService.html +1 -0
  102. package/dist/umd/titleService.js +3 -0
  103. package/dist/umd/titleService.js.br +2 -0
  104. package/dist/umd/titleService.js.gz +0 -0
  105. package/dist/umd/titleService.js.map +1 -0
  106. package/dist/umd/util.js +3 -0
  107. package/dist/umd/util.js.br +0 -0
  108. package/dist/umd/util.js.gz +0 -0
  109. package/dist/umd/util.js.map +1 -0
  110. package/package.json +65 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "appId": "ssf-guest",
3
+ "activeEnv": "localhost",
4
+ "options": {
5
+ "hostUrl": "http://localhost:4000"
6
+ },
7
+ "env": {
8
+ "localhost": {
9
+ "options": {
10
+ "hostUrl": "http://localhost:4000"
11
+ }
12
+ },
13
+ "dev2": {},
14
+ "qa2": {},
15
+ "qa3": {},
16
+ "int": {},
17
+ "stage": {},
18
+ "prod": {}
19
+ }
20
+ }
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Credit Service</title>
8
+ <style>
9
+ body {
10
+ margin: 0px;
11
+ }
12
+ </style>
13
+ <script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script>
14
+ <script>
15
+ window.addEventListener('DOMContentLoaded', async () => {
16
+ window.__ICE__ = {
17
+ diagnosticsUrl:
18
+ 'https://int.api.ellielabs.com/diagnostics/v2/logging',
19
+ };
20
+ const locationUrl = new URL(window.location);
21
+ const scriptUri = locationUrl?.searchParams?.get?.('src');
22
+ window.__ICE__.ssfGuest = new ice.SSFGuest({
23
+ logger: {
24
+ index: 'creditServiceGuest',
25
+ team: 'ui platform',
26
+ appName: 'credit-service',
27
+ },
28
+ });
29
+ await window.__ICE__.ssfGuest.create(scriptUri, document.body);
30
+ });
31
+ </script>
32
+ </head>
33
+ <body></body>
34
+ </html>
@@ -0,0 +1,497 @@
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 __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var __publicField = (obj, key, value) => {
21
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
+ return value;
23
+ };
24
+ var __accessCheck = (obj, member, msg) => {
25
+ if (!member.has(obj))
26
+ throw TypeError("Cannot " + msg);
27
+ };
28
+ var __privateGet = (obj, member, getter) => {
29
+ __accessCheck(obj, member, "read from private field");
30
+ return getter ? getter.call(obj) : member.get(obj);
31
+ };
32
+ var __privateAdd = (obj, member, value) => {
33
+ if (member.has(obj))
34
+ throw TypeError("Cannot add the same private member more than once");
35
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
36
+ };
37
+ var __privateSet = (obj, member, value, setter) => {
38
+ __accessCheck(obj, member, "write to private field");
39
+ setter ? setter.call(obj, value) : member.set(obj, value);
40
+ return value;
41
+ };
42
+ var guest_exports = {};
43
+ __export(guest_exports, {
44
+ SSFGuest: () => SSFGuest
45
+ });
46
+ module.exports = __toCommonJS(guest_exports);
47
+ var import_uuid = require("uuid");
48
+ var import_ssf_common = require("@elliemae/ssf-common");
49
+ var import_pui_diagnostics = require("@elliemae/pui-diagnostics");
50
+ var import_proxy = require("./proxy.js");
51
+ var import_proxyEvent = require("./proxyEvent.js");
52
+ var import_utils = require("./utils.js");
53
+ var _correlationId, _logger, _remoting, _created, _scriptElement, _isConnected, _eventListeners, _id, _title, _url, _hostOrigin, _hostWindow, _getGuestInfo, _fromJSON, _invoke, _handleResponse, _handleConfigChangeEvent, _handleFocusEvent, _handleObjectEvent;
54
+ var ResponseType = /* @__PURE__ */ ((ResponseType2) => {
55
+ ResponseType2["OBJECT"] = "object";
56
+ ResponseType2["VALUE"] = "value";
57
+ return ResponseType2;
58
+ })(ResponseType || {});
59
+ const capabilities = {
60
+ eventFeedback: true
61
+ };
62
+ const onLoad = () => {
63
+ const { document: document2 } = window;
64
+ const iframeBody = document2.body;
65
+ const iframeHTML = document2.documentElement;
66
+ const bodyOffsetHeight = iframeBody.offsetHeight + (0, import_utils.getComputedStyle)("marginTop") + (0, import_utils.getComputedStyle)("marginBottom");
67
+ const size = {
68
+ height: bodyOffsetHeight,
69
+ width: Math.max(iframeBody.scrollWidth, iframeHTML.scrollWidth)
70
+ };
71
+ (0, import_ssf_common.sendMessage)({
72
+ targetWin: window.parent,
73
+ targetOrigin: (0, import_utils.getOrigin)(document2.referrer || window.parent.location.href),
74
+ messageType: import_ssf_common.MessageType.GuestResize,
75
+ messageBody: size
76
+ });
77
+ window.removeEventListener("load", onLoad);
78
+ };
79
+ if ((0, import_utils.isEmbedded)()) {
80
+ window.addEventListener("load", onLoad);
81
+ }
82
+ const DIAGNOSTICS_URL = "https://api.ellielabs.com/diagnostics/v2/logging";
83
+ class SSFGuest {
84
+ /**
85
+ * Create new guest
86
+ *
87
+ * @param {GuestOption} options - options for the guest
88
+ */
89
+ constructor(options) {
90
+ /* eslint-enable indent */
91
+ __privateAdd(this, _correlationId, void 0);
92
+ __privateAdd(this, _logger, void 0);
93
+ __privateAdd(this, _remoting, void 0);
94
+ __privateAdd(this, _created, false);
95
+ __privateAdd(this, _scriptElement, null);
96
+ __privateAdd(this, _isConnected, false);
97
+ __privateAdd(this, _eventListeners, /* @__PURE__ */ new Map());
98
+ __privateAdd(this, _id, null);
99
+ __privateAdd(this, _title, null);
100
+ __privateAdd(this, _url, null);
101
+ __privateAdd(this, _hostOrigin, null);
102
+ __privateAdd(this, _hostWindow, null);
103
+ __privateAdd(this, _getGuestInfo, () => ({
104
+ guestId: __privateGet(this, _id),
105
+ guestTitle: __privateGet(this, _title),
106
+ guestUrl: __privateGet(this, _url)
107
+ }));
108
+ /**
109
+ * Marshals scripting object JSON into a proxy object
110
+ *
111
+ * @param soJSON scripting object JSON
112
+ * @returns marshaled proxy object
113
+ */
114
+ __privateAdd(this, _fromJSON, (soJSON) => {
115
+ if (!soJSON || !soJSON.objectId) {
116
+ __privateGet(this, _logger).error(
117
+ "Deserialization of scripting object failed. Object does not have an Object ID."
118
+ );
119
+ throw new Error("Cannot deserialize object JSON into proxy.");
120
+ }
121
+ const ctrl = new import_proxy.Proxy(soJSON.objectId, soJSON.objectType);
122
+ if (soJSON.functions) {
123
+ soJSON.functions.forEach((functionName) => {
124
+ Object.defineProperty(ctrl, functionName, {
125
+ value: async (...args) => __privateGet(this, _invoke).call(this, {
126
+ objectId: ctrl.id,
127
+ functionName,
128
+ functionParams: [].slice.call(args)
129
+ }),
130
+ enumerable: true
131
+ });
132
+ });
133
+ }
134
+ if (soJSON.events) {
135
+ soJSON.events.forEach((eventName) => {
136
+ Object.defineProperty(ctrl, eventName, {
137
+ value: new import_proxyEvent.ProxyEvent({
138
+ objectId: ctrl.id,
139
+ name: eventName
140
+ }),
141
+ enumerable: true
142
+ });
143
+ });
144
+ }
145
+ __privateGet(this, _logger).debug(
146
+ `Created guest proxy for scripting object (id = "${ctrl.id}")`
147
+ );
148
+ return ctrl;
149
+ });
150
+ __privateAdd(this, _invoke, async ({
151
+ objectId,
152
+ functionName,
153
+ functionParams
154
+ }) => {
155
+ __privateGet(this, _logger).debug(
156
+ `Invoking scripting object method ${objectId}.${functionName}()...`
157
+ );
158
+ const promises = [];
159
+ if (functionParams) {
160
+ for (let i = 0; i < functionParams.length; i += 1) {
161
+ const p = functionParams[i];
162
+ if (p instanceof Promise) {
163
+ promises.push(
164
+ p.then((val) => {
165
+ functionParams[i] = val;
166
+ })
167
+ );
168
+ }
169
+ }
170
+ }
171
+ await Promise.all(promises);
172
+ const response = await __privateGet(this, _remoting).invoke({
173
+ targetWin: __privateGet(this, _hostWindow),
174
+ targetOrigin: __privateGet(this, _hostOrigin),
175
+ messageType: import_ssf_common.MessageType.ObjectInvoke,
176
+ messageBody: {
177
+ objectId,
178
+ functionName,
179
+ functionParams
180
+ }
181
+ });
182
+ const retVal = __privateGet(this, _handleResponse).call(this, response);
183
+ __privateGet(this, _logger).audit({
184
+ message: "Guest proxy invoked Scripting Object method",
185
+ scriptingObject: objectId,
186
+ scriptingMethod: functionName,
187
+ ...__privateGet(this, _getGuestInfo).call(this)
188
+ });
189
+ return retVal;
190
+ });
191
+ __privateAdd(this, _handleResponse, (response) => {
192
+ if (response?.type === "object" /* OBJECT */ && "object" in response) {
193
+ return __privateGet(this, _fromJSON).call(this, response.object);
194
+ }
195
+ if (response?.type === "value" /* VALUE */) {
196
+ return response.value;
197
+ }
198
+ return response;
199
+ });
200
+ __privateAdd(this, _handleConfigChangeEvent, ({ body }) => {
201
+ if (body?.logLevel) {
202
+ __privateGet(this, _logger).setLogLevel(body.logLevel);
203
+ __privateGet(this, _logger).debug(`Log level changed by host to ${body.logLevel}`);
204
+ }
205
+ __privateSet(this, _id, body?.guestId ?? null);
206
+ __privateSet(this, _title, body?.guestTitle ?? null);
207
+ __privateSet(this, _url, body?.guestUrl ?? null);
208
+ __privateGet(this, _logger).audit({
209
+ message: "Received configuration from Host",
210
+ ...__privateGet(this, _getGuestInfo).call(this)
211
+ });
212
+ });
213
+ __privateAdd(this, _handleFocusEvent, () => {
214
+ window.focus();
215
+ });
216
+ __privateAdd(this, _handleObjectEvent, async ({
217
+ sourceWin,
218
+ sourceOrigin,
219
+ requestId,
220
+ body
221
+ }) => {
222
+ const object = __privateGet(this, _fromJSON).call(this, body.object);
223
+ if (object) {
224
+ const eventId = (0, import_ssf_common.getEventId)(object.id, body.eventName);
225
+ __privateGet(this, _logger).debug(`Received event "${eventId}" from host`);
226
+ let listeners;
227
+ if (body.eventHandler) {
228
+ listeners = [
229
+ {
230
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
231
+ callback: window[body.eventHandler],
232
+ token: (0, import_uuid.v4)()
233
+ }
234
+ ];
235
+ } else {
236
+ listeners = __privateGet(this, _eventListeners).get(eventId) || [];
237
+ }
238
+ const promises = [];
239
+ listeners.forEach((callbackInfo) => {
240
+ if (callbackInfo?.callback) {
241
+ __privateGet(this, _logger).debug(
242
+ `Invoking event subscriber ${callbackInfo.callback.name} for event ${eventId}`
243
+ );
244
+ const retVal = callbackInfo.callback({
245
+ obj: object,
246
+ eventName: body.eventName,
247
+ eventParams: body.eventParams,
248
+ eventOptions: body.eventOptions
249
+ });
250
+ if (retVal instanceof Promise) {
251
+ promises.push(retVal);
252
+ } else if (typeof retVal !== "undefined") {
253
+ promises.push(Promise.resolve(retVal));
254
+ }
255
+ }
256
+ });
257
+ if (requestId) {
258
+ const values = await Promise.all(promises);
259
+ __privateGet(this, _remoting).respond({
260
+ targetWin: sourceWin,
261
+ targetOrigin: sourceOrigin,
262
+ requestId,
263
+ response: values
264
+ });
265
+ __privateGet(this, _logger).audit({
266
+ message: "Guest proxy processed event from host and responded",
267
+ scriptingEventId: eventId,
268
+ scriptingObject: object.id,
269
+ ...__privateGet(this, _getGuestInfo).call(this)
270
+ });
271
+ } else {
272
+ __privateGet(this, _logger).audit({
273
+ message: "Guest proxy processed event from host",
274
+ scriptingEventId: eventId,
275
+ scriptingObject: object.id,
276
+ ...__privateGet(this, _getGuestInfo).call(this)
277
+ });
278
+ }
279
+ }
280
+ });
281
+ /**
282
+ * Initialize guest using script
283
+ *
284
+ * @param scriptUri uri of the script
285
+ * @param containerElement dom element to inject the script at
286
+ */
287
+ __publicField(this, "addScript", async (scriptUri, containerElement) => {
288
+ if (!__privateGet(this, _created) && scriptUri) {
289
+ await this.connect();
290
+ const scriptEle = document.createElement("script");
291
+ scriptEle.setAttribute("src", scriptUri);
292
+ await new Promise((resolve) => {
293
+ const onScriptLoad = () => {
294
+ scriptEle?.removeEventListener?.("load", onScriptLoad);
295
+ __privateSet(this, _created, true);
296
+ resolve();
297
+ };
298
+ scriptEle.addEventListener("load", onScriptLoad);
299
+ __privateSet(this, _scriptElement, containerElement.appendChild(scriptEle));
300
+ });
301
+ }
302
+ });
303
+ /**
304
+ * Close the connection to the host
305
+ */
306
+ __publicField(this, "close", () => {
307
+ if (!__privateGet(this, _isConnected))
308
+ return;
309
+ __privateGet(this, _remoting).send({
310
+ targetWin: __privateGet(this, _hostWindow),
311
+ targetOrigin: __privateGet(this, _hostOrigin),
312
+ messageType: import_ssf_common.MessageType.GuestClose,
313
+ messageBody: {}
314
+ });
315
+ __privateGet(this, _remoting).removeSender({
316
+ origin: __privateGet(this, _hostOrigin),
317
+ window: __privateGet(this, _hostWindow)
318
+ });
319
+ __privateGet(this, _remoting).close();
320
+ __privateSet(this, _isConnected, false);
321
+ __privateGet(this, _logger).audit({
322
+ message: "Guest disconnected from host",
323
+ ...__privateGet(this, _getGuestInfo).call(this)
324
+ });
325
+ __privateSet(this, _id, null);
326
+ __privateSet(this, _url, null);
327
+ __privateSet(this, _title, null);
328
+ });
329
+ /**
330
+ * Connect to the host
331
+ *
332
+ * @param {ConnectParam} param - reference to the guest window or options
333
+ */
334
+ __publicField(this, "connect", async (param) => {
335
+ if (!__privateGet(this, _isConnected)) {
336
+ let guestWindow = window;
337
+ let guestOptions = { ...capabilities };
338
+ if (param) {
339
+ guestWindow = param.window || guestWindow;
340
+ const clonedOptions = { ...param };
341
+ delete clonedOptions.window;
342
+ guestOptions = Object.assign(guestOptions, clonedOptions);
343
+ }
344
+ const hostDetails = await (0, import_utils.getHostDetails)();
345
+ __privateSet(this, _hostOrigin, hostDetails.origin);
346
+ __privateSet(this, _hostWindow, hostDetails.window);
347
+ __privateGet(this, _remoting).initialize(guestWindow);
348
+ __privateGet(this, _remoting).addSender({
349
+ origin: __privateGet(this, _hostOrigin),
350
+ window: __privateGet(this, _hostWindow)
351
+ });
352
+ __privateGet(this, _remoting).listen({
353
+ messageType: import_ssf_common.MessageType.ObjectEvent,
354
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
355
+ callback: __privateGet(this, _handleObjectEvent).bind(this)
356
+ });
357
+ __privateGet(this, _remoting).listen({
358
+ messageType: import_ssf_common.MessageType.HostConfig,
359
+ callback: __privateGet(this, _handleConfigChangeEvent).bind(this)
360
+ });
361
+ __privateGet(this, _remoting).listen({
362
+ messageType: import_ssf_common.MessageType.GuestFocus,
363
+ callback: __privateGet(this, _handleFocusEvent).bind(this)
364
+ });
365
+ __privateGet(this, _remoting).send({
366
+ targetWin: __privateGet(this, _hostWindow),
367
+ targetOrigin: __privateGet(this, _hostOrigin),
368
+ messageType: import_ssf_common.MessageType.GuestReady,
369
+ messageBody: guestOptions
370
+ });
371
+ __privateSet(this, _isConnected, true);
372
+ __privateGet(this, _logger).audit({
373
+ message: "Guest connected to host",
374
+ guestUrl: window.location.href
375
+ });
376
+ }
377
+ });
378
+ /**
379
+ * Get scripting object proxy by id
380
+ *
381
+ * @param objectId unique id of the scripting object
382
+ * @returns scripting object proxy
383
+ */
384
+ __publicField(this, "getObject", async (objectId) => {
385
+ __privateGet(this, _logger).debug(
386
+ `Retrieving scripting object "${objectId}" from host...`
387
+ );
388
+ const response = await __privateGet(this, _remoting).invoke({
389
+ targetWin: __privateGet(this, _hostWindow),
390
+ targetOrigin: __privateGet(this, _hostOrigin),
391
+ messageType: import_ssf_common.MessageType.ObjectGet,
392
+ messageBody: {
393
+ objectId
394
+ }
395
+ });
396
+ const obj = __privateGet(this, _fromJSON).call(this, response.object);
397
+ __privateGet(this, _logger).audit({
398
+ message: "Received scripting object from host",
399
+ scriptingObject: objectId,
400
+ ...__privateGet(this, _getGuestInfo).call(this)
401
+ });
402
+ return obj;
403
+ });
404
+ /**
405
+ * remove the guest from the host
406
+ */
407
+ __publicField(this, "removeScript", () => {
408
+ if (!__privateGet(this, _created))
409
+ return;
410
+ if (__privateGet(this, _scriptElement)) {
411
+ const { parentNode } = __privateGet(this, _scriptElement);
412
+ parentNode?.removeChild?.(__privateGet(this, _scriptElement));
413
+ }
414
+ });
415
+ /**
416
+ * Set the log level
417
+ *
418
+ * @param {LogLevels} logLevel - log level
419
+ * @param level
420
+ */
421
+ __publicField(this, "setLogLevel", (level) => {
422
+ __privateGet(this, _logger).setLogLevel(level);
423
+ __privateGet(this, _logger).debug(`Log level changed by guest to ${level}`);
424
+ });
425
+ /**
426
+ * subscribe to an scripting object event
427
+ *
428
+ * @param {GuestSubscribeParam<EventId, AppEvents[EventId]>} param - parameters for subscribing to an event
429
+ * @returns subscription token
430
+ */
431
+ __publicField(this, "subscribe", (param) => {
432
+ const { eventId, callback } = param;
433
+ __privateGet(this, _logger).debug(`Registering subscription for event ${eventId}`);
434
+ const listeners = __privateGet(this, _eventListeners).get(eventId) || [];
435
+ const token = (0, import_uuid.v4)();
436
+ listeners.push({ callback, token });
437
+ __privateGet(this, _eventListeners).set(eventId, listeners);
438
+ return token;
439
+ });
440
+ /**
441
+ * unsubscribe from an scripting object event
442
+ *
443
+ * @param {GuestUnsubscribeParam<EventId>} param - parameters for unsubscribing from an event
444
+ */
445
+ __publicField(this, "unsubscribe", (param) => {
446
+ const { eventId, token } = param;
447
+ let listeners = __privateGet(this, _eventListeners).get(eventId);
448
+ if (listeners) {
449
+ listeners = listeners.filter(
450
+ (callbackInfo) => callbackInfo.token !== token
451
+ );
452
+ __privateGet(this, _eventListeners).set(eventId, listeners);
453
+ }
454
+ });
455
+ const {
456
+ console: logToConsole = false,
457
+ // eslint-disable-next-line no-underscore-dangle
458
+ url = window.__ICE__?.diagnosticsUrl || DIAGNOSTICS_URL,
459
+ index,
460
+ team,
461
+ appName
462
+ } = options?.logger || {};
463
+ const transport = logToConsole ? (0, import_pui_diagnostics.Console)() : (0, import_pui_diagnostics.http)(url);
464
+ __privateSet(this, _logger, (0, import_pui_diagnostics.logger)({
465
+ transport,
466
+ index,
467
+ team,
468
+ appName
469
+ }));
470
+ __privateSet(this, _correlationId, (0, import_uuid.v4)());
471
+ __privateSet(this, _remoting, new import_ssf_common.Remoting(__privateGet(this, _logger), __privateGet(this, _correlationId)));
472
+ __privateGet(this, _logger).audit({
473
+ message: "Guest created",
474
+ guestUrl: window.location.href,
475
+ correlationId: __privateGet(this, _correlationId)
476
+ });
477
+ }
478
+ }
479
+ _correlationId = new WeakMap();
480
+ _logger = new WeakMap();
481
+ _remoting = new WeakMap();
482
+ _created = new WeakMap();
483
+ _scriptElement = new WeakMap();
484
+ _isConnected = new WeakMap();
485
+ _eventListeners = new WeakMap();
486
+ _id = new WeakMap();
487
+ _title = new WeakMap();
488
+ _url = new WeakMap();
489
+ _hostOrigin = new WeakMap();
490
+ _hostWindow = new WeakMap();
491
+ _getGuestInfo = new WeakMap();
492
+ _fromJSON = new WeakMap();
493
+ _invoke = new WeakMap();
494
+ _handleResponse = new WeakMap();
495
+ _handleConfigChangeEvent = new WeakMap();
496
+ _handleFocusEvent = new WeakMap();
497
+ _handleObjectEvent = new WeakMap();
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" style="height:100%;">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Plugin</title>
8
+ <script src="https://cdn.tailwindcss.com?plugins=forms"></script>
9
+ </head>
10
+ <body class="px-2 h-full">
11
+ <main class="h-full">
12
+ <h1 class="text-md font-bold">Credit Score Service</h1>
13
+ <div class="h-full mt-2">
14
+ <output id="msg" class="mt-2 p-2"></output>
15
+ </div>
16
+ </main>
17
+ </body>
18
+ </html>
@@ -0,0 +1,26 @@
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 __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var lib_exports = {};
20
+ __export(lib_exports, {
21
+ ProxyEvent: () => import_proxyEvent.ProxyEvent,
22
+ SSFGuest: () => import_guest.SSFGuest
23
+ });
24
+ module.exports = __toCommonJS(lib_exports);
25
+ var import_guest = require("./guest.js");
26
+ var import_proxyEvent = require("./proxyEvent.js");
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Loan Validation</title>
8
+ <style>
9
+ body {
10
+ margin: 0px;
11
+ }
12
+ </style>
13
+ <script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script>
14
+ </head>
15
+ <body class="px-2">
16
+ <script src="./loanValidation.js" type="module"></script>
17
+ </body>
18
+ </html>
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "commonjs",
3
+ "sideEffects": false
4
+ }
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Pricing Service</title>
8
+ <script src="https://cdn.tailwindcss.com?plugins=forms"></script>
9
+ <script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script>
10
+ </head>
11
+ <body class="px-2">
12
+ <main>
13
+ <h3 class="text-lg font-medium leading-6 text-gray-900">
14
+ Mortgage Pricing
15
+ </h3>
16
+ <div class="mt-5 bg-orange-100 shadow sm:rounded-lg">
17
+ <div class="px-4 py-5 sm:px-6">
18
+ <h3 class="text-lg font-medium leading-6 text-gray-900">
19
+ Average Rates
20
+ </h3>
21
+ <p class="mt-1 max-w-2xl text-sm text-gray-500">
22
+ for $<span id="loanAmount"></span>; Term:
23
+ <span id="term"></span> years; Down Payment: $<span
24
+ id="downPayment"
25
+ ></span>
26
+ </p>
27
+ </div>
28
+ <div class="border-t border-gray-200">
29
+ <dl>
30
+ <div
31
+ class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"
32
+ >
33
+ <dt class="text-sm font-medium text-gray-500">30-yr fixed</dt>
34
+ <dd
35
+ id="30yearRate"
36
+ class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"
37
+ >
38
+ 7.01%
39
+ </dd>
40
+ </div>
41
+ <div
42
+ class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"
43
+ >
44
+ <dt class="text-sm font-medium text-gray-500">15-yr fixed</dt>
45
+ <dd
46
+ id="15yearRate"
47
+ class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"
48
+ >
49
+ 5.61%
50
+ </dd>
51
+ </div>
52
+ <div
53
+ class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"
54
+ >
55
+ <dt class="text-sm font-medium text-gray-500">10/6 ARM</dt>
56
+ <dd
57
+ id="106ARMRate"
58
+ class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"
59
+ >
60
+ 6.42%
61
+ </dd>
62
+ </div>
63
+ </dl>
64
+ </div>
65
+ </div>
66
+ </main>
67
+ <script src="./pricingService.js" type="module"></script>
68
+ </body>
69
+ </html>