@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
@@ -15,7 +15,7 @@ function getVCMetrics(_x) {
15
15
  }
16
16
  function _getVCMetrics() {
17
17
  _getVCMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
18
- var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$experimentalI, _result$ufoVcRev;
18
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$vc3, _config$experimentalI, _result$ufoVcRev;
19
19
  var config, interactionStatus, pageVisibilityUpToTTAI, shouldReportVCMetrics, isSSREnabled, ssr, tti, prefix, result, mostRecentVCRevision, mostRecentVCRevisionPayload;
20
20
  return _regeneratorRuntime.wrap(function _callee$(_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
@@ -56,11 +56,12 @@ function _getVCMetrics() {
56
56
  stop: interaction.end,
57
57
  tti: tti,
58
58
  prefix: prefix,
59
+ includeSSRInV3: (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRInV3,
59
60
  vc: interaction.vc,
60
61
  isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED',
61
62
  experienceKey: interaction.ufoName,
62
63
  interactionId: interaction.id,
63
- includeSSRRatio: (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRRatio
64
+ includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio
64
65
  }, ssr));
65
66
  case 18:
66
67
  result = _context.sent;
@@ -1,13 +1,19 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _typeof from "@babel/runtime/helpers/typeof";
3
+ 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; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ import { fg } from '@atlaskit/platform-feature-flags';
2
6
  var NESTED_METRIC_SEPARATOR = '/';
3
7
  function filterEntry(entry) {
4
8
  return !(!entry || _typeof(entry) !== 'object' || entry.startTime < 0 || entry.duration < 0);
5
9
  }
6
10
  function mapEntry(entry) {
7
- return {
11
+ return _objectSpread({
8
12
  startTime: Math.round(entry.startTime),
9
13
  duration: Math.round(entry.duration)
10
- };
14
+ }, entry.size && fg('platform_ufo_ssr_size_field') ? {
15
+ size: Math.round(entry.size)
16
+ } : {});
11
17
  }
12
18
  var SSR_PREFIX = 'ssr';
13
19
  function mapKey(key) {
@@ -120,7 +120,8 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
120
120
  return (_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
121
121
  start: param.start,
122
122
  stop: param.stop,
123
- interactionId: param.interactionId
123
+ interactionId: param.interactionId,
124
+ ssr: param.includeSSRInV3 ? param.ssr : undefined
124
125
  });
125
126
  case 12:
126
127
  _context.t1 = _context.sent;
@@ -9,6 +9,7 @@ var _excluded = ["__debug__element"];
9
9
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { isVCRevisionEnabled } from '../../config';
13
14
  import { getActiveInteraction } from '../../interaction-metrics';
14
15
  import { attachAbortListeners } from './attachAbortListeners';
@@ -95,7 +96,7 @@ export var VCObserver = /*#__PURE__*/function () {
95
96
  });
96
97
  _defineProperty(this, "getVCResult", /*#__PURE__*/function () {
97
98
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
98
- var start, stop, tti, prefix, ssr, vc, isEventAborted, experienceKey, interactionId, includeSSRRatio, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, isTTVCv1Disabled, vcAbortedResultWithRevisions, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, _ufo_devtool_onVCRev2, _ref9, _ufo_devtool_onVCRev, _ref8, isVCClean, revisionsData, speedIndex, SSRRatio, SSRRatioNext, SSRRatioPayload, isTTVCv3Enabled;
99
+ var start, stop, tti, prefix, ssr, vc, isEventAborted, experienceKey, interactionId, includeSSRRatio, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, isTTVCv1Disabled, vcAbortedResultWithRevisions, 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;
99
100
  return _regeneratorRuntime.wrap(function _callee$(_context) {
100
101
  while (1) switch (_context.prev = _context.next) {
101
102
  case 0:
@@ -264,30 +265,36 @@ export var VCObserver = /*#__PURE__*/function () {
264
265
  entries: isTTVCv1Disabled ? vcNext.VCEntries.rel : VCEntries.rel
265
266
  }
266
267
  }));
267
-
268
- // Add devtool callback for both v1 and v2
268
+ v1RevisionDebugDetails = getVCRevisionDebugDetails({
269
+ revision: 'fy25.01',
270
+ isClean: !abortReasonInfo,
271
+ abortReason: abortReason.reason,
272
+ VCEntries: VCEntries.rel,
273
+ componentsLog: componentsLog,
274
+ interactionId: interactionId
275
+ });
276
+ v2RevisionDebugDetails = getVCRevisionDebugDetails({
277
+ revision: 'fy25.02',
278
+ isClean: !abortReasonInfo,
279
+ abortReason: abortReason.reason,
280
+ VCEntries: vcNext.VCEntries.rel,
281
+ componentsLog: componentsLog,
282
+ interactionId: interactionId
283
+ }); // Add devtool callback for both v1 and v2
269
284
  if (typeof window.__ufo_devtool_onVCRevisionReady__ === 'function') {
270
285
  // Handle v1 if not disabled
271
286
  if (!isTTVCv1Disabled) {
272
- (_ufo_devtool_onVCRev = (_ref8 = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev === void 0 || _ufo_devtool_onVCRev.call(_ref8, getVCRevisionDebugDetails({
273
- revision: 'fy25.01',
274
- isClean: !abortReasonInfo,
275
- abortReason: abortReason.reason,
276
- VCEntries: VCEntries.rel,
277
- componentsLog: componentsLog,
278
- interactionId: interactionId
279
- }));
287
+ (_window$__ufo_devtool = (_window = window).__ufo_devtool_onVCRevisionReady__) === null || _window$__ufo_devtool === void 0 || _window$__ufo_devtool.call(_window, v1RevisionDebugDetails);
280
288
  }
281
289
 
282
290
  // Handle v2
283
- (_ufo_devtool_onVCRev2 = (_ref9 = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev2 === void 0 || _ufo_devtool_onVCRev2.call(_ref9, getVCRevisionDebugDetails({
284
- revision: 'fy25.02',
285
- isClean: !abortReasonInfo,
286
- abortReason: abortReason.reason,
287
- VCEntries: vcNext.VCEntries.rel,
288
- componentsLog: componentsLog,
289
- interactionId: interactionId
290
- }));
291
+ (_window$__ufo_devtool2 = (_window2 = window).__ufo_devtool_onVCRevisionReady__) === null || _window$__ufo_devtool2 === void 0 || _window$__ufo_devtool2.call(_window2, v2RevisionDebugDetails);
292
+ }
293
+ if (typeof window.__on_ufo_vc_debug_data_ready === 'function' && fg('platform_ufo_emit_vc_debug_data')) {
294
+ if (!isTTVCv1Disabled) {
295
+ (_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);
296
+ }
297
+ (_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);
291
298
  }
292
299
  }
293
300
  } catch (e) {
@@ -416,14 +423,14 @@ export var VCObserver = /*#__PURE__*/function () {
416
423
  }
417
424
  });
418
425
  _defineProperty(this, "attachAbortListeners", function () {
419
- var _window;
426
+ var _window5;
420
427
  _this.detachAbortListeners();
421
428
  var unbinds = attachAbortListeners(window, _this.viewport, _this.abortReasonCallback);
422
- if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
423
- Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref1) {
424
- var _ref10 = _slicedToArray(_ref1, 2),
425
- key = _ref10[0],
426
- time = _ref10[1];
429
+ if ((_window5 = window) !== null && _window5 !== void 0 && _window5.__SSR_ABORT_LISTENERS__) {
430
+ Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref9) {
431
+ var _ref0 = _slicedToArray(_ref9, 2),
432
+ key = _ref0[0],
433
+ time = _ref0[1];
427
434
  if (time) {
428
435
  _this.abortReasonCallback(key, time);
429
436
  }
@@ -453,8 +460,8 @@ export var VCObserver = /*#__PURE__*/function () {
453
460
  }
454
461
  return _createClass(VCObserver, [{
455
462
  key: "start",
456
- value: function start(_ref11) {
457
- var startTime = _ref11.startTime;
463
+ value: function start(_ref1) {
464
+ var startTime = _ref1.startTime;
458
465
  this.active = true;
459
466
  if (this.observers.isBrowserSupported()) {
460
467
  this.setViewportSize();
@@ -476,12 +483,12 @@ export var VCObserver = /*#__PURE__*/function () {
476
483
  }, {
477
484
  key: "getIgnoredElements",
478
485
  value: function getIgnoredElements(componentsLog) {
479
- return Object.values(componentsLog).flat().filter(function (_ref12) {
480
- var ignoreReason = _ref12.ignoreReason;
486
+ return Object.values(componentsLog).flat().filter(function (_ref10) {
487
+ var ignoreReason = _ref10.ignoreReason;
481
488
  return Boolean(ignoreReason);
482
- }).map(function (_ref13) {
483
- var targetName = _ref13.targetName,
484
- ignoreReason = _ref13.ignoreReason;
489
+ }).map(function (_ref11) {
490
+ var targetName = _ref11.targetName,
491
+ ignoreReason = _ref11.ignoreReason;
485
492
  return {
486
493
  targetName: targetName,
487
494
  ignoreReason: ignoreReason
@@ -611,13 +618,13 @@ export var VCObserver = /*#__PURE__*/function () {
611
618
  }
612
619
  }, {
613
620
  key: "calculateVC",
614
- value: function calculateVC(_ref14) {
615
- var heatmap = _ref14.heatmap,
616
- _ref14$ssr = _ref14.ssr,
617
- ssr = _ref14$ssr === void 0 ? UNUSED_SECTOR : _ref14$ssr,
618
- componentsLog = _ref14.componentsLog,
619
- viewport = _ref14.viewport,
620
- fixSSRAttribution = _ref14.fixSSRAttribution;
621
+ value: function calculateVC(_ref12) {
622
+ var heatmap = _ref12.heatmap,
623
+ _ref12$ssr = _ref12.ssr,
624
+ ssr = _ref12$ssr === void 0 ? UNUSED_SECTOR : _ref12$ssr,
625
+ componentsLog = _ref12.componentsLog,
626
+ viewport = _ref12.viewport,
627
+ fixSSRAttribution = _ref12.fixSSRAttribution;
621
628
  var lastUpdate = {};
622
629
  var totalPainted = 0;
623
630
  var ssrTime = fixSSRAttribution ? Math.floor(ssr) : ssr;
@@ -684,11 +691,11 @@ export var VCObserver = /*#__PURE__*/function () {
684
691
  });
685
692
  return VCRatio;
686
693
  }, 0);
687
- var VCEntries = entries.reduce(function (acc, _ref15, i) {
694
+ var VCEntries = entries.reduce(function (acc, _ref13, i) {
688
695
  var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
689
- var _ref16 = _slicedToArray(_ref15, 2),
690
- timestamp = _ref16[0],
691
- entryPainted = _ref16[1];
696
+ var _ref14 = _slicedToArray(_ref13, 2),
697
+ timestamp = _ref14[0],
698
+ entryPainted = _ref14[1];
692
699
  var currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
693
700
  var currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
694
701
  var logEntry = _toConsumableArray(new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.filter(function (v) {
@@ -9,6 +9,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import EntriesTimeline from './entries-timeline';
10
10
  import _getElementName from './get-element-name';
11
11
  import VCCalculator_FY25_03 from './metric-calculator/fy25_03';
12
+ import getViewportHeight from './metric-calculator/utils/get-viewport-height';
13
+ import getViewportWidth from './metric-calculator/utils/get-viewport-width';
12
14
  import ViewportObserver from './viewport-observer';
13
15
  import WindowEventObserver from './window-event-observer';
14
16
  var DEFAULT_SELECTOR_CONFIG = {
@@ -111,6 +113,31 @@ var VCObserverNew = /*#__PURE__*/function () {
111
113
  (_this$viewportObserve2 = this.viewportObserver) === null || _this$viewportObserve2 === void 0 || _this$viewportObserve2.stop();
112
114
  (_this$windowEventObse2 = this.windowEventObserver) === null || _this$windowEventObse2 === void 0 || _this$windowEventObse2.stop();
113
115
  }
116
+ }, {
117
+ key: "addSSR",
118
+ value: function addSSR(ssr) {
119
+ this.entriesTimeline.push({
120
+ time: ssr,
121
+ data: {
122
+ elementName: 'SSR',
123
+ type: 'mutation:element',
124
+ rect: {
125
+ height: getViewportHeight(),
126
+ width: getViewportWidth(),
127
+ left: 0,
128
+ top: 0,
129
+ x: 0,
130
+ y: 0,
131
+ bottom: getViewportHeight(),
132
+ right: getViewportWidth(),
133
+ toJSON: function toJSON() {
134
+ return null;
135
+ }
136
+ },
137
+ visible: true
138
+ }
139
+ });
140
+ }
114
141
  }, {
115
142
  key: "getVCResult",
116
143
  value: function () {
@@ -123,11 +150,14 @@ var VCObserverNew = /*#__PURE__*/function () {
123
150
  results = [];
124
151
  this.addStartEntry(start);
125
152
  calculator_fy25_03 = new VCCalculator_FY25_03();
153
+ if (param.ssr) {
154
+ this.addSSR(param.ssr);
155
+ }
126
156
  orderedEntries = this.entriesTimeline.getOrderedEntries({
127
157
  start: start,
128
158
  stop: stop
129
159
  });
130
- _context.next = 7;
160
+ _context.next = 8;
131
161
  return calculator_fy25_03.calculate({
132
162
  orderedEntries: orderedEntries,
133
163
  startTime: start,
@@ -135,13 +165,13 @@ var VCObserverNew = /*#__PURE__*/function () {
135
165
  interactionId: interactionId,
136
166
  isPostInteraction: this.isPostInteraction
137
167
  });
138
- case 7:
168
+ case 8:
139
169
  fy25_03 = _context.sent;
140
170
  if (fy25_03) {
141
171
  results.push(fy25_03);
142
172
  }
143
173
  return _context.abrupt("return", results);
144
- case 10:
174
+ case 11:
145
175
  case "end":
146
176
  return _context.stop();
147
177
  }
@@ -73,7 +73,8 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
73
73
  key: "calculateWithDebugInfo",
74
74
  value: function () {
75
75
  var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason) {
76
- var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, _ufo_devtool_onVCRev, _ref;
76
+ var _window, _window3;
77
+ 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_;
77
78
  return _regeneratorRuntime.wrap(function _callee$(_context) {
78
79
  while (1) switch (_context.prev = _context.next) {
79
80
  case 0:
@@ -163,25 +164,32 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
163
164
  previousResult = vcDetails["".concat(percentile)];
164
165
  }
165
166
  }
166
-
167
- // Handle devtool callback
168
- if (!isPostInteraction && typeof window !== 'undefined' && typeof window.__ufo_devtool_onVCRevisionReady__ === 'function') {
167
+ v3RevisionDebugDetails = {
168
+ revision: this.revisionNo,
169
+ isClean: isVCClean,
170
+ abortReason: dirtyReason,
171
+ vcLogs: vcLogs,
172
+ interactionId: interactionId
173
+ }; // Handle devtool callback
174
+ if (!isPostInteraction && typeof ((_window = window) === null || _window === void 0 ? void 0 : _window.__ufo_devtool_onVCRevisionReady__) === 'function') {
169
175
  try {
170
- (_ufo_devtool_onVCRev = (_ref = window).__ufo_devtool_onVCRevisionReady__) === null || _ufo_devtool_onVCRev === void 0 || _ufo_devtool_onVCRev.call(_ref, {
171
- revision: this.revisionNo,
172
- isClean: isVCClean,
173
- abortReason: dirtyReason,
174
- vcLogs: vcLogs,
175
- interactionId: interactionId
176
- });
176
+ (_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);
177
177
  } catch (e) {
178
178
  // if any error communicating with devtool, we don't want to break the app
179
179
  // eslint-disable-next-line no-console
180
180
  console.error('Error in onVCRevisionReady', e);
181
181
  }
182
182
  }
183
+ 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')) {
184
+ try {
185
+ (_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);
186
+ } catch (e) {
187
+ // eslint-disable-next-line no-console
188
+ console.error('Error in onVCRevisionReady', e);
189
+ }
190
+ }
183
191
  return _context.abrupt("return", vcDetails);
184
- case 32:
192
+ case 34:
185
193
  case "end":
186
194
  return _context.stop();
187
195
  }
@@ -195,7 +203,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
195
203
  }, {
196
204
  key: "calculate",
197
205
  value: function () {
198
- var _calculate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
206
+ var _calculate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref) {
199
207
  var _this = this,
200
208
  _vcDetails$90$t,
201
209
  _vcDetails$;
@@ -203,7 +211,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
203
211
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
204
212
  while (1) switch (_context2.prev = _context2.next) {
205
213
  case 0:
206
- startTime = _ref2.startTime, stopTime = _ref2.stopTime, orderedEntries = _ref2.orderedEntries, interactionId = _ref2.interactionId, isPostInteraction = _ref2.isPostInteraction;
214
+ startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction;
207
215
  filteredEntries = orderedEntries.filter(function (entry) {
208
216
  return _this.isEntryIncluded(entry);
209
217
  });
@@ -74,6 +74,7 @@ export type Config = {
74
74
  readonly ssr?: boolean;
75
75
  readonly ssrWhitelist?: string[];
76
76
  readonly ssrEnablePageLayoutPlaceholder?: boolean;
77
+ readonly includeSSRInV3?: boolean;
77
78
  readonly stopVCAtInteractionFinish?: boolean;
78
79
  readonly includeSSRRatio?: boolean;
79
80
  /**
@@ -2,6 +2,7 @@ export type FeatureFlagValue = boolean | string | number | Record<any, any>;
2
2
  export type ReportedTiming = {
3
3
  startTime: number;
4
4
  duration: number;
5
+ size?: number;
5
6
  };
6
7
  export type ReportedTimings = {
7
8
  [key: string]: ReportedTiming;
@@ -1,5 +1,6 @@
1
1
  import type { VCRawDataType, VCResult } from '../common/vc/types';
2
2
  import type { GetVCResultType, VCObserverInterface, VCObserverOptions } from './types';
3
+ export type { VCRevisionDebugDetails } from './vc-observer/getVCRevisionDebugDetails';
3
4
  declare global {
4
5
  var __vcObserver: VCObserverInterface;
5
6
  }
@@ -6,6 +6,7 @@ export type GetVCResultType = {
6
6
  isEventAborted: boolean;
7
7
  prefix?: string;
8
8
  ssr?: number;
9
+ includeSSRInV3?: boolean;
9
10
  vc?: VCRawDataType | null;
10
11
  experienceKey: string;
11
12
  interactionId?: string;
@@ -1,9 +1,9 @@
1
- import type { ComponentsLogType, VCEntryType } from '../../common/vc/types';
1
+ import type { ComponentsLogType, VCAbortReason, VCEntryType } from '../../common/vc/types';
2
2
  import type { VCObserverEntryType } from '../vc-observer-new/types';
3
- interface VCRevisionDebugDetails {
3
+ export interface VCRevisionDebugDetails {
4
4
  revision: string;
5
5
  isClean: boolean;
6
- abortReason: string | null;
6
+ abortReason?: VCAbortReason | null;
7
7
  vcLogs: Array<{
8
8
  time: number;
9
9
  viewportPercentage: number;
@@ -22,9 +22,8 @@ interface VCRevisionDebugDetails {
22
22
  export declare function getVCRevisionDebugDetails({ revision, isClean, abortReason, VCEntries, componentsLog, interactionId, }: {
23
23
  revision: string;
24
24
  isClean: boolean;
25
- abortReason: string | null;
25
+ abortReason?: VCAbortReason | null;
26
26
  VCEntries: VCEntryType[];
27
27
  componentsLog: ComponentsLogType;
28
28
  interactionId?: string;
29
29
  }): VCRevisionDebugDetails;
30
- export {};
@@ -1,7 +1,14 @@
1
1
  import { type UnbindFn } from 'bind-event-listener';
2
2
  import type { ComponentsLogType, VCAbortReasonType, VCEntryType, VCIgnoreReason, VCRatioType, VCRawDataType, VCResult } from '../../common/vc/types';
3
3
  import type { GetVCResultType, VCObserverInterface, VCObserverOptions } from '../types';
4
+ import { VCRevisionDebugDetails } from './getVCRevisionDebugDetails';
4
5
  import { Observers } from './observers';
6
+ declare global {
7
+ interface Window {
8
+ __ufo_devtool_onVCRevisionReady__?: (debugInfo: VCRevisionDebugDetails) => void;
9
+ __on_ufo_vc_debug_data_ready?: (debugInfo: VCRevisionDebugDetails) => void;
10
+ }
11
+ }
5
12
  export declare class VCObserver implements VCObserverInterface {
6
13
  abortReason: VCAbortReasonType;
7
14
  outOfBoundaryInfo: string;
@@ -16,6 +16,7 @@ export default class VCObserverNew {
16
16
  startTime: DOMHighResTimeStamp;
17
17
  }): void;
18
18
  stop(): void;
19
+ addSSR(ssr: number): void;
19
20
  getVCResult(param: VCObserverGetVCResultParam): Promise<RevisionPayloadEntry[]>;
20
21
  private addStartEntry;
21
22
  private getElementName;
@@ -1,6 +1,13 @@
1
1
  import type { RevisionPayloadEntry, VCAbortReason } from '../../../common/vc/types';
2
+ import { VCRevisionDebugDetails } from '../../vc-observer/getVCRevisionDebugDetails';
2
3
  import type { VCObserverEntry } from '../types';
3
4
  import type { VCCalculator, VCCalculatorParam } from './types';
5
+ declare global {
6
+ interface Window {
7
+ __ufo_devtool_onVCRevisionReady__?: (debugInfo: VCRevisionDebugDetails) => void;
8
+ __on_ufo_vc_debug_data_ready?: (debugInfo: VCRevisionDebugDetails) => void;
9
+ }
10
+ }
4
11
  export default abstract class AbstractVCCalculatorBase implements VCCalculator {
5
12
  private revisionNo;
6
13
  constructor(revisionNo: string);
@@ -22,4 +22,5 @@ export type VCObserverGetVCResultParam = {
22
22
  start: number;
23
23
  stop: number;
24
24
  interactionId?: string;
25
+ ssr?: number;
25
26
  };
@@ -74,6 +74,7 @@ export type Config = {
74
74
  readonly ssr?: boolean;
75
75
  readonly ssrWhitelist?: string[];
76
76
  readonly ssrEnablePageLayoutPlaceholder?: boolean;
77
+ readonly includeSSRInV3?: boolean;
77
78
  readonly stopVCAtInteractionFinish?: boolean;
78
79
  readonly includeSSRRatio?: boolean;
79
80
  /**
@@ -2,6 +2,7 @@ export type FeatureFlagValue = boolean | string | number | Record<any, any>;
2
2
  export type ReportedTiming = {
3
3
  startTime: number;
4
4
  duration: number;
5
+ size?: number;
5
6
  };
6
7
  export type ReportedTimings = {
7
8
  [key: string]: ReportedTiming;
@@ -1,5 +1,6 @@
1
1
  import type { VCRawDataType, VCResult } from '../common/vc/types';
2
2
  import type { GetVCResultType, VCObserverInterface, VCObserverOptions } from './types';
3
+ export type { VCRevisionDebugDetails } from './vc-observer/getVCRevisionDebugDetails';
3
4
  declare global {
4
5
  var __vcObserver: VCObserverInterface;
5
6
  }
@@ -6,6 +6,7 @@ export type GetVCResultType = {
6
6
  isEventAborted: boolean;
7
7
  prefix?: string;
8
8
  ssr?: number;
9
+ includeSSRInV3?: boolean;
9
10
  vc?: VCRawDataType | null;
10
11
  experienceKey: string;
11
12
  interactionId?: string;
@@ -1,9 +1,9 @@
1
- import type { ComponentsLogType, VCEntryType } from '../../common/vc/types';
1
+ import type { ComponentsLogType, VCAbortReason, VCEntryType } from '../../common/vc/types';
2
2
  import type { VCObserverEntryType } from '../vc-observer-new/types';
3
- interface VCRevisionDebugDetails {
3
+ export interface VCRevisionDebugDetails {
4
4
  revision: string;
5
5
  isClean: boolean;
6
- abortReason: string | null;
6
+ abortReason?: VCAbortReason | null;
7
7
  vcLogs: Array<{
8
8
  time: number;
9
9
  viewportPercentage: number;
@@ -22,9 +22,8 @@ interface VCRevisionDebugDetails {
22
22
  export declare function getVCRevisionDebugDetails({ revision, isClean, abortReason, VCEntries, componentsLog, interactionId, }: {
23
23
  revision: string;
24
24
  isClean: boolean;
25
- abortReason: string | null;
25
+ abortReason?: VCAbortReason | null;
26
26
  VCEntries: VCEntryType[];
27
27
  componentsLog: ComponentsLogType;
28
28
  interactionId?: string;
29
29
  }): VCRevisionDebugDetails;
30
- export {};
@@ -1,7 +1,14 @@
1
1
  import { type UnbindFn } from 'bind-event-listener';
2
2
  import type { ComponentsLogType, VCAbortReasonType, VCEntryType, VCIgnoreReason, VCRatioType, VCRawDataType, VCResult } from '../../common/vc/types';
3
3
  import type { GetVCResultType, VCObserverInterface, VCObserverOptions } from '../types';
4
+ import { VCRevisionDebugDetails } from './getVCRevisionDebugDetails';
4
5
  import { Observers } from './observers';
6
+ declare global {
7
+ interface Window {
8
+ __ufo_devtool_onVCRevisionReady__?: (debugInfo: VCRevisionDebugDetails) => void;
9
+ __on_ufo_vc_debug_data_ready?: (debugInfo: VCRevisionDebugDetails) => void;
10
+ }
11
+ }
5
12
  export declare class VCObserver implements VCObserverInterface {
6
13
  abortReason: VCAbortReasonType;
7
14
  outOfBoundaryInfo: string;
@@ -16,6 +16,7 @@ export default class VCObserverNew {
16
16
  startTime: DOMHighResTimeStamp;
17
17
  }): void;
18
18
  stop(): void;
19
+ addSSR(ssr: number): void;
19
20
  getVCResult(param: VCObserverGetVCResultParam): Promise<RevisionPayloadEntry[]>;
20
21
  private addStartEntry;
21
22
  private getElementName;
@@ -1,6 +1,13 @@
1
1
  import type { RevisionPayloadEntry, VCAbortReason } from '../../../common/vc/types';
2
+ import { VCRevisionDebugDetails } from '../../vc-observer/getVCRevisionDebugDetails';
2
3
  import type { VCObserverEntry } from '../types';
3
4
  import type { VCCalculator, VCCalculatorParam } from './types';
5
+ declare global {
6
+ interface Window {
7
+ __ufo_devtool_onVCRevisionReady__?: (debugInfo: VCRevisionDebugDetails) => void;
8
+ __on_ufo_vc_debug_data_ready?: (debugInfo: VCRevisionDebugDetails) => void;
9
+ }
10
+ }
4
11
  export default abstract class AbstractVCCalculatorBase implements VCCalculator {
5
12
  private revisionNo;
6
13
  constructor(revisionNo: string);
@@ -22,4 +22,5 @@ export type VCObserverGetVCResultParam = {
22
22
  start: number;
23
23
  stop: number;
24
24
  interactionId?: string;
25
+ ssr?: number;
25
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.13.16",
3
+ "version": "3.13.18",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -133,6 +133,9 @@
133
133
  "platform_ufo_report_cpu_usage": {
134
134
  "type": "boolean"
135
135
  },
136
+ "platform_ufo_emit_vc_debug_data": {
137
+ "type": "boolean"
138
+ },
136
139
  "ufo_return_relative_request_start": {
137
140
  "type": "boolean"
138
141
  },
@@ -159,6 +162,9 @@
159
162
  },
160
163
  "platform_ufo_rev_ratios": {
161
164
  "type": "boolean"
165
+ },
166
+ "platform_ufo_ssr_size_field": {
167
+ "type": "boolean"
162
168
  }
163
169
  }
164
170
  }