@adobe/spacecat-shared-rum-api-client 2.32.2 → 2.33.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
+ # [@adobe/spacecat-shared-rum-api-client-v2.33.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.32.2...@adobe/spacecat-shared-rum-api-client-v2.33.0) (2025-07-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * **rum-api-client:** add latest_scroll metric to traffic-analysis import output ([#849](https://github.com/adobe/spacecat-shared/issues/849)) ([6c219ee](https://github.com/adobe/spacecat-shared/commit/6c219eecb9bf0966e83b5a212c919a20add87fb4))
7
+
1
8
  # [@adobe/spacecat-shared-rum-api-client-v2.32.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.32.1...@adobe/spacecat-shared-rum-api-client-v2.32.2) (2025-07-12)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-rum-api-client",
3
- "version": "2.32.2",
3
+ "version": "2.33.0",
4
4
  "description": "Shared modules of the Spacecat Services - Rum API client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -27,10 +27,12 @@ function getCWV(bundle, metric) {
27
27
  return measurements.length > 0 ? Math.max(...measurements) : null;
28
28
  }
29
29
 
30
- function containsEngagedScroll(bundle) {
31
- return bundle.events
32
- .some((e) => (e.checkpoint === 'viewmedia' || e.checkpoint === 'viewblock') && e.timeDelta >= 10000)
33
- ? 1 : 0;
30
+ function getLatestScroll(bundle) {
31
+ const scrolls = bundle.events
32
+ .filter((e) => e.checkpoint === 'viewmedia' || e.checkpoint === 'viewblock')
33
+ .map((e) => e.timeDelta);
34
+
35
+ return scrolls.length > 0 ? Math.max(...scrolls) : null;
34
36
  }
35
37
 
36
38
  function getNotFound(bundle) {
@@ -98,6 +100,7 @@ async function handler(bundles) {
98
100
  /* eslint-disable camelcase */
99
101
  const trafficData = trafficType(bundle, memo);
100
102
  const clicked = getClicked(bundle);
103
+ const latestScroll = getLatestScroll(bundle);
101
104
 
102
105
  return {
103
106
  path: new URL(bundle.url).pathname,
@@ -113,7 +116,8 @@ async function handler(bundles) {
113
116
  notfound: getNotFound(bundle),
114
117
  pageviews: bundle.weight,
115
118
  clicked,
116
- engaged: containsEngagedScroll(bundle) || clicked,
119
+ engaged: (latestScroll >= 10000 || clicked) ? 1 : 0,
120
+ latest_scroll: latestScroll,
117
121
  lcp: getCWV(bundle, 'lcp'),
118
122
  inp: getCWV(bundle, 'inp'),
119
123
  cls: getCWV(bundle, 'cls'),