@adobe/helix-rum-enhancer 2.5.0 → 2.7.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,17 @@
1
+ # [2.7.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.6.0...v2.7.0) (2024-04-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * add logic to capture target from wrapping anchor tag ([2a733b3](https://github.com/adobe/helix-rum-enhancer/commit/2a733b307d00c1a0613f645a01e325e683734625))
7
+
8
+ # [2.6.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.5.0...v2.6.0) (2024-04-16)
9
+
10
+
11
+ ### Features
12
+
13
+ * **resources:** add missingresource checkpoint behind feature toggle ([a9ba59d](https://github.com/adobe/helix-rum-enhancer/commit/a9ba59dccc4712571530fd785bb9aa6cc277bea8))
14
+
1
15
  # [2.5.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.4.1...v2.5.0) (2024-04-16)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.5.0",
3
+ "version": "2.7.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -44,7 +44,7 @@
44
44
  "lint-staged": "15.2.2",
45
45
  "mocha": "10.4.0",
46
46
  "mocha-multi-reporters": "1.5.1",
47
- "semantic-release": "22.0.12"
47
+ "semantic-release": "23.0.8"
48
48
  },
49
49
  "lint-staged": {
50
50
  "*.js": "eslint",
package/src/index.js CHANGED
@@ -21,9 +21,14 @@ const urlSanitizers = {
21
21
  path: () => window.location.href.replace(/\?.*$/, ''),
22
22
  };
23
23
 
24
- const targetselector = (element) => {
25
- let value = element.getAttribute('data-rum-target') || element.getAttribute('href')
24
+ const getTargetValue = (element) => element.getAttribute('data-rum-target') || element.getAttribute('href')
26
25
  || element.currentSrc || element.getAttribute('src') || element.dataset.action || element.action;
26
+
27
+ const targetselector = (element) => {
28
+ let value = getTargetValue(element);
29
+ if (!value && element.tagName !== 'A' && element.closest('a')) {
30
+ value = getTargetValue(element.closest('a'));
31
+ }
27
32
  if (value && !value.startsWith('https://')) {
28
33
  // resolve relative links
29
34
  value = new URL(value, window.location).href;
@@ -177,6 +182,15 @@ function addLoadResourceTracking() {
177
182
  .forEach((entry) => {
178
183
  sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
179
184
  });
185
+
186
+ if (window.origin === 'business.adobe.com') {
187
+ // feature flagged for now
188
+ list.getEntries()
189
+ .filter((entry) => entry.responseStatus === 404)
190
+ .forEach((entry) => {
191
+ sampleRUM('missingresource', { source: entry.name, target: entry.hostname });
192
+ });
193
+ }
180
194
  });
181
195
  observer.observe({ type: 'resource', buffered: true });
182
196
  }