@atlaskit/react-ufo 3.13.16 → 3.13.18

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 (38) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/create-payload/utils/get-vc-metrics.js +3 -2
  3. package/dist/cjs/ssr/index.js +8 -2
  4. package/dist/cjs/vc/index.js +2 -1
  5. package/dist/cjs/vc/vc-observer/index.js +50 -43
  6. package/dist/cjs/vc/vc-observer-new/index.js +33 -3
  7. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +22 -14
  8. package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -2
  9. package/dist/es2019/ssr/index.js +5 -1
  10. package/dist/es2019/vc/index.js +2 -1
  11. package/dist/es2019/vc/vc-observer/index.js +31 -20
  12. package/dist/es2019/vc/vc-observer-new/index.js +28 -0
  13. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +20 -9
  14. package/dist/esm/create-payload/utils/get-vc-metrics.js +3 -2
  15. package/dist/esm/ssr/index.js +8 -2
  16. package/dist/esm/vc/index.js +2 -1
  17. package/dist/esm/vc/vc-observer/index.js +50 -43
  18. package/dist/esm/vc/vc-observer-new/index.js +33 -3
  19. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +22 -14
  20. package/dist/types/config/index.d.ts +1 -0
  21. package/dist/types/ssr/index.d.ts +1 -0
  22. package/dist/types/vc/index.d.ts +1 -0
  23. package/dist/types/vc/types.d.ts +1 -0
  24. package/dist/types/vc/vc-observer/getVCRevisionDebugDetails.d.ts +4 -5
  25. package/dist/types/vc/vc-observer/index.d.ts +7 -0
  26. package/dist/types/vc/vc-observer-new/index.d.ts +1 -0
  27. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +7 -0
  28. package/dist/types/vc/vc-observer-new/types.d.ts +1 -0
  29. package/dist/types-ts4.5/config/index.d.ts +1 -0
  30. package/dist/types-ts4.5/ssr/index.d.ts +1 -0
  31. package/dist/types-ts4.5/vc/index.d.ts +1 -0
  32. package/dist/types-ts4.5/vc/types.d.ts +1 -0
  33. package/dist/types-ts4.5/vc/vc-observer/getVCRevisionDebugDetails.d.ts +4 -5
  34. package/dist/types-ts4.5/vc/vc-observer/index.d.ts +7 -0
  35. package/dist/types-ts4.5/vc/vc-observer-new/index.d.ts +1 -0
  36. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +7 -0
  37. package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -0
  38. package/package.json +7 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.13.18
