@adobe/helix-rum-enhancer 2.23.0 → 2.25.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 +7 -1
- package/CHANGELOG.md +15 -0
- package/modules/dom.js +9 -2
- package/modules/fflags.js +1 -0
- package/modules/index.js +12 -2
- package/package.json +7 -6
- package/src/index.js +22 -4
- package/src/index.md5 +1 -1
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,18 @@
|
|
|
1
|
+
# [2.25.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.24.0...v2.25.0) (2024-10-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* capturing id of form and button type inside a form ([#293](https://github.com/adobe/helix-rum-enhancer/issues/293)) ([530572f](https://github.com/adobe/helix-rum-enhancer/commit/530572f7c441c72f8d5f7683bef7490d37186a9f))
|
|
7
|
+
|
|
8
|
+
# [2.24.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.23.0...v2.24.0) (2024-09-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **navigation:** add support for `redirect` checkpoint ([87b2c05](https://github.com/adobe/helix-rum-enhancer/commit/87b2c057a5e0afbe21cd6224bd995f48ebafa30e))
|
|
14
|
+
* **redirect:** support soft-redirects ([00392c1](https://github.com/adobe/helix-rum-enhancer/commit/00392c18ad8a0677437f5846b9e63ea32df163cb))
|
|
15
|
+
|
|
1
16
|
# [2.23.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.22.0...v2.23.0) (2024-09-19)
|
|
2
17
|
|
|
3
18
|
|
package/modules/dom.js
CHANGED
|
@@ -61,7 +61,9 @@ function isButton(element) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function getSourceContext(element) {
|
|
64
|
-
if (element.closest('form'))
|
|
64
|
+
if (element.closest('form')) {
|
|
65
|
+
return `form${element.id ? `#${element.id}` : ''}`;
|
|
66
|
+
}
|
|
65
67
|
const block = element.closest('.block[data-block-name]');
|
|
66
68
|
if (block) return `.${block.getAttribute('data-block-name')}`;
|
|
67
69
|
if (walk(element, isDialog)) return 'dialog';
|
|
@@ -73,7 +75,12 @@ function getSourceContext(element) {
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
function getSourceElement(element) {
|
|
76
|
-
if (element.closest('form') && Array.from(element.closest('form').elements).includes(element))
|
|
78
|
+
if (element.closest('form') && Array.from(element.closest('form').elements).includes(element)) {
|
|
79
|
+
return (element.tagName.toLowerCase()
|
|
80
|
+
+ (['INPUT', 'BUTTON'].includes(element.tagName)
|
|
81
|
+
? `[type='${element.getAttribute('type') || ''}']`
|
|
82
|
+
: ''));
|
|
83
|
+
}
|
|
77
84
|
if (walk(element, isButton)) return 'button';
|
|
78
85
|
return element.tagName.toLowerCase().match(/^(a|img|video)$/) && element.tagName.toLowerCase();
|
|
79
86
|
}
|
package/modules/fflags.js
CHANGED
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(
|
|
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.
|
|
3
|
+
"version": "2.25.0",
|
|
4
4
|
"description": "Helix RUM Enhancer",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -49,16 +49,17 @@
|
|
|
49
49
|
"eslint-plugin-header": "3.1.1",
|
|
50
50
|
"eslint-plugin-import": "2.30.0",
|
|
51
51
|
"husky": "9.1.6",
|
|
52
|
-
"jsdoc-to-markdown": "9.0.
|
|
53
|
-
"junit-report-builder": "5.
|
|
52
|
+
"jsdoc-to-markdown": "9.0.2",
|
|
53
|
+
"junit-report-builder": "5.1.1",
|
|
54
54
|
"lint-staged": "15.2.10",
|
|
55
55
|
"mocha": "10.7.3",
|
|
56
56
|
"mocha-multi-reporters": "1.5.1",
|
|
57
|
-
"rollup": "4.
|
|
58
|
-
"rollup-plugin-cleanup": "3.2.1",
|
|
57
|
+
"rollup": "4.24.0",
|
|
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
|
-
"semantic-release": "24.1.
|
|
61
|
+
"semantic-release": "24.1.2",
|
|
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
|
};
|
|
@@ -79,7 +80,9 @@
|
|
|
79
80
|
return element.getAttribute('role') === 'button';
|
|
80
81
|
}
|
|
81
82
|
function getSourceContext(element) {
|
|
82
|
-
if (element.closest('form'))
|
|
83
|
+
if (element.closest('form')) {
|
|
84
|
+
return `form${element.id ? `#${element.id}` : ''}`;
|
|
85
|
+
}
|
|
83
86
|
const block = element.closest('.block[data-block-name]');
|
|
84
87
|
if (block) return `.${block.getAttribute('data-block-name')}`;
|
|
85
88
|
if (walk(element, isDialog)) return 'dialog';
|
|
@@ -90,7 +93,12 @@
|
|
|
90
93
|
return (walk(element, (e) => e.id && `#${e.id}`));
|
|
91
94
|
}
|
|
92
95
|
function getSourceElement(element) {
|
|
93
|
-
if (element.closest('form') && Array.from(element.closest('form').elements).includes(element))
|
|
96
|
+
if (element.closest('form') && Array.from(element.closest('form').elements).includes(element)) {
|
|
97
|
+
return (element.tagName.toLowerCase()
|
|
98
|
+
+ (['INPUT', 'BUTTON'].includes(element.tagName)
|
|
99
|
+
? `[type='${element.getAttribute('type') || ''}']`
|
|
100
|
+
: ''));
|
|
101
|
+
}
|
|
94
102
|
if (walk(element, isButton)) return 'button';
|
|
95
103
|
return element.tagName.toLowerCase().match(/^(a|img|video)$/) && element.tagName.toLowerCase();
|
|
96
104
|
}
|
|
@@ -256,7 +264,7 @@
|
|
|
256
264
|
}, 2000);
|
|
257
265
|
}
|
|
258
266
|
function addNavigationTracking() {
|
|
259
|
-
const navigate = (source, type) => {
|
|
267
|
+
const navigate = (source, type, redirectCount) => {
|
|
260
268
|
const payload = { source, target: document.visibilityState };
|
|
261
269
|
if (type === 'reload' || source === window.location.href) {
|
|
262
270
|
sampleRUM('reload', payload);
|
|
@@ -267,9 +275,19 @@
|
|
|
267
275
|
} else {
|
|
268
276
|
sampleRUM('enter', payload);
|
|
269
277
|
}
|
|
278
|
+
fflags.enabled('redirect', () => {
|
|
279
|
+
const from = new URLSearchParams(window.location.search).get('redirect-from');
|
|
280
|
+
if (redirectCount || from) {
|
|
281
|
+
sampleRUM('redirect', { source: from, target: redirectCount || 1 });
|
|
282
|
+
}
|
|
283
|
+
});
|
|
270
284
|
};
|
|
271
285
|
new PerformanceObserver((list) => list
|
|
272
|
-
.getEntries().map((entry) => navigate(
|
|
286
|
+
.getEntries().map((entry) => navigate(
|
|
287
|
+
window.hlx.referrer || document.referrer,
|
|
288
|
+
entry.type,
|
|
289
|
+
entry.redirectCount,
|
|
290
|
+
)))
|
|
273
291
|
.observe({ type: 'navigation', buffered: true });
|
|
274
292
|
}
|
|
275
293
|
function addLoadResourceTracking() {
|
package/src/index.md5
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f87fdcb7d5c1e4526225b185d4f392fb
|