@adobe/helix-rum-enhancer 1.9.1 → 1.11.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 +14 -0
- package/package.json +1 -1
- package/src/index.js +15 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.11.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.10.0...v1.11.0) (2024-01-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **observer:** enable tracking of JSON loading for all browsers that have a PerformanceObserver implementation ([c049f93](https://github.com/adobe/helix-rum-enhancer/commit/c049f930f0cc1dc548e42bd8e76cd97709a873d7))
|
|
7
|
+
|
|
8
|
+
# [1.10.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.9.1...v1.10.0) (2024-01-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **sourceselector:** highlight clicks on buttons and CTAs ([4cd62b8](https://github.com/adobe/helix-rum-enhancer/commit/4cd62b86eb08c496712deba42d3f011b8cbac5c6))
|
|
14
|
+
|
|
1
15
|
## [1.9.1](https://github.com/adobe/helix-rum-enhancer/compare/v1.9.0...v1.9.1) (2024-01-11)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -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,10 @@ 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
|
+
}
|
|
136
140
|
return sampleRUM.sourceselector(element.parentElement);
|
|
137
141
|
};
|
|
138
142
|
|
|
@@ -150,15 +154,13 @@ document.querySelectorAll('form').forEach((form) => {
|
|
|
150
154
|
window.addEventListener('visibilitychange', ((event) => sampleRUM.leave(event)));
|
|
151
155
|
window.addEventListener('pagehide', ((event) => sampleRUM.leave(event)));
|
|
152
156
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
observer.observe({ type: 'resource', buffered: true });
|
|
164
|
-
}
|
|
157
|
+
const observer = new PerformanceObserver((list) => {
|
|
158
|
+
list.getEntries()
|
|
159
|
+
.filter((entry) => !entry.responseStatus || entry.responseStatus < 400)
|
|
160
|
+
.filter((entry) => window.location.hostname === new URL(entry.name).hostname)
|
|
161
|
+
.filter((entry) => new URL(entry.name).pathname.match('.*(\\.plain\\.html|\\.json)$'))
|
|
162
|
+
.forEach((entry) => {
|
|
163
|
+
sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
observer.observe({ type: 'resource', buffered: true });
|