@adobe/helix-rum-enhancer 1.13.1 → 1.14.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
+ # [1.14.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.13.2...v1.14.0) (2024-04-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * pr reviews ([8c1a9ae](https://github.com/adobe/helix-rum-enhancer/commit/8c1a9ae8af07baf9d230a428d612f6e9693ca692))
7
+
8
+
9
+ ### Features
10
+
11
+ * report source and target along with lcp event ([5846b71](https://github.com/adobe/helix-rum-enhancer/commit/5846b7110d0acda3789274ddf6b5d3ac43d196eb))
12
+
13
+ ## [1.13.2](https://github.com/adobe/helix-rum-enhancer/compare/v1.13.1...v1.13.2) (2024-03-27)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * remove conflicting variables ([3f871d2](https://github.com/adobe/helix-rum-enhancer/commit/3f871d2e1396ddf0f579056db9bfdb8e72c1b6de))
19
+
1
20
  ## [1.13.1](https://github.com/adobe/helix-rum-enhancer/compare/v1.13.0...v1.13.1) (2024-03-27)
2
21
 
3
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "1.13.1",
3
+ "version": "1.14.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "jsdoc-to-markdown": "8.0.1",
43
43
  "junit-report-builder": "3.2.1",
44
44
  "lint-staged": "15.2.2",
45
- "mocha": "10.3.0",
45
+ "mocha": "10.4.0",
46
46
  "mocha-multi-reporters": "1.5.1",
47
47
  "semantic-release": "22.0.12"
48
48
  },
package/src/index.js CHANGED
@@ -89,6 +89,13 @@ sampleRUM.drain('cwv', (() => {
89
89
  const storeCWV = (measurement) => {
90
90
  const data = { cwv: {} };
91
91
  data.cwv[measurement.name] = measurement.value;
92
+
93
+ if (measurement.name === 'LCP' && measurement.entries.length > 0) {
94
+ const { element } = measurement.entries.pop();
95
+ data.target = sampleRUM.targetselector(element);
96
+ data.source = sampleRUM.sourceselector(element) || element.outerHTML.slice(0, 30);
97
+ }
98
+
92
99
  sampleRUM('cwv', data);
93
100
  };
94
101
 
@@ -159,7 +166,7 @@ document.querySelectorAll('form').forEach((form) => {
159
166
  window.addEventListener('visibilitychange', ((event) => sampleRUM.leave(event)));
160
167
  window.addEventListener('pagehide', ((event) => sampleRUM.leave(event)));
161
168
 
162
- const observer = new PerformanceObserver((list) => {
169
+ new PerformanceObserver((list) => {
163
170
  list.getEntries()
164
171
  .filter((entry) => !entry.responseStatus || entry.responseStatus < 400)
165
172
  .filter((entry) => window.location.hostname === new URL(entry.name).hostname)
@@ -175,11 +182,9 @@ const observer = new PerformanceObserver((list) => {
175
182
  sampleRUM('missingresource', { source: entry.name, target: entry.hostname });
176
183
  });
177
184
  }
178
- });
179
- observer.observe({ type: 'resource', buffered: true });
185
+ }).observe({ type: 'resource', buffered: true });
180
186
 
181
- const usp = new URLSearchParams(window.location.search);
182
- [...usp.entries()]
187
+ [...new URLSearchParams(window.location.search).entries()]
183
188
  .filter(([key]) => key.startsWith('utm_'))
184
189
  .filter(([key]) => key !== 'utm_id')
185
190
  .forEach(([key, value]) => {