@elliemae/ssf-guest 2.8.0 → 2.9.1
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 +44 -10
- package/dist/cjs/tests/utils.js +7 -6
- package/dist/esm/guest.js +45 -10
- package/dist/esm/tests/utils.js +7 -6
- package/dist/public/creditService.html +1 -1
- package/dist/public/index.html +1 -1
- package/dist/public/js/{emuiSsfGuest.59063f8f6a686a1e289c.js → emuiSsfGuest.9130e23170c7f40514b8.js} +7 -7
- package/dist/public/js/emuiSsfGuest.9130e23170c7f40514b8.js.br +0 -0
- package/dist/public/js/emuiSsfGuest.9130e23170c7f40514b8.js.gz +0 -0
- package/dist/public/js/emuiSsfGuest.9130e23170c7f40514b8.js.map +1 -0
- package/dist/public/loanValidation.html +1 -1
- package/dist/public/pricingService.html +1 -1
- package/dist/public/titleService.html +1 -1
- package/dist/public/v2-guest.html +1 -1
- package/dist/types/lib/guest.d.ts +1 -1
- package/dist/types/lib/tests/utils.d.ts +3 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/index.js +6 -6
- 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/package.json +3 -3
- package/dist/public/js/emuiSsfGuest.59063f8f6a686a1e289c.js.br +0 -0
- package/dist/public/js/emuiSsfGuest.59063f8f6a686a1e289c.js.gz +0 -0
- package/dist/public/js/emuiSsfGuest.59063f8f6a686a1e289c.js.map +0 -1
package/dist/cjs/guest.js
CHANGED
|
@@ -91,11 +91,15 @@ class SSFGuest {
|
|
|
91
91
|
/**
|
|
92
92
|
* flag to keep host session alive
|
|
93
93
|
*/
|
|
94
|
-
#keepAlive =
|
|
94
|
+
#keepAlive = true;
|
|
95
95
|
/**
|
|
96
96
|
* interval to keep host session alive.
|
|
97
97
|
*/
|
|
98
98
|
#keepAliveInterval = KEEP_ALIVE_INTERVAL;
|
|
99
|
+
/**
|
|
100
|
+
* options for the logger
|
|
101
|
+
*/
|
|
102
|
+
#loggerOptions;
|
|
99
103
|
/**
|
|
100
104
|
* throttled keep alive function
|
|
101
105
|
*/
|
|
@@ -112,9 +116,10 @@ class SSFGuest {
|
|
|
112
116
|
index,
|
|
113
117
|
team,
|
|
114
118
|
appName
|
|
115
|
-
} = options?.logger
|
|
119
|
+
} = options?.logger ?? {};
|
|
120
|
+
this.#loggerOptions = options?.logger;
|
|
116
121
|
this.#usesDevConnectAPI = options?.usesDevConnectAPI ?? false;
|
|
117
|
-
this.#keepAlive = options?.keepAlive ??
|
|
122
|
+
this.#keepAlive = options?.keepAlive ?? true;
|
|
118
123
|
this.#keepAliveInterval = options?.keepAliveInterval ?? KEEP_ALIVE_INTERVAL;
|
|
119
124
|
const transport = logToConsole ? (0, import_pui_diagnostics.Console)() : (0, import_pui_diagnostics.http)(url);
|
|
120
125
|
this.#logger = (0, import_pui_diagnostics.logger)({
|
|
@@ -410,7 +415,7 @@ class SSFGuest {
|
|
|
410
415
|
#startKeepSessionAlive = async () => {
|
|
411
416
|
if (this.#keepAlive) {
|
|
412
417
|
try {
|
|
413
|
-
const appObj = await this.getObject("
|
|
418
|
+
const appObj = await this.getObject("application");
|
|
414
419
|
if (appObj) {
|
|
415
420
|
this.#throttledKeepAlive = (0, import_lodash.throttle)(
|
|
416
421
|
async () => {
|
|
@@ -430,6 +435,10 @@ class SSFGuest {
|
|
|
430
435
|
userInteractionEvents.forEach((eventType) => {
|
|
431
436
|
document.addEventListener(eventType, this.#throttledKeepAlive);
|
|
432
437
|
});
|
|
438
|
+
} else {
|
|
439
|
+
this.#logger.warn(
|
|
440
|
+
"Application object not available to send keep alive"
|
|
441
|
+
);
|
|
433
442
|
}
|
|
434
443
|
} catch (e) {
|
|
435
444
|
this.#logger.error(
|
|
@@ -438,6 +447,27 @@ class SSFGuest {
|
|
|
438
447
|
}
|
|
439
448
|
}
|
|
440
449
|
};
|
|
450
|
+
/**
|
|
451
|
+
* send all log messages to parent
|
|
452
|
+
*/
|
|
453
|
+
#useParentApplicationLogger = async () => {
|
|
454
|
+
try {
|
|
455
|
+
const appObj = await this.getObject("application");
|
|
456
|
+
if (appObj?.log && !this.#loggerOptions.console) {
|
|
457
|
+
const { index, team, appName } = this.#loggerOptions;
|
|
458
|
+
this.#logger = (0, import_pui_diagnostics.logger)({
|
|
459
|
+
transport: (0, import_pui_diagnostics.parentApp)(appObj),
|
|
460
|
+
index,
|
|
461
|
+
team,
|
|
462
|
+
appName
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
} catch (e) {
|
|
466
|
+
this.#logger.error(
|
|
467
|
+
`Error getting application object. ${e.message}`
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
};
|
|
441
471
|
/**
|
|
442
472
|
* Initialize guest using script
|
|
443
473
|
* @param scriptUri uri of the script
|
|
@@ -539,14 +569,15 @@ class SSFGuest {
|
|
|
539
569
|
messageBody: guestOptions
|
|
540
570
|
});
|
|
541
571
|
this.#isConnected = true;
|
|
542
|
-
this.#logger.audit({
|
|
543
|
-
message: "Guest connected to host",
|
|
544
|
-
guestUrl: window.location.href
|
|
545
|
-
});
|
|
546
572
|
this.#handleParentClose();
|
|
547
573
|
if (this.#usesDevConnectAPI) await this.getAuthToken();
|
|
548
574
|
await this.#startKeepSessionAlive();
|
|
575
|
+
await this.#useParentApplicationLogger();
|
|
549
576
|
window.addEventListener("beforeunload", this.close);
|
|
577
|
+
this.#logger.audit({
|
|
578
|
+
message: "Guest connected to host",
|
|
579
|
+
guestUrl: window.location.href
|
|
580
|
+
});
|
|
550
581
|
}
|
|
551
582
|
};
|
|
552
583
|
/**
|
|
@@ -556,13 +587,16 @@ class SSFGuest {
|
|
|
556
587
|
getAuthToken = async () => {
|
|
557
588
|
if (!this.#authToken && this.#isConnected) {
|
|
558
589
|
try {
|
|
559
|
-
const authObj = await this.getObject("
|
|
590
|
+
const authObj = await this.getObject("auth");
|
|
560
591
|
if (authObj) {
|
|
561
592
|
const tokenInfo = await authObj.getAccessToken();
|
|
562
593
|
this.#authToken = tokenInfo?.access_token;
|
|
563
594
|
this.#hostDomain = tokenInfo?.host_name;
|
|
564
595
|
this.#authClientId = tokenInfo?.client_id;
|
|
565
|
-
}
|
|
596
|
+
} else
|
|
597
|
+
this.#logger.warn(
|
|
598
|
+
"Auth object not available to get access token from host"
|
|
599
|
+
);
|
|
566
600
|
} catch (e) {
|
|
567
601
|
console.dir(e, { depth: null });
|
|
568
602
|
this.#logger.error(
|
package/dist/cjs/tests/utils.js
CHANGED
|
@@ -33,10 +33,11 @@ var import_utils = require("../utils.js");
|
|
|
33
33
|
const createGuest = ({
|
|
34
34
|
keepAlive,
|
|
35
35
|
usesDevConnectAPI,
|
|
36
|
-
keepAliveInterval
|
|
36
|
+
keepAliveInterval,
|
|
37
|
+
console
|
|
37
38
|
}) => new import__.SSFGuest({
|
|
38
39
|
logger: {
|
|
39
|
-
console: true,
|
|
40
|
+
console: console ?? true,
|
|
40
41
|
index: "ssf",
|
|
41
42
|
team: "UI Platform",
|
|
42
43
|
appName: "SSF Guest"
|
|
@@ -116,7 +117,7 @@ const authScriptingObject = {
|
|
|
116
117
|
object: {
|
|
117
118
|
events: [],
|
|
118
119
|
functions: ["getAccessToken", "createAuthCode", "getUser"],
|
|
119
|
-
objectId: "
|
|
120
|
+
objectId: "auth",
|
|
120
121
|
objectType: "Object"
|
|
121
122
|
},
|
|
122
123
|
type: "object"
|
|
@@ -147,14 +148,14 @@ const applicationScriptingObject = {
|
|
|
147
148
|
"supportsAction",
|
|
148
149
|
"supportsNavigateTo"
|
|
149
150
|
],
|
|
150
|
-
objectId: "
|
|
151
|
+
objectId: "application",
|
|
151
152
|
objectType: "Object"
|
|
152
153
|
},
|
|
153
154
|
type: "object"
|
|
154
155
|
};
|
|
155
156
|
const hostObjects = {
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
application: applicationScriptingObject,
|
|
158
|
+
auth: authScriptingObject
|
|
158
159
|
};
|
|
159
160
|
const setupHost = (hostWindow) => {
|
|
160
161
|
const onMessage = ({ data }) => {
|
package/dist/esm/guest.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
logger as puiLogger,
|
|
12
12
|
Console,
|
|
13
13
|
http,
|
|
14
|
+
parentApp,
|
|
14
15
|
webvitals,
|
|
15
16
|
logUnhandledErrors
|
|
16
17
|
} from "@elliemae/pui-diagnostics";
|
|
@@ -86,11 +87,15 @@ class SSFGuest {
|
|
|
86
87
|
/**
|
|
87
88
|
* flag to keep host session alive
|
|
88
89
|
*/
|
|
89
|
-
#keepAlive =
|
|
90
|
+
#keepAlive = true;
|
|
90
91
|
/**
|
|
91
92
|
* interval to keep host session alive.
|
|
92
93
|
*/
|
|
93
94
|
#keepAliveInterval = KEEP_ALIVE_INTERVAL;
|
|
95
|
+
/**
|
|
96
|
+
* options for the logger
|
|
97
|
+
*/
|
|
98
|
+
#loggerOptions;
|
|
94
99
|
/**
|
|
95
100
|
* throttled keep alive function
|
|
96
101
|
*/
|
|
@@ -107,9 +112,10 @@ class SSFGuest {
|
|
|
107
112
|
index,
|
|
108
113
|
team,
|
|
109
114
|
appName
|
|
110
|
-
} = options?.logger
|
|
115
|
+
} = options?.logger ?? {};
|
|
116
|
+
this.#loggerOptions = options?.logger;
|
|
111
117
|
this.#usesDevConnectAPI = options?.usesDevConnectAPI ?? false;
|
|
112
|
-
this.#keepAlive = options?.keepAlive ??
|
|
118
|
+
this.#keepAlive = options?.keepAlive ?? true;
|
|
113
119
|
this.#keepAliveInterval = options?.keepAliveInterval ?? KEEP_ALIVE_INTERVAL;
|
|
114
120
|
const transport = logToConsole ? Console() : http(url);
|
|
115
121
|
this.#logger = puiLogger({
|
|
@@ -405,7 +411,7 @@ class SSFGuest {
|
|
|
405
411
|
#startKeepSessionAlive = async () => {
|
|
406
412
|
if (this.#keepAlive) {
|
|
407
413
|
try {
|
|
408
|
-
const appObj = await this.getObject("
|
|
414
|
+
const appObj = await this.getObject("application");
|
|
409
415
|
if (appObj) {
|
|
410
416
|
this.#throttledKeepAlive = throttle(
|
|
411
417
|
async () => {
|
|
@@ -425,6 +431,10 @@ class SSFGuest {
|
|
|
425
431
|
userInteractionEvents.forEach((eventType) => {
|
|
426
432
|
document.addEventListener(eventType, this.#throttledKeepAlive);
|
|
427
433
|
});
|
|
434
|
+
} else {
|
|
435
|
+
this.#logger.warn(
|
|
436
|
+
"Application object not available to send keep alive"
|
|
437
|
+
);
|
|
428
438
|
}
|
|
429
439
|
} catch (e) {
|
|
430
440
|
this.#logger.error(
|
|
@@ -433,6 +443,27 @@ class SSFGuest {
|
|
|
433
443
|
}
|
|
434
444
|
}
|
|
435
445
|
};
|
|
446
|
+
/**
|
|
447
|
+
* send all log messages to parent
|
|
448
|
+
*/
|
|
449
|
+
#useParentApplicationLogger = async () => {
|
|
450
|
+
try {
|
|
451
|
+
const appObj = await this.getObject("application");
|
|
452
|
+
if (appObj?.log && !this.#loggerOptions.console) {
|
|
453
|
+
const { index, team, appName } = this.#loggerOptions;
|
|
454
|
+
this.#logger = puiLogger({
|
|
455
|
+
transport: parentApp(appObj),
|
|
456
|
+
index,
|
|
457
|
+
team,
|
|
458
|
+
appName
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
} catch (e) {
|
|
462
|
+
this.#logger.error(
|
|
463
|
+
`Error getting application object. ${e.message}`
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
436
467
|
/**
|
|
437
468
|
* Initialize guest using script
|
|
438
469
|
* @param scriptUri uri of the script
|
|
@@ -534,14 +565,15 @@ class SSFGuest {
|
|
|
534
565
|
messageBody: guestOptions
|
|
535
566
|
});
|
|
536
567
|
this.#isConnected = true;
|
|
537
|
-
this.#logger.audit({
|
|
538
|
-
message: "Guest connected to host",
|
|
539
|
-
guestUrl: window.location.href
|
|
540
|
-
});
|
|
541
568
|
this.#handleParentClose();
|
|
542
569
|
if (this.#usesDevConnectAPI) await this.getAuthToken();
|
|
543
570
|
await this.#startKeepSessionAlive();
|
|
571
|
+
await this.#useParentApplicationLogger();
|
|
544
572
|
window.addEventListener("beforeunload", this.close);
|
|
573
|
+
this.#logger.audit({
|
|
574
|
+
message: "Guest connected to host",
|
|
575
|
+
guestUrl: window.location.href
|
|
576
|
+
});
|
|
545
577
|
}
|
|
546
578
|
};
|
|
547
579
|
/**
|
|
@@ -551,13 +583,16 @@ class SSFGuest {
|
|
|
551
583
|
getAuthToken = async () => {
|
|
552
584
|
if (!this.#authToken && this.#isConnected) {
|
|
553
585
|
try {
|
|
554
|
-
const authObj = await this.getObject("
|
|
586
|
+
const authObj = await this.getObject("auth");
|
|
555
587
|
if (authObj) {
|
|
556
588
|
const tokenInfo = await authObj.getAccessToken();
|
|
557
589
|
this.#authToken = tokenInfo?.access_token;
|
|
558
590
|
this.#hostDomain = tokenInfo?.host_name;
|
|
559
591
|
this.#authClientId = tokenInfo?.client_id;
|
|
560
|
-
}
|
|
592
|
+
} else
|
|
593
|
+
this.#logger.warn(
|
|
594
|
+
"Auth object not available to get access token from host"
|
|
595
|
+
);
|
|
561
596
|
} catch (e) {
|
|
562
597
|
console.dir(e, { depth: null });
|
|
563
598
|
this.#logger.error(
|
package/dist/esm/tests/utils.js
CHANGED
|
@@ -10,10 +10,11 @@ import { getOrigin } from "../utils.js";
|
|
|
10
10
|
const createGuest = ({
|
|
11
11
|
keepAlive,
|
|
12
12
|
usesDevConnectAPI,
|
|
13
|
-
keepAliveInterval
|
|
13
|
+
keepAliveInterval,
|
|
14
|
+
console
|
|
14
15
|
}) => new SSFGuest({
|
|
15
16
|
logger: {
|
|
16
|
-
console: true,
|
|
17
|
+
console: console ?? true,
|
|
17
18
|
index: "ssf",
|
|
18
19
|
team: "UI Platform",
|
|
19
20
|
appName: "SSF Guest"
|
|
@@ -93,7 +94,7 @@ const authScriptingObject = {
|
|
|
93
94
|
object: {
|
|
94
95
|
events: [],
|
|
95
96
|
functions: ["getAccessToken", "createAuthCode", "getUser"],
|
|
96
|
-
objectId: "
|
|
97
|
+
objectId: "auth",
|
|
97
98
|
objectType: "Object"
|
|
98
99
|
},
|
|
99
100
|
type: "object"
|
|
@@ -124,14 +125,14 @@ const applicationScriptingObject = {
|
|
|
124
125
|
"supportsAction",
|
|
125
126
|
"supportsNavigateTo"
|
|
126
127
|
],
|
|
127
|
-
objectId: "
|
|
128
|
+
objectId: "application",
|
|
128
129
|
objectType: "Object"
|
|
129
130
|
},
|
|
130
131
|
type: "object"
|
|
131
132
|
};
|
|
132
133
|
const hostObjects = {
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
application: applicationScriptingObject,
|
|
135
|
+
auth: authScriptingObject
|
|
135
136
|
};
|
|
136
137
|
const setupHost = (hostWindow) => {
|
|
137
138
|
const onMessage = ({ data }) => {
|
|
@@ -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.
|
|
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.9130e23170c7f40514b8.js"></script></head><body></body></html>
|
package/dist/public/index.html
CHANGED
|
@@ -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.
|
|
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.9130e23170c7f40514b8.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>
|