@atlaskit/react-ufo 3.4.5 → 3.4.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 +16 -0
- package/dist/cjs/create-payload/index.js +2 -2
- package/dist/cjs/vc/vc-observer/index.js +4 -3
- package/dist/cjs/vc/vc-observer-new/get-element-name.js +7 -1
- package/dist/cjs/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +1 -2
- package/dist/es2019/vc/vc-observer/index.js +2 -1
- package/dist/es2019/vc/vc-observer-new/get-element-name.js +7 -1
- package/dist/esm/create-payload/index.js +2 -2
- package/dist/esm/vc/vc-observer/index.js +4 -3
- package/dist/esm/vc/vc-observer-new/get-element-name.js +7 -1
- package/dist/esm/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +1 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 3.4.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#132798](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132798)
|
|
8
|
+
[`b337a06491cd8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b337a06491cd8) -
|
|
9
|
+
fix page visibility check on VC observer
|
|
10
|
+
|
|
11
|
+
## 3.4.6
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#131564](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131564)
|
|
16
|
+
[`e4cc2be4d7e50`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e4cc2be4d7e50) -
|
|
17
|
+
Fix get element name to use data vc by default unless specifically disabled
|
|
18
|
+
|
|
3
19
|
## 3.4.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -63,14 +63,14 @@ function getUfoNameOverride(interaction) {
|
|
|
63
63
|
function getEarliestLegacyStopTime(interaction, labelStack) {
|
|
64
64
|
var earliestLegacyStopTime = null;
|
|
65
65
|
interaction.apdex.forEach(function (a) {
|
|
66
|
-
var _a$labelStack
|
|
66
|
+
var _a$labelStack;
|
|
67
67
|
if (!(a !== null && a !== void 0 && a.stopTime)) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
if (!(0, _utils.labelStackStartWith)((_a$labelStack = a.labelStack) !== null && _a$labelStack !== void 0 ? _a$labelStack : [], labelStack)) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
if (a.stopTime > interaction.start && (
|
|
73
|
+
if (a.stopTime > interaction.start && (earliestLegacyStopTime !== null && earliestLegacyStopTime !== void 0 ? earliestLegacyStopTime : a.stopTime) >= a.stopTime) {
|
|
74
74
|
earliestLegacyStopTime = a.stopTime;
|
|
75
75
|
}
|
|
76
76
|
});
|
|
@@ -104,7 +104,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
104
104
|
});
|
|
105
105
|
(0, _defineProperty2.default)(this, "getVCResult", /*#__PURE__*/function () {
|
|
106
106
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref3) {
|
|
107
|
-
var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, _VCObserver$calculate, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, isVCClean, isMultiHeatmapEnabled, pageVisibilityUpToTTAI, shouldHaveVCmetric, revisionsData, isCalcSpeedIndexEnabled, speedIndex;
|
|
107
|
+
var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, _VCObserver$calculate, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, isVCClean, isMultiHeatmapEnabled, pageVisibilityUpToTTAI, isVisiblePageVisibleUpToTTAI, shouldHaveVCmetric, revisionsData, isCalcSpeedIndexEnabled, speedIndex;
|
|
108
108
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
109
109
|
while (1) switch (_context.prev = _context.next) {
|
|
110
110
|
case 0:
|
|
@@ -244,7 +244,8 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
244
244
|
isVCClean = !abortReasonInfo;
|
|
245
245
|
isMultiHeatmapEnabled = !(0, _platformFeatureFlags.fg)('platform_ufo_multiheatmap_killswitch');
|
|
246
246
|
pageVisibilityUpToTTAI = (0, _hiddenTiming.getPageVisibilityState)(start, stop);
|
|
247
|
-
|
|
247
|
+
isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
|
|
248
|
+
shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
|
|
248
249
|
revisionsData = isMultiHeatmapEnabled ? (0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new') ? (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:rev"), [{
|
|
249
250
|
revision: 'fy25.01',
|
|
250
251
|
clean: isVCClean,
|
|
@@ -290,7 +291,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
290
291
|
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
291
292
|
'metrics:vc': VC
|
|
292
293
|
}, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
|
|
293
|
-
case
|
|
294
|
+
case 28:
|
|
294
295
|
case "end":
|
|
295
296
|
return _context.stop();
|
|
296
297
|
}
|
|
@@ -16,6 +16,9 @@ function getElementName(selectorConfig, element) {
|
|
|
16
16
|
// Get the tag name of the element.
|
|
17
17
|
var tagName = element.localName;
|
|
18
18
|
var encodeValue = function encodeValue(s) {
|
|
19
|
+
if (typeof encodeURIComponent !== 'function') {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
19
22
|
try {
|
|
20
23
|
return encodeURIComponent(s);
|
|
21
24
|
} catch (e) {
|
|
@@ -26,6 +29,9 @@ function getElementName(selectorConfig, element) {
|
|
|
26
29
|
// Helper function to construct attribute selectors.
|
|
27
30
|
var getAttributeSelector = function getAttributeSelector(attributeName) {
|
|
28
31
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
32
|
+
if (element && typeof element.getAttribute !== 'function') {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
29
35
|
var attrValue = element.getAttribute(attributeName);
|
|
30
36
|
if (!attrValue) {
|
|
31
37
|
return '';
|
|
@@ -35,7 +41,7 @@ function getElementName(selectorConfig, element) {
|
|
|
35
41
|
};
|
|
36
42
|
|
|
37
43
|
// Construct the data-vc attribute selector if specified in the config.
|
|
38
|
-
var dataVC = selectorConfig.dataVC ? getAttributeSelector('data-vc') : '';
|
|
44
|
+
var dataVC = selectorConfig.dataVC !== false ? getAttributeSelector('data-vc') : '';
|
|
39
45
|
|
|
40
46
|
// Construct the ID selector if specified in the config and the element has an ID.
|
|
41
47
|
var id = selectorConfig.id && element.id ? "#".concat(encodeValue(element.id)) : '';
|
|
@@ -17,7 +17,6 @@ function createIntersectionObserver(args) {
|
|
|
17
17
|
var validEntries = [];
|
|
18
18
|
var startTime = performance.now();
|
|
19
19
|
entries.forEach(function (entry) {
|
|
20
|
-
var _mutationTag;
|
|
21
20
|
if (!(entry.target instanceof HTMLElement) || !isValidEntry(entry)) {
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
@@ -44,7 +43,7 @@ function createIntersectionObserver(args) {
|
|
|
44
43
|
target: entry.target,
|
|
45
44
|
rect: entry.intersectionRect,
|
|
46
45
|
time: entry.time,
|
|
47
|
-
type:
|
|
46
|
+
type: mutationTag !== null && mutationTag !== void 0 ? mutationTag : 'unknown',
|
|
48
47
|
mutationData: mutationData
|
|
49
48
|
});
|
|
50
49
|
validEntries.push(new WeakRef(entry.target));
|
|
@@ -254,7 +254,8 @@ export class VCObserver {
|
|
|
254
254
|
const isVCClean = !abortReasonInfo;
|
|
255
255
|
const isMultiHeatmapEnabled = !fg('platform_ufo_multiheatmap_killswitch');
|
|
256
256
|
const pageVisibilityUpToTTAI = getPageVisibilityState(start, stop);
|
|
257
|
-
const
|
|
257
|
+
const isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
|
|
258
|
+
const shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
|
|
258
259
|
const revisionsData = isMultiHeatmapEnabled ? fg('platform_ufo_vc_observer_new') ? {
|
|
259
260
|
[`${fullPrefix}vc:rev`]: [{
|
|
260
261
|
revision: 'fy25.01',
|
|
@@ -10,6 +10,9 @@ export default function getElementName(selectorConfig, element) {
|
|
|
10
10
|
// Get the tag name of the element.
|
|
11
11
|
const tagName = element.localName;
|
|
12
12
|
const encodeValue = s => {
|
|
13
|
+
if (typeof encodeURIComponent !== 'function') {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
13
16
|
try {
|
|
14
17
|
return encodeURIComponent(s);
|
|
15
18
|
} catch (e) {
|
|
@@ -19,6 +22,9 @@ export default function getElementName(selectorConfig, element) {
|
|
|
19
22
|
|
|
20
23
|
// Helper function to construct attribute selectors.
|
|
21
24
|
const getAttributeSelector = (attributeName, prefix = '') => {
|
|
25
|
+
if (element && typeof element.getAttribute !== 'function') {
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
22
28
|
const attrValue = element.getAttribute(attributeName);
|
|
23
29
|
if (!attrValue) {
|
|
24
30
|
return '';
|
|
@@ -28,7 +34,7 @@ export default function getElementName(selectorConfig, element) {
|
|
|
28
34
|
};
|
|
29
35
|
|
|
30
36
|
// Construct the data-vc attribute selector if specified in the config.
|
|
31
|
-
const dataVC = selectorConfig.dataVC ? getAttributeSelector('data-vc') : '';
|
|
37
|
+
const dataVC = selectorConfig.dataVC !== false ? getAttributeSelector('data-vc') : '';
|
|
32
38
|
|
|
33
39
|
// Construct the ID selector if specified in the config and the element has an ID.
|
|
34
40
|
const id = selectorConfig.id && element.id ? `#${encodeValue(element.id)}` : '';
|
|
@@ -52,14 +52,14 @@ function getUfoNameOverride(interaction) {
|
|
|
52
52
|
function getEarliestLegacyStopTime(interaction, labelStack) {
|
|
53
53
|
var earliestLegacyStopTime = null;
|
|
54
54
|
interaction.apdex.forEach(function (a) {
|
|
55
|
-
var _a$labelStack
|
|
55
|
+
var _a$labelStack;
|
|
56
56
|
if (!(a !== null && a !== void 0 && a.stopTime)) {
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
if (!labelStackStartWith((_a$labelStack = a.labelStack) !== null && _a$labelStack !== void 0 ? _a$labelStack : [], labelStack)) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
if (a.stopTime > interaction.start && (
|
|
62
|
+
if (a.stopTime > interaction.start && (earliestLegacyStopTime !== null && earliestLegacyStopTime !== void 0 ? earliestLegacyStopTime : a.stopTime) >= a.stopTime) {
|
|
63
63
|
earliestLegacyStopTime = a.stopTime;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
@@ -97,7 +97,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
97
97
|
});
|
|
98
98
|
_defineProperty(this, "getVCResult", /*#__PURE__*/function () {
|
|
99
99
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
|
|
100
|
-
var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, _VCObserver$calculate, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, isVCClean, isMultiHeatmapEnabled, pageVisibilityUpToTTAI, shouldHaveVCmetric, revisionsData, isCalcSpeedIndexEnabled, speedIndex;
|
|
100
|
+
var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, _VCObserver$calculate, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, isVCClean, isMultiHeatmapEnabled, pageVisibilityUpToTTAI, isVisiblePageVisibleUpToTTAI, shouldHaveVCmetric, revisionsData, isCalcSpeedIndexEnabled, speedIndex;
|
|
101
101
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
102
102
|
while (1) switch (_context.prev = _context.next) {
|
|
103
103
|
case 0:
|
|
@@ -237,7 +237,8 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
237
237
|
isVCClean = !abortReasonInfo;
|
|
238
238
|
isMultiHeatmapEnabled = !fg('platform_ufo_multiheatmap_killswitch');
|
|
239
239
|
pageVisibilityUpToTTAI = getPageVisibilityState(start, stop);
|
|
240
|
-
|
|
240
|
+
isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
|
|
241
|
+
shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
|
|
241
242
|
revisionsData = isMultiHeatmapEnabled ? fg('platform_ufo_vc_observer_new') ? _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [{
|
|
242
243
|
revision: 'fy25.01',
|
|
243
244
|
clean: isVCClean,
|
|
@@ -283,7 +284,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
283
284
|
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
284
285
|
'metrics:vc': VC
|
|
285
286
|
}, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
|
|
286
|
-
case
|
|
287
|
+
case 28:
|
|
287
288
|
case "end":
|
|
288
289
|
return _context.stop();
|
|
289
290
|
}
|
|
@@ -10,6 +10,9 @@ export default function getElementName(selectorConfig, element) {
|
|
|
10
10
|
// Get the tag name of the element.
|
|
11
11
|
var tagName = element.localName;
|
|
12
12
|
var encodeValue = function encodeValue(s) {
|
|
13
|
+
if (typeof encodeURIComponent !== 'function') {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
13
16
|
try {
|
|
14
17
|
return encodeURIComponent(s);
|
|
15
18
|
} catch (e) {
|
|
@@ -20,6 +23,9 @@ export default function getElementName(selectorConfig, element) {
|
|
|
20
23
|
// Helper function to construct attribute selectors.
|
|
21
24
|
var getAttributeSelector = function getAttributeSelector(attributeName) {
|
|
22
25
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
26
|
+
if (element && typeof element.getAttribute !== 'function') {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
23
29
|
var attrValue = element.getAttribute(attributeName);
|
|
24
30
|
if (!attrValue) {
|
|
25
31
|
return '';
|
|
@@ -29,7 +35,7 @@ export default function getElementName(selectorConfig, element) {
|
|
|
29
35
|
};
|
|
30
36
|
|
|
31
37
|
// Construct the data-vc attribute selector if specified in the config.
|
|
32
|
-
var dataVC = selectorConfig.dataVC ? getAttributeSelector('data-vc') : '';
|
|
38
|
+
var dataVC = selectorConfig.dataVC !== false ? getAttributeSelector('data-vc') : '';
|
|
33
39
|
|
|
34
40
|
// Construct the ID selector if specified in the config and the element has an ID.
|
|
35
41
|
var id = selectorConfig.id && element.id ? "#".concat(encodeValue(element.id)) : '';
|
|
@@ -11,7 +11,6 @@ export function createIntersectionObserver(args) {
|
|
|
11
11
|
var validEntries = [];
|
|
12
12
|
var startTime = performance.now();
|
|
13
13
|
entries.forEach(function (entry) {
|
|
14
|
-
var _mutationTag;
|
|
15
14
|
if (!(entry.target instanceof HTMLElement) || !isValidEntry(entry)) {
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
@@ -38,7 +37,7 @@ export function createIntersectionObserver(args) {
|
|
|
38
37
|
target: entry.target,
|
|
39
38
|
rect: entry.intersectionRect,
|
|
40
39
|
time: entry.time,
|
|
41
|
-
type:
|
|
40
|
+
type: mutationTag !== null && mutationTag !== void 0 ? mutationTag : 'unknown',
|
|
42
41
|
mutationData: mutationData
|
|
43
42
|
});
|
|
44
43
|
validEntries.push(new WeakRef(entry.target));
|