@adobe/helix-rum-enhancer 2.8.0 → 2.10.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 +2 -2
- package/src/index.js +15 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [2.10.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.9.0...v2.10.0) (2024-05-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **index:** add new feature flag system ([7ef9f20](https://github.com/adobe/helix-rum-enhancer/commit/7ef9f20cd9e3ec07ac06c3924fb4ca33f68a49e1))
|
|
7
|
+
|
|
8
|
+
# [2.9.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.8.0...v2.9.0) (2024-05-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **missingresource:** remove feature flag (2.x) ([0905922](https://github.com/adobe/helix-rum-enhancer/commit/090592240fe2e6b05afc5044a20d11113b8d5f21))
|
|
14
|
+
|
|
1
15
|
# [2.8.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.7.6...v2.8.0) (2024-05-24)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-rum-enhancer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Helix RUM Enhancer",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"husky": "9.0.11",
|
|
42
42
|
"jsdoc-to-markdown": "8.0.1",
|
|
43
43
|
"junit-report-builder": "3.2.1",
|
|
44
|
-
"lint-staged": "15.2.
|
|
44
|
+
"lint-staged": "15.2.5",
|
|
45
45
|
"mocha": "10.4.0",
|
|
46
46
|
"mocha-multi-reporters": "1.5.1",
|
|
47
47
|
"semantic-release": "23.1.1"
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,15 @@ const KNOWN_PROPERTIES = ['weight', 'id', 'referer', 'checkpoint', 't', 'source'
|
|
|
14
14
|
const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource', 'utm'];
|
|
15
15
|
const { sampleRUM, queue, isSelected } = (window.hlx && window.hlx.rum) ? window.hlx.rum : {};
|
|
16
16
|
|
|
17
|
+
const fflags = {
|
|
18
|
+
has: (flag) => this[flag].indexOf(Array.from(window.origin)
|
|
19
|
+
.map((a) => a.charCodeAt(0))
|
|
20
|
+
.reduce((a, b) => a + b, 1) % 1371) !== -1,
|
|
21
|
+
enabled: (flag, callback) => this.has(flag) && callback(),
|
|
22
|
+
disabled: (flag, callback) => !this.has(flag) && callback(),
|
|
23
|
+
onetrust: [543, 770, 1136],
|
|
24
|
+
};
|
|
25
|
+
|
|
17
26
|
const urlSanitizers = {
|
|
18
27
|
full: () => window.location.href,
|
|
19
28
|
origin: () => window.location.origin,
|
|
@@ -87,9 +96,7 @@ function optedIn(checkpoint, data) {
|
|
|
87
96
|
// Gets configured collection from the config service for the current domain
|
|
88
97
|
function getCollectionConfig() {
|
|
89
98
|
// eslint-disable-next-line max-len
|
|
90
|
-
|
|
91
|
-
return DEFAULT_TRACKING_EVENTS.concat('consent');
|
|
92
|
-
}
|
|
99
|
+
fflags.enabled('onetrust', () => DEFAULT_TRACKING_EVENTS.push('consent'));
|
|
93
100
|
return DEFAULT_TRACKING_EVENTS;
|
|
94
101
|
}
|
|
95
102
|
|
|
@@ -203,15 +210,11 @@ function addLoadResourceTracking() {
|
|
|
203
210
|
.forEach((entry) => {
|
|
204
211
|
sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
|
|
205
212
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
.forEach((entry) => {
|
|
212
|
-
sampleRUM('missingresource', { source: entry.name, target: entry.hostname });
|
|
213
|
-
});
|
|
214
|
-
}
|
|
213
|
+
list.getEntries()
|
|
214
|
+
.filter((entry) => entry.responseStatus === 404)
|
|
215
|
+
.forEach((entry) => {
|
|
216
|
+
sampleRUM('missingresource', { source: entry.name, target: entry.hostname });
|
|
217
|
+
});
|
|
215
218
|
} catch (error) {
|
|
216
219
|
// something went wrong
|
|
217
220
|
}
|