@adobe/helix-rum-enhancer 2.39.0 → 2.40.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,18 @@
1
+ ## [2.40.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.40.0...v2.40.1) (2025-07-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * initialization logic ([a9df224](https://github.com/adobe/helix-rum-enhancer/commit/a9df2242fa0e970f8f730fbf39a985b2bad72937))
7
+ * initialization logic ([2135ec5](https://github.com/adobe/helix-rum-enhancer/commit/2135ec5bde9e7a2ec244113e5731977a957b01cb))
8
+
9
+ # [2.40.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.39.0...v2.40.0) (2025-07-29)
10
+
11
+
12
+ ### Features
13
+
14
+ * escape invalid/special characters from source selector ([#438](https://github.com/adobe/helix-rum-enhancer/issues/438)) ([#452](https://github.com/adobe/helix-rum-enhancer/issues/452)) ([6918ffa](https://github.com/adobe/helix-rum-enhancer/commit/6918ffaffd22d9c444a85815bc26bc8ebf655900))
15
+
1
16
  # [2.39.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.38.0...v2.39.0) (2025-07-28)
2
17
 
3
18
 
package/modules/dom.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  export const getTargetValue = (el) => el.getAttribute('data-rum-target') || el.getAttribute('href')
13
- || el.currentSrc || el.getAttribute('src') || el.dataset.action || el.action;
13
+ || el.currentSrc || el.getAttribute('src') || el.dataset.action || el.action;
14
14
 
15
15
  export const targetSelector = (el) => {
16
16
  try {
@@ -20,7 +20,7 @@ export const targetSelector = (el) => {
20
20
  v = getTargetValue(el.closest('a'));
21
21
  }
22
22
  if (v && !v.startsWith('https://')) {
23
- // resolve relative links
23
+ // resolve relative links
24
24
  v = new URL(v, window.location).href;
25
25
  }
26
26
  return v;
@@ -63,34 +63,34 @@ function getSourceContext(el) {
63
63
  if (formEl) {
64
64
  const id = formEl.getAttribute('id');
65
65
  if (id) {
66
- return `form#${id}`;
66
+ return `form#${CSS.escape(id)}`;
67
67
  }
68
- return `form${formEl.classList.length > 0 ? `.${formEl.classList[0]}` : ''}`;
68
+ return `form${formEl.classList.length > 0 ? `.${CSS.escape(formEl.classList[0])}` : ''}`;
69
69
  }
70
70
  const block = el.closest('.block[data-block-name]');
71
71
  return ((block && `.${block.getAttribute('data-block-name')}`)
72
72
  || (walk(el, isDialog) && 'dialog')
73
73
  || (walk(el, (e) => e.tagName && e.tagName.includes('-') && e.tagName.toLowerCase()))
74
74
  || ['nav', 'header', 'footer', 'aside'].find((t) => el.closest(t))
75
- || walk(el, (e) => e.id && `#${e.id}`));
75
+ || walk(el, (e) => e.id && `#${CSS.escape(e.id)}`));
76
76
  }
77
77
 
78
78
  function getSourceElement(el) {
79
79
  const f = el.closest('form');
80
80
  if (f && Array.from(f.elements).includes(el)) {
81
81
  return (el.tagName.toLowerCase()
82
- + (['INPUT', 'BUTTON'].includes(el.tagName)
83
- ? `[type='${el.getAttribute('type') || ''}']`
84
- : ''));
82
+ + (['INPUT', 'BUTTON'].includes(el.tagName)
83
+ ? `[type='${el.getAttribute('type') || ''}']`
84
+ : ''));
85
85
  }
86
86
  if (walk(el, isButton)) return 'button';
87
87
  return el.tagName.toLowerCase().match(/^(a|img|video|form)$/) && el.tagName.toLowerCase();
88
88
  }
89
89
 
90
90
  function getSourceIdentifier(el) {
91
- if (el.id) return `#${el.id}`;
91
+ if (el.id) return `#${CSS.escape(el.id)}`;
92
92
  if (el.getAttribute('data-block-name')) return `.${el.getAttribute('data-block-name')}`;
93
- return (el.classList.length > 0 && `.${el.classList[0]}`);
93
+ return (el.classList.length > 0 && `.${CSS.escape(el.classList[0])}`);
94
94
  }
95
95
 
96
96
  export const sourceSelector = (el) => {
package/modules/index.js CHANGED
@@ -361,7 +361,7 @@ function addTrackingFromConfig() {
361
361
  });
362
362
  }
363
363
 
364
- function init() {
364
+ function initEnhancer() {
365
365
  try {
366
366
  if (sampleRUM) {
367
367
  addTrackingFromConfig();
@@ -374,4 +374,4 @@ function init() {
374
374
  }
375
375
  }
376
376
 
377
- init();
377
+ initEnhancer();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.39.0",
3
+ "version": "2.40.1",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -60,7 +60,7 @@
60
60
  "lint-staged": "16.1.2",
61
61
  "mocha": "11.7.1",
62
62
  "mocha-multi-reporters": "1.5.1",
63
- "rollup": "4.45.1",
63
+ "rollup": "4.46.1",
64
64
  "rollup-plugin-eslint-bundle": "9.0.0",
65
65
  "semantic-release": "24.2.7",
66
66
  "semantic-release-slack-bot": "^4.0.2",
package/src/index.js CHANGED
@@ -82,12 +82,12 @@
82
82
  if (formEl) {
83
83
  const id = formEl.getAttribute('id');
84
84
  if (id) {
85
- return `form#${id}`;
85
+ return `form#${CSS.escape(id)}`;
86
86
  }
87
- return `form${formEl.classList.length > 0 ? `.${formEl.classList[0]}` : ''}`;
87
+ return `form${formEl.classList.length > 0 ? `.${CSS.escape(formEl.classList[0])}` : ''}`;
88
88
  }
89
89
  const block = el.closest('.block[data-block-name]');
90
- return block && `.${block.getAttribute('data-block-name')}` || walk(el, isDialog) && 'dialog' || walk(el, e => e.tagName && e.tagName.includes('-') && e.tagName.toLowerCase()) || ['nav', 'header', 'footer', 'aside'].find(t => el.closest(t)) || walk(el, e => e.id && `#${e.id}`);
90
+ return block && `.${block.getAttribute('data-block-name')}` || walk(el, isDialog) && 'dialog' || walk(el, e => e.tagName && e.tagName.includes('-') && e.tagName.toLowerCase()) || ['nav', 'header', 'footer', 'aside'].find(t => el.closest(t)) || walk(el, e => e.id && `#${CSS.escape(e.id)}`);
91
91
  }
92
92
  function getSourceElement(el) {
93
93
  const f = el.closest('form');
@@ -98,9 +98,9 @@
98
98
  return el.tagName.toLowerCase().match(/^(a|img|video|form)$/) && el.tagName.toLowerCase();
99
99
  }
100
100
  function getSourceIdentifier(el) {
101
- if (el.id) return `#${el.id}`;
101
+ if (el.id) return `#${CSS.escape(el.id)}`;
102
102
  if (el.getAttribute('data-block-name')) return `.${el.getAttribute('data-block-name')}`;
103
- return el.classList.length > 0 && `.${el.classList[0]}`;
103
+ return el.classList.length > 0 && `.${CSS.escape(el.classList[0])}`;
104
104
  }
105
105
  const sourceSelector = el => {
106
106
  try {
@@ -433,7 +433,7 @@
433
433
  });
434
434
  });
435
435
  }
436
- function init() {
436
+ function initEnhancer() {
437
437
  try {
438
438
  if (sampleRUM) {
439
439
  addTrackingFromConfig();
@@ -442,6 +442,6 @@
442
442
  }
443
443
  } catch (error) {}
444
444
  }
445
- init();
445
+ initEnhancer();
446
446
 
447
447
  })();
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- c69c2dbd6602a4f9ddaabfb336dbf6c3
1
+ 877c59781c2dd371ceba23ff4c75fe70
package/src/index.sri CHANGED
@@ -1 +1 @@
1
- sha384-I5K6alRMVQ/PEU4HdrN6eVdLhmFyFiprozg8vhN5h5gNbohsTdZ5JO5imnjM8Ccv
1
+ sha384-1eVgclIiUMzeVr+j9ZR6jGHN0PHkdlgh7SdPOU7OuMpWovjj6zGZewBqPKA8ejnB
@@ -1 +1 @@
1
- ca3630c51ee48da2595696b4b11cb586
1
+ 411af2624f736f7385cfb1230be854c3
@@ -1 +1 @@
1
- 81a070324c3b6699b07f9f5d4a04d9e2
1
+ 44a60e36c92e7b70b0dd230d2f1d1e7b
@@ -1 +1 @@
1
- 866b5825b7bdb273170fbab6fa8099bb
1
+ 5a20c1d914d19b130034e4df532b8b4d
@@ -1 +1 @@
1
- d241929d3af96465ac32a4158c0e0fe8
1
+ ebe320b3bc258db22786d472559793c1