@atlaskit/react-ufo 2.16.1 → 3.1.0

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 (31) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/cjs/create-payload/index.js +2 -3
  3. package/dist/cjs/resource-timing/main.js +27 -7
  4. package/dist/cjs/vc/vc-observer/heatmap/heatmap.js +9 -1
  5. package/dist/cjs/vc/vc-observer/index.js +40 -28
  6. package/dist/cjs/vc/vc-observer/revisions/ViewportUpdateClassifier.js +16 -8
  7. package/dist/cjs/vc/vc-observer/revisions/fy24_01.js +7 -0
  8. package/dist/cjs/vc/vc-observer/revisions/fy25_01.js +31 -2
  9. package/dist/es2019/create-payload/index.js +2 -3
  10. package/dist/es2019/resource-timing/main.js +27 -7
  11. package/dist/es2019/vc/vc-observer/heatmap/heatmap.js +9 -1
  12. package/dist/es2019/vc/vc-observer/index.js +11 -0
  13. package/dist/es2019/vc/vc-observer/revisions/ViewportUpdateClassifier.js +7 -0
  14. package/dist/es2019/vc/vc-observer/revisions/fy24_01.js +8 -1
  15. package/dist/es2019/vc/vc-observer/revisions/fy25_01.js +23 -0
  16. package/dist/esm/create-payload/index.js +2 -3
  17. package/dist/esm/resource-timing/main.js +27 -7
  18. package/dist/esm/vc/vc-observer/heatmap/heatmap.js +9 -1
  19. package/dist/esm/vc/vc-observer/index.js +40 -28
  20. package/dist/esm/vc/vc-observer/revisions/ViewportUpdateClassifier.js +16 -8
  21. package/dist/esm/vc/vc-observer/revisions/fy24_01.js +7 -0
  22. package/dist/esm/vc/vc-observer/revisions/fy25_01.js +31 -2
  23. package/dist/types/vc/vc-observer/heatmap/heatmap.d.ts +6 -4
  24. package/dist/types/vc/vc-observer/revisions/ViewportUpdateClassifier.d.ts +2 -1
  25. package/dist/types/vc/vc-observer/revisions/fy25_01.d.ts +4 -1
  26. package/dist/types/vc/vc-observer/revisions/types.d.ts +5 -0
  27. package/dist/types-ts4.5/vc/vc-observer/heatmap/heatmap.d.ts +6 -4
  28. package/dist/types-ts4.5/vc/vc-observer/revisions/ViewportUpdateClassifier.d.ts +2 -1
  29. package/dist/types-ts4.5/vc/vc-observer/revisions/fy25_01.d.ts +4 -1
  30. package/dist/types-ts4.5/vc/vc-observer/revisions/types.d.ts +5 -0
  31. package/package.json +6 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#118212](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/118212)
