@atlaskit/react-ufo 3.8.0 → 3.9.1

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,21 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#147978](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147978)
8
+ [`af8b516786ee8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/af8b516786ee8) -
9
+ FF cleanup ufo-calc-speed-index
10
+
11
+ ## 3.9.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#147017](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147017)
16
+ [`cd0798d2a9a3d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cd0798d2a9a3d) -
17
+ Enable VC revisions by UFO config
18
+
3
19
  ## 3.8.0
4
20
 
5
21
  ### Minor Changes
@@ -22,7 +22,7 @@ function getVCMetrics(_x) {
22
22
  }
23
23
  function _getVCMetrics() {
24
24
  _getVCMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interaction) {
25
- var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
25
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI, _config$vc2;
26
26
  var config, interactionStatus, pageVisibilityUpToTTAI, isSSREnabled, ssr, tti, prefix, result, _result$ufoVcRev, ttvcV2Revision, VC;
27
27
  return _regenerator.default.wrap(function _callee$(_context) {
28
28
  while (1) switch (_context.prev = _context.next) {
@@ -70,7 +70,7 @@ function _getVCMetrics() {
70
70
  (0, _vc.getVCObserver)().stop();
71
71
  }
72
72
  _interactionMetrics.postInteractionLog.setLastInteractionFinishVCResult(result);
73
- if (!(0, _platformFeatureFlags.fg)('platform_ufo_disable_ttvc_v1')) {
73
+ if (config !== null && config !== void 0 && (_config$vc2 = config.vc) !== null && _config$vc2 !== void 0 && (_config$vc2 = _config$vc2.enabledVCRevisions) !== null && _config$vc2 !== void 0 && _config$vc2.includes('fy25.01')) {
74
74
  _context.next = 26;
75
75
  break;
76
76
  }
@@ -26,7 +26,7 @@ var VCObserverWrapper = /*#__PURE__*/function () {
26
26
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27
27
  (0, _classCallCheck2.default)(this, VCObserverWrapper);
28
28
  this.newVCObserver = null;
29
- var isNewVCObserverEnabled = (0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new') || ((_getConfig = (0, _config.getConfig)()) === null || _getConfig === void 0 || (_getConfig = _getConfig.vc) === null || _getConfig === void 0 ? void 0 : _getConfig.enableVCObserverNew);
29
+ var isNewVCObserverEnabled = (0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new') || ((_getConfig = (0, _config.getConfig)()) === null || _getConfig === void 0 || (_getConfig = _getConfig.vc) === null || _getConfig === void 0 || (_getConfig = _getConfig.enabledVCRevisions) === null || _getConfig === void 0 ? void 0 : _getConfig.includes('fy25.03'));
30
30
  if (isNewVCObserverEnabled) {
31
31
  this.newVCObserver = new _vcObserverNew.default({
32
32
  selectorConfig: opts.selectorConfig
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getVCRevisionsData = getVCRevisionsData;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
+ var _config = require("../../config");
10
11
  var _hiddenTiming = require("../../hidden-timing");
11
12
  var _revisions = require("./revisions/revisions");
12
13
  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; } } }; }
@@ -45,6 +46,7 @@ function createVCDetails(calculatedVC, shouldHaveVCmetric) {
45
46
 
46
47
  // Optimized implementation (current one)
47
48
  function getVCRevisionsData(_ref) {
49
+ var _ufoConfig$vc, _ufoConfig$vc2;
48
50
  var fullPrefix = _ref.fullPrefix,
49
51
  interaction = _ref.interaction,
50
52
  isVCClean = _ref.isVCClean,
@@ -53,7 +55,8 @@ function getVCRevisionsData(_ref) {
53
55
  ssr = _ref.ssr,
54
56
  calculatedVC = _ref.calculatedVC,
55
57
  calculatedVCNext = _ref.calculatedVCNext;
56
- if (!(0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new')) {
58
+ var ufoConfig = (0, _config.getConfig)();
59
+ if (!(0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new') && !(ufoConfig !== null && ufoConfig !== void 0 && (_ufoConfig$vc = ufoConfig.vc) !== null && _ufoConfig$vc !== void 0 && (_ufoConfig$vc = _ufoConfig$vc.enabledVCRevisions) !== null && _ufoConfig$vc !== void 0 && _ufoConfig$vc.includes('fy25.03'))) {
57
60
  if (!multiHeatmap) {
58
61
  return null;
59
62
  }
@@ -89,7 +92,7 @@ function getVCRevisionsData(_ref) {
89
92
  'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
90
93
  vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
91
94
  };
92
- if ((0, _platformFeatureFlags.fg)('platform_ufo_disable_ttvc_v1')) {
95
+ if (!(ufoConfig !== null && ufoConfig !== void 0 && (_ufoConfig$vc2 = ufoConfig.vc) !== null && _ufoConfig$vc2 !== void 0 && (_ufoConfig$vc2 = _ufoConfig$vc2.enabledVCRevisions) !== null && _ufoConfig$vc2 !== void 0 && _ufoConfig$vc2.includes('fy25.01'))) {
93
96
  return (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:rev"), [ttvcV2Revision]);
94
97
  }
95
98
 
@@ -14,6 +14,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
14
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
16
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
+ var _config = require("../../config");
17
18
  var _attachAbortListeners = require("./attachAbortListeners");
18
19
  var _getVCRevisionsData = require("./getVCRevisionsData");
19
20
  var _getViewport = require("./getViewport");
@@ -44,7 +45,8 @@ function filterComponentsLog(log) {
44
45
  }
45
46
  var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
46
47
  function VCObserver(options) {
47
- var _this = this;
48
+ var _this = this,
49
+ _getConfig5;
48
50
  (0, _classCallCheck2.default)(this, VCObserver);
49
51
  /* abort logic */
50
52
  (0, _defineProperty2.default)(this, "abortReason", {
@@ -104,7 +106,8 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
104
106
  });
105
107
  (0, _defineProperty2.default)(this, "getVCResult", /*#__PURE__*/function () {
106
108
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref3) {
107
- var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, isTTVCv1Disabled, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, isVCClean, revisionsData, isCalcSpeedIndexEnabled, speedIndex;
109
+ var _getConfig, _getConfig2;
110
+ var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, isTTVCv1Disabled, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, isVCClean, revisionsData, speedIndex, isTTVCv3Enabled;
108
111
  return _regenerator.default.wrap(function _callee$(_context) {
109
112
  while (1) switch (_context.prev = _context.next) {
110
113
  case 0:
@@ -131,7 +134,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
131
134
  } catch (e) {}
132
135
  return _context.abrupt("return", (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReasonInfo), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp));
133
136
  case 10:
134
- isTTVCv1Disabled = (0, _platformFeatureFlags.fg)('platform_ufo_disable_ttvc_v1');
137
+ isTTVCv1Disabled = !((_getConfig = (0, _config.getConfig)()) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.vc) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.enabledVCRevisions) !== null && _getConfig !== void 0 && _getConfig.includes('fy25.01'));
135
138
  ttvcV1Result = isTTVCv1Disabled ? {
136
139
  VC: {},
137
140
  VCBox: {},
@@ -280,18 +283,18 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
280
283
  VCBox: vcNext.VCBox
281
284
  },
282
285
  isEventAborted: isEventAborted
283
- }); // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
284
- isCalcSpeedIndexEnabled = (0, _platformFeatureFlags.fg)('ufo-calc-speed-index');
286
+ });
285
287
  speedIndex = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "ufo:speedIndex", isTTVCv1Disabled ? vcNext.VCEntries.speedIndex : VCEntries.speedIndex), "ufo:next:speedIndex", vcNext.VCEntries.speedIndex);
286
288
  if (!isTTVCv1Disabled) {
287
- _context.next = 26;
289
+ _context.next = 25;
288
290
  break;
289
291
  }
290
- return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
291
- case 26:
292
+ return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), speedIndex));
293
+ case 25:
294
+ isTTVCv3Enabled = (0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new') || ((_getConfig2 = (0, _config.getConfig)()) === null || _getConfig2 === void 0 || (_getConfig2 = _getConfig2.vc) === null || _getConfig2 === void 0 || (_getConfig2 = _getConfig2.enabledVCRevisions) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.includes('fy25.03'));
292
295
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
293
296
  'metrics:vc': VC
294
- }, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), (0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new') ? undefined : VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), (0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new') ? undefined : vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
297
+ }, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), isTTVCv3Enabled ? undefined : VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), isTTVCv3Enabled ? undefined : vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), speedIndex));
295
298
  case 27:
296
299
  case "end":
297
300
  return _context.stop();
@@ -303,9 +306,10 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
303
306
  };
304
307
  }());
