@adobe/spacecat-shared-rum-api-client 2.43.1 → 2.44.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,9 @@
1
+ ## [@adobe/spacecat-shared-rum-api-client-v2.44.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.43.1...@adobe/spacecat-shared-rum-api-client-v2.44.0) (2026-06-26)
2
+
3
+ ### Features
4
+
5
+ * **rum:** scope latest-metrics RUM to locale path prefix ([#1707](https://github.com/adobe/spacecat-shared/issues/1707)) ([77cdb33](https://github.com/adobe/spacecat-shared/commit/77cdb33d7f55a9bff795b768621ec70830b2cba3))
6
+
1
7
  ## [@adobe/spacecat-shared-rum-api-client-v2.43.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.43.0...@adobe/spacecat-shared-rum-api-client-v2.43.1) (2026-06-15)
2
8
 
3
9
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-rum-api-client",
3
- "version": "2.43.1",
3
+ "version": "2.44.0",
4
4
  "description": "Shared modules of the Spacecat Services - Rum API client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -13,9 +13,33 @@
13
13
  import { DataChunks, series } from '@adobe/rum-distiller';
14
14
  import { loadBundles } from '../utils.js';
15
15
 
16
- function handler(bundles) {
16
+ /**
17
+ * Checks whether a bundle URL falls under a given path prefix.
18
+ * Boundary-safe: prefix '/de' matches '/de' and '/de/...' but NOT '/design'.
19
+ * @param {string} url - Bundle URL.
20
+ * @param {string} prefix - Normalized path prefix (e.g. '/de').
21
+ * @returns {boolean} True if the URL's path is at or under the prefix.
22
+ */
23
+ function matchesPathPrefix(url, prefix) {
24
+ try {
25
+ const { pathname } = new URL(url);
26
+ const path = pathname !== '/' ? pathname.replace(/\/+$/, '') : '/';
27
+ return path === prefix || path.startsWith(`${prefix}/`);
28
+ } catch {
29
+ return false;
30
+ }
31
+ }
32
+
33
+ function handler(bundles, opts = {}) {
34
+ // Locale-specific sites (e.g. https://example.com/de) have no domain key of their
35
+ // own — RUM is fetched for the main domain, then narrowed to the locale subtree here.
36
+ const { pathPrefix } = opts;
37
+ const scopedBundles = pathPrefix
38
+ ? bundles.filter((b) => b?.url && matchesPathPrefix(b.url, pathPrefix))
39
+ : bundles;
40
+
17
41
  const dataChunks = new DataChunks();
18
- loadBundles(bundles, dataChunks);
42
+ loadBundles(scopedBundles, dataChunks);
19
43
  dataChunks.addSeries('traffic_domain', series.pageViews);
20
44
  dataChunks.addSeries('clicks', (bundle) => (bundle.events.some((e) => e.checkpoint === 'click')
21
45
  ? bundle.weight