@atlaskit/react-ufo 4.11.3 → 4.11.5

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 (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/interaction-metrics/index.js +0 -2
  3. package/dist/cjs/vc/index.js +8 -4
  4. package/dist/cjs/vc/vc-observer-new/index.js +4 -2
  5. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +46 -34
  6. package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +12 -33
  7. package/dist/es2019/interaction-metrics/index.js +0 -2
  8. package/dist/es2019/vc/index.js +7 -1
  9. package/dist/es2019/vc/vc-observer-new/index.js +3 -0
  10. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +17 -7
  11. package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +6 -20
  12. package/dist/esm/interaction-metrics/index.js +0 -2
  13. package/dist/esm/vc/index.js +8 -4
  14. package/dist/esm/vc/vc-observer-new/index.js +4 -2
  15. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +46 -34
  16. package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +12 -33
  17. package/dist/types/common/vc/types.d.ts +5 -1
  18. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +1 -1
  19. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  20. package/dist/types/vc/vc-observer-new/types.d.ts +1 -0
  21. package/dist/types-ts4.5/common/vc/types.d.ts +5 -1
  22. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +1 -1
  23. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  24. package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -0
  25. package/package.json +4 -7
  26. package/dist/cjs/vc/vc-observer-new/viewport-observer/utils/check-display-content.js +0 -32
  27. package/dist/cjs/vc/vc-observer-new/viewport-observer/utils/track-display-content-occurrence.js +0 -19
  28. package/dist/es2019/vc/vc-observer-new/viewport-observer/utils/check-display-content.js +0 -14
  29. package/dist/es2019/vc/vc-observer-new/viewport-observer/utils/track-display-content-occurrence.js +0 -10
  30. package/dist/esm/vc/vc-observer-new/viewport-observer/utils/check-display-content.js +0 -26
  31. package/dist/esm/vc/vc-observer-new/viewport-observer/utils/track-display-content-occurrence.js +0 -10
  32. package/dist/types/vc/vc-observer-new/viewport-observer/utils/check-display-content.d.ts +0 -1
  33. package/dist/types/vc/vc-observer-new/viewport-observer/utils/track-display-content-occurrence.d.ts +0 -3
  34. package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/utils/check-display-content.d.ts +0 -1
  35. package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/utils/track-display-content-occurrence.d.ts +0 -3
@@ -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
  });
@@ -11,7 +11,6 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
11
11
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
12
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
13
  import { fg } from '@atlaskit/platform-feature-flags';
14
- import { cssIssueOccurrence } from '../viewport-observer/utils/track-display-content-occurrence';
15
14
  import { calculateTTVCPercentilesWithDebugInfo } from './percentile-calc';
16
15
  import getViewportHeight from './utils/get-viewport-height';
17
16
  import getViewportWidth from './utils/get-viewport-width';