305
308
  (0, _defineProperty2.default)(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) {
309
+ var _getConfig3;
306
310
  _this.measureStart();
307
311
  _this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue);
308
- if (!(0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new')) {
312
+ if (!(0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new') && !((_getConfig3 = (0, _config.getConfig)()) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.vc) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.enabledVCRevisions) !== null && _getConfig3 !== void 0 && _getConfig3.includes('fy25.03'))) {
309
313
  _this.onViewportChangeDetected({
310
314
  timestamp: rawTime,
311
315
  intersectionRect: intersectionRect,
@@ -322,13 +326,14 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
322
326
  });
323
327
  (0, _defineProperty2.default)(this, "legacyHandleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) {
324
328
  if (_this.abortReason.reason === null || _this.abortReason.blocking === false) {
329
+ var _getConfig4;
325
330
  var time = Math.round(rawTime - _this.startTime);
326
331
  var mappedValues = _this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
327
332
  _this.vcRatios[targetName] = _this.getElementRatio(mappedValues);
328
333
  if (!ignoreReason) {
329
334
  _this.applyChangesToHeatMap(mappedValues, time, _this.heatmapNext);
330
335
  }
331
- var isTTVCv1Disabled = (0, _platformFeatureFlags.fg)('platform_ufo_disable_ttvc_v1');
336
+ var isTTVCv1Disabled = !((_getConfig4 = (0, _config.getConfig)()) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.vc) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.enabledVCRevisions) !== null && _getConfig4 !== void 0 && _getConfig4.includes('fy25.01'));
332
337
  if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
333
338
  _this.applyChangesToHeatMap(mappedValues, time, _this.heatmap);
334
339
  }
@@ -466,7 +471,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
466
471
  dataVC: true
467
472
  }
468
473
  });
469
- this.heatmap = (0, _platformFeatureFlags.fg)('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
474
+ this.heatmap = !((_getConfig5 = (0, _config.getConfig)()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.vc) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.enabledVCRevisions) !== null && _getConfig5 !== void 0 && _getConfig5.includes('fy25.01')) ? [] : this.getCleanHeatmap();
470
475
  this.heatmapNext = this.getCleanHeatmap();
