@atlaskit/react-ufo 3.9.5 → 3.10.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +26 -5
  3. package/dist/cjs/config/index.js +22 -1
  4. package/dist/cjs/create-payload/utils/get-vc-metrics.js +2 -2
  5. package/dist/cjs/vc/index.js +1 -4
  6. package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +2 -5
  7. package/dist/cjs/vc/vc-observer/index.js +47 -22
  8. package/dist/cjs/vc/vc-observer/revisions/revisions.js +1 -2
  9. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +29 -9
  10. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +24 -0
  11. package/dist/es2019/config/index.js +19 -0
  12. package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -3
  13. package/dist/es2019/vc/index.js +2 -5
  14. package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +3 -6
  15. package/dist/es2019/vc/vc-observer/index.js +43 -15
  16. package/dist/es2019/vc/vc-observer/revisions/revisions.js +2 -3
  17. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +24 -8
  18. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +22 -0
  19. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +2 -2
  20. package/dist/esm/config/index.js +20 -1
  21. package/dist/esm/create-payload/utils/get-vc-metrics.js +3 -3
  22. package/dist/esm/vc/index.js +2 -5
  23. package/dist/esm/vc/vc-observer/getVCRevisionsData.js +3 -6
  24. package/dist/esm/vc/vc-observer/index.js +48 -23
  25. package/dist/esm/vc/vc-observer/revisions/revisions.js +2 -3
  26. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +29 -9
  27. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +24 -0
  28. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +2 -2
  29. package/dist/types/common/vc/types.d.ts +2 -1
  30. package/dist/types/config/index.d.ts +2 -0
  31. package/dist/types/vc/vc-observer-new/index.d.ts +1 -1
  32. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +6 -1
  33. package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +7 -0
  34. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +1 -1
  35. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +1 -1
  36. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +1 -1
  37. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -13
  38. package/dist/types-ts4.5/common/vc/types.d.ts +2 -1
  39. package/dist/types-ts4.5/config/index.d.ts +2 -0
  40. package/dist/types-ts4.5/vc/vc-observer-new/index.d.ts +1 -1
  41. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +6 -1
  42. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +7 -0
  43. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +1 -1
  44. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +1 -1
  45. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +1 -1
  46. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -13
  47. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#150909](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150909)
8
+ [`3fca421422bb6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3fca421422bb6) -
9
+ FF cleanup - platform_ufo_vc_observer_new
10
+ - [#150909](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150909)
11
+ [`568e2ae966df9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/568e2ae966df9) -
12
+ FF cleanup - platform_ufo_vc_observer_new
13
+
14
+ ## 3.10.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [#150556](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150556)
19
+ [`b6a8637092517`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b6a8637092517) -
20
+ Add VC abort reason per TTVC revision
21
+
3
22
  ## 3.9.5
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -6,14 +6,35 @@ Parts of React UFO that need to be scoped within @atlaskit
6
6
 
7
7
  <https://hello.atlassian.net/wiki/spaces/UFO/pages/2305847386/react-ufo+UFO+v2>
8
8
 
9
-
10
9
  # Running integration test
10
+
11
+ In one terminal:
12
+
11
13
  ```
12
14
  cd platform && nvm use && yarn
13
-
14
15
  yarn start:rspack react-ufo
16
+ ```
17
+
18
+ This will start the dev server, accessible via http://localhost:9000.
15
19
 
