@atlaskit/react-ufo 4.5.12 → 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 +12 -0
- package/dist/cjs/config/index.js +19 -6
- package/dist/cjs/create-payload/index.js +3 -1
- 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/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/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 +7 -1
- package/trace-hover/package.json +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a5c2905c301d6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a5c2905c301d6) -
|
|
8
|
+
add tracking of minor interactions
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [`135fc7330f9f3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/135fc7330f9f3) -
|
|
13
|
+
serialise TTVC v3 debug data rectangles
|
|
14
|
+
|
|
3
15
|
## 4.5.12
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/config/index.js
CHANGED
|
@@ -15,6 +15,7 @@ exports.getExperimentalInteractionRate = getExperimentalInteractionRate;
|
|
|
15
15
|
exports.getExtraInteractionRate = getExtraInteractionRate;
|
|
16
16
|
exports.getInteractionRate = getInteractionRate;
|
|
17
17
|
exports.getInteractionTimeout = getInteractionTimeout;
|
|
18
|
+
exports.getMinorInteractions = getMinorInteractions;
|
|
18
19
|
exports.getMostRecentVCRevision = getMostRecentVCRevision;
|
|
19
20
|
exports.getPostInteractionRate = getPostInteractionRate;
|
|
20
21
|
exports.getReactHydrationStats = getReactHydrationStats;
|
|
@@ -299,6 +300,18 @@ function getUfoNameOverrides() {
|
|
|
299
300
|
return undefined;
|
|
300
301
|
}
|
|
301
302
|
}
|
|
303
|
+
function getMinorInteractions() {
|
|
304
|
+
try {
|
|
305
|
+
if (!config) {
|
|
306
|
+
return undefined;
|
|
307
|
+
}
|
|
308
|
+
var _config8 = config,
|
|
309
|
+
minorInteractions = _config8.minorInteractions;
|
|
310
|
+
return minorInteractions;
|
|
311
|
+
} catch (e) {
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
302
315
|
|
|
303
316
|
// Contains the list of interactions that do not abort existing known interactions
|
|
304
317
|
function getDoNotAbortActivePressInteraction() {
|
|
@@ -306,8 +319,8 @@ function getDoNotAbortActivePressInteraction() {
|
|
|
306
319
|
if (!config) {
|
|
307
320
|
return undefined;
|
|
308
321
|
}
|
|
309
|
-
var
|
|
310
|
-
doNotAbortActivePressInteraction =
|
|
322
|
+
var _config9 = config,
|
|
323
|
+
doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
|
|
311
324
|
return doNotAbortActivePressInteraction;
|
|
312
325
|
} catch (e) {
|
|
313
326
|
return undefined;
|
|
@@ -320,8 +333,8 @@ function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
320
333
|
if (!config) {
|
|
321
334
|
return undefined;
|
|
322
335
|
}
|
|
323
|
-
var
|
|
324
|
-
doNotAbortActivePressInteractionOnTransition =
|
|
336
|
+
var _config0 = config,
|
|
337
|
+
doNotAbortActivePressInteractionOnTransition = _config0.doNotAbortActivePressInteractionOnTransition;
|
|
325
338
|
return doNotAbortActivePressInteractionOnTransition;
|
|
326
339
|
} catch (e) {
|
|
327
340
|
return undefined;
|
|
@@ -333,8 +346,8 @@ function getInteractionTimeout(ufoName) {
|
|
|
333
346
|
if (!config) {
|
|
334
347
|
return CLEANUP_TIMEOUT;
|
|
335
348
|
}
|
|
336
|
-
var
|
|
337
|
-
interactionTimeout =
|
|
349
|
+
var _config1 = config,
|
|
350
|
+
interactionTimeout = _config1.interactionTimeout;
|
|
338
351
|
if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
|
|
339
352
|
return interactionTimeout[ufoName];
|
|
340
353
|
}
|
|
@@ -748,7 +748,7 @@ function _createInteractionMetricsPayload() {
|
|
|
748
748
|
'ufo:multipayload': true,
|
|
749
749
|
'ufo:criticalPayloadCount': criticalPayloadCount
|
|
750
750
|
} : {}), (0, _getBrowserMetadata.getBrowserMetadataToLegacyFormat)()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), (0, _getNavigationMetrics.getNavigationMetricsToLegacyFormat)(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
|
|
751
|
-
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
751
|
+
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
752
752
|
namePrefix: config.namePrefix || '',
|
|
753
753
|
segmentPrefix: config.segmentPrefix || '',
|
|
754
754
|
interactionId: interactionId,
|
|
@@ -782,6 +782,8 @@ function _createInteractionMetricsPayload() {
|
|
|
782
782
|
unknownElementName: unknownElementName
|
|
783
783
|
} : {}), unknownElementHierarchy ? {
|
|
784
784
|
unknownElementHierarchy: unknownElementHierarchy
|
|
785
|
+
} : {}), (0, _platformFeatureFlags.fg)('platform_ufo_enable_minor_interactions') ? {
|
|
786
|
+
minorInteractions: interaction.minorInteractions
|
|
785
787
|
} : {}),
|
|
786
788
|
'ufo:payloadTime': (0, _roundNumber.roundEpsilon)(performance.now() - interactionPayloadStart)
|
|
787
789
|
})
|
|
@@ -1101,7 +1101,8 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
|
|
|
1101
1101
|
trace: trace,
|
|
1102
1102
|
vcObserver: vcObserver,
|
|
1103
1103
|
hold3pActive: new Map(),
|
|
1104
|
-
hold3pInfo: []
|
|
1104
|
+
hold3pInfo: [],
|
|
1105
|
+
minorInteractions: []
|
|
1105
1106
|
};
|
|
1106
1107
|
if (addFeatureFlagsToInteraction) {
|
|
1107
1108
|
_featureFlagsAccessed.currentFeatureFlagsAccessed.clear();
|
|
@@ -11,6 +11,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _scheduler = require("scheduler");
|
|
13
13
|
var _uuid = require("uuid");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _coinflip = _interopRequireDefault(require("../coinflip"));
|
|
15
16
|
var _config = require("../config");
|
|
16
17
|
var _experienceTraceIdContext = require("../experience-trace-id-context");
|
|
@@ -172,8 +173,24 @@ function UFOSegment(_ref) {
|
|
|
172
173
|
tracePress: function tracePress() {
|
|
173
174
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'unknown';
|
|
174
175
|
var timestamp = arguments.length > 1 ? arguments[1] : undefined;
|
|
175
|
-
if (
|
|
176
|
-
|
|
176
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_minor_interactions')) {
|
|
177
|
+
var _getDoNotAbortActiveP, _getMinorInteractions;
|
|
178
|
+
var minorInteractions = [].concat((0, _toConsumableArray2.default)((_getDoNotAbortActiveP = (0, _config.getDoNotAbortActivePressInteraction)()) !== null && _getDoNotAbortActiveP !== void 0 ? _getDoNotAbortActiveP : []), (0, _toConsumableArray2.default)((_getMinorInteractions = (0, _config.getMinorInteractions)()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []));
|
|
179
|
+
if (minorInteractions.includes(name)) {
|
|
180
|
+
var _activeInteraction$mi;
|
|
181
|
+
var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
|
|
182
|
+
activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
|
|
183
|
+
name: name,
|
|
184
|
+
startTime: timestamp !== null && timestamp !== void 0 ? timestamp : performance.now()
|
|
185
|
+
});
|
|
186
|
+
return;
|
|
187
|
+
} else if (interactionId.current != null) {
|
|
188
|
+
(0, _interactionMetrics.abortByNewInteraction)(interactionId.current, name);
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
if (interactionId.current != null) {
|
|
192
|
+
(0, _interactionMetrics.abortByNewInteraction)(interactionId.current, name);
|
|
193
|
+
}
|
|
177
194
|
}
|
|
178
195
|
var rate = (0, _config.getInteractionRate)(name, 'press');
|
|
179
196
|
if ((0, _coinflip.default)(rate)) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _traceUfoInteraction = _interopRequireDefault(require("../trace-interaction/internal/trace-ufo-interaction"));
|
|
9
|
+
function traceUFOHover(name, timestamp) {
|
|
10
|
+
return (0, _traceUfoInteraction.default)(name, 'hover', timestamp);
|
|
11
|
+
}
|
|
12
|
+
var _default = exports.default = traceUFOHover;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _uuid = require("uuid");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var _coinflip = _interopRequireDefault(require("../../coinflip"));
|
|
10
11
|
var _config = require("../../config");
|
|
11
12
|
var _experienceTraceIdContext = require("../../experience-trace-id-context");
|
|
@@ -15,15 +16,31 @@ var _routeNameContext = _interopRequireDefault(require("../../route-name-context
|
|
|
15
16
|
function traceUFOInteraction(name, interactionType, startTime) {
|
|
16
17
|
var rate = (0, _config.getInteractionRate)(name, interactionType);
|
|
17
18
|
var pressInteractionsList = (0, _config.getDoNotAbortActivePressInteraction)();
|
|
18
|
-
if (
|
|
19
|
-
var
|
|
20
|
-
|
|
19
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_minor_interactions')) {
|
|
20
|
+
var _getMinorInteractions;
|
|
21
|
+
var minorInteractions = (pressInteractionsList !== null && pressInteractionsList !== void 0 ? pressInteractionsList : []).concat((_getMinorInteractions = (0, _config.getMinorInteractions)()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []);
|
|
22
|
+
if (minorInteractions.includes(name)) {
|
|
23
|
+
var _activeInteraction$mi;
|
|
24
|
+
var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
|
|
25
|
+
activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
|
|
26
|
+
name: name,
|
|
27
|
+
startTime: startTime !== null && startTime !== void 0 ? startTime : performance.now()
|
|
28
|
+
});
|
|
21
29
|
return;
|
|
30
|
+
} else {
|
|
31
|
+
(0, _interactionMetrics.abortAll)('new_interaction', name);
|
|
22
32
|
}
|
|
23
33
|
} else {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
35
|
+
var interaction = (0, _interactionMetrics.getActiveInteraction)();
|
|
36
|
+
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
// Abort any existing interaction regardless of the coinflip outcome
|
|
41
|
+
// Ensures measurements are not carried over between distinct interactions
|
|
42
|
+
(0, _interactionMetrics.abortAll)('new_interaction', name);
|
|
43
|
+
}
|
|
27
44
|
}
|
|
28
45
|
if ((0, _coinflip.default)(rate)) {
|
|
29
46
|
var startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
|
|
@@ -87,7 +87,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
87
87
|
value: function () {
|
|
88
88
|
var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p) {
|
|
89
89
|
var _window, _window2, _window3, _window5;
|
|
90
|
-
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_;
|
|
90
|
+
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_;
|
|
91
91
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
92
92
|
while (1) switch (_context.prev = _context.next) {
|
|
93
93
|
case 0:
|
|
@@ -181,7 +181,15 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
enhancedVcLogs = vcLogs ? vcLogs.map(function (log) {
|
|
184
|
-
return _objectSpread(_objectSpread({}, log),
|
|
184
|
+
return _objectSpread(_objectSpread(_objectSpread({}, log), (0, _platformFeatureFlags.fg)('platform_ufo_serialise_ttvc_v3_debug_data') && {
|
|
185
|
+
entries: log.entries.map(function (entry) {
|
|
186
|
+
var _entry$rect, _entry$previousRect;
|
|
187
|
+
return _objectSpread(_objectSpread({}, entry), {}, {
|
|
188
|
+
rect: (_entry$rect = entry.rect) === null || _entry$rect === void 0 ? void 0 : _entry$rect.toJSON(),
|
|
189
|
+
previousRect: (_entry$previousRect = entry.previousRect) === null || _entry$previousRect === void 0 ? void 0 : _entry$previousRect.toJSON()
|
|
190
|
+
});
|
|
191
|
+
})
|
|
192
|
+
}), {}, {
|
|
185
193
|
viewportPercentage: log.viewportPercentage
|
|
186
194
|
});
|
|
187
195
|
}) : []; // If 3p metric enabled - calculate the debug details
|
|
@@ -237,7 +245,10 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
237
245
|
if (!ignoredEntriesByTime.has(timestamp)) {
|
|
238
246
|
ignoredEntriesByTime.set(timestamp, []);
|
|
239
247
|
}
|
|
240
|
-
(_ignoredEntriesByTime = ignoredEntriesByTime.get(timestamp)) === null || _ignoredEntriesByTime === void 0 || _ignoredEntriesByTime.push(_objectSpread(_objectSpread({}, viewportData),
|
|
248
|
+
(_ignoredEntriesByTime = ignoredEntriesByTime.get(timestamp)) === null || _ignoredEntriesByTime === void 0 || _ignoredEntriesByTime.push(_objectSpread(_objectSpread(_objectSpread({}, viewportData), (0, _platformFeatureFlags.fg)('platform_ufo_serialise_ttvc_v3_debug_data') && {
|
|
249
|
+
rect: (_viewportData$rect = viewportData.rect) === null || _viewportData$rect === void 0 ? void 0 : _viewportData$rect.toJSON(),
|
|
250
|
+
previousRect: (_viewportData$previou = viewportData.previousRect) === null || _viewportData$previou === void 0 ? void 0 : _viewportData$previou.toJSON()
|
|
251
|
+
}), {}, {
|
|
241
252
|
ignoreReason: viewportData.visible ? viewportData.type : 'not-visible'
|
|
242
253
|
}));
|
|
243
254
|
}
|
|
@@ -280,6 +280,19 @@ export function getUfoNameOverrides() {
|
|
|
280
280
|
return undefined;
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
+
export function getMinorInteractions() {
|
|
284
|
+
try {
|
|
285
|
+
if (!config) {
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
const {
|
|
289
|
+
minorInteractions
|
|
290
|
+
} = config;
|
|
291
|
+
return minorInteractions;
|
|
292
|
+
} catch (e) {
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
283
296
|
|
|
284
297
|
// Contains the list of interactions that do not abort existing known interactions
|
|
285
298
|
export function getDoNotAbortActivePressInteraction() {
|
|
@@ -787,6 +787,9 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
|
|
|
787
787
|
} : {}),
|
|
788
788
|
...(unknownElementHierarchy ? {
|
|
789
789
|
unknownElementHierarchy
|
|
790
|
+
} : {}),
|
|
791
|
+
...(fg('platform_ufo_enable_minor_interactions') ? {
|
|
792
|
+
minorInteractions: interaction.minorInteractions
|
|
790
793
|
} : {})
|
|
791
794
|
},
|
|
792
795
|
'ufo:payloadTime': roundEpsilon(performance.now() - interactionPayloadStart)
|
|
@@ -979,7 +979,8 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
979
979
|
trace,
|
|
980
980
|
vcObserver,
|
|
981
981
|
hold3pActive: new Map(),
|
|
982
|
-
hold3pInfo: []
|
|
982
|
+
hold3pInfo: [],
|
|
983
|
+
minorInteractions: []
|
|
983
984
|
};
|
|
984
985
|
if (addFeatureFlagsToInteraction) {
|
|
985
986
|
currentFeatureFlagsAccessed.clear();
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
|
|
3
3
|
import { v4 as createUUID } from 'uuid';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import coinflip from '../coinflip';
|
|
5
|
-
import { getConfig, getInteractionRate } from '../config';
|
|
6
|
+
import { getConfig, getDoNotAbortActivePressInteraction, getInteractionRate, getMinorInteractions } from '../config';
|
|
6
7
|
import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
|
|
7
8
|
import UFOInteractionContext from '../interaction-context';
|
|
8
9
|
import UFOInteractionIDContext from '../interaction-id-context';
|
|
9
|
-
import { abortByNewInteraction, addApdex, addCustomData, addCustomTiming, addHold, addHoldByID, addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
|
|
10
|
+
import { abortByNewInteraction, addApdex, addCustomData, addCustomTiming, addHold, addHoldByID, addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, getActiveInteraction, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
|
|
10
11
|
import UFORouteName from '../route-name-context';
|
|
11
12
|
import generateId from '../short-id';
|
|
12
13
|
import scheduleOnPaint from './schedule-on-paint';
|
|
@@ -145,8 +146,24 @@ export default function UFOSegment({
|
|
|
145
146
|
this._internalHoldByID(labelStack, id, name, true);
|
|
146
147
|
},
|
|
147
148
|
tracePress(name = 'unknown', timestamp) {
|
|
148
|
-
if (
|
|
149
|
-
|
|
149
|
+
if (fg('platform_ufo_enable_minor_interactions')) {
|
|
150
|
+
var _getDoNotAbortActiveP, _getMinorInteractions;
|
|
151
|
+
const minorInteractions = [...((_getDoNotAbortActiveP = getDoNotAbortActivePressInteraction()) !== null && _getDoNotAbortActiveP !== void 0 ? _getDoNotAbortActiveP : []), ...((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : [])];
|
|
152
|
+
if (minorInteractions.includes(name)) {
|
|
153
|
+
var _activeInteraction$mi;
|
|
154
|
+
const activeInteraction = getActiveInteraction();
|
|
155
|
+
activeInteraction === null || activeInteraction === void 0 ? void 0 : (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 ? void 0 : _activeInteraction$mi.push({
|
|
156
|
+
name,
|
|
157
|
+
startTime: timestamp !== null && timestamp !== void 0 ? timestamp : performance.now()
|
|
158
|
+
});
|
|
159
|
+
return;
|
|
160
|
+
} else if (interactionId.current != null) {
|
|
161
|
+
abortByNewInteraction(interactionId.current, name);
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
if (interactionId.current != null) {
|
|
165
|
+
abortByNewInteraction(interactionId.current, name);
|
|
166
|
+
}
|
|
150
167
|
}
|
|
151
168
|
const rate = getInteractionRate(name, 'press');
|
|
152
169
|
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
|
const rate = getInteractionRate(name, interactionType);
|
|
10
11
|
const pressInteractionsList = getDoNotAbortActivePressInteraction();
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
if (fg('platform_ufo_enable_minor_interactions')) {
|
|
13
|
+
var _getMinorInteractions;
|
|
14
|
+
const 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
|
+
const activeInteraction = getActiveInteraction();
|
|
18
|
+
activeInteraction === null || activeInteraction === void 0 ? void 0 : (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 ? void 0 : _activeInteraction$mi.push({
|
|
19
|
+
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
|
+
const 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
|
const startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
|
|
@@ -109,6 +109,16 @@ export default class AbstractVCCalculatorBase {
|
|
|
109
109
|
}
|
|
110
110
|
let enhancedVcLogs = vcLogs ? vcLogs.map(log => ({
|
|
111
111
|
...log,
|
|
112
|
+
...(fg('platform_ufo_serialise_ttvc_v3_debug_data') && {
|
|
113
|
+
entries: log.entries.map(entry => {
|
|
114
|
+
var _entry$rect, _entry$previousRect;
|
|
115
|
+
return {
|
|
116
|
+
...entry,
|
|
117
|
+
rect: (_entry$rect = entry.rect) === null || _entry$rect === void 0 ? void 0 : _entry$rect.toJSON(),
|
|
118
|
+
previousRect: (_entry$previousRect = entry.previousRect) === null || _entry$previousRect === void 0 ? void 0 : _entry$previousRect.toJSON()
|
|
119
|
+
};
|
|
120
|
+
})
|
|
121
|
+
}),
|
|
112
122
|
viewportPercentage: log.viewportPercentage
|
|
113
123
|
})) : [];
|
|
114
124
|
|
|
@@ -152,7 +162,7 @@ export default class AbstractVCCalculatorBase {
|
|
|
152
162
|
const ignoredEntriesByTime = new Map();
|
|
153
163
|
for (const entry of allEntries) {
|
|
154
164
|
if ('rect' in entry.data && !this.isEntryIncluded(entry, include3p)) {
|
|
155
|
-
var _ignoredEntriesByTime;
|
|
165
|
+
var _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou;
|
|
156
166
|
const viewportData = entry.data;
|
|
157
167
|
const timestamp = Math.round(entry.time);
|
|
158
168
|
if (!ignoredEntriesByTime.has(timestamp)) {
|
|
@@ -160,6 +170,10 @@ export default class AbstractVCCalculatorBase {
|
|
|
160
170
|
}
|
|
161
171
|
(_ignoredEntriesByTime = ignoredEntriesByTime.get(timestamp)) === null || _ignoredEntriesByTime === void 0 ? void 0 : _ignoredEntriesByTime.push({
|
|
162
172
|
...viewportData,
|
|
173
|
+
...(fg('platform_ufo_serialise_ttvc_v3_debug_data') && {
|
|
174
|
+
rect: (_viewportData$rect = viewportData.rect) === null || _viewportData$rect === void 0 ? void 0 : _viewportData$rect.toJSON(),
|
|
175
|
+
previousRect: (_viewportData$previou = viewportData.previousRect) === null || _viewportData$previou === void 0 ? void 0 : _viewportData$previou.toJSON()
|
|
176
|
+
}),
|
|
163
177
|
ignoreReason: viewportData.visible ? viewportData.type : 'not-visible'
|
|
164
178
|
});
|
|
165
179
|
}
|
package/dist/esm/config/index.js
CHANGED
|
@@ -275,6 +275,18 @@ export function getUfoNameOverrides() {
|
|
|
275
275
|
return undefined;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
+
export function getMinorInteractions() {
|
|
279
|
+
try {
|
|
280
|
+
if (!config) {
|
|
281
|
+
return undefined;
|
|
282
|
+
}
|
|
283
|
+
var _config8 = config,
|
|
284
|
+
minorInteractions = _config8.minorInteractions;
|
|
285
|
+
return minorInteractions;
|
|
286
|
+
} catch (e) {
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
278
290
|
|
|
279
291
|
// Contains the list of interactions that do not abort existing known interactions
|
|
280
292
|
export function getDoNotAbortActivePressInteraction() {
|
|
@@ -282,8 +294,8 @@ export function getDoNotAbortActivePressInteraction() {
|
|
|
282
294
|
if (!config) {
|
|
283
295
|
return undefined;
|
|
284
296
|
}
|
|
285
|
-
var
|
|
286
|
-
doNotAbortActivePressInteraction =
|
|
297
|
+
var _config9 = config,
|
|
298
|
+
doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
|
|
287
299
|
return doNotAbortActivePressInteraction;
|
|
288
300
|
} catch (e) {
|
|
289
301
|
return undefined;
|
|
@@ -296,8 +308,8 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
296
308
|
if (!config) {
|
|
297
309
|
return undefined;
|
|
298
310
|
}
|
|
299
|
-
var
|
|
300
|
-
doNotAbortActivePressInteractionOnTransition =
|
|
311
|
+
var _config0 = config,
|
|
312
|
+
doNotAbortActivePressInteractionOnTransition = _config0.doNotAbortActivePressInteractionOnTransition;
|
|
301
313
|
return doNotAbortActivePressInteractionOnTransition;
|
|
302
314
|
} catch (e) {
|
|
303
315
|
return undefined;
|
|
@@ -309,8 +321,8 @@ export function getInteractionTimeout(ufoName) {
|
|
|
309
321
|
if (!config) {
|
|
310
322
|
return CLEANUP_TIMEOUT;
|
|
311
323
|
}
|
|
312
|
-
var
|
|
313
|
-
interactionTimeout =
|
|
324
|
+
var _config1 = config,
|
|
325
|
+
interactionTimeout = _config1.interactionTimeout;
|
|
314
326
|
if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
|
|
315
327
|
return interactionTimeout[ufoName];
|
|
316
328
|
}
|
|
@@ -739,7 +739,7 @@ function _createInteractionMetricsPayload() {
|
|
|
739
739
|
'ufo:multipayload': true,
|
|
740
740
|
'ufo:criticalPayloadCount': criticalPayloadCount
|
|
741
741
|
} : {}), getBrowserMetadataToLegacyFormat()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), getNavigationMetricsToLegacyFormat(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
|
|
742
|
-
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
742
|
+
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
743
743
|
namePrefix: config.namePrefix || '',
|
|
744
744
|
segmentPrefix: config.segmentPrefix || '',
|
|
745
745
|
interactionId: interactionId,
|
|
@@ -773,6 +773,8 @@ function _createInteractionMetricsPayload() {
|
|
|
773
773
|
unknownElementName: unknownElementName
|
|
774
774
|
} : {}), unknownElementHierarchy ? {
|
|
775
775
|
unknownElementHierarchy: unknownElementHierarchy
|
|
776
|
+
} : {}), fg('platform_ufo_enable_minor_interactions') ? {
|
|
777
|
+
minorInteractions: interaction.minorInteractions
|
|
776
778
|
} : {}),
|
|
777
779
|
'ufo:payloadTime': roundEpsilon(performance.now() - interactionPayloadStart)
|
|
778
780
|
})
|
|
@@ -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();
|