471
476
  this.multiHeatmap = new _heatmap.MultiRevisionHeatmap({
472
477
  viewport: this.viewport,
@@ -546,6 +551,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
546
551
  }, {
547
552
  key: "resetState",
548
553
  value: function resetState() {
554
+ var _getConfig6;
549
555
  this.abortReason = {
550
556
  reason: null,
551
557
  info: '',
@@ -553,7 +559,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
553
559
  blocking: false
554
560
  };
555
561
  this.detachAbortListeners();
556
- this.heatmap = (0, _platformFeatureFlags.fg)('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
562
+ this.heatmap = !((_getConfig6 = (0, _config.getConfig)()) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.vc) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.enabledVCRevisions) !== null && _getConfig6 !== void 0 && _getConfig6.includes('fy25.01')) ? [] : this.getCleanHeatmap();
557
563
  this.heatmapNext = this.getCleanHeatmap();
558
564
  this.multiHeatmap = new _heatmap.MultiRevisionHeatmap({
559
565
  viewport: this.viewport,
@@ -673,9 +679,6 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
673
679
  });
674
680
  var VC = VCObserver.makeVCReturnObj();
675
681
  var VCBox = VCObserver.makeVCReturnObj();
676
-
677
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
678
- var isCalcSpeedIndexEnabled = (0, _platformFeatureFlags.fg)('ufo-calc-speed-index');
679
682
  entries.reduce(function () {
680
683
  var acc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
681
684
  var v = arguments.length > 1 ? arguments[1] : undefined;
@@ -712,10 +715,8 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
712
715
  return v.targetName;
713
716
  })));
714
717
  var ratioDelta = (currentlyPaintedRatio - ((_acc$rel$vc = (_acc$rel = acc.rel[i - 1]) === null || _acc$rel === void 0 ? void 0 : _acc$rel.vc) !== null && _acc$rel$vc !== void 0 ? _acc$rel$vc : 0)) / 100;
715
- if (isCalcSpeedIndexEnabled) {
716
- var speedIndex = timestamp * ratioDelta;
717
- acc.speedIndex += speedIndex;
718
- }
718
+ var speedIndex = timestamp * ratioDelta;
719
+ acc.speedIndex += speedIndex;
719
720
  acc.abs.push([timestamp, currentlyPainted]);
