@adobe/helix-rum-enhancer 2.14.1 → 2.14.2

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/.husky/pre-commit CHANGED
File without changes
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [2.14.2](https://github.com/adobe/helix-rum-enhancer/compare/v2.14.1...v2.14.2) (2024-06-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * restore original path behavior ([#201](https://github.com/adobe/helix-rum-enhancer/issues/201)) ([f70df99](https://github.com/adobe/helix-rum-enhancer/commit/f70df992da778f5700d9bdc8b4f114ddf272ea77))
7
+
1
8
  ## [2.14.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.14.0...v2.14.1) (2024-06-11)
2
9
 
3
10
 
package/modules/utils.js CHANGED
@@ -11,7 +11,28 @@
11
11
  */
12
12
 
13
13
  export const urlSanitizers = {
14
+ /**
15
+ * Returns the full url.
16
+ * If no url is provided, it defaults to window.location.href.
17
+ * @param {string} url (default: window.location.href) The url to sanitize
18
+ * @returns {string} The sanitized url
19
+ */
14
20
  full: (url = window.location.href) => new URL(url).toString(),
21
+ /**
22
+ * Returns the origin of the provided url.
23
+ * If no url is provided, it defaults to window.location.href.
24
+ * @param {string} url (default: window.location.href) The url to sanitize
25
+ * @returns {string} The sanitized url
26
+ */
15
27
  origin: (url = window.location.href) => new URL(url).origin,
16
- path: (url = window.location.href) => new URL(url).pathname,
28
+ /**
29
+ * Returns the sanitized url: the origin and the path (no query params or hash)
30
+ * If no url is provided, it defaults to window.location.href.
31
+ * @param {string} url (default: window.location.href) The url to sanitize
32
+ * @returns {string} The sanitized url
33
+ */
34
+ path: (url = window.location.href) => {
35
+ const u = new URL(url);
36
+ return `${u.origin}${u.pathname}`;
37
+ },
17
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.14.1",
3
+ "version": "2.14.2",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -30,9 +30,30 @@
30
30
  };
31
31
 
32
32
  const urlSanitizers = {
33
+ /**
34
+ * Returns the full url.
35
+ * If no url is provided, it defaults to window.location.href.
36
+ * @param {string} url (default: window.location.href) The url to sanitize
37
+ * @returns {string} The sanitized url
38
+ */
33
39
  full: (url = window.location.href) => new URL(url).toString(),
40
+ /**
41
+ * Returns the origin of the provided url.
42
+ * If no url is provided, it defaults to window.location.href.
43
+ * @param {string} url (default: window.location.href) The url to sanitize
44
+ * @returns {string} The sanitized url
45
+ */
34
46
  origin: (url = window.location.href) => new URL(url).origin,
35
- path: (url = window.location.href) => new URL(url).pathname,
47
+ /**
48
+ * Returns the sanitized url: the origin and the path (no query params or hash)
49
+ * If no url is provided, it defaults to window.location.href.
50
+ * @param {string} url (default: window.location.href) The url to sanitize
51
+ * @returns {string} The sanitized url
52
+ */
53
+ path: (url = window.location.href) => {
54
+ const u = new URL(url);
55
+ return `${u.origin}${u.pathname}`;
56
+ },
36
57
  };
37
58
 
38
59
  const getTargetValue = (element) => element.getAttribute('data-rum-target') || element.getAttribute('href')