4
+
5
+ ### Patch Changes
6
+
7
+ - [#167243](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/167243)
8
+ [`63819af8c6eca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/63819af8c6eca) -
9
+ emit TTVC debug data from UFO
10
+
11
+ ## 3.13.17
12
+
13
+ ### Patch Changes
14
+
15
+ - [#160542](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/160542)
16
+ [`eadf6fec0762d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eadf6fec0762d) -
17
+ Added extension to VC v3 to include SSR
18
+
3
19
  ## 3.13.16
4
20
 
5
21
  ### Patch Changes
@@ -22,7 +22,7 @@ function getVCMetrics(_x) {
22
22
  }
23
23
  function _getVCMetrics() {
24
24
  _getVCMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interaction) {
25
- var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$experimentalI, _result$ufoVcRev;
25
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$vc3, _config$experimentalI, _result$ufoVcRev;
26
26
  var config, interactionStatus, pageVisibilityUpToTTAI, shouldReportVCMetrics, isSSREnabled, ssr, tti, prefix, result, mostRecentVCRevision, mostRecentVCRevisionPayload;
27
27
  return _regenerator.default.wrap(function _callee$(_context) {
28
28
  while (1) switch (_context.prev = _context.next) {
@@ -63,11 +63,12 @@ function _getVCMetrics() {
63
63
  stop: interaction.end,
64
64
  tti: tti,
65
65
  prefix: prefix,
66
+ includeSSRInV3: (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRInV3,
66
67
  vc: interaction.vc,
67
68
  isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED',
68
69
  experienceKey: interaction.ufoName,
69
70
  interactionId: interaction.id,
70
- includeSSRRatio: (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRRatio
71
+ includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio
71
72
  }, ssr));
72
73
  case 18:
73
74
  result = _context.sent;
@@ -9,16 +9,22 @@ exports.getSSRDoneTime = getSSRDoneTime;
9
9
  exports.getSSRFeatureFlags = getSSRFeatureFlags;
10
10
  exports.getSSRSuccess = getSSRSuccess;
11
11
  exports.getSSRTimings = getSSRTimings;
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
13
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
+ 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; }
16
+ 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; }
13
17
  var NESTED_METRIC_SEPARATOR = '/';
14
18
  function filterEntry(entry) {
15
19
  return !(!entry || (0, _typeof2.default)(entry) !== 'object' || entry.startTime < 0 || entry.duration < 0);
16
20
  }
17
21
  function mapEntry(entry) {
18
- return {
22
+ return _objectSpread({
19
23
  startTime: Math.round(entry.startTime),
20
24
  duration: Math.round(entry.duration)
21
- };
25
+ }, entry.size && (0, _platformFeatureFlags.fg)('platform_ufo_ssr_size_field') ? {
26
+ size: Math.round(entry.size)
27
+ } : {});
22
28
  }
23
29
  var SSR_PREFIX = 'ssr';
24
30
  function mapKey(key) {
@@ -129,7 +129,8 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
129
129
  return (_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
130
130
  start: param.start,
131
131
  stop: param.stop,
132
- interactionId: param.interactionId
132
+ interactionId: param.interactionId,
133
+ ssr: param.includeSSRInV3 ? param.ssr : undefined
133
134
  });
134
135
  case 12:
135
136
  _context.t1 = _context.sent;
@@ -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, _ufo_devtool_onVCRev2, _ref9, _ufo_devtool_onVCRev, _ref8, 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, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, 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:
@@ -271,30 +272,36 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
271
272
  entries: isTTVCv1Disabled ? vcNext.VCEntries.rel : VCEntries.rel
272
273
  }
273
274
  }));
274
-
275
- // Add devtool callback for both v1 and v2
275
+ v1RevisionDebugDetails = (0, _getVCRevisionDebugDetails.getVCRevisionDebugDetails)({
276
+ revision: 'fy25.01',
277
+ isClean: !abortReasonInfo,
278
+ abortReason: abortReason.reason,
279
+ VCEntries: VCEntries.rel,
280
+ componentsLog: componentsLog,
281
+ interactionId: interactionId
282
+ });
283
+ v2RevisionDebugDetails = (0, _getVCRevisionDebugDetails.getVCRevisionDebugDetails)({
284
+ revision: 'fy25.02',
285
+ isClean: !abortReasonInfo,
286
+ abortReason: abortReason.reason,
287
+ VCEntries: vcNext.VCEntries.rel,
288
+ componentsLog: componentsLog,
289
+ interactionId: interactionId
290
+ }); // Add devtool callback for both v1 and v2
276
291
  if (typeof window.__ufo_devtool_onVCRevisionReady__ === 'function') {
277
292
  // Handle v1 if not disabled
278
293
  if (!isTTVCv1Disabled) {
279
- (_ufo_devtool_onVCRev = (_ref8 = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev === void 0 || _ufo_devtool_onVCRev.call(_ref8, (0, _getVCRevisionDebugDetails.getVCRevisionDebugDetails)({
280
- revision: 'fy25.01',
281
- isClean: !abortReasonInfo,
282
- abortReason: abortReason.reason,
283
- VCEntries: VCEntries.rel,
284
- componentsLog: componentsLog,
285
- interactionId: interactionId
286
- }));
294
+ (_window$__ufo_devtool = (_window = window).__ufo_devtool_onVCRevisionReady__) === null || _window$__ufo_devtool === void 0 || _window$__ufo_devtool.call(_window, v1RevisionDebugDetails);
287
295
  }
288
296
 
289
297
  // Handle v2
290
- (_ufo_devtool_onVCRev2 = (_ref9 = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev2 === void 0 || _ufo_devtool_onVCRev2.call(_ref9, (0, _getVCRevisionDebugDetails.getVCRevisionDebugDetails)({
291
- revision: 'fy25.02',
292
- isClean: !abortReasonInfo,
293
- abortReason: abortReason.reason,
294
- VCEntries: vcNext.VCEntries.rel,
295
- componentsLog: componentsLog,
296
- interactionId: interactionId
297
- }));
298
+ (_window$__ufo_devtool2 = (_window2 = window).__ufo_devtool_onVCRevisionReady__) === null || _window$__ufo_devtool2 === void 0 || _window$__ufo_devtool2.call(_window2, v2RevisionDebugDetails);
299
+ }
300
+ if (typeof window.__on_ufo_vc_debug_data_ready === 'function' && (0, _platformFeatureFlags.fg)('platform_ufo_emit_vc_debug_data')) {
301
+ if (!isTTVCv1Disabled) {
302
+ (_window$__on_ufo_vc_d = (_window3 = window).__on_ufo_vc_debug_data_ready) === null || _window$__on_ufo_vc_d === void 0 || _window$__on_ufo_vc_d.call(_window3, v1RevisionDebugDetails);
303
+ }
304
+ (_window$__on_ufo_vc_d2 = (_window4 = window).__on_ufo_vc_debug_data_ready) === null || _window$__on_ufo_vc_d2 === void 0 || _window$__on_ufo_vc_d2.call(_window4, v2RevisionDebugDetails);
298
305
  }
299
306
  }
300
307
  } catch (e) {
@@ -423,14 +430,14 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
423
430
  }
424
431
  });