8
+ [`7a1ec3e0fb496`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7a1ec3e0fb496) -
9
+ Updating logic to track resource timings to include 'other' type which includes '.js'
10
+
11
+ ## 3.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - [#117363](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117363)
16
+ [`10a0f7f6c2027`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/10a0f7f6c2027) -
17
+ This package's `peerDependencies` have been adjusted for `react` and/or `react-dom` to reflect the
18
+ status of only supporting React 18 going forward. No explicit breaking change to React support has
19
+ been made in this release, but this is to signify going forward, breaking changes for React 16 or
20
+ React 17 may come via non-major semver releases.
21
+
22
+ Please refer this community post for more details:
23
+ https://community.developer.atlassian.com/t/rfc-78-dropping-support-for-react-16-and-rendering-in-a-react-18-concurrent-root-in-jira-and-confluence/87026
24
+
25
+ ### Patch Changes
26
+
27
+ - [#117324](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117324)
28
+ [`921179f5ee66d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/921179f5ee66d) -
29
+ Remove FG from CHR API
30
+ - Updated dependencies
31
+
3
32
  ## 2.16.1
4
33
 
5
34
  ### Patch Changes
@@ -320,11 +320,10 @@ var getAssetsMetrics = function getAssetsMetrics(interaction, resourceTimings) {
320
320
  try {
321
321
  var config = (0, _config.getConfig)();
322
322
  var type = interaction.type;
323
- var isCHREnabled = (0, _platformFeatureFlags.fg)('ufo_chr_config');
324
323
  var allowedTypes = ['page_load', 'transition'];
325
324
  var assetsClassification = config === null || config === void 0 ? void 0 : config.assetsClassification;
326
- if (!isCHREnabled || !allowedTypes.includes(type) || !assetsClassification) {
327
- // Skip if: FG disabled, not allowed type or assetsClassification isn't configured
325
+ if (!allowedTypes.includes(type) || !assetsClassification) {
326
+ // Skip if: type not allowed or assetsClassification isn't configured
328
327
  return {};
329
328
  }
330
329
  var reporter = new _assets.CHRReporter();
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.getResourceTimings = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
10
  var _config = require("../config");
10
11
  var _roundNumber = require("../round-number");
11
12
  var _config2 = require("./common/utils/config");
@@ -17,10 +18,19 @@ var resourceTypes = ['fetch', 'xmlhttprequest'];
17
18
  var CACHE_NETWORK = 'network';
18
19
  var CACHE_MEMORY = 'memory';
19
20
  var CACHE_DISK = 'disk';
21
+ var isCacheableType = function isCacheableType(url, type) {
22
+ if (cacheableTypes.includes(type)) {
23
+ return true;
24
+ }
25
+ if (type === 'other' && url.includes('.js') && (0, _platformFeatureFlags.fg)('ufo_support_other_resource_type_js')) {
26
+ return true;
27
+ }
28
+ return false;
29
+ };
20
30
 
21
31
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
22
- var calculateTransferType = function calculateTransferType(type, duration, size) {
23
- if (!cacheableTypes.includes(type)) {
32
+ var calculateTransferType = function calculateTransferType(name, type, duration, size) {
33
+ if (!isCacheableType(name, type)) {
24
34
  return CACHE_NETWORK;
25
35
  }
26
36
  if ((size === undefined || size === 0) && duration === 0) {
@@ -38,15 +48,22 @@ var getWindowObject = function getWindowObject() {
38
48
  return typeof window !== 'undefined' && !!window ? window : undefined;
39
49
  };
40
50
  var hasAccessToResourceSize = function hasAccessToResourceSize(url, type, entry, hasTimingHeaders) {
41
- return !cacheableTypes.includes(type) || url.includes('localhost') || !!getWindowObject() && url.includes(window.location.hostname) || hasTimingHeaders(url, entry);
51
+ return !isCacheableType(url, type) || url.includes('localhost') || !!getWindowObject() && url.includes(window.location.hostname) || hasTimingHeaders(url, entry);
42
52
  };
43
53
  var getReportedInitiatorTypes = function getReportedInitiatorTypes(xhrEnabled) {
44
54
  var ufoConfig = (0, _config.getConfig)();
45
55
  if (!(ufoConfig !== null && ufoConfig !== void 0 && ufoConfig.allowedResources)) {
46
- if (xhrEnabled) {
47
- return ['script', 'link', 'fetch', 'xmlhttprequest'];
56
+ if ((0, _platformFeatureFlags.fg)('ufo_support_other_resource_type_js')) {
57
+ if (xhrEnabled) {
58
+ return ['script', 'link', 'fetch', 'other', 'xmlhttprequest'];
59
+ }
60
+ return ['script', 'link', 'fetch', 'other'];
61
+ } else {
62
+ if (xhrEnabled) {
63
+ return ['script', 'link', 'fetch', 'xmlhttprequest'];
64
+ }
65
+ return ['script', 'link', 'fetch'];
48
66
  }
49
- return ['script', 'link', 'fetch'];
50
67
  }
51
68
  return ufoConfig.allowedResources;
52
69
  };
@@ -77,7 +94,7 @@ var getNetworkData = function getNetworkData(item, eventStart) {
77
94
  return {};
78
95
  }
79
96
  if (cacheableTypes.includes(initiatorType)) {
80
- var transferType = calculateTransferType(initiatorType, duration, transferSize);
97
+ var transferType = calculateTransferType(name, initiatorType, duration, transferSize);
81
98
  return _objectSpread({
82
99
  ttfb: ttfb,
83
100
  transferType: transferType,
@@ -125,6 +142,9 @@ var getResourceTimings = exports.getResourceTimings = function getResourceTiming
125
142
  if (initiatorType === 'xmlhttprequest' && (xhrFilter === undefined || xhrFilter(name) === false)) {
126
143
  return;
127
144
  }
145
+ if (initiatorType === 'other' && !name.includes('.js') && (0, _platformFeatureFlags.fg)('ufo_support_other_resource_type_js')) {
146
+ return;
147
+ }
128
148
  var url = resourceTypes.includes(initiatorType) ? sanitiseEndpoints(name) : mapResources(name);
129
149
  if (!url) {
130
150
  return;
@@ -131,6 +131,8 @@ var MultiRevisionHeatmap = exports.MultiRevisionHeatmap = /*#__PURE__*/function
131
131
  var _this3 = this;
132
132
  var VCParts = _ref4.VCParts,
133
133
  VCCalculationMethods = _ref4.VCCalculationMethods,
134
+ filterComponentsLog = _ref4.filterComponentsLog,
135
+ ttai = _ref4.ttai,
134
136
  _ref4$ssr = _ref4.ssr,
135
137
  ssr = _ref4$ssr === void 0 ? UNUSED_SECTOR : _ref4$ssr;
136
138
  return this.heatmaps.map(function (heatmap, i) {
@@ -173,6 +175,12 @@ var MultiRevisionHeatmap = exports.MultiRevisionHeatmap = /*#__PURE__*/function
173
175
  }).sort(function (a, b) {
174
176
  return a[0] > b[0] ? 1 : -1;
175
177
  });
178
+
179
+ // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
180
+ componentsLog = filterComponentsLog[i]({
181
+ componentsLog: componentsLog,
182
+ ttai: ttai
183
+ });
176
184
  var _VCCalculationMethods = VCCalculationMethods[i]({
177
185
  VCParts: VCParts,
178
186
  componentsLog: componentsLog,
@@ -249,7 +257,7 @@ var MultiRevisionHeatmap = exports.MultiRevisionHeatmap = /*#__PURE__*/function
249
257
  }, {
250
258
  key: "getCleanHeatmap",
251
259
  value: function getCleanHeatmap() {
252
- return new Uint32Array(this.arraySize.w * this.arraySize.h);
260
+ return new Int32Array(this.arraySize.w * this.arraySize.h);
253
261
  }
254
262
  }], [{
255
263
  key: "makeVCReturnObj",
@@ -260,6 +260,11 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
260
260
  var classifier = _ref8.classifier;
261
261
  return classifier.VCCalculationMethod;
262
262
  }),
263
+ filterComponentsLog: (0, _revisions.getRevisions)().map(function (_ref9) {
264
+ var classifier = _ref9.classifier;
265
+ return classifier.filterComponentsLog;
266
+ }),
267
+ ttai: stop,
263
268
  ssr: ssr,
264
269
  clean: !abortReasonInfo
265
270
  })) : null;
@@ -306,13 +311,13 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
306
311
  });
307
312
  }
308
313
  });
309
- (0, _defineProperty2.default)(this, "onViewportChangeDetected", function (_ref10) {
310
- var element = _ref10.element,
311
- type = _ref10.type,
312
- ignoreReason = _ref10.ignoreReason,
313
- timestamp = _ref10.timestamp,
314
- targetName = _ref10.targetName,
315
- intersectionRect = _ref10.intersectionRect;
314
+ (0, _defineProperty2.default)(this, "onViewportChangeDetected", function (_ref11) {
315
+ var element = _ref11.element,
316
+ type = _ref11.type,
317
+ ignoreReason = _ref11.ignoreReason,
318
+ timestamp = _ref11.timestamp,
319
+ targetName = _ref11.targetName,
320
+ intersectionRect = _ref11.intersectionRect;
316
321
  if (_this.multiHeatmap === null) {
317
322
  return;
318
323
  }
@@ -394,10 +399,10 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
394
399
  var unbinds = (0, _attachAbortListeners.attachAbortListeners)(window, _this.viewport, _this.abortReasonCallback);
395
400
  if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
396
401
  var _window2;
397
- Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref11) {
398
- var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
399
- key = _ref12[0],
400
- time = _ref12[1];
402
+ Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref12) {
403
+ var _ref13 = (0, _slicedToArray2.default)(_ref12, 2),
404
+ key = _ref13[0],
405
+ time = _ref13[1];
401
406
  if (time) {
402
407
  _this.abortReasonCallback(key, time);
403
408
  }
@@ -432,8 +437,8 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
432
437
  }
433
438
  return (0, _createClass2.default)(VCObserver, [{
434
439
  key: "start",
435
- value: function start(_ref13) {
436
- var startTime = _ref13.startTime;
440
+ value: function start(_ref14) {
441
+ var startTime = _ref14.startTime;
437
442
  this.active = true;
438
443
  if (this.observers.isBrowserSupported()) {
439
444
  this.setViewportSize();
@@ -455,12 +460,12 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
455
460
  }, {
456
461
  key: "getIgnoredElements",
457
462
  value: function getIgnoredElements(componentsLog) {
458
- return Object.values(componentsLog).flat().filter(function (_ref14) {
459
- var ignoreReason = _ref14.ignoreReason;
463
+ return Object.values(componentsLog).flat().filter(function (_ref15) {
464
+ var ignoreReason = _ref15.ignoreReason;
460
465
  return Boolean(ignoreReason);
461
- }).map(function (_ref15) {
462
- var targetName = _ref15.targetName,
463
- ignoreReason = _ref15.ignoreReason;
466
+ }).map(function (_ref16) {
467
+ var targetName = _ref16.targetName,
468
+ ignoreReason = _ref16.ignoreReason;
464
469
  return {
465
470
  targetName: targetName,
466
471
  ignoreReason: ignoreReason
@@ -516,6 +521,13 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
516
521
  this.detachAbortListeners();
517
522
  this.heatmap = this.getCleanHeatmap();
518
523
  this.heatmapNext = this.getCleanHeatmap();
524
+ if ((0, _platformFeatureFlags.fg)('ufo_vc_multiheatmap')) {
525
+ this.multiHeatmap = new _heatmap.MultiRevisionHeatmap({
526
+ viewport: this.viewport,
527
+ revisions: (0, _revisions.getRevisions)(),
528
+ devToolsEnabled: this.devToolsEnabled
529
+ });
530
+ }
519
531
  this.totalTime = 0;
520
532
  this.componentsLog = {};
521
533
  this.vcRatios = {};
@@ -581,12 +593,12 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
581
593
  }
582
594
  }], [{
583
595
  key: "calculateVC",
584
- value: function calculateVC(_ref16) {
585
- var heatmap = _ref16.heatmap,
586
- _ref16$ssr = _ref16.ssr,
587
- ssr = _ref16$ssr === void 0 ? UNUSED_SECTOR : _ref16$ssr,
588
- componentsLog = _ref16.componentsLog,
589
- viewport = _ref16.viewport;
596
+ value: function calculateVC(_ref17) {
597
+ var heatmap = _ref17.heatmap,
598
+ _ref17$ssr = _ref17.ssr,
599
+ ssr = _ref17$ssr === void 0 ? UNUSED_SECTOR : _ref17$ssr,
600
+ componentsLog = _ref17.componentsLog,
601
+ viewport = _ref17.viewport;
590
602
  var lastUpdate = {};
591
603
  var totalPainted = 0;
592
604
  if (ssr !== UNUSED_SECTOR) {
@@ -655,11 +667,11 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
655
667
  });
656
668
  return VCRatio;
657
669
  }, 0);
658
- var VCEntries = entries.reduce(function (acc, _ref17, i) {
670
+ var VCEntries = entries.reduce(function (acc, _ref18, i) {
659
671
  var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
660
- var _ref18 = (0, _slicedToArray2.default)(_ref17, 2),
661
- timestamp = _ref18[0],
662
- entryPainted = _ref18[1];
672
+ var _ref19 = (0, _slicedToArray2.default)(_ref18, 2),
673
+ timestamp = _ref19[0],
674
+ entryPainted = _ref19[1];
663
675
  var currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
664
676
  var currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
665
677
  var logEntry = (_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.map(function (v) {
@@ -26,6 +26,14 @@ var ViewportUpdateClassifier = exports.ViewportUpdateClassifier = /*#__PURE__*/f
26
26
  VCBox: {}
27
27
  };
28
28
  }
29
+
30
+ // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
31
+ }, {
32
+ key: "filterComponentsLog",
33
+ value: function filterComponentsLog(_ref) {
34
+ var componentsLog = _ref.componentsLog;
35
+ return componentsLog;
36
+ }
29
37
  }, {
30
38
  key: "mergeConfig",
31
39
  value: function mergeConfig() {
@@ -38,17 +46,17 @@ var ViewportUpdateClassifier = exports.ViewportUpdateClassifier = /*#__PURE__*/f
38
46
  }
39
47
  }, {
40
48
  key: "classifyUpdate",
41
- value: function classifyUpdate(_ref) {
42
- var element = _ref.element,
43
- type = _ref.type,
44
- tags = _ref.tags,
45
- ignoreReason = _ref.ignoreReason;
49
+ value: function classifyUpdate(_ref2) {
50
+ var element = _ref2.element,
51
+ type = _ref2.type,
52
+ tags = _ref2.tags,
53
+ ignoreReason = _ref2.ignoreReason;
46
54
  if (!this.__combinedTypes.includes(type)) {
47
55
  return false;
48
56
  }
49
- return this.__combinedFilters.every(function (_ref2) {
50
- var filter = _ref2.filter,
51
- name = _ref2.name;
57
+ return this.__combinedFilters.every(function (_ref3) {
58
+ var filter = _ref3.filter,
59
+ name = _ref3.name;
52
60
  return filter({
53
61
  type: type,
54
62
  tags: tags,
@@ -11,6 +11,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
11
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _ViewportUpdateClassifier = require("./ViewportUpdateClassifier");
15
16
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
16
17
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
@@ -48,6 +49,12 @@ var FY24_01Classifier = exports.FY24_01Classifier = /*#__PURE__*/function (_View
48
49
  var v = arguments.length > 1 ? arguments[1] : undefined;
49
50
  var VCRatio = v[1] / totalPainted + acc;
50
51
  var time = v[0];
52
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_fix_vc_observer_rounding_error')) {
53
+ // @todo apply fix to include small changes into accumulator
54
+ var preciseCurrRatio = Math.round(100 * (v[1] / totalPainted));
55
+ var preciseAccRatio = Math.round(acc * 100);
56
+ VCRatio = (preciseCurrRatio + preciseAccRatio) / 100;
57
+ }
51
58
  VCParts.forEach(function (value) {
52
59
  if ((VC[value] === null || VC[value] === undefined) && VCRatio >= value / 100) {
53
60
  var _componentsLog$time;
@@ -5,13 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.revFY25_01Classifier = exports.FY25_01Classifier = void 0;
8
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
16
  var _fy24_ = require("./fy24_01");
17
+ 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; }
18
+ 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; }
15
19
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
16
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
17
21
  var FY25_01Classifier = exports.FY25_01Classifier = /*#__PURE__*/function (_FY24_01Classifier) {
@@ -34,6 +38,31 @@ var FY25_01Classifier = exports.FY25_01Classifier = /*#__PURE__*/function (_FY24
34
38
  return _this;
35
39
  }
36
40
  (0, _inherits2.default)(FY25_01Classifier, _FY24_01Classifier);
37
- return (0, _createClass2.default)(FY25_01Classifier);
41
+ return (0, _createClass2.default)(FY25_01Classifier, [{
42
+ key: "filterComponentsLog",
43
+ value:
44
+ // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
45
+ function filterComponentsLog(_ref2) {
46
+ var componentsLog = _ref2.componentsLog,
47
+ ttai = _ref2.ttai;
48
+ var _componentsLog = {};
49
+
50
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
51
+ if ((0, _platformFeatureFlags.fg)('ufo-remove-vc-component-observations-after-ttai')) {
52
+ Object.entries(componentsLog).forEach(function (_ref3) {
53
+ var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
54
+ _timestamp = _ref4[0],
55
+ value = _ref4[1];
56
+ var timestamp = Number(_timestamp);
57
+ if (ttai > timestamp) {
58
+ _componentsLog[timestamp] = value;
59
+ }
60
+ });
61
+ } else {
62
+ _componentsLog = _objectSpread({}, componentsLog);
63
+ }
64
+ return _componentsLog;
65
+ }
66
+ }]);
38
67
  }(_fy24_.FY24_01Classifier);
39
68
  var revFY25_01Classifier = exports.revFY25_01Classifier = new FY25_01Classifier();
@@ -305,11 +305,10 @@ const getAssetsMetrics = (interaction, resourceTimings) => {
305
305
  const {
306
306
  type
307
307
  } = interaction;
308
- const isCHREnabled = fg('ufo_chr_config');
309
308
  const allowedTypes = ['page_load', 'transition'];
310
309
  const assetsClassification = config === null || config === void 0 ? void 0 : config.assetsClassification;
311
- if (!isCHREnabled || !allowedTypes.includes(type) || !assetsClassification) {
312
- // Skip if: FG disabled, not allowed type or assetsClassification isn't configured
310
+ if (!allowedTypes.includes(type) || !assetsClassification) {
311
+ // Skip if: type not allowed or assetsClassification isn't configured
313
312
  return {};
314
313
  }
315
314
  const reporter = new CHRReporter();
@@ -1,3 +1,4 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  import { getConfig as getConfigUFO } from '../config';
2
3
  import { roundEpsilon } from '../round-number';
3
4
  import { getConfig } from './common/utils/config';
@@ -7,10 +8,19 @@ const resourceTypes = ['fetch', 'xmlhttprequest'];
7
8
  const CACHE_NETWORK = 'network';
8
9
  const CACHE_MEMORY = 'memory';
9
10
  const CACHE_DISK = 'disk';
11
+ const isCacheableType = (url, type) => {
12
+ if (cacheableTypes.includes(type)) {
13
+ return true;
14
+ }
15
+ if (type === 'other' && url.includes('.js') && fg('ufo_support_other_resource_type_js')) {
16
+ return true;
17
+ }
18
+ return false;
19
+ };
10
20
 
11
21
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
12
- const calculateTransferType = (type, duration, size) => {
13
- if (!cacheableTypes.includes(type)) {
22
+ const calculateTransferType = (name, type, duration, size) => {
23
+ if (!isCacheableType(name, type)) {
14
24
  return CACHE_NETWORK;
15
25
  }
16
26
  if ((size === undefined || size === 0) && duration === 0) {
@@ -25,14 +35,21 @@ const calculateTransferType = (type, duration, size) => {
25
35
  return CACHE_NETWORK;
26
36
  };
27
37
  const getWindowObject = () => typeof window !== 'undefined' && !!window ? window : undefined;
28
- const hasAccessToResourceSize = (url, type, entry, hasTimingHeaders) => !cacheableTypes.includes(type) || url.includes('localhost') || !!getWindowObject() && url.includes(window.location.hostname) || hasTimingHeaders(url, entry);
38
+ const hasAccessToResourceSize = (url, type, entry, hasTimingHeaders) => !isCacheableType(url, type) || url.includes('localhost') || !!getWindowObject() && url.includes(window.location.hostname) || hasTimingHeaders(url, entry);
29
39
  const getReportedInitiatorTypes = xhrEnabled => {
30
40
  const ufoConfig = getConfigUFO();
31
41
  if (!(ufoConfig !== null && ufoConfig !== void 0 && ufoConfig.allowedResources)) {
32
- if (xhrEnabled) {
33
- return ['script', 'link', 'fetch', 'xmlhttprequest'];
42
+ if (fg('ufo_support_other_resource_type_js')) {
43
+ if (xhrEnabled) {
44
+ return ['script', 'link', 'fetch', 'other', 'xmlhttprequest'];
45
+ }
46
+ return ['script', 'link', 'fetch', 'other'];
47
+ } else {
48
+ if (xhrEnabled) {
49
+ return ['script', 'link', 'fetch', 'xmlhttprequest'];
50
+ }
51
+ return ['script', 'link', 'fetch'];
34
52
  }
35
- return ['script', 'link', 'fetch'];
36
53
  }
37
54
  return ufoConfig.allowedResources;
38
55
  };
@@ -60,7 +77,7 @@ const getNetworkData = (item, eventStart, hasTimingHeaders = evaluateAccessToRes
60
77
  return {};
61
78
  }
62
79
  if (cacheableTypes.includes(initiatorType)) {
63
- const transferType = calculateTransferType(initiatorType, duration, transferSize);
80
+ const transferType = calculateTransferType(name, initiatorType, duration, transferSize);
64
81
  return {
65
82
  ttfb,
66
83
  transferType,
@@ -113,6 +130,9 @@ export const getResourceTimings = (interactionStart, interactionEnd) => {
113
130
  if (initiatorType === 'xmlhttprequest' && (xhrFilter === undefined || xhrFilter(name) === false)) {
114
131
  return;
115
132
  }
133
+ if (initiatorType === 'other' && !name.includes('.js') && fg('ufo_support_other_resource_type_js')) {
134
+ return;
135
+ }
116
136
  const url = resourceTypes.includes(initiatorType) ? sanitiseEndpoints(name) : mapResources(name);
117
137
  if (!url) {
118
138
  return;
@@ -112,6 +112,8 @@ export class MultiRevisionHeatmap {
112
112
  processData({
113
113
  VCParts,
114
114
  VCCalculationMethods,
115
+ filterComponentsLog,
116
+ ttai,
115
117
  ssr = UNUSED_SECTOR
116
118
  }) {
117
119
  return this.heatmaps.map((heatmap, i) => {
@@ -150,6 +152,12 @@ export class MultiRevisionHeatmap {
150
152
  }
151
153
  }
152
154
  const entries = Object.entries(lastUpdate).map(a => [parseInt(a[0], 10), a[1]]).sort((a, b) => a[0] > b[0] ? 1 : -1);
155
+
156
+ // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
157
+ componentsLog = filterComponentsLog[i]({
158
+ componentsLog,
159
+ ttai
160
+ });
153
161
  const {
154
162
  VC,
155
163
  VCBox
@@ -218,7 +226,7 @@ export class MultiRevisionHeatmap {
218
226
  return x + this.arraySize.w * y;
219
227
  }
220
228
  getCleanHeatmap() {
221
- return new Uint32Array(this.arraySize.w * this.arraySize.h);
229
+ return new Int32Array(this.arraySize.w * this.arraySize.h);
222
230
  }
223
231
  static makeVCReturnObj(VCParts) {
224
232
  const vc = {};
@@ -256,6 +256,10 @@ export class VCObserver {
256
256
  VCCalculationMethods: getRevisions().map(({
257
257
  classifier
258
258
  }) => classifier.VCCalculationMethod),
259
+ filterComponentsLog: getRevisions().map(({
260
+ classifier
261
+ }) => classifier.filterComponentsLog),
262
+ ttai: stop,
259
263
  ssr,
260
264
  clean: !abortReasonInfo
261
265
  })
@@ -605,6 +609,13 @@ export class VCObserver {
605
609
  this.detachAbortListeners();
606
610
  this.heatmap = this.getCleanHeatmap();
607
611
  this.heatmapNext = this.getCleanHeatmap();
612
+ if (fg('ufo_vc_multiheatmap')) {
613
+ this.multiHeatmap = new MultiRevisionHeatmap({
614
+ viewport: this.viewport,
615
+ revisions: getRevisions(),
616
+ devToolsEnabled: this.devToolsEnabled
617
+ });
618
+ }
608
619
  this.totalTime = 0;
609
620
  this.componentsLog = {};
610
621
  this.vcRatios = {};
@@ -13,6 +13,13 @@ export class ViewportUpdateClassifier {
13
13
  VCBox: {}
14
14
  };
15
15
  }
16
+
17
+ // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
18
+ filterComponentsLog({
19
+ componentsLog
20
+ }) {
21
+ return componentsLog;
22
+ }
16
23
  mergeConfig() {
17
24
  this.__combinedTypes = [...this.types, ...((this === null || this === void 0 ? void 0 : this.__combinedTypes) || [])];
18
25
  const previousFilters = this.removedFilters.length === 0 ? this.__combinedFilters : this.__combinedFilters.filter(filter => !this.removedFilters.includes(filter.name));
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { ViewportUpdateClassifier } from './ViewportUpdateClassifier';
3
4
  const legacyIgnoreReasons = ['image', 'ssr-hydration', 'editor-lazy-node-view', 'editor-container-mutation'];
4
5
  export class FY24_01Classifier extends ViewportUpdateClassifier {
@@ -11,8 +12,14 @@ export class FY24_01Classifier extends ViewportUpdateClassifier {
11
12
  const VC = {};
12
13
  const VCBox = {};
13
14
  entries.reduce((acc = 0, v) => {
14
- const VCRatio = v[1] / totalPainted + acc;
15
+ let VCRatio = v[1] / totalPainted + acc;
15
16
  const time = v[0];
17
+ if (fg('platform_ufo_fix_vc_observer_rounding_error')) {
18
+ // @todo apply fix to include small changes into accumulator
19
+ const preciseCurrRatio = Math.round(100 * (v[1] / totalPainted));
20
+ const preciseAccRatio = Math.round(acc * 100);
21
+ VCRatio = (preciseCurrRatio + preciseAccRatio) / 100;
22
+ }
16
23
  VCParts.forEach(value => {
17
24
  if ((VC[value] === null || VC[value] === undefined) && VCRatio >= value / 100) {
18
25
  var _componentsLog$time;
@@ -1,6 +1,29 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { FY24_01Classifier } from './fy24_01';
3
4
  export class FY25_01Classifier extends FY24_01Classifier {
5
+ // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
6
+ filterComponentsLog({
7
+ componentsLog,
8
+ ttai
9
+ }) {
10
+ let _componentsLog = {};
11
+
12
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
13
+ if (fg('ufo-remove-vc-component-observations-after-ttai')) {
14
+ Object.entries(componentsLog).forEach(([_timestamp, value]) => {
15
+ const timestamp = Number(_timestamp);
16
+ if (ttai > timestamp) {
17
+ _componentsLog[timestamp] = value;
18
+ }
19
+ });
20
+ } else {
21
+ _componentsLog = {
22
+ ...componentsLog
23
+ };
24
+ }
25
+ return _componentsLog;
26
+ }
4
27
  constructor() {
5
28
  super();
6
29
  _defineProperty(this, "revision", 'fy25.01');
@@ -309,11 +309,10 @@ var getAssetsMetrics = function getAssetsMetrics(interaction, resourceTimings) {
309
309
  try {
310
310
  var config = getConfig();
311
311
  var type = interaction.type;
312
- var isCHREnabled = fg('ufo_chr_config');
313
312
  var allowedTypes = ['page_load', 'transition'];
314
313
  var assetsClassification = config === null || config === void 0 ? void 0 : config.assetsClassification;
315
- if (!isCHREnabled || !allowedTypes.includes(type) || !assetsClassification) {
316
- // Skip if: FG disabled, not allowed type or assetsClassification isn't configured
314
+ if (!allowedTypes.includes(type) || !assetsClassification) {
315
+ // Skip if: type not allowed or assetsClassification isn't configured
317
316
  return {};
318
317
  }
319
318
  var reporter = new CHRReporter();
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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; }
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { getConfig as getConfigUFO } from '../config';
5
6
  import { roundEpsilon } from '../round-number';
6
7
  import { getConfig } from './common/utils/config';
@@ -10,10 +11,19 @@ var resourceTypes = ['fetch', 'xmlhttprequest'];
10
11
  var CACHE_NETWORK = 'network';
11
12
  var CACHE_MEMORY = 'memory';
12
13
  var CACHE_DISK = 'disk';
14
+ var isCacheableType = function isCacheableType(url, type) {
15
+ if (cacheableTypes.includes(type)) {
16
+ return true;
17
+ }
18
+ if (type === 'other' && url.includes('.js') && fg('ufo_support_other_resource_type_js')) {
19
+ return true;
20
+ }
21
+ return false;
22
+ };
13
23
 
14
24
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
15
- var calculateTransferType = function calculateTransferType(type, duration, size) {
16
- if (!cacheableTypes.includes(type)) {
25
+ var calculateTransferType = function calculateTransferType(name, type, duration, size) {
26
+ if (!isCacheableType(name, type)) {
17
27
  return CACHE_NETWORK;
18
28
  }
19
29
  if ((size === undefined || size === 0) && duration === 0) {
@@ -31,15 +41,22 @@ var getWindowObject = function getWindowObject() {
31
41
  return typeof window !== 'undefined' && !!window ? window : undefined;
32
42
  };
33
43
  var hasAccessToResourceSize = function hasAccessToResourceSize(url, type, entry, hasTimingHeaders) {
34
- return !cacheableTypes.includes(type) || url.includes('localhost') || !!getWindowObject() && url.includes(window.location.hostname) || hasTimingHeaders(url, entry);
44
+ return !isCacheableType(url, type) || url.includes('localhost') || !!getWindowObject() && url.includes(window.location.hostname) || hasTimingHeaders(url, entry);
35
45
  };
36
46
  var getReportedInitiatorTypes = function getReportedInitiatorTypes(xhrEnabled) {
37
47
  var ufoConfig = getConfigUFO();
38
48
  if (!(ufoConfig !== null && ufoConfig !== void 0 && ufoConfig.allowedResources)) {
39
- if (xhrEnabled) {
40
- return ['script', 'link', 'fetch', 'xmlhttprequest'];
49
+ if (fg('ufo_support_other_resource_type_js')) {
50
+ if (xhrEnabled) {
51
+ return ['script', 'link', 'fetch', 'other', 'xmlhttprequest'];
52
+ }
53
+ return ['script', 'link', 'fetch', 'other'];
54
+ } else {
55
+ if (xhrEnabled) {
56
+ return ['script', 'link', 'fetch', 'xmlhttprequest'];
57
+ }
58
+ return ['script', 'link', 'fetch'];
41
59
  }
42
- return ['script', 'link', 'fetch'];
43
60
  }
44
61
  return ufoConfig.allowedResources;
45
62
  };
@@ -70,7 +87,7 @@ var getNetworkData = function getNetworkData(item, eventStart) {
70
87
  return {};
71
88
  }
72
89
  if (cacheableTypes.includes(initiatorType)) {
73
- var transferType = calculateTransferType(initiatorType, duration, transferSize);
90
+ var transferType = calculateTransferType(name, initiatorType, duration, transferSize);
74
91
  return _objectSpread({
75
92
  ttfb: ttfb,
76
93
  transferType: transferType,
@@ -118,6 +135,9 @@ export var getResourceTimings = function getResourceTimings(interactionStart, in
118
135
  if (initiatorType === 'xmlhttprequest' && (xhrFilter === undefined || xhrFilter(name) === false)) {
119
136
  return;
120
137
  }
138
+ if (initiatorType === 'other' && !name.includes('.js') && fg('ufo_support_other_resource_type_js')) {
139
+ return;
140
+ }
121
141
  var url = resourceTypes.includes(initiatorType) ? sanitiseEndpoints(name) : mapResources(name);
122
142
  if (!url) {
123
143
  return;
@@ -124,6 +124,8 @@ export var MultiRevisionHeatmap = /*#__PURE__*/function () {
124
124
  var _this3 = this;
125
125
  var VCParts = _ref4.VCParts,
126
126
  VCCalculationMethods = _ref4.VCCalculationMethods,
127
+ filterComponentsLog = _ref4.filterComponentsLog,
128
+ ttai = _ref4.ttai,
127
129
  _ref4$ssr = _ref4.ssr,
128
130
  ssr = _ref4$ssr === void 0 ? UNUSED_SECTOR : _ref4$ssr;
129
131
  return this.heatmaps.map(function (heatmap, i) {
@@ -166,6 +168,12 @@ export var MultiRevisionHeatmap = /*#__PURE__*/function () {
166
168
  }).sort(function (a, b) {
167
169
  return a[0] > b[0] ? 1 : -1;
168
170
  });
171
+
172
+ // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
173
+ componentsLog = filterComponentsLog[i]({
174
+ componentsLog: componentsLog,
175
+ ttai: ttai
176
+ });
169
177
  var _VCCalculationMethods = VCCalculationMethods[i]({
170
178
  VCParts: VCParts,
171
179
  componentsLog: componentsLog,
@@ -242,7 +250,7 @@ export var MultiRevisionHeatmap = /*#__PURE__*/function () {
242
250
  }, {
243
251
  key: "getCleanHeatmap",
244
252
  value: function getCleanHeatmap() {
245
- return new Uint32Array(this.arraySize.w * this.arraySize.h);
253
+ return new Int32Array(this.arraySize.w * this.arraySize.h);
246
254
  }
247
255
  }], [{
248
256
  key: "makeVCReturnObj",
@@ -253,6 +253,11 @@ export var VCObserver = /*#__PURE__*/function () {
253
253
  var classifier = _ref8.classifier;
254
254
  return classifier.VCCalculationMethod;
255
255
  }),
256
+ filterComponentsLog: getRevisions().map(function (_ref9) {
257
+ var classifier = _ref9.classifier;
258
+ return classifier.filterComponentsLog;
259
+ }),
260
+ ttai: stop,
256
261
  ssr: ssr,
257
262
  clean: !abortReasonInfo
258
263
  })) : null;
@@ -299,13 +304,13 @@ export var VCObserver = /*#__PURE__*/function () {
299
304
  });
300
305
  }
301
306
  });
302
- _defineProperty(this, "onViewportChangeDetected", function (_ref10) {
303
- var element = _ref10.element,
304
- type = _ref10.type,
305
- ignoreReason = _ref10.ignoreReason,
306
- timestamp = _ref10.timestamp,
307
- targetName = _ref10.targetName,
308
- intersectionRect = _ref10.intersectionRect;
307
+ _defineProperty(this, "onViewportChangeDetected", function (_ref11) {
308
+ var element = _ref11.element,
309
+ type = _ref11.type,
310
+ ignoreReason = _ref11.ignoreReason,
311
+ timestamp = _ref11.timestamp,
312
+ targetName = _ref11.targetName,
313
+ intersectionRect = _ref11.intersectionRect;
309
314
  if (_this.multiHeatmap === null) {
310
315
  return;
311
316
  }
@@ -387,10 +392,10 @@ export var VCObserver = /*#__PURE__*/function () {
387
392
  var unbinds = attachAbortListeners(window, _this.viewport, _this.abortReasonCallback);
388
393
  if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
389
394
  var _window2;
390
- Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref11) {
391
- var _ref12 = _slicedToArray(_ref11, 2),
392
- key = _ref12[0],
393
- time = _ref12[1];
395
+ Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref12) {
396
+ var _ref13 = _slicedToArray(_ref12, 2),
397
+ key = _ref13[0],
398
+ time = _ref13[1];
394
399
  if (time) {
395
400
  _this.abortReasonCallback(key, time);
396
401
  }
@@ -425,8 +430,8 @@ export var VCObserver = /*#__PURE__*/function () {
425
430
  }
426
431
  return _createClass(VCObserver, [{
427
432
  key: "start",
428
- value: function start(_ref13) {
429
- var startTime = _ref13.startTime;
433
+ value: function start(_ref14) {
434
+ var startTime = _ref14.startTime;
430
435
  this.active = true;
431
436
  if (this.observers.isBrowserSupported()) {
432
437
  this.setViewportSize();
@@ -448,12 +453,12 @@ export var VCObserver = /*#__PURE__*/function () {
448
453
  }, {
449
454
  key: "getIgnoredElements",
450
455
  value: function getIgnoredElements(componentsLog) {
451
- return Object.values(componentsLog).flat().filter(function (_ref14) {
452
- var ignoreReason = _ref14.ignoreReason;
456
+ return Object.values(componentsLog).flat().filter(function (_ref15) {
457
+ var ignoreReason = _ref15.ignoreReason;
453
458
  return Boolean(ignoreReason);
454
- }).map(function (_ref15) {
455
- var targetName = _ref15.targetName,
456
- ignoreReason = _ref15.ignoreReason;
459
+ }).map(function (_ref16) {
460
+ var targetName = _ref16.targetName,
461
+ ignoreReason = _ref16.ignoreReason;
457
462
  return {
458
463
  targetName: targetName,
459
464
  ignoreReason: ignoreReason
@@ -509,6 +514,13 @@ export var VCObserver = /*#__PURE__*/function () {
509
514
  this.detachAbortListeners();
510
515
  this.heatmap = this.getCleanHeatmap();
511
516
  this.heatmapNext = this.getCleanHeatmap();
517
+ if (fg('ufo_vc_multiheatmap')) {
518
+ this.multiHeatmap = new MultiRevisionHeatmap({
519
+ viewport: this.viewport,
520
+ revisions: getRevisions(),
521
+ devToolsEnabled: this.devToolsEnabled
522
+ });
523
+ }
512
524
  this.totalTime = 0;
513
525
  this.componentsLog = {};
514
526
  this.vcRatios = {};
@@ -574,12 +586,12 @@ export var VCObserver = /*#__PURE__*/function () {
574
586
  }
575
587
  }], [{
576
588
  key: "calculateVC",
577
- value: function calculateVC(_ref16) {
578
- var heatmap = _ref16.heatmap,
579
- _ref16$ssr = _ref16.ssr,
580
- ssr = _ref16$ssr === void 0 ? UNUSED_SECTOR : _ref16$ssr,
581
- componentsLog = _ref16.componentsLog,
582
- viewport = _ref16.viewport;
589
+ value: function calculateVC(_ref17) {
590
+ var heatmap = _ref17.heatmap,
591
+ _ref17$ssr = _ref17.ssr,
592
+ ssr = _ref17$ssr === void 0 ? UNUSED_SECTOR : _ref17$ssr,
593
+ componentsLog = _ref17.componentsLog,
594
+ viewport = _ref17.viewport;
583
595
  var lastUpdate = {};
584
596
  var totalPainted = 0;
585
597
  if (ssr !== UNUSED_SECTOR) {
@@ -648,11 +660,11 @@ export var VCObserver = /*#__PURE__*/function () {
648
660
  });
649
661
  return VCRatio;
650
662
  }, 0);
651
- var VCEntries = entries.reduce(function (acc, _ref17, i) {
663
+ var VCEntries = entries.reduce(function (acc, _ref18, i) {
652
664
  var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
653
- var _ref18 = _slicedToArray(_ref17, 2),
654
- timestamp = _ref18[0],
655
- entryPainted = _ref18[1];
665
+ var _ref19 = _slicedToArray(_ref18, 2),
666
+ timestamp = _ref19[0],
667
+ entryPainted = _ref19[1];
656
668
  var currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
657
669
  var currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
658
670
  var logEntry = (_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.map(function (v) {
@@ -19,6 +19,14 @@ export var ViewportUpdateClassifier = /*#__PURE__*/function () {
19
19
  VCBox: {}
20
20
  };
21
21
  }
22
+
23
+ // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
24
+ }, {
25
+ key: "filterComponentsLog",
26
+ value: function filterComponentsLog(_ref) {
27
+ var componentsLog = _ref.componentsLog;
28
+ return componentsLog;
29
+ }
22
30
  }, {
23
31
  key: "mergeConfig",
24
32
  value: function mergeConfig() {
@@ -31,17 +39,17 @@ export var ViewportUpdateClassifier = /*#__PURE__*/function () {
31
39
  }
32
40
  }, {
33
41
  key: "classifyUpdate",
34
- value: function classifyUpdate(_ref) {
35
- var element = _ref.element,
36
- type = _ref.type,
37
- tags = _ref.tags,
38
- ignoreReason = _ref.ignoreReason;
42
+ value: function classifyUpdate(_ref2) {
43
+ var element = _ref2.element,
44
+ type = _ref2.type,
45
+ tags = _ref2.tags,
46
+ ignoreReason = _ref2.ignoreReason;
39
47
  if (!this.__combinedTypes.includes(type)) {
40
48
  return false;
41
49
  }
42
- return this.__combinedFilters.every(function (_ref2) {
43
- var filter = _ref2.filter,
44
- name = _ref2.name;
50
+ return this.__combinedFilters.every(function (_ref3) {
51
+ var filter = _ref3.filter,
52
+ name = _ref3.name;
45
53
  return filter({
46
54
  type: type,
47
55
  tags: tags,
@@ -6,6 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
7
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { ViewportUpdateClassifier } from './ViewportUpdateClassifier';
10
11
  var legacyIgnoreReasons = ['image', 'ssr-hydration', 'editor-lazy-node-view', 'editor-container-mutation'];
11
12
  export var FY24_01Classifier = /*#__PURE__*/function (_ViewportUpdateClassi) {
@@ -41,6 +42,12 @@ export var FY24_01Classifier = /*#__PURE__*/function (_ViewportUpdateClassi) {
41
42
  var v = arguments.length > 1 ? arguments[1] : undefined;
42
43
  var VCRatio = v[1] / totalPainted + acc;
43
44
  var time = v[0];
45
+ if (fg('platform_ufo_fix_vc_observer_rounding_error')) {
46
+ // @todo apply fix to include small changes into accumulator
47
+ var preciseCurrRatio = Math.round(100 * (v[1] / totalPainted));
48
+ var preciseAccRatio = Math.round(acc * 100);
49
+ VCRatio = (preciseCurrRatio + preciseAccRatio) / 100;
50
+ }
44
51
  VCParts.forEach(function (value) {
45
52
  if ((VC[value] === null || VC[value] === undefined) && VCRatio >= value / 100) {
46
53
  var _componentsLog$time;
@@ -1,11 +1,15 @@
1
- import _createClass from "@babel/runtime/helpers/createClass";
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
6
  import _inherits from "@babel/runtime/helpers/inherits";
6
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+ 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; }
9
+ 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; }
7
10
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
+ import { fg } from '@atlaskit/platform-feature-flags';
9
13
  import { FY24_01Classifier } from './fy24_01';
10
14
  export var FY25_01Classifier = /*#__PURE__*/function (_FY24_01Classifier) {
11
15
  function FY25_01Classifier() {
@@ -27,6 +31,31 @@ export var FY25_01Classifier = /*#__PURE__*/function (_FY24_01Classifier) {
27
31
  return _this;
28
32
  }
29
33
  _inherits(FY25_01Classifier, _FY24_01Classifier);
30
- return _createClass(FY25_01Classifier);
34
+ return _createClass(FY25_01Classifier, [{
35
+ key: "filterComponentsLog",
36
+ value:
37
+ // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
38
+ function filterComponentsLog(_ref2) {
39
+ var componentsLog = _ref2.componentsLog,
40
+ ttai = _ref2.ttai;
41
+ var _componentsLog = {};
42
+
43
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
44
+ if (fg('ufo-remove-vc-component-observations-after-ttai')) {
45
+ Object.entries(componentsLog).forEach(function (_ref3) {
46
+ var _ref4 = _slicedToArray(_ref3, 2),
47
+ _timestamp = _ref4[0],
48
+ value = _ref4[1];
49
+ var timestamp = Number(_timestamp);
50
+ if (ttai > timestamp) {
51
+ _componentsLog[timestamp] = value;
52
+ }
53
+ });
54
+ } else {
55
+ _componentsLog = _objectSpread({}, componentsLog);
56
+ }
57
+ return _componentsLog;
58
+ }
59
+ }]);
31
60
  }(FY24_01Classifier);
32
61
  export var revFY25_01Classifier = new FY25_01Classifier();
@@ -1,6 +1,6 @@
1
1
  import type { ComponentsLogType, MultiHeatmapPayload, VCEntryType, VCIgnoreReason, VCRatioType } from '../../../common/vc/types';
2
2
  import type { ObservedMutationType } from '../observers/types';
3
- import type { RevisionEntry, VCCalculationMethodType } from '../revisions/types';
3
+ import type { FilterComponentsLogType, RevisionEntry, VCCalculationMethodType } from '../revisions/types';
4
4
  type Viewport = {
5
5
  w: number;
6
6
  h: number;
@@ -15,11 +15,13 @@ type HeatmapAttrs = {
15
15
  arraySize?: ArraySize;
16
16
  devToolsEnabled?: boolean;
17
17
  };
18
- type Heatmap = Uint32Array;
18
+ type Heatmap = Int32Array;
19
19
  type ProcessDataArgs = {
20
20
  VCParts: number[];
21
21
  VCCalculationMethods: VCCalculationMethodType[];
22
22
  clean: boolean;
23
+ ttai: number;
24
+ filterComponentsLog: FilterComponentsLogType[];
23
25
  ssr?: number;
24
26
  };
25
27
  type PerRevision<T> = T[];
@@ -48,10 +50,10 @@ export declare class MultiRevisionHeatmap {
48
50
  constructor({ viewport, revisions, arraySize, devToolsEnabled }: HeatmapAttrs);
49
51
  handleUpdate({ time, type, classification, intersectionRect, element, targetName, ignoreReason, onError, }: HandleUpdateArgs): void;
50
52
  getData(): {
51
- heatmaps: Uint32Array[];
53
+ heatmaps: Int32Array[];
52
54
  };
53
55
  getPayloadShapedData(args: ProcessDataArgs): MultiHeatmapPayload;
54
- processData({ VCParts, VCCalculationMethods, ssr }: ProcessDataArgs): {
56
+ processData({ VCParts, VCCalculationMethods, filterComponentsLog, ttai, ssr, }: ProcessDataArgs): {
55
57
  VC: import("../revisions/types").VCType;
56
58
  VCBox: import("../revisions/types").VCBoxType;
57
59
  VCEntries: {
@@ -1,4 +1,4 @@
1
- import type { VCCalculationMethodArgs } from './types';
1
+ import type { FilterComponentsLogArgs, VCCalculationMethodArgs } from './types';
2
2
  export type FilterArgs = {
3
3
  type: string;
4
4
  tags?: string[];
@@ -22,6 +22,7 @@ export declare class ViewportUpdateClassifier {
22
22
  VC: {};
23
23
  VCBox: {};
24
24
  };
25
+ filterComponentsLog({ componentsLog }: FilterComponentsLogArgs): import("../../../common/vc/types").ComponentsLogType;
25
26
  protected __combinedTypes: string[];
26
27
  protected __combinedFilters: Filter[];
27
28
  mergeConfig(): void;
@@ -1,5 +1,7 @@
1
+ import type { ComponentsLogType } from '../../../common/vc/types';
1
2
  import { FY24_01Classifier } from './fy24_01';
2
- import { type FilterArgs } from './ViewportUpdateClassifier';
3
+ import type { FilterComponentsLogArgs } from './types';
4
+ import type { FilterArgs } from './ViewportUpdateClassifier';
3
5
  export declare class FY25_01Classifier extends FY24_01Classifier {
4
6
  revision: string;
5
7
  types: string[];
@@ -8,6 +10,7 @@ export declare class FY25_01Classifier extends FY24_01Classifier {
8
10
  filter: ({ type, ignoreReason }: FilterArgs) => boolean;
9
11
  }[];
10
12
  removedFilters: never[];
13
+ filterComponentsLog({ componentsLog, ttai }: FilterComponentsLogArgs): ComponentsLogType;
11
14
  constructor();
12
15
  }
13
16
  export declare const revFY25_01Classifier: FY25_01Classifier;
@@ -21,3 +21,8 @@ export type VCCalculationMethodReturn = {
21
21
  VCBox: VCBoxType;
22
22
  };
23
23
  export type VCCalculationMethodType = (args: VCCalculationMethodArgs) => VCCalculationMethodReturn;
24
+ export type FilterComponentsLogArgs = {
25
+ componentsLog: ComponentsLogType;
26
+ ttai: number;
27
+ };
28
+ export type FilterComponentsLogType = (args: FilterComponentsLogArgs) => ComponentsLogType;
@@ -1,6 +1,6 @@
1
1
  import type { ComponentsLogType, MultiHeatmapPayload, VCEntryType, VCIgnoreReason, VCRatioType } from '../../../common/vc/types';
2
2
  import type { ObservedMutationType } from '../observers/types';
3
- import type { RevisionEntry, VCCalculationMethodType } from '../revisions/types';
3
+ import type { FilterComponentsLogType, RevisionEntry, VCCalculationMethodType } from '../revisions/types';
4
4
  type Viewport = {
5
5
  w: number;
6
6
  h: number;
@@ -15,11 +15,13 @@ type HeatmapAttrs = {
15
15
  arraySize?: ArraySize;
16
16
  devToolsEnabled?: boolean;
17
17
  };
18
- type Heatmap = Uint32Array;
18
+ type Heatmap = Int32Array;
19
19
  type ProcessDataArgs = {
20
20
  VCParts: number[];
21
21
  VCCalculationMethods: VCCalculationMethodType[];
22
22
  clean: boolean;
23
+ ttai: number;
24
+ filterComponentsLog: FilterComponentsLogType[];
23
25
  ssr?: number;
24
26
  };
25
27
  type PerRevision<T> = T[];
@@ -48,10 +50,10 @@ export declare class MultiRevisionHeatmap {
48
50
  constructor({ viewport, revisions, arraySize, devToolsEnabled }: HeatmapAttrs);
49
51
  handleUpdate({ time, type, classification, intersectionRect, element, targetName, ignoreReason, onError, }: HandleUpdateArgs): void;
50
52
  getData(): {
51
- heatmaps: Uint32Array[];
53
+ heatmaps: Int32Array[];
52
54
  };
53
55
  getPayloadShapedData(args: ProcessDataArgs): MultiHeatmapPayload;
54
- processData({ VCParts, VCCalculationMethods, ssr }: ProcessDataArgs): {
56
+ processData({ VCParts, VCCalculationMethods, filterComponentsLog, ttai, ssr, }: ProcessDataArgs): {
55
57
  VC: import("../revisions/types").VCType;
56
58
  VCBox: import("../revisions/types").VCBoxType;
57
59
  VCEntries: {
@@ -1,4 +1,4 @@
1
- import type { VCCalculationMethodArgs } from './types';
1
+ import type { FilterComponentsLogArgs, VCCalculationMethodArgs } from './types';
2
2
  export type FilterArgs = {
3
3
  type: string;
4
4
  tags?: string[];
@@ -22,6 +22,7 @@ export declare class ViewportUpdateClassifier {
22
22
  VC: {};
23
23
  VCBox: {};
24
24
  };
25
+ filterComponentsLog({ componentsLog }: FilterComponentsLogArgs): import("../../../common/vc/types").ComponentsLogType;
25
26
  protected __combinedTypes: string[];
26
27
  protected __combinedFilters: Filter[];
27
28
  mergeConfig(): void;
@@ -1,5 +1,7 @@
1
+ import type { ComponentsLogType } from '../../../common/vc/types';
1
2
  import { FY24_01Classifier } from './fy24_01';
2
- import { type FilterArgs } from './ViewportUpdateClassifier';
3
+ import type { FilterComponentsLogArgs } from './types';
4
+ import type { FilterArgs } from './ViewportUpdateClassifier';
3
5
  export declare class FY25_01Classifier extends FY24_01Classifier {
4
6
  revision: string;
5
7
  types: string[];
@@ -8,6 +10,7 @@ export declare class FY25_01Classifier extends FY24_01Classifier {
8
10
  filter: ({ type, ignoreReason }: FilterArgs) => boolean;
9
11
  }[];
10
12
  removedFilters: never[];
13
+ filterComponentsLog({ componentsLog, ttai }: FilterComponentsLogArgs): ComponentsLogType;
11
14
  constructor();
12
15
  }
13
16
  export declare const revFY25_01Classifier: FY25_01Classifier;
@@ -21,3 +21,8 @@ export type VCCalculationMethodReturn = {
21
21
  VCBox: VCBoxType;
22
22
  };
23
23
  export type VCCalculationMethodType = (args: VCCalculationMethodArgs) => VCCalculationMethodReturn;
24
+ export type FilterComponentsLogArgs = {
25
+ componentsLog: ComponentsLogType;
26
+ ttai: number;
27
+ };
28
+ export type FilterComponentsLogType = (args: FilterComponentsLogArgs) => ComponentsLogType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "2.16.1",
3
+ "version": "3.1.0",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -74,7 +74,7 @@
74
74
  ".": "./src/index.ts"
75
75
  },
76
76
  "dependencies": {
77
- "@atlaskit/interaction-context": "^2.6.0",
77
+ "@atlaskit/interaction-context": "^3.0.0",
78
78
  "@atlaskit/platform-feature-flags": "^1.1.0",
79
79
  "@babel/runtime": "^7.0.0",
80
80
  "bind-event-listener": "^3.0.0",
@@ -83,7 +83,7 @@
83
83
  "uuid": "^3.1.0"
84
84
  },
85
85
  "peerDependencies": {
86
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
86
+ "react": "^18.2.0"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@af/integration-testing": "*",
@@ -159,6 +159,9 @@
159
159
  },
160
160
  "ufo_chr_config": {
161
161
  "type": "boolean"
162
+ },
163
+ "ufo_support_other_resource_type_js": {
164
+ "type": "boolean"
162
165
  }
163
166
  }
164
167
  }