@@ -102,9 +101,9 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
102
101
  }, {
103
102
  key: "calculateWithDebugInfo",
104
103
  value: function () {
105
- var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason) {
104
+ var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio) {
106
105
  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_;
106
+ 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
107
  return _regeneratorRuntime.wrap(function _callee$(_context) {
109
108
  while (1) switch (_context.prev = _context.next) {
110
109
  case 0:
@@ -125,26 +124,34 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
125
124
  vcDetails = {};
126
125
  percentileIndex = 0;
127
126
  entryDataBuffer = new Set();
127
+ ssrRatio = -1;
128
128
  if (!vcLogs) {
129
- _context.next = 28;
129
+ _context.next = 30;
130
130
  break;
131
131
  }
132
132
  _iterator4 = _createForOfIteratorHelper(vcLogs);
133
- _context.prev = 10;
133
+ _context.prev = 11;
134
134
  _iterator4.s();
135
- case 12:
135
+ case 13:
136
136
  if ((_step4 = _iterator4.n()).done) {
137
- _context.next = 20;
137
+ _context.next = 22;
138
138
  break;
139
139
  }
140
140
  _entry3 = _step4.value;
141
- time = _entry3.time, viewportPercentage = _entry3.viewportPercentage, entries = _entry3.entries; // Only process entries if we haven't reached all percentiles
141
+ time = _entry3.time, viewportPercentage = _entry3.viewportPercentage, entries = _entry3.entries;
142
+ if (includeSSRRatio && ssrRatio === -1 && entries.some(function (e) {
143
+ return e.elementName === 'SSR';
144
+ }) && fg('platform_report_ssr_ratio_in_v3')) {
145
+ ssrRatio = viewportPercentage / 100;
146
+ }
147
+
148
+ // Only process entries if we haven't reached all percentiles
142
149
  if (!(percentileIndex >= percentiles.length)) {
143
- _context.next = 17;
150
+ _context.next = 19;
144
151
  break;
145
152
  }
146
- return _context.abrupt("break", 20);
147
- case 17:
153
+ return _context.abrupt("break", 22);
154
+ case 19:
148
155
  // Check if this entry matches any checkpoint percentiles
149
156
  if (viewportPercentage >= percentiles[percentileIndex]) {
150
157
  elementNames = entries.map(function (e) {
@@ -166,21 +173,21 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
166
173
  return entryDataBuffer.add(e);
167
174
  });
168
175
  }
169
- case 18:
170
- _context.next = 12;
171
- break;
172
176
  case 20:
173
- _context.next = 25;
177
+ _context.next = 13;
174
178
  break;
175
179
  case 22:
176
- _context.prev = 22;
177
- _context.t0 = _context["catch"](10);
180
+ _context.next = 27;
181
+ break;
182
+ case 24:
183
+ _context.prev = 24;
184
+ _context.t0 = _context["catch"](11);
178
185
  _iterator4.e(_context.t0);
179
- case 25:
180
- _context.prev = 25;
186
+ case 27:
187
+ _context.prev = 27;
181
188
  _iterator4.f();
182
- return _context.finish(25);
183
- case 28:
189
+ return _context.finish(27);
190
+ case 30:
184
191
  // Fill in any missing percentiles with the last known values
185
192
  previousResult = {
186
193
  t: 0,
@@ -341,14 +348,17 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
341
348
  console.error('Error in 3pDebugData', e);
342
349
  }
343
350
  }
344
- return _context.abrupt("return", vcDetails);
345
- case 41:
351
+ return _context.abrupt("return", {
352
+ vcDetails: vcDetails,
353
+ ssrRatio: ssrRatio
354
+ });
355
+ case 43:
346
356
  case "end":
347
357
  return _context.stop();
348
358
  }
349
- }, _callee, this, [[10, 22, 25, 28]]);
359
+ }, _callee, this, [[11, 24, 27, 30]]);
350
360
  }));
351
- function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11) {
361
+ function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12) {
352
362
  return _calculateWithDebugInfo.apply(this, arguments);
353
363
  }
354
364
  return calculateWithDebugInfo;
@@ -360,11 +370,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
360
370
  var _this = this,
361
371
  _vcDetails$90$t,
362
372
  _vcDetails$;
363
- var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, interactionType, isPageVisible, interactionAbortReason, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
373
+ var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, includeSSRRatio, interactionType, isPageVisible, interactionAbortReason, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, _yield$this$calculate, vcDetails, ssrRatio, result;
364
374
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
365
375
  while (1) switch (_context2.prev = _context2.next) {
366
376
  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;
377
+ 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
378
  filteredEntries = orderedEntries.filter(function (entry) {
369
379
  return _this.isEntryIncluded(entry, include3p, excludeSmartAnswersInSearch);
370
380
  });
@@ -384,9 +394,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
384
394
  });
385
395
  case 7:
386
396
  _context2.next = 9;
387
- return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason);
397
+ return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio);
388
398
  case 9:
389
- vcDetails = _context2.sent;
399
+ _yield$this$calculate = _context2.sent;
400
+ vcDetails = _yield$this$calculate.vcDetails;
401
+ ssrRatio = _yield$this$calculate.ssrRatio;
390
402
  result = {
391
403
  revision: this.revisionNo,
392
404
  clean: true,
@@ -394,20 +406,20 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
394
406
  vcDetails: vcDetails !== null && vcDetails !== void 0 ? vcDetails : undefined
395
407
  };
396
408
  result.ratios = this.calculateRatios(filteredEntries);
409
+ if (ssrRatio !== -1) {
410
+ result.ssrRatio = ssrRatio;
411
+ }
397
412
  if (isPostInteraction) {
398
413
  result.labelStacks = this.getLabelStacks(filteredEntries);
399
414
  }
