@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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/create-payload/index.js +3 -4
- package/dist/cjs/interaction-metrics/index.js +2 -2
- package/dist/cjs/segment/segment.js +12 -19
- package/dist/cjs/trace-interaction/internal/trace-ufo-interaction.js +11 -25
- package/dist/cjs/vc/vc-observer-new/index.js +3 -8
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +18 -22
- package/dist/es2019/create-payload/index.js +1 -3
- package/dist/es2019/interaction-metrics/index.js +2 -2
- package/dist/es2019/segment/segment.js +12 -19
- package/dist/es2019/trace-interaction/internal/trace-ufo-interaction.js +11 -25
- package/dist/es2019/vc/vc-observer-new/index.js +15 -17
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +14 -19
- package/dist/esm/create-payload/index.js +3 -4
- package/dist/esm/interaction-metrics/index.js +2 -2
- package/dist/esm/segment/segment.js +12 -19
- package/dist/esm/trace-interaction/internal/trace-ufo-interaction.js +11 -25
- package/dist/esm/vc/vc-observer-new/index.js +3 -8
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +18 -22
- package/dist/types/create-payload/index.d.ts +768 -768
- package/dist/types-ts4.5/create-payload/index.d.ts +768 -768
- package/package.json +1 -10
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
-
}
|
|
222
|
-
|
|
215
|
+
} catch (err) {
|
|
216
|
+
_iterator2.e(err);
|
|
217
|
+
} finally {
|
|
218
|
+
_iterator2.f();
|
|
223
219
|
}
|
|
224
|
-
case
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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
|