@adobe/helix-rum-enhancer 2.14.2 → 2.16.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', '1.x'],
15
+ branches: ['main'],
16
16
  };
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # [2.16.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.15.0...v2.16.0) (2024-07-02)
2
+
3
+
4
+ ### Features
5
+
6
+ * enable paid checkpoint for all ([#219](https://github.com/adobe/helix-rum-enhancer/issues/219)) ([5348744](https://github.com/adobe/helix-rum-enhancer/commit/5348744de770c024b2c9fe17962307e39293bf36))
7
+
8
+ # [2.15.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.14.2...v2.15.0) (2024-07-01)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * use correct token for release ([094f37e](https://github.com/adobe/helix-rum-enhancer/commit/094f37ef2de8ddf5d64ea38c9071c9b1bec6119a))
14
+
15
+
16
+ ### Features
17
+
18
+ * add more logic to button selector ([#205](https://github.com/adobe/helix-rum-enhancer/issues/205)) ([c9a5629](https://github.com/adobe/helix-rum-enhancer/commit/c9a5629e7e690397a5f46cbf8db08570f0c4d250))
19
+ * clean up and trigger release ([bfc8d24](https://github.com/adobe/helix-rum-enhancer/commit/bfc8d241cd19b33975ac37be5167783b99fbe54c))
20
+ * switch release token ([0e5b3b0](https://github.com/adobe/helix-rum-enhancer/commit/0e5b3b03d0b96a32118340e7b6f004da8660f0aa))
21
+ * trigger release ([bf26949](https://github.com/adobe/helix-rum-enhancer/commit/bf269492cb330c55d22fd0eeed4aad4cfdac57a3))
22
+
1
23
  ## [2.14.2](https://github.com/adobe/helix-rum-enhancer/compare/v2.14.1...v2.14.2) (2024-06-12)
2
24
 
3
25
 
@@ -10,4 +10,4 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  export const KNOWN_PROPERTIES = ['weight', 'id', 'referer', 'checkpoint', 't', 'source', 'target', 'cwv', 'CLS', 'FID', 'LCP', 'INP', 'TTFB'];
13
- export const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource', 'utm'];
13
+ export const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource', 'utm', 'paid'];
package/modules/dom.js CHANGED
@@ -54,11 +54,25 @@ export const sourceSelector = (element) => {
54
54
  return `.${element.getAttribute('data-block-name')}`;
55
55
  }
56
56
 
57
- if (Array.from(element.classList).some((className) => className.match(/button|cta/))) {
58
- return blockName ? `.${blockName} .button` : '.button';
57
+ const classes = Array.from(element.classList);
58
+ const label = element.tagName.toLowerCase();
59
+ const firstClass = classes.length > 0 ? `.${classes[0]}` : '';
60
+ const labelWithClass = `${element.tagName.toLowerCase()}${firstClass}`;
61
+ if (element.tagName.toLowerCase() === 'button'
62
+ || element.type === 'button'
63
+ || classes.some((className) => className.match(/button|cta/))) {
64
+ let parent = element.parentElement;
65
+ if (!parent) return labelWithClass;
66
+ if (parent.id) return `#${parent.id} ${label}`;
67
+ while (parent.tagName !== 'BODY' && !parent.id) parent = parent.parentElement;
68
+ if (parent.id) return `#${parent.id} ${labelWithClass}`;
69
+ return blockName ? `.${blockName} ${labelWithClass}` : labelWithClass;
59
70
  }
60
71
 
61
- return sourceSelector(element.parentElement);
72
+ const parent = sourceSelector(element.parentElement);
73
+ if (parent) return parent;
74
+
75
+ return labelWithClass;
62
76
  /* c8 ignore next 3 */
63
77
  } catch (error) {
64
78
  return null;
package/modules/fflags.js CHANGED
@@ -16,6 +16,5 @@ export const fflags = {
16
16
  enabled: (flag, callback) => fflags.has(flag) && callback(),
17
17
  disabled: (flag, callback) => !fflags.has(flag) && callback(),
18
18
  onetrust: [543, 770, 1136],
19
- ads: [1139, 543],
20
19
  email: [1139, 543],
21
20
  };
package/modules/index.js CHANGED
@@ -31,7 +31,6 @@ function optedIn(checkpoint, data) {
31
31
  function getCollectionConfig() {
32
32
  // eslint-disable-next-line max-len
33
33
  fflags.enabled('onetrust', () => DEFAULT_TRACKING_EVENTS.push('consent'));
34
- fflags.enabled('ads', () => DEFAULT_TRACKING_EVENTS.push('paid'));
35
34
  fflags.enabled('email', () => DEFAULT_TRACKING_EVENTS.push('email'));
36
35
  return DEFAULT_TRACKING_EVENTS;
37
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.14.2",
3
+ "version": "2.16.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "@web/test-runner-commands": "0.9.0",
43
43
  "@web/test-runner-mocha": "0.9.0",
44
44
  "@web/test-runner-playwright": "0.11.0",
45
- "c8": "10.0.0",
45
+ "c8": "10.1.2",
46
46
  "codecov": "3.8.3",
47
47
  "eslint": "8.57.0",
48
48
  "eslint-plugin-header": "3.1.1",
@@ -50,8 +50,8 @@
50
50
  "husky": "9.0.11",
51
51
  "jsdoc-to-markdown": "8.0.1",
52
52
  "junit-report-builder": "3.2.1",
53
- "lint-staged": "15.2.5",
54
- "mocha": "10.4.0",
53
+ "lint-staged": "15.2.7",
54
+ "mocha": "10.5.2",
55
55
  "mocha-multi-reporters": "1.5.1",
56
56
  "rollup": "4.18.0",
57
57
  "rollup-plugin-cleanup": "3.2.1",
package/src/index.js CHANGED
@@ -16,7 +16,7 @@
16
16
  'use strict';
17
17
 
18
18
  const KNOWN_PROPERTIES = ['weight', 'id', 'referer', 'checkpoint', 't', 'source', 'target', 'cwv', 'CLS', 'FID', 'LCP', 'INP', 'TTFB'];
19
- const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource', 'utm'];
19
+ const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource', 'utm', 'paid'];
20
20
 
21
21
  const fflags = {
22
22
  has: (flag) => fflags[flag].indexOf(Array.from(window.origin)
@@ -25,7 +25,6 @@
25
25
  enabled: (flag, callback) => fflags.has(flag) && callback(),
26
26
  disabled: (flag, callback) => !fflags.has(flag) && callback(),
27
27
  onetrust: [543, 770, 1136],
28
- ads: [1139, 543],
29
28
  email: [1139, 543],
30
29
  };
31
30
 
@@ -100,11 +99,25 @@
100
99
  return `.${element.getAttribute('data-block-name')}`;
101
100
  }
102
101
 
103
- if (Array.from(element.classList).some((className) => className.match(/button|cta/))) {
104
- return blockName ? `.${blockName} .button` : '.button';
102
+ const classes = Array.from(element.classList);
103
+ const label = element.tagName.toLowerCase();
104
+ const firstClass = classes.length > 0 ? `.${classes[0]}` : '';
105
+ const labelWithClass = `${element.tagName.toLowerCase()}${firstClass}`;
106
+ if (element.tagName.toLowerCase() === 'button'
107
+ || element.type === 'button'
108
+ || classes.some((className) => className.match(/button|cta/))) {
109
+ let parent = element.parentElement;
110
+ if (!parent) return labelWithClass;
111
+ if (parent.id) return `#${parent.id} ${label}`;
112
+ while (parent.tagName !== 'BODY' && !parent.id) parent = parent.parentElement;
113
+ if (parent.id) return `#${parent.id} ${labelWithClass}`;
114
+ return blockName ? `.${blockName} ${labelWithClass}` : labelWithClass;
105
115
  }
106
116
 
107
- return sourceSelector(element.parentElement);
117
+ const parent = sourceSelector(element.parentElement);
118
+ if (parent) return parent;
119
+
120
+ return labelWithClass;
108
121
  } catch (error) {
109
122
  return null;
110
123
  }
@@ -119,7 +132,6 @@
119
132
  function getCollectionConfig() {
120
133
  // eslint-disable-next-line max-len
121
134
  fflags.enabled('onetrust', () => DEFAULT_TRACKING_EVENTS.push('consent'));
122
- fflags.enabled('ads', () => DEFAULT_TRACKING_EVENTS.push('paid'));
123
135
  fflags.enabled('email', () => DEFAULT_TRACKING_EVENTS.push('email'));
124
136
  return DEFAULT_TRACKING_EVENTS;
125
137
  }