@adobe/helix-rum-enhancer 1.10.0 → 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 CHANGED
@@ -1,3 +1,10 @@
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
+
1
8
  # [1.10.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.9.1...v1.10.0) (2024-01-16)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -137,7 +137,6 @@ sampleRUM.sourceselector = (element) => {
137
137
  if (Array.from(element.classList).some((className) => className.match(/button|cta/))) {
138
138
  return blockName ? `.${blockName} .button` : '.button';
139
139
  }
140
-
141
140
  return sampleRUM.sourceselector(element.parentElement);
142
141
  };
143
142
 
@@ -155,15 +154,13 @@ document.querySelectorAll('form').forEach((form) => {
155
154
  window.addEventListener('visibilitychange', ((event) => sampleRUM.leave(event)));
156
155
  window.addEventListener('pagehide', ((event) => sampleRUM.leave(event)));
157
156
 
158
- if (window.location.hostname === 'blog.adobe.com') {
159
- const observer = new PerformanceObserver((list) => {
160
- list.getEntries()
161
- .filter((entry) => !entry.responseStatus || entry.responseStatus < 400)
162
- .filter((entry) => window.location.hostname === new URL(entry.name).hostname)
163
- .filter((entry) => new URL(entry.name).pathname.match('.*(\\.plain\\.html|\\.json)$'))
164
- .forEach((entry) => {
165
- sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
166
- });
167
- });
168
- observer.observe({ type: 'resource', buffered: true });
169
- }
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 });