@elliemae/pui-app-sdk 2.13.1 → 2.13.2
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/appdynamics.js +36 -0
- package/dist/cjs/analytics/index.js +2 -2
- package/dist/cjs/analytics/page-view-event.js +3 -5
- package/dist/cjs/analytics/user-session-event.js +3 -3
- package/dist/cjs/analytics/{ba-event-parameters.js → web-analytics.js} +0 -0
- package/dist/cjs/index.js +11 -2
- package/dist/cjs/utils/auth/index.js +11 -1
- package/dist/cjs/utils/micro-frontend/guest.js +28 -0
- package/dist/cjs/utils/micro-frontend/host.js +11 -3
- package/dist/cjs/view/micro-app/resources/manifest.js +11 -5
- package/dist/cjs/view/micro-app/use-app-will-render.js +5 -4
- package/dist/es/analytics/appdynamics.js +18 -0
- package/dist/es/analytics/index.js +1 -1
- package/dist/es/analytics/page-view-event.js +3 -5
- package/dist/es/analytics/user-session-event.js +1 -1
- package/dist/es/analytics/{ba-event-parameters.js → web-analytics.js} +0 -0
- package/dist/es/index.js +2 -1
- package/dist/es/utils/auth/index.js +10 -1
- package/dist/es/utils/micro-frontend/guest.js +26 -0
- package/dist/es/utils/micro-frontend/host.js +10 -3
- package/dist/es/view/micro-app/resources/manifest.js +11 -5
- package/dist/es/view/micro-app/use-app-will-render.js +5 -4
- package/dist/types/analytics/appdynamics.d.ts +9 -0
- package/dist/types/analytics/web-analytics.d.ts +8 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/utils/micro-frontend/guest.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/analytics/ba-event-parameters.d.ts +0 -8
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setAppDynamicsUserData = exports.getAppDynamicsUserData = void 0;
|
|
7
|
+
|
|
8
|
+
var brum = _interopRequireWildcard(require("@elliemae/pui-user-monitoring"));
|
|
9
|
+
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
|
|
14
|
+
let userData = {
|
|
15
|
+
subAppId: '',
|
|
16
|
+
instanceId: '',
|
|
17
|
+
userId: ''
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const getAppDynamicsUserData = () => userData;
|
|
21
|
+
|
|
22
|
+
exports.getAppDynamicsUserData = getAppDynamicsUserData;
|
|
23
|
+
|
|
24
|
+
const setAppDynamicsUserData = params => {
|
|
25
|
+
userData = { ...userData,
|
|
26
|
+
...params
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (brum) {
|
|
30
|
+
brum.setCustomUserData(() => ({
|
|
31
|
+
userData
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.setAppDynamicsUserData = setAppDynamicsUserData;
|
|
@@ -7,7 +7,7 @@ exports.sendBAEvent = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _guest = require("../utils/micro-frontend/guest.js");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _webAnalytics = require("./web-analytics.js");
|
|
11
11
|
|
|
12
12
|
var _redactPii = require("../utils/redact-pii.js");
|
|
13
13
|
|
|
@@ -21,7 +21,7 @@ const sendBAEvent = ({
|
|
|
21
21
|
data,
|
|
22
22
|
self = true
|
|
23
23
|
}) => {
|
|
24
|
-
const eventData = { ...(0,
|
|
24
|
+
const eventData = { ...(0, _webAnalytics.getBAEventParameters)(),
|
|
25
25
|
...data
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -16,19 +16,17 @@ const pageViewEvent = ({
|
|
|
16
16
|
} = (window.top || window.self).location;
|
|
17
17
|
const {
|
|
18
18
|
title
|
|
19
|
-
} = (window.top || window.self).document;
|
|
20
|
-
|
|
19
|
+
} = (window.top || window.self).document;
|
|
21
20
|
const {
|
|
22
21
|
pathname: guestPagePath,
|
|
23
22
|
href: guestPageUrl
|
|
24
|
-
} = window.location;
|
|
25
|
-
|
|
23
|
+
} = window.location;
|
|
26
24
|
const {
|
|
27
25
|
title: guestPageTitle
|
|
28
26
|
} = document;
|
|
29
27
|
(0, _index.sendBAEvent)({
|
|
30
28
|
data: {
|
|
31
|
-
event: '
|
|
29
|
+
event: 'pageView',
|
|
32
30
|
pageUrl: href,
|
|
33
31
|
pagePath: pathname,
|
|
34
32
|
pageTitle: title,
|
|
@@ -7,13 +7,13 @@ exports.logoutEvent = exports.loginEvent = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _index = require("./index.js");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _webAnalytics = require("./web-analytics.js");
|
|
11
11
|
|
|
12
12
|
const loginEvent = ({
|
|
13
13
|
instanceId,
|
|
14
14
|
userId
|
|
15
15
|
}) => {
|
|
16
|
-
(0,
|
|
16
|
+
(0, _webAnalytics.updateBAEventParameters)({
|
|
17
17
|
instanceId,
|
|
18
18
|
userId
|
|
19
19
|
});
|
|
@@ -32,7 +32,7 @@ const logoutEvent = () => {
|
|
|
32
32
|
event: 'logout'
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
(0,
|
|
35
|
+
(0, _webAnalytics.updateBAEventParameters)({
|
|
36
36
|
instanceId: '',
|
|
37
37
|
userId: ''
|
|
38
38
|
});
|
|
File without changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -91,6 +91,7 @@ var _exportNames = {
|
|
|
91
91
|
MicroIFrameApp: true,
|
|
92
92
|
getNavigationLinks: true,
|
|
93
93
|
RegisterService: true,
|
|
94
|
+
setAppDynamicsUserData: true,
|
|
94
95
|
sendBAEvent: true,
|
|
95
96
|
updateBAEventParameters: true,
|
|
96
97
|
redactPii: true
|
|
@@ -563,6 +564,12 @@ Object.defineProperty(exports, "setAppConfigValue", {
|
|
|
563
564
|
return _config.setAppConfigValue;
|
|
564
565
|
}
|
|
565
566
|
});
|
|
567
|
+
Object.defineProperty(exports, "setAppDynamicsUserData", {
|
|
568
|
+
enumerable: true,
|
|
569
|
+
get: function () {
|
|
570
|
+
return _appdynamics.setAppDynamicsUserData;
|
|
571
|
+
}
|
|
572
|
+
});
|
|
566
573
|
Object.defineProperty(exports, "setHostAppData", {
|
|
567
574
|
enumerable: true,
|
|
568
575
|
get: function () {
|
|
@@ -590,7 +597,7 @@ Object.defineProperty(exports, "trackActivity", {
|
|
|
590
597
|
Object.defineProperty(exports, "updateBAEventParameters", {
|
|
591
598
|
enumerable: true,
|
|
592
599
|
get: function () {
|
|
593
|
-
return
|
|
600
|
+
return _webAnalytics.updateBAEventParameters;
|
|
594
601
|
}
|
|
595
602
|
});
|
|
596
603
|
Object.defineProperty(exports, "useAppDispatch", {
|
|
@@ -782,9 +789,11 @@ var _utils = require("./view/micro-app/utils.js");
|
|
|
782
789
|
|
|
783
790
|
var _guestWithService = require("./utils/guest-with-service.js");
|
|
784
791
|
|
|
792
|
+
var _appdynamics = require("./analytics/appdynamics.js");
|
|
793
|
+
|
|
785
794
|
var _index38 = require("./analytics/index.js");
|
|
786
795
|
|
|
787
|
-
var
|
|
796
|
+
var _webAnalytics = require("./analytics/web-analytics.js");
|
|
788
797
|
|
|
789
798
|
var _redactPii = require("./utils/redact-pii.js");
|
|
790
799
|
|
|
@@ -13,6 +13,8 @@ var _index2 = require("../../api/users/index.js");
|
|
|
13
13
|
|
|
14
14
|
var _userSessionEvent = require("../../analytics/user-session-event.js");
|
|
15
15
|
|
|
16
|
+
var _appdynamics = require("../../analytics/appdynamics.js");
|
|
17
|
+
|
|
16
18
|
var _helper = require("./helper.js");
|
|
17
19
|
|
|
18
20
|
var _config = require("../app-config/config.js");
|
|
@@ -82,7 +84,11 @@ const endSession = async ({
|
|
|
82
84
|
clientId,
|
|
83
85
|
token
|
|
84
86
|
});
|
|
85
|
-
(0, _userSessionEvent.logoutEvent)();
|
|
87
|
+
(0, _userSessionEvent.logoutEvent)();
|
|
88
|
+
(0, _appdynamics.setAppDynamicsUserData)({
|
|
89
|
+
instanceId: '',
|
|
90
|
+
userId: ''
|
|
91
|
+
}); // redirect
|
|
86
92
|
|
|
87
93
|
const idpHost = (0, _config.getAppConfigValue)(IDP_ENDPOINT_CONFIG_KEY, '');
|
|
88
94
|
const logoutUrl = new URL('/authorize', idpHost);
|
|
@@ -146,6 +152,10 @@ const authorize = async ({
|
|
|
146
152
|
(0, _userSessionEvent.loginEvent)({
|
|
147
153
|
instanceId,
|
|
148
154
|
userId: userName
|
|
155
|
+
});
|
|
156
|
+
(0, _appdynamics.setAppDynamicsUserData)({
|
|
157
|
+
instanceId,
|
|
158
|
+
userId: userName
|
|
149
159
|
}); // get user info
|
|
150
160
|
|
|
151
161
|
const data = await (0, _index2.getUser)({
|
|
@@ -29,6 +29,10 @@ var _consoleLogger = require("./console-logger.js");
|
|
|
29
29
|
|
|
30
30
|
var _webStorage = require("../web-storage.js");
|
|
31
31
|
|
|
32
|
+
var _webAnalytics = require("../../analytics/web-analytics.js");
|
|
33
|
+
|
|
34
|
+
var _appdynamics = require("../../analytics/appdynamics.js");
|
|
35
|
+
|
|
32
36
|
const isCrossDomain = () => {
|
|
33
37
|
try {
|
|
34
38
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
@@ -113,6 +117,18 @@ class CMicroAppGuest {
|
|
|
113
117
|
return this.props;
|
|
114
118
|
}
|
|
115
119
|
|
|
120
|
+
getSessionStorageItem(key) {
|
|
121
|
+
var _this$props$host;
|
|
122
|
+
|
|
123
|
+
let value = sessionStorage.getItem(key);
|
|
124
|
+
|
|
125
|
+
if (!value && (_this$props$host = this.props.host) !== null && _this$props$host !== void 0 && _this$props$host.getItem) {
|
|
126
|
+
value = this.props.host.getItem(key);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
|
|
116
132
|
async getSSFHost() {
|
|
117
133
|
let host = null;
|
|
118
134
|
|
|
@@ -150,6 +166,18 @@ class CMicroAppGuest {
|
|
|
150
166
|
if (this.onInit) this.onInit(this.props);
|
|
151
167
|
});
|
|
152
168
|
/* eslint-enable camelcase, no-undef */
|
|
169
|
+
|
|
170
|
+
const instanceId = this.getSessionStorageItem('instanceId') || '';
|
|
171
|
+
const userId = this.getSessionStorageItem('userId') || '';
|
|
172
|
+
(0, _webAnalytics.updateBAEventParameters)({
|
|
173
|
+
instanceId,
|
|
174
|
+
userId
|
|
175
|
+
});
|
|
176
|
+
(0, _appdynamics.setAppDynamicsUserData)({
|
|
177
|
+
subAppId: this.appId,
|
|
178
|
+
instanceId,
|
|
179
|
+
userId
|
|
180
|
+
});
|
|
153
181
|
}
|
|
154
182
|
|
|
155
183
|
mount(options = {
|
|
@@ -37,6 +37,8 @@ var _window = require("../window.js");
|
|
|
37
37
|
|
|
38
38
|
var _index3 = require("../../analytics/index.js");
|
|
39
39
|
|
|
40
|
+
var _appdynamics = require("../../analytics/appdynamics.js");
|
|
41
|
+
|
|
40
42
|
class CMicroAppHost {
|
|
41
43
|
constructor(params) {
|
|
42
44
|
(0, _defineProperty2.default)(this, "logger", void 0);
|
|
@@ -67,6 +69,12 @@ class CMicroAppHost {
|
|
|
67
69
|
if (this.onInit) this.onInit(this.props);
|
|
68
70
|
}).catch(() => {});
|
|
69
71
|
/* eslint-enable camelcase, no-undef */
|
|
72
|
+
|
|
73
|
+
(0, _appdynamics.setAppDynamicsUserData)({
|
|
74
|
+
subAppId: this.appId,
|
|
75
|
+
instanceId: '',
|
|
76
|
+
userId: ''
|
|
77
|
+
});
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
static getInstance(params) {
|
|
@@ -176,15 +184,15 @@ class CMicroAppHost {
|
|
|
176
184
|
setSystemVersion(version = 'latest') {
|
|
177
185
|
window.emui.version = version;
|
|
178
186
|
this.props.systemVersion = version;
|
|
179
|
-
}
|
|
187
|
+
} // eslint-disable-next-line max-lines
|
|
188
|
+
|
|
180
189
|
|
|
181
190
|
sendBAEvent(data) {
|
|
182
191
|
(0, _index3.sendBAEvent)({
|
|
183
192
|
data,
|
|
184
193
|
self: true
|
|
185
194
|
});
|
|
186
|
-
}
|
|
187
|
-
|
|
195
|
+
}
|
|
188
196
|
|
|
189
197
|
}
|
|
190
198
|
|
|
@@ -13,7 +13,7 @@ var _index2 = require("../../../utils/micro-frontend/index.js");
|
|
|
13
13
|
|
|
14
14
|
var _logRecords = require("../../../utils/log-records.js");
|
|
15
15
|
|
|
16
|
-
const getUnVersionedManifestPath = path => path.replace(/\/\d+\.\d
|
|
16
|
+
const getUnVersionedManifestPath = path => path.replace(/\/\d+\.\d+/, '/latest');
|
|
17
17
|
|
|
18
18
|
const getAppManifest = async ({
|
|
19
19
|
hostUrl,
|
|
@@ -25,10 +25,16 @@ const getAppManifest = async ({
|
|
|
25
25
|
headers
|
|
26
26
|
} = response;
|
|
27
27
|
if (headers['content-type'] && headers['content-type'].includes('application/json')) return response.data;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const unVersionedManifestPath = getUnVersionedManifestPath(manifestPath);
|
|
29
|
+
|
|
30
|
+
if (manifestPath !== unVersionedManifestPath) {
|
|
31
|
+
return getAppManifest({
|
|
32
|
+
hostUrl,
|
|
33
|
+
manifestPath: getUnVersionedManifestPath(manifestPath)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
throw new Error('manifest.json is not available for the application');
|
|
32
38
|
};
|
|
33
39
|
|
|
34
40
|
exports.getAppManifest = getAppManifest;
|
|
@@ -35,11 +35,12 @@ const useAppWillRender = ({
|
|
|
35
35
|
const getConfig = (0, _react.useCallback)(() => (0, _index2.getMicroFrontEndAppConfig)({
|
|
36
36
|
id
|
|
37
37
|
}), [id]);
|
|
38
|
-
const unload = (0, _react.useCallback)(async appConfig => {
|
|
38
|
+
const unload = (0, _react.useCallback)(async (appConfig, loadFailed = false) => {
|
|
39
39
|
await (0, _index.unmountApp)(appConfig);
|
|
40
40
|
(0, _index.unloadApp)(appConfig);
|
|
41
|
-
if (onUnloadComplete) onUnloadComplete();
|
|
42
|
-
},
|
|
41
|
+
if (!loadFailed && onUnloadComplete) onUnloadComplete();
|
|
42
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
[]);
|
|
43
44
|
const load = (0, _react.useCallback)(async appConfig => {
|
|
44
45
|
if (dispatch) dispatch(_actions.waitMessage.open());
|
|
45
46
|
|
|
@@ -52,7 +53,7 @@ const useAppWillRender = ({
|
|
|
52
53
|
(0, _index2.getLogger)().error({ ..._logRecords.logRecords.APP_CONFIG_LOAD_FAILED,
|
|
53
54
|
exception: ex
|
|
54
55
|
});
|
|
55
|
-
await unload(appConfig);
|
|
56
|
+
await unload(appConfig, true);
|
|
56
57
|
throw ex;
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as brum from '@elliemae/pui-user-monitoring';
|
|
2
|
+
let userData = {
|
|
3
|
+
subAppId: '',
|
|
4
|
+
instanceId: '',
|
|
5
|
+
userId: ''
|
|
6
|
+
};
|
|
7
|
+
export const getAppDynamicsUserData = () => userData;
|
|
8
|
+
export const setAppDynamicsUserData = params => {
|
|
9
|
+
userData = { ...userData,
|
|
10
|
+
...params
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
if (brum) {
|
|
14
|
+
brum.setCustomUserData(() => ({
|
|
15
|
+
userData
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CMicroAppGuest } from "../utils/micro-frontend/guest.js";
|
|
2
|
-
import { getBAEventParameters } from "./
|
|
2
|
+
import { getBAEventParameters } from "./web-analytics.js";
|
|
3
3
|
import { redactPii } from "../utils/redact-pii.js";
|
|
4
4
|
|
|
5
5
|
const sendBAEventToSelf = data => {
|
|
@@ -8,19 +8,17 @@ export const pageViewEvent = ({
|
|
|
8
8
|
} = (window.top || window.self).location;
|
|
9
9
|
const {
|
|
10
10
|
title
|
|
11
|
-
} = (window.top || window.self).document;
|
|
12
|
-
|
|
11
|
+
} = (window.top || window.self).document;
|
|
13
12
|
const {
|
|
14
13
|
pathname: guestPagePath,
|
|
15
14
|
href: guestPageUrl
|
|
16
|
-
} = window.location;
|
|
17
|
-
|
|
15
|
+
} = window.location;
|
|
18
16
|
const {
|
|
19
17
|
title: guestPageTitle
|
|
20
18
|
} = document;
|
|
21
19
|
sendBAEvent({
|
|
22
20
|
data: {
|
|
23
|
-
event: '
|
|
21
|
+
event: 'pageView',
|
|
24
22
|
pageUrl: href,
|
|
25
23
|
pagePath: pathname,
|
|
26
24
|
pageTitle: title,
|
|
File without changes
|
package/dist/es/index.js
CHANGED
|
@@ -76,7 +76,8 @@ export { getNavigationLinks } from "./view/micro-app/utils.js"; // app host
|
|
|
76
76
|
export { getStore } from "./data/store.js";
|
|
77
77
|
export { RegisterService } from "./utils/guest-with-service.js"; // analytics
|
|
78
78
|
|
|
79
|
+
export { setAppDynamicsUserData } from "./analytics/appdynamics.js";
|
|
79
80
|
export { sendBAEvent } from "./analytics/index.js";
|
|
80
|
-
export { updateBAEventParameters } from "./analytics/
|
|
81
|
+
export { updateBAEventParameters } from "./analytics/web-analytics.js"; // security utils
|
|
81
82
|
|
|
82
83
|
export { redactPii } from "./utils/redact-pii.js"; // Type utils
|
|
@@ -3,6 +3,7 @@ import { browserHistory as history } from "../history.js";
|
|
|
3
3
|
import { getToken, revokeToken, introspectToken } from "../../api/auth/index.js";
|
|
4
4
|
import { getUser } from "../../api/users/index.js";
|
|
5
5
|
import { loginEvent, logoutEvent } from "../../analytics/user-session-event.js";
|
|
6
|
+
import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
|
|
6
7
|
import { getAuthorizationHeader, setAuthorizationHeader } from "./helper.js";
|
|
7
8
|
import { getAppConfigValue } from "../app-config/config.js";
|
|
8
9
|
import { getLogger } from "../micro-frontend/index.js";
|
|
@@ -57,7 +58,11 @@ export const endSession = async ({
|
|
|
57
58
|
clientId,
|
|
58
59
|
token
|
|
59
60
|
});
|
|
60
|
-
logoutEvent();
|
|
61
|
+
logoutEvent();
|
|
62
|
+
setAppDynamicsUserData({
|
|
63
|
+
instanceId: '',
|
|
64
|
+
userId: ''
|
|
65
|
+
}); // redirect
|
|
61
66
|
|
|
62
67
|
const idpHost = getAppConfigValue(IDP_ENDPOINT_CONFIG_KEY, '');
|
|
63
68
|
const logoutUrl = new URL('/authorize', idpHost);
|
|
@@ -118,6 +123,10 @@ export const authorize = async ({
|
|
|
118
123
|
loginEvent({
|
|
119
124
|
instanceId,
|
|
120
125
|
userId: userName
|
|
126
|
+
});
|
|
127
|
+
setAppDynamicsUserData({
|
|
128
|
+
instanceId,
|
|
129
|
+
userId: userName
|
|
121
130
|
}); // get user info
|
|
122
131
|
|
|
123
132
|
const data = await getUser({
|
|
@@ -9,6 +9,8 @@ import { getAppConfigValue } from "../app-config/config.js";
|
|
|
9
9
|
import { browserHistory } from "../history.js";
|
|
10
10
|
import { logger } from "./console-logger.js";
|
|
11
11
|
import { removeStorageEvents } from "../web-storage.js";
|
|
12
|
+
import { updateBAEventParameters } from "../../analytics/web-analytics.js";
|
|
13
|
+
import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
|
|
12
14
|
|
|
13
15
|
const isCrossDomain = () => {
|
|
14
16
|
try {
|
|
@@ -102,6 +104,18 @@ export class CMicroAppGuest {
|
|
|
102
104
|
return this.props;
|
|
103
105
|
}
|
|
104
106
|
|
|
107
|
+
getSessionStorageItem(key) {
|
|
108
|
+
var _this$props$host;
|
|
109
|
+
|
|
110
|
+
let value = sessionStorage.getItem(key);
|
|
111
|
+
|
|
112
|
+
if (!value && (_this$props$host = this.props.host) !== null && _this$props$host !== void 0 && _this$props$host.getItem) {
|
|
113
|
+
value = this.props.host.getItem(key);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
|
|
105
119
|
async getSSFHost() {
|
|
106
120
|
let host = null;
|
|
107
121
|
|
|
@@ -138,6 +152,18 @@ export class CMicroAppGuest {
|
|
|
138
152
|
if (this.onInit) this.onInit(this.props);
|
|
139
153
|
});
|
|
140
154
|
/* eslint-enable camelcase, no-undef */
|
|
155
|
+
|
|
156
|
+
const instanceId = this.getSessionStorageItem('instanceId') || '';
|
|
157
|
+
const userId = this.getSessionStorageItem('userId') || '';
|
|
158
|
+
updateBAEventParameters({
|
|
159
|
+
instanceId,
|
|
160
|
+
userId
|
|
161
|
+
});
|
|
162
|
+
setAppDynamicsUserData({
|
|
163
|
+
subAppId: this.appId,
|
|
164
|
+
instanceId,
|
|
165
|
+
userId
|
|
166
|
+
});
|
|
141
167
|
}
|
|
142
168
|
|
|
143
169
|
mount(options = {
|
|
@@ -13,6 +13,7 @@ import { logger } from "./console-logger.js";
|
|
|
13
13
|
import { HOST_WINDOW_RESIZED, HOST_WINDOW_BREAKPOINT_CHANGED } from "../constants.js";
|
|
14
14
|
import { getCurrentBreakpoint, getViewportSize as getWindowViewportSize } from "../window.js";
|
|
15
15
|
import { sendBAEvent } from "../../analytics/index.js";
|
|
16
|
+
import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
|
|
16
17
|
export class CMicroAppHost {
|
|
17
18
|
constructor(params) {
|
|
18
19
|
_defineProperty(this, "logger", void 0);
|
|
@@ -49,6 +50,12 @@ export class CMicroAppHost {
|
|
|
49
50
|
if (this.onInit) this.onInit(this.props);
|
|
50
51
|
}).catch(() => {});
|
|
51
52
|
/* eslint-enable camelcase, no-undef */
|
|
53
|
+
|
|
54
|
+
setAppDynamicsUserData({
|
|
55
|
+
subAppId: this.appId,
|
|
56
|
+
instanceId: '',
|
|
57
|
+
userId: ''
|
|
58
|
+
});
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
static getInstance(params) {
|
|
@@ -158,15 +165,15 @@ export class CMicroAppHost {
|
|
|
158
165
|
setSystemVersion(version = 'latest') {
|
|
159
166
|
window.emui.version = version;
|
|
160
167
|
this.props.systemVersion = version;
|
|
161
|
-
}
|
|
168
|
+
} // eslint-disable-next-line max-lines
|
|
169
|
+
|
|
162
170
|
|
|
163
171
|
sendBAEvent(data) {
|
|
164
172
|
sendBAEvent({
|
|
165
173
|
data,
|
|
166
174
|
self: true
|
|
167
175
|
});
|
|
168
|
-
}
|
|
169
|
-
|
|
176
|
+
}
|
|
170
177
|
|
|
171
178
|
}
|
|
172
179
|
|
|
@@ -3,7 +3,7 @@ import { removeDoubleSlash } from "../../../utils/url.js";
|
|
|
3
3
|
import { getLogger } from "../../../utils/micro-frontend/index.js";
|
|
4
4
|
import { logRecords } from "../../../utils/log-records.js";
|
|
5
5
|
|
|
6
|
-
const getUnVersionedManifestPath = path => path.replace(/\/\d+\.\d
|
|
6
|
+
const getUnVersionedManifestPath = path => path.replace(/\/\d+\.\d+/, '/latest');
|
|
7
7
|
|
|
8
8
|
export const getAppManifest = async ({
|
|
9
9
|
hostUrl,
|
|
@@ -15,10 +15,16 @@ export const getAppManifest = async ({
|
|
|
15
15
|
headers
|
|
16
16
|
} = response;
|
|
17
17
|
if (headers['content-type'] && headers['content-type'].includes('application/json')) return response.data;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const unVersionedManifestPath = getUnVersionedManifestPath(manifestPath);
|
|
19
|
+
|
|
20
|
+
if (manifestPath !== unVersionedManifestPath) {
|
|
21
|
+
return getAppManifest({
|
|
22
|
+
hostUrl,
|
|
23
|
+
manifestPath: getUnVersionedManifestPath(manifestPath)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
throw new Error('manifest.json is not available for the application');
|
|
22
28
|
};
|
|
23
29
|
export const getFullFileNameofAssetsFromManifest = (manifest, assetNames = []) => assetNames.reduce((assets, assetName) => {
|
|
24
30
|
const fullFileName = manifest[assetName];
|
|
@@ -19,11 +19,12 @@ export const useAppWillRender = ({
|
|
|
19
19
|
const getConfig = useCallback(() => getMicroFrontEndAppConfig({
|
|
20
20
|
id
|
|
21
21
|
}), [id]);
|
|
22
|
-
const unload = useCallback(async appConfig => {
|
|
22
|
+
const unload = useCallback(async (appConfig, loadFailed = false) => {
|
|
23
23
|
await unmountApp(appConfig);
|
|
24
24
|
unloadApp(appConfig);
|
|
25
|
-
if (onUnloadComplete) onUnloadComplete();
|
|
26
|
-
},
|
|
25
|
+
if (!loadFailed && onUnloadComplete) onUnloadComplete();
|
|
26
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
+
[]);
|
|
27
28
|
const load = useCallback(async appConfig => {
|
|
28
29
|
if (dispatch) dispatch(waitMessage.open());
|
|
29
30
|
|
|
@@ -36,7 +37,7 @@ export const useAppWillRender = ({
|
|
|
36
37
|
getLogger().error({ ...logRecords.APP_CONFIG_LOAD_FAILED,
|
|
37
38
|
exception: ex
|
|
38
39
|
});
|
|
39
|
-
await unload(appConfig);
|
|
40
|
+
await unload(appConfig, true);
|
|
40
41
|
throw ex;
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface AppDynamicsUserData {
|
|
2
|
+
subAppId: string;
|
|
3
|
+
instanceId?: string;
|
|
4
|
+
userId?: string;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export declare const getAppDynamicsUserData: () => AppDynamicsUserData;
|
|
8
|
+
export declare const setAppDynamicsUserData: <T extends Record<string, any>>(params: T) => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface BAEventParameters {
|
|
2
|
+
instanceId?: string;
|
|
3
|
+
userId?: string;
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export declare const getBAEventParameters: () => BAEventParameters;
|
|
7
|
+
export declare const updateBAEventParameters: <T extends Record<string, any>>(params: T) => void;
|
|
8
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -67,8 +67,9 @@ export { MicroIFrameApp } from './view/micro-iframe-app';
|
|
|
67
67
|
export { getNavigationLinks } from './view/micro-app/utils';
|
|
68
68
|
export { getStore } from './data/store';
|
|
69
69
|
export { RegisterService } from './utils/guest-with-service';
|
|
70
|
+
export { setAppDynamicsUserData } from './analytics/appdynamics';
|
|
70
71
|
export { sendBAEvent } from './analytics';
|
|
71
|
-
export { updateBAEventParameters } from './analytics/
|
|
72
|
+
export { updateBAEventParameters } from './analytics/web-analytics';
|
|
72
73
|
export { redactPii } from './utils/redact-pii';
|
|
73
74
|
export type { EMUI } from './utils/window';
|
|
74
75
|
export type { Await } from './utils/await';
|
|
@@ -36,6 +36,7 @@ export declare class CMicroAppGuest implements IMicroAppGuest {
|
|
|
36
36
|
getHost(): IMicroAppHost;
|
|
37
37
|
getLogger(): MicroFrontEndLogger;
|
|
38
38
|
getProps(): GuestProps;
|
|
39
|
+
private getSessionStorageItem;
|
|
39
40
|
private getSSFHost;
|
|
40
41
|
init(this: CMicroAppGuest, options: InitOptions): Promise<void>;
|
|
41
42
|
mount(this: CMicroAppGuest, options?: MountOptions): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface BAEventParameters {
|
|
2
|
-
instanceId: string;
|
|
3
|
-
userId: string;
|
|
4
|
-
[key: string]: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const getBAEventParameters: () => BAEventParameters;
|
|
7
|
-
export declare const updateBAEventParameters: (params: BAEventParameters) => void;
|
|
8
|
-
export {};
|