@adobe/helix-rum-enhancer 2.30.1 → 2.30.3

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,21 @@
1
+ ## [2.30.3](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.2...v2.30.3) (2025-02-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * collect repeating clicks upto max configuration ([6daba19](https://github.com/adobe/helix-rum-enhancer/commit/6daba19b6dcf3717e8330a923a0d87e61e3080ee))
7
+ * comment for max events tracking ([b4b1c6d](https://github.com/adobe/helix-rum-enhancer/commit/b4b1c6da79a31485bb2165382f9fb9ece611a716))
8
+ * implement flood control with 1024 max events ([e06e1e5](https://github.com/adobe/helix-rum-enhancer/commit/e06e1e51b6dd3db0a015f4dcccb3ab8dcfb11b9f))
9
+ * Implement flood control with 1024 max events ([ddfdb1e](https://github.com/adobe/helix-rum-enhancer/commit/ddfdb1e9dd58ff41cbd761774af9ad616290aae0))
10
+ * review feedback ([f4e6dd1](https://github.com/adobe/helix-rum-enhancer/commit/f4e6dd1b3fae8e37024045156c85923e776f40c3))
11
+
12
+ ## [2.30.2](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.1...v2.30.2) (2025-01-17)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * do not trigger fill checkpoint for hidden fields ([f6f4c51](https://github.com/adobe/helix-rum-enhancer/commit/f6f4c519d38c48740ace4ba64f47cafc6cea2f47))
18
+
1
19
  ## [2.30.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.0...v2.30.1) (2025-01-17)
2
20
 
3
21
 
package/modules/index.js CHANGED
@@ -34,10 +34,16 @@ const blocksMO = window.MutationObserver ? new MutationObserver(blocksMCB)
34
34
  // eslint-disable-next-line no-use-before-define, max-len
35
35
  const mediaMO = window.MutationObserver ? new MutationObserver(mediaMCB)
36
36
  /* c8 ignore next */ : {};
37
+ /**
38
+ * Maximum number of events. The first call will be made by rum-js,
39
+ * leaving 1023 events for the enhancer to track
40
+ */
41
+ let maxEvents = 1023;
37
42
 
38
43
  function trackCheckpoint(checkpoint, data, t) {
39
44
  const { weight, id } = window.hlx.rum;
40
- if (isSelected) {
45
+ if (isSelected && maxEvents) {
46
+ maxEvents -= 1;
41
47
  const sendPing = (pdata = data) => {
42
48
  // eslint-disable-next-line object-curly-newline, max-len
43
49
  const body = JSON.stringify({ weight, id, referer: urlSanitizers[window.hlx.RUM_MASK_URL || 'path'](), checkpoint, t, ...data }, KNOWN_PROPERTIES);
@@ -258,10 +264,12 @@ function addFormTracking(parent) {
258
264
  form.addEventListener('submit', (e) => sampleRUM('formsubmit', { target: targetSelector(e.target), source: sourceSelector(e.target) }), { once: true });
259
265
  let lastSource;
260
266
  form.addEventListener('change', (e) => {
261
- const source = sourceSelector(e.target);
262
- if (source !== lastSource) {
263
- sampleRUM('fill', { source });
264
- lastSource = source;
267
+ if (e.target.checkVisibility()) {
268
+ const source = sourceSelector(e.target);
269
+ if (source !== lastSource) {
270
+ sampleRUM('fill', { source });
271
+ lastSource = source;
272
+ }
265
273
  }
266
274
  });
267
275
  form.addEventListener('focusin', (e) => {
@@ -299,17 +307,10 @@ function mediaMCB(mutations) {
299
307
  }
300
308
 
301
309
  function addTrackingFromConfig() {
302
- let lastSource;
303
- let lastTarget;
304
310
  document.addEventListener('click', (event) => {
305
- const source = sourceSelector(event.target);
306
- const target = targetSelector(event.target);
307
- if (source !== lastSource || target !== lastTarget) {
308
- sampleRUM('click', { target, source });
309
- lastSource = source;
310
- lastTarget = target;
311
- }
311
+ sampleRUM('click', { target: targetSelector(event.target), source: sourceSelector(event.target) });
312
312
  });
313
+
313
314
  addCWVTracking();
314
315
  addFormTracking(window.document.body);
315
316
  addNavigationTracking();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.30.1",
3
+ "version": "2.30.3",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -52,10 +52,10 @@
52
52
  "husky": "9.1.7",
53
53
  "jsdoc-to-markdown": "9.1.1",
54
54
  "junit-report-builder": "5.1.1",
55
- "lint-staged": "15.3.0",
56
- "mocha": "11.0.1",
55
+ "lint-staged": "15.4.3",
56
+ "mocha": "11.1.0",
57
57
  "mocha-multi-reporters": "1.5.1",
58
- "rollup": "4.30.1",
58
+ "rollup": "4.32.0",
59
59
  "rollup-plugin-checksum": "1.0.1",
60
60
  "rollup-plugin-cleanup": "3.2.1",
61
61
  "rollup-plugin-eslint-bundle": "9.0.0",
package/src/index.js CHANGED
@@ -199,9 +199,11 @@
199
199
  : {};
200
200
  const mediaMO = window.MutationObserver ? new MutationObserver(mediaMCB)
201
201
  : {};
202
+ let maxEvents = 1023;
202
203
  function trackCheckpoint(checkpoint, data, t) {
203
204
  const { weight, id } = window.hlx.rum;
204
- if (isSelected) {
205
+ if (isSelected && maxEvents) {
206
+ maxEvents -= 1;
205
207
  const sendPing = (pdata = data) => {
206
208
  const body = JSON.stringify({ weight, id, referer: urlSanitizers[window.hlx.RUM_MASK_URL || 'path'](), checkpoint, t, ...data }, KNOWN_PROPERTIES);
207
209
  const urlParams = window.RUM_PARAMS ? `?${new URLSearchParams(window.RUM_PARAMS).toString()}` : '';
@@ -387,10 +389,12 @@
387
389
  form.addEventListener('submit', (e) => sampleRUM('formsubmit', { target: targetSelector(e.target), source: sourceSelector(e.target) }), { once: true });
388
390
  let lastSource;
389
391
  form.addEventListener('change', (e) => {
390
- const source = sourceSelector(e.target);
391
- if (source !== lastSource) {
392
- sampleRUM('fill', { source });
393
- lastSource = source;
392
+ if (e.target.checkVisibility()) {
393
+ const source = sourceSelector(e.target);
394
+ if (source !== lastSource) {
395
+ sampleRUM('fill', { source });
396
+ lastSource = source;
397
+ }
394
398
  }
395
399
  });
396
400
  form.addEventListener('focusin', (e) => {
@@ -420,16 +424,8 @@
420
424
  });
421
425
  }
422
426
  function addTrackingFromConfig() {
423
- let lastSource;
424
- let lastTarget;
425
427
  document.addEventListener('click', (event) => {
426
- const source = sourceSelector(event.target);
427
- const target = targetSelector(event.target);
428
- if (source !== lastSource || target !== lastTarget) {
429
- sampleRUM('click', { target, source });
430
- lastSource = source;
431
- lastTarget = target;
432
- }
428
+ sampleRUM('click', { target: targetSelector(event.target), source: sourceSelector(event.target) });
433
429
  });
434
430
  addCWVTracking();
435
431
  addFormTracking(window.document.body);
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- 749947aafb5daf964780e64146edf135
1
+ 6a3cb05a18fc7e179bd98f2c310e8e21