@elliemae/ssf-guest 2.9.9 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/creditService.html +1 -1
- package/dist/cjs/guest.js +71 -22
- package/dist/cjs/loanValidation.html +1 -1
- package/dist/cjs/pricingService.html +1 -1
- package/dist/cjs/tests/utils.js +11 -1
- package/dist/cjs/titleService.html +27 -28
- package/dist/cjs/v1-adapter.js +92 -0
- package/dist/cjs/v2-guest.html +1 -5
- package/dist/esm/creditService.html +1 -1
- package/dist/esm/guest.js +72 -23
- package/dist/esm/loanValidation.html +1 -1
- package/dist/esm/pricingService.html +1 -1
- package/dist/esm/tests/utils.js +11 -1
- package/dist/esm/titleService.html +27 -28
- package/dist/esm/v1-adapter.js +72 -0
- package/dist/esm/v2-guest.html +1 -5
- package/dist/public/businessObjects.js.gz +0 -0
- package/dist/public/creditScoreService.js.gz +0 -0
- package/dist/public/creditService.html +1 -1
- package/dist/public/index.html +1 -1
- package/dist/public/js/emuiSsfGuest.a6277961cb41c8cde6b0.js +29 -0
- package/dist/public/js/emuiSsfGuest.a6277961cb41c8cde6b0.js.br +0 -0
- package/dist/public/js/emuiSsfGuest.a6277961cb41c8cde6b0.js.gz +0 -0
- package/dist/public/js/emuiSsfGuest.a6277961cb41c8cde6b0.js.map +1 -0
- package/dist/public/loanValidation.html +1 -1
- package/dist/public/loanValidation.js.gz +0 -0
- package/dist/public/pricingService.html +1 -1
- package/dist/public/pricingService.js.gz +0 -0
- package/dist/public/titleService.html +1 -1
- package/dist/public/titleService.js.gz +0 -0
- package/dist/public/util.js +1 -1
- package/dist/public/util.js.br +0 -0
- package/dist/public/util.js.gz +0 -0
- package/dist/public/util.js.map +1 -1
- package/dist/public/v2-guest.html +1 -1
- package/dist/types/lib/guest.d.ts +17 -9
- package/dist/types/lib/index.d.ts +1 -1
- package/dist/types/lib/typings/window.d.ts +17 -0
- package/dist/types/lib/v1-adapter.d.ts +10 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/businessObjects.js.gz +0 -0
- package/dist/umd/creditScoreService.js.gz +0 -0
- package/dist/umd/creditService.html +1 -1
- package/dist/umd/index.js +15 -15
- package/dist/umd/index.js.br +0 -0
- package/dist/umd/index.js.gz +0 -0
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/loanValidation.html +1 -1
- package/dist/umd/loanValidation.js.gz +0 -0
- package/dist/umd/pricingService.html +1 -1
- package/dist/umd/pricingService.js.gz +0 -0
- package/dist/umd/titleService.html +1 -1
- package/dist/umd/titleService.js.gz +0 -0
- package/dist/umd/util.js +1 -1
- package/dist/umd/util.js.br +0 -0
- package/dist/umd/util.js.gz +0 -0
- package/dist/umd/util.js.map +1 -1
- package/dist/umd/v2-guest.html +1 -1
- package/package.json +5 -5
- package/dist/cjs/proxy.js +0 -42
- package/dist/cjs/types.js +0 -16
- package/dist/esm/proxy.js +0 -22
- package/dist/esm/types.js +0 -0
- package/dist/public/js/emuiSsfGuest.f2e6a00ee4685efdf26f.js +0 -29
- package/dist/public/js/emuiSsfGuest.f2e6a00ee4685efdf26f.js.br +0 -0
- package/dist/public/js/emuiSsfGuest.f2e6a00ee4685efdf26f.js.gz +0 -0
- package/dist/public/js/emuiSsfGuest.f2e6a00ee4685efdf26f.js.map +0 -1
- package/dist/types/lib/proxy.d.ts +0 -20
- package/dist/types/lib/types.d.ts +0 -6
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
margin: 0px;
|
|
11
11
|
}
|
|
12
12
|
</style>
|
|
13
|
-
<script src="https://
|
|
13
|
+
<script src="https://cdn.qa1.ice.com/pui-diagnostics@3"></script>
|
|
14
14
|
<script>
|
|
15
15
|
window.addEventListener('DOMContentLoaded', async () => {
|
|
16
16
|
window.__ICE__ = {
|
package/dist/cjs/guest.js
CHANGED
|
@@ -25,8 +25,9 @@ var import_uuid = require("uuid");
|
|
|
25
25
|
var import_lodash = require("lodash");
|
|
26
26
|
var import_microfe_common = require("@elliemae/microfe-common");
|
|
27
27
|
var import_pui_diagnostics = require("@elliemae/pui-diagnostics");
|
|
28
|
-
var import_proxy = require("./proxy.js");
|
|
29
28
|
var import_utils = require("./utils.js");
|
|
29
|
+
var import_v1_adapter = require("./v1-adapter.js");
|
|
30
|
+
const import_meta = {};
|
|
30
31
|
var ResponseType = /* @__PURE__ */ ((ResponseType2) => {
|
|
31
32
|
ResponseType2["OBJECT"] = "object";
|
|
32
33
|
ResponseType2["VALUE"] = "value";
|
|
@@ -56,8 +57,21 @@ const onLoad = () => {
|
|
|
56
57
|
if ((0, import_utils.isEmbedded)()) {
|
|
57
58
|
window.addEventListener("load", onLoad);
|
|
58
59
|
}
|
|
59
|
-
const
|
|
60
|
+
const diagnosticsEndpoint = {
|
|
61
|
+
"cdn.ice.com": "https://api.elliemae.com/diagnostics/v2/logging",
|
|
62
|
+
"cdn.np.ice.com": "https://stg.api.elliemae.com/diagnostics/v2/logging",
|
|
63
|
+
"cdn.uat.ice.com": "https://concept.api.elliemae.com/diagnostics/v2/logging",
|
|
64
|
+
"cdn.pt1.ice.com": "https://pel1.api.ellielabs.com/diagnostics/v2/logging",
|
|
65
|
+
"cdn.qa1.ice.com": "https://int.api.ellielabs.com/diagnostics/v2/logging",
|
|
66
|
+
"cdn.dev1.ice.com": "https://int.api.ellielabs.com/diagnostics/v2/logging",
|
|
67
|
+
localhost: "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
68
|
+
};
|
|
60
69
|
const userInteractionEvents = ["click", "scroll", "keypress", "touchstart"];
|
|
70
|
+
const getDiagnosticsAPIUrl = () => {
|
|
71
|
+
const scriptUrl = document.currentScript?.src || import_meta.url;
|
|
72
|
+
const hostName = scriptUrl ? new URL(scriptUrl).hostname : "localhost";
|
|
73
|
+
return diagnosticsEndpoint[hostName] || diagnosticsEndpoint["cdn.qa1.ice.com"];
|
|
74
|
+
};
|
|
61
75
|
class SSFGuest {
|
|
62
76
|
/* eslint-enable indent */
|
|
63
77
|
#correlationId;
|
|
@@ -108,21 +122,22 @@ class SSFGuest {
|
|
|
108
122
|
* Create new guest
|
|
109
123
|
* @param {GuestOption} options - options for the guest
|
|
110
124
|
*/
|
|
125
|
+
// eslint-disable-next-line complexity
|
|
111
126
|
constructor(options) {
|
|
112
127
|
const {
|
|
113
128
|
console: logToConsole = false,
|
|
114
129
|
// eslint-disable-next-line no-underscore-dangle
|
|
115
|
-
url = window.__ICE__?.diagnosticsUrl ||
|
|
116
|
-
index,
|
|
117
|
-
team,
|
|
118
|
-
appName
|
|
130
|
+
url = window.__ICE__?.diagnosticsUrl || getDiagnosticsAPIUrl(),
|
|
131
|
+
index = "ssf-guest-v2",
|
|
132
|
+
team = "ICE",
|
|
133
|
+
appName = "SSF Guest V2 Application"
|
|
119
134
|
} = options?.logger ?? {};
|
|
120
135
|
this.#loggerOptions = options?.logger;
|
|
121
136
|
this.#usesDevConnectAPI = options?.usesDevConnectAPI ?? false;
|
|
122
137
|
this.#keepAlive = options?.keepAlive ?? true;
|
|
123
138
|
this.#keepAliveInterval = options?.keepAliveInterval ?? KEEP_ALIVE_INTERVAL;
|
|
124
139
|
const transport = logToConsole ? (0, import_pui_diagnostics.Console)() : (0, import_pui_diagnostics.http)(url);
|
|
125
|
-
this.#logger = (0, import_pui_diagnostics.logger)({
|
|
140
|
+
this.#logger = options?.appLogger ?? (0, import_pui_diagnostics.logger)({
|
|
126
141
|
transport,
|
|
127
142
|
index,
|
|
128
143
|
team,
|
|
@@ -132,6 +147,7 @@ class SSFGuest {
|
|
|
132
147
|
(0, import_pui_diagnostics.logUnhandledErrors)(this.#logger);
|
|
133
148
|
this.#correlationId = (0, import_uuid.v4)();
|
|
134
149
|
this.#remoting = new import_microfe_common.Remoting(this.#logger, this.#correlationId);
|
|
150
|
+
(0, import_v1_adapter.setupV1Adapter)(this);
|
|
135
151
|
this.#logger.audit({
|
|
136
152
|
message: "Guest created",
|
|
137
153
|
guestUrl: window.location.href,
|
|
@@ -155,7 +171,7 @@ class SSFGuest {
|
|
|
155
171
|
);
|
|
156
172
|
throw new Error("Cannot deserialize object JSON into proxy.");
|
|
157
173
|
}
|
|
158
|
-
const ctrl = new
|
|
174
|
+
const ctrl = new import_microfe_common.ScriptingObjectProxy(soJSON.objectId, soJSON.objectType);
|
|
159
175
|
if (soJSON.functions) {
|
|
160
176
|
soJSON.functions.forEach((functionName) => {
|
|
161
177
|
Object.defineProperty(ctrl, functionName, {
|
|
@@ -173,7 +189,8 @@ class SSFGuest {
|
|
|
173
189
|
Object.defineProperty(ctrl, eventName, {
|
|
174
190
|
value: new import_microfe_common.ProxyEvent({
|
|
175
191
|
objectId: ctrl.id,
|
|
176
|
-
name: eventName
|
|
192
|
+
name: eventName,
|
|
193
|
+
eventSrc: this
|
|
177
194
|
}),
|
|
178
195
|
enumerable: true
|
|
179
196
|
});
|
|
@@ -452,19 +469,27 @@ class SSFGuest {
|
|
|
452
469
|
*/
|
|
453
470
|
#useParentApplicationLogger = async () => {
|
|
454
471
|
try {
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
const {
|
|
472
|
+
const moduleObj = await this.getObject("module");
|
|
473
|
+
if (moduleObj?.log && !this.#loggerOptions.console) {
|
|
474
|
+
const {
|
|
475
|
+
index = "",
|
|
476
|
+
team = "",
|
|
477
|
+
appName = ""
|
|
478
|
+
} = this.#loggerOptions || {};
|
|
479
|
+
if (!index || !team || !appName)
|
|
480
|
+
throw new Error(
|
|
481
|
+
"Missing one of required logger options: index, team, appName"
|
|
482
|
+
);
|
|
458
483
|
this.#logger = (0, import_pui_diagnostics.logger)({
|
|
459
|
-
transport: (0, import_pui_diagnostics.parentApp)(
|
|
484
|
+
transport: (0, import_pui_diagnostics.parentApp)(moduleObj),
|
|
460
485
|
index,
|
|
461
486
|
team,
|
|
462
487
|
appName
|
|
463
488
|
});
|
|
464
489
|
}
|
|
465
490
|
} catch (e) {
|
|
466
|
-
this.#logger.
|
|
467
|
-
`
|
|
491
|
+
this.#logger.info(
|
|
492
|
+
`Module object not exposed from hosting application. using local logger instance. ${e.message}`
|
|
468
493
|
);
|
|
469
494
|
}
|
|
470
495
|
};
|
|
@@ -478,10 +503,12 @@ class SSFGuest {
|
|
|
478
503
|
await this.connect();
|
|
479
504
|
const scriptEle = document.createElement("script");
|
|
480
505
|
scriptEle.setAttribute("src", scriptUri);
|
|
506
|
+
scriptEle.setAttribute("type", "module");
|
|
481
507
|
await new Promise((resolve) => {
|
|
482
508
|
const onScriptLoad = () => {
|
|
483
509
|
scriptEle?.removeEventListener?.("load", onScriptLoad);
|
|
484
510
|
this.#created = true;
|
|
511
|
+
(0, import_v1_adapter.setScriptOnlyGuest)(true);
|
|
485
512
|
resolve();
|
|
486
513
|
};
|
|
487
514
|
scriptEle.addEventListener("load", onScriptLoad);
|
|
@@ -572,7 +599,6 @@ class SSFGuest {
|
|
|
572
599
|
this.#handleParentClose();
|
|
573
600
|
if (this.#usesDevConnectAPI) await this.getAuthToken();
|
|
574
601
|
await this.#startKeepSessionAlive();
|
|
575
|
-
await this.#useParentApplicationLogger();
|
|
576
602
|
window.addEventListener("beforeunload", this.close);
|
|
577
603
|
this.#logger.audit({
|
|
578
604
|
message: "Guest connected to host",
|
|
@@ -615,6 +641,7 @@ class SSFGuest {
|
|
|
615
641
|
this.#logger.debug(
|
|
616
642
|
`Retrieving scripting object "${objectId}" from host...`
|
|
617
643
|
);
|
|
644
|
+
if (!this.#isConnected) throw new Error("Not connected to host");
|
|
618
645
|
const response = await this.#remoting.invoke({
|
|
619
646
|
targetWin: this.#hostWindow,
|
|
620
647
|
targetOrigin: this.#hostOrigin,
|
|
@@ -631,6 +658,28 @@ class SSFGuest {
|
|
|
631
658
|
});
|
|
632
659
|
return obj;
|
|
633
660
|
};
|
|
661
|
+
/**
|
|
662
|
+
* Get names of scripting objects exposed by the host
|
|
663
|
+
* @returns scripting objects exposed by the host
|
|
664
|
+
*/
|
|
665
|
+
listObjects = async () => {
|
|
666
|
+
this.#logger.debug(
|
|
667
|
+
`Retrieving names of scripting objects exposed by host...`
|
|
668
|
+
);
|
|
669
|
+
if (!this.#isConnected) throw new Error("Not connected to host");
|
|
670
|
+
const objects = await this.#remoting.invoke({
|
|
671
|
+
targetWin: this.#hostWindow,
|
|
672
|
+
targetOrigin: this.#hostOrigin,
|
|
673
|
+
messageType: import_microfe_common.MessageType.ListObjects,
|
|
674
|
+
messageBody: {}
|
|
675
|
+
});
|
|
676
|
+
this.#logger.audit({
|
|
677
|
+
message: "Received names of all scripting objects exposed by host",
|
|
678
|
+
objects,
|
|
679
|
+
...this.#getGuestInfo()
|
|
680
|
+
});
|
|
681
|
+
return objects;
|
|
682
|
+
};
|
|
634
683
|
/**
|
|
635
684
|
* remove the guest from the host
|
|
636
685
|
*/
|
|
@@ -652,30 +701,30 @@ class SSFGuest {
|
|
|
652
701
|
};
|
|
653
702
|
/**
|
|
654
703
|
* subscribe to an scripting object event
|
|
655
|
-
* @param {
|
|
704
|
+
* @param {SubscribeParam<EventId, AppEvents[EventId]>} param - parameters for subscribing to an event
|
|
656
705
|
* @returns subscription token
|
|
657
706
|
*/
|
|
658
707
|
subscribe = (param) => {
|
|
659
708
|
const { eventId, callback } = param;
|
|
660
709
|
this.#logger.debug(`Registering subscription for event ${eventId}`);
|
|
661
|
-
const listeners = this.#eventListeners.get(eventId) || [];
|
|
710
|
+
const listeners = this.#eventListeners.get(eventId.toLowerCase()) || [];
|
|
662
711
|
const token = (0, import_uuid.v4)();
|
|
663
712
|
listeners.push({ callback, token });
|
|
664
|
-
this.#eventListeners.set(eventId, listeners);
|
|
713
|
+
this.#eventListeners.set(eventId.toLowerCase(), listeners);
|
|
665
714
|
return token;
|
|
666
715
|
};
|
|
667
716
|
/**
|
|
668
717
|
* unsubscribe from an scripting object event
|
|
669
|
-
* @param {
|
|
718
|
+
* @param {UnsubscribeParam<EventId>} param - parameters for unsubscribing from an event
|
|
670
719
|
*/
|
|
671
720
|
unsubscribe = (param) => {
|
|
672
721
|
const { eventId, token } = param;
|
|
673
|
-
let listeners = this.#eventListeners.get(eventId);
|
|
722
|
+
let listeners = this.#eventListeners.get(eventId.toLowerCase());
|
|
674
723
|
if (listeners) {
|
|
675
724
|
listeners = listeners.filter(
|
|
676
725
|
(callbackInfo) => callbackInfo.token !== token
|
|
677
726
|
);
|
|
678
|
-
this.#eventListeners.set(eventId, listeners);
|
|
727
|
+
this.#eventListeners.set(eventId.toLowerCase(), listeners);
|
|
679
728
|
}
|
|
680
729
|
};
|
|
681
730
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
margin: 0px;
|
|
11
11
|
}
|
|
12
12
|
</style>
|
|
13
|
-
<script src="https://
|
|
13
|
+
<script src="https://cdn.qa1.ice.com/pui-diagnostics@3"></script>
|
|
14
14
|
</head>
|
|
15
15
|
<body class="px-2">
|
|
16
16
|
<script src="./loanValidation.js" type="module"></script>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Pricing Service</title>
|
|
8
8
|
<script src="https://cdn.tailwindcss.com?plugins=forms"></script>
|
|
9
|
-
<script src="https://
|
|
9
|
+
<script src="https://cdn.qa1.ice.com/pui-diagnostics@3"></script>
|
|
10
10
|
</head>
|
|
11
11
|
<body class="px-2">
|
|
12
12
|
<main>
|
package/dist/cjs/tests/utils.js
CHANGED
|
@@ -153,9 +153,19 @@ const applicationScriptingObject = {
|
|
|
153
153
|
},
|
|
154
154
|
type: "object"
|
|
155
155
|
};
|
|
156
|
+
const moduleScriptingObject = {
|
|
157
|
+
object: {
|
|
158
|
+
events: [],
|
|
159
|
+
functions: ["getParameters", "getCapabilities", "log", "unload"],
|
|
160
|
+
objectId: "module",
|
|
161
|
+
objectType: "Object"
|
|
162
|
+
},
|
|
163
|
+
type: "object"
|
|
164
|
+
};
|
|
156
165
|
const hostObjects = {
|
|
157
166
|
application: applicationScriptingObject,
|
|
158
|
-
auth: authScriptingObject
|
|
167
|
+
auth: authScriptingObject,
|
|
168
|
+
module: moduleScriptingObject
|
|
159
169
|
};
|
|
160
170
|
const setupHost = (hostWindow) => {
|
|
161
171
|
const onMessage = ({ data }) => {
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
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>Title Service</title>
|
|
8
|
+
<style>
|
|
9
|
+
body {
|
|
10
|
+
margin: 0px;
|
|
11
|
+
}
|
|
12
|
+
</style>
|
|
13
|
+
<script src="https://cdn.tailwindcss.com?plugins=forms"></script>
|
|
14
|
+
<script src="https://cdn.qa1.ice.com/pui-diagnostics@3"></script>
|
|
15
|
+
</head>
|
|
3
16
|
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</
|
|
17
|
-
|
|
18
|
-
<body class="px-2">
|
|
19
|
-
<h3 class="text-lg font-medium leading-6 text-gray-900">
|
|
20
|
-
Title
|
|
21
|
-
</h3>
|
|
22
|
-
<div class="mt-5 flex flex-col">
|
|
23
|
-
<button id="order" type="button"
|
|
24
|
-
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">
|
|
25
|
-
Order
|
|
26
|
-
</button>
|
|
27
|
-
</div>
|
|
28
|
-
<script src="./titleService.js" type="module"></script>
|
|
29
|
-
</body>
|
|
30
|
-
|
|
31
|
-
</html>
|
|
17
|
+
<body class="px-2">
|
|
18
|
+
<h3 class="text-lg font-medium leading-6 text-gray-900">Title</h3>
|
|
19
|
+
<div class="mt-5 flex flex-col">
|
|
20
|
+
<button
|
|
21
|
+
id="order"
|
|
22
|
+
type="button"
|
|
23
|
+
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"
|
|
24
|
+
>
|
|
25
|
+
Order
|
|
26
|
+
</button>
|
|
27
|
+
</div>
|
|
28
|
+
<script src="./titleService.js" type="module"></script>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
@@ -0,0 +1,92 @@
|
|
|
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 v1_adapter_exports = {};
|
|
20
|
+
__export(v1_adapter_exports, {
|
|
21
|
+
setScriptOnlyGuest: () => setScriptOnlyGuest,
|
|
22
|
+
setupV1Adapter: () => setupV1Adapter
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(v1_adapter_exports);
|
|
25
|
+
let scriptOnlyGuest = false;
|
|
26
|
+
const setScriptOnlyGuest = (value) => {
|
|
27
|
+
scriptOnlyGuest = value;
|
|
28
|
+
};
|
|
29
|
+
const setupV1Adapter = (guestV2 = null) => {
|
|
30
|
+
let guest = guestV2;
|
|
31
|
+
const getGuest = () => {
|
|
32
|
+
if (!guest) {
|
|
33
|
+
guest = window.ice?.guest?.SSFGuest ? new window.ice.guest.SSFGuest() : null;
|
|
34
|
+
if (!guest) {
|
|
35
|
+
throw new Error("Guest definition not found");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return guest;
|
|
39
|
+
};
|
|
40
|
+
window.elli = window.elli ?? {};
|
|
41
|
+
window.elli.script = {
|
|
42
|
+
guest: {
|
|
43
|
+
create: async (scriptUri, element) => getGuest().addScript(scriptUri, element)
|
|
44
|
+
},
|
|
45
|
+
connect: async (params) => {
|
|
46
|
+
console.warn(
|
|
47
|
+
"elli.script.connect is deprecated. Please use connect method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); await guest.connect(params);"
|
|
48
|
+
);
|
|
49
|
+
return getGuest().connect(params);
|
|
50
|
+
},
|
|
51
|
+
getObject: async (objectName) => {
|
|
52
|
+
if (!scriptOnlyGuest)
|
|
53
|
+
console.warn(
|
|
54
|
+
"elli.script.getObject is deprecated. Please use getObject method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); await guest.getObject(objectName);"
|
|
55
|
+
);
|
|
56
|
+
return getGuest().getObject(objectName);
|
|
57
|
+
},
|
|
58
|
+
setLogLevel: (level) => {
|
|
59
|
+
if (!scriptOnlyGuest)
|
|
60
|
+
console.warn(
|
|
61
|
+
"elli.script.setLogLevel is deprecated. Please use setLogLevel method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); guest.setLogLevel(level);"
|
|
62
|
+
);
|
|
63
|
+
return getGuest().setLogLevel(level);
|
|
64
|
+
},
|
|
65
|
+
subscribe: (objectId, eventName, callback) => {
|
|
66
|
+
if (!scriptOnlyGuest)
|
|
67
|
+
console.warn(
|
|
68
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
69
|
+
"elli.script.subscribe is deprecated. Please use subscribe method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); guest.subscribe({ eventId: `${objectId}.${eventName}`, callback: (event) => { console.log(event); });"
|
|
70
|
+
);
|
|
71
|
+
return getGuest().subscribe({
|
|
72
|
+
eventId: `${objectId}.${eventName}`,
|
|
73
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
|
74
|
+
callback: (event) => callback(event?.obj, event?.eventParams, event?.eventOptions)
|
|
75
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
unsubscribe: (objectId, eventName, token) => {
|
|
79
|
+
if (!scriptOnlyGuest)
|
|
80
|
+
console.warn(
|
|
81
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
82
|
+
"elli.script.unsubscribe is deprecated. Please use unsubscribe method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); guest.unsubscribe({ eventId: `${objectId}.${eventName}`, token });"
|
|
83
|
+
);
|
|
84
|
+
return getGuest().unsubscribe({
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
86
|
+
eventId: `${objectId}.${eventName}`,
|
|
87
|
+
token
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
setupV1Adapter();
|
package/dist/cjs/v2-guest.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Guest V2</title>
|
|
7
|
-
<script src="https://
|
|
7
|
+
<script src="https://cdn.qa1.ice.com/pui-diagnostics@3"></script>
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
10
|
<h2>Guest V2</h2>
|
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
<p id="loan-pre-save-event-details"></p>
|
|
14
14
|
</div>
|
|
15
15
|
<script type="module">
|
|
16
|
-
window.__ICE__ = {
|
|
17
|
-
diagnosticsUrl: 'https://int.api.ellielabs.com/diagnostics/v2/logging',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
16
|
window.addEventListener('load', async () => {
|
|
21
17
|
const guestV2 = new ice.guest.SSFGuest({
|
|
22
18
|
logger: {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
margin: 0px;
|
|
11
11
|
}
|
|
12
12
|
</style>
|
|
13
|
-
<script src="https://
|
|
13
|
+
<script src="https://cdn.qa1.ice.com/pui-diagnostics@3"></script>
|
|
14
14
|
<script>
|
|
15
15
|
window.addEventListener('DOMContentLoaded', async () => {
|
|
16
16
|
window.__ICE__ = {
|