@adobe/helix-rum-enhancer 1.17.0 → 1.18.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/CHANGELOG.md +14 -0
- package/package.json +3 -3
- package/src/index.js +36 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.18.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.17.1...v1.18.0) (2024-05-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **checkpoint:** add consent checkpoint to 1.x ([cf72b07](https://github.com/adobe/helix-rum-enhancer/commit/cf72b0762aa9b3d1949fc3c9b9a46879fc394b63))
|
|
7
|
+
|
|
8
|
+
## [1.17.1](https://github.com/adobe/helix-rum-enhancer/compare/v1.17.0...v1.17.1) (2024-05-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* no type leads to empty checkpoint (1x) ([#168](https://github.com/adobe/helix-rum-enhancer/issues/168)) ([422fd8e](https://github.com/adobe/helix-rum-enhancer/commit/422fd8ed43d0cf842777ffbfae8c64242adbf39e))
|
|
14
|
+
|
|
1
15
|
# [1.17.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.16.0...v1.17.0) (2024-05-07)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-rum-enhancer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Helix RUM Enhancer",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@adobe/eslint-config-helix": "2.0.6",
|
|
33
33
|
"@semantic-release/changelog": "6.0.3",
|
|
34
34
|
"@semantic-release/git": "10.0.1",
|
|
35
|
-
"@semantic-release/npm": "12.0.
|
|
35
|
+
"@semantic-release/npm": "12.0.1",
|
|
36
36
|
"c8": "9.1.0",
|
|
37
37
|
"codecov": "3.8.3",
|
|
38
38
|
"eslint": "8.57.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"lint-staged": "15.2.2",
|
|
45
45
|
"mocha": "10.4.0",
|
|
46
46
|
"mocha-multi-reporters": "1.5.1",
|
|
47
|
-
"semantic-release": "23.
|
|
47
|
+
"semantic-release": "23.1.1"
|
|
48
48
|
},
|
|
49
49
|
"lint-staged": {
|
|
50
50
|
"*.js": "eslint",
|
package/src/index.js
CHANGED
|
@@ -53,7 +53,7 @@ const navigate = (source, type) => {
|
|
|
53
53
|
// reload: same page, navigate: same origin, enter: everything else
|
|
54
54
|
if (type === 'reload' || source === window.location.href) {
|
|
55
55
|
sampleRUM('reload', payload);
|
|
56
|
-
} else if (type !== 'navigate') {
|
|
56
|
+
} else if (type && type !== 'navigate') {
|
|
57
57
|
sampleRUM(type, payload); // back, forward, prerender, etc.
|
|
58
58
|
} else if (source && window.location.origin === new URL(source).origin) {
|
|
59
59
|
sampleRUM('navigate', payload); // internal navigation
|
|
@@ -195,3 +195,38 @@ new PerformanceObserver((list) => {
|
|
|
195
195
|
.forEach(([key, value]) => {
|
|
196
196
|
sampleRUM('utm', { source: key, target: value });
|
|
197
197
|
});
|
|
198
|
+
|
|
199
|
+
// eslint-disable-next-line max-len
|
|
200
|
+
if ([770, 1136].includes(Array.from(window.origin).map((a) => a.charCodeAt(0)).reduce((a, b) => a + b, 1) % 1371)) {
|
|
201
|
+
const cmpCookie = document.cookie.split(';')
|
|
202
|
+
.map((c) => c.trim())
|
|
203
|
+
.find((cookie) => cookie.startsWith('OptanonAlertBoxClosed='));
|
|
204
|
+
|
|
205
|
+
if (cmpCookie) {
|
|
206
|
+
sampleRUM('consent', { source: 'onetrust', target: 'hidden' });
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
let consentMutationObserver;
|
|
210
|
+
const trackShowConsent = () => {
|
|
211
|
+
if (document.querySelector('body > div#onetrust-consent-sdk')) {
|
|
212
|
+
sampleRUM('consent', { source: 'onetrust', target: 'show' });
|
|
213
|
+
if (consentMutationObserver) {
|
|
214
|
+
consentMutationObserver.disconnect();
|
|
215
|
+
}
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
if (!trackShowConsent()) {
|
|
222
|
+
// eslint-disable-next-line max-len
|
|
223
|
+
consentMutationObserver = window.MutationObserver ? new MutationObserver(trackShowConsent) : null;
|
|
224
|
+
if (consentMutationObserver) {
|
|
225
|
+
consentMutationObserver.observe(
|
|
226
|
+
document.body,
|
|
227
|
+
// eslint-disable-next-line object-curly-newline
|
|
228
|
+
{ attributes: false, childList: true, subtree: false },
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|