@elliemae/pui-app-sdk 2.10.0 → 2.11.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/analytics/base-data.js +22 -0
- package/dist/cjs/analytics/index.js +37 -0
- package/dist/cjs/analytics/user-session.js +20 -12
- package/dist/cjs/analytics/user-wait.js +13 -5
- package/dist/cjs/index.js +10 -1
- package/dist/cjs/utils/auth/index.js +1 -6
- package/dist/cjs/utils/micro-frontend/host.js +10 -0
- package/dist/es/analytics/base-data.js +10 -0
- package/dist/es/analytics/index.js +28 -0
- package/dist/es/analytics/user-session.js +19 -12
- package/dist/es/analytics/user-wait.js +12 -5
- package/dist/es/index.js +3 -1
- package/dist/es/utils/auth/index.js +1 -6
- package/dist/es/utils/micro-frontend/host.js +9 -0
- package/dist/public/index.html +1 -1
- package/dist/public/js/{emuiAppSdk.57ed584b664455a8bbb9.js → emuiAppSdk.bdec42736fbd0fbcbe9a.js} +3 -3
- package/dist/public/js/{emuiAppSdk.57ed584b664455a8bbb9.js.LICENSE.txt → emuiAppSdk.bdec42736fbd0fbcbe9a.js.LICENSE.txt} +0 -0
- package/dist/public/js/emuiAppSdk.bdec42736fbd0fbcbe9a.js.gz +0 -0
- package/dist/public/js/emuiAppSdk.bdec42736fbd0fbcbe9a.js.map +1 -0
- package/dist/types/analytics/base-data.d.ts +8 -0
- package/dist/types/analytics/index.d.ts +5 -0
- package/dist/types/analytics/user-session.d.ts +1 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/micro-frontend/host.d.ts +2 -1
- package/dist/types/utils/window.d.ts +2 -3
- package/package.json +4 -4
- package/dist/cjs/analytics/utils.js +0 -13
- package/dist/cjs/data/tests/store.test.js +0 -32
- package/dist/es/analytics/utils.js +0 -4
- package/dist/es/data/tests/store.test.js +0 -32
- package/dist/public/js/emuiAppSdk.57ed584b664455a8bbb9.js.gz +0 -0
- package/dist/public/js/emuiAppSdk.57ed584b664455a8bbb9.js.map +0 -1
- package/dist/types/analytics/utils.d.ts +0 -4
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.updateBaseData = exports.getBaseData = void 0;
|
|
7
|
+
let baseData = {
|
|
8
|
+
instance_id: '',
|
|
9
|
+
user_id: ''
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const getBaseData = () => baseData;
|
|
13
|
+
|
|
14
|
+
exports.getBaseData = getBaseData;
|
|
15
|
+
|
|
16
|
+
const updateBaseData = data => {
|
|
17
|
+
baseData = { ...baseData,
|
|
18
|
+
...data
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.updateBaseData = updateBaseData;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sendBAEvent = void 0;
|
|
7
|
+
|
|
8
|
+
var _guest = require("../utils/micro-frontend/guest.js");
|
|
9
|
+
|
|
10
|
+
const sendBAEventToSelf = event => {
|
|
11
|
+
window.gtmDataLayer = window.gtmDataLayer || [];
|
|
12
|
+
window.gtmDataLayer.push(event);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const sendBAEvent = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
eventParams,
|
|
18
|
+
self = true
|
|
19
|
+
} = _ref;
|
|
20
|
+
|
|
21
|
+
if (!self) {
|
|
22
|
+
var _CMicroAppGuest$getIn, _CMicroAppGuest$getIn2;
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
25
|
+
const sendEvent = (_CMicroAppGuest$getIn = _guest.CMicroAppGuest.getInstance()) === null || _CMicroAppGuest$getIn === void 0 ? void 0 : (_CMicroAppGuest$getIn2 = _CMicroAppGuest$getIn.getHost()) === null || _CMicroAppGuest$getIn2 === void 0 ? void 0 : _CMicroAppGuest$getIn2.sendBAEvent;
|
|
26
|
+
|
|
27
|
+
if (sendEvent) {
|
|
28
|
+
sendEvent(eventParams);
|
|
29
|
+
} else {
|
|
30
|
+
sendBAEventToSelf(eventParams);
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
sendBAEventToSelf(eventParams);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.sendBAEvent = sendBAEvent;
|
|
@@ -5,31 +5,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.logoutEvent = exports.loginEvent = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _index = require("./index.js");
|
|
9
|
+
|
|
10
|
+
var _baseData = require("./base-data.js");
|
|
9
11
|
|
|
10
12
|
const loginEvent = _ref => {
|
|
11
13
|
let {
|
|
12
14
|
instanceId,
|
|
13
15
|
userId
|
|
14
16
|
} = _ref;
|
|
15
|
-
|
|
16
|
-
event: 'user_login',
|
|
17
|
+
(0, _baseData.updateBaseData)({
|
|
17
18
|
instance_id: instanceId,
|
|
18
19
|
user_id: userId
|
|
19
20
|
});
|
|
21
|
+
(0, _index.sendBAEvent)({
|
|
22
|
+
eventParams: {
|
|
23
|
+
event: 'user_login',
|
|
24
|
+
...(0, _baseData.getBaseData)()
|
|
25
|
+
}
|
|
26
|
+
});
|
|
20
27
|
};
|
|
21
28
|
|
|
22
29
|
exports.loginEvent = loginEvent;
|
|
23
30
|
|
|
24
|
-
const logoutEvent =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const logoutEvent = () => {
|
|
32
|
+
(0, _index.sendBAEvent)({
|
|
33
|
+
eventParams: {
|
|
34
|
+
event: 'user_logout',
|
|
35
|
+
...(0, _baseData.getBaseData)()
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
(0, _baseData.updateBaseData)({
|
|
39
|
+
instance_id: '',
|
|
40
|
+
user_id: ''
|
|
33
41
|
});
|
|
34
42
|
};
|
|
35
43
|
|
|
@@ -5,16 +5,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.waitStartEvent = exports.waitEndEvent = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _index = require("./index.js");
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
var _baseData = require("./base-data.js");
|
|
11
|
+
|
|
12
|
+
const waitStartEvent = () => (0, _index.sendBAEvent)({
|
|
13
|
+
eventParams: {
|
|
14
|
+
event: 'page_interaction_enabled',
|
|
15
|
+
...(0, _baseData.getBaseData)()
|
|
16
|
+
}
|
|
12
17
|
});
|
|
13
18
|
|
|
14
19
|
exports.waitStartEvent = waitStartEvent;
|
|
15
20
|
|
|
16
|
-
const waitEndEvent = () => (0,
|
|
17
|
-
|
|
21
|
+
const waitEndEvent = () => (0, _index.sendBAEvent)({
|
|
22
|
+
eventParams: {
|
|
23
|
+
event: 'page_interaction_disabled',
|
|
24
|
+
...(0, _baseData.getBaseData)()
|
|
25
|
+
}
|
|
18
26
|
});
|
|
19
27
|
|
|
20
28
|
exports.waitEndEvent = waitEndEvent;
|
package/dist/cjs/index.js
CHANGED
|
@@ -103,7 +103,8 @@ var _exportNames = {
|
|
|
103
103
|
MicroApp: true,
|
|
104
104
|
MicroIFrameApp: true,
|
|
105
105
|
getNavigationLinks: true,
|
|
106
|
-
RegisterService: true
|
|
106
|
+
RegisterService: true,
|
|
107
|
+
sendBAEvent: true
|
|
107
108
|
};
|
|
108
109
|
Object.defineProperty(exports, "AppRoot", {
|
|
109
110
|
enumerable: true,
|
|
@@ -543,6 +544,12 @@ Object.defineProperty(exports, "resetUserIdleTime", {
|
|
|
543
544
|
return _session.resetUserIdleTime;
|
|
544
545
|
}
|
|
545
546
|
});
|
|
547
|
+
Object.defineProperty(exports, "sendBAEvent", {
|
|
548
|
+
enumerable: true,
|
|
549
|
+
get: function () {
|
|
550
|
+
return _index39.sendBAEvent;
|
|
551
|
+
}
|
|
552
|
+
});
|
|
546
553
|
Object.defineProperty(exports, "sendMessageToHost", {
|
|
547
554
|
enumerable: true,
|
|
548
555
|
get: function () {
|
|
@@ -782,6 +789,8 @@ var _utils = require("./view/micro-app/utils.js");
|
|
|
782
789
|
|
|
783
790
|
var _guestWithService = require("./utils/guest-with-service.js");
|
|
784
791
|
|
|
792
|
+
var _index39 = require("./analytics/index.js");
|
|
793
|
+
|
|
785
794
|
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); }
|
|
786
795
|
|
|
787
796
|
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; }
|
|
@@ -87,18 +87,13 @@ const endSession = async _ref2 => {
|
|
|
87
87
|
|
|
88
88
|
try {
|
|
89
89
|
const authorization = (0, _helper.getAuthorizationHeader)();
|
|
90
|
-
const userId = sessionStorage.getItem('userId') || '';
|
|
91
|
-
const instanceId = sessionStorage.getItem('instanceId') || '';
|
|
92
90
|
sessionStorage.clear();
|
|
93
91
|
const token = authorization ? authorization.split(' ')[1] : '';
|
|
94
92
|
await (0, _index.revokeToken)({
|
|
95
93
|
clientId,
|
|
96
94
|
token
|
|
97
95
|
});
|
|
98
|
-
(0, _userSession.logoutEvent)(
|
|
99
|
-
userId,
|
|
100
|
-
instanceId
|
|
101
|
-
}); // redirect
|
|
96
|
+
(0, _userSession.logoutEvent)(); // redirect
|
|
102
97
|
|
|
103
98
|
const idpHost = (0, _config.getAppConfigValue)(IDP_ENDPOINT_CONFIG_KEY, '');
|
|
104
99
|
const logoutUrl = new URL('/authorize', idpHost);
|
|
@@ -37,6 +37,8 @@ var _constants = require("../constants.js");
|
|
|
37
37
|
|
|
38
38
|
var _window = require("../window.js");
|
|
39
39
|
|
|
40
|
+
var _index3 = require("../../analytics/index.js");
|
|
41
|
+
|
|
40
42
|
class CMicroAppHost {
|
|
41
43
|
constructor(params) {
|
|
42
44
|
(0, _defineProperty2.default)(this, "logger", void 0);
|
|
@@ -181,6 +183,14 @@ class CMicroAppHost {
|
|
|
181
183
|
this.props.systemVersion = version;
|
|
182
184
|
}
|
|
183
185
|
|
|
186
|
+
sendBAEvent(event) {
|
|
187
|
+
// eslint-disable-next-line max-lines
|
|
188
|
+
(0, _index3.sendBAEvent)({
|
|
189
|
+
eventParams: event,
|
|
190
|
+
self: true
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
184
194
|
}
|
|
185
195
|
|
|
186
196
|
exports.CMicroAppHost = CMicroAppHost;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CMicroAppGuest } from "../utils/micro-frontend/guest.js";
|
|
2
|
+
|
|
3
|
+
const sendBAEventToSelf = event => {
|
|
4
|
+
window.gtmDataLayer = window.gtmDataLayer || [];
|
|
5
|
+
window.gtmDataLayer.push(event);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const sendBAEvent = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
eventParams,
|
|
11
|
+
self = true
|
|
12
|
+
} = _ref;
|
|
13
|
+
|
|
14
|
+
if (!self) {
|
|
15
|
+
var _CMicroAppGuest$getIn, _CMicroAppGuest$getIn2;
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
18
|
+
const sendEvent = (_CMicroAppGuest$getIn = CMicroAppGuest.getInstance()) === null || _CMicroAppGuest$getIn === void 0 ? void 0 : (_CMicroAppGuest$getIn2 = _CMicroAppGuest$getIn.getHost()) === null || _CMicroAppGuest$getIn2 === void 0 ? void 0 : _CMicroAppGuest$getIn2.sendBAEvent;
|
|
19
|
+
|
|
20
|
+
if (sendEvent) {
|
|
21
|
+
sendEvent(eventParams);
|
|
22
|
+
} else {
|
|
23
|
+
sendBAEventToSelf(eventParams);
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
sendBAEventToSelf(eventParams);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sendBAEvent } from "./index.js";
|
|
2
|
+
import { updateBaseData, getBaseData } from "./base-data.js";
|
|
2
3
|
export const loginEvent = _ref => {
|
|
3
4
|
let {
|
|
4
5
|
instanceId,
|
|
5
6
|
userId
|
|
6
7
|
} = _ref;
|
|
7
|
-
|
|
8
|
-
event: 'user_login',
|
|
8
|
+
updateBaseData({
|
|
9
9
|
instance_id: instanceId,
|
|
10
10
|
user_id: userId
|
|
11
11
|
});
|
|
12
|
+
sendBAEvent({
|
|
13
|
+
eventParams: {
|
|
14
|
+
event: 'user_login',
|
|
15
|
+
...getBaseData()
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
};
|
|
13
|
-
export const logoutEvent =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export const logoutEvent = () => {
|
|
20
|
+
sendBAEvent({
|
|
21
|
+
eventParams: {
|
|
22
|
+
event: 'user_logout',
|
|
23
|
+
...getBaseData()
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
updateBaseData({
|
|
27
|
+
instance_id: '',
|
|
28
|
+
user_id: ''
|
|
22
29
|
});
|
|
23
30
|
};
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { sendBAEvent } from "./index.js";
|
|
2
|
+
import { getBaseData } from "./base-data.js";
|
|
3
|
+
export const waitStartEvent = () => sendBAEvent({
|
|
4
|
+
eventParams: {
|
|
5
|
+
event: 'page_interaction_enabled',
|
|
6
|
+
...getBaseData()
|
|
7
|
+
}
|
|
4
8
|
});
|
|
5
|
-
export const waitEndEvent = () =>
|
|
6
|
-
|
|
9
|
+
export const waitEndEvent = () => sendBAEvent({
|
|
10
|
+
eventParams: {
|
|
11
|
+
event: 'page_interaction_disabled',
|
|
12
|
+
...getBaseData()
|
|
13
|
+
}
|
|
7
14
|
});
|
package/dist/es/index.js
CHANGED
|
@@ -75,4 +75,6 @@ export { MicroIFrameApp } from "./view/micro-iframe-app/index.js";
|
|
|
75
75
|
export { getNavigationLinks } from "./view/micro-app/utils.js"; // app host
|
|
76
76
|
|
|
77
77
|
export { getStore } from "./data/store.js";
|
|
78
|
-
export { RegisterService } from "./utils/guest-with-service.js"; //
|
|
78
|
+
export { RegisterService } from "./utils/guest-with-service.js"; // analytics
|
|
79
|
+
|
|
80
|
+
export { sendBAEvent } from "./analytics/index.js"; // Type utils
|
|
@@ -59,18 +59,13 @@ export const endSession = async _ref2 => {
|
|
|
59
59
|
|
|
60
60
|
try {
|
|
61
61
|
const authorization = getAuthorizationHeader();
|
|
62
|
-
const userId = sessionStorage.getItem('userId') || '';
|
|
63
|
-
const instanceId = sessionStorage.getItem('instanceId') || '';
|
|
64
62
|
sessionStorage.clear();
|
|
65
63
|
const token = authorization ? authorization.split(' ')[1] : '';
|
|
66
64
|
await revokeToken({
|
|
67
65
|
clientId,
|
|
68
66
|
token
|
|
69
67
|
});
|
|
70
|
-
logoutEvent(
|
|
71
|
-
userId,
|
|
72
|
-
instanceId
|
|
73
|
-
}); // redirect
|
|
68
|
+
logoutEvent(); // redirect
|
|
74
69
|
|
|
75
70
|
const idpHost = getAppConfigValue(IDP_ENDPOINT_CONFIG_KEY, '');
|
|
76
71
|
const logoutUrl = new URL('/authorize', idpHost);
|
|
@@ -13,6 +13,7 @@ import { browserHistory } from "../history.js";
|
|
|
13
13
|
import { logger } from "./console-logger.js";
|
|
14
14
|
import { HOST_WINDOW_RESIZED, HOST_WINDOW_BREAKPOINT_CHANGED } from "../constants.js";
|
|
15
15
|
import { getCurrentBreakpoint, getViewportSize as getWindowViewportSize } from "../window.js";
|
|
16
|
+
import { sendBAEvent } from "../../analytics/index.js";
|
|
16
17
|
export class CMicroAppHost {
|
|
17
18
|
constructor(params) {
|
|
18
19
|
_defineProperty(this, "logger", void 0);
|
|
@@ -163,6 +164,14 @@ export class CMicroAppHost {
|
|
|
163
164
|
this.props.systemVersion = version;
|
|
164
165
|
}
|
|
165
166
|
|
|
167
|
+
sendBAEvent(event) {
|
|
168
|
+
// eslint-disable-next-line max-lines
|
|
169
|
+
sendBAEvent({
|
|
170
|
+
eventParams: event,
|
|
171
|
+
self: true
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
166
175
|
}
|
|
167
176
|
|
|
168
177
|
_defineProperty(CMicroAppHost, "instance", void 0);
|
package/dist/public/index.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!doctype html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>emuiAppSdk</title><script defer="defer" src="/js/emuiAppSdk.
|
|
1
|
+
<!doctype html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>emuiAppSdk</title><script defer="defer" src="/js/emuiAppSdk.bdec42736fbd0fbcbe9a.js"></script></head><p>This library emuiAppSdk exposes the following properties</p><ul id="libraryAttributes"></ul><script lang="javascript">window.onload = () => {
|
|
2
2
|
const attribNode = document.getElementById('libraryAttributes');
|
|
3
3
|
if (attribNode) {
|
|
4
4
|
attribNode.innerHTML = Object.keys(window['emuiAppSdk'] || {}).reduce((value, attribute) => value += `<li>${attribute}</li>`, '');
|