@adobe/helix-rum-enhancer 2.21.1 → 2.23.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 CHANGED
@@ -1,3 +1,22 @@
1
+ # [2.23.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.22.0...v2.23.0) (2024-09-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * **index:** support to attach custom URL parameters to collection URL ([02f4d0b](https://github.com/adobe/helix-rum-enhancer/commit/02f4d0b366505fc17bc251e29364efa2e497c299))
7
+
8
+ # [2.22.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.21.1...v2.22.0) (2024-09-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **consent:** spelling ([1279aca](https://github.com/adobe/helix-rum-enhancer/commit/1279aca5ab997b33428766a9c552cbde7007804a))
14
+
15
+
16
+ ### Features
17
+
18
+ * **onetrust:** detect supressed consent banner ([440473e](https://github.com/adobe/helix-rum-enhancer/commit/440473ea92fcd281eacad5a14478d3d4751a3c1a))
19
+
1
20
  ## [2.21.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.21.0...v2.21.1) (2024-09-18)
2
21
 
3
22
 
package/modules/index.js CHANGED
@@ -41,7 +41,8 @@ function trackCheckpoint(checkpoint, data, t) {
41
41
  const sendPing = (pdata = data) => {
42
42
  // eslint-disable-next-line object-curly-newline, max-len
43
43
  const body = JSON.stringify({ weight, id, referer: urlSanitizers[window.hlx.RUM_MASK_URL || 'path'](), checkpoint, t, ...data }, KNOWN_PROPERTIES);
44
- const { href: url, origin } = new URL(`.rum/${weight}`, sampleRUM.collectBaseURL || sampleRUM.baseURL);
44
+ const urlParams = window.RUM_PARAMS ? `?${new URLSearchParams(window.RUM_PARAMS).toString()}` : '';
45
+ const { href: url, origin } = new URL(`.rum/${weight}${urlParams}`, sampleRUM.collectBaseURL);
45
46
  if (window.location.origin === origin) {
46
47
  const headers = { type: 'application/json' };
47
48
  navigator.sendBeacon(url, new Blob([body], headers));
@@ -21,8 +21,13 @@ export function addCookieConsentTracking(sampleRUM) {
21
21
 
22
22
  let consentMutationObserver;
23
23
  const trackShowConsent = () => {
24
- if (document.querySelector('body > div#onetrust-consent-sdk')) {
25
- sampleRUM('consent', { source: 'onetrust', target: 'show' });
24
+ const otsdk = document.querySelector('body > div#onetrust-consent-sdk');
25
+ if (otsdk) {
26
+ if (otsdk.checkVisibility && !otsdk.checkVisibility()) {
27
+ sampleRUM('consent', { source: 'onetrust', target: 'suppressed' });
28
+ } else {
29
+ sampleRUM('consent', { source: 'onetrust', target: 'show' });
30
+ }
26
31
  if (consentMutationObserver) {
27
32
  consentMutationObserver.disconnect();
28
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.21.1",
3
+ "version": "2.23.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -34,31 +34,31 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@adobe/eslint-config-helix": "2.0.7",
37
- "@adobe/helix-rum-js": "2.5.3",
37
+ "@adobe/helix-rum-js": "2.6.0",
38
38
  "@esm-bundle/chai": "4.3.4-fix.0",
39
39
  "@semantic-release/changelog": "6.0.3",
40
40
  "@semantic-release/git": "10.0.1",
41
41
  "@semantic-release/npm": "12.0.1",
42
- "@web/test-runner": "0.18.3",
42
+ "@web/test-runner": "0.19.0",
43
43
  "@web/test-runner-commands": "0.9.0",
44
44
  "@web/test-runner-mocha": "0.9.0",
45
45
  "@web/test-runner-playwright": "0.11.0",
46
46
  "c8": "10.1.2",
47
47
  "codecov": "3.8.3",
48
- "eslint": "8.57.0",
48
+ "eslint": "8.57.1",
49
49
  "eslint-plugin-header": "3.1.1",
50
50
  "eslint-plugin-import": "2.30.0",
51
- "husky": "9.1.5",
52
- "jsdoc-to-markdown": "9.0.0",
51
+ "husky": "9.1.6",
52
+ "jsdoc-to-markdown": "9.0.1",
53
53
  "junit-report-builder": "5.0.0",
54
54
  "lint-staged": "15.2.10",
55
55
  "mocha": "10.7.3",
56
56
  "mocha-multi-reporters": "1.5.1",
57
- "rollup": "4.21.2",
57
+ "rollup": "4.21.3",
58
58
  "rollup-plugin-cleanup": "3.2.1",
59
59
  "rollup-plugin-checksum": "1.0.1",
60
60
  "rollup-plugin-eslint-bundle": "9.0.0",
61
- "semantic-release": "24.1.0",
61
+ "semantic-release": "24.1.1",
62
62
  "web-vitals": "4.2.3"
63
63
  },
64
64
  "lint-staged": {
package/src/index.js CHANGED
@@ -126,8 +126,13 @@
126
126
  }
127
127
  let consentMutationObserver;
128
128
  const trackShowConsent = () => {
129
- if (document.querySelector('body > div#onetrust-consent-sdk')) {
130
- sampleRUM('consent', { source: 'onetrust', target: 'show' });
129
+ const otsdk = document.querySelector('body > div#onetrust-consent-sdk');
130
+ if (otsdk) {
131
+ if (otsdk.checkVisibility && !otsdk.checkVisibility()) {
132
+ sampleRUM('consent', { source: 'onetrust', target: 'suppressed' });
133
+ } else {
134
+ sampleRUM('consent', { source: 'onetrust', target: 'show' });
135
+ }
131
136
  if (consentMutationObserver) {
132
137
  consentMutationObserver.disconnect();
133
138
  }
@@ -194,7 +199,8 @@
194
199
  if (isSelected) {
195
200
  const sendPing = (pdata = data) => {
196
201
  const body = JSON.stringify({ weight, id, referer: urlSanitizers[window.hlx.RUM_MASK_URL || 'path'](), checkpoint, t, ...data }, KNOWN_PROPERTIES);
197
- const { href: url, origin } = new URL(`.rum/${weight}`, sampleRUM.collectBaseURL || sampleRUM.baseURL);
202
+ const urlParams = window.RUM_PARAMS ? `?${new URLSearchParams(window.RUM_PARAMS).toString()}` : '';
203
+ const { href: url, origin } = new URL(`.rum/${weight}${urlParams}`, sampleRUM.collectBaseURL);
198
204
  if (window.location.origin === origin) {
199
205
  const headers = { type: 'application/json' };
200
206
  navigator.sendBeacon(url, new Blob([body], headers));
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- 3b6446cae48ed1682059c44081e58f83
1
+ 976e9a76103a41b4ee4ddcb398932250