@elliemae/pui-app-sdk 5.10.10 → 5.11.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/analytics/index.js +1 -1
- package/dist/cjs/analytics/user-session-event.js +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/utils/app-config/index.js +1 -1
- package/dist/cjs/utils/micro-frontend/guest.js +1 -1
- package/dist/cjs/utils/micro-frontend/host.js +13 -4
- package/dist/cjs/utils/micro-frontend/scripting-objects/analytics.js +131 -0
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/analytics/user-session-event.js +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/utils/app-config/index.js +1 -1
- package/dist/esm/utils/micro-frontend/guest.js +1 -1
- package/dist/esm/utils/micro-frontend/host.js +13 -4
- package/dist/esm/utils/micro-frontend/scripting-objects/analytics.js +101 -0
- package/dist/types/lib/api/helpers.d.ts +1 -1
- package/dist/types/lib/data/listenerMiddleware.d.ts +2 -12
- package/dist/types/lib/data/store.d.ts +1 -6
- package/dist/types/lib/index.d.ts +2 -1
- package/dist/types/lib/utils/auth/loginParams.d.ts +1 -1
- package/dist/types/lib/utils/micro-frontend/host.d.ts +6 -2
- package/dist/types/lib/utils/micro-frontend/scripting-objects/analytics.d.ts +44 -0
- package/dist/types/lib/utils/storybook/preview.d.ts +1 -2
- package/dist/types/lib/utils/testing/index.d.ts +1 -1
- package/dist/types/lib/utils/testing/render-with-redux.d.ts +2 -3
- package/dist/types/lib/utils/testing/render-with-router-redux.d.ts +2 -3
- package/dist/types/lib/utils/testing/render-with-router.d.ts +2 -3
- package/dist/types/lib/utils/testing/render-with-state-addons.d.ts +0 -1
- package/dist/types/lib/utils/web-storage.d.ts +1 -1
- package/dist/types/lib/view/app-root/hosted-app.d.ts +0 -1
- package/dist/types/lib/view/app-root/index.d.ts +0 -1
- package/dist/types/lib/view/app-root/stand-alone-app.d.ts +0 -1
- package/dist/types/lib/view/app-router.d.ts +0 -1
- package/dist/types/lib/view/error-toast/index.d.ts +0 -1
- package/dist/types/lib/view/fields/connect-form.d.ts +0 -1
- package/dist/types/lib/view/fields/form-item-layout/index.d.ts +0 -1
- package/dist/types/lib/view/fields/input-mask/index.d.ts +0 -2
- package/dist/types/lib/view/fields/input-text/index.stories.d.ts +1 -1
- package/dist/types/lib/view/fields/masked-input-text/with-money-mask.stories.d.ts +1 -1
- package/dist/types/lib/view/fields/masked-input-text/with-percentage-mask.stories.d.ts +1 -1
- package/dist/types/lib/view/fields/toggle/index.stories.d.ts +1 -1
- package/dist/types/lib/view/form/index.d.ts +0 -1
- package/dist/types/lib/view/form/personal-info-section.d.ts +0 -1
- package/dist/types/lib/view/form/submit-button/index.d.ts +0 -1
- package/dist/types/lib/view/loadable/index.d.ts +1 -1
- package/dist/types/lib/view/login/index.d.ts +0 -1
- package/dist/types/lib/view/micro-app/index.d.ts +0 -1
- package/dist/types/lib/view/micro-iframe-app/app.d.ts +0 -1
- package/dist/types/lib/view/micro-iframe-app/iframe/index.d.ts +0 -1
- package/dist/types/lib/view/micro-iframe-app/index.d.ts +0 -1
- package/dist/types/lib/view/modals/error/index.d.ts +0 -1
- package/dist/types/lib/view/modals/navigation-prompt/index.d.ts +0 -1
- package/dist/types/lib/view/modals/session-expiry/index.d.ts +0 -1
- package/dist/types/lib/view/page.d.ts +0 -1
- package/dist/types/lib/view/render-with-delay/index.d.ts +0 -1
- package/dist/types/lib/view/render-with-host-data/index.d.ts +0 -1
- package/dist/types/lib/view/require-auth.d.ts +0 -1
- package/dist/types/lib/view/storybook/decorator.d.ts +0 -1
- package/dist/types/lib/view/visually-hidden/index.d.ts +0 -1
- package/dist/types/lib/view/wait-message/index.d.ts +0 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +44 -42
- /package/dist/cjs/{analytics → utils/micro-frontend/scripting-objects}/web-analytics.js +0 -0
- /package/dist/esm/{analytics → utils/micro-frontend/scripting-objects}/web-analytics.js +0 -0
- /package/dist/types/lib/{analytics → utils/micro-frontend/scripting-objects}/web-analytics.d.ts +0 -0
|
@@ -22,7 +22,7 @@ __export(analytics_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(analytics_exports);
|
|
24
24
|
var import_guest = require("../utils/micro-frontend/guest.js");
|
|
25
|
-
var import_web_analytics = require("
|
|
25
|
+
var import_web_analytics = require("../utils/micro-frontend/scripting-objects/web-analytics.js");
|
|
26
26
|
var import_redact_pii = require("../utils/redact-pii.js");
|
|
27
27
|
const sendBAEventToSelf = (data) => {
|
|
28
28
|
const redactedData = (0, import_redact_pii.redactPii)(data);
|
|
@@ -23,7 +23,7 @@ __export(user_session_event_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(user_session_event_exports);
|
|
25
25
|
var import_index = require("./index.js");
|
|
26
|
-
var import_web_analytics = require("
|
|
26
|
+
var import_web_analytics = require("../utils/micro-frontend/scripting-objects/web-analytics.js");
|
|
27
27
|
const loginEvent = ({
|
|
28
28
|
instanceId,
|
|
29
29
|
userId
|
package/dist/cjs/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
var lib_exports = {};
|
|
31
31
|
__export(lib_exports, {
|
|
32
|
+
Analytics: () => import_analytics2.Analytics,
|
|
32
33
|
AppRoot: () => import_app_root.AppRoot,
|
|
33
34
|
Autocomplete: () => import_autocomplete.Autocomplete,
|
|
34
35
|
CMicroAppGuest: () => import_guest.CMicroAppGuest,
|
|
@@ -233,5 +234,6 @@ var import_store3 = require("./data/store.js");
|
|
|
233
234
|
var import_guest_with_service = require("./utils/guest-with-service.js");
|
|
234
235
|
var import_appdynamics = require("./analytics/appdynamics.js");
|
|
235
236
|
var import_analytics = require("./analytics/index.js");
|
|
236
|
-
var import_web_analytics = require("./
|
|
237
|
+
var import_web_analytics = require("./utils/micro-frontend/scripting-objects/web-analytics.js");
|
|
238
|
+
var import_analytics2 = require("./utils/micro-frontend/scripting-objects/analytics.js");
|
|
237
239
|
var import_redact_pii = require("./utils/redact-pii.js");
|
|
@@ -35,7 +35,7 @@ module.exports = __toCommonJS(app_config_exports);
|
|
|
35
35
|
var import_lodash = __toESM(require("lodash"));
|
|
36
36
|
var import_config = require("./config.js");
|
|
37
37
|
var import_appdynamics = require("../../analytics/appdynamics.js");
|
|
38
|
-
var import_web_analytics = require("
|
|
38
|
+
var import_web_analytics = require("../micro-frontend/scripting-objects/web-analytics.js");
|
|
39
39
|
var import_window = require("../window.js");
|
|
40
40
|
var import_config2 = require("./config.js");
|
|
41
41
|
const parseAppConfig = (data) => {
|
|
@@ -40,7 +40,7 @@ var import_history2 = require("../history.js");
|
|
|
40
40
|
var import_console_logger = require("../console-logger.js");
|
|
41
41
|
var import_logger = require("../logger.js");
|
|
42
42
|
var import_web_storage = require("../web-storage.js");
|
|
43
|
-
var import_web_analytics = require("
|
|
43
|
+
var import_web_analytics = require("./scripting-objects/web-analytics.js");
|
|
44
44
|
var import_appdynamics = require("../../analytics/appdynamics.js");
|
|
45
45
|
var import_ssfguest_adapter = require("./ssfguest-adapter.js");
|
|
46
46
|
const isCrossDomain = () => {
|
|
@@ -34,9 +34,9 @@ var import_console_logger = require("../console-logger.js");
|
|
|
34
34
|
var import_logger = require("../logger.js");
|
|
35
35
|
var import_constants = require("../constants.js");
|
|
36
36
|
var import_window = require("../window.js");
|
|
37
|
-
var import_analytics = require("../../analytics/index.js");
|
|
38
37
|
var import_appdynamics = require("../../analytics/appdynamics.js");
|
|
39
|
-
var
|
|
38
|
+
var import_analytics = require("./scripting-objects/analytics.js");
|
|
39
|
+
var import_web_analytics = require("./scripting-objects/web-analytics.js");
|
|
40
40
|
var import_session = require("../session.js");
|
|
41
41
|
class CMicroAppHost {
|
|
42
42
|
static instance;
|
|
@@ -47,6 +47,8 @@ class CMicroAppHost {
|
|
|
47
47
|
onInit;
|
|
48
48
|
onRenewSessionTimer;
|
|
49
49
|
scriptingObjects;
|
|
50
|
+
#ssfHostRef;
|
|
51
|
+
// eslint-disable-next-line max-statements
|
|
50
52
|
constructor(params) {
|
|
51
53
|
this.appId = (0, import_config.getAppConfigValue)("appId");
|
|
52
54
|
this.onInit = params?.onInit;
|
|
@@ -59,7 +61,13 @@ class CMicroAppHost {
|
|
|
59
61
|
theme: params?.theme ?? (0, import_pui_theme.getDefaultTheme)()
|
|
60
62
|
};
|
|
61
63
|
this.activeGuests = {};
|
|
62
|
-
this
|
|
64
|
+
this.#ssfHostRef = params?.ssfHostRef || null;
|
|
65
|
+
const analyticsObj = new import_analytics.Analytics(this.logger);
|
|
66
|
+
this.scriptingObjects = {
|
|
67
|
+
analytics: analyticsObj,
|
|
68
|
+
...params?.scriptingObjects ?? {}
|
|
69
|
+
};
|
|
70
|
+
this.#ssfHostRef?.publish(analyticsObj);
|
|
63
71
|
this.getProps = this.getProps.bind(this);
|
|
64
72
|
this.getLogger = this.getLogger.bind(this);
|
|
65
73
|
this.getGuests = this.getGuests.bind(this);
|
|
@@ -165,7 +173,8 @@ class CMicroAppHost {
|
|
|
165
173
|
this.props.systemVersion = version;
|
|
166
174
|
}
|
|
167
175
|
sendBAEvent(data) {
|
|
168
|
-
|
|
176
|
+
this.scriptingObjects.analytics.sendBAEvent(data).catch(() => {
|
|
177
|
+
});
|
|
169
178
|
}
|
|
170
179
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
171
180
|
async getObject(name) {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var analytics_exports = {};
|
|
30
|
+
__export(analytics_exports, {
|
|
31
|
+
Analytics: () => Analytics
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(analytics_exports);
|
|
34
|
+
var import_em_ssf_host = __toESM(require("@elliemae/em-ssf-host"));
|
|
35
|
+
var import_redact_pii = require("../../redact-pii.js");
|
|
36
|
+
var import_web_analytics = require("./web-analytics.js");
|
|
37
|
+
class Analytics extends import_em_ssf_host.default.ScriptingObject {
|
|
38
|
+
/**
|
|
39
|
+
* logger instance
|
|
40
|
+
*/
|
|
41
|
+
#logger;
|
|
42
|
+
/**
|
|
43
|
+
* Creates new instance of Analytics scripting object
|
|
44
|
+
* @param logger instance of PUI Diagnostics logger
|
|
45
|
+
*/
|
|
46
|
+
constructor(logger) {
|
|
47
|
+
super("analytics");
|
|
48
|
+
this.#logger = logger;
|
|
49
|
+
this.#monitorPerformance();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* monitor performance and report to GTM
|
|
53
|
+
*/
|
|
54
|
+
#monitorPerformance = () => {
|
|
55
|
+
try {
|
|
56
|
+
const po = new PerformanceObserver((list) => {
|
|
57
|
+
for (const entry of list.getEntries()) {
|
|
58
|
+
switch (entry.entryType) {
|
|
59
|
+
case "measure":
|
|
60
|
+
this.sendBAEvent({
|
|
61
|
+
event: "performance",
|
|
62
|
+
name: entry.name,
|
|
63
|
+
duration: entry.duration.toString(),
|
|
64
|
+
startTime: new Date(
|
|
65
|
+
performance.timeOrigin + entry.startTime
|
|
66
|
+
).toISOString()
|
|
67
|
+
}).catch(() => {
|
|
68
|
+
});
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
po.observe({ type: "measure", buffered: true });
|
|
76
|
+
} catch (e) {
|
|
77
|
+
this.#logger.error({
|
|
78
|
+
message: "Error while recording performance",
|
|
79
|
+
exception: e
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* send business analytics event
|
|
85
|
+
* @param event business analytics event
|
|
86
|
+
* @returns promise
|
|
87
|
+
*/
|
|
88
|
+
sendBAEvent = (event) => {
|
|
89
|
+
const eventEx = { ...(0, import_web_analytics.getBAEventParameters)(), ...event };
|
|
90
|
+
const redactedData = (0, import_redact_pii.redactPii)(eventEx);
|
|
91
|
+
window.gtmDataLayer = window.gtmDataLayer || [];
|
|
92
|
+
window.gtmDataLayer.push(redactedData);
|
|
93
|
+
return Promise.resolve();
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* start a performance mark
|
|
97
|
+
* @param markName name of the performance mark
|
|
98
|
+
* @param markOptions
|
|
99
|
+
* @returns a promise that resolves to a PerformanceMeasure object
|
|
100
|
+
*/
|
|
101
|
+
perfMarkStart = (markName, markOptions) => {
|
|
102
|
+
if (!markName) throw new Error("markName is required");
|
|
103
|
+
return Promise.resolve(performance.mark(markName, markOptions));
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* end a performance mark
|
|
107
|
+
* @param startMarkNameorMark start mark name or start PerformanceMeasure object
|
|
108
|
+
* @returns a promise that resolves when the mark is ended
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const startMark = await analytics.perfMarkStart('LongTask');
|
|
112
|
+
* // do some work
|
|
113
|
+
* await analytics.perfMarkEnd(startMark);
|
|
114
|
+
* ```
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const startMark = await analytics.perfMarkStart('LongTask');
|
|
117
|
+
* // do some work
|
|
118
|
+
* await analytics.perfMarkEnd('LongTask');
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
perfMarkEnd = (startMarkNameorMark) => {
|
|
122
|
+
if (!startMarkNameorMark) throw new Error("startMark is required");
|
|
123
|
+
if (typeof startMarkNameorMark === "string")
|
|
124
|
+
performance.measure(startMarkNameorMark, { start: startMarkNameorMark });
|
|
125
|
+
else
|
|
126
|
+
performance.measure(startMarkNameorMark.name, {
|
|
127
|
+
start: startMarkNameorMark.startTime
|
|
128
|
+
});
|
|
129
|
+
return Promise.resolve();
|
|
130
|
+
};
|
|
131
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CMicroAppGuest } from "../utils/micro-frontend/guest.js";
|
|
2
|
-
import { getBAEventParameters } from "
|
|
2
|
+
import { getBAEventParameters } from "../utils/micro-frontend/scripting-objects/web-analytics.js";
|
|
3
3
|
import { redactPii } from "../utils/redact-pii.js";
|
|
4
4
|
const sendBAEventToSelf = (data) => {
|
|
5
5
|
const redactedData = redactPii(data);
|
package/dist/esm/index.js
CHANGED
|
@@ -131,9 +131,11 @@ import { getStore } from "./data/store.js";
|
|
|
131
131
|
import { RegisterService } from "./utils/guest-with-service.js";
|
|
132
132
|
import { setAppDynamicsUserData } from "./analytics/appdynamics.js";
|
|
133
133
|
import { sendBAEvent } from "./analytics/index.js";
|
|
134
|
-
import { updateBAEventParameters } from "./
|
|
134
|
+
import { updateBAEventParameters } from "./utils/micro-frontend/scripting-objects/web-analytics.js";
|
|
135
|
+
import { Analytics } from "./utils/micro-frontend/scripting-objects/analytics.js";
|
|
135
136
|
import { redactPii } from "./utils/redact-pii.js";
|
|
136
137
|
export {
|
|
138
|
+
Analytics,
|
|
137
139
|
AppRoot,
|
|
138
140
|
Autocomplete,
|
|
139
141
|
CMicroAppGuest,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _ from "lodash";
|
|
2
2
|
import { setAppConfig } from "./config.js";
|
|
3
3
|
import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
|
|
4
|
-
import { updateBAEventParameters } from "
|
|
4
|
+
import { updateBAEventParameters } from "../micro-frontend/scripting-objects/web-analytics.js";
|
|
5
5
|
import { getAssetPath } from "../window.js";
|
|
6
6
|
import { getAppConfigValue } from "./config.js";
|
|
7
7
|
const parseAppConfig = (data) => {
|
|
@@ -7,7 +7,7 @@ import { browserHistory } from "../history.js";
|
|
|
7
7
|
import { consoleLogger } from "../console-logger.js";
|
|
8
8
|
import { setLogger } from "../logger.js";
|
|
9
9
|
import { removeStorageEvents } from "../web-storage.js";
|
|
10
|
-
import { updateBAEventParameters } from "
|
|
10
|
+
import { updateBAEventParameters } from "./scripting-objects/web-analytics.js";
|
|
11
11
|
import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
|
|
12
12
|
import { SSFGuestAdapter } from "./ssfguest-adapter.js";
|
|
13
13
|
const isCrossDomain = () => {
|
|
@@ -18,9 +18,9 @@ import {
|
|
|
18
18
|
getCurrentBreakpoint,
|
|
19
19
|
getViewportSize as getWindowViewportSize
|
|
20
20
|
} from "../window.js";
|
|
21
|
-
import { sendBAEvent } from "../../analytics/index.js";
|
|
22
21
|
import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
|
|
23
|
-
import {
|
|
22
|
+
import { Analytics } from "./scripting-objects/analytics.js";
|
|
23
|
+
import { updateBAEventParameters } from "./scripting-objects/web-analytics.js";
|
|
24
24
|
import { renewSession } from "../session.js";
|
|
25
25
|
class CMicroAppHost {
|
|
26
26
|
static instance;
|
|
@@ -31,6 +31,8 @@ class CMicroAppHost {
|
|
|
31
31
|
onInit;
|
|
32
32
|
onRenewSessionTimer;
|
|
33
33
|
scriptingObjects;
|
|
34
|
+
#ssfHostRef;
|
|
35
|
+
// eslint-disable-next-line max-statements
|
|
34
36
|
constructor(params) {
|
|
35
37
|
this.appId = getAppConfigValue("appId");
|
|
36
38
|
this.onInit = params?.onInit;
|
|
@@ -43,7 +45,13 @@ class CMicroAppHost {
|
|
|
43
45
|
theme: params?.theme ?? getDefaultTheme()
|
|
44
46
|
};
|
|
45
47
|
this.activeGuests = {};
|
|
46
|
-
this
|
|
48
|
+
this.#ssfHostRef = params?.ssfHostRef || null;
|
|
49
|
+
const analyticsObj = new Analytics(this.logger);
|
|
50
|
+
this.scriptingObjects = {
|
|
51
|
+
analytics: analyticsObj,
|
|
52
|
+
...params?.scriptingObjects ?? {}
|
|
53
|
+
};
|
|
54
|
+
this.#ssfHostRef?.publish(analyticsObj);
|
|
47
55
|
this.getProps = this.getProps.bind(this);
|
|
48
56
|
this.getLogger = this.getLogger.bind(this);
|
|
49
57
|
this.getGuests = this.getGuests.bind(this);
|
|
@@ -149,7 +157,8 @@ class CMicroAppHost {
|
|
|
149
157
|
this.props.systemVersion = version;
|
|
150
158
|
}
|
|
151
159
|
sendBAEvent(data) {
|
|
152
|
-
sendBAEvent(
|
|
160
|
+
this.scriptingObjects.analytics.sendBAEvent(data).catch(() => {
|
|
161
|
+
});
|
|
153
162
|
}
|
|
154
163
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
155
164
|
async getObject(name) {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import ssfHost from "@elliemae/em-ssf-host";
|
|
2
|
+
import { redactPii } from "../../redact-pii.js";
|
|
3
|
+
import { getBAEventParameters } from "./web-analytics.js";
|
|
4
|
+
class Analytics extends ssfHost.ScriptingObject {
|
|
5
|
+
/**
|
|
6
|
+
* logger instance
|
|
7
|
+
*/
|
|
8
|
+
#logger;
|
|
9
|
+
/**
|
|
10
|
+
* Creates new instance of Analytics scripting object
|
|
11
|
+
* @param logger instance of PUI Diagnostics logger
|
|
12
|
+
*/
|
|
13
|
+
constructor(logger) {
|
|
14
|
+
super("analytics");
|
|
15
|
+
this.#logger = logger;
|
|
16
|
+
this.#monitorPerformance();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* monitor performance and report to GTM
|
|
20
|
+
*/
|
|
21
|
+
#monitorPerformance = () => {
|
|
22
|
+
try {
|
|
23
|
+
const po = new PerformanceObserver((list) => {
|
|
24
|
+
for (const entry of list.getEntries()) {
|
|
25
|
+
switch (entry.entryType) {
|
|
26
|
+
case "measure":
|
|
27
|
+
this.sendBAEvent({
|
|
28
|
+
event: "performance",
|
|
29
|
+
name: entry.name,
|
|
30
|
+
duration: entry.duration.toString(),
|
|
31
|
+
startTime: new Date(
|
|
32
|
+
performance.timeOrigin + entry.startTime
|
|
33
|
+
).toISOString()
|
|
34
|
+
}).catch(() => {
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
po.observe({ type: "measure", buffered: true });
|
|
43
|
+
} catch (e) {
|
|
44
|
+
this.#logger.error({
|
|
45
|
+
message: "Error while recording performance",
|
|
46
|
+
exception: e
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* send business analytics event
|
|
52
|
+
* @param event business analytics event
|
|
53
|
+
* @returns promise
|
|
54
|
+
*/
|
|
55
|
+
sendBAEvent = (event) => {
|
|
56
|
+
const eventEx = { ...getBAEventParameters(), ...event };
|
|
57
|
+
const redactedData = redactPii(eventEx);
|
|
58
|
+
window.gtmDataLayer = window.gtmDataLayer || [];
|
|
59
|
+
window.gtmDataLayer.push(redactedData);
|
|
60
|
+
return Promise.resolve();
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* start a performance mark
|
|
64
|
+
* @param markName name of the performance mark
|
|
65
|
+
* @param markOptions
|
|
66
|
+
* @returns a promise that resolves to a PerformanceMeasure object
|
|
67
|
+
*/
|
|
68
|
+
perfMarkStart = (markName, markOptions) => {
|
|
69
|
+
if (!markName) throw new Error("markName is required");
|
|
70
|
+
return Promise.resolve(performance.mark(markName, markOptions));
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* end a performance mark
|
|
74
|
+
* @param startMarkNameorMark start mark name or start PerformanceMeasure object
|
|
75
|
+
* @returns a promise that resolves when the mark is ended
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const startMark = await analytics.perfMarkStart('LongTask');
|
|
79
|
+
* // do some work
|
|
80
|
+
* await analytics.perfMarkEnd(startMark);
|
|
81
|
+
* ```
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const startMark = await analytics.perfMarkStart('LongTask');
|
|
84
|
+
* // do some work
|
|
85
|
+
* await analytics.perfMarkEnd('LongTask');
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
perfMarkEnd = (startMarkNameorMark) => {
|
|
89
|
+
if (!startMarkNameorMark) throw new Error("startMark is required");
|
|
90
|
+
if (typeof startMarkNameorMark === "string")
|
|
91
|
+
performance.measure(startMarkNameorMark, { start: startMarkNameorMark });
|
|
92
|
+
else
|
|
93
|
+
performance.measure(startMarkNameorMark.name, {
|
|
94
|
+
start: startMarkNameorMark.startTime
|
|
95
|
+
});
|
|
96
|
+
return Promise.resolve();
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
Analytics
|
|
101
|
+
};
|
|
@@ -75,4 +75,4 @@ export declare const getApiActionCreator: (api: string) => (operation: string) =
|
|
|
75
75
|
* @param {string} stateName the redux store's state name of the state you want to access.
|
|
76
76
|
* @returns {Function} A *selectField* function that returns a selector function to be used inside a *useSelector* hook or a *select* side effect
|
|
77
77
|
*/
|
|
78
|
-
export declare const getSelectField: (stateName: string) => (fieldName: string | string
|
|
78
|
+
export declare const getSelectField: (stateName: string) => (fieldName: (string | Array<string>) | undefined, defaultValue: unknown | Array<unknown>) => (state?: {}, stateValue?: unknown) => Array<unknown> | unknown;
|
|
@@ -3,16 +3,6 @@ import type { RootState, AppDispatch } from './types.js';
|
|
|
3
3
|
export declare const listenerMiddleware: import("@reduxjs/toolkit").ListenerMiddlewareInstance<unknown, import("@reduxjs/toolkit").ThunkDispatch<unknown, unknown, import("redux").AnyAction>, unknown>;
|
|
4
4
|
export type AppStartListening = TypedStartListening<RootState, AppDispatch>;
|
|
5
5
|
export declare const startSideEffect: AppStartListening;
|
|
6
|
-
export declare const createSideEffect: TypedAddListener<
|
|
7
|
-
|
|
8
|
-
error: import("./error/index.js").ErrorState;
|
|
9
|
-
breakpoint: import("./breakpoint/index.js").BreakpointState;
|
|
10
|
-
liveMessage: import("./live-message/index.js").LiveMessageState;
|
|
11
|
-
}>, AppDispatch>;
|
|
12
|
-
export declare const removeSideEffect: TypedRemoveListener<import("redux").CombinedState<{
|
|
13
|
-
waitMessage: import("./wait-message/reducer.js").WaitMessageState;
|
|
14
|
-
error: import("./error/index.js").ErrorState;
|
|
15
|
-
breakpoint: import("./breakpoint/index.js").BreakpointState;
|
|
16
|
-
liveMessage: import("./live-message/index.js").LiveMessageState;
|
|
17
|
-
}>, AppDispatch>;
|
|
6
|
+
export declare const createSideEffect: TypedAddListener<RootState, AppDispatch>;
|
|
7
|
+
export declare const removeSideEffect: TypedRemoveListener<RootState, AppDispatch>;
|
|
18
8
|
export declare const clearSideEffects: () => void;
|
|
@@ -19,12 +19,7 @@ export declare const getStore: () => unknown;
|
|
|
19
19
|
type MiddlewareConfig = {
|
|
20
20
|
thunk?: boolean;
|
|
21
21
|
};
|
|
22
|
-
export declare const createAppStore: (initialState: import("redux").
|
|
23
|
-
waitMessage: import("./wait-message/reducer.js").WaitMessageState;
|
|
24
|
-
error: import("./error/index.js").ErrorState;
|
|
25
|
-
breakpoint: import("./breakpoint/index.js").BreakpointState;
|
|
26
|
-
liveMessage: import("./live-message/index.js").LiveMessageState;
|
|
27
|
-
}> | undefined, history: History, middlewareConfig?: MiddlewareConfig, injectedReducers?: InjectedReducers) => import("@reduxjs/toolkit/dist/configureStore.js").ToolkitStore<import("redux").EmptyObject & {
|
|
22
|
+
export declare const createAppStore: (initialState: RootState | undefined, history: History, middlewareConfig?: MiddlewareConfig, injectedReducers?: InjectedReducers) => import("@reduxjs/toolkit/dist/configureStore.js").ToolkitStore<import("redux").EmptyObject & {
|
|
28
23
|
waitMessage: import("./wait-message/reducer.js").WaitMessageState;
|
|
29
24
|
error: import("./error/index.js").ErrorState;
|
|
30
25
|
breakpoint: import("./breakpoint/index.js").BreakpointState;
|
|
@@ -85,7 +85,8 @@ export { getStore } from './data/store.js';
|
|
|
85
85
|
export { RegisterService } from './utils/guest-with-service.js';
|
|
86
86
|
export { setAppDynamicsUserData } from './analytics/appdynamics.js';
|
|
87
87
|
export { sendBAEvent } from './analytics/index.js';
|
|
88
|
-
export { updateBAEventParameters } from './
|
|
88
|
+
export { updateBAEventParameters } from './utils/micro-frontend/scripting-objects/web-analytics.js';
|
|
89
|
+
export { Analytics } from './utils/micro-frontend/scripting-objects/analytics.js';
|
|
89
90
|
export { redactPii } from './utils/redact-pii.js';
|
|
90
91
|
export type { EMUI } from './utils/window.js';
|
|
91
92
|
export type { Await } from './utils/await.js';
|
|
@@ -4,7 +4,7 @@ type LoginParams = {
|
|
|
4
4
|
responseType: string;
|
|
5
5
|
redirectUri: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const setLoginParams: (params: Omit<LoginParams,
|
|
7
|
+
export declare const setLoginParams: (params: Omit<LoginParams, "redirectUri"> & {
|
|
8
8
|
redirectUri?: string;
|
|
9
9
|
}) => void;
|
|
10
10
|
export declare const getLoginParams: () => LoginParams;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { History, To } from 'history';
|
|
2
2
|
import { DefaultTheme } from 'styled-components';
|
|
3
|
-
import { IMicroAppHost, ResizeEventHandler, BreakpointChangeEventHandler, SubscriptionListener
|
|
3
|
+
import { IMicroAppHost, ResizeEventHandler, BreakpointChangeEventHandler, SubscriptionListener } from '@elliemae/pui-micro-frontend-base';
|
|
4
|
+
import ssfHost from '@elliemae/em-ssf-host';
|
|
5
|
+
import { BAEvent } from '@elliemae/pui-scripting-object';
|
|
4
6
|
import { MicroFrontEndLogger } from '../types.js';
|
|
5
7
|
type HostOptions = {
|
|
6
8
|
systemVersion: string;
|
|
@@ -16,8 +18,10 @@ type ConstructorParams = {
|
|
|
16
18
|
scriptingObjects?: Record<string, any>;
|
|
17
19
|
onRenewSessionTimer?: () => void;
|
|
18
20
|
onInit?: OnInitCallback;
|
|
21
|
+
ssfHostRef?: typeof ssfHost.Host;
|
|
19
22
|
};
|
|
20
23
|
export declare class CMicroAppHost implements IMicroAppHost {
|
|
24
|
+
#private;
|
|
21
25
|
private static instance;
|
|
22
26
|
private readonly logger;
|
|
23
27
|
private readonly appId;
|
|
@@ -54,7 +58,7 @@ export declare class CMicroAppHost implements IMicroAppHost {
|
|
|
54
58
|
onResizeEvent(eventHandler: ResizeEventHandler): string;
|
|
55
59
|
onBreakpointChangeEvent(eventHandler: BreakpointChangeEventHandler): string;
|
|
56
60
|
setSystemVersion(version?: string): void;
|
|
57
|
-
sendBAEvent(
|
|
61
|
+
sendBAEvent(data: BAEvent): void;
|
|
58
62
|
getObject<T>(name: string): Promise<T>;
|
|
59
63
|
}
|
|
60
64
|
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import ssfHost from '@elliemae/em-ssf-host';
|
|
2
|
+
import { IAnalytics, BAEvent } from '@elliemae/pui-scripting-object';
|
|
3
|
+
import { MicroFrontEndLogger } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Analytics scripting object
|
|
6
|
+
*/
|
|
7
|
+
export declare class Analytics extends ssfHost.ScriptingObject implements IAnalytics {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* Creates new instance of Analytics scripting object
|
|
11
|
+
* @param logger instance of PUI Diagnostics logger
|
|
12
|
+
*/
|
|
13
|
+
constructor(logger: MicroFrontEndLogger);
|
|
14
|
+
/**
|
|
15
|
+
* send business analytics event
|
|
16
|
+
* @param event business analytics event
|
|
17
|
+
* @returns promise
|
|
18
|
+
*/
|
|
19
|
+
sendBAEvent: (event: BAEvent) => Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* start a performance mark
|
|
22
|
+
* @param markName name of the performance mark
|
|
23
|
+
* @param markOptions
|
|
24
|
+
* @returns a promise that resolves to a PerformanceMeasure object
|
|
25
|
+
*/
|
|
26
|
+
perfMarkStart: (markName: string, markOptions?: PerformanceMarkOptions) => Promise<PerformanceMark>;
|
|
27
|
+
/**
|
|
28
|
+
* end a performance mark
|
|
29
|
+
* @param startMarkNameorMark start mark name or start PerformanceMeasure object
|
|
30
|
+
* @returns a promise that resolves when the mark is ended
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const startMark = await analytics.perfMarkStart('LongTask');
|
|
34
|
+
* // do some work
|
|
35
|
+
* await analytics.perfMarkEnd(startMark);
|
|
36
|
+
* ```
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const startMark = await analytics.perfMarkStart('LongTask');
|
|
39
|
+
* // do some work
|
|
40
|
+
* await analytics.perfMarkEnd('LongTask');
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
perfMarkEnd: (startMarkNameorMark: string | PerformanceMeasure) => Promise<void>;
|
|
44
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import './preview.css';
|
|
3
2
|
export declare const getParameters: (storyBookTheme: {
|
|
4
3
|
[x: string]: any;
|
|
@@ -27,5 +26,5 @@ export declare const getParameters: (storyBookTheme: {
|
|
|
27
26
|
hideEmpty: boolean;
|
|
28
27
|
};
|
|
29
28
|
};
|
|
30
|
-
export declare const decorators: ((story: () =>
|
|
29
|
+
export declare const decorators: ((story: () => React.ReactElement) => import("react/jsx-runtime.js").JSX.Element)[];
|
|
31
30
|
export declare const loaders: (() => Promise<void>)[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RenderOptions } from '@testing-library/react';
|
|
2
|
-
declare const customRender: (ui: React.ReactElement, options?: Omit<RenderOptions,
|
|
2
|
+
declare const customRender: (ui: React.ReactElement, options?: Omit<RenderOptions, "queries">) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries.js"), HTMLElement, HTMLElement>;
|
|
3
3
|
export * from '@testing-library/react';
|
|
4
4
|
export { customRender as render };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { AppStore, RootState } from '../../data/store.js';
|
|
3
2
|
interface Args {
|
|
4
3
|
initialState: RootState;
|
|
@@ -24,8 +23,8 @@ export declare const renderWithRedux: (ui: React.ReactElement, { initialState, s
|
|
|
24
23
|
}>, import("redux").AnyAction>, ...(import("redux-saga").SagaMiddleware<object> | import("redux").Middleware<any, any, import("redux").Dispatch<import("redux").AnyAction>>)[]]>>;
|
|
25
24
|
container: HTMLElement;
|
|
26
25
|
baseElement: HTMLElement;
|
|
27
|
-
debug: (baseElement?: Element | DocumentFragment |
|
|
28
|
-
rerender: (ui:
|
|
26
|
+
debug: (baseElement?: Element | DocumentFragment | Array<Element | DocumentFragment>, maxLength?: number, options?: import("pretty-format").OptionsReceived) => void;
|
|
27
|
+
rerender: (ui: React.ReactNode) => void;
|
|
29
28
|
unmount: () => void;
|
|
30
29
|
asFragment: () => DocumentFragment;
|
|
31
30
|
getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { History } from 'history';
|
|
3
2
|
import { AppStore, RootState } from '../../data/store.js';
|
|
4
3
|
interface Args {
|
|
@@ -27,8 +26,8 @@ export declare const renderWithRouterRedux: (ui: React.ReactElement, { route, hi
|
|
|
27
26
|
}>, import("redux").AnyAction>, ...(import("redux-saga").SagaMiddleware<object> | import("redux").Middleware<any, any, import("redux").Dispatch<import("redux").AnyAction>>)[]]>>;
|
|
28
27
|
container: HTMLElement;
|
|
29
28
|
baseElement: HTMLElement;
|
|
30
|
-
debug: (baseElement?: Element | DocumentFragment |
|
|
31
|
-
rerender: (ui:
|
|
29
|
+
debug: (baseElement?: Element | DocumentFragment | Array<Element | DocumentFragment>, maxLength?: number, options?: import("pretty-format").OptionsReceived) => void;
|
|
30
|
+
rerender: (ui: React.ReactNode) => void;
|
|
32
31
|
unmount: () => void;
|
|
33
32
|
asFragment: () => DocumentFragment;
|
|
34
33
|
getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { History } from 'history';
|
|
3
2
|
interface Args {
|
|
4
3
|
route: string;
|
|
@@ -8,8 +7,8 @@ export declare const renderWithRouter: (ui: React.ReactElement, { route, history
|
|
|
8
7
|
history: History;
|
|
9
8
|
container: HTMLElement;
|
|
10
9
|
baseElement: HTMLElement;
|
|
11
|
-
debug: (baseElement?: Element | DocumentFragment |
|
|
12
|
-
rerender: (ui:
|
|
10
|
+
debug: (baseElement?: Element | DocumentFragment | Array<Element | DocumentFragment>, maxLength?: number, options?: import("pretty-format").OptionsReceived) => void;
|
|
11
|
+
rerender: (ui: React.ReactNode) => void;
|
|
13
12
|
unmount: () => void;
|
|
14
13
|
asFragment: () => DocumentFragment;
|
|
15
14
|
getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
|