@atlaskit/react-ufo 4.11.2 → 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.
Files changed (48) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/create-interaction-extra-metrics-payload/index.js +58 -11
  3. package/dist/cjs/create-payload/utils/get-vc-metrics.js +1 -0
  4. package/dist/cjs/interaction-metrics/index.js +7 -6
  5. package/dist/cjs/interaction-metrics/interaction-extra-metrics.js +17 -10
  6. package/dist/cjs/interaction-metrics-init/index.js +2 -2
  7. package/dist/cjs/segment/segment.js +3 -19
  8. package/dist/cjs/vc/index.js +8 -4
  9. package/dist/cjs/vc/vc-observer-new/index.js +4 -2
  10. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +46 -30
  11. package/dist/es2019/create-interaction-extra-metrics-payload/index.js +40 -5
  12. package/dist/es2019/create-payload/utils/get-vc-metrics.js +2 -1
  13. package/dist/es2019/interaction-metrics/index.js +7 -5
  14. package/dist/es2019/interaction-metrics/interaction-extra-metrics.js +14 -9
  15. package/dist/es2019/interaction-metrics-init/index.js +2 -2
  16. package/dist/es2019/segment/segment.js +2 -12
  17. package/dist/es2019/vc/index.js +7 -1
  18. package/dist/es2019/vc/vc-observer-new/index.js +3 -0
  19. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +17 -3
  20. package/dist/esm/create-interaction-extra-metrics-payload/index.js +58 -11
  21. package/dist/esm/create-payload/utils/get-vc-metrics.js +2 -1
  22. package/dist/esm/interaction-metrics/index.js +7 -6
  23. package/dist/esm/interaction-metrics/interaction-extra-metrics.js +17 -10
  24. package/dist/esm/interaction-metrics-init/index.js +2 -2
  25. package/dist/esm/segment/segment.js +2 -16
  26. package/dist/esm/vc/index.js +8 -4
  27. package/dist/esm/vc/vc-observer-new/index.js +4 -2
  28. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +46 -30
  29. package/dist/types/common/vc/types.d.ts +5 -0
  30. package/dist/types/config/index.d.ts +4 -0
  31. package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +9 -1
  32. package/dist/types/interaction-metrics/interaction-extra-metrics.d.ts +6 -3
  33. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +1 -1
  34. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  35. package/dist/types/vc/vc-observer-new/types.d.ts +1 -0
  36. package/dist/types-ts4.5/common/vc/types.d.ts +5 -0
  37. package/dist/types-ts4.5/config/index.d.ts +4 -0
  38. package/dist/types-ts4.5/create-interaction-extra-metrics-payload/index.d.ts +9 -1
  39. package/dist/types-ts4.5/interaction-metrics/interaction-extra-metrics.d.ts +6 -3
  40. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +1 -1
  41. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  42. package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -0
  43. package/package.json +4 -1
  44. package/dist/cjs/segment/segment-highlight.js +0 -39
  45. package/dist/es2019/segment/segment-highlight.js +0 -27
  46. package/dist/esm/segment/segment-highlight.js +0 -30
  47. package/dist/types/segment/segment-highlight.d.ts +0 -6
  48. package/dist/types-ts4.5/segment/segment-highlight.d.ts +0 -6
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
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
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 React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
5
+ import React, { Profiler, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
6
6
  import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
7
7
  import { v4 as createUUID } from 'uuid';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -16,18 +16,9 @@ import UFORouteName from '../route-name-context';
16
16
  import generateId from '../short-id';
17
17
  import scheduleOnPaint from './schedule-on-paint';
18
18
  var tryCompleteHandle;
19
- var AsyncSegmentHighlight = /*#__PURE__*/lazy(function () {
20
- return import( /* webpackChunkName: "@atlaskit-internal_ufo-segment-highlight" */'./segment-highlight').then(function (module) {
21
- return {
22
- default: module.SegmentHighlight
23
- };
24
- });
25
- });
26
19
 
27
- // KARL TODO: finish self profiling
28
20
  /** A portion of the page we apply measurement to */
29
21
  export default function UFOSegment(_ref) {
30
- var _getConfig2;
31
22
  var segmentName = _ref.name,
32
23
  children = _ref.children,
33
24
  _ref$mode = _ref.mode,
@@ -278,16 +269,11 @@ export default function UFOSegment(_ref) {
278
269
  return l.name;
279
270
  }).join('/');
280
271
  }, [labelStack]);
281
- var enableSegmentHighlighting = (_getConfig2 = getConfig()) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.enableSegmentHighlighting;
282
272
  return /*#__PURE__*/React.createElement(UFOInteractionContext.Provider, {
283
273
  value: interactionContext
284
274
  }, /*#__PURE__*/React.createElement(Profiler, {
285
275
  id: reactProfilerId,
286
276
  onRender: onRender
287
- }, children, enableSegmentHighlighting && /*#__PURE__*/React.createElement(Suspense, {
288
- fallback: null
289
- }, /*#__PURE__*/React.createElement(AsyncSegmentHighlight, {
290
- segmentName: segmentName
291
- }))));
277
+ }, children));
292
278
  }
