@adobe/helix-rum-enhancer 2.23.0 → 2.24.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/.releaserc.cjs CHANGED
@@ -21,7 +21,13 @@ module.exports = {
21
21
  "label": "RUM Enhancer Hash"
22
22
  }
23
23
  ]
24
- }]
24
+ }],
25
+ ["semantic-release-slack-bot", {
26
+ notifyOnSuccess: true,
27
+ notifyOnFail: true,
28
+ markdownReleaseNotes: true,
29
+ slackChannel: "rum-explorers",
30
+ }],
25
31
  ],
26
32
  branches: ['main'],
27
33
  };
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [2.24.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.23.0...v2.24.0) (2024-09-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * **navigation:** add support for `redirect` checkpoint ([87b2c05](https://github.com/adobe/helix-rum-enhancer/commit/87b2c057a5e0afbe21cd6224bd995f48ebafa30e))
7
+ * **redirect:** support soft-redirects ([00392c1](https://github.com/adobe/helix-rum-enhancer/commit/00392c18ad8a0677437f5846b9e63ea32df163cb))
8
+
1
9
  # [2.23.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.22.0...v2.23.0) (2024-09-19)
2
10
 
3
11
 
package/modules/fflags.js CHANGED
@@ -18,6 +18,7 @@ export const fflags = {
18
18
  /* c8 ignore next */
19
19
  disabled: (flag, callback) => !fflags.has(flag) && callback(),
20
20
  eagercwv: [683],
21
+ redirect: [620, 1139],
21
22
  example: [543, 770, 1136],
22
23
  language: [543, 959, 1139, 620],
23
24
  };
package/modules/index.js CHANGED
@@ -111,7 +111,7 @@ function addCWVTracking() {
111
111
 
112
112
  function addNavigationTracking() {
113
113
  // enter checkpoint when referrer is not the current page url
114
- const navigate = (source, type) => {
114
+ const navigate = (source, type, redirectCount) => {
115
115
  const payload = { source, target: document.visibilityState };
116
116
  // reload: same page, navigate: same origin, enter: everything else
117
117
  if (type === 'reload' || source === window.location.href) {
@@ -123,10 +123,20 @@ function addNavigationTracking() {
123
123
  } else {
124
124
  sampleRUM('enter', payload); // enter site
125
125
  }
126
+ fflags.enabled('redirect', () => {
127
+ const from = new URLSearchParams(window.location.search).get('redirect-from');
128
+ if (redirectCount || from) {
129
+ sampleRUM('redirect', { source: from, target: redirectCount || 1 });
130
+ }
131
+ });
126
132
  };
127
133
 
128
134
  new PerformanceObserver((list) => list
129
- .getEntries().map((entry) => navigate(window.hlx.referrer || document.referrer, entry.type)))
135
+ .getEntries().map((entry) => navigate(
136
+ window.hlx.referrer || document.referrer,
137
+ entry.type,
138
+ entry.redirectCount,
139
+ )))
130
140
  .observe({ type: 'navigation', buffered: true });
131
141
  }
132
142
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.23.0",
3
+ "version": "2.24.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -55,10 +55,11 @@
55
55
  "mocha": "10.7.3",
56
56
  "mocha-multi-reporters": "1.5.1",
57
57
  "rollup": "4.21.3",
58
- "rollup-plugin-cleanup": "3.2.1",
59
58
  "rollup-plugin-checksum": "1.0.1",
59
+ "rollup-plugin-cleanup": "3.2.1",
60
60
  "rollup-plugin-eslint-bundle": "9.0.0",
61
61
  "semantic-release": "24.1.1",
62
+ "semantic-release-slack-bot": "^4.0.2",
62
63
  "web-vitals": "4.2.3"
63
64
  },
64
65
  "lint-staged": {
package/src/index.js CHANGED
@@ -20,6 +20,7 @@
20
20
  enabled: (flag, callback) => fflags.has(flag) && callback(),
21
21
  disabled: (flag, callback) => !fflags.has(flag) && callback(),
22
22
  eagercwv: [683],
23
+ redirect: [620, 1139],
23
24
  example: [543, 770, 1136],
24
25
  language: [543, 959, 1139, 620],
25
26
  };
@@ -256,7 +257,7 @@
256
257
  }, 2000);
257
258
  }
258
259
  function addNavigationTracking() {
259
- const navigate = (source, type) => {
260
+ const navigate = (source, type, redirectCount) => {
260
261
  const payload = { source, target: document.visibilityState };
261
262
  if (type === 'reload' || source === window.location.href) {
262
263
  sampleRUM('reload', payload);
@@ -267,9 +268,19 @@
267
268
  } else {
268
269
  sampleRUM('enter', payload);
269
270
  }
271
+ fflags.enabled('redirect', () => {
272
+ const from = new URLSearchParams(window.location.search).get('redirect-from');
273
+ if (redirectCount || from) {
274
+ sampleRUM('redirect', { source: from, target: redirectCount || 1 });
275
+ }
276
+ });
270
277
  };
271
278
  new PerformanceObserver((list) => list
272
- .getEntries().map((entry) => navigate(window.hlx.referrer || document.referrer, entry.type)))
279
+ .getEntries().map((entry) => navigate(
280
+ window.hlx.referrer || document.referrer,
281
+ entry.type,
282
+ entry.redirectCount,
283
+ )))
273
284
  .observe({ type: 'navigation', buffered: true });
274
285
  }
275
286
  function addLoadResourceTracking() {
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- 976e9a76103a41b4ee4ddcb398932250
1
+ 734919c8255ab6180ebd17f83f09b78f