@adobe/helix-rum-enhancer 2.1.0 → 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/.releaserc.cjs +1 -1
- package/CHANGELOG.md +17 -0
- package/package.json +10 -10
- package/src/index.js +17 -7
package/.releaserc.cjs
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
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
|
+
|
|
8
|
+
## [2.1.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.1.0...v2.1.1) (2024-02-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **cwv:** only report LCP and CLS eagerly ([9d44949](https://github.com/adobe/helix-rum-enhancer/commit/9d44949701865242ac44255d5080f52b22be2b72))
|
|
14
|
+
* **cwv:** report metrics eagerly ([4cfcad9](https://github.com/adobe/helix-rum-enhancer/commit/4cfcad9e8271a2a3c4571db419e26857b72d0c6d))
|
|
15
|
+
* **cwv:** small change ([542fd6a](https://github.com/adobe/helix-rum-enhancer/commit/542fd6a050fdb911b4fb5faad7f83d0843af4d1e))
|
|
16
|
+
* **cwv:** small change ([3a41b52](https://github.com/adobe/helix-rum-enhancer/commit/3a41b52676484d44585e8b0debe7352fe7a2e5ac))
|
|
17
|
+
|
|
1
18
|
# [2.1.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.0.0...v2.1.0) (2024-01-22)
|
|
2
19
|
|
|
3
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-rum-enhancer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Helix RUM Enhancer",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"lint": "eslint .",
|
|
10
10
|
"docs": "npx jsdoc2md -c .jsdoc.json --files 'src/*.js' > docs/API.md",
|
|
11
11
|
"semantic-release": "semantic-release",
|
|
12
|
-
"semantic-release-dry": "semantic-release --dry-run --branches $CI_BRANCH",
|
|
12
|
+
"semantic-release-dry": "semantic-release --dry-run --branches $CI_BRANCH 1.x main",
|
|
13
13
|
"prepare": "husky install"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
"reporter-options": "configFile=.mocha-multi.json"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@adobe/eslint-config-helix": "2.0.
|
|
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.
|
|
35
|
+
"@semantic-release/npm": "11.0.3",
|
|
36
36
|
"c8": "9.1.0",
|
|
37
37
|
"codecov": "3.8.3",
|
|
38
|
-
"eslint": "8.
|
|
38
|
+
"eslint": "8.57.0",
|
|
39
39
|
"eslint-plugin-header": "3.1.1",
|
|
40
40
|
"eslint-plugin-import": "2.29.1",
|
|
41
|
-
"husky": "
|
|
42
|
-
"jsdoc-to-markdown": "8.0.
|
|
43
|
-
"junit-report-builder": "3.1
|
|
44
|
-
"lint-staged": "15.2.
|
|
45
|
-
"mocha": "10.
|
|
41
|
+
"husky": "9.0.11",
|
|
42
|
+
"jsdoc-to-markdown": "8.0.1",
|
|
43
|
+
"junit-report-builder": "3.2.1",
|
|
44
|
+
"lint-staged": "15.2.2",
|
|
45
|
+
"mocha": "10.3.0",
|
|
46
46
|
"mocha-multi-reporters": "1.5.1",
|
|
47
47
|
"semantic-release": "22.0.12"
|
|
48
48
|
},
|
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
|
|
|
@@ -107,14 +112,19 @@ function addCWVTracking() {
|
|
|
107
112
|
data.cwv[measurement.name] = measurement.value;
|
|
108
113
|
sampleRUM('cwv', data);
|
|
109
114
|
};
|
|
115
|
+
|
|
116
|
+
const featureToggle = () => window.location.hostname === 'blog.adobe.com';
|
|
117
|
+
const isEager = (metric) => ['CLS', 'LCP'].includes(metric);
|
|
118
|
+
|
|
110
119
|
// When loading `web-vitals` using a classic script, all the public
|
|
111
120
|
// methods can be found on the `webVitals` global namespace.
|
|
112
|
-
['
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
121
|
+
['FID', 'INP', 'TTFB', 'CLS', 'LCP'].forEach((metric) => {
|
|
122
|
+
const metricFn = window.webVitals[`on${metric}`];
|
|
123
|
+
if (typeof metricFn === 'function') {
|
|
124
|
+
const opts = isEager(metric) ? { reportAllChanges: featureToggle() } : undefined;
|
|
125
|
+
metricFn(storeCWV, opts);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
118
128
|
};
|
|
119
129
|
document.head.appendChild(script);
|
|
120
130
|
}, 2000); // wait for delayed
|