@atlaskit/react-ufo 4.11.6 → 4.11.8

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.
@@ -1,5 +1,4 @@
1
1
  import { v4 as createUUID } from 'uuid';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import coinflip from '../../coinflip';
4
3
  import { getDoNotAbortActivePressInteraction, getInteractionRate, getMinorInteractions } from '../../config';
5
4
  import { getActiveTrace, setInteractionActiveTrace } from '../../experience-trace-id-context';
@@ -7,33 +6,20 @@ import { DefaultInteractionID } from '../../interaction-id-context';
7
6
  import { abortAll, addNewInteraction, getActiveInteraction } from '../../interaction-metrics';
8
7
  import UFORouteName from '../../route-name-context';
9
8
  function traceUFOInteraction(name, interactionType, startTime) {
9
+ var _getMinorInteractions;
10
10
  var rate = getInteractionRate(name, interactionType);
11
11
  var pressInteractionsList = getDoNotAbortActivePressInteraction();
12
- if (fg('platform_ufo_enable_minor_interactions')) {
13
- var _getMinorInteractions;
14
- var minorInteractions = (pressInteractionsList !== null && pressInteractionsList !== void 0 ? pressInteractionsList : []).concat((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []);
15
- if (minorInteractions.includes(name)) {
16
- var _activeInteraction$mi;
17
- var activeInteraction = getActiveInteraction();
18
- activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
19
- name: name,
20
- startTime: startTime !== null && startTime !== void 0 ? startTime : performance.now()
21
- });
22
- return;
23
- } else {
24
- abortAll('new_interaction', name);
25
- }
12
+ var minorInteractions = (pressInteractionsList !== null && pressInteractionsList !== void 0 ? pressInteractionsList : []).concat((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []);
13
+ if (minorInteractions.includes(name)) {
14
+ var _activeInteraction$mi;
15
+ var activeInteraction = getActiveInteraction();
16
+ activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
17
+ name: name,
18
+ startTime: startTime !== null && startTime !== void 0 ? startTime : performance.now()
19
+ });
20
+ return;
26
21
  } else {
27
- if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
28
- var interaction = getActiveInteraction();
29
- if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
30
- return;
31
- }
32
- } else {
33
- // Abort any existing interaction regardless of the coinflip outcome
34
- // Ensures measurements are not carried over between distinct interactions
35
- abortAll('new_interaction', name);
36
- }
22
+ abortAll('new_interaction', name);
37
23
  }
