@adobe/helix-rum-enhancer 2.1.1 → 2.2.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,10 @@
1
+ # [2.2.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.1.1...v2.2.0) (2024-03-04)
2
+
3
+
4
+ ### Features
5
+
6
+ * **sourceselector:** highlight clicks on buttons and CTAs ([2bc8dc5](https://github.com/adobe/helix-rum-enhancer/commit/2bc8dc531ef31e9ae08daebdd428a98a493c0f9e))
7
+
1
8
  ## [2.1.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.1.0...v2.1.1) (2024-02-28)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "@adobe/eslint-config-helix": "2.0.6",
33
33
  "@semantic-release/changelog": "6.0.3",
34
34
  "@semantic-release/git": "10.0.1",
35
- "@semantic-release/npm": "11.0.2",
35
+ "@semantic-release/npm": "11.0.3",
36
36
  "c8": "9.1.0",
37
37
  "codecov": "3.8.3",
38
38
  "eslint": "8.57.0",
package/src/index.js CHANGED
@@ -44,8 +44,8 @@ const sourceselector = (element) => {
44
44
  formElementSelector = element.tagName === 'INPUT' ? `form input[type='${element.getAttribute('type')}']` : `form ${element.tagName.toLowerCase()}`;
45
45
  }
46
46
 
47
+ const blockName = element.closest('.block') ? element.closest('.block').getAttribute('data-block-name') : '';
47
48
  if (element.id || formElementSelector) {
48
- const blockName = element.closest('.block') ? element.closest('.block').getAttribute('data-block-name') : '';
49
49
  const id = element.id ? `#${element.id}` : '';
50
50
  return blockName ? `.${blockName} ${formElementSelector}${id}` : `${formElementSelector}${id}`;
51
51
  }
@@ -53,6 +53,11 @@ const sourceselector = (element) => {
53
53
  if (element.getAttribute('data-block-name')) {
54
54
  return `.${element.getAttribute('data-block-name')}`;
55
55
  }
56
+
57
+ if (Array.from(element.classList).some((className) => className.match(/button|cta/))) {
58
+ return blockName ? `.${blockName} .button` : '.button';
59
+ }
60
+
56
61
  return sourceselector(element.parentElement);
57
62
  };
58
63