@adobe/spacecat-shared-rum-api-client 2.22.3 → 2.22.5

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,17 @@
1
+ # [@adobe/spacecat-shared-rum-api-client-v2.22.5](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.22.4...@adobe/spacecat-shared-rum-api-client-v2.22.5) (2025-04-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update external fixes ([#679](https://github.com/adobe/spacecat-shared/issues/679)) ([a41bf0c](https://github.com/adobe/spacecat-shared/commit/a41bf0cd488efa0f72af0933992edb256302af18))
7
+
8
+ # [@adobe/spacecat-shared-rum-api-client-v2.22.4](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.22.3...@adobe/spacecat-shared-rum-api-client-v2.22.4) (2025-04-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * filter search form events ([#689](https://github.com/adobe/spacecat-shared/issues/689)) ([abde8cd](https://github.com/adobe/spacecat-shared/commit/abde8cd47f98f4aa5753a3105e8a54df4caffa07))
14
+
1
15
  # [@adobe/spacecat-shared-rum-api-client-v2.22.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.22.2...@adobe/spacecat-shared-rum-api-client-v2.22.3) (2025-04-11)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-rum-api-client",
3
- "version": "2.22.3",
3
+ "version": "2.22.5",
4
4
  "description": "Shared modules of the Spacecat Services - Rum API client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -46,9 +46,9 @@
46
46
  "devDependencies": {
47
47
  "chai": "5.2.0",
48
48
  "chai-as-promised": "8.0.1",
49
- "nock": "14.0.1",
49
+ "nock": "14.0.3",
50
50
  "sinon": "20.0.0",
51
51
  "sinon-chai": "4.0.0",
52
- "typescript": "5.8.2"
52
+ "typescript": "5.8.3"
53
53
  }
54
54
  }
@@ -14,8 +14,10 @@ import { DataChunks } from '@adobe/rum-distiller';
14
14
  import trafficAcquisition from './traffic-acquisition.js';
15
15
  import { generateKey, DELIMITER, loadBundles } from '../utils.js';
16
16
 
17
- const FORM_SOURCE = ['.form', '.marketo', '.marketo-form'];
17
+ const FORM_SOURCE = [/\bform\b/, /\.marketo/];
18
18
  const METRICS = ['formview', 'formengagement', 'formsubmit', 'formbuttonclick'];
19
+ const CHECKPOINTS = ['viewblock', 'click', 'fill', 'formsubmit', 'navigate'];
20
+ const KEYWORDS_TO_FILTER = ['search'];
19
21
 
20
22
  function initializeResult(url) {
21
23
  return {
@@ -29,9 +31,29 @@ function initializeResult(url) {
29
31
  };
30
32
  }
31
33
 
34
+ function filterEvents(bundles) {
35
+ return bundles.map((bundle) => ({
36
+ ...bundle,
37
+ events: bundle.events.filter((event) => {
38
+ if (!CHECKPOINTS.includes(event.checkpoint)) {
39
+ return false;
40
+ }
41
+
42
+ if (event.checkpoint === 'navigate') {
43
+ return true;
44
+ }
45
+
46
+ const isFormRelatedEvent = ['fill', 'formsubmit'].includes(event.checkpoint)
47
+ || /\bform\b/.test(event.source);
48
+ return isFormRelatedEvent && !KEYWORDS_TO_FILTER.some((keyword) => event.source
49
+ && event.source.toLowerCase().includes(keyword));
50
+ }),
51
+ }));
52
+ }
53
+
32
54
  const metricFns = {
33
55
  formview: (bundle) => {
34
- const formView = bundle.events.find((e) => e.checkpoint === 'viewblock' && FORM_SOURCE.includes(e.source));
56
+ const formView = bundle.events.find((e) => e.checkpoint === 'viewblock' && FORM_SOURCE.some((regex) => regex.test(e.source)));
35
57
  return formView ? bundle.weight : 0;
36
58
  },
37
59
  formengagement: (bundle) => {
@@ -106,8 +128,11 @@ function containsFormVitals(row) {
106
128
  }
107
129
 
108
130
  function handler(bundles) {
131
+ // Filter out search related events
132
+ const bundlesWithFilteredEvents = filterEvents(bundles);
133
+
109
134
  const dataChunks = new DataChunks();
110
- loadBundles(bundles, dataChunks);
135
+ loadBundles(bundlesWithFilteredEvents, dataChunks);
111
136
 
112
137
  // groups by url and user agent
113
138
  dataChunks.addFacet('urlUserAgents', (bundle) => generateKey(bundle.url, bundle.userAgent));
@@ -147,5 +172,5 @@ function handler(bundles) {
147
172
 
148
173
  export default {
149
174
  handler,
150
- checkpoints: ['viewblock', 'formsubmit', 'click', 'navigate'],
175
+ checkpoints: CHECKPOINTS,
151
176
  };