@atlaskit/react-ufo 4.5.11 → 4.6.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/CHANGELOG.md +19 -0
- package/dist/cjs/config/index.js +19 -6
- package/dist/cjs/create-payload/index.js +3 -1
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +5 -13
- package/dist/cjs/interaction-metrics/index.js +2 -1
- package/dist/cjs/segment/segment.js +19 -2
- package/dist/cjs/trace-hover/index.js +12 -0
- package/dist/cjs/trace-interaction/internal/trace-ufo-interaction.js +23 -6
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +14 -3
- package/dist/es2019/config/index.js +13 -0
- package/dist/es2019/create-payload/index.js +3 -0
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +0 -5
- package/dist/es2019/interaction-metrics/index.js +2 -1
- package/dist/es2019/segment/segment.js +21 -4
- package/dist/es2019/trace-hover/index.js +5 -0
- package/dist/es2019/trace-interaction/internal/trace-ufo-interaction.js +24 -7
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +15 -1
- package/dist/esm/config/index.js +18 -6
- package/dist/esm/create-payload/index.js +3 -1
- package/dist/esm/create-payload/utils/get-vc-metrics.js +5 -13
- package/dist/esm/interaction-metrics/index.js +2 -1
- package/dist/esm/segment/segment.js +21 -4
- package/dist/esm/trace-hover/index.js +5 -0
- package/dist/esm/trace-interaction/internal/trace-ufo-interaction.js +24 -7
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +14 -3
- package/dist/types/common/common/types.d.ts +5 -0
- package/dist/types/common/react-ufo-payload-schema.d.ts +2 -1
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/create-payload/index.d.ts +512 -0
- package/dist/types/trace-hover/index.d.ts +2 -0
- package/dist/types-ts4.5/common/common/types.d.ts +5 -0
- package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +2 -1
- package/dist/types-ts4.5/config/index.d.ts +2 -0
- package/dist/types-ts4.5/create-payload/index.d.ts +512 -0
- package/dist/types-ts4.5/trace-hover/index.d.ts +2 -0
- package/package.json +6 -3
- package/trace-hover/package.json +15 -0
|
@@ -1055,7 +1055,8 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
1055
1055
|
trace: trace,
|
|
1056
1056
|
vcObserver: vcObserver,
|
|
1057
1057
|
hold3pActive: new Map(),
|
|
1058
|
-
hold3pInfo: []
|
|
1058
|
+
hold3pInfo: [],
|
|
1059
|
+
minorInteractions: []
|
|
1059
1060
|
};
|
|
1060
1061
|
if (addFeatureFlagsToInteraction) {
|
|
1061
1062
|
currentFeatureFlagsAccessed.clear();
|
|
@@ -5,12 +5,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
|
|
7
7
|
import { v4 as createUUID } from 'uuid';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import coinflip from '../coinflip';
|
|
9
|
-
import { getConfig, getInteractionRate } from '../config';
|
|
10
|
+
import { getConfig, getDoNotAbortActivePressInteraction, getInteractionRate, getMinorInteractions } from '../config';
|
|
10
11
|
import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
|
|
11
12
|
import UFOInteractionContext from '../interaction-context';
|
|
12
13
|
import UFOInteractionIDContext from '../interaction-id-context';
|
|
13
|
-
import { abortByNewInteraction, addApdex as _addApdex, addCustomData as _addCustomData, addCustomTiming, addHold, addHoldByID, addMark as _addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
|
|
14
|
+
import { abortByNewInteraction, addApdex as _addApdex, addCustomData as _addCustomData, addCustomTiming, addHold, addHoldByID, addMark as _addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, getActiveInteraction, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
|
|
14
15
|
import UFORouteName from '../route-name-context';
|
|
15
16
|
import generateId from '../short-id';
|
|
16
17
|
import scheduleOnPaint from './schedule-on-paint';
|
|
@@ -161,8 +162,24 @@ export default function UFOSegment(_ref) {
|
|
|
161
162
|
tracePress: function tracePress() {
|
|
162
163
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'unknown';
|
|
163
164
|
var timestamp = arguments.length > 1 ? arguments[1] : undefined;
|
|
164
|
-
if (
|
|
165
|
-
|
|
165
|
+
if (fg('platform_ufo_enable_minor_interactions')) {
|
|
166
|
+
var _getDoNotAbortActiveP, _getMinorInteractions;
|
|
167
|
+
var minorInteractions = [].concat(_toConsumableArray((_getDoNotAbortActiveP = getDoNotAbortActivePressInteraction()) !== null && _getDoNotAbortActiveP !== void 0 ? _getDoNotAbortActiveP : []), _toConsumableArray((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []));
|
|
168
|
+
if (minorInteractions.includes(name)) {
|
|
169
|
+
var _activeInteraction$mi;
|
|
170
|
+
var activeInteraction = getActiveInteraction();
|
|
171
|
+
activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
|
|
172
|
+
name: name,
|
|
173
|
+
startTime: timestamp !== null && timestamp !== void 0 ? timestamp : performance.now()
|
|
174
|
+
});
|
|
175
|
+
return;
|
|
176
|
+
} else if (interactionId.current != null) {
|
|
177
|
+
abortByNewInteraction(interactionId.current, name);
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
if (interactionId.current != null) {
|
|
181
|
+
abortByNewInteraction(interactionId.current, name);
|
|
182
|
+
}
|
|
166
183
|
}
|
|
167
184
|
var rate = getInteractionRate(name, 'press');
|
|
168
185
|
if (coinflip(rate)) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { v4 as createUUID } from 'uuid';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import coinflip from '../../coinflip';
|
|
3
|
-
import { getDoNotAbortActivePressInteraction, getInteractionRate } from '../../config';
|
|
4
|
+
import { getDoNotAbortActivePressInteraction, getInteractionRate, getMinorInteractions } from '../../config';
|
|
4
5
|
import { getActiveTrace, setInteractionActiveTrace } from '../../experience-trace-id-context';
|
|
5
6
|
import { DefaultInteractionID } from '../../interaction-id-context';
|
|
6
7
|
import { abortAll, addNewInteraction, getActiveInteraction } from '../../interaction-metrics';
|
|
@@ -8,15 +9,31 @@ import UFORouteName from '../../route-name-context';
|
|
|
8
9
|
function traceUFOInteraction(name, interactionType, startTime) {
|
|
9
10
|
var rate = getInteractionRate(name, interactionType);
|
|
10
11
|
var pressInteractionsList = getDoNotAbortActivePressInteraction();
|
|
11
|
-
if (
|
|
12
|
-
var
|
|
13
|
-
|
|
12
|
+
if (fg('platform_ufo_enable_minor_interactions')) {
|
|
13
|
+
var _getMinorInteractions;
|
|
14
|
+
var minorInteractions = (pressInteractionsList !== null && pressInteractionsList !== void 0 ? pressInteractionsList : []).concat((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []);
|
|
15
|
+
if (minorInteractions.includes(name)) {
|
|
16
|
+
var _activeInteraction$mi;
|
|
17
|
+
var activeInteraction = getActiveInteraction();
|
|
18
|
+
activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
|
|
19
|
+
name: name,
|
|
20
|
+
startTime: startTime !== null && startTime !== void 0 ? startTime : performance.now()
|
|
21
|
+
});
|
|
14
22
|
return;
|
|
23
|
+
} else {
|
|
24
|
+
abortAll('new_interaction', name);
|
|
15
25
|
}
|
|
16
26
|
} else {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
28
|
+
var interaction = getActiveInteraction();
|
|
29
|
+
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
// Abort any existing interaction regardless of the coinflip outcome
|
|
34
|
+
// Ensures measurements are not carried over between distinct interactions
|
|
35
|
+
abortAll('new_interaction', name);
|
|
36
|
+
}
|
|
20
37
|
}
|
|
21
38
|
if (coinflip(rate)) {
|
|
22
39
|
var startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
|
|
@@ -81,7 +81,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
81
81
|
value: function () {
|
|
82
82
|
var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p) {
|
|
83
83
|
var _window, _window2, _window3, _window5;
|
|
84
|
-
var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator4, _step4, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator5, _step5, _entry3, _ignoredEntriesByTime, viewportData, timestamp, additionalVcLogs, _iterator6, _step6, _step6$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window4, _window4$__ufo_devtoo, _window6, _window6$__on_ufo_vc_;
|
|
84
|
+
var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator4, _step4, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator5, _step5, _entry3, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator6, _step6, _step6$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window4, _window4$__ufo_devtoo, _window6, _window6$__on_ufo_vc_;
|
|
85
85
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
86
86
|
while (1) switch (_context.prev = _context.next) {
|
|
87
87
|
case 0:
|
|
@@ -175,7 +175,15 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
enhancedVcLogs = vcLogs ? vcLogs.map(function (log) {
|
|
178
|
-
return _objectSpread(_objectSpread({}, log),
|
|
178
|
+
return _objectSpread(_objectSpread(_objectSpread({}, log), fg('platform_ufo_serialise_ttvc_v3_debug_data') && {
|
|
179
|
+
entries: log.entries.map(function (entry) {
|
|
180
|
+
var _entry$rect, _entry$previousRect;
|
|
181
|
+
return _objectSpread(_objectSpread({}, entry), {}, {
|
|
182
|
+
rect: (_entry$rect = entry.rect) === null || _entry$rect === void 0 ? void 0 : _entry$rect.toJSON(),
|
|
183
|
+
previousRect: (_entry$previousRect = entry.previousRect) === null || _entry$previousRect === void 0 ? void 0 : _entry$previousRect.toJSON()
|
|
184
|
+
});
|
|
185
|
+
})
|
|
186
|
+
}), {}, {
|
|
179
187
|
viewportPercentage: log.viewportPercentage
|
|
180
188
|
});
|
|
181
189
|
}) : []; // If 3p metric enabled - calculate the debug details
|
|
@@ -231,7 +239,10 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
231
239
|
if (!ignoredEntriesByTime.has(timestamp)) {
|
|
232
240
|
ignoredEntriesByTime.set(timestamp, []);
|
|
233
241
|
}
|
|
234
|
-
(_ignoredEntriesByTime = ignoredEntriesByTime.get(timestamp)) === null || _ignoredEntriesByTime === void 0 || _ignoredEntriesByTime.push(_objectSpread(_objectSpread({}, viewportData),
|
|
242
|
+
(_ignoredEntriesByTime = ignoredEntriesByTime.get(timestamp)) === null || _ignoredEntriesByTime === void 0 || _ignoredEntriesByTime.push(_objectSpread(_objectSpread(_objectSpread({}, viewportData), fg('platform_ufo_serialise_ttvc_v3_debug_data') && {
|
|
243
|
+
rect: (_viewportData$rect = viewportData.rect) === null || _viewportData$rect === void 0 ? void 0 : _viewportData$rect.toJSON(),
|
|
244
|
+
previousRect: (_viewportData$previou = viewportData.previousRect) === null || _viewportData$previou === void 0 ? void 0 : _viewportData$previou.toJSON()
|
|
245
|
+
}), {}, {
|
|
235
246
|
ignoreReason: viewportData.visible ? viewportData.type : 'not-visible'
|
|
236
247
|
}));
|
|
237
248
|
}
|
|
@@ -90,6 +90,10 @@ export type ResponsivenessMetric = {
|
|
|
90
90
|
visuallyComplete?: number;
|
|
91
91
|
totalBlockingTime?: number;
|
|
92
92
|
};
|
|
93
|
+
export type MinorInteraction = {
|
|
94
|
+
name: string;
|
|
95
|
+
startTime: DOMHighResTimeStamp;
|
|
96
|
+
};
|
|
93
97
|
export interface InteractionMetrics {
|
|
94
98
|
id: string;
|
|
95
99
|
start: number;
|
|
@@ -170,6 +174,7 @@ export interface InteractionMetrics {
|
|
|
170
174
|
unknownElementHierarchy?: string;
|
|
171
175
|
hold3pActive?: Map<string, HoldActive>;
|
|
172
176
|
hold3pInfo?: HoldInfo[];
|
|
177
|
+
minorInteractions?: MinorInteraction[];
|
|
173
178
|
}
|
|
174
179
|
export type LoadProfilerEventInfo = {
|
|
175
180
|
identifier: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type createPayloads } from '../create-payload';
|
|
2
2
|
import { type LabelStack } from '../interaction-context';
|
|
3
3
|
import { type VCObserver } from '../vc/vc-observer';
|
|
4
|
-
import type { AbortReasonType, ApdexType, HoldActive, InteractionError, InteractionType, SegmentInfo } from './common/types';
|
|
4
|
+
import type { AbortReasonType, ApdexType, HoldActive, InteractionError, InteractionType, MinorInteraction, SegmentInfo } from './common/types';
|
|
5
5
|
import type { RevisionPayload } from './vc/types';
|
|
6
6
|
type ExtractPromise<T> = T extends Promise<infer U> ? U : never;
|
|
7
7
|
export type PageVisibility = 'hidden' | 'mixed' | 'visible';
|
|
@@ -158,6 +158,7 @@ export type ReactUFOPayload = {
|
|
|
158
158
|
holdActive: HoldActive[];
|
|
159
159
|
unknownElementName?: string;
|
|
160
160
|
unknownElementHierarchy?: string;
|
|
161
|
+
minorInteractions?: MinorInteraction[];
|
|
161
162
|
};
|
|
162
163
|
'ufo:vc:rev': RevisionPayload;
|
|
163
164
|
'ufo:vc:ratios': Record<string, number>;
|
|
@@ -59,6 +59,7 @@ export type ReactHydrationStats = {
|
|
|
59
59
|
export type Config = {
|
|
60
60
|
readonly enabled?: boolean;
|
|
61
61
|
readonly interactionTimeout?: Record<string, number>;
|
|
62
|
+
readonly minorInteractions?: string[];
|
|
62
63
|
readonly doNotAbortActivePressInteraction?: string[];
|
|
63
64
|
readonly doNotAbortActivePressInteractionOnTransition?: string[];
|
|
64
65
|
readonly awaitBM3TTI?: string[];
|
|
@@ -165,6 +166,7 @@ type ValidTypingMethod = (typeof validTypingMethods)[number];
|
|
|
165
166
|
export declare function getTypingPerformanceTracingMethod(): ValidTypingMethod;
|
|
166
167
|
export declare function getAwaitBM3TTIList(): string[];
|
|
167
168
|
export declare function getUfoNameOverrides(): UFONameOverride | undefined;
|
|
169
|
+
export declare function getMinorInteractions(): string[] | undefined;
|
|
168
170
|
export declare function getDoNotAbortActivePressInteraction(): string[] | undefined;
|
|
169
171
|
export declare function getDoNotAbortActivePressInteractionOnTransition(): string[] | undefined;
|
|
170
172
|
export declare const CLEANUP_TIMEOUT: number;
|