@atlaskit/react-ufo 4.11.6 → 4.11.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/create-payload/index.js +3 -4
- package/dist/cjs/interaction-metrics/index.js +2 -2
- package/dist/cjs/segment/segment.js +12 -19
- package/dist/cjs/trace-interaction/internal/trace-ufo-interaction.js +11 -25
- package/dist/cjs/vc/vc-observer-new/index.js +3 -8
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +18 -22
- package/dist/es2019/create-payload/index.js +1 -3
- package/dist/es2019/interaction-metrics/index.js +2 -2
- package/dist/es2019/segment/segment.js +12 -19
- package/dist/es2019/trace-interaction/internal/trace-ufo-interaction.js +11 -25
- package/dist/es2019/vc/vc-observer-new/index.js +15 -17
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +14 -19
- package/dist/esm/create-payload/index.js +3 -4
- package/dist/esm/interaction-metrics/index.js +2 -2
- package/dist/esm/segment/segment.js +12 -19
- package/dist/esm/trace-interaction/internal/trace-ufo-interaction.js +11 -25
- package/dist/esm/vc/vc-observer-new/index.js +3 -8
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +18 -22
- package/dist/types/create-payload/index.d.ts +768 -768
- package/dist/types-ts4.5/create-payload/index.d.ts +768 -768
- package/package.json +1 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.11.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`29629e6bfc4be`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/29629e6bfc4be) -
|
|
8
|
+
FG cleanup - platform_ufo_vcnext_v4_enabled
|
|
9
|
+
- [`0e2fae38334fe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0e2fae38334fe) -
|
|
10
|
+
FG cleanup - platform_ufo_enable_timeout_config
|
|
11
|
+
|
|
12
|
+
## 4.11.7
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`273616f4575b7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/273616f4575b7) -
|
|
17
|
+
FG cleanup - platform_ufo_enable_minor_interactions
|
|
18
|
+
|
|
3
19
|
## 4.11.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -557,7 +557,7 @@ function _createInteractionMetricsPayload() {
|
|
|
557
557
|
'ufo:multipayload': true,
|
|
558
558
|
'ufo:criticalPayloadCount': criticalPayloadCount
|
|
559
559
|
} : {}), (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()), {}, {
|
|
560
|
-
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(
|
|
560
|
+
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
561
561
|
namePrefix: config.namePrefix || '',
|
|
562
562
|
segmentPrefix: config.segmentPrefix || '',
|
|
563
563
|
interactionId: interactionId,
|
|
@@ -581,7 +581,8 @@ function _createInteractionMetricsPayload() {
|
|
|
581
581
|
segments: (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type) === '2.0.0' ? segmentTree : (0, _utils.getOldSegmentsLabelStack)(segments, interaction.type),
|
|
582
582
|
marks: (0, _optimizeMarks.optimizeMarks)(interaction.marks, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type)),
|
|
583
583
|
customData: optimizeCustomData(interaction),
|
|
584
|
-
reactProfilerTimings: (0, _optimizeReactProfilerTimings.optimizeReactProfilerTimings)(interaction.reactProfilerTimings, start, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type))
|
|
584
|
+
reactProfilerTimings: (0, _optimizeReactProfilerTimings.optimizeReactProfilerTimings)(interaction.reactProfilerTimings, start, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type)),
|
|
585
|
+
minorInteractions: interaction.minorInteractions
|
|
585
586
|
}, responsiveness ? {
|
|
586
587
|
responsiveness: responsiveness
|
|
587
588
|
} : {}), labelStack), pageLoadInteractionMetrics), getDetailedInteractionMetrics(resourceTimings)), getPageLoadDetailedInteractionMetrics()), getBm3TrackerTimings(interaction)), {}, {
|
|
@@ -591,8 +592,6 @@ function _createInteractionMetricsPayload() {
|
|
|
591
592
|
unknownElementName: unknownElementName
|
|
592
593
|
} : {}), unknownElementHierarchy ? {
|
|
593
594
|
unknownElementHierarchy: unknownElementHierarchy
|
|
594
|
-
} : {}), (0, _platformFeatureFlags.fg)('platform_ufo_enable_minor_interactions') ? {
|
|
595
|
-
minorInteractions: interaction.minorInteractions
|
|
596
595
|
} : {}),
|
|
597
596
|
'ufo:payloadTime': (0, _roundNumber.roundEpsilon)(performance.now() - interactionPayloadStart)
|
|
598
597
|
})
|
|
@@ -77,7 +77,7 @@ var interactionExtraMetrics = exports.interactionExtraMetrics = new _interaction
|
|
|
77
77
|
var interactionQueue = [];
|
|
78
78
|
var segmentCache = new Map();
|
|
79
79
|
var segmentUnmountCache = exports.segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
var segmentObservers = [];
|
|
82
82
|
function getActiveInteraction() {
|
|
83
83
|
var interactionId = (0, _interactionIdContext.getInteractionId)();
|
|
@@ -1013,7 +1013,7 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
|
|
|
1013
1013
|
postInteractionLog.reset();
|
|
1014
1014
|
var vcObserver;
|
|
1015
1015
|
var previousTime = startTime;
|
|
1016
|
-
var timeoutTime = (0,
|
|
1016
|
+
var timeoutTime = (0, _config.getInteractionTimeout)(ufoName);
|
|
1017
1017
|
var timerID = setTimeout(function () {
|
|
1018
1018
|
abort(interactionId, 'timeout');
|
|
1019
1019
|
}, timeoutTime);
|
|
@@ -11,7 +11,6 @@ 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");
|
|
15
14
|
var _coinflip = _interopRequireDefault(require("../coinflip"));
|
|
16
15
|
var _config = require("../config");
|
|
17
16
|
var _experienceTraceIdContext = require("../experience-trace-id-context");
|
|
@@ -160,26 +159,20 @@ function UFOSegment(_ref) {
|
|
|
160
159
|
this._internalHoldByID(labelStack, id, name, true);
|
|
161
160
|
},
|
|
162
161
|
tracePress: function tracePress() {
|
|
162
|
+
var _getDoNotAbortActiveP, _getMinorInteractions;
|
|
163
163
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'unknown';
|
|
164
164
|
var timestamp = arguments.length > 1 ? arguments[1] : undefined;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
} else if (interactionId.current != null) {
|
|
177
|
-
(0, _interactionMetrics.abortByNewInteraction)(interactionId.current, name);
|
|
178
|
-
}
|
|
179
|
-
} else {
|
|
180
|
-
if (interactionId.current != null) {
|
|
181
|
-
(0, _interactionMetrics.abortByNewInteraction)(interactionId.current, name);
|
|
182
|
-
}
|
|
165
|
+
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 : []));
|
|
166
|
+
if (minorInteractions.includes(name)) {
|
|
167
|
+
var _activeInteraction$mi;
|
|
168
|
+
var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
|
|
169
|
+
activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
|
|
170
|
+
name: name,
|
|
171
|
+
startTime: timestamp !== null && timestamp !== void 0 ? timestamp : performance.now()
|
|
172
|
+
});
|
|
173
|
+
return;
|
|
174
|
+
} else if (interactionId.current != null) {
|
|
175
|
+
(0, _interactionMetrics.abortByNewInteraction)(interactionId.current, name);
|
|
183
176
|
}
|
|
184
177
|
var rate = (0, _config.getInteractionRate)(name, 'press');
|
|
185
178
|
if ((0, _coinflip.default)(rate)) {
|
|
@@ -6,7 +6,6 @@ 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");
|
|
10
9
|
var _coinflip = _interopRequireDefault(require("../../coinflip"));
|
|
11
10
|
var _config = require("../../config");
|
|
12
11
|
var _experienceTraceIdContext = require("../../experience-trace-id-context");
|
|
@@ -14,33 +13,20 @@ var _interactionIdContext = require("../../interaction-id-context");
|
|
|
14
13
|
var _interactionMetrics = require("../../interaction-metrics");
|
|
15
14
|
var _routeNameContext = _interopRequireDefault(require("../../route-name-context"));
|
|
16
15
|
function traceUFOInteraction(name, interactionType, startTime) {
|
|
16
|
+
var _getMinorInteractions;
|
|
17
17
|
var rate = (0, _config.getInteractionRate)(name, interactionType);
|
|
18
18
|
var pressInteractionsList = (0, _config.getDoNotAbortActivePressInteraction)();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
return;
|
|
30
|
-
} else {
|
|
31
|
-
(0, _interactionMetrics.abortAll)('new_interaction', name);
|
|
32
|
-
}
|
|
19
|
+
var minorInteractions = (pressInteractionsList !== null && pressInteractionsList !== void 0 ? pressInteractionsList : []).concat((_getMinorInteractions = (0, _config.getMinorInteractions)()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []);
|
|
20
|
+
if (minorInteractions.includes(name)) {
|
|
21
|
+
var _activeInteraction$mi;
|
|
22
|
+
var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
|
|
23
|
+
activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
|
|
24
|
+
name: name,
|
|
25
|
+
startTime: startTime !== null && startTime !== void 0 ? startTime : performance.now()
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
33
28
|
} else {
|
|
34
|
-
|
|
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
|
-
}
|
|
29
|
+
(0, _interactionMetrics.abortAll)('new_interaction', name);
|
|
44
30
|
}
|
|
45
31
|
if ((0, _coinflip.default)(rate)) {
|
|
46
32
|
var startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
|
|
@@ -274,12 +274,8 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
// TODO on cleanup: put behind `enabledVCRevisions` config
|
|
277
|
-
if (!(0, _platformFeatureFlags.fg)('platform_ufo_vcnext_v4_enabled')) {
|
|
278
|
-
_context.next = 16;
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
277
|
calculator_next = new _vcnext.default();
|
|
282
|
-
_context.next =
|
|
278
|
+
_context.next = 13;
|
|
283
279
|
return calculator_next.calculate({
|
|
284
280
|
orderedEntries: orderedEntries,
|
|
285
281
|
startTime: start,
|
|
@@ -292,14 +288,13 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
|
|
|
292
288
|
isPageVisible: isPageVisible,
|
|
293
289
|
interactionAbortReason: interactionAbortReason
|
|
294
290
|
});
|
|
295
|
-
case
|
|
291
|
+
case 13:
|
|
296
292
|
vcNext = _context.sent;
|
|
297
293
|
if (vcNext) {
|
|
298
294
|
results.push(vcNext);
|
|
299
295
|
}
|
|
300
|
-
case 16:
|
|
301
296
|
return _context.abrupt("return", results);
|
|
302
|
-
case
|
|
297
|
+
case 16:
|
|
303
298
|
case "end":
|
|
304
299
|
return _context.stop();
|
|
305
300
|
}
|
|
@@ -99,7 +99,7 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
99
99
|
_iterator = _createForOfIteratorHelper(addedNodes);
|
|
100
100
|
_context2.prev = 4;
|
|
101
101
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
102
|
-
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
|
|
102
|
+
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;
|
|
103
103
|
return _regenerator.default.wrap(function _loop$(_context) {
|
|
104
104
|
while (1) switch (_context.prev = _context.next) {
|
|
105
105
|
case 0:
|
|
@@ -211,26 +211,22 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
211
211
|
(_this$intersectionObs7 = _this.intersectionObserver) === null || _this$intersectionObs7 === void 0 || _this$intersectionObs7.watchAndTag(addedNode, 'mutation:third-party-element');
|
|
212
212
|
return _context.abrupt("return", 0);
|
|
213
213
|
case 45:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
(_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
223
|
-
}
|
|
214
|
+
_iterator2 = _createForOfIteratorHelper((0, _getMutatedElements.getMutatedElements)(addedNode));
|
|
215
|
+
try {
|
|
216
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
217
|
+
_step2$value = _step2.value, isDisplayContentsElementChildren = _step2$value.isDisplayContentsElementChildren, element = _step2$value.element;
|
|
218
|
+
if (isDisplayContentsElementChildren) {
|
|
219
|
+
(_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
220
|
+
} else {
|
|
221
|
+
(_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
224
222
|
}
|
|
225
|
-
} catch (err) {
|
|
226
|
-
_iterator2.e(err);
|
|
227
|
-
} finally {
|
|
228
|
-
_iterator2.f();
|
|
229
223
|
}
|
|
230
|
-
}
|
|
231
|
-
|
|
224
|
+
} catch (err) {
|
|
225
|
+
_iterator2.e(err);
|
|
226
|
+
} finally {
|
|
227
|
+
_iterator2.f();
|
|
232
228
|
}
|
|
233
|
-
case
|
|
229
|
+
case 47:
|
|
234
230
|
case "end":
|
|
235
231
|
return _context.stop();
|
|
236
232
|
}
|
|
@@ -275,12 +271,12 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
275
271
|
};
|
|
276
272
|
}());
|
|
277
273
|
(0, _defineProperty2.default)(this, "handleAttributeMutation", function (_ref6) {
|
|
278
|
-
var _this$
|
|
274
|
+
var _this$intersectionObs0;
|
|
279
275
|
var target = _ref6.target,
|
|
280
276
|
attributeName = _ref6.attributeName,
|
|
281
277
|
oldValue = _ref6.oldValue,
|
|
282
278
|
newValue = _ref6.newValue;
|
|
283
|
-
(_this$
|
|
279
|
+
(_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(target, function (_ref7) {
|
|
284
280
|
var target = _ref7.target,
|
|
285
281
|
rect = _ref7.rect;
|
|
286
282
|
if ((0, _vcUtils.isContainedWithinMediaWrapper)(target)) {
|
|
@@ -446,12 +442,12 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
446
442
|
}, {
|
|
447
443
|
key: "stop",
|
|
448
444
|
value: function stop() {
|
|
449
|
-
var _this$mutationObserve2, _this$
|
|
445
|
+
var _this$mutationObserve2, _this$intersectionObs1, _this$performanceObse2;
|
|
450
446
|
if (!this.isStarted) {
|
|
451
447
|
return;
|
|
452
448
|
}
|
|
453
449
|
(_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
|
|
454
|
-
(_this$
|
|
450
|
+
(_this$intersectionObs1 = this.intersectionObserver) === null || _this$intersectionObs1 === void 0 || _this$intersectionObs1.disconnect();
|
|
455
451
|
(_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
|
|
456
452
|
this.isStarted = false;
|
|
457
453
|
// Clean up caches when stopping
|
|
@@ -577,6 +577,7 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
|
|
|
577
577
|
marks: optimizeMarks(interaction.marks, getReactUFOPayloadVersion(interaction.type)),
|
|
578
578
|
customData: optimizeCustomData(interaction),
|
|
579
579
|
reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start, getReactUFOPayloadVersion(interaction.type)),
|
|
580
|
+
minorInteractions: interaction.minorInteractions,
|
|
580
581
|
...(responsiveness ? {
|
|
581
582
|
responsiveness
|
|
582
583
|
} : {}),
|
|
@@ -592,9 +593,6 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
|
|
|
592
593
|
} : {}),
|
|
593
594
|
...(unknownElementHierarchy ? {
|
|
594
595
|
unknownElementHierarchy
|
|
595
|
-
} : {}),
|
|
596
|
-
...(fg('platform_ufo_enable_minor_interactions') ? {
|
|
597
|
-
minorInteractions: interaction.minorInteractions
|
|
598
596
|
} : {})
|
|
599
597
|
},
|
|
600
598
|
'ufo:payloadTime': roundEpsilon(performance.now() - interactionPayloadStart)
|
|
@@ -21,7 +21,7 @@ export const interactionExtraMetrics = new InteractionExtraMetrics();
|
|
|
21
21
|
const interactionQueue = [];
|
|
22
22
|
const segmentCache = new Map();
|
|
23
23
|
export const segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
const segmentObservers = [];
|
|
26
26
|
export function getActiveInteraction() {
|
|
27
27
|
const interactionId = getInteractionId();
|
|
@@ -892,7 +892,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
892
892
|
postInteractionLog.reset();
|
|
893
893
|
let vcObserver;
|
|
894
894
|
let previousTime = startTime;
|
|
895
|
-
let timeoutTime =
|
|
895
|
+
let timeoutTime = getInteractionTimeout(ufoName);
|
|
896
896
|
const timerID = setTimeout(() => {
|
|
897
897
|
abort(interactionId, 'timeout');
|
|
898
898
|
}, timeoutTime);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Profiler, 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';
|
|
5
4
|
import coinflip from '../coinflip';
|
|
6
5
|
import { getConfig, getDoNotAbortActivePressInteraction, getInteractionRate, getMinorInteractions } from '../config';
|
|
7
6
|
import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
|
|
@@ -141,24 +140,18 @@ export default function UFOSegment({
|
|
|
141
140
|
this._internalHoldByID(labelStack, id, name, true);
|
|
142
141
|
},
|
|
143
142
|
tracePress(name = 'unknown', timestamp) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
abortByNewInteraction(interactionId.current, name);
|
|
157
|
-
}
|
|
158
|
-
} else {
|
|
159
|
-
if (interactionId.current != null) {
|
|
160
|
-
abortByNewInteraction(interactionId.current, name);
|
|
161
|
-
}
|
|
143
|
+
var _getDoNotAbortActiveP, _getMinorInteractions;
|
|
144
|
+
const minorInteractions = [...((_getDoNotAbortActiveP = getDoNotAbortActivePressInteraction()) !== null && _getDoNotAbortActiveP !== void 0 ? _getDoNotAbortActiveP : []), ...((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : [])];
|
|
145
|
+
if (minorInteractions.includes(name)) {
|
|
146
|
+
var _activeInteraction$mi;
|
|
147
|
+
const activeInteraction = getActiveInteraction();
|
|
148
|
+
activeInteraction === null || activeInteraction === void 0 ? void 0 : (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 ? void 0 : _activeInteraction$mi.push({
|
|
149
|
+
name,
|
|
150
|
+
startTime: timestamp !== null && timestamp !== void 0 ? timestamp : performance.now()
|
|
151
|
+
});
|
|
152
|
+
return;
|
|
153
|
+
} else if (interactionId.current != null) {
|
|
154
|
+
abortByNewInteraction(interactionId.current, name);
|
|
162
155
|
}
|
|
163
156
|
const rate = getInteractionRate(name, 'press');
|
|
164
157
|
if (coinflip(rate)) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { v4 as createUUID } from 'uuid';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import coinflip from '../../coinflip';
|
|
4
3
|
import { getDoNotAbortActivePressInteraction, getInteractionRate, getMinorInteractions } from '../../config';
|
|
5
4
|
import { getActiveTrace, setInteractionActiveTrace } from '../../experience-trace-id-context';
|
|
@@ -7,33 +6,20 @@ import { DefaultInteractionID } from '../../interaction-id-context';
|
|
|
7
6
|
import { abortAll, addNewInteraction, getActiveInteraction } from '../../interaction-metrics';
|
|
8
7
|
import UFORouteName from '../../route-name-context';
|
|
9
8
|
function traceUFOInteraction(name, interactionType, startTime) {
|
|
9
|
+
var _getMinorInteractions;
|
|
10
10
|
const rate = getInteractionRate(name, interactionType);
|
|
11
11
|
const pressInteractionsList = getDoNotAbortActivePressInteraction();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
return;
|
|
23
|
-
} else {
|
|
24
|
-
abortAll('new_interaction', name);
|
|
25
|
-
}
|
|
12
|
+
const minorInteractions = (pressInteractionsList !== null && pressInteractionsList !== void 0 ? pressInteractionsList : []).concat((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []);
|
|
13
|
+
if (minorInteractions.includes(name)) {
|
|
14
|
+
var _activeInteraction$mi;
|
|
15
|
+
const activeInteraction = getActiveInteraction();
|
|
16
|
+
activeInteraction === null || activeInteraction === void 0 ? void 0 : (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 ? void 0 : _activeInteraction$mi.push({
|
|
17
|
+
name,
|
|
18
|
+
startTime: startTime !== null && startTime !== void 0 ? startTime : performance.now()
|
|
19
|
+
});
|
|
20
|
+
return;
|
|
26
21
|
} else {
|
|
27
|
-
|
|
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
|
-
}
|
|
22
|
+
abortAll('new_interaction', name);
|
|
37
23
|
}
|
|
38
24
|
if (coinflip(rate)) {
|
|
39
25
|
const startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
|
|
@@ -231,23 +231,21 @@ export default class VCObserverNew {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
// TODO on cleanup: put behind `enabledVCRevisions` config
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
results.push(vcNext);
|
|
250
|
-
}
|
|
234
|
+
const calculator_next = new VCNextCalculator();
|
|
235
|
+
const vcNext = await calculator_next.calculate({
|
|
236
|
+
orderedEntries,
|
|
237
|
+
startTime: start,
|
|
238
|
+
stopTime: stop,
|
|
239
|
+
interactionId,
|
|
240
|
+
interactionType,
|
|
241
|
+
isPostInteraction: this.isPostInteraction,
|
|
242
|
+
include3p,
|
|
243
|
+
includeSSRRatio,
|
|
244
|
+
isPageVisible,
|
|
245
|
+
interactionAbortReason
|
|
246
|
+
});
|
|
247
|
+
if (vcNext) {
|
|
248
|
+
results.push(vcNext);
|
|
251
249
|
}
|
|
252
250
|
return results;
|
|
253
251
|
}
|
|
@@ -160,22 +160,17 @@ export default class ViewportObserver {
|
|
|
160
160
|
(_this$intersectionObs7 = this.intersectionObserver) === null || _this$intersectionObs7 === void 0 ? void 0 : _this$intersectionObs7.watchAndTag(addedNode, 'mutation:third-party-element');
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
(_this$intersectionObs9 = this.intersectionObserver) === null || _this$intersectionObs9 === void 0 ? void 0 : _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
174
|
-
}
|
|
163
|
+
for (const {
|
|
164
|
+
isDisplayContentsElementChildren,
|
|
165
|
+
element
|
|
166
|
+
} of getMutatedElements(addedNode)) {
|
|
167
|
+
if (isDisplayContentsElementChildren) {
|
|
168
|
+
var _this$intersectionObs8;
|
|
169
|
+
(_this$intersectionObs8 = this.intersectionObserver) === null || _this$intersectionObs8 === void 0 ? void 0 : _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
170
|
+
} else {
|
|
171
|
+
var _this$intersectionObs9;
|
|
172
|
+
(_this$intersectionObs9 = this.intersectionObserver) === null || _this$intersectionObs9 === void 0 ? void 0 : _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
175
173
|
}
|
|
176
|
-
} else {
|
|
177
|
-
var _this$intersectionObs0;
|
|
178
|
-
(_this$intersectionObs0 = this.intersectionObserver) === null || _this$intersectionObs0 === void 0 ? void 0 : _this$intersectionObs0.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
|
|
179
174
|
}
|
|
180
175
|
}
|
|
181
176
|
});
|
|
@@ -185,8 +180,8 @@ export default class ViewportObserver {
|
|
|
185
180
|
oldValue,
|
|
186
181
|
newValue
|
|
187
182
|
}) => {
|
|
188
|
-
var _this$
|
|
189
|
-
(_this$
|
|
183
|
+
var _this$intersectionObs0;
|
|
184
|
+
(_this$intersectionObs0 = this.intersectionObserver) === null || _this$intersectionObs0 === void 0 ? void 0 : _this$intersectionObs0.watchAndTag(target, ({
|
|
190
185
|
target,
|
|
191
186
|
rect
|
|
192
187
|
}) => {
|
|
@@ -339,12 +334,12 @@ export default class ViewportObserver {
|
|
|
339
334
|
this.isStarted = true;
|
|
340
335
|
}
|
|
341
336
|
stop() {
|
|
342
|
-
var _this$mutationObserve2, _this$
|
|
337
|
+
var _this$mutationObserve2, _this$intersectionObs1, _this$performanceObse2;
|
|
343
338
|
if (!this.isStarted) {
|
|
344
339
|
return;
|
|
345
340
|
}
|
|
346
341
|
(_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 ? void 0 : _this$mutationObserve2.disconnect();
|
|
347
|
-
(_this$
|
|
342
|
+
(_this$intersectionObs1 = this.intersectionObserver) === null || _this$intersectionObs1 === void 0 ? void 0 : _this$intersectionObs1.disconnect();
|
|
348
343
|
(_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 ? void 0 : _this$performanceObse2.disconnect();
|
|
349
344
|
this.isStarted = false;
|
|
350
345
|
// Clean up caches when stopping
|
|
@@ -549,7 +549,7 @@ function _createInteractionMetricsPayload() {
|
|
|
549
549
|
'ufo:multipayload': true,
|
|
550
550
|
'ufo:criticalPayloadCount': criticalPayloadCount
|
|
551
551
|
} : {}), 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()), {}, {
|
|
552
|
-
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(
|
|
552
|
+
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
553
553
|
namePrefix: config.namePrefix || '',
|
|
554
554
|
segmentPrefix: config.segmentPrefix || '',
|
|
555
555
|
interactionId: interactionId,
|
|
@@ -573,7 +573,8 @@ function _createInteractionMetricsPayload() {
|
|
|
573
573
|
segments: getReactUFOPayloadVersion(interaction.type) === '2.0.0' ? segmentTree : getOldSegmentsLabelStack(segments, interaction.type),
|
|
574
574
|
marks: optimizeMarks(interaction.marks, getReactUFOPayloadVersion(interaction.type)),
|
|
575
575
|
customData: optimizeCustomData(interaction),
|
|
576
|
-
reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start, getReactUFOPayloadVersion(interaction.type))
|
|
576
|
+
reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start, getReactUFOPayloadVersion(interaction.type)),
|
|
577
|
+
minorInteractions: interaction.minorInteractions
|
|
577
578
|
}, responsiveness ? {
|
|
578
579
|
responsiveness: responsiveness
|
|
579
580
|
} : {}), labelStack), pageLoadInteractionMetrics), getDetailedInteractionMetrics(resourceTimings)), getPageLoadDetailedInteractionMetrics()), getBm3TrackerTimings(interaction)), {}, {
|
|
@@ -583,8 +584,6 @@ function _createInteractionMetricsPayload() {
|
|
|
583
584
|
unknownElementName: unknownElementName
|
|
584
585
|
} : {}), unknownElementHierarchy ? {
|
|
585
586
|
unknownElementHierarchy: unknownElementHierarchy
|
|
586
|
-
} : {}), fg('platform_ufo_enable_minor_interactions') ? {
|
|
587
|
-
minorInteractions: interaction.minorInteractions
|
|
588
587
|
} : {}),
|
|
589
588
|
'ufo:payloadTime': roundEpsilon(performance.now() - interactionPayloadStart)
|
|
590
589
|
})
|
|
@@ -31,7 +31,7 @@ export var interactionExtraMetrics = new InteractionExtraMetrics();
|
|
|
31
31
|
var interactionQueue = [];
|
|
32
32
|
var segmentCache = new Map();
|
|
33
33
|
export var segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
var segmentObservers = [];
|
|
36
36
|
export function getActiveInteraction() {
|
|
37
37
|
var interactionId = getInteractionId();
|
|
@@ -967,7 +967,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
967
967
|
postInteractionLog.reset();
|
|
968
968
|
var vcObserver;
|
|
969
969
|
var previousTime = startTime;
|
|
970
|
-
var timeoutTime =
|
|
970
|
+
var timeoutTime = getInteractionTimeout(ufoName);
|
|
971
971
|
var timerID = setTimeout(function () {
|
|
972
972
|
abort(interactionId, 'timeout');
|
|
973
973
|
}, timeoutTime);
|
|
@@ -5,7 +5,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import React, { Profiler, 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';
|
|
9
8
|
import coinflip from '../coinflip';
|
|
10
9
|
import { getConfig, getDoNotAbortActivePressInteraction, getInteractionRate, getMinorInteractions } from '../config';
|
|
11
10
|
import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
|
|
@@ -151,26 +150,20 @@ export default function UFOSegment(_ref) {
|
|
|
151
150
|
this._internalHoldByID(labelStack, id, name, true);
|
|
152
151
|
},
|
|
153
152
|
tracePress: function tracePress() {
|
|
153
|
+
var _getDoNotAbortActiveP, _getMinorInteractions;
|
|
154
154
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'unknown';
|
|
155
155
|
var timestamp = arguments.length > 1 ? arguments[1] : undefined;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
} else if (interactionId.current != null) {
|
|
168
|
-
abortByNewInteraction(interactionId.current, name);
|
|
169
|
-
}
|
|
170
|
-
} else {
|
|
171
|
-
if (interactionId.current != null) {
|
|
172
|
-
abortByNewInteraction(interactionId.current, name);
|
|
173
|
-
}
|
|
156
|
+
var minorInteractions = [].concat(_toConsumableArray((_getDoNotAbortActiveP = getDoNotAbortActivePressInteraction()) !== null && _getDoNotAbortActiveP !== void 0 ? _getDoNotAbortActiveP : []), _toConsumableArray((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []));
|
|
157
|
+
if (minorInteractions.includes(name)) {
|
|
158
|
+
var _activeInteraction$mi;
|
|
159
|
+
var activeInteraction = getActiveInteraction();
|
|
160
|
+
activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
|
|
161
|
+
name: name,
|
|
162
|
+
startTime: timestamp !== null && timestamp !== void 0 ? timestamp : performance.now()
|
|
163
|
+
});
|
|
164
|
+
return;
|
|
165
|
+
} else if (interactionId.current != null) {
|
|
166
|
+
abortByNewInteraction(interactionId.current, name);
|
|
174
167
|
}
|
|
175
168
|
var rate = getInteractionRate(name, 'press');
|
|
176
169
|
if (coinflip(rate)) {
|