293
279
  UFOSegment.displayName = 'UFOSegment';
@@ -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;
@@ -132,6 +132,10 @@ export type Config = {
132
132
  readonly rates?: Rates;
133
133
  readonly kind?: Record<InteractionType, number>;
134
134
  };
135
+ /**
136
+ * @private
137
+ * @deprecated - to be removed on next major version
138
+ */
135
139
  readonly enableSegmentHighlighting?: boolean;
136
140
  readonly enableAdditionalPerformanceMarks?: boolean;
137
141
  /**
@@ -1,6 +1,7 @@
1
1
  import type { InteractionMetrics } from '../common';
2
+ import type { VCResult } from '../common/vc/types';
2
3
  import type { LabelStack } from '../interaction-context';
3
- declare function createInteractionExtraLogPayload(interactionId: string, interaction: InteractionMetrics): Promise<{
4
+ declare function createInteractionExtraLogPayload(interactionId: string, interaction: InteractionMetrics, lastInteractionFinish: InteractionMetrics | null, lastInteractionFinishVCResult?: VCResult): Promise<{
4
5
  actionSubject: string;
5
6
  action: string;
6
7
  eventType: string;
@@ -96,6 +97,13 @@ declare function createInteractionExtraLogPayload(interactionId: string, interac
96
97
  'metric:ttai:3p': number;
97
98
  };
98
99
  'vc:effective:revision': string;
100
+ lastInteractionFinish: {
101
+ start: number | undefined;
102
+ end: number | undefined;
103
+ ttai: number | undefined;
104
+ vc90: number | null;
105
+ vcClean: boolean;
106
+ };
99
107
  };
100
108
  };
101
109
  } | null>;
@@ -1,8 +1,10 @@
1
+ import { type VCResult } from '../common/vc/types';
1
2
  import type { VCObserverInterface, VCObserverOptions } from '../vc/types';
2
3
  import { type InteractionMetrics } from './index';
3
4
  export default class InteractionExtraMetrics {
4
- finishedInteractionId: string | null;
5
+ finishedInteraction: InteractionMetrics | null;
5
6
  vcObserver: VCObserverInterface | null;
7
+ lastInteractionFinishVCResult?: VCResult;
6
8
  private sinkHandlerFn;
7
9
  initializeVCObserver(options: VCObserverOptions): void;
8
10
  startVCObserver({ startTime }: {
@@ -10,8 +12,9 @@ export default class InteractionExtraMetrics {
10
12
  }, interactionId: string): void;
11
13
  stopVCObserver(): void;
12
14
  eligibleToMeasure(interactionId: string): boolean;
13
- updateFinishedInteractionId(interactionId: string): void;
14
- sinkHandler(fn: (interactionId: string, interaction: InteractionMetrics) => void | Promise<void>): void;
15
+ updateFinishedInteraction(interaction: InteractionMetrics): void;
16
+ setLastInteractionFinishVCResult(result: VCResult): void;
17
+ sinkHandler(fn: (interactionId: string, interaction: InteractionMetrics, lastInteractionFinish: InteractionMetrics | null, lastInteractionFinishVCResult?: VCResult) => void | Promise<void>): void;
15
18
  onInteractionComplete(id: string, data: InteractionMetrics): void;
16
19
  reset(): void;
17
20
  stopAll(id: string): void;
@@ -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;
@@ -132,6 +132,10 @@ export type Config = {
132
132
  readonly rates?: Rates;
133
133
  readonly kind?: Record<InteractionType, number>;
134
134
  };
135
+ /**
136
+ * @private
137
+ * @deprecated - to be removed on next major version
138
+ */
135
139
  readonly enableSegmentHighlighting?: boolean;
136
140
  readonly enableAdditionalPerformanceMarks?: boolean;
