@atlaskit/react-ufo 4.2.5 → 4.3.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.
- package/CHANGELOG.md +15 -0
- package/additional-payload/package.json +1 -1
- package/bundle-eval-timing/package.json +1 -1
- package/coinflip/package.json +1 -1
- package/common/package.json +1 -1
- package/config/package.json +1 -1
- package/create-experimental-interaction-metrics-payload/package.json +1 -1
- package/create-payload/package.json +1 -1
- package/create-post-interaction-log-payload/package.json +1 -1
- package/custom-cohort-data/package.json +1 -1
- package/custom-data/package.json +1 -1
- package/custom-mark/package.json +1 -1
- package/custom-spans/package.json +1 -1
- package/custom-timings/package.json +1 -1
- package/dist/cjs/config/index.js +39 -24
- package/dist/cjs/create-payload/common/utils/index.js +4 -4
- package/dist/cjs/create-payload/index.js +13 -5
- package/dist/cjs/interaction-metrics/index.js +1 -0
- package/dist/cjs/segment/segment.js +2 -3
- package/dist/es2019/config/index.js +14 -0
- package/dist/es2019/create-payload/common/utils/index.js +4 -4
- package/dist/es2019/create-payload/index.js +11 -1
- package/dist/es2019/interaction-metrics/index.js +2 -1
- package/dist/es2019/segment/segment.js +2 -3
- package/dist/esm/config/index.js +38 -24
- package/dist/esm/create-payload/common/utils/index.js +4 -4
- package/dist/esm/create-payload/index.js +13 -5
- package/dist/esm/interaction-metrics/index.js +2 -1
- package/dist/esm/segment/segment.js +2 -3
- package/dist/types/common/common/types.d.ts +2 -0
- package/dist/types/config/index.d.ts +24 -0
- package/dist/types/create-payload/index.d.ts +25346 -146
- package/dist/types-ts4.5/common/common/types.d.ts +2 -0
- package/dist/types-ts4.5/config/index.d.ts +24 -0
- package/dist/types-ts4.5/create-payload/index.d.ts +25346 -146
- package/experience-trace-id-context/package.json +1 -1
- package/feature-flags-accessed/package.json +1 -1
- package/generate-id/package.json +1 -1
- package/global-error-handler/package.json +1 -1
- package/hidden-timing/package.json +1 -1
- package/initial-page-load-extra-timing/package.json +1 -1
- package/interaction-context/package.json +1 -1
- package/interaction-id-context/package.json +1 -1
- package/interaction-ignore/package.json +1 -1
- package/interaction-metrics/package.json +1 -1
- package/interaction-metrics-init/package.json +1 -1
- package/label/package.json +1 -1
- package/load-hold/package.json +1 -1
- package/package.json +1 -4
- package/placeholder/package.json +1 -1
- package/resource-timing/package.json +1 -1
- package/round-number/package.json +1 -1
- package/route-name/package.json +1 -1
- package/route-name-context/package.json +1 -1
- package/segment/package.json +1 -1
- package/set-interaction-error/package.json +1 -1
- package/short-id/package.json +1 -1
- package/ssr/package.json +1 -1
- package/ssr-scripts/package.json +1 -1
- package/suspense/package.json +1 -1
- package/trace-interaction/package.json +1 -1
- package/trace-pageload/package.json +1 -1
- package/trace-press/package.json +1 -1
- package/trace-redirect/package.json +1 -1
- package/trace-transition/package.json +1 -1
- package/typing-performance-tracing/package.json +1 -1
- package/use-press-tracing/package.json +1 -1
- package/vc/package.json +1 -1
- package/vc-media/package.json +1 -1
package/dist/esm/config/index.js
CHANGED
|
@@ -68,17 +68,31 @@ export function getMostRecentVCRevision() {
|
|
|
68
68
|
var enabledVCRevisions = getEnabledVCRevisions(experienceKey);
|
|
69
69
|
return enabledVCRevisions[enabledVCRevisions.length - 1];
|
|
70
70
|
}
|
|
71
|
+
export function getReactHydrationStats() {
|
|
72
|
+
if (!config) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
var _config, _config$getReactHydra;
|
|
77
|
+
var stats = (_config = config) === null || _config === void 0 || (_config$getReactHydra = _config.getReactHydrationStats) === null || _config$getReactHydra === void 0 ? void 0 : _config$getReactHydra.call(_config);
|
|
78
|
+
return stats !== null && stats !== void 0 ? stats : undefined;
|
|
79
|
+
} catch (e) {
|
|
80
|
+
// eslint-disable-next-line no-console
|
|
81
|
+
console.error('getReactHydrationStats threw an error: ', e);
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
71
85
|
export function getInteractionRate(name, interactionKind) {
|
|
72
86
|
try {
|
|
73
87
|
if (!config) {
|
|
74
88
|
return 0;
|
|
75
89
|
}
|
|
76
|
-
var
|
|
77
|
-
killswitch =
|
|
78
|
-
rates =
|
|
79
|
-
rules =
|
|
80
|
-
kind =
|
|
81
|
-
autoGeneratedRate =
|
|
90
|
+
var _config2 = config,
|
|
91
|
+
killswitch = _config2.killswitch,
|
|
92
|
+
rates = _config2.rates,
|
|
93
|
+
rules = _config2.rules,
|
|
94
|
+
kind = _config2.kind,
|
|
95
|
+
autoGeneratedRate = _config2.autoGeneratedRate;
|
|
82
96
|
if (killswitch != null) {
|
|
83
97
|
// Specifically kill certain events
|
|
84
98
|
if (killswitch.includes(name)) {
|
|
@@ -128,8 +142,8 @@ export function getExperimentalInteractionRate(name, interactionType) {
|
|
|
128
142
|
if (!config) {
|
|
129
143
|
return 0;
|
|
130
144
|
}
|
|
131
|
-
var
|
|
132
|
-
experimentalInteractionMetrics =
|
|
145
|
+
var _config3 = config,
|
|
146
|
+
experimentalInteractionMetrics = _config3.experimentalInteractionMetrics;
|
|
133
147
|
if (!(experimentalInteractionMetrics !== null && experimentalInteractionMetrics !== void 0 && experimentalInteractionMetrics.enabled)) {
|
|
134
148
|
return 0;
|
|
135
149
|
}
|
|
@@ -149,8 +163,8 @@ export function getPostInteractionRate(name, interactionType) {
|
|
|
149
163
|
if (!config) {
|
|
150
164
|
return 0;
|
|
151
165
|
}
|
|
152
|
-
var
|
|
153
|
-
postInteractionLog =
|
|
166
|
+
var _config4 = config,
|
|
167
|
+
postInteractionLog = _config4.postInteractionLog;
|
|
154
168
|
if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
|
|
155
169
|
return 0;
|
|
156
170
|
}
|
|
@@ -176,8 +190,8 @@ export function getCapabilityRate(capability) {
|
|
|
176
190
|
if (!config) {
|
|
177
191
|
return 0;
|
|
178
192
|
}
|
|
179
|
-
var
|
|
180
|
-
capabilityRate =
|
|
193
|
+
var _config5 = config,
|
|
194
|
+
capabilityRate = _config5.capability;
|
|
181
195
|
if (capabilityRate != null) {
|
|
182
196
|
var rate = capabilityRate[capability];
|
|
183
197
|
if (rate != null) {
|
|
@@ -196,8 +210,8 @@ export function getTypingPerformanceTracingMethod() {
|
|
|
196
210
|
if (!config) {
|
|
197
211
|
return defaultMethod;
|
|
198
212
|
}
|
|
199
|
-
var
|
|
200
|
-
typingMethod =
|
|
213
|
+
var _config6 = config,
|
|
214
|
+
typingMethod = _config6.typingMethod;
|
|
201
215
|
if (typingMethod != null && validTypingMethods.find(function (m) {
|
|
202
216
|
return m === typingMethod;
|
|
203
217
|
})) {
|
|
@@ -216,8 +230,8 @@ export function getAwaitBM3TTIList() {
|
|
|
216
230
|
if (!config) {
|
|
217
231
|
return [];
|
|
218
232
|
}
|
|
219
|
-
var
|
|
220
|
-
awaitBM3TTI =
|
|
233
|
+
var _config7 = config,
|
|
234
|
+
awaitBM3TTI = _config7.awaitBM3TTI;
|
|
221
235
|
if (awaitBM3TTI != null) {
|
|
222
236
|
return awaitBM3TTI;
|
|
223
237
|
} else {
|
|
@@ -237,8 +251,8 @@ export function getUfoNameOverrides() {
|
|
|
237
251
|
if (!config) {
|
|
238
252
|
return undefined;
|
|
239
253
|
}
|
|
240
|
-
var
|
|
241
|
-
ufoNameOverrides =
|
|
254
|
+
var _config8 = config,
|
|
255
|
+
ufoNameOverrides = _config8.ufoNameOverrides;
|
|
242
256
|
if (ufoNameOverrides != null) {
|
|
243
257
|
return ufoNameOverrides;
|
|
244
258
|
}
|
|
@@ -254,8 +268,8 @@ export function getDoNotAbortActivePressInteraction() {
|
|
|
254
268
|
if (!config) {
|
|
255
269
|
return undefined;
|
|
256
270
|
}
|
|
257
|
-
var
|
|
258
|
-
doNotAbortActivePressInteraction =
|
|
271
|
+
var _config9 = config,
|
|
272
|
+
doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
|
|
259
273
|
return doNotAbortActivePressInteraction;
|
|
260
274
|
} catch (e) {
|
|
261
275
|
return undefined;
|
|
@@ -268,8 +282,8 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
268
282
|
if (!config) {
|
|
269
283
|
return undefined;
|
|
270
284
|
}
|
|
271
|
-
var
|
|
272
|
-
doNotAbortActivePressInteractionOnTransition =
|
|
285
|
+
var _config0 = config,
|
|
286
|
+
doNotAbortActivePressInteractionOnTransition = _config0.doNotAbortActivePressInteractionOnTransition;
|
|
273
287
|
return doNotAbortActivePressInteractionOnTransition;
|
|
274
288
|
} catch (e) {
|
|
275
289
|
return undefined;
|
|
@@ -281,8 +295,8 @@ export function getInteractionTimeout(ufoName) {
|
|
|
281
295
|
if (!config) {
|
|
282
296
|
return CLEANUP_TIMEOUT;
|
|
283
297
|
}
|
|
284
|
-
var
|
|
285
|
-
interactionTimeout =
|
|
298
|
+
var _config1 = config,
|
|
299
|
+
interactionTimeout = _config1.interactionTimeout;
|
|
286
300
|
if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
|
|
287
301
|
return interactionTimeout[ufoName];
|
|
288
302
|
}
|
|
@@ -53,7 +53,7 @@ export function buildSegmentTree(labelStacks) {
|
|
|
53
53
|
if (!currentNode.c[key]) {
|
|
54
54
|
currentNode.c[key] = _objectSpread({
|
|
55
55
|
n: name
|
|
56
|
-
}, type
|
|
56
|
+
}, type ? {
|
|
57
57
|
t: type
|
|
58
58
|
} : {});
|
|
59
59
|
}
|
|
@@ -79,7 +79,7 @@ export function buildSegmentTree(labelStacks) {
|
|
|
79
79
|
if (!currentNode.c[key]) {
|
|
80
80
|
currentNode.c[key] = _objectSpread({
|
|
81
81
|
n: name
|
|
82
|
-
}, type
|
|
82
|
+
}, type ? {
|
|
83
83
|
t: type
|
|
84
84
|
} : {});
|
|
85
85
|
}
|
|
@@ -121,7 +121,7 @@ export function optimizeLabelStack(labelStack, reactUFOVersion) {
|
|
|
121
121
|
n: ls.name
|
|
122
122
|
}, ls.segmentId ? {
|
|
123
123
|
s: ls.segmentId
|
|
124
|
-
} : {}), ls.type
|
|
124
|
+
} : {}), ls.type ? {
|
|
125
125
|
t: ls.type
|
|
126
126
|
} : {});
|
|
127
127
|
});
|
|
@@ -155,7 +155,7 @@ export function getOldSegmentsLabelStack(segments, interactionType) {
|
|
|
155
155
|
n: ls.name
|
|
156
156
|
}, ls.segmentId ? {
|
|
157
157
|
s: ls.segmentId
|
|
158
|
-
} : {}), ls.type
|
|
158
|
+
} : {}), ls.type ? {
|
|
159
159
|
t: ls.type
|
|
160
160
|
} : {}));
|
|
161
161
|
}
|
|
@@ -575,7 +575,7 @@ function createInteractionMetricsPayload(_x, _x2, _x3, _x4, _x5) {
|
|
|
575
575
|
function _createInteractionMetricsPayload() {
|
|
576
576
|
_createInteractionMetricsPayload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction, interactionId, experimental, criticalPayloadCount, vcMetrics) {
|
|
577
577
|
var _window$location, _config$additionalPay;
|
|
578
|
-
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, payload;
|
|
578
|
+
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, hydration, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, getReactHydrationStats, payload;
|
|
579
579
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
580
580
|
while (1) switch (_context.prev = _context.next) {
|
|
581
581
|
case 0:
|
|
@@ -587,7 +587,7 @@ function _createInteractionMetricsPayload() {
|
|
|
587
587
|
}
|
|
588
588
|
throw Error('UFO Configuration not provided');
|
|
589
589
|
case 4:
|
|
590
|
-
end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, knownSegments = interaction.knownSegments, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, featureFlags = interaction.featureFlags, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, responsiveness = interaction.responsiveness, unknownElementName = interaction.unknownElementName, unknownElementHierarchy = interaction.unknownElementHierarchy;
|
|
590
|
+
end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, knownSegments = interaction.knownSegments, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, featureFlags = interaction.featureFlags, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, responsiveness = interaction.responsiveness, unknownElementName = interaction.unknownElementName, unknownElementHierarchy = interaction.unknownElementHierarchy, hydration = interaction.hydration;
|
|
591
591
|
pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
592
592
|
pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
593
593
|
segments = !fg('platform_ufo_remove_deprecated_config_fields') && config.killswitchNestedSegments ? [] : knownSegments;
|
|
@@ -700,6 +700,14 @@ function _createInteractionMetricsPayload() {
|
|
|
700
700
|
if (!experimental) {
|
|
701
701
|
fg('ufo_chrome_devtools_uplift') && addPerformanceMeasures(interaction.start, _toConsumableArray((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || []));
|
|
702
702
|
}
|
|
703
|
+
getReactHydrationStats = function getReactHydrationStats() {
|
|
704
|
+
if (!isPageLoad || !hydration) {
|
|
705
|
+
return {};
|
|
706
|
+
}
|
|
707
|
+
return {
|
|
708
|
+
hydration: hydration
|
|
709
|
+
};
|
|
710
|
+
};
|
|
703
711
|
payload = {
|
|
704
712
|
actionSubject: 'experience',
|
|
705
713
|
action: 'measured',
|
|
@@ -707,7 +715,7 @@ function _createInteractionMetricsPayload() {
|
|
|
707
715
|
source: 'measured',
|
|
708
716
|
tags: ['observability'],
|
|
709
717
|
attributes: {
|
|
710
|
-
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
718
|
+
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
711
719
|
// basic
|
|
712
720
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
713
721
|
'event:product': config.product,
|
|
@@ -726,7 +734,7 @@ function _createInteractionMetricsPayload() {
|
|
|
726
734
|
}, criticalPayloadCount !== undefined ? {
|
|
727
735
|
'ufo:multipayload': true,
|
|
728
736
|
'ufo:criticalPayloadCount': criticalPayloadCount
|
|
729
|
-
} : {}), getBrowserMetadataToLegacyFormat()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), getNavigationMetricsToLegacyFormat(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), {}, {
|
|
737
|
+
} : {}), getBrowserMetadataToLegacyFormat()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), getNavigationMetricsToLegacyFormat(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
|
|
730
738
|
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
731
739
|
namePrefix: config.namePrefix || '',
|
|
732
740
|
segmentPrefix: config.segmentPrefix || '',
|
|
@@ -772,7 +780,7 @@ function _createInteractionMetricsPayload() {
|
|
|
772
780
|
}
|
|
773
781
|
payload.attributes.properties['event:sizeInKb'] = getPayloadSize(payload.attributes.properties);
|
|
774
782
|
return _context.abrupt("return", payload);
|
|
775
|
-
case
|
|
783
|
+
case 45:
|
|
776
784
|
case "end":
|
|
777
785
|
return _context.stop();
|
|
778
786
|
}
|
|
@@ -11,7 +11,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
11
11
|
import { v4 as createUUID } from 'uuid';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import coinflip from '../coinflip';
|
|
14
|
-
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate } from '../config';
|
|
14
|
+
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
15
15
|
import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
|
|
16
16
|
import { sanitizeUfoName } from '../create-payload/common/utils';
|
|
17
17
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
@@ -617,6 +617,7 @@ function finishInteraction(id, data) {
|
|
|
617
617
|
data.vc = observer.getVCRawData();
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
|
+
data.hydration = getReactHydrationStats();
|
|
620
621
|
|
|
621
622
|
// By this time, stop the post interaction log observer if coinflip rate is 0
|
|
622
623
|
if (fg('platform_ufo_post_interaction_check_name')) {
|
|
@@ -5,7 +5,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
|
|
7
7
|
import { v4 as createUUID } from 'uuid';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import coinflip from '../coinflip';
|
|
10
9
|
import { getConfig, getInteractionRate } from '../config';
|
|
11
10
|
import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
|
|
@@ -56,13 +55,13 @@ export default function UFOSegment(_ref) {
|
|
|
56
55
|
return parentContext !== null && parentContext !== void 0 && parentContext.labelStack ? [].concat(_toConsumableArray(parentContext.labelStack), [_objectSpread({
|
|
57
56
|
name: segmentName,
|
|
58
57
|
segmentId: segmentId
|
|
59
|
-
}, type !== 'first-party'
|
|
58
|
+
}, type !== 'first-party' ? {
|
|
60
59
|
type: type
|
|
61
60
|
} : {}) // Only pass non-default types (not 'first-party') in payload to reduce size
|
|
62
61
|
]) : [_objectSpread({
|
|
63
62
|
name: segmentName,
|
|
64
63
|
segmentId: segmentId
|
|
65
|
-
}, type !== 'first-party'
|
|
64
|
+
}, type !== 'first-party' ? {
|
|
66
65
|
type: type
|
|
67
66
|
} : {})];
|
|
68
67
|
}, [parentContext, segmentName, segmentId, type]);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactHydrationStats } from '../../config';
|
|
1
2
|
import type { TraceIdContext } from '../../experience-trace-id-context';
|
|
2
3
|
import type { LabelStack, UFOInteractionContextType } from '../../interaction-context';
|
|
3
4
|
import type { VCObserverInterface } from '../../vc/types';
|
|
@@ -162,6 +163,7 @@ export interface InteractionMetrics {
|
|
|
162
163
|
vcObserver?: VCObserverInterface;
|
|
163
164
|
experimentalVCObserver?: VCObserverInterface;
|
|
164
165
|
vc?: VCRawDataType | null;
|
|
166
|
+
hydration?: ReactHydrationStats;
|
|
165
167
|
experimentalTTAI?: number;
|
|
166
168
|
experimentalVC90?: number;
|
|
167
169
|
unknownElementName?: string;
|
|
@@ -32,6 +32,24 @@ type Rates = {
|
|
|
32
32
|
};
|
|
33
33
|
export type TTVCRevision = 'fy25.01' | 'fy25.02' | 'fy25.03';
|
|
34
34
|
export declare const DEFAULT_TTVC_REVISION = "fy25.03";
|
|
35
|
+
export type ReactHydrationStats = {
|
|
36
|
+
/**
|
|
37
|
+
* Indicates if hydration of SSR content failed, so React switching to client-side rendering and re-rendered from scratch.
|
|
38
|
+
*/
|
|
39
|
+
successful: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The total number of hydration errors reported from {@code hydrateRoot#onRecoverableError}.
|
|
42
|
+
*/
|
|
43
|
+
warningCount?: number;
|
|
44
|
+
/**
|
|
45
|
+
* The depth in the React component tree of the shallowest warning.
|
|
46
|
+
*/
|
|
47
|
+
minWarningComponentDepth?: number;
|
|
48
|
+
/**
|
|
49
|
+
* The depth in the React component tree of the deepest warning.
|
|
50
|
+
*/
|
|
51
|
+
maxWarningComponentDepth?: number;
|
|
52
|
+
};
|
|
35
53
|
export type Config = {
|
|
36
54
|
readonly enabled?: boolean;
|
|
37
55
|
readonly interactionTimeout?: Record<string, number>;
|
|
@@ -115,12 +133,18 @@ export type Config = {
|
|
|
115
133
|
readonly shouldCalculateLighthouseMetricsFromTTAI?: boolean;
|
|
116
134
|
readonly timeWindowForLateMutationsInMilliseconds?: number;
|
|
117
135
|
readonly manuallyTrackReactProfilerMounts?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Callback for consumers to provide React hydration stats after React has finished.
|
|
138
|
+
* Return {@code null} if hydration was not attempted or if we do not want to report any stats.
|
|
139
|
+
*/
|
|
140
|
+
readonly getReactHydrationStats?: (() => ReactHydrationStats | undefined) | undefined;
|
|
118
141
|
};
|
|
119
142
|
export declare function setUFOConfig(newConfig: Config): void;
|
|
120
143
|
export declare function getConfig(): Config | undefined;
|
|
121
144
|
export declare function getEnabledVCRevisions(experienceKey?: string): readonly TTVCRevision[];
|
|
122
145
|
export declare function isVCRevisionEnabled(revision: TTVCRevision, experienceKey?: string): boolean;
|
|
123
146
|
export declare function getMostRecentVCRevision(experienceKey?: string): TTVCRevision;
|
|
147
|
+
export declare function getReactHydrationStats(): ReactHydrationStats | undefined;
|
|
124
148
|
export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
|
|
125
149
|
export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
|
|
126
150
|
export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
|