@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
|
@@ -162,29 +162,7 @@ export function getExperimentalInteractionRate(name, interactionType) {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
export function getPostInteractionRate(name, interactionType) {
|
|
165
|
-
|
|
166
|
-
if (!config) {
|
|
167
|
-
return 0;
|
|
168
|
-
}
|
|
169
|
-
const {
|
|
170
|
-
postInteractionLog
|
|
171
|
-
} = config;
|
|
172
|
-
if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
|
|
173
|
-
return 0;
|
|
174
|
-
}
|
|
175
|
-
if (interactionType !== 'page_load' && interactionType !== 'transition') {
|
|
176
|
-
return 0;
|
|
177
|
-
}
|
|
178
|
-
if (postInteractionLog.rates && typeof postInteractionLog.rates[name] === 'number') {
|
|
179
|
-
return postInteractionLog.rates[name];
|
|
180
|
-
}
|
|
181
|
-
if (postInteractionLog.kind && typeof postInteractionLog.kind[interactionType] === 'number') {
|
|
182
|
-
return postInteractionLog.kind[interactionType];
|
|
183
|
-
}
|
|
184
|
-
return 0;
|
|
185
|
-
} catch (e) {
|
|
186
|
-
return 0;
|
|
187
|
-
}
|
|
165
|
+
return getConfigRate(name, interactionType, 'postInteractionLog');
|
|
188
166
|
}
|
|
189
167
|
export function getCapabilityRate(capability) {
|
|
190
168
|
if (fg('platform_ufo_remove_deprecated_config_fields')) {
|
|
@@ -208,6 +186,32 @@ export function getCapabilityRate(capability) {
|
|
|
208
186
|
return 0;
|
|
209
187
|
}
|
|
210
188
|
}
|
|
189
|
+
function getConfigRate(name, interactionType, configName) {
|
|
190
|
+
try {
|
|
191
|
+
if (!config) {
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
const gotConfig = config[configName];
|
|
195
|
+
if (!(gotConfig !== null && gotConfig !== void 0 && gotConfig.enabled)) {
|
|
196
|
+
return 0;
|
|
197
|
+
}
|
|
198
|
+
if (interactionType !== 'page_load' && interactionType !== 'transition') {
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
201
|
+
if (gotConfig.rates && typeof gotConfig.rates[name] === 'number') {
|
|
202
|
+
return gotConfig.rates[name];
|
|
203
|
+
}
|
|
204
|
+
if ('kind' in gotConfig && gotConfig.kind && typeof gotConfig.kind[interactionType] === 'number') {
|
|
205
|
+
return gotConfig.kind[interactionType];
|
|
206
|
+
}
|
|
207
|
+
return 0;
|
|
208
|
+
} catch (e) {
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
export function getExtraInteractionRate(name, interactionType) {
|
|
213
|
+
return getConfigRate(name, interactionType, 'extraInteractionMetrics');
|
|
214
|
+
}
|
|
211
215
|
const validTypingMethods = ['timeout', 'timeoutNoAlloc', 'mutationObserver'];
|
|
212
216
|
export function getTypingPerformanceTracingMethod() {
|
|
213
217
|
const defaultMethod = 'timeout';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import coinflip from '../coinflip';
|
|
2
|
+
import { getConfig, getExtraInteractionRate } from '../config';
|
|
2
3
|
import { getMoreAccuratePageVisibilityUpToTTAI } from '../create-payload';
|
|
3
4
|
import { sanitizeUfoName } from '../create-payload/common/utils';
|
|
4
5
|
import getPageVisibilityUpToTTAI from '../create-payload/utils/get-page-visibility-up-to-ttai';
|
|
@@ -24,6 +25,10 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
|
|
|
24
25
|
isPreviousInteractionAborted,
|
|
25
26
|
abortedByInteractionName
|
|
26
27
|
} = interaction;
|
|
28
|
+
const configRate = getExtraInteractionRate(ufoName, type);
|
|
29
|
+
if (!coinflip(configRate)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
27
32
|
const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
28
33
|
const isPageLoad = type === 'page_load' || type === 'transition';
|
|
29
34
|
if (!isPageLoad) {
|
|
@@ -2,7 +2,7 @@ import { v4 as createUUID } from 'uuid';
|
|
|
2
2
|
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import coinflip from '../coinflip';
|
|
5
|
-
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
5
|
+
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getExtraInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
6
6
|
import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
|
|
7
7
|
import { sanitizeUfoName, stringifyLabelStackFully } from '../create-payload/common/utils';
|
|
8
8
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
@@ -617,15 +617,9 @@ function finishInteraction(id, data, endTime = performance.now()) {
|
|
|
617
617
|
data.hydration = getReactHydrationStats();
|
|
618
618
|
|
|
619
619
|
// By this time, stop the post interaction log observer if coinflip rate is 0
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
postInteractionLog.stopVCObserver();
|
|
624
|
-
}
|
|
625
|
-
} else {
|
|
626
|
-
if (!coinflip(getPostInteractionRate(data.routeName || data.ufoName, data.type))) {
|
|
627
|
-
postInteractionLog.stopVCObserver();
|
|
628
|
-
}
|
|
620
|
+
const sanitisedUfoName = sanitizeUfoName(data.ufoName);
|
|
621
|
+
if (!coinflip(getPostInteractionRate(sanitisedUfoName, data.type))) {
|
|
622
|
+
postInteractionLog.stopVCObserver();
|
|
629
623
|
}
|
|
630
624
|
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
631
625
|
if (!data.hold3pActive || data.hold3pActive.size === 0) {
|
|
@@ -633,7 +627,10 @@ function finishInteraction(id, data, endTime = performance.now()) {
|
|
|
633
627
|
if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5$experimen = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5$experimen !== void 0 && _getConfig5$experimen.enabled)) {
|
|
634
628
|
remove(id);
|
|
635
629
|
}
|
|
636
|
-
|
|
630
|
+
const sanitisedUfoName = sanitizeUfoName(data.ufoName);
|
|
631
|
+
if (!coinflip(getExtraInteractionRate(sanitisedUfoName, data.type))) {
|
|
632
|
+
interactionExtraMetrics.stopVCObserver();
|
|
633
|
+
}
|
|
637
634
|
}
|
|
638
635
|
} else {
|
|
639
636
|
var _getConfig6, _getConfig6$experimen;
|
|
@@ -899,13 +896,7 @@ export function addOnCancelCallback(id, cancelCallback) {
|
|
|
899
896
|
interaction === null || interaction === void 0 ? void 0 : interaction.cancelCallbacks.push(cancelCallback);
|
|
900
897
|
}
|
|
901
898
|
export function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName, trace = null) {
|
|
902
|
-
|
|
903
|
-
postInteractionLog.reset();
|
|
904
|
-
} else {
|
|
905
|
-
if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
|
|
906
|
-
postInteractionLog.reset();
|
|
907
|
-
}
|
|
908
|
-
}
|
|
899
|
+
postInteractionLog.reset();
|
|
909
900
|
let vcObserver;
|
|
910
901
|
let previousTime = startTime;
|
|
911
902
|
let timeoutTime = fg('platform_ufo_enable_timeout_config') ? getInteractionTimeout(ufoName) : CLEANUP_TIMEOUT;
|
|
@@ -1016,6 +1007,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
1016
1007
|
addHoldByID(interactionId, [], ufoName, ufoName, true);
|
|
1017
1008
|
}
|
|
1018
1009
|
if (type === 'transition' || type === 'page_load') {
|
|
1010
|
+
var _getConfig11, _getConfig11$postInte;
|
|
1019
1011
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
1020
1012
|
const observer = vcObserver;
|
|
1021
1013
|
if (observer) {
|
|
@@ -1024,21 +1016,12 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
1024
1016
|
experienceKey: ufoName
|
|
1025
1017
|
});
|
|
1026
1018
|
}
|
|
1027
|
-
if
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
startTime
|
|
1034
|
-
});
|
|
1035
|
-
}
|
|
1036
|
-
} else {
|
|
1037
|
-
if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
|
|
1038
|
-
postInteractionLog.startVCObserver({
|
|
1039
|
-
startTime
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
1019
|
+
// Start post interaction observer for all if config is enabled
|
|
1020
|
+
// in case ufoName is updated at later time
|
|
1021
|
+
if ((_getConfig11 = getConfig()) !== null && _getConfig11 !== void 0 && (_getConfig11$postInte = _getConfig11.postInteractionLog) !== null && _getConfig11$postInte !== void 0 && _getConfig11$postInte.enabled) {
|
|
1022
|
+
postInteractionLog.startVCObserver({
|
|
1023
|
+
startTime
|
|
1024
|
+
});
|
|
1042
1025
|
}
|
|
1043
1026
|
if (coinflip(getExperimentalInteractionRate(ufoName, type))) {
|
|
1044
1027
|
experimentalVC.start({
|
|
@@ -1046,9 +1029,12 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
1046
1029
|
});
|
|
1047
1030
|
}
|
|
1048
1031
|
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1032
|
+
var _config$extraInteract;
|
|
1033
|
+
if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
|
|
1034
|
+
interactionExtraMetrics.startVCObserver({
|
|
1035
|
+
startTime
|
|
1036
|
+
}, interactionId);
|
|
1037
|
+
}
|
|
1052
1038
|
}
|
|
1053
1039
|
}
|
|
1054
1040
|
if (type === 'press' && fg('platform_ufo_enable_vc_press_interactions')) {
|
|
@@ -112,7 +112,10 @@ export function init(analyticsWebClientAsync, config) {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
115
|
-
|
|
115
|
+
var _config$extraInteract;
|
|
116
|
+
if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
|
|
117
|
+
interactionExtraMetrics.initializeVCObserver(vcOptions);
|
|
118
|
+
}
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
121
|
setupHiddenTimingCapture();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { isVCRevisionEnabled } from '../../config';
|
|
3
4
|
import { getActiveInteraction } from '../../interaction-metrics';
|
|
4
5
|
import { attachAbortListeners } from './attachAbortListeners';
|
|
@@ -123,26 +124,48 @@ export class VCObserver {
|
|
|
123
124
|
window.__vcNotAvailableReason = abortReasonInfo;
|
|
124
125
|
}
|
|
125
126
|
} catch (e) {}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
127
|
+
if (fg('platform_ufo_abort_timestamp_by_revision')) {
|
|
128
|
+
const vcAbortedResultWithRevisions = {
|
|
129
|
+
[`${fullPrefix}vc:rev`]: [{
|
|
130
|
+
revision: 'fy25.02',
|
|
131
|
+
clean: false,
|
|
132
|
+
'metric:vc90': null,
|
|
133
|
+
abortReason: abortReason.reason,
|
|
134
|
+
abortTimestamp: Math.round(abortReason.timestamp)
|
|
135
|
+
}]
|
|
136
|
+
};
|
|
137
|
+
if (!isTTVCv1Disabled) {
|
|
138
|
+
vcAbortedResultWithRevisions[`${fullPrefix}vc:rev`].push({
|
|
139
|
+
revision: 'fy25.01',
|
|
140
|
+
clean: false,
|
|
141
|
+
'metric:vc90': null,
|
|
142
|
+
abortReason: abortReason.reason,
|
|
143
|
+
abortTimestamp: Math.round(abortReason.timestamp)
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return vcAbortedResultWithRevisions;
|
|
147
|
+
} else {
|
|
148
|
+
const vcAbortedResultWithRevisions = {
|
|
149
|
+
[`${fullPrefix}vc:state`]: false,
|
|
150
|
+
[`${fullPrefix}vc:abort:reason`]: abortReason.reason,
|
|
151
|
+
[`${fullPrefix}vc:abort:timestamp`]: abortReason.timestamp,
|
|
152
|
+
[`${fullPrefix}vc:rev`]: [{
|
|
153
|
+
revision: 'fy25.02',
|
|
154
|
+
clean: false,
|
|
155
|
+
'metric:vc90': null,
|
|
156
|
+
abortReason: abortReason.reason
|
|
157
|
+
}]
|
|
158
|
+
};
|
|
159
|
+
if (!isTTVCv1Disabled) {
|
|
160
|
+
vcAbortedResultWithRevisions[`${fullPrefix}vc:rev`].push({
|
|
161
|
+
revision: 'fy25.01',
|
|
162
|
+
clean: false,
|
|
163
|
+
'metric:vc90': null,
|
|
164
|
+
abortReason: abortReason.reason
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return vcAbortedResultWithRevisions;
|
|
144
168
|
}
|
|
145
|
-
return vcAbortedResultWithRevisions;
|
|
146
169
|
}
|
|
147
170
|
const ttvcV1Result = isTTVCv1Disabled ? {
|
|
148
171
|
VC: {},
|
|
@@ -40,7 +40,7 @@ export default class AbstractVCCalculatorBase {
|
|
|
40
40
|
}
|
|
41
41
|
return ratios;
|
|
42
42
|
}
|
|
43
|
-
async calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries) {
|
|
43
|
+
async calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p) {
|
|
44
44
|
var _window, _window2, _window3, _window5;
|
|
45
45
|
const percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99];
|
|
46
46
|
if (fg('platform_ufo_send_vc_100')) {
|
|
@@ -112,8 +112,10 @@ export default class AbstractVCCalculatorBase {
|
|
|
112
112
|
viewportPercentage: log.viewportPercentage
|
|
113
113
|
})) : [];
|
|
114
114
|
|
|
115
|
+
// If 3p metric enabled - calculate the debug details
|
|
116
|
+
const shouldCalculate3p = include3p && fg('platform_ufo_enable_ttai_with_3p');
|
|
115
117
|
// Only calculate enhanced debug details if devtool callbacks exist
|
|
116
|
-
const shouldCalculateDebugDetails = !isPostInteraction && (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');
|
|
118
|
+
const 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');
|
|
117
119
|
if (shouldCalculateDebugDetails && allEntries && vcLogs) {
|
|
118
120
|
// Pre-sort vcLogs by time for efficient lookups
|
|
119
121
|
const sortedVcLogs = [...vcLogs].sort((a, b) => a.time - b.time);
|
|
@@ -149,7 +151,7 @@ export default class AbstractVCCalculatorBase {
|
|
|
149
151
|
// Group ignored entries by timestamp
|
|
150
152
|
const ignoredEntriesByTime = new Map();
|
|
151
153
|
for (const entry of allEntries) {
|
|
152
|
-
if ('rect' in entry.data && !this.isEntryIncluded(entry)) {
|
|
154
|
+
if ('rect' in entry.data && !this.isEntryIncluded(entry, include3p)) {
|
|
153
155
|
var _ignoredEntriesByTime;
|
|
154
156
|
const viewportData = entry.data;
|
|
155
157
|
const timestamp = Math.round(entry.time);
|
|
@@ -193,7 +195,7 @@ export default class AbstractVCCalculatorBase {
|
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
// Handle devtool callback
|
|
196
|
-
if (v3RevisionDebugDetails && typeof ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.__ufo_devtool_onVCRevisionReady__) === 'function') {
|
|
198
|
+
if (v3RevisionDebugDetails && typeof ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.__ufo_devtool_onVCRevisionReady__) === 'function' && !include3p) {
|
|
197
199
|
try {
|
|
198
200
|
var _window4, _window4$__ufo_devtoo;
|
|
199
201
|
(_window4 = window) === null || _window4 === void 0 ? void 0 : (_window4$__ufo_devtoo = _window4.__ufo_devtool_onVCRevisionReady__) === null || _window4$__ufo_devtoo === void 0 ? void 0 : _window4$__ufo_devtoo.call(_window4, v3RevisionDebugDetails);
|
|
@@ -203,7 +205,7 @@ export default class AbstractVCCalculatorBase {
|
|
|
203
205
|
console.error('Error in onVCRevisionReady', e);
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
|
-
if (v3RevisionDebugDetails && typeof ((_window5 = window) === null || _window5 === void 0 ? void 0 : _window5.__on_ufo_vc_debug_data_ready) === 'function') {
|
|
208
|
+
if (v3RevisionDebugDetails && typeof ((_window5 = window) === null || _window5 === void 0 ? void 0 : _window5.__on_ufo_vc_debug_data_ready) === 'function' && !include3p) {
|
|
207
209
|
try {
|
|
208
210
|
var _window6, _window6$__on_ufo_vc_;
|
|
209
211
|
(_window6 = window) === null || _window6 === void 0 ? void 0 : (_window6$__on_ufo_vc_ = _window6.__on_ufo_vc_debug_data_ready) === null || _window6$__on_ufo_vc_ === void 0 ? void 0 : _window6$__on_ufo_vc_.call(_window6, v3RevisionDebugDetails);
|
|
@@ -212,6 +214,15 @@ export default class AbstractVCCalculatorBase {
|
|
|
212
214
|
console.error('Error in onVCRevisionReady', e);
|
|
213
215
|
}
|
|
214
216
|
}
|
|
217
|
+
if (v3RevisionDebugDetails && shouldCalculate3p) {
|
|
218
|
+
try {
|
|
219
|
+
// Log vc details with 3p for debugging
|
|
220
|
+
window.__ufo_devtool_vc_3p_debug_data = v3RevisionDebugDetails;
|
|
221
|
+
} catch (e) {
|
|
222
|
+
// eslint-disable-next-line no-console
|
|
223
|
+
console.error('Error in 3pDebugData', e);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
215
226
|
return vcDetails;
|
|
216
227
|
}
|
|
217
228
|
async calculate({
|
|
@@ -236,10 +247,13 @@ export default class AbstractVCCalculatorBase {
|
|
|
236
247
|
revision: this.revisionNo,
|
|
237
248
|
'metric:vc90': null,
|
|
238
249
|
clean: false,
|
|
239
|
-
abortReason: dirtyReason
|
|
250
|
+
abortReason: dirtyReason,
|
|
251
|
+
...(fg('platform_ufo_abort_timestamp_by_revision') ? {
|
|
252
|
+
abortTimestamp: getVCCleanStatusResult.abortTimestamp
|
|
253
|
+
} : {})
|
|
240
254
|
};
|
|
241
255
|
}
|
|
242
|
-
const vcDetails = await this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries);
|
|
256
|
+
const vcDetails = await this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries, include3p);
|
|
243
257
|
const result = {
|
|
244
258
|
revision: this.revisionNo,
|
|
245
259
|
clean: true,
|
|
@@ -50,11 +50,15 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
|
|
|
50
50
|
}
|
|
51
51
|
getVCCleanStatus(filteredEntries) {
|
|
52
52
|
let dirtyReason = '';
|
|
53
|
+
let abortTimestamp = -1;
|
|
53
54
|
const hasAbortEvent = filteredEntries.some(entry => {
|
|
54
55
|
if (entry.data.type === 'window:event') {
|
|
55
56
|
const data = entry.data;
|
|
56
57
|
if (ABORTING_WINDOW_EVENT.includes(data.eventType)) {
|
|
57
58
|
dirtyReason = data.eventType === 'keydown' ? 'keypress' : data.eventType;
|
|
59
|
+
if (fg('platform_ufo_abort_timestamp_by_revision')) {
|
|
60
|
+
abortTimestamp = Math.round(entry.time);
|
|
61
|
+
}
|
|
58
62
|
return true;
|
|
59
63
|
}
|
|
60
64
|
}
|
|
@@ -63,7 +67,10 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
|
|
|
63
67
|
if (hasAbortEvent && dirtyReason) {
|
|
64
68
|
return {
|
|
65
69
|
isVCClean: false,
|
|
66
|
-
dirtyReason
|
|
70
|
+
dirtyReason,
|
|
71
|
+
...(fg('platform_ufo_abort_timestamp_by_revision') ? {
|
|
72
|
+
abortTimestamp
|
|
73
|
+
} : {})
|
|
67
74
|
};
|
|
68
75
|
}
|
|
69
76
|
return {
|
package/dist/esm/config/index.js
CHANGED
|
@@ -159,28 +159,7 @@ export function getExperimentalInteractionRate(name, interactionType) {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
export function getPostInteractionRate(name, interactionType) {
|
|
162
|
-
|
|
163
|
-
if (!config) {
|
|
164
|
-
return 0;
|
|
165
|
-
}
|
|
166
|
-
var _config4 = config,
|
|
167
|
-
postInteractionLog = _config4.postInteractionLog;
|
|
168
|
-
if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
|
|
169
|
-
return 0;
|
|
170
|
-
}
|
|
171
|
-
if (interactionType !== 'page_load' && interactionType !== 'transition') {
|
|
172
|
-
return 0;
|
|
173
|
-
}
|
|
174
|
-
if (postInteractionLog.rates && typeof postInteractionLog.rates[name] === 'number') {
|
|
175
|
-
return postInteractionLog.rates[name];
|
|
176
|
-
}
|
|
177
|
-
if (postInteractionLog.kind && typeof postInteractionLog.kind[interactionType] === 'number') {
|
|
178
|
-
return postInteractionLog.kind[interactionType];
|
|
179
|
-
}
|
|
180
|
-
return 0;
|
|
181
|
-
} catch (e) {
|
|
182
|
-
return 0;
|
|
183
|
-
}
|
|
162
|
+
return getConfigRate(name, interactionType, 'postInteractionLog');
|
|
184
163
|
}
|
|
185
164
|
export function getCapabilityRate(capability) {
|
|
186
165
|
if (fg('platform_ufo_remove_deprecated_config_fields')) {
|
|
@@ -190,8 +169,8 @@ export function getCapabilityRate(capability) {
|
|
|
190
169
|
if (!config) {
|
|
191
170
|
return 0;
|
|
192
171
|
}
|
|
193
|
-
var
|
|
194
|
-
capabilityRate =
|
|
172
|
+
var _config4 = config,
|
|
173
|
+
capabilityRate = _config4.capability;
|
|
195
174
|
if (capabilityRate != null) {
|
|
196
175
|
var rate = capabilityRate[capability];
|
|
197
176
|
if (rate != null) {
|
|
@@ -203,6 +182,32 @@ export function getCapabilityRate(capability) {
|
|
|
203
182
|
return 0;
|
|
204
183
|
}
|
|
205
184
|
}
|
|
185
|
+
function getConfigRate(name, interactionType, configName) {
|
|
186
|
+
try {
|
|
187
|
+
if (!config) {
|
|
188
|
+
return 0;
|
|
189
|
+
}
|
|
190
|
+
var gotConfig = config[configName];
|
|
191
|
+
if (!(gotConfig !== null && gotConfig !== void 0 && gotConfig.enabled)) {
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
if (interactionType !== 'page_load' && interactionType !== 'transition') {
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
if (gotConfig.rates && typeof gotConfig.rates[name] === 'number') {
|
|
198
|
+
return gotConfig.rates[name];
|
|
199
|
+
}
|
|
200
|
+
if ('kind' in gotConfig && gotConfig.kind && typeof gotConfig.kind[interactionType] === 'number') {
|
|
201
|
+
return gotConfig.kind[interactionType];
|
|
202
|
+
}
|
|
203
|
+
return 0;
|
|
204
|
+
} catch (e) {
|
|
205
|
+
return 0;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export function getExtraInteractionRate(name, interactionType) {
|
|
209
|
+
return getConfigRate(name, interactionType, 'extraInteractionMetrics');
|
|
210
|
+
}
|
|
206
211
|
var validTypingMethods = ['timeout', 'timeoutNoAlloc', 'mutationObserver'];
|
|
207
212
|
export function getTypingPerformanceTracingMethod() {
|
|
208
213
|
var defaultMethod = 'timeout';
|
|
@@ -210,8 +215,8 @@ export function getTypingPerformanceTracingMethod() {
|
|
|
210
215
|
if (!config) {
|
|
211
216
|
return defaultMethod;
|
|
212
217
|
}
|
|
213
|
-
var
|
|
214
|
-
typingMethod =
|
|
218
|
+
var _config5 = config,
|
|
219
|
+
typingMethod = _config5.typingMethod;
|
|
215
220
|
if (typingMethod != null && validTypingMethods.find(function (m) {
|
|
216
221
|
return m === typingMethod;
|
|
217
222
|
})) {
|
|
@@ -230,8 +235,8 @@ export function getAwaitBM3TTIList() {
|
|
|
230
235
|
if (!config) {
|
|
231
236
|
return [];
|
|
232
237
|
}
|
|
233
|
-
var
|
|
234
|
-
awaitBM3TTI =
|
|
238
|
+
var _config6 = config,
|
|
239
|
+
awaitBM3TTI = _config6.awaitBM3TTI;
|
|
235
240
|
if (awaitBM3TTI != null) {
|
|
236
241
|
return awaitBM3TTI;
|
|
237
242
|
} else {
|
|
@@ -251,8 +256,8 @@ export function getUfoNameOverrides() {
|
|
|
251
256
|
if (!config) {
|
|
252
257
|
return undefined;
|
|
253
258
|
}
|
|
254
|
-
var
|
|
255
|
-
ufoNameOverrides =
|
|
259
|
+
var _config7 = config,
|
|
260
|
+
ufoNameOverrides = _config7.ufoNameOverrides;
|
|
256
261
|
if (ufoNameOverrides != null) {
|
|
257
262
|
return ufoNameOverrides;
|
|
258
263
|
}
|
|
@@ -268,8 +273,8 @@ export function getDoNotAbortActivePressInteraction() {
|
|
|
268
273
|
if (!config) {
|
|
269
274
|
return undefined;
|
|
270
275
|
}
|
|
271
|
-
var
|
|
272
|
-
doNotAbortActivePressInteraction =
|
|
276
|
+
var _config8 = config,
|
|
277
|
+
doNotAbortActivePressInteraction = _config8.doNotAbortActivePressInteraction;
|
|
273
278
|
return doNotAbortActivePressInteraction;
|
|
274
279
|
} catch (e) {
|
|
275
280
|
return undefined;
|
|
@@ -282,8 +287,8 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
282
287
|
if (!config) {
|
|
283
288
|
return undefined;
|
|
284
289
|
}
|
|
285
|
-
var
|
|
286
|
-
doNotAbortActivePressInteractionOnTransition =
|
|
290
|
+
var _config9 = config,
|
|
291
|
+
doNotAbortActivePressInteractionOnTransition = _config9.doNotAbortActivePressInteractionOnTransition;
|
|
287
292
|
return doNotAbortActivePressInteractionOnTransition;
|
|
288
293
|
} catch (e) {
|
|
289
294
|
return undefined;
|
|
@@ -295,8 +300,8 @@ export function getInteractionTimeout(ufoName) {
|
|
|
295
300
|
if (!config) {
|
|
296
301
|
return CLEANUP_TIMEOUT;
|
|
297
302
|
}
|
|
298
|
-
var
|
|
299
|
-
interactionTimeout =
|
|
303
|
+
var _config0 = config,
|
|
304
|
+
interactionTimeout = _config0.interactionTimeout;
|
|
300
305
|
if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
|
|
301
306
|
return interactionTimeout[ufoName];
|
|
302
307
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import
|
|
3
|
+
import coinflip from '../coinflip';
|
|
4
|
+
import { getConfig, getExtraInteractionRate } from '../config';
|
|
4
5
|
import { getMoreAccuratePageVisibilityUpToTTAI } from '../create-payload';
|
|
5
6
|
import { sanitizeUfoName } from '../create-payload/common/utils';
|
|
6
7
|
import getPageVisibilityUpToTTAI from '../create-payload/utils/get-page-visibility-up-to-ttai';
|
|
@@ -14,7 +15,7 @@ function createInteractionExtraLogPayload(_x, _x2) {
|
|
|
14
15
|
function _createInteractionExtraLogPayload() {
|
|
15
16
|
_createInteractionExtraLogPayload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interactionId, interaction) {
|
|
16
17
|
var _getTTAI, _finalVCMetrics$ufoV, _window$location;
|
|
17
|
-
var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, ttvc, payload;
|
|
18
|
+
var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, ttvc, payload;
|
|
18
19
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19
20
|
while (1) switch (_context.prev = _context.next) {
|
|
20
21
|
case 0:
|
|
@@ -26,21 +27,28 @@ function _createInteractionExtraLogPayload() {
|
|
|
26
27
|
throw Error('UFO Configuration not provided');
|
|
27
28
|
case 3:
|
|
28
29
|
end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName;
|
|
30
|
+
configRate = getExtraInteractionRate(ufoName, type);
|
|
31
|
+
if (coinflip(configRate)) {
|
|
32
|
+
_context.next = 7;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
return _context.abrupt("return", null);
|
|
36
|
+
case 7:
|
|
29
37
|
pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
30
38
|
isPageLoad = type === 'page_load' || type === 'transition';
|
|
31
39
|
if (isPageLoad) {
|
|
32
|
-
_context.next =
|
|
40
|
+
_context.next = 11;
|
|
33
41
|
break;
|
|
34
42
|
}
|
|
35
43
|
return _context.abrupt("return", null);
|
|
36
|
-
case
|
|
44
|
+
case 11:
|
|
37
45
|
calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
|
|
38
46
|
moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? getMoreAccuratePageVisibilityUpToTTAI(interaction) : null;
|
|
39
47
|
extraTTAI = (_getTTAI = getTTAI(interaction)) !== null && _getTTAI !== void 0 ? _getTTAI : undefined;
|
|
40
48
|
newUFOName = sanitizeUfoName(ufoName);
|
|
41
|
-
_context.next =
|
|
49
|
+
_context.next = 17;
|
|
42
50
|
return getVCMetrics(interaction, true);
|
|
43
|
-
case
|
|
51
|
+
case 17:
|
|
44
52
|
finalVCMetrics = _context.sent;
|
|
45
53
|
ttvc = (_finalVCMetrics$ufoV = finalVCMetrics['ufo:vc:rev']) === null || _finalVCMetrics$ufoV === void 0 ? void 0 : _finalVCMetrics$ufoV.map(function (revision) {
|
|
46
54
|
if (revision['metric:vc90'] === null || revision.clean !== true) {
|
|
@@ -98,7 +106,7 @@ function _createInteractionExtraLogPayload() {
|
|
|
98
106
|
};
|
|
99
107
|
payload.attributes.properties['event:sizeInKb'] = getPayloadSize(payload.attributes.properties);
|
|
100
108
|
return _context.abrupt("return", payload);
|
|
101
|
-
case
|
|
109
|
+
case 22:
|
|
102
110
|
case "end":
|
|
103
111
|
return _context.stop();
|
|
104
112
|
}
|