@atlaskit/react-ufo 3.7.0 → 3.9.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 (42) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/config/index.js +0 -9
  3. package/dist/cjs/create-payload/utils/get-vc-metrics.js +2 -2
  4. package/dist/cjs/vc/index.js +1 -1
  5. package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +5 -2
  6. package/dist/cjs/vc/vc-observer/index.js +16 -9
  7. package/dist/cjs/vc/vc-observer/observers/index.js +4 -18
  8. package/dist/cjs/vc/vc-observer/revisions/fy25_01.js +1 -1
  9. package/dist/cjs/vc/vc-observer/revisions/revisions.js +3 -2
  10. package/dist/es2019/config/index.js +0 -8
  11. package/dist/es2019/create-payload/utils/get-vc-metrics.js +2 -2
  12. package/dist/es2019/vc/index.js +2 -2
  13. package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +5 -2
  14. package/dist/es2019/vc/vc-observer/index.js +14 -7
  15. package/dist/es2019/vc/vc-observer/observers/index.js +0 -15
  16. package/dist/es2019/vc/vc-observer/revisions/fy25_01.js +1 -1
  17. package/dist/es2019/vc/vc-observer/revisions/revisions.js +3 -2
  18. package/dist/esm/config/index.js +0 -8
  19. package/dist/esm/create-payload/utils/get-vc-metrics.js +2 -2
  20. package/dist/esm/vc/index.js +1 -1
  21. package/dist/esm/vc/vc-observer/getVCRevisionsData.js +5 -2
  22. package/dist/esm/vc/vc-observer/index.js +16 -9
  23. package/dist/esm/vc/vc-observer/observers/index.js +4 -18
  24. package/dist/esm/vc/vc-observer/revisions/fy25_01.js +1 -1
  25. package/dist/esm/vc/vc-observer/revisions/revisions.js +3 -2
  26. package/dist/types/common/vc/types.d.ts +1 -1
  27. package/dist/types/config/index.d.ts +2 -3
  28. package/dist/types/vc/vc-observer/observers/index.d.ts +0 -1
  29. package/dist/types-ts4.5/common/vc/types.d.ts +1 -1
  30. package/dist/types-ts4.5/config/index.d.ts +2 -3
  31. package/dist/types-ts4.5/vc/vc-observer/observers/index.d.ts +0 -1
  32. package/package.json +1 -4
  33. package/dist/cjs/vc/vc-observer/observers/editor-lnv/index.js +0 -186
  34. package/dist/cjs/vc/vc-observer/observers/editor-lnv/test-utils.js +0 -68
  35. package/dist/es2019/vc/vc-observer/observers/editor-lnv/index.js +0 -140
  36. package/dist/es2019/vc/vc-observer/observers/editor-lnv/test-utils.js +0 -41
  37. package/dist/esm/vc/vc-observer/observers/editor-lnv/index.js +0 -180
  38. package/dist/esm/vc/vc-observer/observers/editor-lnv/test-utils.js +0 -58
  39. package/dist/types/vc/vc-observer/observers/editor-lnv/index.d.ts +0 -24
  40. package/dist/types/vc/vc-observer/observers/editor-lnv/test-utils.d.ts +0 -35
  41. package/dist/types-ts4.5/vc/vc-observer/observers/editor-lnv/index.d.ts +0 -24
  42. package/dist/types-ts4.5/vc/vc-observer/observers/editor-lnv/test-utils.d.ts +0 -35
@@ -3,6 +3,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
3
3
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
4
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { getConfig } from '../../config';
6
7
  import { getPageVisibilityState } from '../../hidden-timing';
7
8
  import { getRevisions } from './revisions/revisions';
8
9
  var VCParts = ['25', '50', '75', '80', '85', '90', '95', '98', '99'];
