@atlaskit/react-ufo 4.2.6 → 4.3.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 +14 -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/index.js +13 -5
- package/dist/cjs/interaction-metrics/index.js +1 -0
- package/dist/cjs/resource-timing/main.js +1 -2
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +26 -22
- package/dist/es2019/config/index.js +14 -0
- package/dist/es2019/create-payload/index.js +11 -1
- package/dist/es2019/interaction-metrics/index.js +2 -1
- package/dist/es2019/resource-timing/main.js +1 -2
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +4 -0
- package/dist/esm/config/index.js +38 -24
- package/dist/esm/create-payload/index.js +13 -5
- package/dist/esm/interaction-metrics/index.js +2 -1
- package/dist/esm/resource-timing/main.js +1 -2
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +26 -22
- 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 +4 -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
|
}
|
|
@@ -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')) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
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
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { getConfig as getConfigUFO } from '../config';
|
|
6
5
|
import { roundEpsilon } from '../round-number';
|
|
7
6
|
import { getConfig } from './common/utils/config';
|
|
@@ -95,7 +94,7 @@ function getNetworkData(item, eventStart) {
|
|
|
95
94
|
ttfb: ttfb,
|
|
96
95
|
serverTime: serverTime,
|
|
97
96
|
networkTime: networkTime,
|
|
98
|
-
requestStart:
|
|
97
|
+
requestStart: requestStartRelative
|
|
99
98
|
}, getSizeObject(transferSize));
|
|
100
99
|
}
|
|
101
100
|
export function getResourceTimings(interactionStart, interactionEnd) {
|
|
@@ -10,6 +10,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
10
10
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
11
11
|
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; } }
|
|
12
12
|
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; }
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { calculateTTVCPercentilesWithDebugInfo } from './percentile-calc';
|
|
14
15
|
import getViewportHeight from './utils/get-viewport-height';
|
|
15
16
|
import getViewportWidth from './utils/get-viewport-width';
|
|
@@ -84,8 +85,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
84
85
|
while (1) switch (_context.prev = _context.next) {
|
|
85
86
|
case 0:
|
|
86
87
|
percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99];
|
|
88
|
+
if (fg('platform_ufo_send_vc_100')) {
|
|
89
|
+
percentiles.push(100);
|
|
90
|
+
}
|
|
87
91
|
viewportEntries = this.filterViewportEntries(filteredEntries);
|
|
88
|
-
_context.next =
|
|
92
|
+
_context.next = 5;
|
|
89
93
|
return calculateTTVCPercentilesWithDebugInfo({
|
|
90
94
|
viewport: {
|
|
91
95
|
width: getViewportWidth(),
|
|
@@ -95,31 +99,31 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
95
99
|
stopTime: stopTime,
|
|
96
100
|
orderedEntries: viewportEntries
|
|
97
101
|
});
|
|
98
|
-
case
|
|
102
|
+
case 5:
|
|
99
103
|
vcLogs = _context.sent;
|
|
100
104
|
vcDetails = {};
|
|
101
105
|
percentileIndex = 0;
|
|
102
106
|
entryDataBuffer = new Set();
|
|
103
107
|
if (!vcLogs) {
|
|
104
|
-
_context.next =
|
|
108
|
+
_context.next = 29;
|
|
105
109
|
break;
|
|
106
110
|
}
|
|
107
111
|
_iterator3 = _createForOfIteratorHelper(vcLogs);
|
|
108
|
-
_context.prev =
|
|
112
|
+
_context.prev = 11;
|
|
109
113
|
_iterator3.s();
|
|
110
|
-
case
|
|
114
|
+
case 13:
|
|
111
115
|
if ((_step3 = _iterator3.n()).done) {
|
|
112
|
-
_context.next =
|
|
116
|
+
_context.next = 21;
|
|
113
117
|
break;
|
|
114
118
|
}
|
|
115
119
|
_entry2 = _step3.value;
|
|
116
120
|
time = _entry2.time, viewportPercentage = _entry2.viewportPercentage, entries = _entry2.entries; // Only process entries if we haven't reached all percentiles
|
|
117
121
|
if (!(percentileIndex >= percentiles.length)) {
|
|
118
|
-
_context.next =
|
|
122
|
+
_context.next = 18;
|
|
119
123
|
break;
|
|
120
124
|
}
|
|
121
|
-
return _context.abrupt("break",
|
|
122
|
-
case
|
|
125
|
+
return _context.abrupt("break", 21);
|
|
126
|
+
case 18:
|
|
123
127
|
// Check if this entry matches any checkpoint percentiles
|
|
124
128
|
if (viewportPercentage >= percentiles[percentileIndex]) {
|
|
125
129
|
elementNames = entries.map(function (e) {
|
|
@@ -141,21 +145,21 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
141
145
|
return entryDataBuffer.add(e);
|
|
142
146
|
});
|
|
143
147
|
}
|
|
144
|
-
case
|
|
145
|
-
_context.next =
|
|
148
|
+
case 19:
|
|
149
|
+
_context.next = 13;
|
|
146
150
|
break;
|
|
147
|
-
case
|
|
148
|
-
_context.next =
|
|
151
|
+
case 21:
|
|
152
|
+
_context.next = 26;
|
|
149
153
|
break;
|
|
150
|
-
case
|
|
151
|
-
_context.prev =
|
|
152
|
-
_context.t0 = _context["catch"](
|
|
154
|
+
case 23:
|
|
155
|
+
_context.prev = 23;
|
|
156
|
+
_context.t0 = _context["catch"](11);
|
|
153
157
|
_iterator3.e(_context.t0);
|
|
154
|
-
case
|
|
155
|
-
_context.prev =
|
|
158
|
+
case 26:
|
|
159
|
+
_context.prev = 26;
|
|
156
160
|
_iterator3.f();
|
|
157
|
-
return _context.finish(
|
|
158
|
-
case
|
|
161
|
+
return _context.finish(26);
|
|
162
|
+
case 29:
|
|
159
163
|
// Fill in any missing percentiles with the last known values
|
|
160
164
|
previousResult = {
|
|
161
165
|
t: 0,
|
|
@@ -294,11 +298,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
294
298
|
}
|
|
295
299
|
}
|
|
296
300
|
return _context.abrupt("return", vcDetails);
|
|
297
|
-
case
|
|
301
|
+
case 39:
|
|
298
302
|
case "end":
|
|
299
303
|
return _context.stop();
|
|
300
304
|
}
|
|
301
|
-
}, _callee, this, [[
|
|
305
|
+
}, _callee, this, [[11, 23, 26, 29]]);
|
|
302
306
|
}));
|
|
303
307
|
function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
304
308
|
return _calculateWithDebugInfo.apply(this, arguments);
|
|
@@ -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;
|