720
721
  acc.rel.push({
721
722
  time: timestamp,
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getRevisions = getRevisions;
7
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
7
+ var _config = require("../../../config");
8
8
  var _fy25_ = require("./fy25_01");
9
9
  var _fy25_2 = require("./fy25_02");
10
10
  function getRevisions() {
11
- if ((0, _platformFeatureFlags.fg)('platform_ufo_disable_ttvc_v1')) {
11
+ var _getConfig;
12
+ if (!((_getConfig = (0, _config.getConfig)()) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.vc) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.enabledVCRevisions) !== null && _getConfig !== void 0 && _getConfig.includes('fy25.01'))) {
12
13
  return [{
13
14
  name: 'fy25.02',
14
15
  classifier: _fy25_2.revFY25_02Classifier
@@ -6,7 +6,7 @@ import getInteractionStatus from './get-interaction-status';
6
6
  import getPageVisibilityUpToTTAI from './get-page-visibility-up-to-ttai';
7
7
  import getSSRDoneTimeValue from './get-ssr-done-time-value';
8
8
  async function getVCMetrics(interaction) {
9
- var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _interaction$apdex$, _config$experimentalI;
9
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _interaction$apdex$, _config$experimentalI, _config$vc2, _config$vc2$enabledVC;
10
10
  const config = getConfig();
11
11
  if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
12
12
  return {};
@@ -39,7 +39,7 @@ async function getVCMetrics(interaction) {
39
39
  getVCObserver().stop();
40
40
  }
41
41
  postInteractionLog.setLastInteractionFinishVCResult(result);
42
- if (fg('platform_ufo_disable_ttvc_v1')) {
42
+ if (!(config !== null && config !== void 0 && (_config$vc2 = config.vc) !== null && _config$vc2 !== void 0 && (_config$vc2$enabledVC = _config$vc2.enabledVCRevisions) !== null && _config$vc2$enabledVC !== void 0 && _config$vc2$enabledVC.includes('fy25.01'))) {
43
43
  var _result$ufoVcRev;
44
44
  const ttvcV2Revision = result === null || result === void 0 ? void 0 : (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(({
45
45
  revision
@@ -6,9 +6,9 @@ import { VCObserver } from './vc-observer';
6
6
  import VCObserverNew from './vc-observer-new';
7
7
  class VCObserverWrapper {
8
8
  constructor(opts = {}) {
9
- var _getConfig, _getConfig$vc;
9
+ var _getConfig, _getConfig$vc, _getConfig$vc$enabled;
10
10
  this.newVCObserver = null;
11
- const isNewVCObserverEnabled = fg('platform_ufo_vc_observer_new') || ((_getConfig = getConfig()) === null || _getConfig === void 0 ? void 0 : (_getConfig$vc = _getConfig.vc) === null || _getConfig$vc === void 0 ? void 0 : _getConfig$vc.enableVCObserverNew);
11
+ const isNewVCObserverEnabled = fg('platform_ufo_vc_observer_new') || ((_getConfig = getConfig()) === null || _getConfig === void 0 ? void 0 : (_getConfig$vc = _getConfig.vc) === null || _getConfig$vc === void 0 ? void 0 : (_getConfig$vc$enabled = _getConfig$vc.enabledVCRevisions) === null || _getConfig$vc$enabled === void 0 ? void 0 : _getConfig$vc$enabled.includes('fy25.03'));
12
12
  if (isNewVCObserverEnabled) {
13
13
  this.newVCObserver = new VCObserverNew({
14
14
  selectorConfig: opts.selectorConfig
@@ -1,4 +1,5 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { getConfig } from '../../config';
2
3
  import { getPageVisibilityState } from '../../hidden-timing';
3
4
  import { getRevisions } from './revisions/revisions';
4
5
  const VCParts = ['25', '50', '75', '80', '85', '90', '95', '98', '99'];
@@ -37,7 +38,9 @@ export function getVCRevisionsData({
37
38
  calculatedVC,
38
39
  calculatedVCNext
39
40
  }) {
40
- if (!fg('platform_ufo_vc_observer_new')) {
41
+ var _ufoConfig$vc, _ufoConfig$vc$enabled, _ufoConfig$vc2, _ufoConfig$vc2$enable;
42
+ const ufoConfig = getConfig();
43
+ if (!fg('platform_ufo_vc_observer_new') && !(ufoConfig !== null && ufoConfig !== void 0 && (_ufoConfig$vc = ufoConfig.vc) !== null && _ufoConfig$vc !== void 0 && (_ufoConfig$vc$enabled = _ufoConfig$vc.enabledVCRevisions) !== null && _ufoConfig$vc$enabled !== void 0 && _ufoConfig$vc$enabled.includes('fy25.03'))) {
41
44
  if (!multiHeatmap) {
42
45
  return null;
43
46
  }
@@ -71,7 +74,7 @@ export function getVCRevisionsData({
71
74
  'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
72
75
  vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
73
76
  };
74
- if (fg('platform_ufo_disable_ttvc_v1')) {
77
+ if (!(ufoConfig !== null && ufoConfig !== void 0 && (_ufoConfig$vc2 = ufoConfig.vc) !== null && _ufoConfig$vc2 !== void 0 && (_ufoConfig$vc2$enable = _ufoConfig$vc2.enabledVCRevisions) !== null && _ufoConfig$vc2$enable !== void 0 && _ufoConfig$vc2$enable.includes('fy25.01'))) {
75
78
  return {
76
79
  [`${fullPrefix}vc:rev`]: [ttvcV2Revision]
77
80
  };
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { getConfig } from '../../config';
3
4
  import { attachAbortListeners } from './attachAbortListeners';
4
5
  import { getVCRevisionsData } from './getVCRevisionsData';
5
6
  import { getViewportHeight, getViewportWidth } from './getViewport';
@@ -24,6 +25,7 @@ function filterComponentsLog(log) {
24
25
  }
25
26
  export class VCObserver {
26
27
  constructor(options) {
28
+ var _getConfig5, _getConfig5$vc, _getConfig5$vc$enable;
27
29
  /* abort logic */
28
30
  _defineProperty(this, "abortReason", {
29
31
  reason: null,
@@ -95,6 +97,7 @@ export class VCObserver {
95
97
  vc,
96
98
  isEventAborted
97
99
  }) => {
100
+ var _getConfig, _getConfig$vc, _getConfig$vc$enabled, _getConfig2, _getConfig2$vc, _getConfig2$vc$enable;
98
101
  const startTime = performance.now();
99
102
  // add local measurement
100
103
  const fullPrefix = prefix !== undefined && prefix !== '' ? `${prefix}:` : '';
@@ -128,7 +131,7 @@ export class VCObserver {
128
131
  [`${fullPrefix}vc:abort:timestamp`]: abortReason.timestamp
129
132
  };
130
133
  }
131
- const isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
134
+ const isTTVCv1Disabled = !((_getConfig = getConfig()) !== null && _getConfig !== void 0 && (_getConfig$vc = _getConfig.vc) !== null && _getConfig$vc !== void 0 && (_getConfig$vc$enabled = _getConfig$vc.enabledVCRevisions) !== null && _getConfig$vc$enabled !== void 0 && _getConfig$vc$enabled.includes('fy25.01'));
132
135
  const ttvcV1Result = isTTVCv1Disabled ? {
133
136
  VC: {},
134
137
  VCBox: {},
@@ -288,8 +291,6 @@ export class VCObserver {
288
291
  },
289
292
  isEventAborted
290
293
  });
291
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
292
- const isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
293
294
  const speedIndex = {
294
295
  [`ufo:speedIndex`]: isTTVCv1Disabled ? vcNext.VCEntries.speedIndex : VCEntries.speedIndex,
295
296
  [`ufo:next:speedIndex`]: vcNext.VCEntries.speedIndex
@@ -302,15 +303,16 @@ export class VCObserver {
302
303
  ...outOfBoundary,
303
304
  [`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog),
304
305
  ...revisionsData,
305
- ...(isCalcSpeedIndexEnabled ? speedIndex : {})
306
+ ...speedIndex
306
307
  };
307
308
  }
309
+ const isTTVCv3Enabled = fg('platform_ufo_vc_observer_new') || ((_getConfig2 = getConfig()) === null || _getConfig2 === void 0 ? void 0 : (_getConfig2$vc = _getConfig2.vc) === null || _getConfig2$vc === void 0 ? void 0 : (_getConfig2$vc$enable = _getConfig2$vc.enabledVCRevisions) === null || _getConfig2$vc$enable === void 0 ? void 0 : _getConfig2$vc$enable.includes('fy25.03'));
308
310
  return {
309
311
  'metrics:vc': VC,
310
312
  [`${fullPrefix}vc:state`]: true,
311
313
  [`${fullPrefix}vc:clean`]: isVCClean,
312
314
  [`${fullPrefix}vc:dom`]: VCBox,
313
- [`${fullPrefix}vc:updates`]: fg('platform_ufo_vc_observer_new') ? undefined : VCEntries.rel.slice(0, 50),
315
+ [`${fullPrefix}vc:updates`]: isTTVCv3Enabled ? undefined : VCEntries.rel.slice(0, 50),
314
316
  // max 50
315
317
  [`${fullPrefix}vc:size`]: viewport,
316
318
  [`${fullPrefix}vc:time`]: Math.round(totalTime + (stopTime - startTime)),
@@ -318,18 +320,19 @@ export class VCObserver {
318
320
  [`${fullPrefix}vc:ratios`]: ratios,
319
321
  ...outOfBoundary,
320
322
  [`${fullPrefix}vc:next`]: vcNext.VC,
321
- [`${fullPrefix}vc:next:updates`]: fg('platform_ufo_vc_observer_new') ? undefined : vcNext.VCEntries.rel.slice(0, 50),
323
+ [`${fullPrefix}vc:next:updates`]: isTTVCv3Enabled ? undefined : vcNext.VCEntries.rel.slice(0, 50),
322
324
  // max 50
323
325
  [`${fullPrefix}vc:next:dom`]: vcNext.VCBox,
324
326
  [`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog),
325
327
  ...revisionsData,
326
- ...(isCalcSpeedIndexEnabled ? speedIndex : {})
328
+ ...speedIndex
327
329
  };
328
330
  });
329
331
  _defineProperty(this, "handleUpdate", (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) => {
332
+ var _getConfig3, _getConfig3$vc, _getConfig3$vc$enable;
330
333
  this.measureStart();
331
334
  this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue);
332
- if (!fg('platform_ufo_vc_observer_new')) {
335
+ if (!fg('platform_ufo_vc_observer_new') && !((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3$vc = _getConfig3.vc) !== null && _getConfig3$vc !== void 0 && (_getConfig3$vc$enable = _getConfig3$vc.enabledVCRevisions) !== null && _getConfig3$vc$enable !== void 0 && _getConfig3$vc$enable.includes('fy25.03'))) {
333
336
  this.onViewportChangeDetected({
334
337
  timestamp: rawTime,
335
338
  intersectionRect,
@@ -346,13 +349,14 @@ export class VCObserver {
346
349
  });
347
350
  _defineProperty(this, "legacyHandleUpdate", (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) => {
348
351
  if (this.abortReason.reason === null || this.abortReason.blocking === false) {
352
+ var _getConfig4, _getConfig4$vc, _getConfig4$vc$enable;
349
353
  const time = Math.round(rawTime - this.startTime);
350
354
  const mappedValues = this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
351
355
  this.vcRatios[targetName] = this.getElementRatio(mappedValues);
352
356
  if (!ignoreReason) {
353
357
  this.applyChangesToHeatMap(mappedValues, time, this.heatmapNext);
354
358
  }
355
- const isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
359
+ const isTTVCv1Disabled = !((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4$vc = _getConfig4.vc) !== null && _getConfig4$vc !== void 0 && (_getConfig4$vc$enable = _getConfig4$vc.enabledVCRevisions) !== null && _getConfig4$vc$enable !== void 0 && _getConfig4$vc$enable.includes('fy25.01'));
356
360
  if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
357
361
  this.applyChangesToHeatMap(mappedValues, time, this.heatmap);
358
362
  }
@@ -491,7 +495,7 @@ export class VCObserver {
491
495
  dataVC: true
492
496
  }
493
497
  });
494
- this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
498
+ this.heatmap = !((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5$vc = _getConfig5.vc) !== null && _getConfig5$vc !== void 0 && (_getConfig5$vc$enable = _getConfig5$vc.enabledVCRevisions) !== null && _getConfig5$vc$enable !== void 0 && _getConfig5$vc$enable.includes('fy25.01')) ? [] : this.getCleanHeatmap();
495
499
  this.heatmapNext = this.getCleanHeatmap();
496
500
  this.multiHeatmap = new MultiRevisionHeatmap({
497
501
  viewport: this.viewport,
@@ -574,9 +578,6 @@ export class VCObserver {
574
578
  const entries = Object.entries(lastUpdate).map(a => [parseInt(a[0], 10), a[1]]).sort((a, b) => a[0] > b[0] ? 1 : -1);
575
579
  const VC = VCObserver.makeVCReturnObj();
576
580
  const VCBox = VCObserver.makeVCReturnObj();
577
-
578
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
579
- const isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
580
581
  entries.reduce((acc = 0, v) => {
581
582
  const currRatio = v[1] / totalPainted;
582
583
  let VCRatio = currRatio + acc;
@@ -600,10 +601,8 @@ export class VCObserver {
600
601
  const currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
601
602
  const logEntry = [...new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.filter(v => !v.ignoreReason).map(v => v.targetName))];
602
603
  const ratioDelta = (currentlyPaintedRatio - ((_acc$rel$vc = (_acc$rel = acc.rel[i - 1]) === null || _acc$rel === void 0 ? void 0 : _acc$rel.vc) !== null && _acc$rel$vc !== void 0 ? _acc$rel$vc : 0)) / 100;
603
- if (isCalcSpeedIndexEnabled) {
604
- const speedIndex = timestamp * ratioDelta;
605
- acc.speedIndex += speedIndex;
606
- }
604
+ const speedIndex = timestamp * ratioDelta;
605
+ acc.speedIndex += speedIndex;
607
606
  acc.abs.push([timestamp, currentlyPainted]);
608
607
  acc.rel.push({
609
608
  time: timestamp,
@@ -645,6 +644,7 @@ export class VCObserver {
645
644
  }
646
645
  }
647
646
  resetState() {
647
+ var _getConfig6, _getConfig6$vc, _getConfig6$vc$enable;
648
648
  this.abortReason = {
649
649
  reason: null,
650
650
  info: '',
@@ -652,7 +652,7 @@ export class VCObserver {
652
652
  blocking: false
653
653
  };
654
654
  this.detachAbortListeners();
655
- this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
655
+ this.heatmap = !((_getConfig6 = getConfig()) !== null && _getConfig6 !== void 0 && (_getConfig6$vc = _getConfig6.vc) !== null && _getConfig6$vc !== void 0 && (_getConfig6$vc$enable = _getConfig6$vc.enabledVCRevisions) !== null && _getConfig6$vc$enable !== void 0 && _getConfig6$vc$enable.includes('fy25.01')) ? [] : this.getCleanHeatmap();
656
656
  this.heatmapNext = this.getCleanHeatmap();
657
657
  this.multiHeatmap = new MultiRevisionHeatmap({
658
658
  viewport: this.viewport,
@@ -1,8 +1,9 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
1
+ import { getConfig } from '../../../config';
2
2
  import { revFY25_01Classifier } from './fy25_01';
3
3
  import { revFY25_02Classifier } from './fy25_02';
4
4
  export function getRevisions() {
5
- if (fg('platform_ufo_disable_ttvc_v1')) {
5
+ var _getConfig, _getConfig$vc, _getConfig$vc$enabled;
6
+ if (!((_getConfig = getConfig()) !== null && _getConfig !== void 0 && (_getConfig$vc = _getConfig.vc) !== null && _getConfig$vc !== void 0 && (_getConfig$vc$enabled = _getConfig$vc.enabledVCRevisions) !== null && _getConfig$vc$enabled !== void 0 && _getConfig$vc$enabled.includes('fy25.01'))) {
6
7
  return [{
7
8
  name: 'fy25.02',
8
9
  classifier: revFY25_02Classifier
@@ -15,7 +15,7 @@ function getVCMetrics(_x) {
15
15
  }
16
16
  function _getVCMetrics() {
17
17
  _getVCMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
18
- var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
18
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI, _config$vc2;
19
19
  var config, interactionStatus, pageVisibilityUpToTTAI, isSSREnabled, ssr, tti, prefix, result, _result$ufoVcRev, ttvcV2Revision, VC;
20
20
  return _regeneratorRuntime.wrap(function _callee$(_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
@@ -63,7 +63,7 @@ function _getVCMetrics() {
63
63
  getVCObserver().stop();
64
64
  }
65
65
  postInteractionLog.setLastInteractionFinishVCResult(result);
66
- if (!fg('platform_ufo_disable_ttvc_v1')) {
66
+ if (config !== null && config !== void 0 && (_config$vc2 = config.vc) !== null && _config$vc2 !== void 0 && (_config$vc2 = _config$vc2.enabledVCRevisions) !== null && _config$vc2 !== void 0 && _config$vc2.includes('fy25.01')) {
67
67
  _context.next = 26;
68
68
  break;
69
69
  }
@@ -18,7 +18,7 @@ var VCObserverWrapper = /*#__PURE__*/function () {
18
18
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19
19
  _classCallCheck(this, VCObserverWrapper);
20
20
  this.newVCObserver = null;
21
- var isNewVCObserverEnabled = fg('platform_ufo_vc_observer_new') || ((_getConfig = getConfig()) === null || _getConfig === void 0 || (_getConfig = _getConfig.vc) === null || _getConfig === void 0 ? void 0 : _getConfig.enableVCObserverNew);
21
+ var isNewVCObserverEnabled = fg('platform_ufo_vc_observer_new') || ((_getConfig = getConfig()) === null || _getConfig === void 0 || (_getConfig = _getConfig.vc) === null || _getConfig === void 0 || (_getConfig = _getConfig.enabledVCRevisions) === null || _getConfig === void 0 ? void 0 : _getConfig.includes('fy25.03'));
22
22
  if (isNewVCObserverEnabled) {
23
23
  this.newVCObserver = new VCObserverNew({
24
24
  selectorConfig: opts.selectorConfig
@@ -3,6 +3,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
3
3
  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; } }
4
4
  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; }
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { getConfig } from '../../config';
6
7
  import { getPageVisibilityState } from '../../hidden-timing';
7
8
  import { getRevisions } from './revisions/revisions';
8
9
  var VCParts = ['25', '50', '75', '80', '85', '90', '95', '98', '99'];
@@ -38,6 +39,7 @@ function createVCDetails(calculatedVC, shouldHaveVCmetric) {
38
39
 
39
40
  // Optimized implementation (current one)
40
41
  export function getVCRevisionsData(_ref) {
42
+ var _ufoConfig$vc, _ufoConfig$vc2;
41
43
  var fullPrefix = _ref.fullPrefix,
42
44
  interaction = _ref.interaction,
43
45
  isVCClean = _ref.isVCClean,
@@ -46,7 +48,8 @@ export function getVCRevisionsData(_ref) {
46
48
  ssr = _ref.ssr,
47
49
  calculatedVC = _ref.calculatedVC,
48
50
  calculatedVCNext = _ref.calculatedVCNext;
49
- if (!fg('platform_ufo_vc_observer_new')) {
51
+ var ufoConfig = getConfig();
52
+ if (!fg('platform_ufo_vc_observer_new') && !(ufoConfig !== null && ufoConfig !== void 0 && (_ufoConfig$vc = ufoConfig.vc) !== null && _ufoConfig$vc !== void 0 && (_ufoConfig$vc = _ufoConfig$vc.enabledVCRevisions) !== null && _ufoConfig$vc !== void 0 && _ufoConfig$vc.includes('fy25.03'))) {
50
53
  if (!multiHeatmap) {
51
54
  return null;
52
55
  }
@@ -82,7 +85,7 @@ export function getVCRevisionsData(_ref) {
82
85
  'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
83
86
  vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
84
87
  };
85
- if (fg('platform_ufo_disable_ttvc_v1')) {
88
+ if (!(ufoConfig !== null && ufoConfig !== void 0 && (_ufoConfig$vc2 = ufoConfig.vc) !== null && _ufoConfig$vc2 !== void 0 && (_ufoConfig$vc2 = _ufoConfig$vc2.enabledVCRevisions) !== null && _ufoConfig$vc2 !== void 0 && _ufoConfig$vc2.includes('fy25.01'))) {
86
89
  return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [ttvcV2Revision]);
87
90
  }
88
91
 
@@ -10,6 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
+ import { getConfig } from '../../config';
13
14
  import { attachAbortListeners } from './attachAbortListeners';
14
15
  import { getVCRevisionsData } from './getVCRevisionsData';
15
16
  import { getViewportHeight, getViewportWidth } from './getViewport';
@@ -37,7 +38,8 @@ function filterComponentsLog(log) {
37
38
  }
38
39
  export var VCObserver = /*#__PURE__*/function () {
39
40
  function VCObserver(options) {
40
- var _this = this;
41
+ var _this = this,
42
+ _getConfig5;
41
43
  _classCallCheck(this, VCObserver);
42
44
  /* abort logic */
43
45
  _defineProperty(this, "abortReason", {
@@ -97,7 +99,8 @@ export var VCObserver = /*#__PURE__*/function () {
97
99
  });
98
100
  _defineProperty(this, "getVCResult", /*#__PURE__*/function () {
99
101
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
100
- var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, isTTVCv1Disabled, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, isVCClean, revisionsData, isCalcSpeedIndexEnabled, speedIndex;
102
+ var _getConfig, _getConfig2;
103
+ var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, isTTVCv1Disabled, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, isVCClean, revisionsData, speedIndex, isTTVCv3Enabled;
101
104
  return _regeneratorRuntime.wrap(function _callee$(_context) {
102
105
  while (1) switch (_context.prev = _context.next) {
103
106
  case 0:
@@ -124,7 +127,7 @@ export var VCObserver = /*#__PURE__*/function () {
124
127
  } catch (e) {}
125
128
  return _context.abrupt("return", _defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReasonInfo), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp));
126
129
  case 10:
127
- isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
130
+ isTTVCv1Disabled = !((_getConfig = getConfig()) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.vc) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.enabledVCRevisions) !== null && _getConfig !== void 0 && _getConfig.includes('fy25.01'));
128
131
  ttvcV1Result = isTTVCv1Disabled ? {
129
132
  VC: {},
130
133
  VCBox: {},
@@ -273,18 +276,18 @@ export var VCObserver = /*#__PURE__*/function () {
273
276
  VCBox: vcNext.VCBox
274
277
  },
275
278
  isEventAborted: isEventAborted
276
- }); // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
277
- isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
279
+ });
278
280
  speedIndex = _defineProperty(_defineProperty({}, "ufo:speedIndex", isTTVCv1Disabled ? vcNext.VCEntries.speedIndex : VCEntries.speedIndex), "ufo:next:speedIndex", vcNext.VCEntries.speedIndex);
279
281
  if (!isTTVCv1Disabled) {
280
- _context.next = 26;
282
+ _context.next = 25;
281
283
  break;
282
284
  }
283
- return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
284
- case 26:
285
+ return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), speedIndex));
286
+ case 25:
287
+ isTTVCv3Enabled = fg('platform_ufo_vc_observer_new') || ((_getConfig2 = getConfig()) === null || _getConfig2 === void 0 || (_getConfig2 = _getConfig2.vc) === null || _getConfig2 === void 0 || (_getConfig2 = _getConfig2.enabledVCRevisions) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.includes('fy25.03'));
285
288
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
286
289
  'metrics:vc': VC
287
- }, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), fg('platform_ufo_vc_observer_new') ? undefined : VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), fg('platform_ufo_vc_observer_new') ? undefined : vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
290
+ }, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), isTTVCv3Enabled ? undefined : VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), isTTVCv3Enabled ? undefined : vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), speedIndex));
288
291
  case 27:
289
292
  case "end":
290
293
  return _context.stop();
@@ -296,9 +299,10 @@ export var VCObserver = /*#__PURE__*/function () {
296
299
  };
297
300
  }());
298
301
  _defineProperty(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) {
302
+ var _getConfig3;
299
303
  _this.measureStart();
300
304
  _this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue);
301
- if (!fg('platform_ufo_vc_observer_new')) {
305
+ if (!fg('platform_ufo_vc_observer_new') && !((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.vc) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.enabledVCRevisions) !== null && _getConfig3 !== void 0 && _getConfig3.includes('fy25.03'))) {
302
306
  _this.onViewportChangeDetected({
303
307
  timestamp: rawTime,
304
308
  intersectionRect: intersectionRect,
@@ -315,13 +319,14 @@ export var VCObserver = /*#__PURE__*/function () {
315
319
  });
316
320
  _defineProperty(this, "legacyHandleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) {
317
321
  if (_this.abortReason.reason === null || _this.abortReason.blocking === false) {
322
+ var _getConfig4;
318
323
  var time = Math.round(rawTime - _this.startTime);
319
324
  var mappedValues = _this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
320
325
  _this.vcRatios[targetName] = _this.getElementRatio(mappedValues);
321
326
  if (!ignoreReason) {
322
327
  _this.applyChangesToHeatMap(mappedValues, time, _this.heatmapNext);
323
328
  }
324
- var isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
329
+ var isTTVCv1Disabled = !((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.vc) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.enabledVCRevisions) !== null && _getConfig4 !== void 0 && _getConfig4.includes('fy25.01'));
325
330
  if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
326
331
  _this.applyChangesToHeatMap(mappedValues, time, _this.heatmap);
327
332
  }
@@ -459,7 +464,7 @@ export var VCObserver = /*#__PURE__*/function () {
459
464
  dataVC: true
460
465
  }
461
466
  });
462
- this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
467
+ this.heatmap = !((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.vc) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.enabledVCRevisions) !== null && _getConfig5 !== void 0 && _getConfig5.includes('fy25.01')) ? [] : this.getCleanHeatmap();
463
468
  this.heatmapNext = this.getCleanHeatmap();
464
469
  this.multiHeatmap = new MultiRevisionHeatmap({
465
470
  viewport: this.viewport,
@@ -539,6 +544,7 @@ export var VCObserver = /*#__PURE__*/function () {
539
544
  }, {
540
545
  key: "resetState",
541
546
  value: function resetState() {
547
+ var _getConfig6;
542
548
  this.abortReason = {
543
549
  reason: null,
544
550
  info: '',
@@ -546,7 +552,7 @@ export var VCObserver = /*#__PURE__*/function () {
546
552
  blocking: false
547
553
  };
548
554
  this.detachAbortListeners();
549
- this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
555
+ this.heatmap = !((_getConfig6 = getConfig()) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.vc) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.enabledVCRevisions) !== null && _getConfig6 !== void 0 && _getConfig6.includes('fy25.01')) ? [] : this.getCleanHeatmap();
550
556
  this.heatmapNext = this.getCleanHeatmap();
551
557
  this.multiHeatmap = new MultiRevisionHeatmap({
552
558
  viewport: this.viewport,
@@ -666,9 +672,6 @@ export var VCObserver = /*#__PURE__*/function () {
666
672
  });
667
673
  var VC = VCObserver.makeVCReturnObj();
668
674
  var VCBox = VCObserver.makeVCReturnObj();
669
-
670
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
671
- var isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
672
675
  entries.reduce(function () {
673
676
  var acc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
674
677
  var v = arguments.length > 1 ? arguments[1] : undefined;
@@ -705,10 +708,8 @@ export var VCObserver = /*#__PURE__*/function () {
705
708
  return v.targetName;
706
709
  })));
707
710
  var ratioDelta = (currentlyPaintedRatio - ((_acc$rel$vc = (_acc$rel = acc.rel[i - 1]) === null || _acc$rel === void 0 ? void 0 : _acc$rel.vc) !== null && _acc$rel$vc !== void 0 ? _acc$rel$vc : 0)) / 100;
708
- if (isCalcSpeedIndexEnabled) {
709
- var speedIndex = timestamp * ratioDelta;
710
- acc.speedIndex += speedIndex;
711
- }
711
+ var speedIndex = timestamp * ratioDelta;
712
+ acc.speedIndex += speedIndex;
712
713
  acc.abs.push([timestamp, currentlyPainted]);
713
714
  acc.rel.push({
714
715
  time: timestamp,
@@ -1,8 +1,9 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
1
+ import { getConfig } from '../../../config';
2
2
  import { revFY25_01Classifier } from './fy25_01';
3
3
  import { revFY25_02Classifier } from './fy25_02';
4
4
  export function getRevisions() {
5
- if (fg('platform_ufo_disable_ttvc_v1')) {
5
+ var _getConfig;
6
+ if (!((_getConfig = getConfig()) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.vc) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.enabledVCRevisions) !== null && _getConfig !== void 0 && _getConfig.includes('fy25.01'))) {
6
7
  return [{
7
8
  name: 'fy25.02',
8
9
  classifier: revFY25_02Classifier
@@ -27,6 +27,7 @@ type SelectorConfig = {
27
27
  type Rates = {
28
28
  readonly [key: string]: number;
29
29
  };
30
+ type TTVCRevisions = 'fy25.01' | 'fy25.02' | 'fy25.03';
30
31
  export type Config = {
31
32
  readonly enabled?: boolean;
32
33
  readonly doNotAbortActivePressInteraction?: string[];
@@ -73,7 +74,7 @@ export type Config = {
73
74
  readonly ssr?: boolean;
74
75
  readonly ssrWhitelist?: string[];
75
76
  readonly stopVCAtInteractionFinish?: boolean;
76
- readonly enableVCObserverNew?: boolean;
77
+ readonly enabledVCRevisions?: readonly TTVCRevisions[];
77
78
  };
78
79
  readonly postInteractionLog?: {
79
80
  readonly enabled?: boolean;
@@ -27,6 +27,7 @@ type SelectorConfig = {
27
27
  type Rates = {
28
28
  readonly [key: string]: number;
29
29
  };
30
+ type TTVCRevisions = 'fy25.01' | 'fy25.02' | 'fy25.03';
30
31
  export type Config = {
31
32
  readonly enabled?: boolean;
32
33
  readonly doNotAbortActivePressInteraction?: string[];
@@ -73,7 +74,7 @@ export type Config = {
73
74
  readonly ssr?: boolean;
74
75
  readonly ssrWhitelist?: string[];
75
76
  readonly stopVCAtInteractionFinish?: boolean;
76
- readonly enableVCObserverNew?: boolean;
77
+ readonly enabledVCRevisions?: readonly TTVCRevisions[];
77
78
  };
78
79
  readonly postInteractionLog?: {
79
80
  readonly enabled?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.8.0",
3
+ "version": "3.9.1",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -133,9 +133,6 @@
133
133
  "ufo_capture_stylesheet_metrics": {
134
134
  "type": "boolean"
135
135
  },
136
- "ufo-calc-speed-index": {
137
- "type": "boolean"
138
- },
139
136
  "ufo_return_relative_request_start": {
140
137
  "type": "boolean"
141
138
  },
@@ -157,9 +154,6 @@
157
154
  "ufo_payload_use_idle_callback": {
158
155
  "type": "boolean"
159
156
  },
160
- "platform_ufo_disable_ttvc_v1": {
161
- "type": "boolean"
162
- },
163
157
  "platform_ufo_assets_check_for_nan": {
164
158
  "type": "boolean"
165
159
  },