@@ -38,6 +39,7 @@ function createVCDetails(calculatedVC, shouldHaveVCmetric) {
38
39
 
39
40
  // Optimized implementation (current one)
40
41
  export function getVCRevisionsData(_ref) {
42
+ var _ufoConfig$vc, _ufoConfig$vc2;
41
43
  var fullPrefix = _ref.fullPrefix,
42
44
  interaction = _ref.interaction,
43
45
  isVCClean = _ref.isVCClean,
@@ -46,7 +48,8 @@ export function getVCRevisionsData(_ref) {
46
48
  ssr = _ref.ssr,
47
49
  calculatedVC = _ref.calculatedVC,
48
50
  calculatedVCNext = _ref.calculatedVCNext;
49
- if (!fg('platform_ufo_vc_observer_new')) {
51
+ var ufoConfig = getConfig();
52
+ if (!fg('platform_ufo_vc_observer_new') && !(ufoConfig !== null && ufoConfig !== void 0 && (_ufoConfig$vc = ufoConfig.vc) !== null && _ufoConfig$vc !== void 0 && (_ufoConfig$vc = _ufoConfig$vc.enabledVCRevisions) !== null && _ufoConfig$vc !== void 0 && _ufoConfig$vc.includes('fy25.03'))) {
50
53
  if (!multiHeatmap) {
51
54
  return null;
52
55
  }
@@ -82,7 +85,7 @@ export function getVCRevisionsData(_ref) {
82
85
  'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
83
86
  vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
84
87
  };
85
- if (fg('platform_ufo_disable_ttvc_v1')) {
88
+ if (!(ufoConfig !== null && ufoConfig !== void 0 && (_ufoConfig$vc2 = ufoConfig.vc) !== null && _ufoConfig$vc2 !== void 0 && (_ufoConfig$vc2 = _ufoConfig$vc2.enabledVCRevisions) !== null && _ufoConfig$vc2 !== void 0 && _ufoConfig$vc2.includes('fy25.01'))) {
86
89
  return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [ttvcV2Revision]);
87
90
  }
88
91
 
@@ -10,6 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
+ import { getConfig } from '../../config';
13
14
  import { attachAbortListeners } from './attachAbortListeners';
14
15
  import { getVCRevisionsData } from './getVCRevisionsData';
15
16
  import { getViewportHeight, getViewportWidth } from './getViewport';
@@ -37,7 +38,8 @@ function filterComponentsLog(log) {
37
38
  }
38
39
  export var VCObserver = /*#__PURE__*/function () {
39
40
  function VCObserver(options) {
40
- var _this = this;
41
+ var _this = this,
42
+ _getConfig5;
41
43
  _classCallCheck(this, VCObserver);
42
44
  /* abort logic */
43
45
  _defineProperty(this, "abortReason", {
@@ -97,7 +99,8 @@ export var VCObserver = /*#__PURE__*/function () {
97
99
  });
98
100
  _defineProperty(this, "getVCResult", /*#__PURE__*/function () {
99
101
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
100
- var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, isTTVCv1Disabled, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, isVCClean, revisionsData, isCalcSpeedIndexEnabled, speedIndex;
102
+ var _getConfig, _getConfig2;
103
+ var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, isTTVCv1Disabled, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, isVCClean, revisionsData, isCalcSpeedIndexEnabled, speedIndex, isTTVCv3Enabled;
101
104
  return _regeneratorRuntime.wrap(function _callee$(_context) {
102
105
  while (1) switch (_context.prev = _context.next) {
103
106
  case 0:
@@ -124,7 +127,7 @@ export var VCObserver = /*#__PURE__*/function () {
124
127
  } catch (e) {}
125
128
  return _context.abrupt("return", _defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReasonInfo), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp));
126
129
  case 10:
127
- isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
130
+ isTTVCv1Disabled = !((_getConfig = getConfig()) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.vc) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.enabledVCRevisions) !== null && _getConfig !== void 0 && _getConfig.includes('fy25.01'));
128
131
  ttvcV1Result = isTTVCv1Disabled ? {
129
132
  VC: {},
130
133
  VCBox: {},
@@ -282,10 +285,11 @@ export var VCObserver = /*#__PURE__*/function () {
282
285
  }
283
286
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
284
287
  case 26:
288
+ isTTVCv3Enabled = fg('platform_ufo_vc_observer_new') || ((_getConfig2 = getConfig()) === null || _getConfig2 === void 0 || (_getConfig2 = _getConfig2.vc) === null || _getConfig2 === void 0 || (_getConfig2 = _getConfig2.enabledVCRevisions) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.includes('fy25.03'));
285
289
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
286
290
  'metrics:vc': VC
287
- }, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), fg('platform_ufo_vc_observer_new') ? undefined : VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), fg('platform_ufo_vc_observer_new') ? undefined : vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
288
- case 27:
291
+ }, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), isTTVCv3Enabled ? undefined : VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), isTTVCv3Enabled ? undefined : vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
292
+ case 28:
289
293
  case "end":
290
294
  return _context.stop();
291
295
  }
@@ -296,9 +300,10 @@ export var VCObserver = /*#__PURE__*/function () {
296
300
  };
297
301
  }());
298
302
  _defineProperty(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) {
303
+ var _getConfig3;
299
304
  _this.measureStart();
300
305
  _this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue);
301
- if (!fg('platform_ufo_vc_observer_new')) {
306
+ if (!fg('platform_ufo_vc_observer_new') && !((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.vc) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.enabledVCRevisions) !== null && _getConfig3 !== void 0 && _getConfig3.includes('fy25.03'))) {
302
307
  _this.onViewportChangeDetected({
303
308
  timestamp: rawTime,
304
309
  intersectionRect: intersectionRect,
@@ -315,13 +320,14 @@ export var VCObserver = /*#__PURE__*/function () {
315
320
  });
316
321
  _defineProperty(this, "legacyHandleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) {
317
322
  if (_this.abortReason.reason === null || _this.abortReason.blocking === false) {
323
+ var _getConfig4;
318
324
  var time = Math.round(rawTime - _this.startTime);
319
325
  var mappedValues = _this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
320
326
  _this.vcRatios[targetName] = _this.getElementRatio(mappedValues);
321
327
  if (!ignoreReason) {
322
328
  _this.applyChangesToHeatMap(mappedValues, time, _this.heatmapNext);
323
329
  }
324
- var isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
330
+ var isTTVCv1Disabled = !((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.vc) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.enabledVCRevisions) !== null && _getConfig4 !== void 0 && _getConfig4.includes('fy25.01'));
325
331
  if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
326
332
  _this.applyChangesToHeatMap(mappedValues, time, _this.heatmap);
327
333
  }
@@ -459,7 +465,7 @@ export var VCObserver = /*#__PURE__*/function () {
459
465
  dataVC: true
460
466
  }
461
467
  });
462
- this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
468
+ this.heatmap = !((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.vc) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.enabledVCRevisions) !== null && _getConfig5 !== void 0 && _getConfig5.includes('fy25.01')) ? [] : this.getCleanHeatmap();
463
469
  this.heatmapNext = this.getCleanHeatmap();
