@adobe/helix-rum-enhancer 2.29.0 → 2.30.1

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.30.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.0...v2.30.1) (2025-01-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * form elements having name/id as id breaks the sourceSelector logic. ([37bd0ab](https://github.com/adobe/helix-rum-enhancer/commit/37bd0ab4c6bb1aac1326bc9be0097a7ccf038870))
7
+
8
+ # [2.30.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.29.0...v2.30.0) (2025-01-15)
9
+
10
+
11
+ ### Features
12
+
13
+ * **missingresource:** report all resource error with http status code ([e238136](https://github.com/adobe/helix-rum-enhancer/commit/e238136c46a9801be1e3ce7887c7b4b292cbcf5b))
14
+
1
15
  # [2.29.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.28.0...v2.29.0) (2025-01-15)
2
16
 
3
17
 
package/README.md CHANGED
@@ -62,10 +62,6 @@ All three parts are optional
62
62
  Even if an `identifier` is provided, having a `context` and `element` is recommended, as it makes the `source` parameter more readable and easier to understand.
63
63
 
64
64
 
65
- #### Examples
66
-
67
- - ``
68
-
69
65
  ## Development
70
66
 
71
67
  ### Build
@@ -85,3 +81,6 @@ $ npm test
85
81
  ```bash
86
82
  $ npm run lint
87
83
  ```
84
+ ### Cutting a Pre-Release
85
+
86
+ Releases are handled by [semantic-release](https://github.com/semantic-release/semantic-release), and will happen automatically when a PR is merged into the `main` or the `1.x` branch. By merging into `beta`, a pre-release will be created.
package/modules/dom.js CHANGED
@@ -41,12 +41,10 @@ function isDialog(el) {
41
41
  // doing it well
42
42
  if (el.tagName === 'DIALOG') return true;
43
43
  // making the best of it
44
- if (el.getAttribute('role') === 'dialog') return true;
45
- if (el.getAttribute('role') === 'alertdialog') return true;
46
- if (el.getAttribute('aria-modal') === 'true') return true;
47
- // doing it wrong
48
44
  const cs = window.getComputedStyle(el);
49
- return (cs && cs.position === 'fixed' && cs.zIndex > 100);
45
+ return ['dialog', 'alertdialog'].find((r) => el.getAttribute('role') === r)
46
+ || el.getAttribute('aria-modal') === 'true'
47
+ || (cs && cs.position === 'fixed' && cs.zIndex > 100);
50
48
  }
51
49
 
52
50
  function isButton(el) {
@@ -62,16 +60,14 @@ function isButton(el) {
62
60
  function getSourceContext(el) {
63
61
  const formEl = el.closest('form');
64
62
  if (formEl) {
65
- return `form${formEl.id ? `#${formEl.id}` : ''}`;
63
+ const id = formEl.getAttribute('id');
64
+ return `form${id ? `#${id}` : ''}`;
66
65
  }
67
66
  const block = el.closest('.block[data-block-name]');
68
- if (block) return `.${block.getAttribute('data-block-name')}`;
69
- if (walk(el, isDialog)) return 'dialog';
70
- if (el.closest('nav')) return 'nav';
71
- if (el.closest('header')) return 'header';
72
- if (el.closest('footer')) return 'footer';
73
- if (el.closest('aside')) return 'aside';
74
- return (walk(el, (e) => e.id && `#${e.id}`));
67
+ return ((block && `.${block.getAttribute('data-block-name')}`)
68
+ || (walk(el, isDialog) && 'dialog')
69
+ || ['nav', 'header', 'footer', 'aside'].find((t) => el.closest(t))
70
+ || walk(el, (e) => e.id && `#${e.id}`));
75
71
  }
76
72
 
77
73
  function getSourceElement(el) {
package/modules/index.js CHANGED
@@ -168,9 +168,9 @@ function addLoadResourceTracking() {
168
168
  sampleRUM('loadresource', { source: e.name, target: Math.round(e.duration) });
169
169
  });
170
170
  list.getEntries()
171
- .filter((e) => e.responseStatus === 404)
171
+ .filter((e) => e.responseStatus >= 400)
172
172
  .forEach((e) => {
173
- sampleRUM('missingresource', { source: e.name, target: e.hostname });
173
+ sampleRUM('missingresource', { source: e.name, target: e.responseStatus });
174
174
  });
175
175
  /* c8 ignore next 3 */
176
176
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.29.0",
3
+ "version": "2.30.1",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -63,11 +63,10 @@
63
63
  }
64
64
  function isDialog(el) {
65
65
  if (el.tagName === 'DIALOG') return true;
66
- if (el.getAttribute('role') === 'dialog') return true;
67
- if (el.getAttribute('role') === 'alertdialog') return true;
68
- if (el.getAttribute('aria-modal') === 'true') return true;
69
66
  const cs = window.getComputedStyle(el);
70
- return (cs && cs.position === 'fixed' && cs.zIndex > 100);
67
+ return ['dialog', 'alertdialog'].find((r) => el.getAttribute('role') === r)
68
+ || el.getAttribute('aria-modal') === 'true'
69
+ || (cs && cs.position === 'fixed' && cs.zIndex > 100);
71
70
  }
72
71
  function isButton(el) {
73
72
  if (el.tagName === 'BUTTON') return true;
@@ -81,16 +80,14 @@
81
80
  function getSourceContext(el) {
82
81
  const formEl = el.closest('form');
83
82
  if (formEl) {
84
- return `form${formEl.id ? `#${formEl.id}` : ''}`;
83
+ const id = formEl.getAttribute('id');
84
+ return `form${id ? `#${id}` : ''}`;
85
85
  }
86
86
  const block = el.closest('.block[data-block-name]');
87
- if (block) return `.${block.getAttribute('data-block-name')}`;
88
- if (walk(el, isDialog)) return 'dialog';
89
- if (el.closest('nav')) return 'nav';
90
- if (el.closest('header')) return 'header';
91
- if (el.closest('footer')) return 'footer';
92
- if (el.closest('aside')) return 'aside';
93
- return (walk(el, (e) => e.id && `#${e.id}`));
87
+ return ((block && `.${block.getAttribute('data-block-name')}`)
88
+ || (walk(el, isDialog) && 'dialog')
89
+ || ['nav', 'header', 'footer', 'aside'].find((t) => el.closest(t))
90
+ || walk(el, (e) => e.id && `#${e.id}`));
94
91
  }
95
92
  function getSourceElement(el) {
96
93
  const f = el.closest('form');
@@ -314,9 +311,9 @@
314
311
  sampleRUM('loadresource', { source: e.name, target: Math.round(e.duration) });
315
312
  });
316
313
  list.getEntries()
317
- .filter((e) => e.responseStatus === 404)
314
+ .filter((e) => e.responseStatus >= 400)
318
315
  .forEach((e) => {
319
- sampleRUM('missingresource', { source: e.name, target: e.hostname });
316
+ sampleRUM('missingresource', { source: e.name, target: e.responseStatus });
320
317
  });
321
318
  } catch (error) {
322
319
  }
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- 1abf13337d16246784fba2bcfa3f2fb1
1
+ 749947aafb5daf964780e64146edf135