@atlaskit/react-ufo 2.4.7 → 2.5.1
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 +23 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +2 -4
- package/dist/cjs/common/constants.js +2 -1
- package/dist/cjs/config/index.js +18 -40
- package/dist/cjs/create-payload/common/utils/index.js +1 -85
- package/dist/cjs/create-payload/index.js +77 -37
- package/dist/cjs/interaction-metrics/common/constants.js +1 -7
- package/dist/cjs/interaction-metrics/index.js +205 -140
- package/dist/cjs/interaction-metrics/post-interaction-log.js +1 -2
- package/dist/cjs/interaction-metrics-init/index.js +9 -27
- package/dist/cjs/load-hold/UFOLoadHold.js +4 -3
- package/dist/cjs/segment/segment.js +9 -7
- package/dist/cjs/trace-pageload/index.js +1 -2
- package/dist/cjs/vc/vc-observer/index.js +50 -38
- package/dist/cjs/vc/vc-observer/observers/editor-lnv/index.js +1 -2
- package/dist/cjs/vc/vc-observer/observers/editor-lnv/test-utils.js +1 -2
- package/dist/cjs/vc/vc-observer/observers/index.js +1 -2
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +1 -2
- package/dist/es2019/common/constants.js +3 -1
- package/dist/es2019/config/index.js +0 -22
- package/dist/es2019/create-payload/common/utils/index.js +1 -86
- package/dist/es2019/create-payload/index.js +74 -28
- package/dist/es2019/interaction-metrics/common/constants.js +0 -6
- package/dist/es2019/interaction-metrics/index.js +130 -93
- package/dist/es2019/interaction-metrics-init/index.js +8 -21
- package/dist/es2019/load-hold/UFOLoadHold.js +4 -3
- package/dist/es2019/segment/segment.js +12 -6
- package/dist/es2019/trace-pageload/index.js +1 -1
- package/dist/es2019/vc/vc-observer/index.js +17 -5
- package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +2 -4
- package/dist/esm/common/constants.js +3 -1
- package/dist/esm/config/index.js +18 -39
- package/dist/esm/create-payload/common/utils/index.js +1 -80
- package/dist/esm/create-payload/index.js +75 -33
- package/dist/esm/interaction-metrics/common/constants.js +0 -6
- package/dist/esm/interaction-metrics/index.js +157 -88
- package/dist/esm/interaction-metrics/post-interaction-log.js +1 -2
- package/dist/esm/interaction-metrics-init/index.js +10 -24
- package/dist/esm/load-hold/UFOLoadHold.js +4 -3
- package/dist/esm/segment/segment.js +9 -7
- package/dist/esm/trace-pageload/index.js +1 -1
- package/dist/esm/vc/vc-observer/index.js +50 -38
- package/dist/esm/vc/vc-observer/observers/editor-lnv/index.js +1 -2
- package/dist/esm/vc/vc-observer/observers/editor-lnv/test-utils.js +1 -2
- package/dist/esm/vc/vc-observer/observers/index.js +1 -2
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +1 -2
- package/dist/types/common/common/types.d.ts +4 -6
- package/dist/types/config/index.d.ts +0 -6
- package/dist/types/create-payload/common/utils/index.d.ts +0 -12
- package/dist/types/create-payload/index.d.ts +5660 -13
- package/dist/types/interaction-metrics/common/constants.d.ts +1 -31
- package/dist/types/interaction-metrics/index.d.ts +15 -4
- package/dist/types/load-hold/UFOLoadHold.d.ts +2 -1
- package/dist/types/trace-pageload/index.d.ts +0 -1
- package/dist/types/vc/vc-observer/index.d.ts +1 -1
- package/dist/types-ts4.5/common/common/types.d.ts +4 -6
- package/dist/types-ts4.5/config/index.d.ts +0 -6
- package/dist/types-ts4.5/create-payload/common/utils/index.d.ts +0 -12
- package/dist/types-ts4.5/create-payload/index.d.ts +5660 -13
- package/dist/types-ts4.5/interaction-metrics/common/constants.d.ts +1 -31
- package/dist/types-ts4.5/interaction-metrics/index.d.ts +15 -4
- package/dist/types-ts4.5/load-hold/UFOLoadHold.d.ts +2 -1
- package/dist/types-ts4.5/trace-pageload/index.d.ts +0 -1
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +1 -1
- package/package.json +6 -5
- package/create-experimental-interaction-metrics-payload/package.json +0 -15
- package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +0 -89
- package/dist/cjs/interaction-metrics/common/index.js +0 -151
- package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +0 -67
- package/dist/es2019/interaction-metrics/common/index.js +0 -103
- package/dist/esm/create-experimental-interaction-metrics-payload/index.js +0 -81
- package/dist/esm/interaction-metrics/common/index.js +0 -132
- package/dist/types/create-experimental-interaction-metrics-payload/index.d.ts +0 -31
- package/dist/types/interaction-metrics/common/index.d.ts +0 -16
- package/dist/types-ts4.5/create-experimental-interaction-metrics-payload/index.d.ts +0 -31
- package/dist/types-ts4.5/interaction-metrics/common/index.d.ts +0 -16
|
@@ -2,7 +2,7 @@ import { unstable_IdlePriority as idlePriority, unstable_scheduleCallback as sch
|
|
|
2
2
|
import { startLighthouseObserver } from '../additional-payload';
|
|
3
3
|
import { setUFOConfig } from '../config';
|
|
4
4
|
import { setupHiddenTimingCapture } from '../hidden-timing';
|
|
5
|
-
import {
|
|
5
|
+
import { postInteractionLog, sinkInteractionHandler, sinkPostInteractionLogHandler } from '../interaction-metrics';
|
|
6
6
|
import { getVCObserver } from '../vc';
|
|
7
7
|
let initialized = false;
|
|
8
8
|
function sinkInteraction(instance, payloadPackage) {
|
|
@@ -15,14 +15,6 @@ function sinkInteraction(instance, payloadPackage) {
|
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
function sinkExperimentalInteractionMetrics(instance, payloadPackage) {
|
|
19
|
-
sinkExperimentalHandler((interactionId, interaction) => {
|
|
20
|
-
scheduleCallback(idlePriority, () => {
|
|
21
|
-
const payload = payloadPackage.createExperimentalInteractionMetricsPayload(interactionId, interaction);
|
|
22
|
-
instance.sendOperationalEvent(payload);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
18
|
function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
|
|
27
19
|
sinkPostInteractionLogHandler(logOutput => {
|
|
28
20
|
scheduleCallback(idlePriority, () => {
|
|
@@ -53,32 +45,27 @@ export const init = (analyticsWebClientAsync, config) => {
|
|
|
53
45
|
postInteractionLog.startVCObserver({
|
|
54
46
|
startTime: 0
|
|
55
47
|
});
|
|
56
|
-
experimentalInteractionLog.initializeVCObserver(vcOptions).startVCObserver({
|
|
57
|
-
startTime: 0
|
|
58
|
-
});
|
|
59
48
|
}
|
|
60
49
|
setupHiddenTimingCapture();
|
|
61
50
|
startLighthouseObserver();
|
|
62
51
|
initialized = true;
|
|
63
|
-
Promise.all([analyticsWebClientAsync,
|
|
52
|
+
Promise.all([analyticsWebClientAsync,
|
|
53
|
+
// eslint-disable-next-line import/dynamic-import-chunkname
|
|
54
|
+
import( /* webpackChunkName: "create-payloads" */'../create-payload'),
|
|
55
|
+
// eslint-disable-next-line import/dynamic-import-chunkname
|
|
56
|
+
import( /* webpackChunkName: "create-post-intreaction-log-payload" */'../create-post-interaction-log-payload')]).then(([awc, payloadPackage, createPostInteractionLogPayloadPackage]) => {
|
|
64
57
|
if (awc.getAnalyticsWebClientPromise) {
|
|
65
58
|
awc.getAnalyticsWebClientPromise().then(client => {
|
|
66
|
-
var _config$
|
|
59
|
+
var _config$postInteracti;
|
|
67
60
|
const instance = client.getInstance();
|
|
68
61
|
sinkInteraction(instance, payloadPackage);
|
|
69
|
-
if (config !== null && config !== void 0 && (_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
|
|
70
|
-
sinkExperimentalInteractionMetrics(instance, createExperimentalInteractionMetricsPayload);
|
|
71
|
-
}
|
|
72
62
|
if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
|
|
73
63
|
sinkPostInteractionLog(instance, createPostInteractionLogPayloadPackage.default);
|
|
74
64
|
}
|
|
75
65
|
});
|
|
76
66
|
} else if (awc.sendOperationalEvent) {
|
|
77
|
-
var _config$
|
|
67
|
+
var _config$postInteracti2;
|
|
78
68
|
sinkInteraction(awc, payloadPackage);
|
|
79
|
-
if (config !== null && config !== void 0 && (_config$experimentalI2 = config.experimentalInteractionMetrics) !== null && _config$experimentalI2 !== void 0 && _config$experimentalI2.enabled) {
|
|
80
|
-
sinkExperimentalInteractionMetrics(awc, createExperimentalInteractionMetricsPayload);
|
|
81
|
-
}
|
|
82
69
|
if ((_config$postInteracti2 = config.postInteractionLog) !== null && _config$postInteracti2 !== void 0 && _config$postInteracti2.enabled) {
|
|
83
70
|
sinkPostInteractionLog(awc, createPostInteractionLogPayloadPackage.default);
|
|
84
71
|
}
|
|
@@ -22,7 +22,8 @@ const useLayoutEffectSAFE = typeof window === 'undefined' ? useEffect : useLayou
|
|
|
22
22
|
* return (
|
|
23
23
|
* <>
|
|
24
24
|
* <Skeleton />
|
|
25
|
-
* <UFOLoadHold name="card"
|
|
25
|
+
* <UFOLoadHold name="card">
|
|
26
|
+
* </UFOLoadHold>
|
|
26
27
|
* )
|
|
27
28
|
* }
|
|
28
29
|
* ```
|
|
@@ -56,8 +57,8 @@ export default function UFOLoadHold({
|
|
|
56
57
|
// react-18: useId instead
|
|
57
58
|
const context = useContext(UFOInteractionContext);
|
|
58
59
|
useLayoutEffectSAFE(() => {
|
|
59
|
-
if (hold && context != null) {
|
|
60
|
-
return context.hold(name
|
|
60
|
+
if (hold && !experimental && context != null) {
|
|
61
|
+
return context.hold(name);
|
|
61
62
|
}
|
|
62
63
|
}, [hold, context, name]);
|
|
63
64
|
|
|
@@ -67,13 +67,15 @@ export default function UFOSegment({
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
function _internalHold(labelStack, name
|
|
70
|
+
function _internalHold(labelStack, name
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
72
|
+
) {
|
|
71
73
|
if (interactionId.current != null) {
|
|
72
74
|
if (parentContext) {
|
|
73
|
-
return parentContext._internalHold(labelStack, name
|
|
75
|
+
return parentContext._internalHold(labelStack, name);
|
|
74
76
|
} else {
|
|
75
77
|
const capturedInteractionId = interactionId.current;
|
|
76
|
-
const disposeHold = addHold(interactionId.current, labelStack, name
|
|
78
|
+
const disposeHold = addHold(interactionId.current, labelStack, name);
|
|
77
79
|
return () => {
|
|
78
80
|
if (capturedInteractionId === interactionId.current) {
|
|
79
81
|
disposeHold();
|
|
@@ -82,7 +84,9 @@ export default function UFOSegment({
|
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
|
-
function _internalHoldByID(labelStack, id, name, remove
|
|
87
|
+
function _internalHoldByID(labelStack, id, name, remove
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
89
|
+
) {
|
|
86
90
|
if (interactionId.current != null) {
|
|
87
91
|
if (parentContext) {
|
|
88
92
|
parentContext._internalHoldByID(labelStack, name, id, remove);
|
|
@@ -104,8 +108,10 @@ export default function UFOSegment({
|
|
|
104
108
|
}
|
|
105
109
|
return {
|
|
106
110
|
labelStack,
|
|
107
|
-
hold(name = 'unknown'
|
|
108
|
-
|
|
111
|
+
hold(name = 'unknown'
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
113
|
+
) {
|
|
114
|
+
return this._internalHold(this.labelStack, name);
|
|
109
115
|
},
|
|
110
116
|
addHoldByID(labelStack, id, name = 'unknown') {
|
|
111
117
|
this._internalHoldByID(labelStack, id, name, false);
|
|
@@ -5,7 +5,7 @@ import { getActiveTrace } from '../experience-trace-id-context';
|
|
|
5
5
|
import { DefaultInteractionID } from '../interaction-id-context';
|
|
6
6
|
import { abort, addHoldByID, addNewInteraction, getActiveInteraction, removeHoldByID, updatePageLoadInteractionName } from '../interaction-metrics';
|
|
7
7
|
import UFORouteName from '../route-name-context';
|
|
8
|
-
|
|
8
|
+
const AWAITING_PAGELOAD_NAME = 'awaiting_pageload_name';
|
|
9
9
|
export default function traceUFOPageLoad(ufoName, routeName = ufoName) {
|
|
10
10
|
const activeInteraction = getActiveInteraction();
|
|
11
11
|
if (activeInteraction && !ufoName) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { attachAbortListeners } from './attachAbortListeners';
|
|
3
4
|
import { getViewportHeight, getViewportWidth } from './getViewport';
|
|
4
5
|
import { Observers } from './observers';
|
|
@@ -51,7 +52,7 @@ export class VCObserver {
|
|
|
51
52
|
const info = this.abortReason.info !== '' ? ` ${this.abortReason.info}` : '';
|
|
52
53
|
return `${this.abortReason.reason}${info}`;
|
|
53
54
|
});
|
|
54
|
-
_defineProperty(this, "getVCRawData",
|
|
55
|
+
_defineProperty(this, "getVCRawData", stopTime => {
|
|
55
56
|
this.measureStart();
|
|
56
57
|
if (!this.active) {
|
|
57
58
|
this.measureStop();
|
|
@@ -60,6 +61,19 @@ export class VCObserver {
|
|
|
60
61
|
this.stop();
|
|
61
62
|
const abortReasonInfo = this.getAbortReasonInfo();
|
|
62
63
|
this.measureStop();
|
|
64
|
+
let componentsLog = {};
|
|
65
|
+
if (stopTime && fg('ufo-remove-vc-component-observations-after-ttai')) {
|
|
66
|
+
Object.entries(this.componentsLog).forEach(([_timestamp, value]) => {
|
|
67
|
+
const timestamp = Number(_timestamp);
|
|
68
|
+
if (stopTime > timestamp) {
|
|
69
|
+
componentsLog[timestamp] = value;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
componentsLog = {
|
|
74
|
+
...this.componentsLog
|
|
75
|
+
};
|
|
76
|
+
}
|
|
63
77
|
return {
|
|
64
78
|
abortReasonInfo,
|
|
65
79
|
abortReason: {
|
|
@@ -69,9 +83,7 @@ export class VCObserver {
|
|
|
69
83
|
heatmapNext: this.heatmapNext,
|
|
70
84
|
outOfBoundaryInfo: this.outOfBoundaryInfo,
|
|
71
85
|
totalTime: Math.round(this.totalTime + this.observers.getTotalTime()),
|
|
72
|
-
componentsLog
|
|
73
|
-
...this.componentsLog
|
|
74
|
-
},
|
|
86
|
+
componentsLog,
|
|
75
87
|
viewport: {
|
|
76
88
|
...this.viewport
|
|
77
89
|
},
|
|
@@ -91,7 +103,7 @@ export class VCObserver {
|
|
|
91
103
|
const startTime = performance.now();
|
|
92
104
|
// add local measurement
|
|
93
105
|
const fullPrefix = prefix !== undefined && prefix !== '' ? `${prefix}:` : '';
|
|
94
|
-
const rawData = vc !== undefined ? vc : this.getVCRawData();
|
|
106
|
+
const rawData = vc !== undefined ? vc : this.getVCRawData(stop);
|
|
95
107
|
if (rawData === null) {
|
|
96
108
|
return {};
|
|
97
109
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _EntriesBuffer;
|
|
5
4
|
import { PerformanceObserverEntryTypes } from '../../const';
|
|
6
5
|
export var BufferWithMaxLength = /*#__PURE__*/function () {
|
|
7
6
|
function BufferWithMaxLength() {
|
|
@@ -11,7 +10,7 @@ export var BufferWithMaxLength = /*#__PURE__*/function () {
|
|
|
11
10
|
_defineProperty(this, "full", false);
|
|
12
11
|
this.maxLength = maxLength;
|
|
13
12
|
}
|
|
14
|
-
_createClass(BufferWithMaxLength, [{
|
|
13
|
+
return _createClass(BufferWithMaxLength, [{
|
|
15
14
|
key: "push",
|
|
16
15
|
value: function push(item) {
|
|
17
16
|
if (this.full || this.maxLength === this.buffer.length) {
|
|
@@ -26,6 +25,5 @@ export var BufferWithMaxLength = /*#__PURE__*/function () {
|
|
|
26
25
|
return this.buffer;
|
|
27
26
|
}
|
|
28
27
|
}]);
|
|
29
|
-
return BufferWithMaxLength;
|
|
30
28
|
}();
|
|
31
|
-
export var EntriesBuffer = (
|
|
29
|
+
export var EntriesBuffer = _defineProperty(_defineProperty({}, PerformanceObserverEntryTypes.LongTask, new BufferWithMaxLength()), PerformanceObserverEntryTypes.LayoutShift, new BufferWithMaxLength());
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @atlaskit/platform/no-module-level-eval
|
|
4
|
+
export var REACT_UFO_VERSION = fg('enable-react-ufo-payload-segment-compressed') ? '2.0.0' : '1.0.1';
|
package/dist/esm/config/index.js
CHANGED
|
@@ -64,34 +64,13 @@ export function getInteractionRate(name, interactionKind) {
|
|
|
64
64
|
return 0;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
export function getExperimentalInteractionRate(name, interactionType) {
|
|
68
|
-
try {
|
|
69
|
-
if (!config) {
|
|
70
|
-
return 0;
|
|
71
|
-
}
|
|
72
|
-
var _config2 = config,
|
|
73
|
-
experimentalInteractionMetrics = _config2.experimentalInteractionMetrics;
|
|
74
|
-
if (!(experimentalInteractionMetrics !== null && experimentalInteractionMetrics !== void 0 && experimentalInteractionMetrics.enabled)) {
|
|
75
|
-
return 0;
|
|
76
|
-
}
|
|
77
|
-
if (experimentalInteractionMetrics.rates && typeof experimentalInteractionMetrics.rates[name] === 'number') {
|
|
78
|
-
return experimentalInteractionMetrics.rates[name];
|
|
79
|
-
}
|
|
80
|
-
if (experimentalInteractionMetrics.kind && typeof experimentalInteractionMetrics.kind[interactionType] === 'number') {
|
|
81
|
-
return experimentalInteractionMetrics.kind[interactionType];
|
|
82
|
-
}
|
|
83
|
-
return 0;
|
|
84
|
-
} catch (e) {
|
|
85
|
-
return 0;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
67
|
export function getPostInteractionRate(name, interactionType) {
|
|
89
68
|
try {
|
|
90
69
|
if (!config) {
|
|
91
70
|
return 0;
|
|
92
71
|
}
|
|
93
|
-
var
|
|
94
|
-
postInteractionLog =
|
|
72
|
+
var _config2 = config,
|
|
73
|
+
postInteractionLog = _config2.postInteractionLog;
|
|
95
74
|
if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
|
|
96
75
|
return 0;
|
|
97
76
|
}
|
|
@@ -111,8 +90,8 @@ export function getCapabilityRate(capability) {
|
|
|
111
90
|
if (!config) {
|
|
112
91
|
return 0;
|
|
113
92
|
}
|
|
114
|
-
var
|
|
115
|
-
capabilityRate =
|
|
93
|
+
var _config3 = config,
|
|
94
|
+
capabilityRate = _config3.capability;
|
|
116
95
|
if (capabilityRate != null) {
|
|
117
96
|
var rate = capabilityRate[capability];
|
|
118
97
|
if (rate != null) {
|
|
@@ -131,8 +110,8 @@ export function getTypingPerformanceTracingMethod() {
|
|
|
131
110
|
if (!config) {
|
|
132
111
|
return defaultMethod;
|
|
133
112
|
}
|
|
134
|
-
var
|
|
135
|
-
typingMethod =
|
|
113
|
+
var _config4 = config,
|
|
114
|
+
typingMethod = _config4.typingMethod;
|
|
136
115
|
if (typingMethod != null && validTypingMethods.find(function (m) {
|
|
137
116
|
return m === typingMethod;
|
|
138
117
|
})) {
|
|
@@ -151,8 +130,8 @@ export function getAwaitBM3TTIList() {
|
|
|
151
130
|
if (!config) {
|
|
152
131
|
return [];
|
|
153
132
|
}
|
|
154
|
-
var
|
|
155
|
-
awaitBM3TTI =
|
|
133
|
+
var _config5 = config,
|
|
134
|
+
awaitBM3TTI = _config5.awaitBM3TTI;
|
|
156
135
|
if (awaitBM3TTI != null) {
|
|
157
136
|
return awaitBM3TTI;
|
|
158
137
|
} else {
|
|
@@ -169,8 +148,8 @@ export function getRemovePageSegmentsUFOPrefixes() {
|
|
|
169
148
|
if (!config) {
|
|
170
149
|
return false;
|
|
171
150
|
}
|
|
172
|
-
var
|
|
173
|
-
removePageSegmentsUFOPrefixes =
|
|
151
|
+
var _config6 = config,
|
|
152
|
+
removePageSegmentsUFOPrefixes = _config6.removePageSegmentsUFOPrefixes;
|
|
174
153
|
if (removePageSegmentsUFOPrefixes != null) {
|
|
175
154
|
return removePageSegmentsUFOPrefixes;
|
|
176
155
|
} else {
|
|
@@ -187,8 +166,8 @@ export function getRemoveInteractionsUFOPrefixes() {
|
|
|
187
166
|
if (!config) {
|
|
188
167
|
return false;
|
|
189
168
|
}
|
|
190
|
-
var
|
|
191
|
-
removeInteractionsUFOPrefixes =
|
|
169
|
+
var _config7 = config,
|
|
170
|
+
removeInteractionsUFOPrefixes = _config7.removeInteractionsUFOPrefixes;
|
|
192
171
|
if (removeInteractionsUFOPrefixes != null) {
|
|
193
172
|
return removeInteractionsUFOPrefixes;
|
|
194
173
|
} else {
|
|
@@ -208,8 +187,8 @@ export function getUfoNameOverrides() {
|
|
|
208
187
|
if (!config) {
|
|
209
188
|
return undefined;
|
|
210
189
|
}
|
|
211
|
-
var
|
|
212
|
-
ufoNameOverrides =
|
|
190
|
+
var _config8 = config,
|
|
191
|
+
ufoNameOverrides = _config8.ufoNameOverrides;
|
|
213
192
|
if (ufoNameOverrides != null) {
|
|
214
193
|
return ufoNameOverrides;
|
|
215
194
|
}
|
|
@@ -225,8 +204,8 @@ export function getDoNotAbortActivePressInteraction() {
|
|
|
225
204
|
if (!config) {
|
|
226
205
|
return undefined;
|
|
227
206
|
}
|
|
228
|
-
var
|
|
229
|
-
doNotAbortActivePressInteraction =
|
|
207
|
+
var _config9 = config,
|
|
208
|
+
doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
|
|
230
209
|
return doNotAbortActivePressInteraction;
|
|
231
210
|
} catch (e) {
|
|
232
211
|
return undefined;
|
|
@@ -239,8 +218,8 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
239
218
|
if (!config) {
|
|
240
219
|
return undefined;
|
|
241
220
|
}
|
|
242
|
-
var
|
|
243
|
-
doNotAbortActivePressInteractionOnTransition =
|
|
221
|
+
var _config10 = config,
|
|
222
|
+
doNotAbortActivePressInteractionOnTransition = _config10.doNotAbortActivePressInteractionOnTransition;
|
|
244
223
|
return doNotAbortActivePressInteractionOnTransition;
|
|
245
224
|
} catch (e) {
|
|
246
225
|
return undefined;
|
|
@@ -2,13 +2,7 @@ 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
4
|
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
|
5
|
-
|
|
6
5
|
import { REACT_UFO_VERSION } from '../../../common/constants';
|
|
7
|
-
import { getConfig } from '../../../config';
|
|
8
|
-
import { getPageVisibilityState } from '../../../hidden-timing';
|
|
9
|
-
import { experimentalInteractionLog, postInteractionLog } from '../../../interaction-metrics';
|
|
10
|
-
import * as ssr from '../../../ssr';
|
|
11
|
-
import { getVCObserver } from '../../../vc';
|
|
12
6
|
export var sanitizeUfoName = function sanitizeUfoName(name) {
|
|
13
7
|
return name.replace(/_/g, '-');
|
|
14
8
|
};
|
|
@@ -65,77 +59,4 @@ export function optimizeLabelStack(labelStack) {
|
|
|
65
59
|
s: ls.segmentId
|
|
66
60
|
} : {});
|
|
67
61
|
});
|
|
68
|
-
}
|
|
69
|
-
export var getInteractionStatus = function getInteractionStatus(interaction) {
|
|
70
|
-
var originalInteractionStatus = interaction.abortReason ? 'ABORTED' : 'SUCCEEDED';
|
|
71
|
-
var hasBm3TTI = interaction.apdex.length > 0;
|
|
72
|
-
var overrideStatus = hasBm3TTI ? 'SUCCEEDED' : originalInteractionStatus;
|
|
73
|
-
return {
|
|
74
|
-
originalInteractionStatus: originalInteractionStatus,
|
|
75
|
-
overrideStatus: overrideStatus
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
export var getPageVisibilityUpToTTAI = function getPageVisibilityUpToTTAI(interaction) {
|
|
79
|
-
var start = interaction.start,
|
|
80
|
-
end = interaction.end;
|
|
81
|
-
return getPageVisibilityState(start, end);
|
|
82
|
-
};
|
|
83
|
-
export var calculateVCMetrics = function calculateVCMetrics(interaction, prefix, getVCResultFn) {
|
|
84
|
-
var _interaction$apdex;
|
|
85
|
-
var result = getVCResultFn({
|
|
86
|
-
start: interaction.start,
|
|
87
|
-
stop: interaction.end,
|
|
88
|
-
tti: (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime,
|
|
89
|
-
prefix: prefix,
|
|
90
|
-
vc: interaction.vc
|
|
91
|
-
});
|
|
92
|
-
var VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
|
|
93
|
-
if (!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")])) {
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
var interactionStatus = getInteractionStatus(interaction);
|
|
97
|
-
var pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
98
|
-
if (interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') {
|
|
99
|
-
return result;
|
|
100
|
-
}
|
|
101
|
-
return result;
|
|
102
|
-
};
|
|
103
|
-
export function getSSRDoneTimeValue(config) {
|
|
104
|
-
var _config$ssr, _config$ssr2;
|
|
105
|
-
return config !== null && config !== void 0 && (_config$ssr = config.ssr) !== null && _config$ssr !== void 0 && _config$ssr.getSSRDoneTime ? config === null || config === void 0 || (_config$ssr2 = config.ssr) === null || _config$ssr2 === void 0 ? void 0 : _config$ssr2.getSSRDoneTime() : ssr.getSSRDoneTime();
|
|
106
|
-
}
|
|
107
|
-
export var getVCMetrics = function getVCMetrics(interaction) {
|
|
108
|
-
var _config$vc, _result$metricsVc;
|
|
109
|
-
var config = getConfig();
|
|
110
|
-
if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
|
|
111
|
-
return {};
|
|
112
|
-
}
|
|
113
|
-
if (interaction.type !== 'page_load' && interaction.type !== 'transition') {
|
|
114
|
-
return {};
|
|
115
|
-
}
|
|
116
|
-
var ssr = interaction.type === 'page_load' && config !== null && config !== void 0 && config.ssr ? {
|
|
117
|
-
ssr: getSSRDoneTimeValue(config)
|
|
118
|
-
} : null;
|
|
119
|
-
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
120
|
-
var result = calculateVCMetrics(interaction, 'ufo', getVCObserver().getVCResult);
|
|
121
|
-
return _objectSpread(_objectSpread({}, result), {}, {
|
|
122
|
-
'metric:vc90': result === null || result === void 0 || (_result$metricsVc = result['metrics:vc']) === null || _result$metricsVc === void 0 ? void 0 : _result$metricsVc['90']
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
export var getExperimentalVCMetrics = function getExperimentalVCMetrics(interaction) {
|
|
126
|
-
if (experimentalInteractionLog.vcObserver) {
|
|
127
|
-
var _result$metricsVc2;
|
|
128
|
-
var result = calculateVCMetrics(interaction, 'ufo-experimental', experimentalInteractionLog.vcObserver.getVCResult);
|
|
129
|
-
return _objectSpread(_objectSpread({}, result), {}, {
|
|
130
|
-
'metric:experimental:vc90': result === null || result === void 0 || (_result$metricsVc2 = result['metrics:vc']) === null || _result$metricsVc2 === void 0 ? void 0 : _result$metricsVc2['90']
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
134
|
-
};
|
|
135
|
-
export var getTTAI = function getTTAI(interaction) {
|
|
136
|
-
var start = interaction.start,
|
|
137
|
-
end = interaction.end;
|
|
138
|
-
var interactionStatus = getInteractionStatus(interaction);
|
|
139
|
-
var pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
140
|
-
return interactionStatus.originalInteractionStatus === 'SUCCEEDED' && pageVisibilityUpToTTAI === 'visible' ? Math.round(end - start) : undefined;
|
|
141
|
-
};
|
|
62
|
+
}
|