@atlaskit/react-ufo 4.4.4 → 4.4.6
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/config/index.js +42 -36
- package/dist/cjs/create-interaction-extra-metrics-payload/index.js +14 -6
- package/dist/cjs/interaction-metrics/index.js +21 -35
- package/dist/cjs/interaction-metrics-init/index.js +4 -1
- package/dist/cjs/vc/vc-observer/index.js +32 -9
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +25 -13
- package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +11 -2
- package/dist/es2019/config/index.js +27 -23
- package/dist/es2019/create-interaction-extra-metrics-payload/index.js +6 -1
- package/dist/es2019/interaction-metrics/index.js +22 -36
- package/dist/es2019/interaction-metrics-init/index.js +4 -1
- package/dist/es2019/vc/vc-observer/index.js +42 -19
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +21 -7
- package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +8 -1
- package/dist/esm/config/index.js +41 -36
- package/dist/esm/create-interaction-extra-metrics-payload/index.js +15 -7
- package/dist/esm/interaction-metrics/index.js +22 -36
- package/dist/esm/interaction-metrics-init/index.js +4 -1
- package/dist/esm/vc/vc-observer/index.js +32 -9
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +25 -13
- package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +11 -2
- package/dist/types/common/vc/types.d.ts +1 -0
- package/dist/types/config/index.d.ts +10 -0
- package/dist/types/vc/vc-observer/getVCRevisionDebugDetails.d.ts +1 -0
- package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -0
- package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
- package/dist/types-ts4.5/common/vc/types.d.ts +1 -0
- package/dist/types-ts4.5/config/index.d.ts +10 -0
- package/dist/types-ts4.5/vc/vc-observer/getVCRevisionDebugDetails.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
- package/package.json +4 -4
|
@@ -12,7 +12,7 @@ import { v4 as createUUID } from 'uuid';
|
|
|
12
12
|
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import coinflip from '../coinflip';
|
|
15
|
-
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
15
|
+
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getExtraInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
16
16
|
import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
|
|
17
17
|
import { sanitizeUfoName, stringifyLabelStackFully } from '../create-payload/common/utils';
|
|
18
18
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
@@ -653,15 +653,9 @@ function finishInteraction(id, data) {
|
|
|
653
653
|
data.hydration = getReactHydrationStats();
|
|
654
654
|
|
|
655
655
|
// By this time, stop the post interaction log observer if coinflip rate is 0
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
postInteractionLog.stopVCObserver();
|
|
660
|
-
}
|
|
661
|
-
} else {
|
|
662
|
-
if (!coinflip(getPostInteractionRate(data.routeName || data.ufoName, data.type))) {
|
|
663
|
-
postInteractionLog.stopVCObserver();
|
|
664
|
-
}
|
|
656
|
+
var sanitisedUfoName = sanitizeUfoName(data.ufoName);
|
|
657
|
+
if (!coinflip(getPostInteractionRate(sanitisedUfoName, data.type))) {
|
|
658
|
+
postInteractionLog.stopVCObserver();
|
|
665
659
|
}
|
|
666
660
|
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
667
661
|
if (!data.hold3pActive || data.hold3pActive.size === 0) {
|
|
@@ -669,7 +663,10 @@ function finishInteraction(id, data) {
|
|
|
669
663
|
if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
|
|
670
664
|
remove(id);
|
|
671
665
|
}
|
|
672
|
-
|
|
666
|
+
var _sanitisedUfoName = sanitizeUfoName(data.ufoName);
|
|
667
|
+
if (!coinflip(getExtraInteractionRate(_sanitisedUfoName, data.type))) {
|
|
668
|
+
interactionExtraMetrics.stopVCObserver();
|
|
669
|
+
}
|
|
673
670
|
}
|
|
674
671
|
} else {
|
|
675
672
|
var _getConfig6;
|
|
@@ -975,13 +972,7 @@ export function addOnCancelCallback(id, cancelCallback) {
|
|
|
975
972
|
}
|
|
976
973
|
export function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName) {
|
|
977
974
|
var trace = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
978
|
-
|
|
979
|
-
postInteractionLog.reset();
|
|
980
|
-
} else {
|
|
981
|
-
if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
|
|
982
|
-
postInteractionLog.reset();
|
|
983
|
-
}
|
|
984
|
-
}
|
|
975
|
+
postInteractionLog.reset();
|
|
985
976
|
var vcObserver;
|
|
986
977
|
var previousTime = startTime;
|
|
987
978
|
var timeoutTime = fg('platform_ufo_enable_timeout_config') ? getInteractionTimeout(ufoName) : CLEANUP_TIMEOUT;
|
|
@@ -1092,6 +1083,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
1092
1083
|
addHoldByID(interactionId, [], ufoName, ufoName, true);
|
|
1093
1084
|
}
|
|
1094
1085
|
if (type === 'transition' || type === 'page_load') {
|
|
1086
|
+
var _getConfig11;
|
|
1095
1087
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
1096
1088
|
var observer = vcObserver;
|
|
1097
1089
|
if (observer) {
|
|
@@ -1100,21 +1092,12 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
1100
1092
|
experienceKey: ufoName
|
|
1101
1093
|
});
|
|
1102
1094
|
}
|
|
1103
|
-
if
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
startTime: startTime
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1112
|
-
} else {
|
|
1113
|
-
if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
|
|
1114
|
-
postInteractionLog.startVCObserver({
|
|
1115
|
-
startTime: startTime
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1095
|
+
// Start post interaction observer for all if config is enabled
|
|
1096
|
+
// in case ufoName is updated at later time
|
|
1097
|
+
if ((_getConfig11 = getConfig()) !== null && _getConfig11 !== void 0 && (_getConfig11 = _getConfig11.postInteractionLog) !== null && _getConfig11 !== void 0 && _getConfig11.enabled) {
|
|
1098
|
+
postInteractionLog.startVCObserver({
|
|
1099
|
+
startTime: startTime
|
|
1100
|
+
});
|
|
1118
1101
|
}
|
|
1119
1102
|
if (coinflip(getExperimentalInteractionRate(ufoName, type))) {
|
|
1120
1103
|
experimentalVC.start({
|
|
@@ -1122,9 +1105,12 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
1122
1105
|
});
|
|
1123
1106
|
}
|
|
1124
1107
|
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1108
|
+
var _config$extraInteract;
|
|
1109
|
+
if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
|
|
1110
|
+
interactionExtraMetrics.startVCObserver({
|
|
1111
|
+
startTime: startTime
|
|
1112
|
+
}, interactionId);
|
|
1113
|
+
}
|
|
1128
1114
|
}
|
|
1129
1115
|
}
|
|
1130
1116
|
if (type === 'press' && fg('platform_ufo_enable_vc_press_interactions')) {
|
|
@@ -127,7 +127,10 @@ export function init(analyticsWebClientAsync, config) {
|
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
130
|
-
|
|
130
|
+
var _config$extraInteract;
|
|
131
|
+
if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
|
|
132
|
+
interactionExtraMetrics.initializeVCObserver(vcOptions);
|
|
133
|
+
}
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
136
|
setupHiddenTimingCapture();
|
|
@@ -9,6 +9,7 @@ var _excluded = ["__debug__element"];
|
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
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; }
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { isVCRevisionEnabled } from '../../config';
|
|
13
14
|
import { getActiveInteraction } from '../../interaction-metrics';
|
|
14
15
|
import { attachAbortListeners } from './attachAbortListeners';
|
|
@@ -95,7 +96,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
95
96
|
});
|
|
96
97
|
_defineProperty(this, "getVCResult", /*#__PURE__*/function () {
|
|
97
98
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
|
|
98
|
-
var start, stop, tti, prefix, ssr, vc, isEventAborted, experienceKey, interactionId, includeSSRRatio, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, isTTVCv1Disabled, vcAbortedResultWithRevisions, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, shouldCreateDebugDetails, v1RevisionDebugDetails, v2RevisionDebugDetails, _window$__ufo_devtool2, _window2, _window$__ufo_devtool, _window, _window$__on_ufo_vc_d2, _window4, _window$__on_ufo_vc_d, _window3, isVCClean, revisionsData, speedIndex, SSRRatio, SSRRatioNext, SSRRatioPayload, isTTVCv3Enabled;
|
|
99
|
+
var start, stop, tti, prefix, ssr, vc, isEventAborted, experienceKey, interactionId, includeSSRRatio, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, isTTVCv1Disabled, vcAbortedResultWithRevisions, _vcAbortedResultWithRevisions, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, shouldCreateDebugDetails, v1RevisionDebugDetails, v2RevisionDebugDetails, _window$__ufo_devtool2, _window2, _window$__ufo_devtool, _window, _window$__on_ufo_vc_d2, _window4, _window$__on_ufo_vc_d, _window3, isVCClean, revisionsData, speedIndex, SSRRatio, SSRRatioNext, SSRRatioPayload, isTTVCv3Enabled;
|
|
99
100
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
100
101
|
while (1) switch (_context.prev = _context.next) {
|
|
101
102
|
case 0:
|
|
@@ -112,7 +113,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
112
113
|
abortReason = rawData.abortReason, abortReasonInfo = rawData.abortReasonInfo, heatmap = rawData.heatmap, heatmapNext = rawData.heatmapNext, outOfBoundaryInfo = rawData.outOfBoundaryInfo, totalTime = rawData.totalTime, componentsLog = rawData.componentsLog, viewport = rawData.viewport, devToolsEnabled = rawData.devToolsEnabled, ratios = rawData.ratios;
|
|
113
114
|
isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01', experienceKey);
|
|
114
115
|
if (!(abortReasonInfo !== null)) {
|
|
115
|
-
_context.next =
|
|
116
|
+
_context.next = 19;
|
|
116
117
|
break;
|
|
117
118
|
}
|
|
118
119
|
// exposing data to devtools
|
|
@@ -121,22 +122,44 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
121
122
|
window.__vcNotAvailableReason = abortReasonInfo;
|
|
122
123
|
}
|
|
123
124
|
} catch (e) {}
|
|
124
|
-
|
|
125
|
+
if (!fg('platform_ufo_abort_timestamp_by_revision')) {
|
|
126
|
+
_context.next = 16;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
vcAbortedResultWithRevisions = _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [{
|
|
125
130
|
revision: 'fy25.02',
|
|
126
131
|
clean: false,
|
|
127
132
|
'metric:vc90': null,
|
|
128
|
-
abortReason: abortReason.reason
|
|
133
|
+
abortReason: abortReason.reason,
|
|
134
|
+
abortTimestamp: Math.round(abortReason.timestamp)
|
|
129
135
|
}]);
|
|
130
136
|
if (!isTTVCv1Disabled) {
|
|
131
137
|
vcAbortedResultWithRevisions["".concat(fullPrefix, "vc:rev")].push({
|
|
132
138
|
revision: 'fy25.01',
|
|
133
139
|
clean: false,
|
|
134
140
|
'metric:vc90': null,
|
|
135
|
-
abortReason: abortReason.reason
|
|
141
|
+
abortReason: abortReason.reason,
|
|
142
|
+
abortTimestamp: Math.round(abortReason.timestamp)
|
|
136
143
|
});
|
|
137
144
|
}
|
|
138
145
|
return _context.abrupt("return", vcAbortedResultWithRevisions);
|
|
139
|
-
case
|
|
146
|
+
case 16:
|
|
147
|
+
_vcAbortedResultWithRevisions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReason.reason), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp), "".concat(fullPrefix, "vc:rev"), [{
|
|
148
|
+
revision: 'fy25.02',
|
|
149
|
+
clean: false,
|
|
150
|
+
'metric:vc90': null,
|
|
151
|
+
abortReason: abortReason.reason
|
|
152
|
+
}]);
|
|
153
|
+
if (!isTTVCv1Disabled) {
|
|
154
|
+
_vcAbortedResultWithRevisions["".concat(fullPrefix, "vc:rev")].push({
|
|
155
|
+
revision: 'fy25.01',
|
|
156
|
+
clean: false,
|
|
157
|
+
'metric:vc90': null,
|
|
158
|
+
abortReason: abortReason.reason
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return _context.abrupt("return", _vcAbortedResultWithRevisions);
|
|
162
|
+
case 19:
|
|
140
163
|
ttvcV1Result = isTTVCv1Disabled ? {
|
|
141
164
|
VC: {},
|
|
142
165
|
VCBox: {},
|
|
@@ -294,16 +317,16 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
294
317
|
SSRRatioNext = VCObserver.getSSRRatio(vcNext.VCEntries.rel, ssr);
|
|
295
318
|
SSRRatioPayload = includeSSRRatio ? _defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:ssrRatio"), isTTVCv1Disabled ? SSRRatioNext : SSRRatio), "".concat(fullPrefix, "vc:next:ssrRatio"), SSRRatioNext) : {};
|
|
296
319
|
if (!isTTVCv1Disabled) {
|
|
297
|
-
_context.next =
|
|
320
|
+
_context.next = 35;
|
|
298
321
|
break;
|
|
299
322
|
}
|
|
300
323
|
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), SSRRatioPayload), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ssrRatio"), SSRRatioNext), revisionsData), speedIndex));
|
|
301
|
-
case
|
|
324
|
+
case 35:
|
|
302
325
|
isTTVCv3Enabled = isVCRevisionEnabled('fy25.03', experienceKey);
|
|
303
326
|
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
304
327
|
'metrics:vc': VC
|
|
305
328
|
}, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), isTTVCv3Enabled ? undefined : VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), "".concat(fullPrefix, "vc:ssrRatio"), SSRRatio), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), isTTVCv3Enabled ? undefined : vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), SSRRatioPayload), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), speedIndex));
|
|
306
|
-
case
|
|
329
|
+
case 37:
|
|
307
330
|
case "end":
|
|
308
331
|
return _context.stop();
|
|
309
332
|
}
|
|
@@ -79,9 +79,9 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
79
79
|
}, {
|
|
80
80
|
key: "calculateWithDebugInfo",
|
|
81
81
|
value: function () {
|
|
82
|
-
var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries) {
|
|
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, 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, 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:
|
|
@@ -178,8 +178,9 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
178
178
|
return _objectSpread(_objectSpread({}, log), {}, {
|
|
179
179
|
viewportPercentage: log.viewportPercentage
|
|
180
180
|
});
|
|
181
|
-
}) : []; //
|
|
182
|
-
|
|
181
|
+
}) : []; // If 3p metric enabled - calculate the debug details
|
|
182
|
+
shouldCalculate3p = include3p && fg('platform_ufo_enable_ttai_with_3p'); // Only calculate enhanced debug details if devtool callbacks exist
|
|
183
|
+
shouldCalculateDebugDetails = (!isPostInteraction || shouldCalculate3p) && (typeof ((_window = window) === null || _window === void 0 ? void 0 : _window.__ufo_devtool_onVCRevisionReady__) === 'function' || typeof ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.__on_ufo_vc_debug_data_ready) === 'function');
|
|
183
184
|
if (shouldCalculateDebugDetails && allEntries && vcLogs) {
|
|
184
185
|
// Pre-sort vcLogs by time for efficient lookups
|
|
185
186
|
sortedVcLogs = _toConsumableArray(vcLogs).sort(function (a, b) {
|
|
@@ -224,7 +225,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
224
225
|
try {
|
|
225
226
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
226
227
|
_entry3 = _step5.value;
|
|
227
|
-
if ('rect' in _entry3.data && !this.isEntryIncluded(_entry3)) {
|
|
228
|
+
if ('rect' in _entry3.data && !this.isEntryIncluded(_entry3, include3p)) {
|
|
228
229
|
viewportData = _entry3.data;
|
|
229
230
|
timestamp = Math.round(_entry3.time);
|
|
230
231
|
if (!ignoredEntriesByTime.has(timestamp)) {
|
|
@@ -281,7 +282,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
281
282
|
}
|
|
282
283
|
|
|
283
284
|
// Handle devtool callback
|
|
284
|
-
if (v3RevisionDebugDetails && typeof ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.__ufo_devtool_onVCRevisionReady__) === 'function') {
|
|
285
|
+
if (v3RevisionDebugDetails && typeof ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.__ufo_devtool_onVCRevisionReady__) === 'function' && !include3p) {
|
|
285
286
|
try {
|
|
286
287
|
(_window4 = window) === null || _window4 === void 0 || (_window4$__ufo_devtoo = _window4.__ufo_devtool_onVCRevisionReady__) === null || _window4$__ufo_devtoo === void 0 || _window4$__ufo_devtoo.call(_window4, v3RevisionDebugDetails);
|
|
287
288
|
} catch (e) {
|
|
@@ -290,7 +291,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
290
291
|
console.error('Error in onVCRevisionReady', e);
|
|
291
292
|
}
|
|
292
293
|
}
|
|
293
|
-
if (v3RevisionDebugDetails && typeof ((_window5 = window) === null || _window5 === void 0 ? void 0 : _window5.__on_ufo_vc_debug_data_ready) === 'function') {
|
|
294
|
+
if (v3RevisionDebugDetails && typeof ((_window5 = window) === null || _window5 === void 0 ? void 0 : _window5.__on_ufo_vc_debug_data_ready) === 'function' && !include3p) {
|
|
294
295
|
try {
|
|
295
296
|
(_window6 = window) === null || _window6 === void 0 || (_window6$__on_ufo_vc_ = _window6.__on_ufo_vc_debug_data_ready) === null || _window6$__on_ufo_vc_ === void 0 || _window6$__on_ufo_vc_.call(_window6, v3RevisionDebugDetails);
|
|
296
297
|
} catch (e) {
|
|
@@ -298,14 +299,23 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
298
299
|
console.error('Error in onVCRevisionReady', e);
|
|
299
300
|
}
|
|
300
301
|
}
|
|
302
|
+
if (v3RevisionDebugDetails && shouldCalculate3p) {
|
|
303
|
+
try {
|
|
304
|
+
// Log vc details with 3p for debugging
|
|
305
|
+
window.__ufo_devtool_vc_3p_debug_data = v3RevisionDebugDetails;
|
|
306
|
+
} catch (e) {
|
|
307
|
+
// eslint-disable-next-line no-console
|
|
308
|
+
console.error('Error in 3pDebugData', e);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
301
311
|
return _context.abrupt("return", vcDetails);
|
|
302
|
-
case
|
|
312
|
+
case 41:
|
|
303
313
|
case "end":
|
|
304
314
|
return _context.stop();
|
|
305
315
|
}
|
|
306
316
|
}, _callee, this, [[11, 23, 26, 29]]);
|
|
307
317
|
}));
|
|
308
|
-
function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
318
|
+
function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9) {
|
|
309
319
|
return _calculateWithDebugInfo.apply(this, arguments);
|
|
310
320
|
}
|
|
311
321
|
return calculateWithDebugInfo;
|
|
@@ -332,15 +342,17 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
332
342
|
_context2.next = 7;
|
|
333
343
|
break;
|
|
334
344
|
}
|
|
335
|
-
return _context2.abrupt("return", {
|
|
345
|
+
return _context2.abrupt("return", _objectSpread({
|
|
336
346
|
revision: this.revisionNo,
|
|
337
347
|
'metric:vc90': null,
|
|
338
348
|
clean: false,
|
|
339
349
|
abortReason: dirtyReason
|
|
340
|
-
})
|
|
350
|
+
}, fg('platform_ufo_abort_timestamp_by_revision') ? {
|
|
351
|
+
abortTimestamp: getVCCleanStatusResult.abortTimestamp
|
|
352
|
+
} : {}));
|
|
341
353
|
case 7:
|
|
342
354
|
_context2.next = 9;
|
|
343
|
-
return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries);
|
|
355
|
+
return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries, include3p);
|
|
344
356
|
case 9:
|
|
345
357
|
vcDetails = _context2.sent;
|
|
346
358
|
result = {
|
|
@@ -360,7 +372,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
360
372
|
}
|
|
361
373
|
}, _callee2, this);
|
|
362
374
|
}));
|
|
363
|
-
function calculate(
|
|
375
|
+
function calculate(_x0) {
|
|
364
376
|
return _calculate.apply(this, arguments);
|
|
365
377
|
}
|
|
366
378
|
return calculate;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
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; }
|
|
6
9
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -63,21 +66,27 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
|
|
|
63
66
|
key: "getVCCleanStatus",
|
|
64
67
|
value: function getVCCleanStatus(filteredEntries) {
|
|
65
68
|
var dirtyReason = '';
|
|
69
|
+
var abortTimestamp = -1;
|
|
66
70
|
var hasAbortEvent = filteredEntries.some(function (entry) {
|
|
67
71
|
if (entry.data.type === 'window:event') {
|
|
68
72
|
var data = entry.data;
|
|
69
73
|
if (ABORTING_WINDOW_EVENT.includes(data.eventType)) {
|
|
70
74
|
dirtyReason = data.eventType === 'keydown' ? 'keypress' : data.eventType;
|
|
75
|
+
if (fg('platform_ufo_abort_timestamp_by_revision')) {
|
|
76
|
+
abortTimestamp = Math.round(entry.time);
|
|
77
|
+
}
|
|
71
78
|
return true;
|
|
72
79
|
}
|
|
73
80
|
}
|
|
74
81
|
return false;
|
|
75
82
|
});
|
|
76
83
|
if (hasAbortEvent && dirtyReason) {
|
|
77
|
-
return {
|
|
84
|
+
return _objectSpread({
|
|
78
85
|
isVCClean: false,
|
|
79
86
|
dirtyReason: dirtyReason
|
|
80
|
-
}
|
|
87
|
+
}, fg('platform_ufo_abort_timestamp_by_revision') ? {
|
|
88
|
+
abortTimestamp: abortTimestamp
|
|
89
|
+
} : {});
|
|
81
90
|
}
|
|
82
91
|
return {
|
|
83
92
|
isVCClean: true
|
|
@@ -115,6 +115,7 @@ export type RevisionPayloadEntry = {
|
|
|
115
115
|
vcDetails?: RevisionPayloadVCDetails;
|
|
116
116
|
ratios?: VCRatioType;
|
|
117
117
|
abortReason?: VCAbortReason | null;
|
|
118
|
+
abortTimestamp?: number;
|
|
118
119
|
childrenIgnoredCount?: number;
|
|
119
120
|
};
|
|
120
121
|
export type RevisionPayload = RevisionPayloadEntry[];
|
|
@@ -2,6 +2,11 @@ import type { AssetsConfig, InteractionMetrics, InteractionType } from '../commo
|
|
|
2
2
|
export interface AdditionalData {
|
|
3
3
|
[key: string]: null | string | number | boolean | undefined | AdditionalData | Record<string, AdditionalData> | Array<AdditionalData>;
|
|
4
4
|
}
|
|
5
|
+
interface InteractionMetricsConfig {
|
|
6
|
+
readonly enabled?: boolean;
|
|
7
|
+
readonly rates?: Rates;
|
|
8
|
+
readonly kind?: Record<InteractionType, number>;
|
|
9
|
+
}
|
|
5
10
|
export interface SSRTiming {
|
|
6
11
|
label: string;
|
|
7
12
|
data: {
|
|
@@ -138,6 +143,10 @@ export type Config = {
|
|
|
138
143
|
* Return {@code null} if hydration was not attempted or if we do not want to report any stats.
|
|
139
144
|
*/
|
|
140
145
|
readonly getReactHydrationStats?: (() => ReactHydrationStats | undefined) | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Whether ttvc with 3p measurement is enabled and sent new event for experiences with sample rates
|
|
148
|
+
*/
|
|
149
|
+
readonly extraInteractionMetrics?: InteractionMetricsConfig;
|
|
141
150
|
};
|
|
142
151
|
export declare function setUFOConfig(newConfig: Config): void;
|
|
143
152
|
export declare function getConfig(): Config | undefined;
|
|
@@ -149,6 +158,7 @@ export declare function getInteractionRate(name: string, interactionKind: Intera
|
|
|
149
158
|
export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
|
|
150
159
|
export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
|
|
151
160
|
export declare function getCapabilityRate(capability: Capability): number;
|
|
161
|
+
export declare function getExtraInteractionRate(name: string, interactionType: InteractionType): number;
|
|
152
162
|
declare const validTypingMethods: readonly ["timeout", "timeoutNoAlloc", "mutationObserver"];
|
|
153
163
|
type ValidTypingMethod = (typeof validTypingMethods)[number];
|
|
154
164
|
export declare function getTypingPerformanceTracingMethod(): ValidTypingMethod;
|
|
@@ -6,6 +6,7 @@ declare global {
|
|
|
6
6
|
interface Window {
|
|
7
7
|
__ufo_devtool_onVCRevisionReady__?: (debugInfo: VCRevisionDebugDetails) => void;
|
|
8
8
|
__on_ufo_vc_debug_data_ready?: (debugInfo: VCRevisionDebugDetails) => void;
|
|
9
|
+
__ufo_devtool_vc_3p_debug_data?: VCRevisionDebugDetails;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
export default abstract class AbstractVCCalculatorBase implements VCCalculator {
|
|
@@ -15,6 +16,7 @@ export default abstract class AbstractVCCalculatorBase implements VCCalculator {
|
|
|
15
16
|
protected abstract getVCCleanStatus(filteredEntries: ReadonlyArray<VCObserverEntry>): {
|
|
16
17
|
isVCClean: boolean;
|
|
17
18
|
dirtyReason?: VCAbortReason;
|
|
19
|
+
abortTimestamp?: number;
|
|
18
20
|
};
|
|
19
21
|
private filterViewportEntries;
|
|
20
22
|
/**
|
|
@@ -6,10 +6,10 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
|
|
|
6
6
|
constructor();
|
|
7
7
|
protected isEntryIncluded(entry: VCObserverEntry, include3p?: boolean): boolean;
|
|
8
8
|
protected getVCCleanStatus(filteredEntries: readonly VCObserverEntry[]): {
|
|
9
|
+
abortTimestamp?: number | undefined;
|
|
9
10
|
isVCClean: boolean;
|
|
10
11
|
dirtyReason: never;
|
|
11
12
|
} | {
|
|
12
13
|
isVCClean: boolean;
|
|
13
|
-
dirtyReason?: undefined;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -115,6 +115,7 @@ export type RevisionPayloadEntry = {
|
|
|
115
115
|
vcDetails?: RevisionPayloadVCDetails;
|
|
116
116
|
ratios?: VCRatioType;
|
|
117
117
|
abortReason?: VCAbortReason | null;
|
|
118
|
+
abortTimestamp?: number;
|
|
118
119
|
childrenIgnoredCount?: number;
|
|
119
120
|
};
|
|
120
121
|
export type RevisionPayload = RevisionPayloadEntry[];
|
|
@@ -2,6 +2,11 @@ import type { AssetsConfig, InteractionMetrics, InteractionType } from '../commo
|
|
|
2
2
|
export interface AdditionalData {
|
|
3
3
|
[key: string]: null | string | number | boolean | undefined | AdditionalData | Record<string, AdditionalData> | Array<AdditionalData>;
|
|
4
4
|
}
|
|
5
|
+
interface InteractionMetricsConfig {
|
|
6
|
+
readonly enabled?: boolean;
|
|
7
|
+
readonly rates?: Rates;
|
|
8
|
+
readonly kind?: Record<InteractionType, number>;
|
|
9
|
+
}
|
|
5
10
|
export interface SSRTiming {
|
|
6
11
|
label: string;
|
|
7
12
|
data: {
|
|
@@ -138,6 +143,10 @@ export type Config = {
|
|
|
138
143
|
* Return {@code null} if hydration was not attempted or if we do not want to report any stats.
|
|
139
144
|
*/
|
|
140
145
|
readonly getReactHydrationStats?: (() => ReactHydrationStats | undefined) | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Whether ttvc with 3p measurement is enabled and sent new event for experiences with sample rates
|
|
148
|
+
*/
|
|
149
|
+
readonly extraInteractionMetrics?: InteractionMetricsConfig;
|
|
141
150
|
};
|
|
142
151
|
export declare function setUFOConfig(newConfig: Config): void;
|
|
143
152
|
export declare function getConfig(): Config | undefined;
|
|
@@ -149,6 +158,7 @@ export declare function getInteractionRate(name: string, interactionKind: Intera
|
|
|
149
158
|
export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
|
|
150
159
|
export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
|
|
151
160
|
export declare function getCapabilityRate(capability: Capability): number;
|
|
161
|
+
export declare function getExtraInteractionRate(name: string, interactionType: InteractionType): number;
|
|
152
162
|
declare const validTypingMethods: readonly [
|
|
153
163
|
"timeout",
|
|
154
164
|
"timeoutNoAlloc",
|
package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ declare global {
|
|
|
6
6
|
interface Window {
|
|
7
7
|
__ufo_devtool_onVCRevisionReady__?: (debugInfo: VCRevisionDebugDetails) => void;
|
|
8
8
|
__on_ufo_vc_debug_data_ready?: (debugInfo: VCRevisionDebugDetails) => void;
|
|
9
|
+
__ufo_devtool_vc_3p_debug_data?: VCRevisionDebugDetails;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
export default abstract class AbstractVCCalculatorBase implements VCCalculator {
|
|
@@ -15,6 +16,7 @@ export default abstract class AbstractVCCalculatorBase implements VCCalculator {
|
|
|
15
16
|
protected abstract getVCCleanStatus(filteredEntries: ReadonlyArray<VCObserverEntry>): {
|
|
16
17
|
isVCClean: boolean;
|
|
17
18
|
dirtyReason?: VCAbortReason;
|
|
19
|
+
abortTimestamp?: number;
|
|
18
20
|
};
|
|
19
21
|
private filterViewportEntries;
|
|
20
22
|
/**
|
|
@@ -6,10 +6,10 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
|
|
|
6
6
|
constructor();
|
|
7
7
|
protected isEntryIncluded(entry: VCObserverEntry, include3p?: boolean): boolean;
|
|
8
8
|
protected getVCCleanStatus(filteredEntries: readonly VCObserverEntry[]): {
|
|
9
|
+
abortTimestamp?: number | undefined;
|
|
9
10
|
isVCClean: boolean;
|
|
10
11
|
dirtyReason: never;
|
|
11
12
|
} | {
|
|
12
13
|
isVCClean: boolean;
|
|
13
|
-
dirtyReason?: undefined;
|
|
14
14
|
};
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.6",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -145,6 +145,9 @@
|
|
|
145
145
|
"enable_ufo_devtools_api_for_extra_events": {
|
|
146
146
|
"type": "boolean"
|
|
147
147
|
},
|
|
148
|
+
"platform_ufo_abort_timestamp_by_revision": {
|
|
149
|
+
"type": "boolean"
|
|
150
|
+
},
|
|
148
151
|
"platform_ufo_no_vc_on_aborted": {
|
|
149
152
|
"type": "boolean"
|
|
150
153
|
},
|
|
@@ -178,9 +181,6 @@
|
|
|
178
181
|
"platform_ufo_segment_critical_metrics": {
|
|
179
182
|
"type": "boolean"
|
|
180
183
|
},
|
|
181
|
-
"platform_ufo_post_interaction_check_name": {
|
|
182
|
-
"type": "boolean"
|
|
183
|
-
},
|
|
184
184
|
"platform_ufo_report_non_htmlelement_selectors": {
|
|
185
185
|
"type": "boolean"
|
|
186
186
|
},
|