@adobe/helix-rum-enhancer 1.9.0 → 1.10.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/.releaserc.cjs CHANGED
@@ -12,5 +12,5 @@ module.exports = {
12
12
  }],
13
13
  ["@semantic-release/github", {}]
14
14
  ],
15
- branches: ['main'],
15
+ branches: ['main', "1.x"],
16
16
  };
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.10.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.9.1...v1.10.0) (2024-01-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * **sourceselector:** highlight clicks on buttons and CTAs ([4cd62b8](https://github.com/adobe/helix-rum-enhancer/commit/4cd62b86eb08c496712deba42d3f011b8cbac5c6))
7
+
8
+ ## [1.9.1](https://github.com/adobe/helix-rum-enhancer/compare/v1.9.0...v1.9.1) (2024-01-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * correct prefix check for relative urls in targets. fixes [#102](https://github.com/adobe/helix-rum-enhancer/issues/102) ([3df4132](https://github.com/adobe/helix-rum-enhancer/commit/3df413259cd0e71777328f738b81057f7f4e5520))
14
+
1
15
  # [1.9.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.8.1...v1.9.0) (2023-12-11)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -32,18 +32,18 @@
32
32
  "@semantic-release/changelog": "6.0.3",
33
33
  "@semantic-release/git": "10.0.1",
34
34
  "@semantic-release/npm": "11.0.2",
35
- "c8": "8.0.1",
35
+ "c8": "9.0.0",
36
36
  "codecov": "3.8.3",
37
- "eslint": "8.55.0",
37
+ "eslint": "8.56.0",
38
38
  "eslint-plugin-header": "3.1.1",
39
- "eslint-plugin-import": "2.29.0",
39
+ "eslint-plugin-import": "2.29.1",
40
40
  "husky": "8.0.3",
41
41
  "jsdoc-to-markdown": "8.0.0",
42
42
  "junit-report-builder": "3.1.0",
43
43
  "lint-staged": "15.2.0",
44
44
  "mocha": "10.2.0",
45
45
  "mocha-multi-reporters": "1.5.1",
46
- "semantic-release": "22.0.10"
46
+ "semantic-release": "22.0.12"
47
47
  },
48
48
  "lint-staged": {
49
49
  "*.js": "eslint",
package/src/index.js CHANGED
@@ -69,7 +69,7 @@ new PerformanceObserver((list) => list
69
69
  sampleRUM.targetselector = (element) => {
70
70
  let value = element.getAttribute('data-rum-target') || element.getAttribute('href') || element.currentSrc || element.getAttribute('src')
71
71
  || element.dataset.action || element.action;
72
- if (value && value.startsWith('https://')) {
72
+ if (value && !value.startsWith('https://')) {
73
73
  // resolve relative links
74
74
  value = new URL(value, window.location).href;
75
75
  }
@@ -124,8 +124,8 @@ sampleRUM.sourceselector = (element) => {
124
124
  formElementSelector = element.tagName === 'INPUT' ? `form input[type='${element.getAttribute('type')}']` : `form ${element.tagName.toLowerCase()}`;
125
125
  }
126
126
 
127
+ const blockName = element.closest('.block') ? element.closest('.block').getAttribute('data-block-name') : '';
127
128
  if (element.id || formElementSelector) {
128
- const blockName = element.closest('.block') ? element.closest('.block').getAttribute('data-block-name') : '';
129
129
  const id = element.id ? `#${element.id}` : '';
130
130
  return blockName ? `.${blockName} ${formElementSelector}${id}` : `${formElementSelector}${id}`;
131
131
  }
@@ -133,6 +133,11 @@ sampleRUM.sourceselector = (element) => {
133
133
  if (element.getAttribute('data-block-name')) {
134
134
  return `.${element.getAttribute('data-block-name')}`;
135
135
  }
136
+
137
+ if (Array.from(element.classList).some((className) => className.match(/button|cta/))) {
138
+ return blockName ? `.${blockName} .button` : '.button';
139
+ }
140
+
136
141
  return sampleRUM.sourceselector(element.parentElement);
137
142
  };
138
143