16
- # in a separate terminal
20
+ Then in a separate terminal:
21
+
22
+ ```
17
23
  cd platform && nvm use
18
- yarn test:integration packages/react-ufo/atlaskit/__tests__/ --retries 0 --reporter list --reuse-dev-server --project=desktop-chromium --max-failures=0
19
- ```
24
+ yarn test:integration packages/react-ufo/atlaskit/__tests__/ --retries 0 --reporter list --reuse-dev-server --project=desktop-chromium --max-failures=0
25
+ ```
26
+
27
+ To ensure the test is not flaky, refer to the following page:
28
+ [HOWTO: Fix & remove flaky tests](https://hello.atlassian.net/wiki/spaces/afm/pages/3153691982/HOWTO+Fix+remove+flaky+tests#3.-How-can-I-verify-/-reproduce-flakiness?)
29
+
30
+ Essentially, to simulate CI-like environment in local for Playwright to parallelise load, we can
31
+ increase the following:
32
+
33
+ - The number of times to repeat each test
34
+ - The number of workers
35
+
36
+ Example:
37
+
38
+ ```
39
+ yarn test:integration packages/react-ufo/atlaskit/__tests__/playwright/base.spec.ts --retries 0 --reporter list --reuse-dev-server --project=desktop-chromium --max-failures=0 --repeat-each 50 --workers 50
40
+ ```
@@ -8,6 +8,7 @@ exports.getCapabilityRate = getCapabilityRate;
8
8
  exports.getConfig = getConfig;
9
9
  exports.getDoNotAbortActivePressInteraction = getDoNotAbortActivePressInteraction;
10
10
  exports.getDoNotAbortActivePressInteractionOnTransition = getDoNotAbortActivePressInteractionOnTransition;
11
+ exports.getEnabledVCRevisions = getEnabledVCRevisions;
11
12
  exports.getExperimentalInteractionRate = getExperimentalInteractionRate;
12
13
  exports.getInteractionRate = getInteractionRate;
13
14
  exports.getPostInteractionRate = getPostInteractionRate;
@@ -15,8 +16,10 @@ exports.getRemoveInteractionsUFOPrefixes = getRemoveInteractionsUFOPrefixes;
15
16
  exports.getRemovePageSegmentsUFOPrefixes = getRemovePageSegmentsUFOPrefixes;
16
17
  exports.getTypingPerformanceTracingMethod = getTypingPerformanceTracingMethod;
17
18
  exports.getUfoNameOverrides = getUfoNameOverrides;
19
+ exports.isVCRevisionEnabled = isVCRevisionEnabled;
18
20
  exports.setUFOConfig = setUFOConfig;
19
21
  var config;
22
+ var DEFAULT_TTVC_REVISION = 'fy25.02';
20
23
 
21
24
  // Defensively typed, since this is directly user-editable
22
25
  // and they could delete empty members
@@ -27,6 +30,24 @@ function setUFOConfig(newConfig) {
27
30
  function getConfig() {
28
31
  return config;
29
32
  }
33
+ function getEnabledVCRevisions() {
34
+ try {
35
+ var _config$vc;
36
+ if (!config) {
37
+ return [];
38
+ }
39
+ if ((_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
40
+ var _config$vc2, _config$vc3;
41
+ return Array.isArray((_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.enabledVCRevisions) && ((_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.enabledVCRevisions.length) > 0 ? config.vc.enabledVCRevisions : [DEFAULT_TTVC_REVISION];
42
+ }
43
+ return [];
44
+ } catch (_unused) {
45
+ return [];
46
+ }
47
+ }
48
+ function isVCRevisionEnabled(revision) {
49
+ return getEnabledVCRevisions().includes(revision);
50
+ }
30
51
  function getInteractionRate(name, interactionKind) {
31
52
  try {
32
53
  if (!config) {
@@ -138,7 +159,7 @@ function getCapabilityRate(capability) {
138
159
  }
139
160
  }
140
161
  return 0;
141
- } catch (_unused) {
162
+ } catch (_unused2) {
142
163
  return 0;
143
164
  }
144
165
  }
@@ -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, _config$vc2;
25
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
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) {
@@ -71,7 +71,7 @@ function _getVCMetrics() {
71
71
  (0, _vc.getVCObserver)().stop();
72
72
  }
73
73
  _interactionMetrics.postInteractionLog.setLastInteractionFinishVCResult(result);
74
- 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
+ if ((0, _config.isVCRevisionEnabled)('fy25.01')) {
75
75
  _context.next = 27;
76
76
  break;
77
77
  }
@@ -12,7 +12,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
13
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
14
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _config = require("../config");
17
16
  var _noOpVcObserver = require("./no-op-vc-observer");
18
17
  var _vcObserver = require("./vc-observer");
@@ -22,12 +21,10 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
22
21
  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) { (0, _defineProperty2.default)(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; }
23
22
  var VCObserverWrapper = /*#__PURE__*/function () {
24
23
  function VCObserverWrapper() {
25
- var _getConfig;
26
24
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27
25
  (0, _classCallCheck2.default)(this, VCObserverWrapper);
28
26
  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 || (_getConfig = _getConfig.enabledVCRevisions) === null || _getConfig === void 0 ? void 0 : _getConfig.includes('fy25.03'));
30
- if (isNewVCObserverEnabled) {
27
+ if ((0, _config.isVCRevisionEnabled)('fy25.03')) {
31
28
  this.newVCObserver = new _vcObserverNew.default({
32
29
  selectorConfig: opts.selectorConfig
33
30
  });
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.getVCRevisionsData = getVCRevisionsData;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
9
  var _config = require("../../config");
11
10
  var _hiddenTiming = require("../../hidden-timing");
12
11
  var _revisions = require("./revisions/revisions");
@@ -46,7 +45,6 @@ function createVCDetails(calculatedVC, shouldHaveVCmetric) {
46
45
 
47
46
  // Optimized implementation (current one)
48
47
  function getVCRevisionsData(_ref) {
49
- var _ufoConfig$vc, _ufoConfig$vc2;
50
48
  var fullPrefix = _ref.fullPrefix,
51
49
  interaction = _ref.interaction,
52
50
  isVCClean = _ref.isVCClean,
@@ -55,8 +53,7 @@ function getVCRevisionsData(_ref) {
55
53
  ssr = _ref.ssr,
56
54
  calculatedVC = _ref.calculatedVC,
57
55
  calculatedVCNext = _ref.calculatedVCNext;
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'))) {
56
+ if (!(0, _config.isVCRevisionEnabled)('fy25.03')) {
60
57
  if (!multiHeatmap) {
61
58
  return null;
62
59
  }
@@ -92,7 +89,7 @@ function getVCRevisionsData(_ref) {
92
89
  'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
93
90
  vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
94
91
  };
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'))) {
92
+ if (!(0, _config.isVCRevisionEnabled)('fy25.01')) {
96
93
  return (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:rev"), [ttvcV2Revision]);
97
94
  }
98
95
 
@@ -45,8 +45,7 @@ function filterComponentsLog(log) {
45
45
  }
46
46
  var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
47
47
  function VCObserver(options) {
48
- var _this = this,
49
- _getConfig5;
48
+ var _this = this;
50
49
  (0, _classCallCheck2.default)(this, VCObserver);
51
50
  /* abort logic */
52
51
  (0, _defineProperty2.default)(this, "abortReason", {
@@ -106,8 +105,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
106
105
  });
107
106
  (0, _defineProperty2.default)(this, "getVCResult", /*#__PURE__*/function () {
108
107
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref3) {
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
+ var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, isTTVCv1Disabled, vcAbortedResultWithRevisions, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, isVCClean, revisionsData, speedIndex, isTTVCv3Enabled;
111
109
  return _regenerator.default.wrap(function _callee$(_context) {
112
110
  while (1) switch (_context.prev = _context.next) {
113
111
  case 0:
@@ -122,8 +120,37 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
122
120
  return _context.abrupt("return", {});
123
121
  case 6:
124
122
  abortReason = rawData.abortReason, abortReasonInfo = rawData.abortReasonInfo, heatmap = rawData.heatmap, heatmapNext = rawData.heatmapNext, outOfBoundaryInfo = rawData.outOfBoundaryInfo, totalTime = rawData.totalTime, componentsLog = rawData.componentsLog, viewport = rawData.viewport, devToolsEnabled = rawData.devToolsEnabled, ratios = rawData.ratios, multiHeatmap = rawData.multiHeatmap;
123
+ isTTVCv1Disabled = !(0, _config.isVCRevisionEnabled)('fy25.01'); // NOTE: as part of platform_ufo_add_vc_abort_reason_by_revisions feature,
124
+ // we want to report abort by scroll events the same way as other abort reasons
125
+ // i.e. not have the concept of `abortReason.blocking` anymore
126
+ if (!(abortReasonInfo !== null && (0, _platformFeatureFlags.fg)('platform_ufo_add_vc_abort_reason_by_revisions'))) {
127
+ _context.next = 15;
128
+ break;
129
+ }
130
+ // exposing data to devtools
131
+ try {
132
+ if (devToolsEnabled && !_this.isPostInteraction) {
133
+ window.__vcNotAvailableReason = abortReasonInfo;
134
+ }
135
+ } catch (e) {}
136
+ vcAbortedResultWithRevisions = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReason.reason), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp), "".concat(fullPrefix, "vc:rev"), [{
137
+ revision: 'fy25.02',
138
+ clean: false,
139
+ 'metric:vc90': null,
140
+ abortReason: abortReason.reason
141
+ }]);
142
+ if (!isTTVCv1Disabled) {
143
+ vcAbortedResultWithRevisions["".concat(fullPrefix, "vc:rev")].push({
144
+ revision: 'fy25.01',
145
+ clean: false,
146
+ 'metric:vc90': null,
147
+ abortReason: abortReason.reason
148
+ });
149
+ }
150
+ return _context.abrupt("return", vcAbortedResultWithRevisions);
151
+ case 15:
125
152
  if (!(abortReasonInfo !== null && abortReason.blocking)) {
126
- _context.next = 10;
153
+ _context.next = 18;
127
154
  break;
128
155
  }
129
156
  // exposing data to devtools
@@ -133,8 +160,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
133
160
  }
134
161
  } catch (e) {}
135
162
  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));
136
- case 10:
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'));
163
+ case 18:
138
164
  ttvcV1Result = isTTVCv1Disabled ? {
139
165
  VC: {},
140
166
  VCBox: {},
@@ -286,16 +312,16 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
286
312
  });
287
313
  speedIndex = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "ufo:speedIndex", isTTVCv1Disabled ? vcNext.VCEntries.speedIndex : VCEntries.speedIndex), "ufo:next:speedIndex", vcNext.VCEntries.speedIndex);
288
314
  if (!isTTVCv1Disabled) {
289
- _context.next = 25;
315
+ _context.next = 32;
290
316
  break;
291
317
  }
292
318
  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'));
319
+ case 32:
320
+ isTTVCv3Enabled = (0, _config.isVCRevisionEnabled)('fy25.03');
295
321
  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)({
296
322
  'metrics:vc': VC
297
323
  }, "".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));
298
- case 27:
324
+ case 34:
299
325
  case "end":
300
326
  return _context.stop();
301
327
  }
@@ -306,10 +332,9 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
306
332
  };
307
333
  }());
308
334
  (0, _defineProperty2.default)(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) {
309
- var _getConfig3;
310
335
  _this.measureStart();
311
336
  _this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue);
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'))) {
337
+ if (!(0, _config.isVCRevisionEnabled)('fy25.03')) {
313
338
  _this.onViewportChangeDetected({
314
339
  timestamp: rawTime,
315
340
  intersectionRect: intersectionRect,
@@ -326,14 +351,13 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
326
351
  });
327
352
  (0, _defineProperty2.default)(this, "legacyHandleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) {
328
353
  if (_this.abortReason.reason === null || _this.abortReason.blocking === false) {
329
- var _getConfig4;
330
354
  var time = Math.round(rawTime - _this.startTime);
331
355
  var mappedValues = _this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
332
356
  _this.vcRatios[targetName] = _this.getElementRatio(mappedValues);
333
357
  if (!ignoreReason) {
334
358
  _this.applyChangesToHeatMap(mappedValues, time, _this.heatmapNext);
335
359
  }
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'));
360
+ var isTTVCv1Disabled = !(0, _config.isVCRevisionEnabled)('fy25.01');
337
361
  if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
338
362
  _this.applyChangesToHeatMap(mappedValues, time, _this.heatmap);
339
363
  }
@@ -471,7 +495,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
471
495
  dataVC: true
472
496
  }
473
497
  });
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();
498
+ this.heatmap = !(0, _config.isVCRevisionEnabled)('fy25.01') ? [] : this.getCleanHeatmap();
475
499
  this.heatmapNext = this.getCleanHeatmap();
476
500
  this.multiHeatmap = new _heatmap.MultiRevisionHeatmap({
477
501
  viewport: this.viewport,
@@ -551,7 +575,6 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
551
575
  }, {
552
576
  key: "resetState",
553
577
  value: function resetState() {
554
- var _getConfig6;
555
578
  this.abortReason = {
556
579
  reason: null,
557
580
  info: '',
@@ -559,7 +582,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
559
582
  blocking: false
560
583
  };
561
584
  this.detachAbortListeners();
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();
585
+ this.heatmap = !(0, _config.isVCRevisionEnabled)('fy25.01') ? [] : this.getCleanHeatmap();
563
586
  this.heatmapNext = this.getCleanHeatmap();
564
587
  this.multiHeatmap = new _heatmap.MultiRevisionHeatmap({
565
588
  viewport: this.viewport,
@@ -610,10 +633,12 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
610
633
  }, {
611
634
  key: "detachAbortListeners",
612
635
  value: function detachAbortListeners() {
613
- this.unbind.forEach(function (fn) {
614
- return fn();
615
- });
616
- this.unbind = [];
636
+ if (Array.isArray(this.unbind)) {
637
+ this.unbind.forEach(function (fn) {
638
+ return fn();
639
+ });
640
+ this.unbind = [];
641
+ }
617
642
  }
618
643
  }, {
619
644
  key: "measureStart",
@@ -8,8 +8,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
- 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'))) {
11
+ if (!(0, _config.isVCRevisionEnabled)('fy25.01')) {
13
12
  return [{
14
13
  name: 'fy25.02',
15
14
  classifier: _fy25_2.revFY25_02Classifier
@@ -9,6 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _percentileCalc = _interopRequireDefault(require("./percentile-calc"));
13
14
  var _getViewportHeight = _interopRequireDefault(require("./utils/get-viewport-height"));
14
15
  var _getViewportWidth = _interopRequireDefault(require("./utils/get-viewport-width"));
@@ -24,7 +25,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
24
25
  var _this = this,
25
26
  _vcDetails$90$t,
26
27
  _vcDetails$;
27
- var startTime, stopTime, orderedEntries, filteredEntries, isVCClean, vcDetails;
28
+ var startTime, stopTime, orderedEntries, filteredEntries, _this$getVCCleanStatu, _isVCClean, dirtyReason, _isVCClean2, vcDetails;
28
29
  return _regenerator.default.wrap(function _callee$(_context) {
29
30
  while (1) switch (_context.prev = _context.next) {
30
31
  case 0:
@@ -32,9 +33,28 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
32
33
  filteredEntries = orderedEntries.filter(function (entry) {
33
34
  return _this.isEntryIncluded(entry);
34
35
  });
35
- isVCClean = this.isVCClean(filteredEntries);
36
- if (isVCClean) {
37
- _context.next = 5;
36
+ if (!(0, _platformFeatureFlags.fg)('platform_ufo_add_vc_abort_reason_by_revisions')) {
37
+ _context.next = 8;
38
+ break;
39
+ }
40
+ _this$getVCCleanStatu = this.getVCCleanStatus(filteredEntries), _isVCClean = _this$getVCCleanStatu.isVCClean, dirtyReason = _this$getVCCleanStatu.dirtyReason;
41
+ if (_isVCClean) {
42
+ _context.next = 6;
43
+ break;
44
+ }
45
+ return _context.abrupt("return", {
46
+ revision: this.revisionNo,
47
+ 'metric:vc90': null,
48
+ clean: false,
49
+ abortReason: dirtyReason
50
+ });
51
+ case 6:
52
+ _context.next = 11;
53
+ break;
54
+ case 8:
55
+ _isVCClean2 = this.isVCClean(filteredEntries);
56
+ if (_isVCClean2) {
57
+ _context.next = 11;
38
58
  break;
39
59
  }
40
60
  return _context.abrupt("return", {
@@ -42,8 +62,8 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
42
62
  'metric:vc90': null,
43
63
  clean: false
44
64
  });
45
- case 5:
46
- _context.next = 7;
65
+ case 11:
66
+ _context.next = 13;
47
67
  return (0, _percentileCalc.default)({
48
68
  viewport: {
49
69
  width: (0, _getViewportWidth.default)(),
@@ -54,15 +74,15 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
54
74
  orderedEntries: filteredEntries,
55
75
  percentiles: [25, 50, 75, 80, 85, 90, 95, 98, 99]
56
76
  });
57
- case 7:
77
+ case 13:
58
78
  vcDetails = _context.sent;
59
79
  return _context.abrupt("return", {
60
80
  revision: this.revisionNo,
61
81
  vcDetails: vcDetails !== null && vcDetails !== void 0 ? vcDetails : undefined,
62
- clean: isVCClean,
82
+ clean: true,
63
83
  'metric:vc90': (_vcDetails$90$t = vcDetails === null || vcDetails === void 0 || (_vcDetails$ = vcDetails['90']) === null || _vcDetails$ === void 0 ? void 0 : _vcDetails$.t) !== null && _vcDetails$90$t !== void 0 ? _vcDetails$90$t : null
64
84
  });
65
- case 9:
85
+ case 15:
66
86
  case "end":
67
87
  return _context.stop();
68
88
  }
@@ -61,5 +61,29 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
61
61
  });
62
62
  return !hasAbortEvent;
63
63
  }
64
+ }, {
65
+ key: "getVCCleanStatus",
66
+ value: function getVCCleanStatus(filteredEntries) {
67
+ var dirtyReason = '';
68
+ var hasAbortEvent = filteredEntries.some(function (entry) {
69
+ if (entry.type === 'window:event') {
70
+ var data = entry.data;
71
+ if (ABORTING_WINDOW_EVENT.includes(data.eventType)) {
72
+ dirtyReason = data.eventType === 'keydown' ? 'keypress' : data.eventType;
73
+ return true;
74
+ }
75
+ }
76
+ return false;
77
+ });
78
+ if (hasAbortEvent && dirtyReason) {
79
+ return {
80
+ isVCClean: false,
81
+ dirtyReason: dirtyReason
82
+ };
83
+ }
84
+ return {
85
+ isVCClean: true
86
+ };
87
+ }
64
88
  }]);
65
89
  }(_abstractBaseVcCalculator.default);
@@ -1,4 +1,5 @@
1
1
  let config;
2
+ const DEFAULT_TTVC_REVISION = 'fy25.02';
2
3
 
3
4
  // Defensively typed, since this is directly user-editable
4
5
  // and they could delete empty members
@@ -9,6 +10,24 @@ export function setUFOConfig(newConfig) {
9
10
  export function getConfig() {
10
11
  return config;
11
12
  }
13
+ export function getEnabledVCRevisions() {
14
+ try {
15
+ var _config$vc;
16
+ if (!config) {
17
+ return [];
18
+ }
19
+ if ((_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
20
+ var _config$vc2, _config$vc3;
21
+ return Array.isArray((_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.enabledVCRevisions) && ((_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.enabledVCRevisions.length) > 0 ? config.vc.enabledVCRevisions : [DEFAULT_TTVC_REVISION];
22
+ }
23
+ return [];
24
+ } catch {
25
+ return [];
26
+ }
27
+ }
28
+ export function isVCRevisionEnabled(revision) {
29
+ return getEnabledVCRevisions().includes(revision);
30
+ }
12
31
  export function getInteractionRate(name, interactionKind) {
13
32
  try {
14
33
  if (!config) {
@@ -1,12 +1,12 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- import { getConfig } from '../../config';
2
+ import { getConfig, isVCRevisionEnabled } from '../../config';
3
3
  import { postInteractionLog } from '../../interaction-metrics';
4
4
  import { getVCObserver } from '../../vc';
5
5
  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, _config$vc2, _config$vc2$enabledVC;
9
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _interaction$apdex$, _config$experimentalI;
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 {};
@@ -40,7 +40,7 @@ async function getVCMetrics(interaction) {
40
40
  getVCObserver().stop();
41
41
  }
42
42
  postInteractionLog.setLastInteractionFinishVCResult(result);
43
- 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
+ if (!isVCRevisionEnabled('fy25.01')) {
44
44
  var _result$ufoVcRev;
45
45
  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(({
46
46
  revision
@@ -1,15 +1,12 @@
1
1
  var _process, _process$env;
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
- import { getConfig } from '../config';
2
+ import { isVCRevisionEnabled } from '../config';
4
3
  import { VCObserverNOOP } from './no-op-vc-observer';
5
4
  import { VCObserver } from './vc-observer';
6
5
  import VCObserverNew from './vc-observer-new';
7
6
  class VCObserverWrapper {
8
7
  constructor(opts = {}) {
9
- var _getConfig, _getConfig$vc, _getConfig$vc$enabled;
10
8
  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$enabled = _getConfig$vc.enabledVCRevisions) === null || _getConfig$vc$enabled === void 0 ? void 0 : _getConfig$vc$enabled.includes('fy25.03'));
12
- if (isNewVCObserverEnabled) {
9
+ if (isVCRevisionEnabled('fy25.03')) {
13
10
  this.newVCObserver = new VCObserverNew({
14
11
  selectorConfig: opts.selectorConfig
15
12
  });
@@ -1,5 +1,4 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
- import { getConfig } from '../../config';
1
+ import { isVCRevisionEnabled } from '../../config';
3
2
  import { getPageVisibilityState } from '../../hidden-timing';
4
3
  import { getRevisions } from './revisions/revisions';
5
4
  const VCParts = ['25', '50', '75', '80', '85', '90', '95', '98', '99'];
@@ -38,9 +37,7 @@ export function getVCRevisionsData({
38
37
  calculatedVC,
39
38
  calculatedVCNext
40
39
  }) {
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'))) {
40
+ if (!isVCRevisionEnabled('fy25.03')) {
44
41
  if (!multiHeatmap) {
45
42
  return null;
46
43
  }
@@ -74,7 +71,7 @@ export function getVCRevisionsData({
74
71
  'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
75
72
  vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
76
73
  };
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'))) {
74
+ if (!isVCRevisionEnabled('fy25.01')) {
78
75
  return {
79
76
  [`${fullPrefix}vc:rev`]: [ttvcV2Revision]
80
77
  };