@atlaskit/react-ufo 4.11.3 → 4.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.11.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0e311a2eaf943`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0e311a2eaf943) -
8
+ Fixed reporting ssrRatio in v3
9
+
3
10
  ## 4.11.3
4
11
 
5
12
  ### Patch Changes
@@ -122,11 +122,11 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
122
122
  value: function () {
123
123
  var _getVCResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(param) {
124
124
  var _this$oldVCObserver4, _this$newVCObserver3, _ref2;
125
- var experienceKey, include3p, excludeSmartAnswersInSearch, v1v2Result, v3Result;
125
+ var experienceKey, include3p, excludeSmartAnswersInSearch, includeSSRRatio, v1v2Result, v3Result, ssrRatio;
126
126
  return _regenerator.default.wrap(function _callee$(_context) {
127
127
  while (1) switch (_context.prev = _context.next) {
128
128
  case 0:
129
- experienceKey = param.experienceKey, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
129
+ experienceKey = param.experienceKey, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch, includeSSRRatio = param.includeSSRRatio;
130
130
  if (!((0, _config.isVCRevisionEnabled)('fy25.01', experienceKey) || (0, _config.isVCRevisionEnabled)('fy25.02', experienceKey))) {
131
131
  _context.next = 7;
132
132
  break;
@@ -153,6 +153,7 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
153
153
  ssr: param.includeSSRInV3 ? param.ssr : undefined,
154
154
  include3p: include3p,
155
155
  excludeSmartAnswersInSearch: excludeSmartAnswersInSearch,
156
+ includeSSRRatio: includeSSRRatio,
156
157
  interactionType: param.interactionType,
157
158
  isPageVisible: param.isPageVisible,
158
159
  interactionAbortReason: param.interactionAbortReason
@@ -171,10 +172,13 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
171
172
  }
172
173
  return _context.abrupt("return", v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {});
173
174
  case 19:
174
- return _context.abrupt("return", _objectSpread(_objectSpread({}, v1v2Result), {}, {
175
+ ssrRatio = v3Result[0].ssrRatio;
176
+ return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, includeSSRRatio && ssrRatio !== undefined ? {
177
+ 'ufo:vc:ssrRatio': ssrRatio
178
+ } : {}), v1v2Result), {}, {
175
179
  'ufo:vc:rev': [].concat((0, _toConsumableArray2.default)((_ref2 = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref2 !== void 0 ? _ref2 : []), (0, _toConsumableArray2.default)(v3Result !== null && v3Result !== void 0 ? v3Result : []))
176
180
  }));
177
- case 20:
181
+ case 21:
178
182
  case "end":
179
183
  return _context.stop();
180
184
  }
@@ -238,11 +238,11 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
238
238
  key: "getVCResult",
239
239
  value: function () {
240
240
  var _getVCResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(param) {
241
- var start, stop, interactionId, interactionType, interactionAbortReason, isPageVisible, include3p, excludeSmartAnswersInSearch, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
241
+ var start, stop, interactionId, interactionType, interactionAbortReason, isPageVisible, include3p, includeSSRRatio, excludeSmartAnswersInSearch, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
242
242
  return _regenerator.default.wrap(function _callee$(_context) {
243
243
  while (1) switch (_context.prev = _context.next) {
244
244
  case 0:
245
- start = param.start, stop = param.stop, interactionId = param.interactionId, interactionType = param.interactionType, interactionAbortReason = param.interactionAbortReason, isPageVisible = param.isPageVisible, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
245
+ start = param.start, stop = param.stop, interactionId = param.interactionId, interactionType = param.interactionType, interactionAbortReason = param.interactionAbortReason, isPageVisible = param.isPageVisible, include3p = param.include3p, includeSSRRatio = param.includeSSRRatio, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
246
246
  results = [];
247
247
  this.addStartEntry(start);
248
248
  calculator_fy25_03 = new _fy25_.default();
@@ -263,6 +263,7 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
263
263
  isPostInteraction: this.isPostInteraction,
264
264
  include3p: include3p,
265
265
  excludeSmartAnswersInSearch: excludeSmartAnswersInSearch,
266
+ includeSSRRatio: includeSSRRatio,
266
267
  isPageVisible: isPageVisible,
267
268
  interactionAbortReason: interactionAbortReason
268
269
  });
@@ -287,6 +288,7 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
287
288
  interactionType: interactionType,
288
289
  isPostInteraction: this.isPostInteraction,
289
290
  include3p: include3p,
291
+ includeSSRRatio: includeSSRRatio,
290
292
  isPageVisible: isPageVisible,
291
293
  interactionAbortReason: interactionAbortReason
292
294
  });
@@ -108,9 +108,9 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
108
108
  }, {
109
109
  key: "calculateWithDebugInfo",
110
110
  value: function () {
111
- var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason) {
111
+ var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio) {
112
112
  var _window, _window2, _window6, _window8;
113
- var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, _window3, _window4, _window5, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window7, _window7$__ufo_devtoo, _window9, _window9$__on_ufo_vc_;
113
+ var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, ssrRatio, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, _window3, _window4, _window5, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window7, _window7$__ufo_devtoo, _window9, _window9$__on_ufo_vc_;
114
114
  return _regenerator.default.wrap(function _callee$(_context) {
115
115
  while (1) switch (_context.prev = _context.next) {
116
116
  case 0:
@@ -131,26 +131,34 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
131
131
  vcDetails = {};
132
132
  percentileIndex = 0;
133
133
  entryDataBuffer = new Set();
134
+ ssrRatio = -1;
134
135
  if (!vcLogs) {
135
- _context.next = 28;
136
+ _context.next = 30;
136
137
  break;
137
138
  }
138
139
  _iterator4 = _createForOfIteratorHelper(vcLogs);
139
- _context.prev = 10;
140
+ _context.prev = 11;
140
141
  _iterator4.s();
141
- case 12:
142
+ case 13:
142
143
  if ((_step4 = _iterator4.n()).done) {
143
- _context.next = 20;
144
+ _context.next = 22;
144
145
  break;
145
146
  }
146
147
  _entry3 = _step4.value;
147
- time = _entry3.time, viewportPercentage = _entry3.viewportPercentage, entries = _entry3.entries; // Only process entries if we haven't reached all percentiles
148
+ time = _entry3.time, viewportPercentage = _entry3.viewportPercentage, entries = _entry3.entries;
149
+ if (includeSSRRatio && ssrRatio === -1 && entries.some(function (e) {
150
+ return e.elementName === 'SSR';
151
+ }) && (0, _platformFeatureFlags.fg)('platform_report_ssr_ratio_in_v3')) {
152
+ ssrRatio = viewportPercentage / 100;
153
+ }
154
+
155
+ // Only process entries if we haven't reached all percentiles
148
156
  if (!(percentileIndex >= percentiles.length)) {
149
- _context.next = 17;
157
+ _context.next = 19;
150
158
  break;
151
159
  }
152
- return _context.abrupt("break", 20);
153
- case 17:
160
+ return _context.abrupt("break", 22);
161
+ case 19:
154
162
  // Check if this entry matches any checkpoint percentiles
155
163
  if (viewportPercentage >= percentiles[percentileIndex]) {
156
164
  elementNames = entries.map(function (e) {
@@ -172,21 +180,21 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
172
180
  return entryDataBuffer.add(e);
173
181
  });
174
182
  }
175
- case 18:
176
- _context.next = 12;
177
- break;
178
183
  case 20:
179
- _context.next = 25;
184
+ _context.next = 13;
180
185
  break;
181
186
  case 22:
182
- _context.prev = 22;
183
- _context.t0 = _context["catch"](10);
187
+ _context.next = 27;
188
+ break;
189
+ case 24:
190
+ _context.prev = 24;
191
+ _context.t0 = _context["catch"](11);
184
192
  _iterator4.e(_context.t0);
185
- case 25:
186
- _context.prev = 25;
193
+ case 27:
194
+ _context.prev = 27;
187
195
  _iterator4.f();
188
- return _context.finish(25);
189
- case 28:
196
+ return _context.finish(27);
197
+ case 30:
190
198
  // Fill in any missing percentiles with the last known values
191
199
  previousResult = {
192
200
  t: 0,
@@ -347,14 +355,17 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
347
355
  console.error('Error in 3pDebugData', e);
348
356
  }
349
357
  }
350
- return _context.abrupt("return", vcDetails);
351
- case 41:
358
+ return _context.abrupt("return", {
359
+ vcDetails: vcDetails,
360
+ ssrRatio: ssrRatio
361
+ });
362
+ case 43:
352
363
  case "end":
353
364
  return _context.stop();
354
365
  }
355
- }, _callee, this, [[10, 22, 25, 28]]);
366
+ }, _callee, this, [[11, 24, 27, 30]]);
356
367
  }));
357
- function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11) {
368
+ function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12) {
358
369
  return _calculateWithDebugInfo.apply(this, arguments);
359
370
  }
360
371
  return calculateWithDebugInfo;
@@ -366,11 +377,11 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
366
377
  var _this = this,
367
378
  _vcDetails$90$t,
368
379
  _vcDetails$;
369
- var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, interactionType, isPageVisible, interactionAbortReason, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
380
+ var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, includeSSRRatio, interactionType, isPageVisible, interactionAbortReason, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, _yield$this$calculate, vcDetails, ssrRatio, result;
370
381
  return _regenerator.default.wrap(function _callee2$(_context2) {
371
382
  while (1) switch (_context2.prev = _context2.next) {
372
383
  case 0:
373
- startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p, excludeSmartAnswersInSearch = _ref.excludeSmartAnswersInSearch, interactionType = _ref.interactionType, isPageVisible = _ref.isPageVisible, interactionAbortReason = _ref.interactionAbortReason;
384
+ startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p, excludeSmartAnswersInSearch = _ref.excludeSmartAnswersInSearch, includeSSRRatio = _ref.includeSSRRatio, interactionType = _ref.interactionType, isPageVisible = _ref.isPageVisible, interactionAbortReason = _ref.interactionAbortReason;
374
385
  filteredEntries = orderedEntries.filter(function (entry) {
375
386
  return _this.isEntryIncluded(entry, include3p, excludeSmartAnswersInSearch);
376
387
  });
@@ -390,9 +401,11 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
390
401
  });
391
402
  case 7:
392
403
  _context2.next = 9;
393
- return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason);
404
+ return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio);
394
405
  case 9:
395
- vcDetails = _context2.sent;
406
+ _yield$this$calculate = _context2.sent;
407
+ vcDetails = _yield$this$calculate.vcDetails;
408
+ ssrRatio = _yield$this$calculate.ssrRatio;
396
409
  result = {
397
410
  revision: this.revisionNo,
398
411
  clean: true,
@@ -400,6 +413,9 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
400
413
  vcDetails: vcDetails !== null && vcDetails !== void 0 ? vcDetails : undefined
401
414
  };
402
415
  result.ratios = this.calculateRatios(filteredEntries);
416
+ if (ssrRatio !== -1) {
417
+ result.ssrRatio = ssrRatio;
418
+ }
403
419
  if (isPostInteraction) {
404
420
  result.labelStacks = this.getLabelStacks(filteredEntries);
405
421
  }
@@ -407,13 +423,13 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
407
423
  result.displayContentsOccurrence = _trackDisplayContentOccurrence.cssIssueOccurrence;
408
424
  }
409
425
  return _context2.abrupt("return", result);
410
- case 15:
426
+ case 18:
411
427
  case "end":
412
428
  return _context2.stop();
413
429
  }
414
430
  }, _callee2, this);
415
431
  }));
416
- function calculate(_x12) {
432
+ function calculate(_x13) {
417
433
  return _calculate.apply(this, arguments);
418
434
  }
419
435
  return calculate;
@@ -96,7 +96,8 @@ export class VCObserverWrapper {
96
96
  const {
97
97
  experienceKey,
98
98
  include3p,
99
- excludeSmartAnswersInSearch
99
+ excludeSmartAnswersInSearch,
100
+ includeSSRRatio
100
101
  } = param;
101
102
  const v1v2Result = isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey) ? await ((_this$oldVCObserver4 = this.oldVCObserver) === null || _this$oldVCObserver4 === void 0 ? void 0 : _this$oldVCObserver4.getVCResult(param)) : {};
102
103
  const v3Result = isVCRevisionEnabled('fy25.03', experienceKey) ? await ((_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
@@ -106,6 +107,7 @@ export class VCObserverWrapper {
106
107
  ssr: param.includeSSRInV3 ? param.ssr : undefined,
107
108
  include3p,
108
109
  excludeSmartAnswersInSearch,
110
+ includeSSRRatio,
109
111
  interactionType: param.interactionType,
110
112
  isPageVisible: param.isPageVisible,
111
113
  interactionAbortReason: param.interactionAbortReason
@@ -113,7 +115,11 @@ export class VCObserverWrapper {
113
115
  if (!v3Result) {
114
116
  return v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {};
115
117
  }
118
+ const ssrRatio = v3Result[0].ssrRatio;
116
119
  return {
120
+ ...(includeSSRRatio && ssrRatio !== undefined ? {
121
+ 'ufo:vc:ssrRatio': ssrRatio
122
+ } : {}),
117
123
  ...v1v2Result,
118
124
  'ufo:vc:rev': [...((_ref = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref !== void 0 ? _ref : []), ...(v3Result !== null && v3Result !== void 0 ? v3Result : [])]
119
125
  };
@@ -200,6 +200,7 @@ export default class VCObserverNew {
200
200
  interactionAbortReason,
201
201
  isPageVisible,
202
202
  include3p,
203
+ includeSSRRatio,
203
204
  excludeSmartAnswersInSearch
204
205
  } = param;
205
206
  const results = [];
@@ -221,6 +222,7 @@ export default class VCObserverNew {
221
222
  isPostInteraction: this.isPostInteraction,
222
223
  include3p,
223
224
  excludeSmartAnswersInSearch,
225
+ includeSSRRatio,
224
226
  isPageVisible,
225
227
  interactionAbortReason
226
228
  });
@@ -239,6 +241,7 @@ export default class VCObserverNew {
239
241
  interactionType,
240
242
  isPostInteraction: this.isPostInteraction,
241
243
  include3p,
244
+ includeSSRRatio,
242
245
  isPageVisible,
243
246
  interactionAbortReason
244
247
  });
@@ -52,7 +52,7 @@ export default class AbstractVCCalculatorBase {
52
52
  }
53
53
  return labelStacks;
54
54
  }
55
- async calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason) {
55
+ async calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio) {
56
56
  var _window, _window2, _window6, _window8;
57
57
  const percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99, 100];
58
58
  const viewportEntries = this.filterViewportEntries(filteredEntries);
@@ -68,6 +68,7 @@ export default class AbstractVCCalculatorBase {
68
68
  const vcDetails = {};
69
69
  let percentileIndex = 0;
70
70
  const entryDataBuffer = new Set();
71
+ let ssrRatio = -1;
71
72
  if (vcLogs) {
72
73
  for (const entry of vcLogs) {
73
74
  const {
@@ -75,6 +76,9 @@ export default class AbstractVCCalculatorBase {
75
76
  viewportPercentage,
76
77
  entries
77
78
  } = entry;
79
+ if (includeSSRRatio && ssrRatio === -1 && entries.some(e => e.elementName === 'SSR') && fg('platform_report_ssr_ratio_in_v3')) {
80
+ ssrRatio = viewportPercentage / 100;
81
+ }
78
82
 
79
83
  // Only process entries if we haven't reached all percentiles
80
84
  if (percentileIndex >= percentiles.length) {
@@ -247,7 +251,10 @@ export default class AbstractVCCalculatorBase {
247
251
  console.error('Error in 3pDebugData', e);
248
252
  }
249
253
  }
250
- return vcDetails;
254
+ return {
255
+ vcDetails,
256
+ ssrRatio
257
+ };
251
258
  }
252
259
  async calculate({
253
260
  startTime,
@@ -257,6 +264,7 @@ export default class AbstractVCCalculatorBase {
257
264
  isPostInteraction,
258
265
  include3p,
259
266
  excludeSmartAnswersInSearch,
267
+ includeSSRRatio,
260
268
  interactionType,
261
269
  isPageVisible,
262
270
  interactionAbortReason
@@ -279,7 +287,10 @@ export default class AbstractVCCalculatorBase {
279
287
  abortTimestamp: getVCCleanStatusResult.abortTimestamp
280
288
  };
281
289
  }
282
- const vcDetails = await this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason);
290
+ const {
291
+ vcDetails,
292
+ ssrRatio
293
+ } = await this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio);
283
294
  const result = {
284
295
  revision: this.revisionNo,
285
296
  clean: true,
@@ -287,6 +298,9 @@ export default class AbstractVCCalculatorBase {
287
298
  vcDetails: vcDetails !== null && vcDetails !== void 0 ? vcDetails : undefined
288
299
  };
289
300
  result.ratios = this.calculateRatios(filteredEntries);
301
+ if (ssrRatio !== -1) {
302
+ result.ssrRatio = ssrRatio;
303
+ }
290
304
  if (isPostInteraction) {
291
305
  result.labelStacks = this.getLabelStacks(filteredEntries);
292
306
  }
@@ -112,11 +112,11 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
112
112
  value: function () {
113
113
  var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
114
114
  var _this$oldVCObserver4, _this$newVCObserver3, _ref2;
115
- var experienceKey, include3p, excludeSmartAnswersInSearch, v1v2Result, v3Result;
115
+ var experienceKey, include3p, excludeSmartAnswersInSearch, includeSSRRatio, v1v2Result, v3Result, ssrRatio;
116
116
  return _regeneratorRuntime.wrap(function _callee$(_context) {
117
117
  while (1) switch (_context.prev = _context.next) {
118
118
  case 0:
119
- experienceKey = param.experienceKey, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
119
+ experienceKey = param.experienceKey, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch, includeSSRRatio = param.includeSSRRatio;
120
120
  if (!(isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey))) {
121
121
  _context.next = 7;
122
122
  break;
@@ -143,6 +143,7 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
143
143
  ssr: param.includeSSRInV3 ? param.ssr : undefined,
144
144
  include3p: include3p,
145
145
  excludeSmartAnswersInSearch: excludeSmartAnswersInSearch,
146
+ includeSSRRatio: includeSSRRatio,
146
147
  interactionType: param.interactionType,
147
148
  isPageVisible: param.isPageVisible,
148
149
  interactionAbortReason: param.interactionAbortReason
@@ -161,10 +162,13 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
161
162
  }
162
163
  return _context.abrupt("return", v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {});
163
164
  case 19:
164
- return _context.abrupt("return", _objectSpread(_objectSpread({}, v1v2Result), {}, {
165
+ ssrRatio = v3Result[0].ssrRatio;
166
+ return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, includeSSRRatio && ssrRatio !== undefined ? {
167
+ 'ufo:vc:ssrRatio': ssrRatio
168
+ } : {}), v1v2Result), {}, {
165
169
  'ufo:vc:rev': [].concat(_toConsumableArray((_ref2 = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref2 !== void 0 ? _ref2 : []), _toConsumableArray(v3Result !== null && v3Result !== void 0 ? v3Result : []))
166
170
  }));
167
- case 20:
171
+ case 21:
168
172
  case "end":
169
173
  return _context.stop();
170
174
  }
@@ -231,11 +231,11 @@ var VCObserverNew = /*#__PURE__*/function () {
231
231
  key: "getVCResult",
232
232
  value: function () {
233
233
  var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
234
- var start, stop, interactionId, interactionType, interactionAbortReason, isPageVisible, include3p, excludeSmartAnswersInSearch, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
234
+ var start, stop, interactionId, interactionType, interactionAbortReason, isPageVisible, include3p, includeSSRRatio, excludeSmartAnswersInSearch, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
235
235
  return _regeneratorRuntime.wrap(function _callee$(_context) {
236
236
  while (1) switch (_context.prev = _context.next) {
237
237
  case 0:
238
- start = param.start, stop = param.stop, interactionId = param.interactionId, interactionType = param.interactionType, interactionAbortReason = param.interactionAbortReason, isPageVisible = param.isPageVisible, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
238
+ start = param.start, stop = param.stop, interactionId = param.interactionId, interactionType = param.interactionType, interactionAbortReason = param.interactionAbortReason, isPageVisible = param.isPageVisible, include3p = param.include3p, includeSSRRatio = param.includeSSRRatio, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
239
239
  results = [];
240
240
  this.addStartEntry(start);
241
241
  calculator_fy25_03 = new VCCalculator_FY25_03();
@@ -256,6 +256,7 @@ var VCObserverNew = /*#__PURE__*/function () {
256
256
  isPostInteraction: this.isPostInteraction,
257
257
  include3p: include3p,
258
258
  excludeSmartAnswersInSearch: excludeSmartAnswersInSearch,
259
+ includeSSRRatio: includeSSRRatio,
259
260
  isPageVisible: isPageVisible,
260
261
  interactionAbortReason: interactionAbortReason
261
262
  });
@@ -280,6 +281,7 @@ var VCObserverNew = /*#__PURE__*/function () {
280
281
  interactionType: interactionType,
281
282
  isPostInteraction: this.isPostInteraction,
282
283
  include3p: include3p,
284
+ includeSSRRatio: includeSSRRatio,
283
285
  isPageVisible: isPageVisible,
284
286
  interactionAbortReason: interactionAbortReason
285
287
  });
@@ -102,9 +102,9 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
102
102
  }, {
103
103
  key: "calculateWithDebugInfo",
104
104
  value: function () {
105
- var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason) {
105
+ var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio) {
106
106
  var _window, _window2, _window6, _window8;
107
- var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, _window3, _window4, _window5, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window7, _window7$__ufo_devtoo, _window9, _window9$__on_ufo_vc_;
107
+ var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, ssrRatio, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, _window3, _window4, _window5, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window7, _window7$__ufo_devtoo, _window9, _window9$__on_ufo_vc_;
108
108
  return _regeneratorRuntime.wrap(function _callee$(_context) {
109
109
  while (1) switch (_context.prev = _context.next) {
110
110
  case 0:
@@ -125,26 +125,34 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
125
125
  vcDetails = {};
126
126
  percentileIndex = 0;
127
127
  entryDataBuffer = new Set();
128
+ ssrRatio = -1;
128
129
  if (!vcLogs) {
129
- _context.next = 28;
130
+ _context.next = 30;
130
131
  break;
131
132
  }
132
133
  _iterator4 = _createForOfIteratorHelper(vcLogs);
133
- _context.prev = 10;
134
+ _context.prev = 11;
134
135
  _iterator4.s();
135
- case 12:
136
+ case 13:
136
137
  if ((_step4 = _iterator4.n()).done) {
137
- _context.next = 20;
138
+ _context.next = 22;
138
139
  break;
139
140
  }
140
141
  _entry3 = _step4.value;
141
- time = _entry3.time, viewportPercentage = _entry3.viewportPercentage, entries = _entry3.entries; // Only process entries if we haven't reached all percentiles
142
+ time = _entry3.time, viewportPercentage = _entry3.viewportPercentage, entries = _entry3.entries;
143
+ if (includeSSRRatio && ssrRatio === -1 && entries.some(function (e) {
144
+ return e.elementName === 'SSR';
145
+ }) && fg('platform_report_ssr_ratio_in_v3')) {
146
+ ssrRatio = viewportPercentage / 100;
147
+ }
148
+
149
+ // Only process entries if we haven't reached all percentiles
142
150
  if (!(percentileIndex >= percentiles.length)) {
143
- _context.next = 17;
151
+ _context.next = 19;
144
152
  break;
145
153
  }
146
- return _context.abrupt("break", 20);
147
- case 17:
154
+ return _context.abrupt("break", 22);
155
+ case 19:
148
156
  // Check if this entry matches any checkpoint percentiles
149
157
  if (viewportPercentage >= percentiles[percentileIndex]) {
150
158
  elementNames = entries.map(function (e) {
@@ -166,21 +174,21 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
166
174
  return entryDataBuffer.add(e);
167
175
  });
168
176
  }
169
- case 18:
170
- _context.next = 12;
171
- break;
172
177
  case 20:
173
- _context.next = 25;
178
+ _context.next = 13;
174
179
  break;
175
180
  case 22:
176
- _context.prev = 22;
177
- _context.t0 = _context["catch"](10);
181
+ _context.next = 27;
182
+ break;
183
+ case 24:
184
+ _context.prev = 24;
185
+ _context.t0 = _context["catch"](11);
178
186
  _iterator4.e(_context.t0);
179
- case 25:
180
- _context.prev = 25;
187
+ case 27:
188
+ _context.prev = 27;
181
189
  _iterator4.f();
182
- return _context.finish(25);
183
- case 28:
190
+ return _context.finish(27);
191
+ case 30:
184
192
  // Fill in any missing percentiles with the last known values
185
193
  previousResult = {
186
194
  t: 0,
@@ -341,14 +349,17 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
341
349
  console.error('Error in 3pDebugData', e);
342
350
  }
343
351
  }
344
- return _context.abrupt("return", vcDetails);
345
- case 41:
352
+ return _context.abrupt("return", {
353
+ vcDetails: vcDetails,
354
+ ssrRatio: ssrRatio
355
+ });
356
+ case 43:
346
357
  case "end":
347
358
  return _context.stop();
348
359
  }
349
- }, _callee, this, [[10, 22, 25, 28]]);
360
+ }, _callee, this, [[11, 24, 27, 30]]);
350
361
  }));
351
- function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11) {
362
+ function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12) {
352
363
  return _calculateWithDebugInfo.apply(this, arguments);
353
364
  }
354
365
  return calculateWithDebugInfo;
@@ -360,11 +371,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
360
371
  var _this = this,
361
372
  _vcDetails$90$t,
362
373
  _vcDetails$;
363
- var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, interactionType, isPageVisible, interactionAbortReason, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
374
+ var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, includeSSRRatio, interactionType, isPageVisible, interactionAbortReason, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, _yield$this$calculate, vcDetails, ssrRatio, result;
364
375
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
365
376
  while (1) switch (_context2.prev = _context2.next) {
366
377
  case 0:
367
- startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p, excludeSmartAnswersInSearch = _ref.excludeSmartAnswersInSearch, interactionType = _ref.interactionType, isPageVisible = _ref.isPageVisible, interactionAbortReason = _ref.interactionAbortReason;
378
+ startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p, excludeSmartAnswersInSearch = _ref.excludeSmartAnswersInSearch, includeSSRRatio = _ref.includeSSRRatio, interactionType = _ref.interactionType, isPageVisible = _ref.isPageVisible, interactionAbortReason = _ref.interactionAbortReason;
368
379
  filteredEntries = orderedEntries.filter(function (entry) {
369
380
  return _this.isEntryIncluded(entry, include3p, excludeSmartAnswersInSearch);
370
381
  });
@@ -384,9 +395,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
384
395
  });
385
396
  case 7:
386
397
  _context2.next = 9;
387
- return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason);
398
+ return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio);
388
399
  case 9:
389
- vcDetails = _context2.sent;
400
+ _yield$this$calculate = _context2.sent;
401
+ vcDetails = _yield$this$calculate.vcDetails;
402
+ ssrRatio = _yield$this$calculate.ssrRatio;
390
403
  result = {
391
404
  revision: this.revisionNo,
392
405
  clean: true,
@@ -394,6 +407,9 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
394
407
  vcDetails: vcDetails !== null && vcDetails !== void 0 ? vcDetails : undefined
395
408
  };
396
409
  result.ratios = this.calculateRatios(filteredEntries);
410
+ if (ssrRatio !== -1) {
411
+ result.ssrRatio = ssrRatio;
412
+ }
397
413
  if (isPostInteraction) {
398
414
  result.labelStacks = this.getLabelStacks(filteredEntries);
399
415
  }
@@ -401,13 +417,13 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
401
417
  result.displayContentsOccurrence = cssIssueOccurrence;
402
418
  }
403
419
  return _context2.abrupt("return", result);
404
- case 15:
420
+ case 18:
405
421
  case "end":
406
422
  return _context2.stop();
407
423
  }
408
424
  }, _callee2, this);
409
425
  }));
410
- function calculate(_x12) {
426
+ function calculate(_x13) {
411
427
  return _calculate.apply(this, arguments);
412
428
  }
413
429
  return calculate;
@@ -114,12 +114,17 @@ export type RevisionPayloadVCDetails = Record<string, {
114
114
  t: number;
115
115
  e: string[];
116
116
  }>;
117
+ export type CalculateTTVCResult = {
118
+ vcDetails: RevisionPayloadVCDetails;
119
+ ssrRatio: number;
120
+ };
117
121
  export type RevisionPayloadEntry = {
118
122
  'metric:vc90': number | null;
119
123
  revision: string;
120
124
  clean: boolean;
121
125
  vcDetails?: RevisionPayloadVCDetails;
122
126
  ratios?: VCRatioType;
127
+ ssrRatio?: number;
123
128
  labelStacks?: VCLabelStacks;
124
129
  abortReason?: VCAbortReason | null;
125
130
  abortTimestamp?: number;
@@ -25,5 +25,5 @@ export default abstract class AbstractVCCalculatorBase implements VCCalculator {
25
25
  private calculateRatios;
26
26
  private getLabelStacks;
27
27
  private calculateWithDebugInfo;
28
- calculate({ startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, interactionType, isPageVisible, interactionAbortReason, }: VCCalculatorParam): Promise<RevisionPayloadEntry | undefined>;
28
+ calculate({ startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, includeSSRRatio, interactionType, isPageVisible, interactionAbortReason, }: VCCalculatorParam): Promise<RevisionPayloadEntry | undefined>;
29
29
  }
@@ -9,6 +9,7 @@ export type VCCalculatorParam = {
9
9
  isPostInteraction: boolean;
10
10
  include3p?: boolean;
11
11
  excludeSmartAnswersInSearch?: boolean;
12
+ includeSSRRatio?: boolean;
12
13
  interactionType: InteractionType;
13
14
  isPageVisible: boolean;
14
15
  interactionAbortReason?: AbortReasonType;
@@ -31,6 +31,7 @@ export type VCObserverGetVCResultParam = {
31
31
  ssr?: number;
32
32
  include3p?: boolean;
33
33
  excludeSmartAnswersInSearch?: boolean;
34
+ includeSSRRatio?: boolean;
34
35
  interactionType: InteractionType;
35
36
  isPageVisible: boolean;
36
37
  interactionAbortReason?: AbortReasonType;
@@ -114,12 +114,17 @@ export type RevisionPayloadVCDetails = Record<string, {
114
114
  t: number;
115
115
  e: string[];
116
116
  }>;
117
+ export type CalculateTTVCResult = {
118
+ vcDetails: RevisionPayloadVCDetails;
119
+ ssrRatio: number;
120
+ };
117
121
  export type RevisionPayloadEntry = {
118
122
  'metric:vc90': number | null;
119
123
  revision: string;
120
124
  clean: boolean;
121
125
  vcDetails?: RevisionPayloadVCDetails;
122
126
  ratios?: VCRatioType;
127
+ ssrRatio?: number;
123
128
  labelStacks?: VCLabelStacks;
124
129
  abortReason?: VCAbortReason | null;
125
130
  abortTimestamp?: number;
@@ -25,5 +25,5 @@ export default abstract class AbstractVCCalculatorBase implements VCCalculator {
25
25
  private calculateRatios;
26
26
  private getLabelStacks;
27
27
  private calculateWithDebugInfo;
28
- calculate({ startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, interactionType, isPageVisible, interactionAbortReason, }: VCCalculatorParam): Promise<RevisionPayloadEntry | undefined>;
28
+ calculate({ startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, includeSSRRatio, interactionType, isPageVisible, interactionAbortReason, }: VCCalculatorParam): Promise<RevisionPayloadEntry | undefined>;
29
29
  }
@@ -9,6 +9,7 @@ export type VCCalculatorParam = {
9
9
  isPostInteraction: boolean;
10
10
  include3p?: boolean;
11
11
  excludeSmartAnswersInSearch?: boolean;
12
+ includeSSRRatio?: boolean;
12
13
  interactionType: InteractionType;
13
14
  isPageVisible: boolean;
14
15
  interactionAbortReason?: AbortReasonType;
@@ -31,6 +31,7 @@ export type VCObserverGetVCResultParam = {
31
31
  ssr?: number;
32
32
  include3p?: boolean;
33
33
  excludeSmartAnswersInSearch?: boolean;
34
+ includeSSRRatio?: boolean;
34
35
  interactionType: InteractionType;
35
36
  isPageVisible: boolean;
36
37
  interactionAbortReason?: AbortReasonType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.11.3",
3
+ "version": "4.11.4",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -171,6 +171,9 @@
171
171
  },
172
172
  "platform_ufo_always_send_post_interaction_log": {
173
173
  "type": "boolean"
174
+ },
175
+ "platform_report_ssr_ratio_in_v3": {
176
+ "type": "boolean"
174
177
  }
175
178
  }
176
179
  }