464
470
  this.multiHeatmap = new MultiRevisionHeatmap({
465
471
  viewport: this.viewport,
@@ -539,6 +545,7 @@ export var VCObserver = /*#__PURE__*/function () {
539
545
  }, {
540
546
  key: "resetState",
541
547
  value: function resetState() {
548
+ var _getConfig6;
542
549
  this.abortReason = {
543
550
  reason: null,
544
551
  info: '',
@@ -546,7 +553,7 @@ export var VCObserver = /*#__PURE__*/function () {
546
553
  blocking: false
547
554
  };
548
555
  this.detachAbortListeners();
549
- this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
556
+ this.heatmap = !((_getConfig6 = getConfig()) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.vc) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.enabledVCRevisions) !== null && _getConfig6 !== void 0 && _getConfig6.includes('fy25.01')) ? [] : this.getCleanHeatmap();
550
557
  this.heatmapNext = this.getCleanHeatmap();
551
558
  this.multiHeatmap = new MultiRevisionHeatmap({
552
559
  viewport: this.viewport,
@@ -4,9 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  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; }
5
5
  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; }
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
- import { shouldHandleEditorLnv } from '../../../config';
8
7
  import { isContainedWithinMediaWrapper } from '../media-wrapper/vc-utils';
9
- import { EditorLnvHandler } from './editor-lnv';
10
8
  import isNonVisualStyleMutation from './non-visual-styles/is-non-visual-style-mutation';
11
9
  import { SSRPlaceholderHandlers } from './ssr-placeholders';
12
10
  var state = {
@@ -76,7 +74,6 @@ export var Observers = /*#__PURE__*/function () {
76
74
  this.intersectionObserver = this.getIntersectionObserver();
77
75
  this.mutationObserver = this.getMutationObserver();
78
76
  this.ssrPlaceholderHandler = new SSRPlaceholderHandlers();
79
- this.editorLnvHandler = new EditorLnvHandler();
80
77
  }
81
78
  return _createClass(Observers, [{
82
79
  key: "isBrowserSupported",
@@ -113,7 +110,6 @@ export var Observers = /*#__PURE__*/function () {
113
110
  this.callbacks = new Set();
114
111
  this.ssr.reactRootElement = null;
115
112
  this.ssrPlaceholderHandler.clear();
116
- this.editorLnvHandler.clear();
117
113
  }
118
114
  }, {
119
115
  key: "getTotalTime",
@@ -145,7 +141,6 @@ export var Observers = /*#__PURE__*/function () {
145
141
  if (!this.isBrowserSupported()) {
146
142
  return null;
147
143
  }
148
- var shouldHandleEditorLnvLocal = shouldHandleEditorLnv();
149
144
  return new MutationObserver(function (mutations) {
150
145
  _this2.measureStart();
151
146
  mutations.forEach(function (mutation) {
@@ -191,15 +186,6 @@ export var Observers = /*#__PURE__*/function () {
191
186
  });
192
187
  return;
193
188
  }
194
- if (shouldHandleEditorLnvLocal) {
195
- if (_this2.editorLnvHandler.shouldHandleAddedNode(node)) {
196
- _this2.editorLnvHandler.handleAddedNode(node).then(function (_ref) {
197
- var shouldIgnore = _ref.shouldIgnore;
198
- _this2.observeElement(node, mutation, 'html', shouldIgnore ? 'editor-lazy-node-view' : ignoreReason);
199
- });
200
- return;
201
- }
202
- }
203
189
  _this2.observeElement(node, mutation, 'html', ignoreReason);
204
190
  }
205
191
  if (node instanceof Text && node.parentElement != null) {
@@ -277,10 +263,10 @@ export var Observers = /*#__PURE__*/function () {
277
263
  }
278
264
  return new IntersectionObserver(function (entries) {
279
265
  _this3.measureStart();
280
- entries.forEach(function (_ref2) {
281
- var isIntersecting = _ref2.isIntersecting,
282
- ir = _ref2.intersectionRect,
283
- target = _ref2.target;
266
+ entries.forEach(function (_ref) {
267
+ var isIntersecting = _ref.isIntersecting,
268
+ ir = _ref.intersectionRect,
269
+ target = _ref.target;
284
270
  var data = _this3.observedMutations.get(target);
285
271
  _this3.observedMutations.delete(target);
286
272
  if (isIntersecting && ir.width > 0 && ir.height > 0) {
@@ -7,7 +7,7 @@ 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
9
  import { ViewportUpdateClassifier } from './ViewportUpdateClassifier';
10
- var legacyIgnoreReasons = ['image', 'ssr-hydration', 'editor-lazy-node-view'];
10
+ var legacyIgnoreReasons = ['image', 'ssr-hydration'];
11
11
  export var FY25_01Classifier = /*#__PURE__*/function (_ViewportUpdateClassi) {
12
12
  function FY25_01Classifier() {
13
13
  var _this;
@@ -1,8 +1,9 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
1
+ import { getConfig } from '../../../config';
2
2
  import { revFY25_01Classifier } from './fy25_01';
3
3
  import { revFY25_02Classifier } from './fy25_02';
4
4
  export function getRevisions() {
5
- if (fg('platform_ufo_disable_ttvc_v1')) {
5
+ var _getConfig;
6
+ if (!((_getConfig = getConfig()) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.vc) !== null && _getConfig !== void 0 && (_getConfig = _getConfig.enabledVCRevisions) !== null && _getConfig !== void 0 && _getConfig.includes('fy25.01'))) {
6
7
  return [{
7
8
  name: 'fy25.02',
8
9
  classifier: revFY25_02Classifier
@@ -37,7 +37,7 @@ export type VCEntryType = {
37
37
  vc: number;
38
38
  elements: string[];
39
39
  };
40
- export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | 'non-visual-style' | '';
40
+ export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'not-visible' | 'non-visual-style' | '';
41
41
  export type ComponentsLogEntry = {
42
42
  type?: string;
43
43
  targetName: string;
@@ -27,6 +27,7 @@ type SelectorConfig = {
27
27
  type Rates = {
28
28
  readonly [key: string]: number;
29
29
  };
30
+ type TTVCRevisions = 'fy25.01' | 'fy25.02' | 'fy25.03';
30
31
  export type Config = {
31
32
  readonly enabled?: boolean;
32
33
  readonly doNotAbortActivePressInteraction?: string[];
@@ -73,7 +74,7 @@ export type Config = {
73
74
  readonly ssr?: boolean;
74
75
  readonly ssrWhitelist?: string[];
75
76
  readonly stopVCAtInteractionFinish?: boolean;
76
- readonly enableVCObserverNew?: boolean;
77
+ readonly enabledVCRevisions?: readonly TTVCRevisions[];
77
78
  };
78
79
  readonly postInteractionLog?: {
79
80
  readonly enabled?: boolean;
@@ -90,7 +91,6 @@ export type Config = {
90
91
  readonly shouldCalculateLighthouseMetricsFromTTAI?: boolean;
91
92
  readonly timeWindowForLateMutationsInMilliseconds?: number;
92
93
  readonly manuallyTrackReactProfilerMounts?: boolean;
93
- readonly enableEditorLnvHandler?: boolean;
94
94
  /**
95
95
  * @private
96
96
  * @deprecated setting this will do nothing now
@@ -112,5 +112,4 @@ export declare function getRemoveInteractionsUFOPrefixes(): boolean;
112
112
  export declare function getUfoNameOverrides(): UFONameOverride | undefined;
113
113
  export declare function getDoNotAbortActivePressInteraction(): string[] | undefined;
114
114
  export declare function getDoNotAbortActivePressInteractionOnTransition(): string[] | undefined;
115
- export declare function shouldHandleEditorLnv(): boolean;
116
115
  export {};
@@ -19,7 +19,6 @@ export declare class Observers implements BrowserObservers {
19
19
  private totalTime;
20
20
  private _startMeasureTimestamp;
21
21
  private ssrPlaceholderHandler;
22
- private editorLnvHandler;
23
22
  private ssr;
24
23
  private selectorConfig;
25
24
  constructor(opts: ConstructorOptions);
@@ -37,7 +37,7 @@ export type VCEntryType = {
37
37
  vc: number;
38
38
  elements: string[];
39
39
  };
40
- export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | 'non-visual-style' | '';
40
+ export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'not-visible' | 'non-visual-style' | '';
41
41
  export type ComponentsLogEntry = {
42
42
  type?: string;
43
43
  targetName: string;
@@ -27,6 +27,7 @@ type SelectorConfig = {
27
27
  type Rates = {
28
28
  readonly [key: string]: number;
29
29
  };
30
+ type TTVCRevisions = 'fy25.01' | 'fy25.02' | 'fy25.03';
30
31
  export type Config = {
31
32
  readonly enabled?: boolean;
32
33
  readonly doNotAbortActivePressInteraction?: string[];
@@ -73,7 +74,7 @@ export type Config = {
73
74
  readonly ssr?: boolean;
74
75
  readonly ssrWhitelist?: string[];
75
76
  readonly stopVCAtInteractionFinish?: boolean;
76
- readonly enableVCObserverNew?: boolean;
77
+ readonly enabledVCRevisions?: readonly TTVCRevisions[];
77
78
  };
78
79
  readonly postInteractionLog?: {
79
80
  readonly enabled?: boolean;
@@ -90,7 +91,6 @@ export type Config = {
90
91
  readonly shouldCalculateLighthouseMetricsFromTTAI?: boolean;
91
92
  readonly timeWindowForLateMutationsInMilliseconds?: number;
92
93
  readonly manuallyTrackReactProfilerMounts?: boolean;
93
- readonly enableEditorLnvHandler?: boolean;
94
94
  /**
95
95
  * @private
96
96
  * @deprecated setting this will do nothing now
@@ -116,5 +116,4 @@ export declare function getRemoveInteractionsUFOPrefixes(): boolean;
116
116
  export declare function getUfoNameOverrides(): UFONameOverride | undefined;
117
117
  export declare function getDoNotAbortActivePressInteraction(): string[] | undefined;
118
118
  export declare function getDoNotAbortActivePressInteractionOnTransition(): string[] | undefined;
119
- export declare function shouldHandleEditorLnv(): boolean;
120
119
  export {};
@@ -19,7 +19,6 @@ export declare class Observers implements BrowserObservers {
19
19
  private totalTime;
20
20
  private _startMeasureTimestamp;
21
21
  private ssrPlaceholderHandler;
22
- private editorLnvHandler;
23
22
  private ssr;
24
23
  private selectorConfig;
25
24
  constructor(opts: ConstructorOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.7.0",
3
+ "version": "3.9.0",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -157,9 +157,6 @@
157
157
  "ufo_payload_use_idle_callback": {
158
158
  "type": "boolean"
159
159
  },
160
- "platform_ufo_disable_ttvc_v1": {
161
- "type": "boolean"
162
- },
163
160
  "platform_ufo_assets_check_for_nan": {
164
161
  "type": "boolean"
165
162
  },
@@ -1,186 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.EditorLnvHandler = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var placeholderDataKey = 'editorLnvPlaceholder'; // data-editor-lnv-placeholder
12
- var replaceDataKey = 'editorLnvPlaceholderReplace'; // data-editor-lnv-placeholder-replace
13
- var EditorLnvHandler = exports.EditorLnvHandler = /*#__PURE__*/function () {
14
- function EditorLnvHandler() {
15
- var _this = this;
16
- (0, _classCallCheck2.default)(this, EditorLnvHandler);
17
- (0, _defineProperty2.default)(this, "placeholders", new Map());
18
- (0, _defineProperty2.default)(this, "getSizeCallbacks", new Map());
19
- (0, _defineProperty2.default)(this, "isAddedPlaceholderMatchingSizeCallbacks", new Map());
20
- (0, _defineProperty2.default)(this, "isAddedReplaceMatchingSizeCallbacks", new Map());
21
- (0, _defineProperty2.default)(this, "intersectionObserverCallback", function (_ref) {
22
- var _target$dataset, _target$dataset2;
23
- var target = _ref.target,
24
- boundingClientRect = _ref.boundingClientRect;
25
- _this.intersectionObserver.unobserve(target);
26
- if (!(target instanceof HTMLElement)) {
27
- return;
28
- }
29
- var placeholderId = (_target$dataset = target.dataset) === null || _target$dataset === void 0 ? void 0 : _target$dataset[placeholderDataKey];
30
- if (placeholderId && _this.getSizeCallbacks.has(placeholderId)) {
31
- var _resolve = _this.getSizeCallbacks.get(placeholderId);
32
- _this.getSizeCallbacks.delete(placeholderId);
33
- if (!_resolve) {
34
- return;
35
- }
36
- _resolve({
37
- x: boundingClientRect.x,
38
- y: boundingClientRect.y,
39
- width: boundingClientRect.width,
40
- height: boundingClientRect.height
41
- });
42
- return;
43
- }
44
- if (placeholderId && _this.isAddedPlaceholderMatchingSizeCallbacks.has(placeholderId)) {
45
- var _resolve2 = _this.isAddedPlaceholderMatchingSizeCallbacks.get(placeholderId);
46
- _this.isAddedPlaceholderMatchingSizeCallbacks.delete(placeholderId);
47
- if (!_resolve2) {
48
- return;
49
- }
50
- var placeholder = _this.placeholders.get(placeholderId);
51
- if (!placeholder) {
52
- _resolve2(false);
53
- return;
54
- }
55
- _resolve2(_this.areRectsSameSize(placeholder, boundingClientRect));
56
- return;
57
- }
58
- var replaceId = (_target$dataset2 = target.dataset) === null || _target$dataset2 === void 0 ? void 0 : _target$dataset2[replaceDataKey];
59
- if (replaceId && _this.isAddedReplaceMatchingSizeCallbacks.has(replaceId)) {
60
- var _resolve3 = _this.isAddedReplaceMatchingSizeCallbacks.get(replaceId);
61
- _this.isAddedReplaceMatchingSizeCallbacks.delete(replaceId);
62
- if (!_resolve3) {
63
- return;
64
- }
65
- var _placeholder = _this.placeholders.get(replaceId);
66
- if (!_placeholder) {
67
- _resolve3(false);
68
- return;
69
- }
70
- _this.placeholders.delete(replaceId);
71
- _resolve3(_this.areRectsSameSize(_placeholder, boundingClientRect));
72
- return;
73
- }
74
- });
75
- this.intersectionObserver = new IntersectionObserver(function (entries) {
76
- return entries.filter(function (entry) {
77
- return entry.intersectionRatio > 0;
78
- }).forEach(_this.intersectionObserverCallback);
79
- });
80
- }
81
- return (0, _createClass2.default)(EditorLnvHandler, [{
82
- key: "shouldHandleAddedNode",
83
- value: function shouldHandleAddedNode(el) {
84
- var _el$dataset, _el$dataset2;
85
- return ((_el$dataset = el.dataset) === null || _el$dataset === void 0 ? void 0 : _el$dataset[placeholderDataKey]) || ((_el$dataset2 = el.dataset) === null || _el$dataset2 === void 0 ? void 0 : _el$dataset2[replaceDataKey]);
86
- }
87
- }, {
88
- key: "handleAddedNode",
89
- value: function handleAddedNode(el) {
90
- var _el$dataset3, _el$dataset4;
91
- // If it placeholder does not already exist, add it to the map
92
- var placeholderId = (_el$dataset3 = el.dataset) === null || _el$dataset3 === void 0 ? void 0 : _el$dataset3[placeholderDataKey];
93
- if (placeholderId) {
94
- return this.handleAddedPlaceholderNode(el, placeholderId);
95
- }
96
- var replaceId = (_el$dataset4 = el.dataset) === null || _el$dataset4 === void 0 ? void 0 : _el$dataset4[replaceDataKey];
97
- if (replaceId) {
98
- return this.handleAddedReplaceNode(el, replaceId);
99
- }
100
- return Promise.resolve({
101
- shouldIgnore: false
102
- });
103
- }
104
- }, {
105
- key: "clear",
106
- value: function clear() {
107
- this.placeholders.clear();
108
- this.intersectionObserver.disconnect();
109
- }
110
- }, {
111
- key: "handleAddedPlaceholderNode",
112
- value: function handleAddedPlaceholderNode(el, placeholderId) {
113
- if (this.isExistingPlaceholder(placeholderId)) {
114
- return this.isAddedPlaceholderMatchingSize(el, placeholderId).then(function (isMatching) {
115
- return {
116
- shouldIgnore: isMatching
117
- };
118
- });
119
- }
120
- return this.registerPlaceholder(el, placeholderId).then(function () {
121
- return {
122
- shouldIgnore: false
123
- };
124
- });
125
- }
126
- }, {
127
- key: "handleAddedReplaceNode",
128
- value: function handleAddedReplaceNode(el, placeholderId) {
129
- if (this.isExistingPlaceholder(placeholderId)) {
130
- return this.isAddedReplaceMatchingSize(el, placeholderId).then(function (isMatching) {
131
- return {
132
- shouldIgnore: isMatching
133
- };
134
- });
135
- }
136
- return Promise.resolve({
137
- shouldIgnore: false
138
- });
139
- }
140
- }, {
141
- key: "isExistingPlaceholder",
142
- value: function isExistingPlaceholder(placeholderId) {
143
- return this.placeholders.has(placeholderId);
144
- }
145
- }, {
146
- key: "registerPlaceholder",
147
- value: function registerPlaceholder(el, placeholderId) {
148
- var _this2 = this;
149
- return this.getSize(el, placeholderId).then(function (size) {
150
- _this2.placeholders.set(placeholderId, size);
151
- });
152
- }
153
- }, {
154
- key: "getSize",
155
- value: function getSize(el, placeholderId) {
156
- var _this3 = this;
157
- return new Promise(function (resolve) {
158
- _this3.getSizeCallbacks.set(placeholderId, resolve);
159
- _this3.intersectionObserver.observe(el);
160
- });
161
- }
162
- }, {
163
- key: "isAddedPlaceholderMatchingSize",
164
- value: function isAddedPlaceholderMatchingSize(el, placeholderId) {
165
- var _this4 = this;
166
- return new Promise(function (resolve) {
167
- _this4.isAddedPlaceholderMatchingSizeCallbacks.set(placeholderId, resolve);
168
- _this4.intersectionObserver.observe(el);
169
- });
170
- }
171
- }, {
172
- key: "isAddedReplaceMatchingSize",
173
- value: function isAddedReplaceMatchingSize(el, placeholderId) {
174
- var _this5 = this;
175
- return new Promise(function (resolve) {
176
- _this5.isAddedReplaceMatchingSizeCallbacks.set(placeholderId, resolve);
177
- _this5.intersectionObserver.observe(el);
178
- });
179
- }
180
- }, {
181
- key: "areRectsSameSize",
182
- value: function areRectsSameSize(a, b) {
183
- return Math.abs(a.width - b.width) < 1 && Math.abs(a.height - b.height) < 1;
184
- }
185
- }]);
186
- }();
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createMockIntersectionObserver = createMockIntersectionObserver;
8
- exports.createPlaceholderElement = createPlaceholderElement;
9
- exports.createReplaceElement = createReplaceElement;
10
- exports.handleElements = handleElements;
11
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
14
- var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
15
- 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; }
16
- 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; }
17
- function createPlaceholderElement(id) {
18
- var el = document.createElement('div');
19
- el.dataset.editorLnvPlaceholder = id;
20
- return el;
21
- }
22
- function createReplaceElement(id) {
23
- var el = document.createElement('div');
24
- el.dataset.editorLnvPlaceholderReplace = id;
25
- return el;
26
- }
27
- function handleElements(elements, handler, observerCallback, callback) {
28
- var _elements = (0, _toArray2.default)(elements),
29
- first = _elements[0],
30
- rest = _elements.slice(1);
31
- handler.handleAddedNode(first.element).then(function (result) {
32
- if (!rest.length) {
33
- // Recursion terminating condition
34
- callback(result);
35
- } else {
36
- // Recursively handle the rest of the elements
37
- handleElements(rest, handler, observerCallback, callback);
38
- }
39
- });
40
- observerCallback([{
41
- target: first.element,
42
- boundingClientRect: first.rect
43
- }]);
44
- }
45
- function createMockIntersectionObserver(cbRef) {
46
- return /*#__PURE__*/function () {
47
- function _class(fn) {
48
- (0, _classCallCheck2.default)(this, _class);
49
- cbRef.current = function (entries) {
50
- return fn(entries.map(function (entry) {
51
- return _objectSpread(_objectSpread({}, entry), {}, {
52
- intersectionRatio: 1
53
- });
54
- }));
55
- };
56
- }
57
- return (0, _createClass2.default)(_class, [{
58
- key: "observe",
59
- value: function observe() {}
60
- }, {
61
- key: "unobserve",
62
- value: function unobserve() {}
63
- }, {
64
- key: "disconnect",
65
- value: function disconnect() {}
66
- }]);
67
- }();
68
- }