@elliemae/ssf-host 2.6.6 → 2.7.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/guest.js +33 -8
- package/dist/cjs/host.js +63 -6
- package/dist/cjs/tests/scriptingObjects/analytics.js +45 -0
- package/dist/cjs/tests/utils.js +3 -1
- package/dist/esm/guest.js +33 -8
- package/dist/esm/host.js +63 -6
- package/dist/esm/tests/scriptingObjects/analytics.js +25 -0
- package/dist/esm/tests/utils.js +3 -1
- package/dist/public/index.html +1 -1
- package/dist/public/js/emuiSsfHost.53895eb92f2e3367ed38.js +3 -0
- package/dist/public/js/emuiSsfHost.53895eb92f2e3367ed38.js.br +0 -0
- package/dist/public/js/emuiSsfHost.53895eb92f2e3367ed38.js.gz +0 -0
- package/dist/public/js/emuiSsfHost.53895eb92f2e3367ed38.js.map +1 -0
- package/dist/public/utils.js +1 -1
- package/dist/public/utils.js.br +0 -0
- package/dist/public/utils.js.gz +0 -0
- package/dist/public/utils.js.map +1 -1
- package/dist/public/v1-guest-v2-host.html +1 -1
- package/dist/public/v2-host-v1-guest.html +1 -1
- package/dist/types/lib/guest.d.ts +5 -0
- package/dist/types/lib/ihost.d.ts +5 -1
- package/dist/types/lib/tests/scriptingObjects/analytics.d.ts +8 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/index.js +1 -1
- 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/utils.js +1 -1
- package/dist/umd/utils.js.br +0 -0
- package/dist/umd/utils.js.gz +0 -0
- package/dist/umd/utils.js.map +1 -1
- package/package.json +6 -6
- package/dist/public/js/emuiSsfHost.bc25f766644bc8cb29c3.js +0 -3
- package/dist/public/js/emuiSsfHost.bc25f766644bc8cb29c3.js.br +0 -0
- package/dist/public/js/emuiSsfHost.bc25f766644bc8cb29c3.js.gz +0 -0
- package/dist/public/js/emuiSsfHost.bc25f766644bc8cb29c3.js.map +0 -1
package/dist/cjs/guest.js
CHANGED
|
@@ -73,6 +73,10 @@ class Guest {
|
|
|
73
73
|
* remoting object
|
|
74
74
|
*/
|
|
75
75
|
#remoting;
|
|
76
|
+
/**
|
|
77
|
+
* analytics object
|
|
78
|
+
*/
|
|
79
|
+
#analyticsObj;
|
|
76
80
|
/**
|
|
77
81
|
* Create object representing guest application
|
|
78
82
|
* @param {GuestOption} option - options for creating a guest application
|
|
@@ -86,7 +90,8 @@ class Guest {
|
|
|
86
90
|
window,
|
|
87
91
|
searchParams = {},
|
|
88
92
|
openMode = import_types.OpenMode.Embed,
|
|
89
|
-
remoting
|
|
93
|
+
remoting,
|
|
94
|
+
analyticsObj
|
|
90
95
|
} = option;
|
|
91
96
|
this.id = guestId;
|
|
92
97
|
this.title = title;
|
|
@@ -97,6 +102,7 @@ class Guest {
|
|
|
97
102
|
this.window = window;
|
|
98
103
|
this.openMode = openMode;
|
|
99
104
|
this.capabilities = {};
|
|
105
|
+
this.#analyticsObj = analyticsObj;
|
|
100
106
|
this.#remoting = remoting;
|
|
101
107
|
}
|
|
102
108
|
/**
|
|
@@ -146,13 +152,32 @@ class Guest {
|
|
|
146
152
|
* @param {EventObject} event - event object
|
|
147
153
|
* @param {number} timeout - timeout in milliseconds
|
|
148
154
|
*/
|
|
149
|
-
dispatchEvent = (event, timeout) =>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
dispatchEvent = (event, timeout) => {
|
|
156
|
+
this.#analyticsObj.startTiming(
|
|
157
|
+
`SSFGuest.event.${event.object.objectId}.${event.eventName}`,
|
|
158
|
+
{
|
|
159
|
+
appId: this.id,
|
|
160
|
+
appUrl: this.url
|
|
161
|
+
}
|
|
162
|
+
).catch(() => {
|
|
163
|
+
});
|
|
164
|
+
return this.#remoting.invoke({
|
|
165
|
+
targetWin: this.window,
|
|
166
|
+
targetOrigin: this.origin,
|
|
167
|
+
messageType: import_microfe_common.MessageType.ObjectEvent,
|
|
168
|
+
messageBody: event,
|
|
169
|
+
responseTimeoutMs: timeout
|
|
170
|
+
}).finally(() => {
|
|
171
|
+
this.#analyticsObj.endTiming(
|
|
172
|
+
`SSFGuest.event.${event.object.objectId}.${event.eventName}`,
|
|
173
|
+
{
|
|
174
|
+
appId: this.id,
|
|
175
|
+
appUrl: this.url
|
|
176
|
+
}
|
|
177
|
+
).catch(() => {
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
};
|
|
156
181
|
/**
|
|
157
182
|
* Send a message without any form of response. fire and forget
|
|
158
183
|
* @param {MessageParam} param - message to be sent
|
package/dist/cjs/host.js
CHANGED
|
@@ -49,6 +49,10 @@ class SSFHost {
|
|
|
49
49
|
* reference to the logger
|
|
50
50
|
*/
|
|
51
51
|
#logger;
|
|
52
|
+
/**
|
|
53
|
+
* reference to the analytics object
|
|
54
|
+
*/
|
|
55
|
+
#analyticsObj;
|
|
52
56
|
/**
|
|
53
57
|
* list of guests
|
|
54
58
|
*/
|
|
@@ -73,7 +77,9 @@ class SSFHost {
|
|
|
73
77
|
constructor(hostId, option) {
|
|
74
78
|
this.hostId = hostId;
|
|
75
79
|
if (!option?.logger) throw new Error("Logger is required");
|
|
80
|
+
if (!option?.analyticsObj) throw new Error("Analytics object is required");
|
|
76
81
|
this.#logger = option.logger;
|
|
82
|
+
this.#analyticsObj = option.analyticsObj;
|
|
77
83
|
this.#correlationId = (0, import_uuid.v4)();
|
|
78
84
|
this.#remoting = new import_microfe_common.Remoting(this.#logger, this.#correlationId);
|
|
79
85
|
if (option?.readyStateCallback && typeof option?.readyStateCallback !== "function")
|
|
@@ -87,6 +93,19 @@ class SSFHost {
|
|
|
87
93
|
`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#correlationId}`
|
|
88
94
|
);
|
|
89
95
|
}
|
|
96
|
+
#sendBAEvent = (event, data) => {
|
|
97
|
+
const baEvent = { event, ...data };
|
|
98
|
+
this.#analyticsObj.sendBAEvent(baEvent).catch(() => {
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
#startTiming = (name, options) => {
|
|
102
|
+
this.#analyticsObj.startTiming(name, options).catch(() => {
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
#endTiming = (start, options) => {
|
|
106
|
+
this.#analyticsObj.endTiming(start, options).catch(() => {
|
|
107
|
+
});
|
|
108
|
+
};
|
|
90
109
|
#closeAllPopupGuests = () => {
|
|
91
110
|
for (const guest of this.#guests.values()) {
|
|
92
111
|
if (guest.openMode === import_types.OpenMode.Popup) {
|
|
@@ -206,11 +225,16 @@ class SSFHost {
|
|
|
206
225
|
}
|
|
207
226
|
if (!guest.ready) {
|
|
208
227
|
guest.ready = true;
|
|
228
|
+
const guestInfo = guest.getInfo();
|
|
229
|
+
this.#endTiming("SSFHost.loadGuest", {
|
|
230
|
+
appId: guestInfo.guestId,
|
|
231
|
+
appUrl: guestInfo.guestUrl
|
|
232
|
+
});
|
|
209
233
|
this.#dispatchConfigEvent(guest);
|
|
210
234
|
this.#readyStateCallback?.(guest);
|
|
211
235
|
this.#logger.audit({
|
|
212
236
|
message: `Guest is ready`,
|
|
213
|
-
...
|
|
237
|
+
...guestInfo
|
|
214
238
|
});
|
|
215
239
|
}
|
|
216
240
|
};
|
|
@@ -355,6 +379,11 @@ class SSFHost {
|
|
|
355
379
|
});
|
|
356
380
|
return false;
|
|
357
381
|
}
|
|
382
|
+
const guestInfo = guest.getInfo();
|
|
383
|
+
this.#startTiming(`SSFHost.call.${objectId}.${body.functionName}`, {
|
|
384
|
+
appId: guestInfo.guestId,
|
|
385
|
+
appUrl: guestInfo.guestUrl
|
|
386
|
+
});
|
|
358
387
|
this.#invoke({
|
|
359
388
|
guest,
|
|
360
389
|
obj,
|
|
@@ -372,7 +401,7 @@ class SSFHost {
|
|
|
372
401
|
requestId,
|
|
373
402
|
scriptingObject: objectId,
|
|
374
403
|
scriptingMethod: body.functionName,
|
|
375
|
-
...
|
|
404
|
+
...guestInfo
|
|
376
405
|
});
|
|
377
406
|
}).catch((ex) => {
|
|
378
407
|
this.#remoting.raiseException({
|
|
@@ -386,7 +415,12 @@ class SSFHost {
|
|
|
386
415
|
requestId,
|
|
387
416
|
scriptingObject: objectId,
|
|
388
417
|
scriptingMethod: body.functionName,
|
|
389
|
-
...
|
|
418
|
+
...guestInfo
|
|
419
|
+
});
|
|
420
|
+
}).finally(() => {
|
|
421
|
+
this.#endTiming(`SSFHost.call.${objectId}.${body.functionName}`, {
|
|
422
|
+
appId: guestInfo.guestId,
|
|
423
|
+
appUrl: guestInfo.guestUrl
|
|
390
424
|
});
|
|
391
425
|
});
|
|
392
426
|
return true;
|
|
@@ -432,7 +466,11 @@ class SSFHost {
|
|
|
432
466
|
* @returns reference to the guest object
|
|
433
467
|
*/
|
|
434
468
|
#attachGuest = (param) => {
|
|
435
|
-
const guest = new import_guest.Guest({
|
|
469
|
+
const guest = new import_guest.Guest({
|
|
470
|
+
...param,
|
|
471
|
+
remoting: this.#remoting,
|
|
472
|
+
analyticsObj: this.#analyticsObj
|
|
473
|
+
});
|
|
436
474
|
guest.init();
|
|
437
475
|
this.#guests.set(param.guestId, guest);
|
|
438
476
|
return guest;
|
|
@@ -694,14 +732,23 @@ class SSFHost {
|
|
|
694
732
|
};
|
|
695
733
|
}
|
|
696
734
|
const guestPromises = [];
|
|
735
|
+
let timingMetricStarted = false;
|
|
697
736
|
this.#guests.forEach((guest) => {
|
|
737
|
+
const guestInfo = guest.getInfo();
|
|
698
738
|
if (!targetWindow || targetWindow === guest.window) {
|
|
699
739
|
if (timeout && guest?.capabilities?.eventFeedback) {
|
|
700
740
|
guestPromises.push(guest.dispatchEvent(eventObj, timeout));
|
|
741
|
+
if (!timingMetricStarted) {
|
|
742
|
+
this.#startTiming(`SSFHost.event.${scriptingObject.id}.${name}`, {
|
|
743
|
+
appId: this.hostId,
|
|
744
|
+
appUrl: window.location.href
|
|
745
|
+
});
|
|
746
|
+
timingMetricStarted = true;
|
|
747
|
+
}
|
|
701
748
|
this.#logger.audit({
|
|
702
749
|
message: "Event dispatched and awaiting feedback",
|
|
703
750
|
scriptingEventId: id,
|
|
704
|
-
...
|
|
751
|
+
...guestInfo
|
|
705
752
|
});
|
|
706
753
|
} else {
|
|
707
754
|
guest.send({
|
|
@@ -711,7 +758,7 @@ class SSFHost {
|
|
|
711
758
|
this.#logger.audit({
|
|
712
759
|
message: "Event dispatched",
|
|
713
760
|
scriptingEventId: id,
|
|
714
|
-
...
|
|
761
|
+
...guestInfo
|
|
715
762
|
});
|
|
716
763
|
}
|
|
717
764
|
}
|
|
@@ -729,6 +776,12 @@ class SSFHost {
|
|
|
729
776
|
exception: ex
|
|
730
777
|
});
|
|
731
778
|
throw ex;
|
|
779
|
+
}).finally(() => {
|
|
780
|
+
if (timingMetricStarted)
|
|
781
|
+
this.#endTiming(`SSFHost.event.${scriptingObject.id}.${name}`, {
|
|
782
|
+
appId: this.hostId,
|
|
783
|
+
appUrl: window.location.href
|
|
784
|
+
});
|
|
732
785
|
});
|
|
733
786
|
return retValue;
|
|
734
787
|
};
|
|
@@ -768,6 +821,10 @@ class SSFHost {
|
|
|
768
821
|
const { openMode = import_types.OpenMode.Embed, popupWindowFeatures = {} } = options;
|
|
769
822
|
const srcUrl = this.#getGuestUrl(url, searchParams);
|
|
770
823
|
let guest = null;
|
|
824
|
+
this.#startTiming("SSFHost.loadGuest", {
|
|
825
|
+
appId: guestId,
|
|
826
|
+
appUrl: srcUrl
|
|
827
|
+
});
|
|
771
828
|
if (openMode === import_types.OpenMode.Popup) {
|
|
772
829
|
guest = this.#openPopupGuest({
|
|
773
830
|
guestId,
|
|
@@ -0,0 +1,45 @@
|
|
|
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 analytics_exports = {};
|
|
20
|
+
__export(analytics_exports, {
|
|
21
|
+
Analytics: () => Analytics
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(analytics_exports);
|
|
24
|
+
var import_microfe_common = require("@elliemae/microfe-common");
|
|
25
|
+
class Analytics extends import_microfe_common.ScriptingObject {
|
|
26
|
+
constructor() {
|
|
27
|
+
super("Analytics");
|
|
28
|
+
}
|
|
29
|
+
sendBAEvent(event) {
|
|
30
|
+
console.log("Analytics.sendBAEvent", event);
|
|
31
|
+
return Promise.resolve();
|
|
32
|
+
}
|
|
33
|
+
startTiming(name, options) {
|
|
34
|
+
console.log("Analytics.perfMarkStart", name);
|
|
35
|
+
return Promise.resolve(performance.mark(name, { detail: options }));
|
|
36
|
+
}
|
|
37
|
+
endTiming(start, options) {
|
|
38
|
+
console.log("Analytics.perfMarkEnd", start);
|
|
39
|
+
performance.measure(start, {
|
|
40
|
+
detail: options,
|
|
41
|
+
start
|
|
42
|
+
});
|
|
43
|
+
return Promise.resolve();
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/cjs/tests/utils.js
CHANGED
|
@@ -28,6 +28,7 @@ var import_microfe_common = require("@elliemae/microfe-common");
|
|
|
28
28
|
var import__ = require("../index.js");
|
|
29
29
|
var import_logger = require("./logger.js");
|
|
30
30
|
var import_utils = require("../utils.js");
|
|
31
|
+
var import_analytics = require("./scriptingObjects/analytics.js");
|
|
31
32
|
const createHost = (name = "IMTProduct") => {
|
|
32
33
|
let host = null;
|
|
33
34
|
const guestReady = new Promise((resolve) => {
|
|
@@ -35,7 +36,8 @@ const createHost = (name = "IMTProduct") => {
|
|
|
35
36
|
logger: import_logger.logger,
|
|
36
37
|
readyStateCallback: (guest) => {
|
|
37
38
|
resolve(guest);
|
|
38
|
-
}
|
|
39
|
+
},
|
|
40
|
+
analyticsObj: new import_analytics.Analytics()
|
|
39
41
|
};
|
|
40
42
|
host = new import__.SSFHost(name, hostOptions);
|
|
41
43
|
});
|
package/dist/esm/guest.js
CHANGED
|
@@ -50,6 +50,10 @@ class Guest {
|
|
|
50
50
|
* remoting object
|
|
51
51
|
*/
|
|
52
52
|
#remoting;
|
|
53
|
+
/**
|
|
54
|
+
* analytics object
|
|
55
|
+
*/
|
|
56
|
+
#analyticsObj;
|
|
53
57
|
/**
|
|
54
58
|
* Create object representing guest application
|
|
55
59
|
* @param {GuestOption} option - options for creating a guest application
|
|
@@ -63,7 +67,8 @@ class Guest {
|
|
|
63
67
|
window,
|
|
64
68
|
searchParams = {},
|
|
65
69
|
openMode = OpenMode.Embed,
|
|
66
|
-
remoting
|
|
70
|
+
remoting,
|
|
71
|
+
analyticsObj
|
|
67
72
|
} = option;
|
|
68
73
|
this.id = guestId;
|
|
69
74
|
this.title = title;
|
|
@@ -74,6 +79,7 @@ class Guest {
|
|
|
74
79
|
this.window = window;
|
|
75
80
|
this.openMode = openMode;
|
|
76
81
|
this.capabilities = {};
|
|
82
|
+
this.#analyticsObj = analyticsObj;
|
|
77
83
|
this.#remoting = remoting;
|
|
78
84
|
}
|
|
79
85
|
/**
|
|
@@ -123,13 +129,32 @@ class Guest {
|
|
|
123
129
|
* @param {EventObject} event - event object
|
|
124
130
|
* @param {number} timeout - timeout in milliseconds
|
|
125
131
|
*/
|
|
126
|
-
dispatchEvent = (event, timeout) =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
dispatchEvent = (event, timeout) => {
|
|
133
|
+
this.#analyticsObj.startTiming(
|
|
134
|
+
`SSFGuest.event.${event.object.objectId}.${event.eventName}`,
|
|
135
|
+
{
|
|
136
|
+
appId: this.id,
|
|
137
|
+
appUrl: this.url
|
|
138
|
+
}
|
|
139
|
+
).catch(() => {
|
|
140
|
+
});
|
|
141
|
+
return this.#remoting.invoke({
|
|
142
|
+
targetWin: this.window,
|
|
143
|
+
targetOrigin: this.origin,
|
|
144
|
+
messageType: MessageType.ObjectEvent,
|
|
145
|
+
messageBody: event,
|
|
146
|
+
responseTimeoutMs: timeout
|
|
147
|
+
}).finally(() => {
|
|
148
|
+
this.#analyticsObj.endTiming(
|
|
149
|
+
`SSFGuest.event.${event.object.objectId}.${event.eventName}`,
|
|
150
|
+
{
|
|
151
|
+
appId: this.id,
|
|
152
|
+
appUrl: this.url
|
|
153
|
+
}
|
|
154
|
+
).catch(() => {
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
};
|
|
133
158
|
/**
|
|
134
159
|
* Send a message without any form of response. fire and forget
|
|
135
160
|
* @param {MessageParam} param - message to be sent
|
package/dist/esm/host.js
CHANGED
|
@@ -35,6 +35,10 @@ class SSFHost {
|
|
|
35
35
|
* reference to the logger
|
|
36
36
|
*/
|
|
37
37
|
#logger;
|
|
38
|
+
/**
|
|
39
|
+
* reference to the analytics object
|
|
40
|
+
*/
|
|
41
|
+
#analyticsObj;
|
|
38
42
|
/**
|
|
39
43
|
* list of guests
|
|
40
44
|
*/
|
|
@@ -59,7 +63,9 @@ class SSFHost {
|
|
|
59
63
|
constructor(hostId, option) {
|
|
60
64
|
this.hostId = hostId;
|
|
61
65
|
if (!option?.logger) throw new Error("Logger is required");
|
|
66
|
+
if (!option?.analyticsObj) throw new Error("Analytics object is required");
|
|
62
67
|
this.#logger = option.logger;
|
|
68
|
+
this.#analyticsObj = option.analyticsObj;
|
|
63
69
|
this.#correlationId = uuidv4();
|
|
64
70
|
this.#remoting = new Remoting(this.#logger, this.#correlationId);
|
|
65
71
|
if (option?.readyStateCallback && typeof option?.readyStateCallback !== "function")
|
|
@@ -73,6 +79,19 @@ class SSFHost {
|
|
|
73
79
|
`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#correlationId}`
|
|
74
80
|
);
|
|
75
81
|
}
|
|
82
|
+
#sendBAEvent = (event, data) => {
|
|
83
|
+
const baEvent = { event, ...data };
|
|
84
|
+
this.#analyticsObj.sendBAEvent(baEvent).catch(() => {
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
#startTiming = (name, options) => {
|
|
88
|
+
this.#analyticsObj.startTiming(name, options).catch(() => {
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
#endTiming = (start, options) => {
|
|
92
|
+
this.#analyticsObj.endTiming(start, options).catch(() => {
|
|
93
|
+
});
|
|
94
|
+
};
|
|
76
95
|
#closeAllPopupGuests = () => {
|
|
77
96
|
for (const guest of this.#guests.values()) {
|
|
78
97
|
if (guest.openMode === OpenMode.Popup) {
|
|
@@ -192,11 +211,16 @@ class SSFHost {
|
|
|
192
211
|
}
|
|
193
212
|
if (!guest.ready) {
|
|
194
213
|
guest.ready = true;
|
|
214
|
+
const guestInfo = guest.getInfo();
|
|
215
|
+
this.#endTiming("SSFHost.loadGuest", {
|
|
216
|
+
appId: guestInfo.guestId,
|
|
217
|
+
appUrl: guestInfo.guestUrl
|
|
218
|
+
});
|
|
195
219
|
this.#dispatchConfigEvent(guest);
|
|
196
220
|
this.#readyStateCallback?.(guest);
|
|
197
221
|
this.#logger.audit({
|
|
198
222
|
message: `Guest is ready`,
|
|
199
|
-
...
|
|
223
|
+
...guestInfo
|
|
200
224
|
});
|
|
201
225
|
}
|
|
202
226
|
};
|
|
@@ -341,6 +365,11 @@ class SSFHost {
|
|
|
341
365
|
});
|
|
342
366
|
return false;
|
|
343
367
|
}
|
|
368
|
+
const guestInfo = guest.getInfo();
|
|
369
|
+
this.#startTiming(`SSFHost.call.${objectId}.${body.functionName}`, {
|
|
370
|
+
appId: guestInfo.guestId,
|
|
371
|
+
appUrl: guestInfo.guestUrl
|
|
372
|
+
});
|
|
344
373
|
this.#invoke({
|
|
345
374
|
guest,
|
|
346
375
|
obj,
|
|
@@ -358,7 +387,7 @@ class SSFHost {
|
|
|
358
387
|
requestId,
|
|
359
388
|
scriptingObject: objectId,
|
|
360
389
|
scriptingMethod: body.functionName,
|
|
361
|
-
...
|
|
390
|
+
...guestInfo
|
|
362
391
|
});
|
|
363
392
|
}).catch((ex) => {
|
|
364
393
|
this.#remoting.raiseException({
|
|
@@ -372,7 +401,12 @@ class SSFHost {
|
|
|
372
401
|
requestId,
|
|
373
402
|
scriptingObject: objectId,
|
|
374
403
|
scriptingMethod: body.functionName,
|
|
375
|
-
...
|
|
404
|
+
...guestInfo
|
|
405
|
+
});
|
|
406
|
+
}).finally(() => {
|
|
407
|
+
this.#endTiming(`SSFHost.call.${objectId}.${body.functionName}`, {
|
|
408
|
+
appId: guestInfo.guestId,
|
|
409
|
+
appUrl: guestInfo.guestUrl
|
|
376
410
|
});
|
|
377
411
|
});
|
|
378
412
|
return true;
|
|
@@ -418,7 +452,11 @@ class SSFHost {
|
|
|
418
452
|
* @returns reference to the guest object
|
|
419
453
|
*/
|
|
420
454
|
#attachGuest = (param) => {
|
|
421
|
-
const guest = new Guest({
|
|
455
|
+
const guest = new Guest({
|
|
456
|
+
...param,
|
|
457
|
+
remoting: this.#remoting,
|
|
458
|
+
analyticsObj: this.#analyticsObj
|
|
459
|
+
});
|
|
422
460
|
guest.init();
|
|
423
461
|
this.#guests.set(param.guestId, guest);
|
|
424
462
|
return guest;
|
|
@@ -680,14 +718,23 @@ class SSFHost {
|
|
|
680
718
|
};
|
|
681
719
|
}
|
|
682
720
|
const guestPromises = [];
|
|
721
|
+
let timingMetricStarted = false;
|
|
683
722
|
this.#guests.forEach((guest) => {
|
|
723
|
+
const guestInfo = guest.getInfo();
|
|
684
724
|
if (!targetWindow || targetWindow === guest.window) {
|
|
685
725
|
if (timeout && guest?.capabilities?.eventFeedback) {
|
|
686
726
|
guestPromises.push(guest.dispatchEvent(eventObj, timeout));
|
|
727
|
+
if (!timingMetricStarted) {
|
|
728
|
+
this.#startTiming(`SSFHost.event.${scriptingObject.id}.${name}`, {
|
|
729
|
+
appId: this.hostId,
|
|
730
|
+
appUrl: window.location.href
|
|
731
|
+
});
|
|
732
|
+
timingMetricStarted = true;
|
|
733
|
+
}
|
|
687
734
|
this.#logger.audit({
|
|
688
735
|
message: "Event dispatched and awaiting feedback",
|
|
689
736
|
scriptingEventId: id,
|
|
690
|
-
...
|
|
737
|
+
...guestInfo
|
|
691
738
|
});
|
|
692
739
|
} else {
|
|
693
740
|
guest.send({
|
|
@@ -697,7 +744,7 @@ class SSFHost {
|
|
|
697
744
|
this.#logger.audit({
|
|
698
745
|
message: "Event dispatched",
|
|
699
746
|
scriptingEventId: id,
|
|
700
|
-
...
|
|
747
|
+
...guestInfo
|
|
701
748
|
});
|
|
702
749
|
}
|
|
703
750
|
}
|
|
@@ -715,6 +762,12 @@ class SSFHost {
|
|
|
715
762
|
exception: ex
|
|
716
763
|
});
|
|
717
764
|
throw ex;
|
|
765
|
+
}).finally(() => {
|
|
766
|
+
if (timingMetricStarted)
|
|
767
|
+
this.#endTiming(`SSFHost.event.${scriptingObject.id}.${name}`, {
|
|
768
|
+
appId: this.hostId,
|
|
769
|
+
appUrl: window.location.href
|
|
770
|
+
});
|
|
718
771
|
});
|
|
719
772
|
return retValue;
|
|
720
773
|
};
|
|
@@ -754,6 +807,10 @@ class SSFHost {
|
|
|
754
807
|
const { openMode = OpenMode.Embed, popupWindowFeatures = {} } = options;
|
|
755
808
|
const srcUrl = this.#getGuestUrl(url, searchParams);
|
|
756
809
|
let guest = null;
|
|
810
|
+
this.#startTiming("SSFHost.loadGuest", {
|
|
811
|
+
appId: guestId,
|
|
812
|
+
appUrl: srcUrl
|
|
813
|
+
});
|
|
757
814
|
if (openMode === OpenMode.Popup) {
|
|
758
815
|
guest = this.#openPopupGuest({
|
|
759
816
|
guestId,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ScriptingObject } from "@elliemae/microfe-common";
|
|
2
|
+
class Analytics extends ScriptingObject {
|
|
3
|
+
constructor() {
|
|
4
|
+
super("Analytics");
|
|
5
|
+
}
|
|
6
|
+
sendBAEvent(event) {
|
|
7
|
+
console.log("Analytics.sendBAEvent", event);
|
|
8
|
+
return Promise.resolve();
|
|
9
|
+
}
|
|
10
|
+
startTiming(name, options) {
|
|
11
|
+
console.log("Analytics.perfMarkStart", name);
|
|
12
|
+
return Promise.resolve(performance.mark(name, { detail: options }));
|
|
13
|
+
}
|
|
14
|
+
endTiming(start, options) {
|
|
15
|
+
console.log("Analytics.perfMarkEnd", start);
|
|
16
|
+
performance.measure(start, {
|
|
17
|
+
detail: options,
|
|
18
|
+
start
|
|
19
|
+
});
|
|
20
|
+
return Promise.resolve();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
Analytics
|
|
25
|
+
};
|
package/dist/esm/tests/utils.js
CHANGED
|
@@ -2,6 +2,7 @@ import { MessageType } from "@elliemae/microfe-common";
|
|
|
2
2
|
import { SSFHost } from "../index.js";
|
|
3
3
|
import { logger } from "./logger.js";
|
|
4
4
|
import { getOrigin } from "../utils.js";
|
|
5
|
+
import { Analytics } from "./scriptingObjects/analytics.js";
|
|
5
6
|
const createHost = (name = "IMTProduct") => {
|
|
6
7
|
let host = null;
|
|
7
8
|
const guestReady = new Promise((resolve) => {
|
|
@@ -9,7 +10,8 @@ const createHost = (name = "IMTProduct") => {
|
|
|
9
10
|
logger,
|
|
10
11
|
readyStateCallback: (guest) => {
|
|
11
12
|
resolve(guest);
|
|
12
|
-
}
|
|
13
|
+
},
|
|
14
|
+
analyticsObj: new Analytics()
|
|
13
15
|
};
|
|
14
16
|
host = new SSFHost(name, hostOptions);
|
|
15
17
|
});
|
package/dist/public/index.html
CHANGED
|
@@ -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>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.
|
|
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>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.53895eb92f2e3367ed38.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center"><div class="px-2">ICE Mortgage Product</div></header><main class="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8"><div class="min-w-0 flex-1 mt-4"><h1 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">Loan Application</h1></div><div id="successFeedback" class="hidden rounded-md bg-green-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg></div><div class="ml-3"><p class="text-sm font-medium text-green-800">Loan Saved Successfully</p></div></div></div><div id="errorFeedback" class="hidden rounded-md bg-red-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/></svg></div><div class="ml-3"><h3 class="text-sm font-medium text-red-800">Credit Score is not meeting the requirement</h3></div></div></div><div class="mt-2 sm:grid sm:grid-cols-2 sm:gap-2"><form class="px-2 py-2 space-y-8 divide-y divide-gray-200 bg-gray-50"><div class="space-y-8 divide-y divide-gray-200 sm:space-y-5"><div class="space-y-6 sm:space-y-5"><div><h3 class="text-lg font-medium leading-6 text-gray-900">Personal Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="firstName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">First name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="firstName" id="firstName" autocomplete="given-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="John" placeholder="John"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="lastName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Last name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="lastName" id="lastName" autocomplete="family-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="Doe" placeholder="Doe"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="ssn" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">SSN</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="ssn" id="ssn" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="123456789" placeholder="123456789"/></div></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Loan Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="amount" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Amount</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="amount" id="amount" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="500000" placeholder="500000"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="Term" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Term (years)</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="term" id="term" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="30" placeholder="30"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="downPayment" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Down Payment</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="downPayment" id="downPayment" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="50000" placeholder="50000"/></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Order Services</h3></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><div class="mt-1 sm:mt-0"><button id="title" type="button" class="inline-flex items-center 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 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M7.502 6h7.128A3.375 3.375 0 0118 9.375v9.375a3 3 0 003-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 00-.673-.05A3 3 0 0015 1.5h-1.5a3 3 0 00-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6zM13.5 3A1.5 1.5 0 0012 4.5h4.5A1.5 1.5 0 0015 3h-1.5z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 013 20.625V9.375zM6 12a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V12zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 15a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V15zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 18a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V18zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75z" clip-rule="evenodd"/></svg> Title</button></div><div class="mt-1 sm:mt-0"><button id="credit" type="button" class="inline-flex items-center 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 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M2.25 13.5a8.25 8.25 0 018.25-8.25.75.75 0 01.75.75v6.75H18a.75.75 0 01.75.75 8.25 8.25 0 01-16.5 0z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M12.75 3a.75.75 0 01.75-.75 8.25 8.25 0 018.25 8.25.75.75 0 01-.75.75h-7.5a.75.75 0 01-.75-.75V3z" clip-rule="evenodd"/></svg> Credit Score</button></div></div></div></div></div><div class="flex flex-col"><button id="saveLoan" type="button" 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">Save</button></div></form><div id="aside-container" class="flex flex-col gap-4 items-start mt-4 border-2 p-2 rounded-lg border-dashed border-cyan-300 sm:mt-0"></div></div><div id="bottom-container" class="flex flex-col gap-4 items-start mt-4 p-2 sm:mt-0"></div></main><script src="./init.js" type="module"></script></body></html>
|