@adobe/helix-rum-enhancer 1.4.0 → 1.5.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,11 @@
1
+ # [1.5.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.4.0...v1.5.0) (2023-09-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * **index:** configurable base url. Adapt to changes in helix-rum-js ([1bb9792](https://github.com/adobe/helix-rum-enhancer/commit/1bb9792f46441d4b17809570f3a018552389515f))
7
+ * **index:** enable configurable base url ([3adc4a8](https://github.com/adobe/helix-rum-enhancer/commit/3adc4a8308b86571af5014f6463a4543f3fca857))
8
+
1
9
  # [1.4.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.3.0...v1.4.0) (2023-09-02)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -31,10 +31,10 @@
31
31
  "@adobe/eslint-config-helix": "2.0.3",
32
32
  "@semantic-release/changelog": "6.0.3",
33
33
  "@semantic-release/git": "10.0.1",
34
- "@semantic-release/npm": "10.0.5",
34
+ "@semantic-release/npm": "11.0.0",
35
35
  "c8": "8.0.1",
36
36
  "codecov": "3.8.3",
37
- "eslint": "8.48.0",
37
+ "eslint": "8.49.0",
38
38
  "eslint-plugin-header": "3.1.1",
39
39
  "eslint-plugin-import": "2.28.1",
40
40
  "husky": "8.0.3",
@@ -43,7 +43,7 @@
43
43
  "lint-staged": "14.0.1",
44
44
  "mocha": "10.2.0",
45
45
  "mocha-multi-reporters": "1.5.1",
46
- "semantic-release": "21.1.1"
46
+ "semantic-release": "22.0.0"
47
47
  },
48
48
  "lint-staged": {
49
49
  "*.js": "eslint",
package/src/index.js CHANGED
@@ -11,6 +11,8 @@
11
11
  */
12
12
  const { sampleRUM } = window.hlx.rum;
13
13
 
14
+ sampleRUM.baseURL = sampleRUM.baseURL || new URL('https://rum.hlx.page');
15
+
14
16
  sampleRUM.blockobserver = (window.IntersectionObserver) ? new IntersectionObserver((entries) => {
15
17
  entries
16
18
  .filter((entry) => entry.isIntersecting)
@@ -62,13 +64,14 @@ sampleRUM.targetselector = (element) => {
62
64
  };
63
65
 
64
66
  sampleRUM.drain('cwv', (() => {
65
- if (document.querySelector('script[src="https://rum.hlx.page/.rum/web-vitals/dist/web-vitals.iife.js"]')) {
67
+ const cwvScript = new URL('.rum/web-vitals/dist/web-vitals.iife.js', sampleRUM.baseURL).href;
68
+ if (document.querySelector(`script[src="${cwvScript}"]`)) {
66
69
  // web vitals script has been loaded already
67
70
  return;
68
71
  }
69
72
  // use classic script to avoid CORS issues
70
73
  const script = document.createElement('script');
71
- script.src = 'https://rum.hlx.page/.rum/web-vitals/dist/web-vitals.iife.js';
74
+ script.src = cwvScript;
72
75
  script.onload = () => {
73
76
  const storeCWV = (measurement) => {
74
77
  const data = { cwv: {} };