38
24
  if (coinflip(rate)) {
39
25
  var startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
@@ -267,12 +267,8 @@ var VCObserverNew = /*#__PURE__*/function () {
267
267
  }
268
268
 
269
269
  // TODO on cleanup: put behind `enabledVCRevisions` config
270
- if (!fg('platform_ufo_vcnext_v4_enabled')) {
271
- _context.next = 16;
272
- break;
273
- }
274
270
  calculator_next = new VCNextCalculator();
275
- _context.next = 14;
271
+ _context.next = 13;
276
272
  return calculator_next.calculate({
277
273
  orderedEntries: orderedEntries,
278
274
  startTime: start,
@@ -285,14 +281,13 @@ var VCObserverNew = /*#__PURE__*/function () {
285
281
  isPageVisible: isPageVisible,
286
282
  interactionAbortReason: interactionAbortReason
287
283
  });
288
- case 14:
284
+ case 13:
289
285
  vcNext = _context.sent;
290
286
  if (vcNext) {
291
287
  results.push(vcNext);
292
288
  }
293
- case 16:
294
289
  return _context.abrupt("return", results);
295
- case 17:
290
+ case 16:
296
291
  case "end":
297
292
  return _context.stop();
298
293
  }
@@ -90,7 +90,7 @@ var ViewportObserver = /*#__PURE__*/function () {
90
90
  _iterator = _createForOfIteratorHelper(addedNodes);
91
91
  _context2.prev = 4;
92
92
  _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
93
- var addedNodeRef, addedNode, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _checkWithinComponent, isWithinThirdPartySegment, _this$intersectionObs7, _iterator2, _step2, _step2$value, isDisplayContentsElementChildren, element, _this$intersectionObs8, _this$intersectionObs9, _this$intersectionObs0;
93
+ var addedNodeRef, addedNode, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _checkWithinComponent, isWithinThirdPartySegment, _this$intersectionObs7, _iterator2, _step2, _step2$value, isDisplayContentsElementChildren, element, _this$intersectionObs8, _this$intersectionObs9;
94
94
  return _regeneratorRuntime.wrap(function _loop$(_context) {
95
95
  while (1) switch (_context.prev = _context.next) {
96
96
  case 0:
@@ -202,26 +202,22 @@ var ViewportObserver = /*#__PURE__*/function () {
202
202
  (_this$intersectionObs7 = _this.intersectionObserver) === null || _this$intersectionObs7 === void 0 || _this$intersectionObs7.watchAndTag(addedNode, 'mutation:third-party-element');
203
203
  return _context.abrupt("return", 0);
204
204
  case 45:
205
- if (fg('platform_ufo_vcnext_v4_enabled')) {
206
- _iterator2 = _createForOfIteratorHelper(getMutatedElements(addedNode));
207
- try {
208
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
209
- _step2$value = _step2.value, isDisplayContentsElementChildren = _step2$value.isDisplayContentsElementChildren, element = _step2$value.element;
210
- if (isDisplayContentsElementChildren) {
211
- (_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
212
- } else {
213
- (_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
214
- }
205
+ _iterator2 = _createForOfIteratorHelper(getMutatedElements(addedNode));
206
+ try {
207
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
208
+ _step2$value = _step2.value, isDisplayContentsElementChildren = _step2$value.isDisplayContentsElementChildren, element = _step2$value.element;
209
+ if (isDisplayContentsElementChildren) {
210
+ (_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
211
+ } else {
212
+ (_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
215
213
  }
216
- } catch (err) {
217
- _iterator2.e(err);
218
- } finally {
219
- _iterator2.f();
220
214
  }
221
- } else {
222
- (_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
215
+ } catch (err) {
216
+ _iterator2.e(err);
217
+ } finally {
218
+ _iterator2.f();
223
219
  }
224
- case 46:
220
+ case 47:
225
221
  case "end":
226
222
  return _context.stop();
227
223
  }
@@ -266,12 +262,12 @@ var ViewportObserver = /*#__PURE__*/function () {
266
262
  };
267
263
  }());
268
264
  _defineProperty(this, "handleAttributeMutation", function (_ref6) {
269
- var _this$intersectionObs1;
265
+ var _this$intersectionObs0;
270
266
  var target = _ref6.target,
271
267
  attributeName = _ref6.attributeName,
272
268
  oldValue = _ref6.oldValue,
273
269
  newValue = _ref6.newValue;
274
- (_this$intersectionObs1 = _this.intersectionObserver) === null || _this$intersectionObs1 === void 0 || _this$intersectionObs1.watchAndTag(target, function (_ref7) {
270
+ (_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(target, function (_ref7) {
275
271
  var target = _ref7.target,
276
272
  rect = _ref7.rect;
277
273
  if (isContainedWithinMediaWrapper(target)) {
@@ -437,12 +433,12 @@ var ViewportObserver = /*#__PURE__*/function () {
437
433
  }, {
438
434
  key: "stop",
439
435
  value: function stop() {
440
- var _this$mutationObserve2, _this$intersectionObs10, _this$performanceObse2;
436
+ var _this$mutationObserve2, _this$intersectionObs1, _this$performanceObse2;
441
437
  if (!this.isStarted) {
442
438
  return;
443
439
  }
444
440
  (_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
445
- (_this$intersectionObs10 = this.intersectionObserver) === null || _this$intersectionObs10 === void 0 || _this$intersectionObs10.disconnect();
441
+ (_this$intersectionObs1 = this.intersectionObserver) === null || _this$intersectionObs1 === void 0 || _this$intersectionObs1.disconnect();
446
442
  (_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
447
443
  this.isStarted = false;
448
444
  // Clean up caches when stopping