@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.
Files changed (33) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/config/index.js +42 -36
  3. package/dist/cjs/create-interaction-extra-metrics-payload/index.js +14 -6
  4. package/dist/cjs/interaction-metrics/index.js +21 -35
  5. package/dist/cjs/interaction-metrics-init/index.js +4 -1
  6. package/dist/cjs/vc/vc-observer/index.js +32 -9
  7. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +25 -13
  8. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +11 -2
  9. package/dist/es2019/config/index.js +27 -23
  10. package/dist/es2019/create-interaction-extra-metrics-payload/index.js +6 -1
  11. package/dist/es2019/interaction-metrics/index.js +22 -36
  12. package/dist/es2019/interaction-metrics-init/index.js +4 -1
  13. package/dist/es2019/vc/vc-observer/index.js +42 -19
  14. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +21 -7
  15. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +8 -1
  16. package/dist/esm/config/index.js +41 -36
  17. package/dist/esm/create-interaction-extra-metrics-payload/index.js +15 -7
  18. package/dist/esm/interaction-metrics/index.js +22 -36
  19. package/dist/esm/interaction-metrics-init/index.js +4 -1
  20. package/dist/esm/vc/vc-observer/index.js +32 -9
  21. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +25 -13
  22. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +11 -2
  23. package/dist/types/common/vc/types.d.ts +1 -0
  24. package/dist/types/config/index.d.ts +10 -0
  25. package/dist/types/vc/vc-observer/getVCRevisionDebugDetails.d.ts +1 -0
  26. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -0
  27. package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
  28. package/dist/types-ts4.5/common/vc/types.d.ts +1 -0
  29. package/dist/types-ts4.5/config/index.d.ts +10 -0
  30. package/dist/types-ts4.5/vc/vc-observer/getVCRevisionDebugDetails.d.ts +1 -0
  31. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -0
  32. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
  33. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0feed18feb110`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0feed18feb110) -
8
+ Add sample rate config for extraInteractionMetrics
9
+
10
+ ## 4.4.5
11
+
12
+ ### Patch Changes
13
+
14
+ - [`b773a6a1dad0f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b773a6a1dad0f) -
15
+ add TTVC abort timestamp to payload
16
+ - [`80ff64c68bc70`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/80ff64c68bc70) -
17
+ Clean up feature gate platform_ufo_post_interaction_check_name
18
+
3
19
  ## 4.4.4
4
20
 
5
21
  ### Patch Changes
@@ -12,6 +12,7 @@ exports.getDoNotAbortActivePressInteraction = getDoNotAbortActivePressInteractio
12
12
  exports.getDoNotAbortActivePressInteractionOnTransition = getDoNotAbortActivePressInteractionOnTransition;
13
13
  exports.getEnabledVCRevisions = getEnabledVCRevisions;
14
14
  exports.getExperimentalInteractionRate = getExperimentalInteractionRate;
15
+ exports.getExtraInteractionRate = getExtraInteractionRate;
15
16
  exports.getInteractionRate = getInteractionRate;
16
17
  exports.getInteractionTimeout = getInteractionTimeout;
17
18
  exports.getMostRecentVCRevision = getMostRecentVCRevision;
@@ -182,28 +183,7 @@ function getExperimentalInteractionRate(name, interactionType) {
182
183
  }
183
184
  }
184
185
  function getPostInteractionRate(name, interactionType) {
185
- try {
186
- if (!config) {
187
- return 0;
188
- }
189
- var _config4 = config,
190
- postInteractionLog = _config4.postInteractionLog;
191
- if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
192
- return 0;
193
- }
194
- if (interactionType !== 'page_load' && interactionType !== 'transition') {
195
- return 0;
196
- }
197
- if (postInteractionLog.rates && typeof postInteractionLog.rates[name] === 'number') {
198
- return postInteractionLog.rates[name];
199
- }
200
- if (postInteractionLog.kind && typeof postInteractionLog.kind[interactionType] === 'number') {
201
- return postInteractionLog.kind[interactionType];
202
- }
203
- return 0;
204
- } catch (e) {
205
- return 0;
206
- }
186
+ return getConfigRate(name, interactionType, 'postInteractionLog');
207
187
  }
