@atlaskit/react-ufo 4.10.0 → 4.10.2
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 +19 -0
- package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +10 -7
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +13 -9
- package/dist/cjs/interaction-metrics/index.js +6 -4
- package/dist/cjs/interaction-metrics/post-interaction-log.js +13 -6
- package/dist/cjs/vc/index.js +4 -1
- package/dist/cjs/vc/vc-observer-new/index.js +10 -4
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +11 -18
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +14 -16
- package/dist/cjs/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.js +50 -0
- package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +5 -2
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +5 -2
- package/dist/es2019/interaction-metrics/index.js +6 -4
- package/dist/es2019/interaction-metrics/post-interaction-log.js +7 -1
- package/dist/es2019/vc/index.js +4 -1
- package/dist/es2019/vc/vc-observer-new/index.js +11 -2
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +10 -15
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +11 -11
- package/dist/es2019/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.js +27 -0
- package/dist/esm/create-experimental-interaction-metrics-payload/index.js +10 -7
- package/dist/esm/create-payload/utils/get-vc-metrics.js +13 -9
- package/dist/esm/interaction-metrics/index.js +6 -4
- package/dist/esm/interaction-metrics/post-interaction-log.js +13 -6
- package/dist/esm/vc/index.js +4 -1
- package/dist/esm/vc/vc-observer-new/index.js +10 -4
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +11 -18
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +14 -16
- package/dist/esm/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.js +43 -0
- package/dist/types/common/common/types.d.ts +1 -0
- package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +1 -0
- package/dist/types/create-payload/index.d.ts +384 -0
- package/dist/types/interaction-metrics/index.d.ts +2 -2
- package/dist/types/vc/types.d.ts +4 -0
- package/dist/types/vc/vc-observer/getVCRevisionDebugDetails.d.ts +2 -0
- package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +4 -0
- package/dist/types/vc/vc-observer-new/types.d.ts +4 -0
- package/dist/types/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.d.ts +6 -0
- package/dist/types-ts4.5/common/common/types.d.ts +1 -0
- package/dist/types-ts4.5/create-interaction-extra-metrics-payload/index.d.ts +1 -0
- package/dist/types-ts4.5/create-payload/index.d.ts +384 -0
- package/dist/types-ts4.5/interaction-metrics/index.d.ts +2 -2
- package/dist/types-ts4.5/vc/types.d.ts +4 -0
- package/dist/types-ts4.5/vc/vc-observer/getVCRevisionDebugDetails.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +4 -0
- package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +4 -0
- package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.d.ts +6 -0
- package/package.json +1 -4
|
@@ -196,6 +196,9 @@ export default class VCObserverNew {
|
|
|
196
196
|
start,
|
|
197
197
|
stop,
|
|
198
198
|
interactionId,
|
|
199
|
+
interactionType,
|
|
200
|
+
interactionAbortReason,
|
|
201
|
+
isPageVisible,
|
|
199
202
|
include3p,
|
|
200
203
|
excludeSmartAnswersInSearch
|
|
201
204
|
} = param;
|
|
@@ -214,9 +217,12 @@ export default class VCObserverNew {
|
|
|
214
217
|
startTime: start,
|
|
215
218
|
stopTime: stop,
|
|
216
219
|
interactionId,
|
|
220
|
+
interactionType,
|
|
217
221
|
isPostInteraction: this.isPostInteraction,
|
|
218
222
|
include3p,
|
|
219
|
-
excludeSmartAnswersInSearch
|
|
223
|
+
excludeSmartAnswersInSearch,
|
|
224
|
+
isPageVisible,
|
|
225
|
+
interactionAbortReason
|
|
220
226
|
});
|
|
221
227
|
if (fy25_03) {
|
|
222
228
|
results.push(fy25_03);
|
|
@@ -230,8 +236,11 @@ export default class VCObserverNew {
|
|
|
230
236
|
startTime: start,
|
|
231
237
|
stopTime: stop,
|
|
232
238
|
interactionId,
|
|
239
|
+
interactionType,
|
|
233
240
|
isPostInteraction: this.isPostInteraction,
|
|
234
|
-
include3p
|
|
241
|
+
include3p,
|
|
242
|
+
isPageVisible,
|
|
243
|
+
interactionAbortReason
|
|
235
244
|
});
|
|
236
245
|
if (vcNext) {
|
|
237
246
|
results.push(vcNext);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import getPageVisibilityUpToTTAI from '../../../create-payload/utils/get-page-visibility-up-to-ttai';
|
|
3
|
-
import { getInteractionId } from '../../../interaction-id-context';
|
|
4
|
-
import { interactions } from '../../../interaction-metrics/common/constants';
|
|
5
2
|
import { cssIssueOccurrence } from '../viewport-observer/utils/track-display-content-occurrence';
|
|
6
3
|
import { calculateTTVCPercentilesWithDebugInfo } from './percentile-calc';
|
|
7
4
|
import getViewportHeight from './utils/get-viewport-height';
|
|
@@ -55,7 +52,7 @@ export default class AbstractVCCalculatorBase {
|
|
|
55
52
|
}
|
|
56
53
|
return labelStacks;
|
|
57
54
|
}
|
|
58
|
-
async calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch) {
|
|
55
|
+
async calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason) {
|
|
59
56
|
var _window, _window2, _window6, _window8;
|
|
60
57
|
const percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99, 100];
|
|
61
58
|
const viewportEntries = this.filterViewportEntries(filteredEntries);
|
|
@@ -212,18 +209,13 @@ export default class AbstractVCCalculatorBase {
|
|
|
212
209
|
let v3RevisionDebugDetails = null;
|
|
213
210
|
if (shouldCalculateDebugDetails) {
|
|
214
211
|
if (fg('platform_ufo_unify_abort_status_in_ttvc_debug_data')) {
|
|
215
|
-
var _activeInteractionId$;
|
|
216
|
-
// NOTE: using this instead of directly calling `getActiveInteraction()` to get around circular dependencies
|
|
217
|
-
const activeInteractionId = getInteractionId();
|
|
218
|
-
const activeInteraction = interactions.get((_activeInteractionId$ = activeInteractionId.current) !== null && _activeInteractionId$ !== void 0 ? _activeInteractionId$ : '');
|
|
219
|
-
const pageVisibilityUpToTTAI = activeInteraction ? getPageVisibilityUpToTTAI(activeInteraction) : null;
|
|
220
|
-
const isBackgrounded = pageVisibilityUpToTTAI !== 'visible';
|
|
221
212
|
v3RevisionDebugDetails = {
|
|
222
213
|
revision: this.revisionNo,
|
|
223
|
-
isClean: isVCClean && !
|
|
224
|
-
abortReason:
|
|
214
|
+
isClean: isVCClean && !interactionAbortReason && isPageVisible,
|
|
215
|
+
abortReason: !isPageVisible ? 'browser_backgrounded' : dirtyReason !== null && dirtyReason !== void 0 ? dirtyReason : interactionAbortReason,
|
|
225
216
|
vcLogs: enhancedVcLogs,
|
|
226
|
-
interactionId
|
|
217
|
+
interactionId,
|
|
218
|
+
interactionType
|
|
227
219
|
};
|
|
228
220
|
} else {
|
|
229
221
|
v3RevisionDebugDetails = {
|
|
@@ -274,7 +266,10 @@ export default class AbstractVCCalculatorBase {
|
|
|
274
266
|
interactionId,
|
|
275
267
|
isPostInteraction,
|
|
276
268
|
include3p,
|
|
277
|
-
excludeSmartAnswersInSearch
|
|
269
|
+
excludeSmartAnswersInSearch,
|
|
270
|
+
interactionType,
|
|
271
|
+
isPageVisible,
|
|
272
|
+
interactionAbortReason
|
|
278
273
|
}) {
|
|
279
274
|
var _vcDetails$90$t, _vcDetails$;
|
|
280
275
|
const filteredEntries = orderedEntries.filter(entry => {
|
|
@@ -294,7 +289,7 @@ export default class AbstractVCCalculatorBase {
|
|
|
294
289
|
abortTimestamp: getVCCleanStatusResult.abortTimestamp
|
|
295
290
|
};
|
|
296
291
|
}
|
|
297
|
-
const vcDetails = await this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch);
|
|
292
|
+
const vcDetails = await this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason);
|
|
298
293
|
const result = {
|
|
299
294
|
revision: this.revisionNo,
|
|
300
295
|
clean: true,
|
|
@@ -9,6 +9,7 @@ import createMutationObserver from './mutation-observer';
|
|
|
9
9
|
import createPerformanceObserver from './performance-observer';
|
|
10
10
|
import checkCssProperty from './utils/check-display-content';
|
|
11
11
|
import checkWithinComponent, { cleanupCaches } from './utils/check-within-component';
|
|
12
|
+
import { getMutatedElements } from './utils/get-mutated-elements';
|
|
12
13
|
import isInVCIgnoreIfNoLayoutShiftMarker from './utils/is-in-vc-ignore-if-no-layout-shift-marker';
|
|
13
14
|
import trackDisplayContentsOccurrence from './utils/track-display-content-occurrence';
|
|
14
15
|
function isElementVisible(element) {
|
|
@@ -188,17 +189,17 @@ export default class ViewportObserver {
|
|
|
188
189
|
continue;
|
|
189
190
|
}
|
|
190
191
|
if (fg('platform_ufo_vcnext_v4_enabled')) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
for (const {
|
|
193
|
+
isDisplayContentsElementChildren,
|
|
194
|
+
element
|
|
195
|
+
} of getMutatedElements(addedNode)) {
|
|
196
|
+
if (isDisplayContentsElementChildren) {
|
|
197
|
+
var _this$intersectionObs8;
|
|
198
|
+
(_this$intersectionObs8 = this.intersectionObserver) === null || _this$intersectionObs8 === void 0 ? void 0 : _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
199
|
+
} else {
|
|
200
|
+
var _this$intersectionObs9;
|
|
201
|
+
(_this$intersectionObs9 = this.intersectionObserver) === null || _this$intersectionObs9 === void 0 ? void 0 : _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
198
202
|
}
|
|
199
|
-
} else {
|
|
200
|
-
var _this$intersectionObs9;
|
|
201
|
-
(_this$intersectionObs9 = this.intersectionObserver) === null || _this$intersectionObs9 === void 0 ? void 0 : _this$intersectionObs9.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
|
|
202
203
|
}
|
|
203
204
|
} else {
|
|
204
205
|
if (fg('platform_ufo_display_content_resolution_ttvc_v3')) {
|
|
@@ -299,7 +300,6 @@ export default class ViewportObserver {
|
|
|
299
300
|
}
|
|
300
301
|
};
|
|
301
302
|
});
|
|
302
|
-
// }
|
|
303
303
|
});
|
|
304
304
|
_defineProperty(this, "handleLayoutShift", ({
|
|
305
305
|
time,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED = 3;
|
|
2
|
+
export function getMutatedElements(element, depthLevel = 0) {
|
|
3
|
+
var _window, _window$getComputedSt;
|
|
4
|
+
if (((_window = window) === null || _window === void 0 ? void 0 : (_window$getComputedSt = _window.getComputedStyle(element)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.display) === 'contents') {
|
|
5
|
+
const mutatedElements = [];
|
|
6
|
+
const nestedDisplayContentsElementChildren = [];
|
|
7
|
+
for (const child of element.children) {
|
|
8
|
+
var _window2, _window2$getComputedS;
|
|
9
|
+
if (((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$getComputedS = _window2.getComputedStyle(child)) === null || _window2$getComputedS === void 0 ? void 0 : _window2$getComputedS.display) === 'contents') {
|
|
10
|
+
nestedDisplayContentsElementChildren.push(child);
|
|
11
|
+
}
|
|
12
|
+
mutatedElements.push({
|
|
13
|
+
element: child,
|
|
14
|
+
isDisplayContentsElementChildren: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (depthLevel < MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED && nestedDisplayContentsElementChildren.length > 0) {
|
|
18
|
+
return [...mutatedElements, ...nestedDisplayContentsElementChildren.map(element => getMutatedElements(element, depthLevel + 1)).flat()];
|
|
19
|
+
}
|
|
20
|
+
return mutatedElements;
|
|
21
|
+
} else {
|
|
22
|
+
return [{
|
|
23
|
+
element,
|
|
24
|
+
isDisplayContentsElementChildren: false
|
|
25
|
+
}];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -84,18 +84,19 @@ export function getExperimentalVCMetrics(_x) {
|
|
|
84
84
|
}
|
|
85
85
|
function _getExperimentalVCMetrics() {
|
|
86
86
|
_getExperimentalVCMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
|
|
87
|
-
var vcObserver, _interaction$apdex, prefix, result, VC
|
|
87
|
+
var vcObserver, pageVisibilityUpToTTAI, _interaction$apdex, prefix, result, VC;
|
|
88
88
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
89
89
|
while (1) switch (_context.prev = _context.next) {
|
|
90
90
|
case 0:
|
|
91
91
|
// Use per-interaction VC observer if available, otherwise fall back to global experimentalVC
|
|
92
92
|
vcObserver = interaction.experimentalVCObserver || experimentalVC.vcObserver;
|
|
93
|
+
pageVisibilityUpToTTAI = getPageVisibilityState(interaction.start, interaction.end);
|
|
93
94
|
if (!vcObserver) {
|
|
94
95
|
_context.next = 13;
|
|
95
96
|
break;
|
|
96
97
|
}
|
|
97
98
|
prefix = 'ufo-experimental';
|
|
98
|
-
_context.next =
|
|
99
|
+
_context.next = 6;
|
|
99
100
|
return vcObserver.getVCResult({
|
|
100
101
|
start: interaction.start,
|
|
101
102
|
stop: interaction.end,
|
|
@@ -104,18 +105,20 @@ function _getExperimentalVCMetrics() {
|
|
|
104
105
|
prefix: prefix,
|
|
105
106
|
vc: interaction.vc,
|
|
106
107
|
experienceKey: interaction.ufoName,
|
|
107
|
-
interactionId: interaction.id
|
|
108
|
+
interactionId: interaction.id,
|
|
109
|
+
interactionType: interaction.type,
|
|
110
|
+
isPageVisible: pageVisibilityUpToTTAI === 'visible',
|
|
111
|
+
interactionAbortReason: interaction.abortReason
|
|
108
112
|
});
|
|
109
|
-
case
|
|
113
|
+
case 6:
|
|
110
114
|
result = _context.sent;
|
|
111
115
|
VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
|
|
112
116
|
if (!(!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")]))) {
|
|
113
|
-
_context.next =
|
|
117
|
+
_context.next = 10;
|
|
114
118
|
break;
|
|
115
119
|
}
|
|
116
120
|
return _context.abrupt("return", result);
|
|
117
|
-
case
|
|
118
|
-
pageVisibilityUpToTTAI = getPageVisibilityState(interaction.start, interaction.end);
|
|
121
|
+
case 10:
|
|
119
122
|
if (!(interaction.abortReason || pageVisibilityUpToTTAI !== 'visible')) {
|
|
120
123
|
_context.next = 12;
|
|
121
124
|
break;
|
|
@@ -19,6 +19,7 @@ function _getVCMetrics() {
|
|
|
19
19
|
config,
|
|
20
20
|
interactionStatus,
|
|
21
21
|
pageVisibilityUpToTTAI,
|
|
22
|
+
isPageVisible,
|
|
22
23
|
shouldReportVCMetrics,
|
|
23
24
|
observer,
|
|
24
25
|
isSSREnabled,
|
|
@@ -49,14 +50,15 @@ function _getVCMetrics() {
|
|
|
49
50
|
case 7:
|
|
50
51
|
interactionStatus = getInteractionStatus(interaction);
|
|
51
52
|
pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
52
|
-
|
|
53
|
+
isPageVisible = pageVisibilityUpToTTAI === 'visible';
|
|
54
|
+
shouldReportVCMetrics = interactionStatus.originalInteractionStatus === 'SUCCEEDED' && isPageVisible; // Use per-interaction VC observer if available, otherwise fall back to global
|
|
53
55
|
observer = interaction.vcObserver;
|
|
54
56
|
if (observer) {
|
|
55
|
-
_context.next =
|
|
57
|
+
_context.next = 14;
|
|
56
58
|
break;
|
|
57
59
|
}
|
|
58
60
|
return _context.abrupt("return", {});
|
|
59
|
-
case
|
|
61
|
+
case 14:
|
|
60
62
|
isSSREnabled = interaction.type === 'page_load' && ((config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 || (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName)));
|
|
61
63
|
ssr = interaction.type === 'page_load' && isSSREnabled ? {
|
|
62
64
|
ssr: getSSRDoneTimeValue(config)
|
|
@@ -64,7 +66,7 @@ function _getVCMetrics() {
|
|
|
64
66
|
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
65
67
|
tti = (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime;
|
|
66
68
|
prefix = 'ufo';
|
|
67
|
-
_context.next =
|
|
69
|
+
_context.next = 21;
|
|
68
70
|
return observer.getVCResult(_objectSpread(_objectSpread({
|
|
69
71
|
start: interaction.start,
|
|
70
72
|
stop: interaction.end,
|
|
@@ -78,9 +80,11 @@ function _getVCMetrics() {
|
|
|
78
80
|
includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio
|
|
79
81
|
}, ssr), {}, {
|
|
80
82
|
include3p: include3p,
|
|
81
|
-
excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
|
|
83
|
+
excludeSmartAnswersInSearch: excludeSmartAnswersInSearch,
|
|
84
|
+
interactionType: interaction.type,
|
|
85
|
+
isPageVisible: isPageVisible
|
|
82
86
|
}));
|
|
83
|
-
case
|
|
87
|
+
case 21:
|
|
84
88
|
result = _context.sent;
|
|
85
89
|
observer.stop(interaction.ufoName);
|
|
86
90
|
if (!include3p) {
|
|
@@ -93,15 +97,15 @@ function _getVCMetrics() {
|
|
|
93
97
|
return revision === mostRecentVCRevision;
|
|
94
98
|
});
|
|
95
99
|
if (!(!shouldReportVCMetrics || !(mostRecentVCRevisionPayload !== null && mostRecentVCRevisionPayload !== void 0 && mostRecentVCRevisionPayload.clean))) {
|
|
96
|
-
_context.next =
|
|
100
|
+
_context.next = 28;
|
|
97
101
|
break;
|
|
98
102
|
}
|
|
99
103
|
return _context.abrupt("return", result);
|
|
100
|
-
case
|
|
104
|
+
case 28:
|
|
101
105
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
102
106
|
'metric:vc90': mostRecentVCRevisionPayload['metric:vc90']
|
|
103
107
|
}));
|
|
104
|
-
case
|
|
108
|
+
case 29:
|
|
105
109
|
case "end":
|
|
106
110
|
return _context.stop();
|
|
107
111
|
}
|
|
@@ -542,7 +542,7 @@ export var ModuleLoadingProfiler = {
|
|
|
542
542
|
removeHoldByID(currentInteractionId, id);
|
|
543
543
|
}
|
|
544
544
|
};
|
|
545
|
-
export function addError(interactionId, name, labelStack, errorType, errorMessage, errorStack, forcedError) {
|
|
545
|
+
export function addError(interactionId, name, labelStack, errorType, errorMessage, errorStack, forcedError, errorHash) {
|
|
546
546
|
var interaction = interactions.get(interactionId);
|
|
547
547
|
if (interaction != null) {
|
|
548
548
|
interaction.errors.push({
|
|
@@ -551,18 +551,20 @@ export function addError(interactionId, name, labelStack, errorType, errorMessag
|
|
|
551
551
|
errorType: errorType,
|
|
552
552
|
errorMessage: errorMessage,
|
|
553
553
|
errorStack: errorStack,
|
|
554
|
-
forcedError: forcedError
|
|
554
|
+
forcedError: forcedError,
|
|
555
|
+
errorHash: errorHash
|
|
555
556
|
});
|
|
556
557
|
}
|
|
557
558
|
}
|
|
558
|
-
export function addErrorToAll(name, labelStack, errorType, errorMessage, errorStack) {
|
|
559
|
+
export function addErrorToAll(name, labelStack, errorType, errorMessage, errorStack, errorHash) {
|
|
559
560
|
interactions.forEach(function (interaction) {
|
|
560
561
|
interaction.errors.push({
|
|
561
562
|
name: name,
|
|
562
563
|
labelStack: labelStack,
|
|
563
564
|
errorType: errorType,
|
|
564
565
|
errorMessage: errorMessage,
|
|
565
|
-
errorStack: errorStack
|
|
566
|
+
errorStack: errorStack,
|
|
567
|
+
errorHash: errorHash
|
|
566
568
|
});
|
|
567
569
|
});
|
|
568
570
|
}
|
|
@@ -7,6 +7,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { getConfig } from '../config';
|
|
10
|
+
import { getPageVisibilityState } from '../hidden-timing';
|
|
10
11
|
import { VCObserverWrapper } from '../vc';
|
|
11
12
|
var POST_INTERACTION_LOG_SEND_DEFAULT_TIMEOUT = 3000;
|
|
12
13
|
var PostInteractionLog = /*#__PURE__*/function () {
|
|
@@ -115,7 +116,7 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
115
116
|
value: (function () {
|
|
116
117
|
var _sendPostInteractionLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
117
118
|
var _this$vcObserver4, _config$vc, _config$vc2, _this$vcObserver5;
|
|
118
|
-
var _this$vcObserver3, config, postInteractionFinishVCResult;
|
|
119
|
+
var _this$vcObserver3, pageVisibilityState, isPageVisible, config, postInteractionFinishVCResult;
|
|
119
120
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
120
121
|
while (1) switch (_context.prev = _context.next) {
|
|
121
122
|
case 0:
|
|
@@ -127,9 +128,11 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
127
128
|
(_this$vcObserver3 = this.vcObserver) === null || _this$vcObserver3 === void 0 || _this$vcObserver3.stop();
|
|
128
129
|
return _context.abrupt("return");
|
|
129
130
|
case 4:
|
|
131
|
+
pageVisibilityState = getPageVisibilityState(this.lastInteractionFinish.start, this.lastInteractionFinish.end);
|
|
132
|
+
isPageVisible = pageVisibilityState === 'visible';
|
|
130
133
|
config = getConfig();
|
|
131
|
-
_context.next =
|
|
132
|
-
return (_this$vcObserver4 = this.vcObserver) === null || _this$vcObserver4 === void 0 ? void 0 : _this$vcObserver4.getVCResult(_objectSpread({
|
|
134
|
+
_context.next = 9;
|
|
135
|
+
return (_this$vcObserver4 = this.vcObserver) === null || _this$vcObserver4 === void 0 ? void 0 : _this$vcObserver4.getVCResult(_objectSpread(_objectSpread({
|
|
133
136
|
start: this.lastInteractionFinish.start,
|
|
134
137
|
stop: performance.now(),
|
|
135
138
|
tti: -1,
|
|
@@ -140,8 +143,12 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
140
143
|
interactionId: this.lastInteractionFinish.id,
|
|
141
144
|
includeSSRInV3: config === null || config === void 0 || (_config$vc = config.vc) === null || _config$vc === void 0 ? void 0 : _config$vc.includeSSRInV3,
|
|
142
145
|
includeSSRRatio: config === null || config === void 0 || (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRRatio
|
|
143
|
-
}, this.vcObserverSSRConfig)
|
|
144
|
-
|
|
146
|
+
}, this.vcObserverSSRConfig), {}, {
|
|
147
|
+
interactionType: this.lastInteractionFinish.type,
|
|
148
|
+
isPageVisible: isPageVisible,
|
|
149
|
+
interactionAbortReason: this.lastInteractionFinish.abortReason
|
|
150
|
+
}));
|
|
151
|
+
case 9:
|
|
145
152
|
postInteractionFinishVCResult = _context.sent;
|
|
146
153
|
(_this$vcObserver5 = this.vcObserver) === null || _this$vcObserver5 === void 0 || _this$vcObserver5.stop();
|
|
147
154
|
this.sinkHandlerFn({
|
|
@@ -151,7 +158,7 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
151
158
|
lastInteractionFinishVCResult: this.lastInteractionFinishVCResult
|
|
152
159
|
});
|
|
153
160
|
this.reset();
|
|
154
|
-
case
|
|
161
|
+
case 13:
|
|
155
162
|
case "end":
|
|
156
163
|
return _context.stop();
|
|
157
164
|
}
|
package/dist/esm/vc/index.js
CHANGED
|
@@ -142,7 +142,10 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
|
|
|
142
142
|
interactionId: param.interactionId,
|
|
143
143
|
ssr: param.includeSSRInV3 ? param.ssr : undefined,
|
|
144
144
|
include3p: include3p,
|
|
145
|
-
excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
|
|
145
|
+
excludeSmartAnswersInSearch: excludeSmartAnswersInSearch,
|
|
146
|
+
interactionType: param.interactionType,
|
|
147
|
+
isPageVisible: param.isPageVisible,
|
|
148
|
+
interactionAbortReason: param.interactionAbortReason
|
|
146
149
|
});
|
|
147
150
|
case 12:
|
|
148
151
|
_context.t1 = _context.sent;
|
|
@@ -231,11 +231,11 @@ var VCObserverNew = /*#__PURE__*/function () {
|
|
|
231
231
|
key: "getVCResult",
|
|
232
232
|
value: function () {
|
|
233
233
|
var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
234
|
-
var start, stop, interactionId, include3p, excludeSmartAnswersInSearch, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
|
|
234
|
+
var start, stop, interactionId, interactionType, interactionAbortReason, isPageVisible, include3p, excludeSmartAnswersInSearch, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
|
|
235
235
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
236
236
|
while (1) switch (_context.prev = _context.next) {
|
|
237
237
|
case 0:
|
|
238
|
-
start = param.start, stop = param.stop, interactionId = param.interactionId, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
|
|
238
|
+
start = param.start, stop = param.stop, interactionId = param.interactionId, interactionType = param.interactionType, interactionAbortReason = param.interactionAbortReason, isPageVisible = param.isPageVisible, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
|
|
239
239
|
results = [];
|
|
240
240
|
this.addStartEntry(start);
|
|
241
241
|
calculator_fy25_03 = new VCCalculator_FY25_03();
|
|
@@ -252,9 +252,12 @@ var VCObserverNew = /*#__PURE__*/function () {
|
|
|
252
252
|
startTime: start,
|
|
253
253
|
stopTime: stop,
|
|
254
254
|
interactionId: interactionId,
|
|
255
|
+
interactionType: interactionType,
|
|
255
256
|
isPostInteraction: this.isPostInteraction,
|
|
256
257
|
include3p: include3p,
|
|
257
|
-
excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
|
|
258
|
+
excludeSmartAnswersInSearch: excludeSmartAnswersInSearch,
|
|
259
|
+
isPageVisible: isPageVisible,
|
|
260
|
+
interactionAbortReason: interactionAbortReason
|
|
258
261
|
});
|
|
259
262
|
case 8:
|
|
260
263
|
fy25_03 = _context.sent;
|
|
@@ -274,8 +277,11 @@ var VCObserverNew = /*#__PURE__*/function () {
|
|
|
274
277
|
startTime: start,
|
|
275
278
|
stopTime: stop,
|
|
276
279
|
interactionId: interactionId,
|
|
280
|
+
interactionType: interactionType,
|
|
277
281
|
isPostInteraction: this.isPostInteraction,
|
|
278
|
-
include3p: include3p
|
|
282
|
+
include3p: include3p,
|
|
283
|
+
isPageVisible: isPageVisible,
|
|
284
|
+
interactionAbortReason: interactionAbortReason
|
|
279
285
|
});
|
|
280
286
|
case 14:
|
|
281
287
|
vcNext = _context.sent;
|
|
@@ -11,9 +11,6 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
11
11
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
12
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
-
import getPageVisibilityUpToTTAI from '../../../create-payload/utils/get-page-visibility-up-to-ttai';
|
|
15
|
-
import { getInteractionId } from '../../../interaction-id-context';
|
|
16
|
-
import { interactions } from '../../../interaction-metrics/common/constants';
|
|
17
14
|
import { cssIssueOccurrence } from '../viewport-observer/utils/track-display-content-occurrence';
|
|
18
15
|
import { calculateTTVCPercentilesWithDebugInfo } from './percentile-calc';
|
|
19
16
|
import getViewportHeight from './utils/get-viewport-height';
|
|
@@ -105,9 +102,9 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
105
102
|
}, {
|
|
106
103
|
key: "calculateWithDebugInfo",
|
|
107
104
|
value: function () {
|
|
108
|
-
var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch) {
|
|
105
|
+
var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason) {
|
|
109
106
|
var _window, _window2, _window6, _window8;
|
|
110
|
-
var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, _window3, _window4, _window5, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails,
|
|
107
|
+
var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, _window3, _window4, _window5, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window7, _window7$__ufo_devtoo, _window9, _window9$__on_ufo_vc_;
|
|
111
108
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
112
109
|
while (1) switch (_context.prev = _context.next) {
|
|
113
110
|
case 0:
|
|
@@ -308,17 +305,13 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
308
305
|
v3RevisionDebugDetails = null;
|
|
309
306
|
if (shouldCalculateDebugDetails) {
|
|
310
307
|
if (fg('platform_ufo_unify_abort_status_in_ttvc_debug_data')) {
|
|
311
|
-
// NOTE: using this instead of directly calling `getActiveInteraction()` to get around circular dependencies
|
|
312
|
-
activeInteractionId = getInteractionId();
|
|
313
|
-
activeInteraction = interactions.get((_activeInteractionId$ = activeInteractionId.current) !== null && _activeInteractionId$ !== void 0 ? _activeInteractionId$ : '');
|
|
314
|
-
pageVisibilityUpToTTAI = activeInteraction ? getPageVisibilityUpToTTAI(activeInteraction) : null;
|
|
315
|
-
isBackgrounded = pageVisibilityUpToTTAI !== 'visible';
|
|
316
308
|
v3RevisionDebugDetails = {
|
|
317
309
|
revision: this.revisionNo,
|
|
318
|
-
isClean: isVCClean && !
|
|
319
|
-
abortReason:
|
|
310
|
+
isClean: isVCClean && !interactionAbortReason && isPageVisible,
|
|
311
|
+
abortReason: !isPageVisible ? 'browser_backgrounded' : dirtyReason !== null && dirtyReason !== void 0 ? dirtyReason : interactionAbortReason,
|
|
320
312
|
vcLogs: enhancedVcLogs,
|
|
321
|
-
interactionId: interactionId
|
|
313
|
+
interactionId: interactionId,
|
|
314
|
+
interactionType: interactionType
|
|
322
315
|
};
|
|
323
316
|
} else {
|
|
324
317
|
v3RevisionDebugDetails = {
|
|
@@ -365,7 +358,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
365
358
|
}
|
|
366
359
|
}, _callee, this, [[10, 22, 25, 28]]);
|
|
367
360
|
}));
|
|
368
|
-
function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0) {
|
|
361
|
+
function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11) {
|
|
369
362
|
return _calculateWithDebugInfo.apply(this, arguments);
|
|
370
363
|
}
|
|
371
364
|
return calculateWithDebugInfo;
|
|
@@ -377,11 +370,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
377
370
|
var _this = this,
|
|
378
371
|
_vcDetails$90$t,
|
|
379
372
|
_vcDetails$;
|
|
380
|
-
var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
|
|
373
|
+
var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, interactionType, isPageVisible, interactionAbortReason, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
|
|
381
374
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
382
375
|
while (1) switch (_context2.prev = _context2.next) {
|
|
383
376
|
case 0:
|
|
384
|
-
startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p, excludeSmartAnswersInSearch = _ref.excludeSmartAnswersInSearch;
|
|
377
|
+
startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p, excludeSmartAnswersInSearch = _ref.excludeSmartAnswersInSearch, interactionType = _ref.interactionType, isPageVisible = _ref.isPageVisible, interactionAbortReason = _ref.interactionAbortReason;
|
|
385
378
|
filteredEntries = orderedEntries.filter(function (entry) {
|
|
386
379
|
return _this.isEntryIncluded(entry, include3p, excludeSmartAnswersInSearch);
|
|
387
380
|
});
|
|
@@ -401,7 +394,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
401
394
|
});
|
|
402
395
|
case 7:
|
|
403
396
|
_context2.next = 9;
|
|
404
|
-
return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch);
|
|
397
|
+
return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason);
|
|
405
398
|
case 9:
|
|
406
399
|
vcDetails = _context2.sent;
|
|
407
400
|
result = {
|
|
@@ -424,7 +417,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
424
417
|
}
|
|
425
418
|
}, _callee2, this);
|
|
426
419
|
}));
|
|
427
|
-
function calculate(
|
|
420
|
+
function calculate(_x12) {
|
|
428
421
|
return _calculate.apply(this, arguments);
|
|
429
422
|
}
|
|
430
423
|
return calculate;
|
|
@@ -16,6 +16,7 @@ import createMutationObserver from './mutation-observer';
|
|
|
16
16
|
import createPerformanceObserver from './performance-observer';
|
|
17
17
|
import checkCssProperty from './utils/check-display-content';
|
|
18
18
|
import checkWithinComponent, { cleanupCaches } from './utils/check-within-component';
|
|
19
|
+
import { getMutatedElements } from './utils/get-mutated-elements';
|
|
19
20
|
import isInVCIgnoreIfNoLayoutShiftMarker from './utils/is-in-vc-ignore-if-no-layout-shift-marker';
|
|
20
21
|
import trackDisplayContentsOccurrence from './utils/track-display-content-occurrence';
|
|
21
22
|
function isElementVisible(element) {
|
|
@@ -117,7 +118,7 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
117
118
|
_iterator = _createForOfIteratorHelper(addedNodes);
|
|
118
119
|
_context2.prev = 4;
|
|
119
120
|
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
|
|
120
|
-
var addedNodeRef, addedNode, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _checkWithinComponent, isWithinThirdPartySegment, _this$intersectionObs7,
|
|
121
|
+
var addedNodeRef, addedNode, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _checkWithinComponent, isWithinThirdPartySegment, _this$intersectionObs7, _iterator2, _step2, _step2$value, isDisplayContentsElementChildren, element, _this$intersectionObs8, _this$intersectionObs9, validTargets, _iterator3, _step3, _this$intersectionObs0, validTarget, _this$intersectionObs1;
|
|
121
122
|
return _regeneratorRuntime.wrap(function _loop$(_context) {
|
|
122
123
|
while (1) switch (_context.prev = _context.next) {
|
|
123
124
|
case 0:
|
|
@@ -230,22 +231,20 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
230
231
|
return _context.abrupt("return", 0);
|
|
231
232
|
case 45:
|
|
232
233
|
if (fg('platform_ufo_vcnext_v4_enabled')) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
234
|
+
_iterator2 = _createForOfIteratorHelper(getMutatedElements(addedNode));
|
|
235
|
+
try {
|
|
236
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
237
|
+
_step2$value = _step2.value, isDisplayContentsElementChildren = _step2$value.isDisplayContentsElementChildren, element = _step2$value.element;
|
|
238
|
+
if (isDisplayContentsElementChildren) {
|
|
239
|
+
(_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
240
|
+
} else {
|
|
241
|
+
(_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
241
242
|
}
|
|
242
|
-
} catch (err) {
|
|
243
|
-
_iterator2.e(err);
|
|
244
|
-
} finally {
|
|
245
|
-
_iterator2.f();
|
|
246
243
|
}
|
|
247
|
-
}
|
|
248
|
-
|
|
244
|
+
} catch (err) {
|
|
245
|
+
_iterator2.e(err);
|
|
246
|
+
} finally {
|
|
247
|
+
_iterator2.f();
|
|
249
248
|
}
|
|
250
249
|
} else {
|
|
251
250
|
if (fg('platform_ufo_display_content_resolution_ttvc_v3')) {
|
|
@@ -392,7 +391,6 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
392
391
|
}
|
|
393
392
|
};
|
|
394
393
|
});
|
|
395
|
-
// }
|
|
396
394
|
});
|
|
397
395
|
_defineProperty(this, "handleLayoutShift", function (_ref8) {
|
|
398
396
|
var time = _ref8.time,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
var MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED = 3;
|
|
6
|
+
export function getMutatedElements(element) {
|
|
7
|
+
var _window;
|
|
8
|
+
var depthLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
9
|
+
if (((_window = window) === null || _window === void 0 || (_window = _window.getComputedStyle(element)) === null || _window === void 0 ? void 0 : _window.display) === 'contents') {
|
|
10
|
+
var mutatedElements = [];
|
|
11
|
+
var nestedDisplayContentsElementChildren = [];
|
|
12
|
+
var _iterator = _createForOfIteratorHelper(element.children),
|
|
13
|
+
_step;
|
|
14
|
+
try {
|
|
15
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
16
|
+
var _window2;
|
|
17
|
+
var child = _step.value;
|
|
18
|
+
if (((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(child)) === null || _window2 === void 0 ? void 0 : _window2.display) === 'contents') {
|
|
19
|
+
nestedDisplayContentsElementChildren.push(child);
|
|
20
|
+
}
|
|
21
|
+
mutatedElements.push({
|
|
22
|
+
element: child,
|
|
23
|
+
isDisplayContentsElementChildren: true
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
} catch (err) {
|
|
27
|
+
_iterator.e(err);
|
|
28
|
+
} finally {
|
|
29
|
+
_iterator.f();
|
|
30
|
+
}
|
|
31
|
+
if (depthLevel < MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED && nestedDisplayContentsElementChildren.length > 0) {
|
|
32
|
+
return [].concat(mutatedElements, _toConsumableArray(nestedDisplayContentsElementChildren.map(function (element) {
|
|
33
|
+
return getMutatedElements(element, depthLevel + 1);
|
|
34
|
+
}).flat()));
|
|
35
|
+
}
|
|
36
|
+
return mutatedElements;
|
|
37
|
+
} else {
|
|
38
|
+
return [{
|
|
39
|
+
element: element,
|
|
40
|
+
isDisplayContentsElementChildren: false
|
|
41
|
+
}];
|
|
42
|
+
}
|
|
43
|
+
}
|