400
- if (fg('platform_ufo_display_content_track_occurrence')) {
401
- result.displayContentsOccurrence = cssIssueOccurrence;
402
- }
403
415
  return _context2.abrupt("return", result);
404
- case 15:
416
+ case 17:
405
417
  case "end":
406
418
  return _context2.stop();
407
419
  }
408
420
  }, _callee2, this);
409
421
  }));
410
- function calculate(_x12) {
422
+ function calculate(_x13) {
411
423
  return _calculate.apply(this, arguments);
412
424
  }
413
425
  return calculate;
@@ -14,14 +14,12 @@ import { RLLPlaceholderHandlers } from '../../vc-observer/observers/rll-placehol
14
14
  import { createIntersectionObserver } from './intersection-observer';
15
15
  import createMutationObserver from './mutation-observer';
16
16
  import createPerformanceObserver from './performance-observer';
17
- import checkCssProperty from './utils/check-display-content';
18
17
  import checkWithinComponent, { cleanupCaches } from './utils/check-within-component';
19
18
  import { getMutatedElements } from './utils/get-mutated-elements';
20
19
  import { isElementVisible } from './utils/is-element-visible';
21
20
  import isInVCIgnoreIfNoLayoutShiftMarker from './utils/is-in-vc-ignore-if-no-layout-shift-marker';
22
21
  import { isSameRectDimensions } from './utils/is-same-rect-dimensions';
23
22
  import { isSameRectSize } from './utils/is-same-rect-size';
24
- import trackDisplayContentsOccurrence from './utils/track-display-content-occurrence';
25
23
  var createElementMutationsWatcher = function createElementMutationsWatcher(removedNodeRects) {
26
24
  return function (_ref) {
27
25
  var target = _ref.target,
@@ -92,7 +90,7 @@ var ViewportObserver = /*#__PURE__*/function () {
92
90
  _iterator = _createForOfIteratorHelper(addedNodes);
93
91
  _context2.prev = 4;
94
92
  _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
95
- var addedNodeRef, addedNode, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _checkWithinComponent, isWithinThirdPartySegment, _this$intersectionObs7, _iterator2, _step2, _step2$value, isDisplayContentsElementChildren, element, _this$intersectionObs8, _this$intersectionObs9, validTargets, _iterator3, _step3, _this$intersectionObs0, validTarget, _this$intersectionObs1;
93
+ var addedNodeRef, addedNode, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _checkWithinComponent, isWithinThirdPartySegment, _this$intersectionObs7, _iterator2, _step2, _step2$value, isDisplayContentsElementChildren, element, _this$intersectionObs8, _this$intersectionObs9, _this$intersectionObs0;
96
94
  return _regeneratorRuntime.wrap(function _loop$(_context) {
97
95
  while (1) switch (_context.prev = _context.next) {
98
96
  case 0:
@@ -221,26 +219,7 @@ var ViewportObserver = /*#__PURE__*/function () {
221
219
  _iterator2.f();
222
220
  }
223
221
  } else {
224
- if (fg('platform_ufo_display_content_resolution_ttvc_v3')) {
225
- // Check if the target has display:content css property, return array of valid targets
226
- validTargets = checkCssProperty(addedNode);
227
- _iterator3 = _createForOfIteratorHelper(validTargets);
228
- try {
229
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
230
- validTarget = _step3.value;
231
- (_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(validTarget, createElementMutationsWatcher(removedNodeRects));
232
- }
233
- } catch (err) {
234
- _iterator3.e(err);
235
- } finally {
236
- _iterator3.f();
237
- }
238
- } else {
239
- if (fg('platform_ufo_display_content_track_occurrence')) {
240
- trackDisplayContentsOccurrence(addedNode);
241
- }
242
- (_this$intersectionObs1 = _this.intersectionObserver) === null || _this$intersectionObs1 === void 0 || _this$intersectionObs1.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
243
- }
222
+ (_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
244
223
  }
245
224
  case 46:
246
225
  case "end":
@@ -287,12 +266,12 @@ var ViewportObserver = /*#__PURE__*/function () {
287
266
  };
288
267
  }());
289
268
  _defineProperty(this, "handleAttributeMutation", function (_ref6) {
290
- var _this$intersectionObs10;
269
+ var _this$intersectionObs1;
291
270
  var target = _ref6.target,
292
271
  attributeName = _ref6.attributeName,
293
272
  oldValue = _ref6.oldValue,
294
273
  newValue = _ref6.newValue;
295
- (_this$intersectionObs10 = _this.intersectionObserver) === null || _this$intersectionObs10 === void 0 || _this$intersectionObs10.watchAndTag(target, function (_ref7) {
274
+ (_this$intersectionObs1 = _this.intersectionObserver) === null || _this$intersectionObs1 === void 0 || _this$intersectionObs1.watchAndTag(target, function (_ref7) {
296
275
  var target = _ref7.target,
297
276
  rect = _ref7.rect;
298
277
  if (isContainedWithinMediaWrapper(target)) {
@@ -369,11 +348,11 @@ var ViewportObserver = /*#__PURE__*/function () {
369
348
  _defineProperty(this, "handleLayoutShift", function (_ref8) {
370
349
  var time = _ref8.time,
371
350
  changedRects = _ref8.changedRects;
372
- var _iterator4 = _createForOfIteratorHelper(changedRects),
373
- _step4;
351
+ var _iterator3 = _createForOfIteratorHelper(changedRects),
352
+ _step3;
374
353
  try {
375
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
376
- var changedRect = _step4.value;
354
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
355
+ var changedRect = _step3.value;
377
356
  var target = changedRect.node;
378
357
  if (target) {
379
358
  if (fg('platform_ufo_vc_next_filter_ls_entries_same_rect')) {
@@ -399,9 +378,9 @@ var ViewportObserver = /*#__PURE__*/function () {
399
378
  }
400
379
  }
401
380
  } catch (err) {
402
- _iterator4.e(err);
381
+ _iterator3.e(err);
403
382
  } finally {
404
- _iterator4.f();
383
+ _iterator3.f();
405
384
  }
406
385
  });
407
386
  this.mapVisibleNodeRects = new WeakMap();
@@ -458,12 +437,12 @@ var ViewportObserver = /*#__PURE__*/function () {
458
437
  }, {
459
438
  key: "stop",
460
439
  value: function stop() {
461
- var _this$mutationObserve2, _this$intersectionObs11, _this$performanceObse2;
440
+ var _this$mutationObserve2, _this$intersectionObs10, _this$performanceObse2;
462
441
  if (!this.isStarted) {
463
442
  return;
464
443
  }
465
444
  (_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
466
- (_this$intersectionObs11 = this.intersectionObserver) === null || _this$intersectionObs11 === void 0 || _this$intersectionObs11.disconnect();
445
+ (_this$intersectionObs10 = this.intersectionObserver) === null || _this$intersectionObs10 === void 0 || _this$intersectionObs10.disconnect();
467
446
  (_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
468
447
  this.isStarted = false;
469
448
  // Clean up caches when stopping
@@ -114,16 +114,20 @@ 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;
126
- displayContentsOccurrence?: number;
127
131
  };
128
132
  export type RevisionPayload = RevisionPayloadEntry[];
129
133
  export {};
@@ -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,16 +114,20 @@ 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;
126
- displayContentsOccurrence?: number;
127
131
  };
128
132
  export type RevisionPayload = RevisionPayloadEntry[];
129
133
  export {};
@@ -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.5",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -136,9 +136,6 @@
136
136
  "platform_ufo_add_segments_count_threshold": {
137
137
  "type": "boolean"
138
138
  },
139
- "platform_ufo_display_content_resolution_ttvc_v3": {
140
- "type": "boolean"
141
- },
142
139
  "platform_ufo_segment_unmount_count": {
143
140
  "type": "boolean"
144
141
  },
@@ -151,9 +148,6 @@
151
148
  "platform_ufo_enable_late_holds_post_interaction": {
152
149
  "type": "boolean"
153
150
  },
154
- "platform_ufo_display_content_track_occurrence": {
155
- "type": "boolean"
156
- },
157
151
  "platform_ufo_enable_late_mutation_label_stacks": {
158
152
  "type": "boolean"
159
153
  },
@@ -171,6 +165,9 @@
171
165
  },
172
166
  "platform_ufo_always_send_post_interaction_log": {
173
167
  "type": "boolean"
168
+ },
169
+ "platform_report_ssr_ratio_in_v3": {
170
+ "type": "boolean"
174
171
  }
175
172
  }
176
173
  }
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = checkCssProperty;
7
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
8
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
- function checkCssProperty(element) {
11
- var computedStyle = window.getComputedStyle(element);
12
- if (computedStyle.display === 'contents') {
13
- // If display is 'contents', we return the direct children of the element
14
- var result = [];
15
- var _iterator = _createForOfIteratorHelper(element.children),
16
- _step;
17
- try {
18
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
19
- var child = _step.value;
20
- if (child instanceof HTMLElement) {
21
- result.push(child);
22
- }
23
- }
24
- } catch (err) {
25
- _iterator.e(err);
26
- } finally {
27
- _iterator.f();
28
- }
29
- return result;
30
- }
31
- return [element];
32
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.cssIssueOccurrence = void 0;
7
- exports.default = trackDisplayContentsOccurrence;
8
- exports.resetCssIssueOccurrence = resetCssIssueOccurrence;
9
- var _cssIssueOccurrence;
10
- var cssIssueOccurrence = exports.cssIssueOccurrence = 0;
11
- function trackDisplayContentsOccurrence(element) {
12
- var computedStyle = window.getComputedStyle(element);
13
- if (computedStyle.display === 'contents') {
14
- _cssIssueOccurrence = cssIssueOccurrence++, exports.cssIssueOccurrence = cssIssueOccurrence, _cssIssueOccurrence;
15
- }
16
- }
17
- function resetCssIssueOccurrence() {
18
- exports.cssIssueOccurrence = cssIssueOccurrence = 0;
19
- }
@@ -1,14 +0,0 @@
1
- export default function checkCssProperty(element) {
2
- const computedStyle = window.getComputedStyle(element);
3
- if (computedStyle.display === 'contents') {
4
- // If display is 'contents', we return the direct children of the element
5
- const result = [];
6
- for (const child of element.children) {
7
- if (child instanceof HTMLElement) {
8
- result.push(child);
9
- }
10
- }
11
- return result;
12
- }
13
- return [element];
14
- }
@@ -1,10 +0,0 @@
1
- export let cssIssueOccurrence = 0;
2
- export default function trackDisplayContentsOccurrence(element) {
3
- const computedStyle = window.getComputedStyle(element);
4
- if (computedStyle.display === 'contents') {
5
- cssIssueOccurrence++;
6
- }
7
- }
8
- export function resetCssIssueOccurrence() {
9
- cssIssueOccurrence = 0;
10
- }
@@ -1,26 +0,0 @@
1
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
3
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
- export default function checkCssProperty(element) {
5
- var computedStyle = window.getComputedStyle(element);
6
- if (computedStyle.display === 'contents') {
7
- // If display is 'contents', we return the direct children of the element
8
- var result = [];
9
- var _iterator = _createForOfIteratorHelper(element.children),
10
- _step;
11
- try {
12
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
13
- var child = _step.value;
14
- if (child instanceof HTMLElement) {
15
- result.push(child);
16
- }
17
- }
18
- } catch (err) {
19
- _iterator.e(err);
20
- } finally {
21
- _iterator.f();
22
- }
23
- return result;
24
- }
25
- return [element];
26
- }
@@ -1,10 +0,0 @@
1
- export var cssIssueOccurrence = 0;
2
- export default function trackDisplayContentsOccurrence(element) {
3
- var computedStyle = window.getComputedStyle(element);
4
- if (computedStyle.display === 'contents') {
5
- cssIssueOccurrence++;
6
- }
7
- }
8
- export function resetCssIssueOccurrence() {
9
- cssIssueOccurrence = 0;
10
- }
@@ -1 +0,0 @@
1
- export default function checkCssProperty(element: HTMLElement): Element[];
@@ -1,3 +0,0 @@
1
- export declare let cssIssueOccurrence: number;
2
- export default function trackDisplayContentsOccurrence(element: HTMLElement): void;
3
- export declare function resetCssIssueOccurrence(): void;
@@ -1 +0,0 @@
1
- export default function checkCssProperty(element: HTMLElement): Element[];
@@ -1,3 +0,0 @@
1
- export declare let cssIssueOccurrence: number;
2
- export default function trackDisplayContentsOccurrence(element: HTMLElement): void;
3
- export declare function resetCssIssueOccurrence(): void;