425
432
  (0, _defineProperty2.default)(this, "attachAbortListeners", function () {
426
- var _window;
433
+ var _window5;
427
434
  _this.detachAbortListeners();
428
435
  var unbinds = (0, _attachAbortListeners.attachAbortListeners)(window, _this.viewport, _this.abortReasonCallback);
429
- if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
430
- Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref1) {
431
- var _ref10 = (0, _slicedToArray2.default)(_ref1, 2),
432
- key = _ref10[0],
433
- time = _ref10[1];
436
+ if ((_window5 = window) !== null && _window5 !== void 0 && _window5.__SSR_ABORT_LISTENERS__) {
437
+ Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref9) {
438
+ var _ref0 = (0, _slicedToArray2.default)(_ref9, 2),
439
+ key = _ref0[0],
440
+ time = _ref0[1];
434
441
  if (time) {
435
442
  _this.abortReasonCallback(key, time);
436
443
  }
@@ -460,8 +467,8 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
460
467
  }
461
468
  return (0, _createClass2.default)(VCObserver, [{
462
469
  key: "start",
463
- value: function start(_ref11) {
464
- var startTime = _ref11.startTime;
470
+ value: function start(_ref1) {
471
+ var startTime = _ref1.startTime;
465
472
  this.active = true;
466
473
  if (this.observers.isBrowserSupported()) {
467
474
  this.setViewportSize();
@@ -483,12 +490,12 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
483
490
  }, {
484
491
  key: "getIgnoredElements",
485
492
  value: function getIgnoredElements(componentsLog) {
486
- return Object.values(componentsLog).flat().filter(function (_ref12) {
487
- var ignoreReason = _ref12.ignoreReason;
493
+ return Object.values(componentsLog).flat().filter(function (_ref10) {
494
+ var ignoreReason = _ref10.ignoreReason;
488
495
  return Boolean(ignoreReason);
489
- }).map(function (_ref13) {
490
- var targetName = _ref13.targetName,
491
- ignoreReason = _ref13.ignoreReason;
496
+ }).map(function (_ref11) {
497
+ var targetName = _ref11.targetName,
498
+ ignoreReason = _ref11.ignoreReason;
492
499
  return {
493
500
  targetName: targetName,
494
501
  ignoreReason: ignoreReason
@@ -618,13 +625,13 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
618
625
  }
619
626
  }, {
620
627
  key: "calculateVC",
621
- value: function calculateVC(_ref14) {
622
- var heatmap = _ref14.heatmap,
623
- _ref14$ssr = _ref14.ssr,
624
- ssr = _ref14$ssr === void 0 ? UNUSED_SECTOR : _ref14$ssr,
625
- componentsLog = _ref14.componentsLog,
626
- viewport = _ref14.viewport,
627
- fixSSRAttribution = _ref14.fixSSRAttribution;
628
+ value: function calculateVC(_ref12) {
629
+ var heatmap = _ref12.heatmap,
630
+ _ref12$ssr = _ref12.ssr,
631
+ ssr = _ref12$ssr === void 0 ? UNUSED_SECTOR : _ref12$ssr,
632
+ componentsLog = _ref12.componentsLog,
633
+ viewport = _ref12.viewport,
634
+ fixSSRAttribution = _ref12.fixSSRAttribution;
628
635
  var lastUpdate = {};
629
636
  var totalPainted = 0;
630
637
  var ssrTime = fixSSRAttribution ? Math.floor(ssr) : ssr;
@@ -691,11 +698,11 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
691
698
  });
692
699
  return VCRatio;
693
700
  }, 0);
694
- var VCEntries = entries.reduce(function (acc, _ref15, i) {
701
+ var VCEntries = entries.reduce(function (acc, _ref13, i) {
695
702
  var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
696
- var _ref16 = (0, _slicedToArray2.default)(_ref15, 2),
697
- timestamp = _ref16[0],
698
- entryPainted = _ref16[1];
703
+ var _ref14 = (0, _slicedToArray2.default)(_ref13, 2),
704
+ timestamp = _ref14[0],
705
+ entryPainted = _ref14[1];
699
706
  var currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
700
707
  var currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
701
708
  var logEntry = (0, _toConsumableArray2.default)(new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.filter(function (v) {
@@ -16,6 +16,8 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
16
  var _entriesTimeline = _interopRequireDefault(require("./entries-timeline"));
17
17
  var _getElementName2 = _interopRequireDefault(require("./get-element-name"));
18
18
  var _fy25_ = _interopRequireDefault(require("./metric-calculator/fy25_03"));
19
+ var _getViewportHeight = _interopRequireDefault(require("./metric-calculator/utils/get-viewport-height"));
20
+ var _getViewportWidth = _interopRequireDefault(require("./metric-calculator/utils/get-viewport-width"));
19
21
  var _viewportObserver = _interopRequireDefault(require("./viewport-observer"));
20
22
  var _windowEventObserver = _interopRequireDefault(require("./window-event-observer"));
21
23
  var DEFAULT_SELECTOR_CONFIG = {
@@ -118,6 +120,31 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
118
120
  (_this$viewportObserve2 = this.viewportObserver) === null || _this$viewportObserve2 === void 0 || _this$viewportObserve2.stop();
119
121
  (_this$windowEventObse2 = this.windowEventObserver) === null || _this$windowEventObse2 === void 0 || _this$windowEventObse2.stop();
120
122
  }
123
+ }, {
124
+ key: "addSSR",
125
+ value: function addSSR(ssr) {
126
+ this.entriesTimeline.push({
127
+ time: ssr,
128
+ data: {
129
+ elementName: 'SSR',
130
+ type: 'mutation:element',
131
+ rect: {
132
+ height: (0, _getViewportHeight.default)(),
133
+ width: (0, _getViewportWidth.default)(),
134
+ left: 0,
135
+ top: 0,
136
+ x: 0,
137
+ y: 0,
138
+ bottom: (0, _getViewportHeight.default)(),
139
+ right: (0, _getViewportWidth.default)(),
140
+ toJSON: function toJSON() {
141
+ return null;
142
+ }
143
+ },
144
+ visible: true
145
+ }
146
+ });
147
+ }
121
148
  }, {
122
149
  key: "getVCResult",
123
150
  value: function () {
@@ -130,11 +157,14 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
130
157
  results = [];
131
158
  this.addStartEntry(start);
132
159
  calculator_fy25_03 = new _fy25_.default();
160
+ if (param.ssr) {
161
+ this.addSSR(param.ssr);
162
+ }
133
163
  orderedEntries = this.entriesTimeline.getOrderedEntries({
134
164
  start: start,
135
165
  stop: stop
136
166
  });
137
- _context.next = 7;
167
+ _context.next = 8;
138
168
  return calculator_fy25_03.calculate({
139
169
  orderedEntries: orderedEntries,
140
170
  startTime: start,
@@ -142,13 +172,13 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
142
172
  interactionId: interactionId,
143
173
  isPostInteraction: this.isPostInteraction
144
174
  });
145
- case 7:
175
+ case 8:
146
176
  fy25_03 = _context.sent;
147
177
  if (fy25_03) {
148
178
  results.push(fy25_03);
149
179
  }
150
180
  return _context.abrupt("return", results);
151
- case 10:
181
+ case 11:
152
182
  case "end":
153
183
  return _context.stop();
154
184
  }
@@ -80,7 +80,8 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
80
80
  key: "calculateWithDebugInfo",
81
81
  value: function () {
82
82
  var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason) {
83
- var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, _ufo_devtool_onVCRev, _ref;
83
+ var _window, _window3;
84
+ var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, v3RevisionDebugDetails, _window2, _window2$__ufo_devtoo, _window4, _window4$__on_ufo_vc_;
84
85
  return _regenerator.default.wrap(function _callee$(_context) {
85
86
  while (1) switch (_context.prev = _context.next) {
86
87
  case 0:
@@ -170,25 +171,32 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
170
171
  previousResult = vcDetails["".concat(percentile)];
171
172
  }
172
173
  }
173
-
174
- // Handle devtool callback
175
- if (!isPostInteraction && typeof window !== 'undefined' && typeof window.__ufo_devtool_onVCRevisionReady__ === 'function') {
174
+ v3RevisionDebugDetails = {
175
+ revision: this.revisionNo,
176
+ isClean: isVCClean,
177
+ abortReason: dirtyReason,
178
+ vcLogs: vcLogs,
179
+ interactionId: interactionId
180
+ }; // Handle devtool callback
181
+ if (!isPostInteraction && typeof ((_window = window) === null || _window === void 0 ? void 0 : _window.__ufo_devtool_onVCRevisionReady__) === 'function') {
176
182
  try {
177
- (_ufo_devtool_onVCRev = (_ref = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev === void 0 || _ufo_devtool_onVCRev.call(_ref, {
178
- revision: this.revisionNo,
179
- isClean: isVCClean,
180
- abortReason: dirtyReason,
181
- vcLogs: vcLogs,
182
- interactionId: interactionId
183
- });
183
+ (_window2 = window) === null || _window2 === void 0 || (_window2$__ufo_devtoo = _window2.__ufo_devtool_onVCRevisionReady__) === null || _window2$__ufo_devtoo === void 0 || _window2$__ufo_devtoo.call(_window2, v3RevisionDebugDetails);
184
184
  } catch (e) {
185
185
  // if any error communicating with devtool, we don't want to break the app
186
186
  // eslint-disable-next-line no-console
187
187
  console.error('Error in onVCRevisionReady', e);
188
188
  }
189
189
  }
190
+ if (!isPostInteraction && typeof ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.__on_ufo_vc_debug_data_ready) === 'function' && (0, _platformFeatureFlags.fg)('platform_ufo_emit_vc_debug_data')) {
191
+ try {
192
+ (_window4 = window) === null || _window4 === void 0 || (_window4$__on_ufo_vc_ = _window4.__on_ufo_vc_debug_data_ready) === null || _window4$__on_ufo_vc_ === void 0 || _window4$__on_ufo_vc_.call(_window4, v3RevisionDebugDetails);
193
+ } catch (e) {
194
+ // eslint-disable-next-line no-console
195
+ console.error('Error in onVCRevisionReady', e);
196
+ }
197
+ }
190
198
  return _context.abrupt("return", vcDetails);
191
- case 32:
199
+ case 34:
192
200
  case "end":
193
201
  return _context.stop();
194
202
  }
@@ -202,7 +210,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
202
210
  }, {
203
211
  key: "calculate",
204
212
  value: function () {
205
- var _calculate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref2) {
213
+ var _calculate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref) {
206
214
  var _this = this,
207
215
  _vcDetails$90$t,
208
216
  _vcDetails$;
@@ -210,7 +218,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
210
218
  return _regenerator.default.wrap(function _callee2$(_context2) {
211
219
  while (1) switch (_context2.prev = _context2.next) {
212
220
  case 0:
213
- startTime = _ref2.startTime, stopTime = _ref2.stopTime, orderedEntries = _ref2.orderedEntries, interactionId = _ref2.interactionId, isPostInteraction = _ref2.isPostInteraction;
221
+ startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction;
214
222
  filteredEntries = orderedEntries.filter(function (entry) {
215
223
  return _this.isEntryIncluded(entry);
216
224
  });
@@ -6,7 +6,7 @@ import getInteractionStatus from './get-interaction-status';
6
6
  import getPageVisibilityUpToTTAI from './get-page-visibility-up-to-ttai';
7
7
  import getSSRDoneTimeValue from './get-ssr-done-time-value';
8
8
  async function getVCMetrics(interaction) {
9
- var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _interaction$apdex$, _config$vc2, _config$experimentalI, _result$ufoVcRev;
9
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _interaction$apdex$, _config$vc2, _config$vc3, _config$experimentalI, _result$ufoVcRev;
10
10
  const config = getConfig();
11
11
  if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
12
12
  return {};
@@ -33,11 +33,12 @@ async function getVCMetrics(interaction) {
33
33
  stop: interaction.end,
34
34
  tti,
35
35
  prefix,
36
+ includeSSRInV3: (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRInV3,
36
37
  vc: interaction.vc,
37
38
  isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED',
38
39
  experienceKey: interaction.ufoName,
39
40
  interactionId: interaction.id,
40
- includeSSRRatio: (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRRatio,
41
+ includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio,
41
42
  ...ssr
42
43
  });
43
44
  if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
@@ -1,3 +1,4 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  const NESTED_METRIC_SEPARATOR = '/';
2
3
  function filterEntry(entry) {
3
4
  return !(!entry || typeof entry !== 'object' || entry.startTime < 0 || entry.duration < 0);
@@ -5,7 +6,10 @@ function filterEntry(entry) {
5
6
  function mapEntry(entry) {
6
7
  return {
7
8
  startTime: Math.round(entry.startTime),
8
- duration: Math.round(entry.duration)
9
+ duration: Math.round(entry.duration),
10
+ ...(entry.size && fg('platform_ufo_ssr_size_field') ? {
11
+ size: Math.round(entry.size)
12
+ } : {})
9
13
  };
10
14
  }
11
15
  const SSR_PREFIX = 'ssr';
@@ -80,7 +80,8 @@ export class VCObserverWrapper {
80
80
  const v3Result = isVCRevisionEnabled('fy25.03', experienceKey) ? await ((_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
81
81
  start: param.start,
82
82
  stop: param.stop,
83
- interactionId: param.interactionId
83
+ interactionId: param.interactionId,
84
+ ssr: param.includeSSRInV3 ? param.ssr : undefined
84
85
  })) : [];
85
86
  if (!v3Result) {
86
87
  return v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {};
@@ -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';
@@ -281,32 +282,42 @@ export class VCObserver {
281
282
  entries: isTTVCv1Disabled ? vcNext.VCEntries.rel : VCEntries.rel
282
283
  }
283
284
  }));
285
+ const v1RevisionDebugDetails = getVCRevisionDebugDetails({
286
+ revision: 'fy25.01',
287
+ isClean: !abortReasonInfo,
288
+ abortReason: abortReason.reason,
289
+ VCEntries: VCEntries.rel,
290
+ componentsLog,
291
+ interactionId
292
+ });
293
+ const v2RevisionDebugDetails = getVCRevisionDebugDetails({
294
+ revision: 'fy25.02',
295
+ isClean: !abortReasonInfo,
296
+ abortReason: abortReason.reason,
297
+ VCEntries: vcNext.VCEntries.rel,
298
+ componentsLog,
299
+ interactionId
300
+ });
284
301
 
285
302
  // Add devtool callback for both v1 and v2
286
303
  if (typeof window.__ufo_devtool_onVCRevisionReady__ === 'function') {
287
- var _ufo_devtool_onVCRev2, _ref2;
304
+ var _window$__ufo_devtool2, _window2;
288
305
  // Handle v1 if not disabled
289
306
  if (!isTTVCv1Disabled) {
290
- var _ufo_devtool_onVCRev, _ref;
291
- (_ufo_devtool_onVCRev = (_ref = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev === void 0 ? void 0 : _ufo_devtool_onVCRev.call(_ref, getVCRevisionDebugDetails({
292
- revision: 'fy25.01',
293
- isClean: !abortReasonInfo,
294
- abortReason: abortReason.reason,
295
- VCEntries: VCEntries.rel,
296
- componentsLog,
297
- interactionId
298
- }));
307
+ var _window$__ufo_devtool, _window;
308
+ (_window$__ufo_devtool = (_window = window).__ufo_devtool_onVCRevisionReady__) === null || _window$__ufo_devtool === void 0 ? void 0 : _window$__ufo_devtool.call(_window, v1RevisionDebugDetails);
299
309
  }
300
310
 
301
311
  // Handle v2
302
- (_ufo_devtool_onVCRev2 = (_ref2 = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev2 === void 0 ? void 0 : _ufo_devtool_onVCRev2.call(_ref2, getVCRevisionDebugDetails({
303
- revision: 'fy25.02',
304
- isClean: !abortReasonInfo,
305
- abortReason: abortReason.reason,
306
- VCEntries: vcNext.VCEntries.rel,
307
- componentsLog,
308
- interactionId
309
- }));
312
+ (_window$__ufo_devtool2 = (_window2 = window).__ufo_devtool_onVCRevisionReady__) === null || _window$__ufo_devtool2 === void 0 ? void 0 : _window$__ufo_devtool2.call(_window2, v2RevisionDebugDetails);
313
+ }
314
+ if (typeof window.__on_ufo_vc_debug_data_ready === 'function' && fg('platform_ufo_emit_vc_debug_data')) {
315
+ var _window$__on_ufo_vc_d2, _window4;
316
+ if (!isTTVCv1Disabled) {
317
+ var _window$__on_ufo_vc_d, _window3;
318
+ (_window$__on_ufo_vc_d = (_window3 = window).__on_ufo_vc_debug_data_ready) === null || _window$__on_ufo_vc_d === void 0 ? void 0 : _window$__on_ufo_vc_d.call(_window3, v1RevisionDebugDetails);
319
+ }
320
+ (_window$__on_ufo_vc_d2 = (_window4 = window).__on_ufo_vc_debug_data_ready) === null || _window$__on_ufo_vc_d2 === void 0 ? void 0 : _window$__on_ufo_vc_d2.call(_window4, v2RevisionDebugDetails);
310
321
  }
311
322
  }
312
323
  } catch (e) {
@@ -461,10 +472,10 @@ export class VCObserver {
461
472
  }
462
473
  });
463
474
  _defineProperty(this, "attachAbortListeners", () => {
464
- var _window;
475
+ var _window5;
465
476
  this.detachAbortListeners();
466
477
  let unbinds = attachAbortListeners(window, this.viewport, this.abortReasonCallback);
467
- if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
478
+ if ((_window5 = window) !== null && _window5 !== void 0 && _window5.__SSR_ABORT_LISTENERS__) {
468
479
  Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(([key, time]) => {
469
480
  if (time) {
470
481
  this.abortReasonCallback(key, time);
@@ -3,6 +3,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import EntriesTimeline from './entries-timeline';
4
4
  import getElementName from './get-element-name';
5
5
  import VCCalculator_FY25_03 from './metric-calculator/fy25_03';
6
+ import getViewportHeight from './metric-calculator/utils/get-viewport-height';
7
+ import getViewportWidth from './metric-calculator/utils/get-viewport-width';
6
8
  import ViewportObserver from './viewport-observer';
7
9
  import WindowEventObserver from './window-event-observer';
8
10
  const DEFAULT_SELECTOR_CONFIG = {
@@ -96,6 +98,29 @@ export default class VCObserverNew {
96
98
  (_this$viewportObserve2 = this.viewportObserver) === null || _this$viewportObserve2 === void 0 ? void 0 : _this$viewportObserve2.stop();
97
99
  (_this$windowEventObse2 = this.windowEventObserver) === null || _this$windowEventObse2 === void 0 ? void 0 : _this$windowEventObse2.stop();
98
100
  }
101
+ addSSR(ssr) {
102
+ this.entriesTimeline.push({
103
+ time: ssr,
104
+ data: {
105
+ elementName: 'SSR',
106
+ type: 'mutation:element',
107
+ rect: {
108
+ height: getViewportHeight(),
109
+ width: getViewportWidth(),
110
+ left: 0,
111
+ top: 0,
112
+ x: 0,
113
+ y: 0,
114
+ bottom: getViewportHeight(),
115
+ right: getViewportWidth(),
116
+ toJSON() {
117
+ return null;
118
+ }
119
+ },
120
+ visible: true
121
+ }
122
+ });
123
+ }
99
124
  async getVCResult(param) {
100
125
  const {
101
126
  start,
@@ -105,6 +130,9 @@ export default class VCObserverNew {
105
130
  const results = [];
106
131
  this.addStartEntry(start);
107
132
  const calculator_fy25_03 = new VCCalculator_FY25_03();
133
+ if (param.ssr) {
134
+ this.addSSR(param.ssr);
135
+ }
108
136
  const orderedEntries = this.entriesTimeline.getOrderedEntries({
109
137
  start,
110
138
  stop
@@ -37,6 +37,7 @@ export default class AbstractVCCalculatorBase {
37
37
  return ratios;
38
38
  }
39
39
  async calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason) {
40
+ var _window, _window3;
40
41
  const percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99];
41
42
  const viewportEntries = this.filterViewportEntries(filteredEntries);
42
43
  const vcLogs = await calculateTTVCPercentilesWithDebugInfo({
@@ -99,24 +100,34 @@ export default class AbstractVCCalculatorBase {
99
100
  previousResult = vcDetails[`${percentile}`];
100
101
  }
101
102
  }
103
+ const v3RevisionDebugDetails = {
104
+ revision: this.revisionNo,
105
+ isClean: isVCClean,
106
+ abortReason: dirtyReason,
107
+ vcLogs,
108
+ interactionId
109
+ };
102
110
 
103
111
  // Handle devtool callback
104
- if (!isPostInteraction && typeof window !== 'undefined' && typeof window.__ufo_devtool_onVCRevisionReady__ === 'function') {
112
+ if (!isPostInteraction && typeof ((_window = window) === null || _window === void 0 ? void 0 : _window.__ufo_devtool_onVCRevisionReady__) === 'function') {
105
113
  try {
106
- var _ufo_devtool_onVCRev, _ref;
107
- (_ufo_devtool_onVCRev = (_ref = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev === void 0 ? void 0 : _ufo_devtool_onVCRev.call(_ref, {
108
- revision: this.revisionNo,
109
- isClean: isVCClean,
110
- abortReason: dirtyReason,
111
- vcLogs,
112
- interactionId
113
- });
114
+ var _window2, _window2$__ufo_devtoo;
115
+ (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$__ufo_devtoo = _window2.__ufo_devtool_onVCRevisionReady__) === null || _window2$__ufo_devtoo === void 0 ? void 0 : _window2$__ufo_devtoo.call(_window2, v3RevisionDebugDetails);
114
116
  } catch (e) {
115
117
  // if any error communicating with devtool, we don't want to break the app
116
118
  // eslint-disable-next-line no-console
117
119
  console.error('Error in onVCRevisionReady', e);
118
120
  }
119
121
  }
122
+ if (!isPostInteraction && typeof ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.__on_ufo_vc_debug_data_ready) === 'function' && fg('platform_ufo_emit_vc_debug_data')) {
123
+ try {
124
+ var _window4, _window4$__on_ufo_vc_;
125
+ (_window4 = window) === null || _window4 === void 0 ? void 0 : (_window4$__on_ufo_vc_ = _window4.__on_ufo_vc_debug_data_ready) === null || _window4$__on_ufo_vc_ === void 0 ? void 0 : _window4$__on_ufo_vc_.call(_window4, v3RevisionDebugDetails);
126
+ } catch (e) {
127
+ // eslint-disable-next-line no-console
128
+ console.error('Error in onVCRevisionReady', e);
129
+ }
130
+ }
120
131
  return vcDetails;
121
132
  }
122
133
  async calculate({