208
188
  function getCapabilityRate(capability) {
209
189
  if ((0, _platformFeatureFlags.fg)('platform_ufo_remove_deprecated_config_fields')) {
@@ -213,8 +193,8 @@ function getCapabilityRate(capability) {
213
193
  if (!config) {
214
194
  return 0;
215
195
  }
216
- var _config5 = config,
217
- capabilityRate = _config5.capability;
196
+ var _config4 = config,
197
+ capabilityRate = _config4.capability;
218
198
  if (capabilityRate != null) {
219
199
  var rate = capabilityRate[capability];
220
200
  if (rate != null) {
@@ -226,6 +206,32 @@ function getCapabilityRate(capability) {
226
206
  return 0;
227
207
  }
228
208
  }
209
+ function getConfigRate(name, interactionType, configName) {
210
+ try {
211
+ if (!config) {
212
+ return 0;
213
+ }
214
+ var gotConfig = config[configName];
215
+ if (!(gotConfig !== null && gotConfig !== void 0 && gotConfig.enabled)) {
216
+ return 0;
217
+ }
218
+ if (interactionType !== 'page_load' && interactionType !== 'transition') {
219
+ return 0;
220
+ }
221
+ if (gotConfig.rates && typeof gotConfig.rates[name] === 'number') {
222
+ return gotConfig.rates[name];
223
+ }
224
+ if ('kind' in gotConfig && gotConfig.kind && typeof gotConfig.kind[interactionType] === 'number') {
225
+ return gotConfig.kind[interactionType];
226
+ }
227
+ return 0;
228
+ } catch (e) {
229
+ return 0;
230
+ }
231
+ }
232
+ function getExtraInteractionRate(name, interactionType) {
233
+ return getConfigRate(name, interactionType, 'extraInteractionMetrics');
234
+ }
229
235
  var validTypingMethods = ['timeout', 'timeoutNoAlloc', 'mutationObserver'];
230
236
  function getTypingPerformanceTracingMethod() {
231
237
  var defaultMethod = 'timeout';
@@ -233,8 +239,8 @@ function getTypingPerformanceTracingMethod() {
233
239
  if (!config) {
234
240
  return defaultMethod;
235
241
  }
236
- var _config6 = config,
237
- typingMethod = _config6.typingMethod;
242
+ var _config5 = config,
243
+ typingMethod = _config5.typingMethod;
238
244
  if (typingMethod != null && validTypingMethods.find(function (m) {
239
245
  return m === typingMethod;
240
246
  })) {
@@ -253,8 +259,8 @@ function getAwaitBM3TTIList() {
253
259
  if (!config) {
254
260
  return [];
255
261
  }
256
- var _config7 = config,
257
- awaitBM3TTI = _config7.awaitBM3TTI;
262
+ var _config6 = config,
263
+ awaitBM3TTI = _config6.awaitBM3TTI;
258
264
  if (awaitBM3TTI != null) {
259
265
  return awaitBM3TTI;
260
266
  } else {
@@ -274,8 +280,8 @@ function getUfoNameOverrides() {
274
280
  if (!config) {
275
281
  return undefined;
276
282
  }
277
- var _config8 = config,
278
- ufoNameOverrides = _config8.ufoNameOverrides;
283
+ var _config7 = config,
284
+ ufoNameOverrides = _config7.ufoNameOverrides;
279
285
  if (ufoNameOverrides != null) {
280
286
  return ufoNameOverrides;
281
287
  }
@@ -291,8 +297,8 @@ function getDoNotAbortActivePressInteraction() {
291
297
  if (!config) {
292
298
  return undefined;
293
299
  }
294
- var _config9 = config,
295
- doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
300
+ var _config8 = config,
301
+ doNotAbortActivePressInteraction = _config8.doNotAbortActivePressInteraction;
296
302
  return doNotAbortActivePressInteraction;
297
303
  } catch (e) {
298
304
  return undefined;
@@ -305,8 +311,8 @@ function getDoNotAbortActivePressInteractionOnTransition() {
305
311
  if (!config) {
306
312
  return undefined;
307
313
  }
308
- var _config0 = config,
309
- doNotAbortActivePressInteractionOnTransition = _config0.doNotAbortActivePressInteractionOnTransition;
314
+ var _config9 = config,
315
+ doNotAbortActivePressInteractionOnTransition = _config9.doNotAbortActivePressInteractionOnTransition;
310
316
  return doNotAbortActivePressInteractionOnTransition;
311
317
  } catch (e) {
312
318
  return undefined;
@@ -318,8 +324,8 @@ function getInteractionTimeout(ufoName) {
318
324
  if (!config) {
319
325
  return CLEANUP_TIMEOUT;
320
326
  }
321
- var _config1 = config,
322
- interactionTimeout = _config1.interactionTimeout;
327
+ var _config0 = config,
328
+ interactionTimeout = _config0.interactionTimeout;
323
329
  if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
324
330
  return interactionTimeout[ufoName];
325
331
  }
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _coinflip = _interopRequireDefault(require("../coinflip"));
10
11
  var _config = require("../config");
11
12
  var _createPayload = require("../create-payload");
12
13
  var _utils = require("../create-payload/common/utils");
@@ -21,7 +22,7 @@ function createInteractionExtraLogPayload(_x, _x2) {
21
22
  function _createInteractionExtraLogPayload() {
22
23
  _createInteractionExtraLogPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interactionId, interaction) {
23
24
  var _getTTAI, _finalVCMetrics$ufoV, _window$location;
24
- var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, ttvc, payload;
25
+ var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, ttvc, payload;
25
26
  return _regenerator.default.wrap(function _callee$(_context) {
26
27
  while (1) switch (_context.prev = _context.next) {
27
28
  case 0:
@@ -33,21 +34,28 @@ function _createInteractionExtraLogPayload() {
33
34
  throw Error('UFO Configuration not provided');
34
35
  case 3:
35
36
  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;
37
+ configRate = (0, _config.getExtraInteractionRate)(ufoName, type);
38
+ if ((0, _coinflip.default)(configRate)) {
39
+ _context.next = 7;
40
+ break;
41
+ }
42
+ return _context.abrupt("return", null);
43
+ case 7:
36
44
  pageVisibilityAtTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
37
45
  isPageLoad = type === 'page_load' || type === 'transition';
38
46
  if (isPageLoad) {
39
- _context.next = 8;
47
+ _context.next = 11;
40
48
  break;
41
49
  }
42
50
  return _context.abrupt("return", null);
43
- case 8:
51
+ case 11:
44
52
  calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
45
53
  moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? (0, _createPayload.getMoreAccuratePageVisibilityUpToTTAI)(interaction) : null;
46
54
  extraTTAI = (_getTTAI = (0, _getTtai.default)(interaction)) !== null && _getTTAI !== void 0 ? _getTTAI : undefined;
47
55
  newUFOName = (0, _utils.sanitizeUfoName)(ufoName);
48
- _context.next = 14;
56
+ _context.next = 17;
49
57
  return (0, _getVcMetrics.default)(interaction, true);
50
- case 14:
58
+ case 17:
51
59
  finalVCMetrics = _context.sent;
52
60
  ttvc = (_finalVCMetrics$ufoV = finalVCMetrics['ufo:vc:rev']) === null || _finalVCMetrics$ufoV === void 0 ? void 0 : _finalVCMetrics$ufoV.map(function (revision) {
53
61
  if (revision['metric:vc90'] === null || revision.clean !== true) {
@@ -105,7 +113,7 @@ function _createInteractionExtraLogPayload() {
105
113
  };
106
114
  payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
107
115
  return _context.abrupt("return", payload);
108
- case 19:
116
+ case 22:
109
117
  case "end":
110
118
  return _context.stop();
111
119
  }
@@ -699,15 +699,9 @@ function finishInteraction(id, data) {
699
699
  data.hydration = (0, _config.getReactHydrationStats)();
700
700
 
701
701
  // By this time, stop the post interaction log observer if coinflip rate is 0
702
- if ((0, _platformFeatureFlags.fg)('platform_ufo_post_interaction_check_name')) {
703
- var sanitisedUfoName = (0, _utils.sanitizeUfoName)(data.ufoName);
704
- if (!(0, _coinflip.default)((0, _config.getPostInteractionRate)(sanitisedUfoName, data.type))) {
705
- postInteractionLog.stopVCObserver();
706
- }
707
- } else {
708
- if (!(0, _coinflip.default)((0, _config.getPostInteractionRate)(data.routeName || data.ufoName, data.type))) {
709
- postInteractionLog.stopVCObserver();
710
- }
702
+ var sanitisedUfoName = (0, _utils.sanitizeUfoName)(data.ufoName);
703
+ if (!(0, _coinflip.default)((0, _config.getPostInteractionRate)(sanitisedUfoName, data.type))) {
704
+ postInteractionLog.stopVCObserver();
711
705
  }
712
706
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
713
707
  if (!data.hold3pActive || data.hold3pActive.size === 0) {
@@ -715,7 +709,10 @@ function finishInteraction(id, data) {
715
709
  if (!((_getConfig5 = (0, _config.getConfig)()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
716
710
  remove(id);
717
711
  }
718
- interactionExtraMetrics.stopVCObserver();
712
+ var _sanitisedUfoName = (0, _utils.sanitizeUfoName)(data.ufoName);
713
+ if (!(0, _coinflip.default)((0, _config.getExtraInteractionRate)(_sanitisedUfoName, data.type))) {
714
+ interactionExtraMetrics.stopVCObserver();
715
+ }
719
716
  }
720
717
  } else {
721
718
  var _getConfig6;
@@ -1021,13 +1018,7 @@ function addOnCancelCallback(id, cancelCallback) {
1021
1018
  }
1022
1019
  function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName) {
1023
1020
  var trace = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
1024
- if ((0, _platformFeatureFlags.fg)('platform_ufo_post_interaction_check_name')) {
1025
- postInteractionLog.reset();
1026
- } else {
1027
- if ((0, _coinflip.default)((0, _config.getPostInteractionRate)(routeName || ufoName, type))) {
1028
- postInteractionLog.reset();
1029
- }
1030
- }
1021
+ postInteractionLog.reset();
1031
1022
  var vcObserver;
1032
1023
  var previousTime = startTime;
1033
1024
  var timeoutTime = (0, _platformFeatureFlags.fg)('platform_ufo_enable_timeout_config') ? (0, _config.getInteractionTimeout)(ufoName) : CLEANUP_TIMEOUT;
@@ -1138,6 +1129,7 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1138
1129
  addHoldByID(interactionId, [], ufoName, ufoName, true);
1139
1130
  }
1140
1131
  if (type === 'transition' || type === 'page_load') {
1132
+ var _getConfig11;
1141
1133
  // Use per-interaction VC observer if available, otherwise fall back to global
1142
1134
  var observer = vcObserver;
1143
1135
  if (observer) {
@@ -1146,21 +1138,12 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1146
1138
  experienceKey: ufoName
1147
1139
  });
1148
1140
  }
1149
- if ((0, _platformFeatureFlags.fg)('platform_ufo_post_interaction_check_name')) {
1150
- var _getConfig11;
1151
- // Start post interaction observer for all if config is enabled
1152
- // in case ufoName is updated at later time
1153
- if ((_getConfig11 = (0, _config.getConfig)()) !== null && _getConfig11 !== void 0 && (_getConfig11 = _getConfig11.postInteractionLog) !== null && _getConfig11 !== void 0 && _getConfig11.enabled) {
1154
- postInteractionLog.startVCObserver({
1155
- startTime: startTime
1156
- });
1157
- }
1158
- } else {
1159
- if ((0, _coinflip.default)((0, _config.getPostInteractionRate)(routeName || ufoName, type))) {
1160
- postInteractionLog.startVCObserver({
1161
- startTime: startTime
1162
- });
1163
- }
1141
+ // Start post interaction observer for all if config is enabled
1142
+ // in case ufoName is updated at later time
1143
+ if ((_getConfig11 = (0, _config.getConfig)()) !== null && _getConfig11 !== void 0 && (_getConfig11 = _getConfig11.postInteractionLog) !== null && _getConfig11 !== void 0 && _getConfig11.enabled) {
1144
+ postInteractionLog.startVCObserver({
1145
+ startTime: startTime
1146
+ });
1164
1147
  }
1165
1148
  if ((0, _coinflip.default)((0, _config.getExperimentalInteractionRate)(ufoName, type))) {
1166
1149
  _createExperimentalInteractionMetricsPayload.experimentalVC.start({
@@ -1168,9 +1151,12 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1168
1151
  });
1169
1152
  }
1170
1153
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
1171
- interactionExtraMetrics.startVCObserver({
1172
- startTime: startTime
1173
- }, interactionId);
1154
+ var _config$extraInteract;
1155
+ if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
1156
+ interactionExtraMetrics.startVCObserver({
1157
+ startTime: startTime
1158
+ }, interactionId);
1159
+ }
1174
1160
  }
1175
1161
  }
1176
1162
  if (type === 'press' && (0, _platformFeatureFlags.fg)('platform_ufo_enable_vc_press_interactions')) {
@@ -136,7 +136,10 @@ function init(analyticsWebClientAsync, config) {
136
136
  });
137
137
  }
138
138
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
139
- _interactionMetrics.interactionExtraMetrics.initializeVCObserver(vcOptions);
139
+ var _config$extraInteract;
140
+ if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
141
+ _interactionMetrics.interactionExtraMetrics.initializeVCObserver(vcOptions);
142
+ }
140
143
  }
141
144
  }
142
145
  (0, _hiddenTiming.setupHiddenTimingCapture)();
@@ -13,6 +13,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _config = require("../../config");
17
18
  var _interactionMetrics = require("../../interaction-metrics");
18
19
  var _attachAbortListeners = require("./attachAbortListeners");
@@ -102,7 +103,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
102
103
  });
103
104
  (0, _defineProperty2.default)(this, "getVCResult", /*#__PURE__*/function () {
104
105
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref3) {
105
- 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;
106
+ 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;
106
107
  return _regenerator.default.wrap(function _callee$(_context) {
107
108
  while (1) switch (_context.prev = _context.next) {
108
109
  case 0:
@@ -119,7 +120,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
119
120
  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;
120
121
  isTTVCv1Disabled = !(0, _config.isVCRevisionEnabled)('fy25.01', experienceKey);
121
122
  if (!(abortReasonInfo !== null)) {
122
- _context.next = 13;
123
+ _context.next = 19;
123
124
  break;
124
125
  }
125
126
  // exposing data to devtools
@@ -128,22 +129,44 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
128
129
  window.__vcNotAvailableReason = abortReasonInfo;
129
130
  }
130
131
  } catch (e) {}
131
- vcAbortedResultWithRevisions = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReason.reason), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp), "".concat(fullPrefix, "vc:rev"), [{
132
+ if (!(0, _platformFeatureFlags.fg)('platform_ufo_abort_timestamp_by_revision')) {
133
+ _context.next = 16;
134
+ break;
135
+ }
136
+ vcAbortedResultWithRevisions = (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:rev"), [{
132
137
  revision: 'fy25.02',
133
138
  clean: false,
134
139
  'metric:vc90': null,
135
- abortReason: abortReason.reason
140
+ abortReason: abortReason.reason,
141
+ abortTimestamp: Math.round(abortReason.timestamp)
136
142
  }]);
137
143
  if (!isTTVCv1Disabled) {
138
144
  vcAbortedResultWithRevisions["".concat(fullPrefix, "vc:rev")].push({
139
145
  revision: 'fy25.01',
140
146
  clean: false,
141
147
  'metric:vc90': null,
142
- abortReason: abortReason.reason
148
+ abortReason: abortReason.reason,
149
+ abortTimestamp: Math.round(abortReason.timestamp)
143
150
  });
144
151
  }
145
152
  return _context.abrupt("return", vcAbortedResultWithRevisions);
146
- case 13:
153
+ case 16:
154
+ _vcAbortedResultWithRevisions = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReason.reason), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp), "".concat(fullPrefix, "vc:rev"), [{
155
+ revision: 'fy25.02',
156
+ clean: false,
157
+ 'metric:vc90': null,
158
+ abortReason: abortReason.reason
159
+ }]);
160
+ if (!isTTVCv1Disabled) {
161
+ _vcAbortedResultWithRevisions["".concat(fullPrefix, "vc:rev")].push({
162
+ revision: 'fy25.01',
163
+ clean: false,
164
+ 'metric:vc90': null,
165
+ abortReason: abortReason.reason
166
+ });
167
+ }
168
+ return _context.abrupt("return", _vcAbortedResultWithRevisions);
169
+ case 19:
147
170
  ttvcV1Result = isTTVCv1Disabled ? {
148
171
  VC: {},
149
172
  VCBox: {},
@@ -301,16 +324,16 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
301
324
  SSRRatioNext = VCObserver.getSSRRatio(vcNext.VCEntries.rel, ssr);
302
325
  SSRRatioPayload = includeSSRRatio ? (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:ssrRatio"), isTTVCv1Disabled ? SSRRatioNext : SSRRatio), "".concat(fullPrefix, "vc:next:ssrRatio"), SSRRatioNext) : {};
303
326
  if (!isTTVCv1Disabled) {
304
- _context.next = 29;
327
+ _context.next = 35;
305
328
  break;
306
329
  }
307
330
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), SSRRatioPayload), {}, (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:ssrRatio"), SSRRatioNext), revisionsData), speedIndex));
308
- case 29:
331
+ case 35:
309
332
  isTTVCv3Enabled = (0, _config.isVCRevisionEnabled)('fy25.03', experienceKey);
310
333
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
311
334
  'metrics:vc': VC
312
335
  }, "".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), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".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), {}, (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), speedIndex));
313
- case 31:
336
+ case 37:
314
337
  case "end":
315
338
  return _context.stop();
316
339
  }
@@ -85,9 +85,9 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
85
85
  }, {
86
86
  key: "calculateWithDebugInfo",
87
87
  value: function () {
88
- var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries) {
88
+ var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p) {
89
89
  var _window, _window2, _window3, _window5;
90
- var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator4, _step4, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator5, _step5, _entry3, _ignoredEntriesByTime, viewportData, timestamp, additionalVcLogs, _iterator6, _step6, _step6$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window4, _window4$__ufo_devtoo, _window6, _window6$__on_ufo_vc_;
90
+ var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator4, _step4, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator5, _step5, _entry3, _ignoredEntriesByTime, viewportData, timestamp, additionalVcLogs, _iterator6, _step6, _step6$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window4, _window4$__ufo_devtoo, _window6, _window6$__on_ufo_vc_;
91
91
  return _regenerator.default.wrap(function _callee$(_context) {
92
92
  while (1) switch (_context.prev = _context.next) {
93
93
  case 0:
@@ -184,8 +184,9 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
184
184
  return _objectSpread(_objectSpread({}, log), {}, {
185
185
  viewportPercentage: log.viewportPercentage
186
186
  });
187
- }) : []; // Only calculate enhanced debug details if devtool callbacks exist
188
- 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');
187
+ }) : []; // If 3p metric enabled - calculate the debug details
188
+ shouldCalculate3p = include3p && (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p'); // Only calculate enhanced debug details if devtool callbacks exist
189
+ 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');
189
190
  if (shouldCalculateDebugDetails && allEntries && vcLogs) {
190
191
  // Pre-sort vcLogs by time for efficient lookups
191
192
  sortedVcLogs = (0, _toConsumableArray2.default)(vcLogs).sort(function (a, b) {
@@ -230,7 +231,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
230
231
  try {
231
232
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
232
233
  _entry3 = _step5.value;
233
- if ('rect' in _entry3.data && !this.isEntryIncluded(_entry3)) {
234
+ if ('rect' in _entry3.data && !this.isEntryIncluded(_entry3, include3p)) {
234
235
  viewportData = _entry3.data;
235
236
  timestamp = Math.round(_entry3.time);
236
237
  if (!ignoredEntriesByTime.has(timestamp)) {
@@ -287,7 +288,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
287
288
  }
288
289
 
289
290
  // Handle devtool callback
290
- if (v3RevisionDebugDetails && typeof ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.__ufo_devtool_onVCRevisionReady__) === 'function') {
291
+ if (v3RevisionDebugDetails && typeof ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.__ufo_devtool_onVCRevisionReady__) === 'function' && !include3p) {
291
292
  try {
292
293
  (_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);
293
294
  } catch (e) {
@@ -296,7 +297,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
296
297
  console.error('Error in onVCRevisionReady', e);
297
298
  }
298
299
  }
299
- if (v3RevisionDebugDetails && typeof ((_window5 = window) === null || _window5 === void 0 ? void 0 : _window5.__on_ufo_vc_debug_data_ready) === 'function') {
300
+ if (v3RevisionDebugDetails && typeof ((_window5 = window) === null || _window5 === void 0 ? void 0 : _window5.__on_ufo_vc_debug_data_ready) === 'function' && !include3p) {
300
301
  try {
301
302
  (_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);
302
303
  } catch (e) {
@@ -304,14 +305,23 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
304
305
  console.error('Error in onVCRevisionReady', e);
305
306
  }
306
307
  }
308
+ if (v3RevisionDebugDetails && shouldCalculate3p) {
309
+ try {
310
+ // Log vc details with 3p for debugging
311
+ window.__ufo_devtool_vc_3p_debug_data = v3RevisionDebugDetails;
312
+ } catch (e) {
313
+ // eslint-disable-next-line no-console
314
+ console.error('Error in 3pDebugData', e);
315
+ }
316
+ }
307
317
  return _context.abrupt("return", vcDetails);
308
- case 39:
318
+ case 41:
309
319
  case "end":
310
320
  return _context.stop();
311
321
  }
312
322
  }, _callee, this, [[11, 23, 26, 29]]);
313
323
  }));
314
- function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
324
+ function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9) {
315
325
  return _calculateWithDebugInfo.apply(this, arguments);
316
326
  }
317
327
  return calculateWithDebugInfo;
@@ -338,15 +348,17 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
338
348
  _context2.next = 7;
339
349
  break;
340
350
  }
341
- return _context2.abrupt("return", {
351
+ return _context2.abrupt("return", _objectSpread({
342
352
  revision: this.revisionNo,
343
353
  'metric:vc90': null,
344
354
  clean: false,
345
355
  abortReason: dirtyReason
346
- });
356
+ }, (0, _platformFeatureFlags.fg)('platform_ufo_abort_timestamp_by_revision') ? {
357
+ abortTimestamp: getVCCleanStatusResult.abortTimestamp
358
+ } : {}));
347
359
  case 7:
348
360
  _context2.next = 9;
349
- return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries);
361
+ return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries, include3p);
350
362
  case 9:
351
363
  vcDetails = _context2.sent;
352
364
  result = {
@@ -366,7 +378,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
366
378
  }
367
379
  }, _callee2, this);
368
380
  }));
369
- function calculate(_x9) {
381
+ function calculate(_x0) {
370
382
  return _calculate.apply(this, arguments);
371
383
  }
372
384
  return calculate;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = exports.NON_VISUAL_ARIA_ATTRIBUTES = exports.KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
@@ -13,6 +14,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _abstractBaseVcCalculator = _interopRequireDefault(require("../abstract-base-vc-calculator"));
15
16
  var _isViewportEntryData = _interopRequireDefault(require("../utils/is-viewport-entry-data"));
17
+ 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; }
18
+ 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) { (0, _defineProperty2.default)(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; }
16
19
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
17
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
21
  var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
@@ -70,21 +73,27 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
70
73
  key: "getVCCleanStatus",
71
74
  value: function getVCCleanStatus(filteredEntries) {
72
75
  var dirtyReason = '';
76
+ var abortTimestamp = -1;
73
77
  var hasAbortEvent = filteredEntries.some(function (entry) {
74
78
  if (entry.data.type === 'window:event') {
75
79
  var data = entry.data;
76
80
  if (ABORTING_WINDOW_EVENT.includes(data.eventType)) {
77
81
  dirtyReason = data.eventType === 'keydown' ? 'keypress' : data.eventType;
82
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_abort_timestamp_by_revision')) {
83
+ abortTimestamp = Math.round(entry.time);
84
+ }
78
85
  return true;
79
86
  }
80
87
  }
81
88
  return false;
82
89
  });
83
90
  if (hasAbortEvent && dirtyReason) {
84
- return {
91
+ return _objectSpread({
85
92
  isVCClean: false,
86
93
  dirtyReason: dirtyReason
87
- };
94
+ }, (0, _platformFeatureFlags.fg)('platform_ufo_abort_timestamp_by_revision') ? {
95
+ abortTimestamp: abortTimestamp
96
+ } : {});
88
97
  }
89
98
  return {
90
99
  isVCClean: true