@adobe/helix-rum-enhancer 2.26.0 → 2.26.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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.26.2](https://github.com/adobe/helix-rum-enhancer/compare/v2.26.1...v2.26.2) (2024-12-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * do not process duplicate navigation checkpoints ([#331](https://github.com/adobe/helix-rum-enhancer/issues/331)) ([4b6843f](https://github.com/adobe/helix-rum-enhancer/commit/4b6843f4cbe7b685ffc0c017a46274e505b26b56))
7
+
8
+ ## [2.26.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.26.0...v2.26.1) (2024-12-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **redirects:** use underscore in param ([bada92e](https://github.com/adobe/helix-rum-enhancer/commit/bada92e69aaa8f560d61d6264f578eb2958934ec))
14
+
1
15
  # [2.26.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.25.0...v2.26.0) (2024-10-16)
2
16
 
3
17
 
package/modules/dom.js CHANGED
@@ -60,8 +60,9 @@ function isButton(el) {
60
60
  }
61
61
 
62
62
  function getSourceContext(el) {
63
- if (el.closest('form')) {
64
- return `form${el.id ? `#${el.id}` : ''}`;
63
+ const formEl = el.closest('form');
64
+ if (formEl) {
65
+ return `form${formEl.id ? `#${formEl.id}` : ''}`;
65
66
  }
66
67
  const block = el.closest('.block[data-block-name]');
67
68
  if (block) return `.${block.getAttribute('data-block-name')}`;
package/modules/index.js CHANGED
@@ -138,20 +138,23 @@ function addNavigationTracking() {
138
138
  sampleRUM('enter', payload); // enter site
139
139
  }
140
140
  fflags.enabled('redirect', () => {
141
- const from = new URLSearchParams(window.location.search).get('redirect-from');
141
+ const from = new URLSearchParams(window.location.search).get('redirect_from');
142
142
  if (redirectCount || from) {
143
143
  sampleRUM('redirect', { source: from, target: redirectCount || 1 });
144
144
  }
145
145
  });
146
146
  };
147
147
 
148
+ const processed = new Set(); // avoid processing duplicate types
148
149
  new PerformanceObserver((list) => list
149
- .getEntries().map((e) => navigate(
150
+ .getEntries()
151
+ .filter(({ type }) => !processed.has(type))
152
+ .map((e) => [e, processed.add(e.type)])
153
+ .map(([e]) => navigate(
150
154
  window.hlx.referrer || document.referrer,
151
155
  e.type,
152
156
  e.redirectCount,
153
- )))
154
- .observe({ type: 'navigation', buffered: true });
157
+ ))).observe({ type: 'navigation', buffered: true });
155
158
  }
156
159
 
157
160
  function addLoadResourceTracking() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.26.0",
3
+ "version": "2.26.2",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@adobe/eslint-config-helix": "2.0.8",
37
- "@adobe/helix-rum-js": "2.6.0",
37
+ "@adobe/helix-rum-js": "2.10.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",
@@ -48,19 +48,19 @@
48
48
  "eslint": "8.57.1",
49
49
  "eslint-plugin-header": "3.1.1",
50
50
  "eslint-plugin-import": "2.31.0",
51
- "husky": "9.1.6",
52
- "jsdoc-to-markdown": "9.0.2",
51
+ "husky": "9.1.7",
52
+ "jsdoc-to-markdown": "9.1.1",
53
53
  "junit-report-builder": "5.1.1",
54
54
  "lint-staged": "15.2.10",
55
- "mocha": "10.7.3",
55
+ "mocha": "11.0.1",
56
56
  "mocha-multi-reporters": "1.5.1",
57
- "rollup": "4.24.0",
57
+ "rollup": "4.28.1",
58
58
  "rollup-plugin-checksum": "1.0.1",
59
59
  "rollup-plugin-cleanup": "3.2.1",
60
60
  "rollup-plugin-eslint-bundle": "9.0.0",
61
- "semantic-release": "24.1.2",
61
+ "semantic-release": "24.2.0",
62
62
  "semantic-release-slack-bot": "^4.0.2",
63
- "web-vitals": "4.2.3"
63
+ "web-vitals": "4.2.4"
64
64
  },
65
65
  "lint-staged": {
66
66
  "*.js": "eslint",
package/src/index.js CHANGED
@@ -80,8 +80,9 @@
80
80
  return el.getAttribute('role') === 'button';
81
81
  }
82
82
  function getSourceContext(el) {
83
- if (el.closest('form')) {
84
- return `form${el.id ? `#${el.id}` : ''}`;
83
+ const formEl = el.closest('form');
84
+ if (formEl) {
85
+ return `form${formEl.id ? `#${formEl.id}` : ''}`;
85
86
  }
86
87
  const block = el.closest('.block[data-block-name]');
87
88
  if (block) return `.${block.getAttribute('data-block-name')}`;
@@ -286,19 +287,22 @@
286
287
  sampleRUM('enter', payload);
287
288
  }
288
289
  fflags.enabled('redirect', () => {
289
- const from = new URLSearchParams(window.location.search).get('redirect-from');
290
+ const from = new URLSearchParams(window.location.search).get('redirect_from');
290
291
  if (redirectCount || from) {
291
292
  sampleRUM('redirect', { source: from, target: redirectCount || 1 });
292
293
  }
293
294
  });
294
295
  };
296
+ const processed = new Set();
295
297
  new PerformanceObserver((list) => list
296
- .getEntries().map((e) => navigate(
298
+ .getEntries()
299
+ .filter(({ type }) => !processed.has(type))
300
+ .map((e) => [e, processed.add(e.type)])
301
+ .map(([e]) => navigate(
297
302
  window.hlx.referrer || document.referrer,
298
303
  e.type,
299
304
  e.redirectCount,
300
- )))
301
- .observe({ type: 'navigation', buffered: true });
305
+ ))).observe({ type: 'navigation', buffered: true });
302
306
  }
303
307
  function addLoadResourceTracking() {
304
308
  const observer = new PerformanceObserver((list) => {
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- 8094422990fd7a9219bffb7309cb92a2
1
+ b33e2bbaa1ad5542ff6a6343af9750b6
@@ -23,6 +23,7 @@ export default {
23
23
  'test/fixtures/**',
24
24
  'node_modules/**',
25
25
  '.rum/**',
26
+ 'src/**',
26
27
  ],
27
28
  },
28
29
  files: [
@@ -43,9 +44,10 @@ export default {
43
44
  context.url = '/node_modules/@adobe/helix-rum-js/dist/rum-standalone.js';
44
45
  await next();
45
46
  context.body = context.body
46
- .replace(/const weight.*/, 'const weight = 1')
47
+ .replace(/const weight =/, 'const weight = 1 ||')
47
48
  .replace(/navigator\.sendBeacon/g, 'fakeSendBeacon')
48
- .replace('.rum/@adobe/helix-rum-enhancer@^2/src/index.js', 'src/index.map.js');
49
+ // eslint-disable-next-line no-template-curly-in-string
50
+ .replace('.rum/@adobe/helix-rum-enhancer@${enhancerVersion || \'^2\'}/src/index.js', 'src/index.map.js');
49
51
  return true;
50
52
  } else if (context.url.startsWith('/.rum/web-vitals')) {
51
53
  context.url = '/node_modules/web-vitals/dist/web-vitals.iife.js';