137
141
  /**
@@ -1,6 +1,7 @@
1
1
  import type { InteractionMetrics } from '../common';
2
+ import type { VCResult } from '../common/vc/types';
2
3
  import type { LabelStack } from '../interaction-context';
3
- declare function createInteractionExtraLogPayload(interactionId: string, interaction: InteractionMetrics): Promise<{
4
+ declare function createInteractionExtraLogPayload(interactionId: string, interaction: InteractionMetrics, lastInteractionFinish: InteractionMetrics | null, lastInteractionFinishVCResult?: VCResult): Promise<{
4
5
  actionSubject: string;
5
6
  action: string;
6
7
  eventType: string;
@@ -96,6 +97,13 @@ declare function createInteractionExtraLogPayload(interactionId: string, interac
96
97
  'metric:ttai:3p': number;
97
98
  };
98
99
  'vc:effective:revision': string;
100
+ lastInteractionFinish: {
101
+ start: number | undefined;
102
+ end: number | undefined;
103
+ ttai: number | undefined;
104
+ vc90: number | null;
105
+ vcClean: boolean;
106
+ };
99
107
  };
100
108
  };
101
109
  } | null>;
@@ -1,8 +1,10 @@
1
+ import { type VCResult } from '../common/vc/types';
1
2
  import type { VCObserverInterface, VCObserverOptions } from '../vc/types';
2
3
  import { type InteractionMetrics } from './index';
3
4
  export default class InteractionExtraMetrics {
4
- finishedInteractionId: string | null;
5
+ finishedInteraction: InteractionMetrics | null;
5
6
  vcObserver: VCObserverInterface | null;
7
+ lastInteractionFinishVCResult?: VCResult;
6
8
  private sinkHandlerFn;
7
9
  initializeVCObserver(options: VCObserverOptions): void;
8
10
  startVCObserver({ startTime }: {
@@ -10,8 +12,9 @@ export default class InteractionExtraMetrics {
10
12
  }, interactionId: string): void;
11
13
  stopVCObserver(): void;
12
14
  eligibleToMeasure(interactionId: string): boolean;
13
- updateFinishedInteractionId(interactionId: string): void;
14
- sinkHandler(fn: (interactionId: string, interaction: InteractionMetrics) => void | Promise<void>): void;
15
+ updateFinishedInteraction(interaction: InteractionMetrics): void;
16
+ setLastInteractionFinishVCResult(result: VCResult): void;
17
+ sinkHandler(fn: (interactionId: string, interaction: InteractionMetrics, lastInteractionFinish: InteractionMetrics | null, lastInteractionFinishVCResult?: VCResult) => void | Promise<void>): void;
15
18
  onInteractionComplete(id: string, data: InteractionMetrics): void;
16
19
  reset(): void;
17
20
  stopAll(id: string): void;
@@ -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.2",
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
  }
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.SegmentHighlight = SegmentHighlight;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
12
- function SegmentHighlight(_ref) {
13
- var segmentName = _ref.segmentName;
14
- var _useState = (0, _react.useState)(false),
15
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
16
- segmentHighlight = _useState2[0],
17
- setSegmentHighlight = _useState2[1];
18
- (0, _react.useEffect)(function () {
19
- try {
20
- var shouldHighlightSegments = sessionStorage.getItem('segmentsHighlight') === 'true';
21
- setSegmentHighlight(shouldHighlightSegments);
22
- } catch (err) {
23
- /* do nothing */
24
- }
25
- }, []);
26
- if (segmentHighlight) {
27
- return (
28
- /*#__PURE__*/
29
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
30
- _react.default.createElement("span", {
31
- "data-segment-name": segmentName,
32
- style: {
33
- display: 'none'
34
- }
35
- })
36
- );
37
- }
38
- return null;
39
- }
@@ -1,27 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- export function SegmentHighlight({
3
- segmentName
4
- }) {
5
- const [segmentHighlight, setSegmentHighlight] = useState(false);
6
- useEffect(() => {
7
- try {
8
- const shouldHighlightSegments = sessionStorage.getItem('segmentsHighlight') === 'true';
9
- setSegmentHighlight(shouldHighlightSegments);
10
- } catch (err) {
11
- /* do nothing */
12
- }
13
- }, []);
14
- if (segmentHighlight) {
15
- return (
16
- /*#__PURE__*/
17
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
18
- React.createElement("span", {
19
- "data-segment-name": segmentName,
20
- style: {
21
- display: 'none'
22
- }
23
- })
24
- );
25
- }
26
- return null;
27
- }
@@ -1,30 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useEffect, useState } from 'react';
3
- export function SegmentHighlight(_ref) {
4
- var segmentName = _ref.segmentName;
5
- var _useState = useState(false),
6
- _useState2 = _slicedToArray(_useState, 2),
7
- segmentHighlight = _useState2[0],
8
- setSegmentHighlight = _useState2[1];
9
- useEffect(function () {
10
- try {
11
- var shouldHighlightSegments = sessionStorage.getItem('segmentsHighlight') === 'true';
12
- setSegmentHighlight(shouldHighlightSegments);
13
- } catch (err) {
14
- /* do nothing */
15
- }
16
- }, []);
17
- if (segmentHighlight) {
18
- return (
19
- /*#__PURE__*/
20
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
21
- React.createElement("span", {
22
- "data-segment-name": segmentName,
23
- style: {
24
- display: 'none'
25
- }
26
- })
27
- );
28
- }
29
- return null;
30
- }
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- type Props = {
3
- segmentName: string;
4
- };
5
- export declare function SegmentHighlight({ segmentName }: Props): React.JSX.Element | null;
6
- export {};
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- type Props = {
3
- segmentName: string;
4
- };
5
- export declare function SegmentHighlight({ segmentName }: Props): React.JSX.Element | null;
6
- export {};