@adobe/helix-rum-enhancer 2.11.0 → 2.11.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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/index.js +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.11.2](https://github.com/adobe/helix-rum-enhancer/compare/v2.11.1...v2.11.2) (2024-06-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* avoid CORS ([#183](https://github.com/adobe/helix-rum-enhancer/issues/183)) ([4daf390](https://github.com/adobe/helix-rum-enhancer/commit/4daf3903247b0834b6e4fd15a3ad3738ad6917b5))
|
|
7
|
+
|
|
8
|
+
## [2.11.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.11.0...v2.11.1) (2024-06-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* no this in arrow functions ([#182](https://github.com/adobe/helix-rum-enhancer/issues/182)) ([218e608](https://github.com/adobe/helix-rum-enhancer/commit/218e60890c5e1328de27d03916a680c6019f92af))
|
|
14
|
+
|
|
1
15
|
# [2.11.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.10.0...v2.11.0) (2024-05-31)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -15,11 +15,11 @@ const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewbloc
|
|
|
15
15
|
const { sampleRUM, queue, isSelected } = (window.hlx && window.hlx.rum) ? window.hlx.rum : {};
|
|
16
16
|
|
|
17
17
|
const fflags = {
|
|
18
|
-
has: (flag) =>
|
|
18
|
+
has: (flag) => fflags[flag].indexOf(Array.from(window.origin)
|
|
19
19
|
.map((a) => a.charCodeAt(0))
|
|
20
20
|
.reduce((a, b) => a + b, 1) % 1371) !== -1,
|
|
21
|
-
enabled: (flag, callback) =>
|
|
22
|
-
disabled: (flag, callback) => !
|
|
21
|
+
enabled: (flag, callback) => fflags.has(flag) && callback(),
|
|
22
|
+
disabled: (flag, callback) => !fflags.has(flag) && callback(),
|
|
23
23
|
onetrust: [543, 770, 1136],
|
|
24
24
|
ads: [1339],
|
|
25
25
|
email: [1339],
|
|
@@ -110,9 +110,13 @@ function trackCheckpoint(checkpoint, data, t) {
|
|
|
110
110
|
const sendPing = (pdata = data) => {
|
|
111
111
|
// eslint-disable-next-line object-curly-newline, max-len
|
|
112
112
|
const body = JSON.stringify({ weight, id, sanitizeURL: urlSanitizers[window.hlx.RUM_MASK_URL || 'path'], checkpoint, t, ...data }, KNOWN_PROPERTIES);
|
|
113
|
-
const url = new URL(`.rum/${weight}`, sampleRUM.collectBaseURL || sampleRUM.baseURL)
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
const { href: url, origin} = new URL(`.rum/${weight}`, sampleRUM.collectBaseURL || sampleRUM.baseURL);
|
|
114
|
+
if (window.location.origin === origin) {
|
|
115
|
+
const headers = { type: 'application/json' };
|
|
116
|
+
navigator.sendBeacon(url, new Blob([body], headers));
|
|
117
|
+
} else {
|
|
118
|
+
navigator.sendBeacon(url, body);
|
|
119
|
+
}
|
|
116
120
|
// eslint-disable-next-line no-console
|
|
117
121
|
console.debug(`ping:${checkpoint}`, pdata);
|
|
118
122
|
};
|