@adobe/helix-rum-enhancer 2.31.0-beta.5 → 2.31.0-beta.7

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,48 +1,55 @@
1
- # [2.31.0-beta.5](https://github.com/adobe/helix-rum-enhancer/compare/v2.31.0-beta.4...v2.31.0-beta.5) (2025-01-17)
1
+ # [2.31.0-beta.7](https://github.com/adobe/helix-rum-enhancer/compare/v2.31.0-beta.6...v2.31.0-beta.7) (2025-02-19)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * just forcing a release ([84ab687](https://github.com/adobe/helix-rum-enhancer/commit/84ab68734b5862816a532d4847df0ffa753b0717))
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
+ * do not trigger fill checkpoint for hidden fields ([f6f4c51](https://github.com/adobe/helix-rum-enhancer/commit/f6f4c519d38c48740ace4ba64f47cafc6cea2f47))
9
+ * form elements having name/id as id breaks the sourceSelector logic. ([37bd0ab](https://github.com/adobe/helix-rum-enhancer/commit/37bd0ab4c6bb1aac1326bc9be0097a7ccf038870))
10
+ * implement flood control with 1024 max events ([e06e1e5](https://github.com/adobe/helix-rum-enhancer/commit/e06e1e51b6dd3db0a015f4dcccb3ab8dcfb11b9f))
11
+ * Implement flood control with 1024 max events ([ddfdb1e](https://github.com/adobe/helix-rum-enhancer/commit/ddfdb1e9dd58ff41cbd761774af9ad616290aae0))
12
+ * just forcing a release ([0a643d5](https://github.com/adobe/helix-rum-enhancer/commit/0a643d55440216adc5ca8b66e5cf70b31997b800))
13
+ * plugin path resolution ([f77d736](https://github.com/adobe/helix-rum-enhancer/commit/f77d736a5e52b6e01fb83defe74b5e0f9622c127))
14
+ * plugins are not executing because they are exported as iife ([dfc1eea](https://github.com/adobe/helix-rum-enhancer/commit/dfc1eea7bf230d95456ee2f7ee200e6a37c2f8c3))
15
+ * review feedback ([f4e6dd1](https://github.com/adobe/helix-rum-enhancer/commit/f4e6dd1b3fae8e37024045156c85923e776f40c3))
7
16
 
8
- # [2.31.0-beta.4](https://github.com/adobe/helix-rum-enhancer/compare/v2.31.0-beta.3...v2.31.0-beta.4) (2025-01-16)
9
17
 
18
+ ### Features
10
19
 
11
- ### Bug Fixes
12
-
13
- * plugin path resolution ([f464652](https://github.com/adobe/helix-rum-enhancer/commit/f464652df5bef5f42e0b32c1f10bebef013dd1b0))
20
+ * handle pre-rendering ([3181698](https://github.com/adobe/helix-rum-enhancer/commit/3181698ea202ebb389dd82ab35a8d206a82b2006))
21
+ * **loadresource:** add `allresources` feature flag that enables tracking all resources, not just same host ([a8fa936](https://github.com/adobe/helix-rum-enhancer/commit/a8fa936035f56b13ff8db66f32db17c828318972))
22
+ * **missingresource:** report all resource error with http status code ([e3ad482](https://github.com/adobe/helix-rum-enhancer/commit/e3ad482454e5fe874e5cef5842a08915c53dbad4))
14
23
 
15
- # [2.31.0-beta.3](https://github.com/adobe/helix-rum-enhancer/compare/v2.31.0-beta.2...v2.31.0-beta.3) (2025-01-16)
16
24
 
25
+ ### Reverts
17
26
 
18
- ### Bug Fixes
27
+ * Revert "feat: handle pre-rendering" ([9603927](https://github.com/adobe/helix-rum-enhancer/commit/9603927774966fcfadb3ba3f8f7b42a0c003fd2e))
19
28
 
20
- * bugs and failing tests ([5c9adbc](https://github.com/adobe/helix-rum-enhancer/commit/5c9adbc2502203495a05d4fd2be6e05cc11102df))
21
- * cross-browser compatibility ([1c21afd](https://github.com/adobe/helix-rum-enhancer/commit/1c21afd8cd982d4c33feba863d2251311f36e153))
22
- * set proper url base for plugins ([9726dc8](https://github.com/adobe/helix-rum-enhancer/commit/9726dc8f98bd71936c8a8f430cae73b6a8f5d63f))
23
- * use proper fully qualified URLs for plugin path to avoid CORS ([c73eb31](https://github.com/adobe/helix-rum-enhancer/commit/c73eb31461115529922b82c3a8b678f21052b918))
29
+ ## [2.30.3](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.2...v2.30.3) (2025-02-03)
24
30
 
25
31
 
26
- ### Features
32
+ ### Bug Fixes
27
33
 
28
- * allow external extension via window.RUM_PLUGINS ([4613b00](https://github.com/adobe/helix-rum-enhancer/commit/4613b004c617f4d503355b5c43008149df9101ef))
29
- * inline web-vitals.js ([7d89e9f](https://github.com/adobe/helix-rum-enhancer/commit/7d89e9f664686d3a475ce829d7fb4f68f29ed71b))
30
- * introduce minimal plugin system to offset non-essenial logic ([8642557](https://github.com/adobe/helix-rum-enhancer/commit/8642557beaef5161d1d4d51d2b04ce06bf7dbeb7))
31
- * introduce minimal plugin system to offset non-essenial logic ([6066f0b](https://github.com/adobe/helix-rum-enhancer/commit/6066f0bd56393a10391e190b9a338f9a65b772b0))
34
+ * collect repeating clicks upto max configuration ([6daba19](https://github.com/adobe/helix-rum-enhancer/commit/6daba19b6dcf3717e8330a923a0d87e61e3080ee))
35
+ * comment for max events tracking ([b4b1c6d](https://github.com/adobe/helix-rum-enhancer/commit/b4b1c6da79a31485bb2165382f9fb9ece611a716))
36
+ * implement flood control with 1024 max events ([e06e1e5](https://github.com/adobe/helix-rum-enhancer/commit/e06e1e51b6dd3db0a015f4dcccb3ab8dcfb11b9f))
37
+ * Implement flood control with 1024 max events ([ddfdb1e](https://github.com/adobe/helix-rum-enhancer/commit/ddfdb1e9dd58ff41cbd761774af9ad616290aae0))
38
+ * review feedback ([f4e6dd1](https://github.com/adobe/helix-rum-enhancer/commit/f4e6dd1b3fae8e37024045156c85923e776f40c3))
32
39
 
33
- # [2.31.0-beta.2](https://github.com/adobe/helix-rum-enhancer/compare/v2.31.0-beta.1...v2.31.0-beta.2) (2025-01-16)
40
+ ## [2.30.2](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.1...v2.30.2) (2025-01-17)
34
41
 
35
42
 
36
- ### Reverts
43
+ ### Bug Fixes
37
44
 
38
- * Revert "feat: handle pre-rendering" ([6471af5](https://github.com/adobe/helix-rum-enhancer/commit/6471af5cce4d895ca036a7b04a33530a3715b810))
45
+ * do not trigger fill checkpoint for hidden fields ([f6f4c51](https://github.com/adobe/helix-rum-enhancer/commit/f6f4c519d38c48740ace4ba64f47cafc6cea2f47))
39
46
 
40
- # [2.31.0-beta.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.0...v2.31.0-beta.1) (2025-01-16)
47
+ ## [2.30.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.30.0...v2.30.1) (2025-01-17)
41
48
 
42
49
 
43
- ### Features
50
+ ### Bug Fixes
44
51
 
45
- * handle pre-rendering ([bb11187](https://github.com/adobe/helix-rum-enhancer/commit/bb11187058b8cb521a270c316323b66414a8d817))
52
+ * form elements having name/id as id breaks the sourceSelector logic. ([37bd0ab](https://github.com/adobe/helix-rum-enhancer/commit/37bd0ab4c6bb1aac1326bc9be0097a7ccf038870))
46
53
 
47
54
  # [2.30.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.29.0...v2.30.0) (2025-01-15)
48
55
 
package/README.md CHANGED
@@ -62,10 +62,6 @@ All three parts are optional
62
62
  Even if an `identifier` is provided, having a `context` and `element` is recommended, as it makes the `source` parameter more readable and easier to understand.
63
63
 
64
64
 
65
- #### Examples
66
-
67
- - ``
68
-
69
65
  ## Development
70
66
 
71
67
  ### Build
@@ -85,3 +81,6 @@ $ npm test
85
81
  ```bash
86
82
  $ npm run lint
87
83
  ```
84
+ ### Cutting a Pre-Release
85
+
86
+ Releases are handled by [semantic-release](https://github.com/semantic-release/semantic-release), and will happen automatically when a PR is merged into the `main` or the `1.x` branch. By merging into `beta`, a pre-release will be created.
package/modules/dom.js CHANGED
@@ -41,12 +41,10 @@ function isDialog(el) {
41
41
  // doing it well
42
42
  if (el.tagName === 'DIALOG') return true;
43
43
  // making the best of it
44
- if (el.getAttribute('role') === 'dialog') return true;
45
- if (el.getAttribute('role') === 'alertdialog') return true;
46
- if (el.getAttribute('aria-modal') === 'true') return true;
47
- // doing it wrong
48
44
  const cs = window.getComputedStyle(el);
49
- return (cs && cs.position === 'fixed' && cs.zIndex > 100);
45
+ return ['dialog', 'alertdialog'].find((r) => el.getAttribute('role') === r)
46
+ || el.getAttribute('aria-modal') === 'true'
47
+ || (cs && cs.position === 'fixed' && cs.zIndex > 100);
50
48
  }
51
49
 
52
50
  function isButton(el) {
@@ -62,16 +60,14 @@ function isButton(el) {
62
60
  function getSourceContext(el) {
63
61
  const formEl = el.closest('form');
64
62
  if (formEl) {
65
- return `form${formEl.id ? `#${formEl.id}` : ''}`;
63
+ const id = formEl.getAttribute('id');
64
+ return `form${id ? `#${id}` : ''}`;
66
65
  }
67
66
  const block = el.closest('.block[data-block-name]');
68
- if (block) return `.${block.getAttribute('data-block-name')}`;
69
- if (walk(el, isDialog)) return 'dialog';
70
- if (el.closest('nav')) return 'nav';
71
- if (el.closest('header')) return 'header';
72
- if (el.closest('footer')) return 'footer';
73
- if (el.closest('aside')) return 'aside';
74
- return (walk(el, (e) => e.id && `#${e.id}`));
67
+ return ((block && `.${block.getAttribute('data-block-name')}`)
68
+ || (walk(el, isDialog) && 'dialog')
69
+ || ['nav', 'header', 'footer', 'aside'].find((t) => el.closest(t))
70
+ || walk(el, (e) => e.id && `#${e.id}`));
75
71
  }
76
72
 
77
73
  function getSourceElement(el) {
package/modules/index.js CHANGED
@@ -73,10 +73,16 @@ function loadPlugins(filter = () => true, params = PLUGIN_PARAMETERS) {
73
73
  .filter(([, plugin]) => filter(plugin))
74
74
  .map(([key]) => loadPlugin(key, params));
75
75
  }
76
+ /**
77
+ * Maximum number of events. The first call will be made by rum-js,
78
+ * leaving 1023 events for the enhancer to track
79
+ */
80
+ let maxEvents = 1023;
76
81
 
77
82
  function trackCheckpoint(checkpoint, data, t) {
78
83
  const { weight, id } = window.hlx.rum;
79
- if (isSelected) {
84
+ if (isSelected && maxEvents) {
85
+ maxEvents -= 1;
80
86
  const sendPing = (pdata = data) => {
81
87
  // eslint-disable-next-line object-curly-newline, max-len
82
88
  const body = JSON.stringify({ weight, id, referer: urlSanitizers[window.hlx.RUM_MASK_URL || 'path'](), checkpoint, t, ...data }, KNOWN_PROPERTIES);
@@ -271,16 +277,8 @@ function addTrackingFromConfig() {
271
277
  activateBlocksMO();
272
278
  activateMediaMO();
273
279
 
274
- let lastSource;
275
- let lastTarget;
276
280
  document.addEventListener('click', (event) => {
277
- const source = sourceSelector(event.target);
278
- const target = targetSelector(event.target);
279
- if (source !== lastSource || target !== lastTarget) {
280
- sampleRUM('click', { target, source });
281
- lastSource = source;
282
- lastTarget = target;
283
- }
281
+ sampleRUM('click', { target: targetSelector(event.target), source: sourceSelector(event.target) });
284
282
  });
285
283
 
286
284
  // Core tracking
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.31.0-beta.5",
3
+ "version": "2.31.0-beta.7",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -33,16 +33,16 @@
33
33
  "reporter-options": "configFile=.mocha-multi.json"
34
34
  },
35
35
  "devDependencies": {
36
- "@adobe/eslint-config-helix": "2.0.8",
36
+ "@adobe/eslint-config-helix": "2.0.9",
37
37
  "@adobe/helix-rum-js": "2.10.0",
38
38
  "@esm-bundle/chai": "4.3.4-fix.0",
39
39
  "@rollup/plugin-babel": "6.0.4",
40
40
  "@semantic-release/changelog": "6.0.3",
41
41
  "@semantic-release/git": "10.0.1",
42
42
  "@semantic-release/npm": "12.0.1",
43
- "@web/test-runner": "0.19.0",
43
+ "@web/test-runner": "0.20.0",
44
44
  "@web/test-runner-commands": "0.9.0",
45
- "@web/test-runner-junit-reporter": "0.7.2",
45
+ "@web/test-runner-junit-reporter": "0.8.0",
46
46
  "@web/test-runner-mocha": "0.9.0",
47
47
  "@web/test-runner-playwright": "0.11.0",
48
48
  "c8": "10.1.3",
@@ -53,13 +53,13 @@
53
53
  "husky": "9.1.7",
54
54
  "jsdoc-to-markdown": "9.1.1",
55
55
  "junit-report-builder": "5.1.1",
56
- "lint-staged": "15.3.0",
57
- "mocha": "11.0.1",
56
+ "lint-staged": "15.4.3",
57
+ "mocha": "11.1.0",
58
58
  "mocha-multi-reporters": "1.5.1",
59
- "rollup": "4.30.1",
59
+ "rollup": "4.34.8",
60
60
  "rollup-plugin-checksum": "1.0.1",
61
61
  "rollup-plugin-eslint-bundle": "9.0.0",
62
- "semantic-release": "24.2.1",
62
+ "semantic-release": "24.2.3",
63
63
  "semantic-release-slack-bot": "^4.0.2",
64
64
  "web-vitals": "4.2.4"
65
65
  },
package/plugins/cwv.js CHANGED
@@ -19,6 +19,7 @@ export default function addCWVTracking({
19
19
  setTimeout(() => {
20
20
  try {
21
21
  const cwvScript = new URL('.rum/web-vitals/dist/web-vitals.iife.js', sampleRUM.baseURL).href;
22
+ /* c8 ignore next 3 */
22
23
  if (document.querySelector(`script[src="${cwvScript}"]`)) {
23
24
  // web vitals script has been loaded already
24
25
  return;
package/plugins/form.js CHANGED
@@ -16,10 +16,12 @@ export default function addFormTracking({
16
16
  form.addEventListener('submit', (e) => sampleRUM('formsubmit', { target: targetSelector(e.target), source: sourceSelector(e.target) }), { once: true });
17
17
  let lastSource;
18
18
  form.addEventListener('change', (e) => {
19
- const source = sourceSelector(e.target);
20
- if (source !== lastSource) {
21
- sampleRUM('fill', { source });
22
- lastSource = source;
19
+ if (e.target.checkVisibility()) {
20
+ const source = sourceSelector(e.target);
21
+ if (source !== lastSource) {
22
+ sampleRUM('fill', { source });
23
+ lastSource = source;
24
+ }
23
25
  }
24
26
  });
25
27
  form.addEventListener('focusin', (e) => {
package/rollup.config.js CHANGED
@@ -38,22 +38,23 @@ const bundles = [
38
38
  ...['cwv', 'form', 'martech', 'onetrust', 'video'].map((plugin) => ({
39
39
  source: `plugins/${plugin}.js`,
40
40
  outputFile: `src/plugins/${plugin}`,
41
+ format: 'es',
41
42
  })),
42
43
  ];
43
44
 
44
- export default [...bundles.map(({ outputFile, source }) => ({
45
+ export default [...bundles.map(({ outputFile, source, format }) => ({
45
46
  input: source,
46
47
  output: [
47
48
  {
48
49
  file: `${outputFile}.map.js`,
49
- format: 'iife',
50
+ format: format || 'iife',
50
51
  sourcemap: 'inline',
51
52
  exports: 'auto',
52
53
  banner,
53
54
  },
54
55
  {
55
56
  file: `${outputFile}.js`,
56
- format: 'iife',
57
+ format: format || 'iife',
57
58
  sourcemap: false,
58
59
  exports: 'auto',
59
60
  banner,
package/src/index.js CHANGED
@@ -64,11 +64,8 @@
64
64
  }
65
65
  function isDialog(el) {
66
66
  if (el.tagName === 'DIALOG') return true;
67
- if (el.getAttribute('role') === 'dialog') return true;
68
- if (el.getAttribute('role') === 'alertdialog') return true;
69
- if (el.getAttribute('aria-modal') === 'true') return true;
70
67
  const cs = window.getComputedStyle(el);
71
- return cs && cs.position === 'fixed' && cs.zIndex > 100;
68
+ return ['dialog', 'alertdialog'].find(r => el.getAttribute('role') === r) || el.getAttribute('aria-modal') === 'true' || cs && cs.position === 'fixed' && cs.zIndex > 100;
72
69
  }
73
70
  function isButton(el) {
74
71
  if (el.tagName === 'BUTTON') return true;
@@ -82,16 +79,11 @@
82
79
  function getSourceContext(el) {
83
80
  const formEl = el.closest('form');
84
81
  if (formEl) {
85
- return `form${formEl.id ? `#${formEl.id}` : ''}`;
82
+ const id = formEl.getAttribute('id');
83
+ return `form${id ? `#${id}` : ''}`;
86
84
  }
87
85
  const block = el.closest('.block[data-block-name]');
88
- if (block) return `.${block.getAttribute('data-block-name')}`;
89
- if (walk(el, isDialog)) return 'dialog';
90
- if (el.closest('nav')) return 'nav';
91
- if (el.closest('header')) return 'header';
92
- if (el.closest('footer')) return 'footer';
93
- if (el.closest('aside')) return 'aside';
94
- return walk(el, e => e.id && `#${e.id}`);
86
+ return block && `.${block.getAttribute('data-block-name')}` || walk(el, isDialog) && 'dialog' || ['nav', 'header', 'footer', 'aside'].find(t => el.closest(t)) || walk(el, e => e.id && `#${e.id}`);
95
87
  }
96
88
  function getSourceElement(el) {
97
89
  const f = el.closest('form');
@@ -181,12 +173,14 @@
181
173
  function loadPlugins(filter = () => true, params = PLUGIN_PARAMETERS) {
182
174
  Object.entries(PLUGINS).filter(([, plugin]) => filter(plugin)).map(([key]) => loadPlugin(key, params));
183
175
  }
176
+ let maxEvents = 1023;
184
177
  function trackCheckpoint(checkpoint, data, t) {
185
178
  const {
186
179
  weight,
187
180
  id
188
181
  } = window.hlx.rum;
189
- if (isSelected) {
182
+ if (isSelected && maxEvents) {
183
+ maxEvents -= 1;
190
184
  const sendPing = (pdata = data) => {
191
185
  const body = JSON.stringify({
192
186
  weight,
@@ -365,19 +359,11 @@
365
359
  function addTrackingFromConfig() {
366
360
  activateBlocksMO();
367
361
  activateMediaMO();
368
- let lastSource;
369
- let lastTarget;
370
362
  document.addEventListener('click', event => {
371
- const source = sourceSelector(event.target);
372
- const target = targetSelector(event.target);
373
- if (source !== lastSource || target !== lastTarget) {
374
- sampleRUM('click', {
375
- target,
376
- source
377
- });
378
- lastSource = source;
379
- lastTarget = target;
380
- }
363
+ sampleRUM('click', {
364
+ target: targetSelector(event.target),
365
+ source: sourceSelector(event.target)
366
+ });
381
367
  });
382
368
  addNavigationTracking();
383
369
  addLoadResourceTracking();
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- 6927b0ca98e3d69c532b6b104f0ffb14
1
+ bae386a44a51c5b754217dd50889bce5