@atlaskit/react-ufo 3.13.1 → 3.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.13.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#159817](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159817)
8
+ [`b0c2c870bc291`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b0c2c870bc291) -
9
+ [HOT-117391] Ignore mutations from data-aui-version
10
+
11
+ ## 3.13.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#159297](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159297)
16
+ [`9669e0bb8bda1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9669e0bb8bda1) -
17
+ Make VCObserverNew (TTVC v3) listens to abort events from ssr mark
18
+
3
19
  ## 3.13.1
4
20
 
5
21
  ### Patch Changes
@@ -35,7 +35,30 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
35
35
  this.oldVCObserver = new _vcObserver.VCObserver(opts);
36
36
  }
37
37
  }
38
+
39
+ // Helper method to process SSR abort listeners
38
40
  return (0, _createClass2.default)(VCObserverWrapper, [{
41
+ key: "processSsrAbortListeners",
42
+ value: function processSsrAbortListeners() {
43
+ var _window;
44
+ // Process any SSR abort listeners that remain
45
+ if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
46
+ // Clean up any event listeners that may have been registered during SSR
47
+ // This is centralized here so only the wrapper handles unbinding, not individual observers
48
+ if (window.__SSR_ABORT_LISTENERS__.unbinds && Array.isArray(window.__SSR_ABORT_LISTENERS__.unbinds)) {
49
+ window.__SSR_ABORT_LISTENERS__.unbinds.forEach(function (unbind) {
50
+ if (typeof unbind === 'function') {
51
+ unbind();
52
+ }
53
+ });
54
+ }
55
+
56
+ // After all observers had a chance to process abort events,
57
+ // we can safely delete the SSR_ABORT_LISTENERS object
58
+ delete window.__SSR_ABORT_LISTENERS__;
59
+ }
60
+ }
61
+ }, {
39
62
  key: "start",
40
63
  value: function start(_ref) {
41
64
  var startTime = _ref.startTime,
@@ -52,6 +75,9 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
52
75
  startTime: startTime
53
76
  });
54
77
  }
78
+
79
+ // Clean up any remaining SSR abort listeners after all observers have been started
80
+ this.processSsrAbortListeners();
55
81
  }
56
82
  }, {
57
83
  key: "stop",
@@ -436,7 +436,6 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
436
436
  _this.detachAbortListeners();
437
437
  var unbinds = (0, _attachAbortListeners.attachAbortListeners)(window, _this.viewport, _this.abortReasonCallback);
438
438
  if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
439
- var _window2;
440
439
  Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref11) {
441
440
  var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
442
441
  key = _ref12[0],
@@ -445,8 +444,6 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
445
444
  _this.abortReasonCallback(key, time);
446
445
  }
447
446
  });
448
- unbinds = unbinds.concat(window.__SSR_ABORT_LISTENERS__.unbinds);
449
- (_window2 = window) === null || _window2 === void 0 || delete _window2.__SSR_ABORT_LISTENERS__;
450
447
  }
451
448
  _this.unbind = unbinds;
452
449
  });
@@ -7,9 +7,12 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
16
  var _entriesTimeline = _interopRequireDefault(require("./entries-timeline"));
14
17
  var _getElementName2 = _interopRequireDefault(require("./get-element-name"));
15
18
  var _fy25_ = _interopRequireDefault(require("./metric-calculator/fy25_03"));
@@ -79,9 +82,32 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
79
82
  return (0, _createClass2.default)(VCObserverNew, [{
80
83
  key: "start",
81
84
  value: function start(_ref2) {
82
- var _this$viewportObserve, _this$windowEventObse;
85
+ var _this$viewportObserve,
86
+ _window,
87
+ _this2 = this,
88
+ _this$windowEventObse;
83
89
  var startTime = _ref2.startTime;
84
90
  (_this$viewportObserve = this.viewportObserver) === null || _this$viewportObserve === void 0 || _this$viewportObserve.start();
91
+ if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__ && (0, _platformFeatureFlags.fg)('platform_ufo_vc_observer_new_ssr_abort_listener')) {
92
+ var abortListeners = window.__SSR_ABORT_LISTENERS__;
93
+ var aborts = abortListeners.aborts;
94
+ if (aborts && (0, _typeof2.default)(aborts) === 'object') {
95
+ Object.entries(aborts).forEach(function (_ref3) {
96
+ var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
97
+ key = _ref4[0],
98
+ time = _ref4[1];
99
+ if (typeof time === 'number') {
100
+ _this2.entriesTimeline.push({
101
+ time: time,
102
+ data: {
103
+ type: 'window:event',
104
+ eventType: key
105
+ }
106
+ });
107
+ }
108
+ });
109
+ }
110
+ }
85
111
  (_this$windowEventObse = this.windowEventObserver) === null || _this$windowEventObse === void 0 || _this$windowEventObse.start();
86
112
  this.entriesTimeline.clear();
87
113
  }
@@ -10,6 +10,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
10
10
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _abstractBaseVcCalculator = _interopRequireDefault(require("../abstract-base-vc-calculator"));
14
15
  var _isViewportEntryData = _interopRequireDefault(require("../utils/is-viewport-entry-data"));
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)); }
@@ -40,6 +41,9 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
40
41
  if (!attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(attributeName)) {
41
42
  return false;
42
43
  }
44
+ if (attributeName === 'data-aui-version' && (0, _platformFeatureFlags.fg)('platform_ufo_filter_out_aui_attribute_changes')) {
45
+ return false;
46
+ }
43
47
  return true;
44
48
  }
45
49
  if ((0, _isViewportEntryData.default)(entry.data) && !entry.data.visible) {
@@ -16,6 +16,27 @@ export class VCObserverWrapper {
16
16
  this.oldVCObserver = new VCObserver(opts);
17
17
  }
18
18
  }
19
+
20
+ // Helper method to process SSR abort listeners
21
+ processSsrAbortListeners() {
22
+ var _window;
23
+ // Process any SSR abort listeners that remain
24
+ if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
25
+ // Clean up any event listeners that may have been registered during SSR
26
+ // This is centralized here so only the wrapper handles unbinding, not individual observers
27
+ if (window.__SSR_ABORT_LISTENERS__.unbinds && Array.isArray(window.__SSR_ABORT_LISTENERS__.unbinds)) {
28
+ window.__SSR_ABORT_LISTENERS__.unbinds.forEach(unbind => {
29
+ if (typeof unbind === 'function') {
30
+ unbind();
31
+ }
32
+ });
33
+ }
34
+
35
+ // After all observers had a chance to process abort events,
36
+ // we can safely delete the SSR_ABORT_LISTENERS object
37
+ delete window.__SSR_ABORT_LISTENERS__;
38
+ }
39
+ }
19
40
  start({
20
41
  startTime,
21
42
  experienceKey
@@ -32,6 +53,9 @@ export class VCObserverWrapper {
32
53
  startTime
33
54
  });
34
55
  }
56
+
57
+ // Clean up any remaining SSR abort listeners after all observers have been started
58
+ this.processSsrAbortListeners();
35
59
  }
36
60
  stop(experienceKey) {
37
61
  if (isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey)) {
@@ -468,14 +468,11 @@ export class VCObserver {
468
468
  this.detachAbortListeners();
469
469
  let unbinds = attachAbortListeners(window, this.viewport, this.abortReasonCallback);
470
470
  if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
471
- var _window2;
472
471
  Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(([key, time]) => {
473
472
  if (time) {
474
473
  this.abortReasonCallback(key, time);
475
474
  }
476
475
  });
477
- unbinds = unbinds.concat(window.__SSR_ABORT_LISTENERS__.unbinds);
478
- (_window2 = window) === null || _window2 === void 0 ? true : delete _window2.__SSR_ABORT_LISTENERS__;
479
476
  }
480
477
  this.unbind = unbinds;
481
478
  });
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import EntriesTimeline from './entries-timeline';
3
4
  import getElementName from './get-element-name';
4
5
  import VCCalculator_FY25_03 from './metric-calculator/fy25_03';
@@ -68,8 +69,25 @@ export default class VCObserverNew {
68
69
  start({
69
70
  startTime
70
71
  }) {
71
- var _this$viewportObserve, _this$windowEventObse;
72
+ var _this$viewportObserve, _window, _this$windowEventObse;
72
73
  (_this$viewportObserve = this.viewportObserver) === null || _this$viewportObserve === void 0 ? void 0 : _this$viewportObserve.start();
74
+ if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__ && fg('platform_ufo_vc_observer_new_ssr_abort_listener')) {
75
+ const abortListeners = window.__SSR_ABORT_LISTENERS__;
76
+ const aborts = abortListeners.aborts;
77
+ if (aborts && typeof aborts === 'object') {
78
+ Object.entries(aborts).forEach(([key, time]) => {
79
+ if (typeof time === 'number') {
80
+ this.entriesTimeline.push({
81
+ time,
82
+ data: {
83
+ type: 'window:event',
84
+ eventType: key
85
+ }
86
+ });
87
+ }
88
+ });
89
+ }
90
+ }
73
91
  (_this$windowEventObse = this.windowEventObserver) === null || _this$windowEventObse === void 0 ? void 0 : _this$windowEventObse.start();
74
92
  this.entriesTimeline.clear();
75
93
  }
@@ -1,3 +1,4 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  import AbstractVCCalculatorBase from '../abstract-base-vc-calculator';
2
3
  import isViewportEntryData from '../utils/is-viewport-entry-data';
3
4
  const ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
@@ -22,6 +23,9 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
22
23
  if (!attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(attributeName)) {
23
24
  return false;
24
25
  }
26
+ if (attributeName === 'data-aui-version' && fg('platform_ufo_filter_out_aui_attribute_changes')) {
27
+ return false;
28
+ }
25
29
  return true;
26
30
  }
27
31
  if (isViewportEntryData(entry.data) && !entry.data.visible) {
@@ -26,7 +26,30 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
26
26
  this.oldVCObserver = new VCObserver(opts);
27
27
  }
28
28
  }
29
+
30
+ // Helper method to process SSR abort listeners
29
31
  return _createClass(VCObserverWrapper, [{
32
+ key: "processSsrAbortListeners",
33
+ value: function processSsrAbortListeners() {
34
+ var _window;
35
+ // Process any SSR abort listeners that remain
36
+ if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
37
+ // Clean up any event listeners that may have been registered during SSR
38
+ // This is centralized here so only the wrapper handles unbinding, not individual observers
39
+ if (window.__SSR_ABORT_LISTENERS__.unbinds && Array.isArray(window.__SSR_ABORT_LISTENERS__.unbinds)) {
40
+ window.__SSR_ABORT_LISTENERS__.unbinds.forEach(function (unbind) {
41
+ if (typeof unbind === 'function') {
42
+ unbind();
43
+ }
44
+ });
45
+ }
46
+
47
+ // After all observers had a chance to process abort events,
48
+ // we can safely delete the SSR_ABORT_LISTENERS object
49
+ delete window.__SSR_ABORT_LISTENERS__;
50
+ }
51
+ }
52
+ }, {
30
53
  key: "start",
31
54
  value: function start(_ref) {
32
55
  var startTime = _ref.startTime,
@@ -43,6 +66,9 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
43
66
  startTime: startTime
44
67
  });
45
68
  }
69
+
70
+ // Clean up any remaining SSR abort listeners after all observers have been started
71
+ this.processSsrAbortListeners();
46
72
  }
47
73
  }, {
48
74
  key: "stop",
@@ -429,7 +429,6 @@ export var VCObserver = /*#__PURE__*/function () {
429
429
  _this.detachAbortListeners();
430
430
  var unbinds = attachAbortListeners(window, _this.viewport, _this.abortReasonCallback);
431
431
  if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
432
- var _window2;
433
432
  Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref11) {
434
433
  var _ref12 = _slicedToArray(_ref11, 2),
435
434
  key = _ref12[0],
@@ -438,8 +437,6 @@ export var VCObserver = /*#__PURE__*/function () {
438
437
  _this.abortReasonCallback(key, time);
439
438
  }
440
439
  });
441
- unbinds = unbinds.concat(window.__SSR_ABORT_LISTENERS__.unbinds);
442
- (_window2 = window) === null || _window2 === void 0 || delete _window2.__SSR_ABORT_LISTENERS__;
443
440
  }
444
441
  _this.unbind = unbinds;
445
442
  });
@@ -1,8 +1,11 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _typeof from "@babel/runtime/helpers/typeof";
2
4
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
5
  import _createClass from "@babel/runtime/helpers/createClass";
4
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
+ import { fg } from '@atlaskit/platform-feature-flags';
6
9
  import EntriesTimeline from './entries-timeline';
7
10
  import _getElementName from './get-element-name';
8
11
  import VCCalculator_FY25_03 from './metric-calculator/fy25_03';
@@ -72,9 +75,32 @@ var VCObserverNew = /*#__PURE__*/function () {
72
75
  return _createClass(VCObserverNew, [{
73
76
  key: "start",
74
77
  value: function start(_ref2) {
75
- var _this$viewportObserve, _this$windowEventObse;
78
+ var _this$viewportObserve,
79
+ _window,
80
+ _this2 = this,
81
+ _this$windowEventObse;
76
82
  var startTime = _ref2.startTime;
77
83
  (_this$viewportObserve = this.viewportObserver) === null || _this$viewportObserve === void 0 || _this$viewportObserve.start();
84
+ if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__ && fg('platform_ufo_vc_observer_new_ssr_abort_listener')) {
85
+ var abortListeners = window.__SSR_ABORT_LISTENERS__;
86
+ var aborts = abortListeners.aborts;
87
+ if (aborts && _typeof(aborts) === 'object') {
88
+ Object.entries(aborts).forEach(function (_ref3) {
89
+ var _ref4 = _slicedToArray(_ref3, 2),
90
+ key = _ref4[0],
91
+ time = _ref4[1];
92
+ if (typeof time === 'number') {
93
+ _this2.entriesTimeline.push({
94
+ time: time,
95
+ data: {
96
+ type: 'window:event',
97
+ eventType: key
98
+ }
99
+ });
100
+ }
101
+ });
102
+ }
103
+ }
78
104
  (_this$windowEventObse = this.windowEventObserver) === null || _this$windowEventObse === void 0 || _this$windowEventObse.start();
79
105
  this.entriesTimeline.clear();
80
106
  }
@@ -5,6 +5,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
5
  import _inherits from "@babel/runtime/helpers/inherits";
6
6
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
7
7
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import AbstractVCCalculatorBase from '../abstract-base-vc-calculator';
9
10
  import isViewportEntryData from '../utils/is-viewport-entry-data';
10
11
  var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
@@ -33,6 +34,9 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
33
34
  if (!attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(attributeName)) {
34
35
  return false;
35
36
  }
37
+ if (attributeName === 'data-aui-version' && fg('platform_ufo_filter_out_aui_attribute_changes')) {
38
+ return false;
39
+ }
36
40
  return true;
37
41
  }
38
42
  if (isViewportEntryData(entry.data) && !entry.data.visible) {
@@ -7,6 +7,7 @@ export declare class VCObserverWrapper implements VCObserverInterface {
7
7
  private oldVCObserver;
8
8
  private newVCObserver;
9
9
  constructor(opts?: VCObserverOptions);
10
+ private processSsrAbortListeners;
10
11
  start({ startTime, experienceKey }: {
11
12
  startTime: number;
12
13
  experienceKey: string;
@@ -7,6 +7,7 @@ export declare class VCObserverWrapper implements VCObserverInterface {
7
7
  private oldVCObserver;
8
8
  private newVCObserver;
9
9
  constructor(opts?: VCObserverOptions);
10
+ private processSsrAbortListeners;
10
11
  start({ startTime, experienceKey }: {
11
12
  startTime: number;
12
13
  experienceKey: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.13.1",
3
+ "version": "3.13.3",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -162,6 +162,12 @@
162
162
  },
163
163
  "platform_ufo_ttvc_v3_devtool": {
164
164
  "type": "boolean"
165
+ },
166
+ "platform_ufo_filter_out_aui_attribute_changes": {
167
+ "type": "boolean"
168
+ },
169
+ "platform_ufo_vc_observer_new_ssr_abort_listener": {
170
+ "type": "boolean"
165
171
  }
166
172
  }
167
173
  }