@atlaskit/react-ufo 3.1.0 → 3.1.2
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 +19 -0
- package/dist/cjs/common/constants.js +12 -3
- package/dist/cjs/create-payload/common/utils/index.js +3 -4
- package/dist/cjs/create-payload/index.js +26 -27
- package/dist/cjs/create-post-interaction-log-payload/index.js +1 -1
- package/dist/cjs/vc/vc-observer/index.js +5 -4
- package/dist/cjs/vc/vc-observer/revisions/fy25_01.js +42 -32
- package/dist/cjs/vc/vc-observer/revisions/fy25_02.js +68 -0
- package/dist/cjs/vc/vc-observer/revisions/revisions.js +4 -4
- package/dist/es2019/common/constants.js +10 -2
- package/dist/es2019/create-payload/common/utils/index.js +2 -4
- package/dist/es2019/create-payload/index.js +27 -28
- package/dist/es2019/create-post-interaction-log-payload/index.js +2 -2
- package/dist/es2019/vc/vc-observer/index.js +2 -2
- package/dist/es2019/vc/vc-observer/revisions/fy25_01.js +37 -24
- package/dist/es2019/vc/vc-observer/revisions/fy25_02.js +44 -0
- package/dist/es2019/vc/vc-observer/revisions/revisions.js +4 -4
- package/dist/esm/common/constants.js +10 -2
- package/dist/esm/create-payload/common/utils/index.js +2 -4
- package/dist/esm/create-payload/index.js +27 -28
- package/dist/esm/create-post-interaction-log-payload/index.js +2 -2
- package/dist/esm/vc/vc-observer/index.js +5 -4
- package/dist/esm/vc/vc-observer/revisions/fy25_01.js +42 -32
- package/dist/esm/vc/vc-observer/revisions/fy25_02.js +61 -0
- package/dist/esm/vc/vc-observer/revisions/revisions.js +4 -4
- package/dist/types/common/constants.d.ts +2 -1
- package/dist/types/create-payload/common/utils/index.d.ts +2 -1
- package/dist/types/create-payload/index.d.ts +0 -32
- package/dist/types/vc/vc-observer/revisions/fy25_01.d.ts +4 -7
- package/dist/types/vc/vc-observer/revisions/fy25_02.d.ts +16 -0
- package/dist/types-ts4.5/common/constants.d.ts +2 -1
- package/dist/types-ts4.5/create-payload/common/utils/index.d.ts +2 -1
- package/dist/types-ts4.5/create-payload/index.d.ts +0 -32
- package/dist/types-ts4.5/vc/vc-observer/revisions/fy25_01.d.ts +4 -7
- package/dist/types-ts4.5/vc/vc-observer/revisions/fy25_02.d.ts +16 -0
- package/package.json +1 -1
- package/dist/cjs/vc/vc-observer/revisions/fy24_01.js +0 -78
- package/dist/es2019/vc/vc-observer/revisions/fy24_01.js +0 -57
- package/dist/esm/vc/vc-observer/revisions/fy24_01.js +0 -71
- package/dist/types/vc/vc-observer/revisions/fy24_01.d.ts +0 -13
- package/dist/types-ts4.5/vc/vc-observer/revisions/fy24_01.d.ts +0 -13
|
@@ -4,7 +4,7 @@ import { getLighthouseMetrics } from '../additional-payload';
|
|
|
4
4
|
import { CHRReporter } from '../assets';
|
|
5
5
|
import * as bundleEvalTiming from '../bundle-eval-timing';
|
|
6
6
|
import coinflip from '../coinflip';
|
|
7
|
-
import {
|
|
7
|
+
import { getReactUFOVersion } from '../common/constants';
|
|
8
8
|
import { getConfig, getExperimentalInteractionRate, getUfoNameOverrides } from '../config';
|
|
9
9
|
import { getExperimentalVCMetrics } from '../create-experimental-interaction-metrics-payload';
|
|
10
10
|
import { getBm3Timings } from '../custom-timings';
|
|
@@ -383,7 +383,7 @@ function optimizeCustomData(interaction) {
|
|
|
383
383
|
const label = stringifyLabelStackFully(labelStack);
|
|
384
384
|
const value = (_result$get$data = (_result$get = result.get(label)) === null || _result$get === void 0 ? void 0 : _result$get.data) !== null && _result$get$data !== void 0 ? _result$get$data : {};
|
|
385
385
|
result.set(label, {
|
|
386
|
-
labelStack: optimizeLabelStack(labelStack),
|
|
386
|
+
labelStack: optimizeLabelStack(labelStack, getReactUFOVersion(interaction.type)),
|
|
387
387
|
data: Object.assign(value, data)
|
|
388
388
|
});
|
|
389
389
|
return result;
|
|
@@ -395,7 +395,7 @@ function optimizeCustomData(interaction) {
|
|
|
395
395
|
const label = stringifyLabelStackFully([]);
|
|
396
396
|
const labelValue = (_result$get$data2 = (_result$get2 = result.get(label)) === null || _result$get2 === void 0 ? void 0 : _result$get2.data) !== null && _result$get$data2 !== void 0 ? _result$get$data2 : {};
|
|
397
397
|
result.set(label, {
|
|
398
|
-
labelStack: optimizeLabelStack([]),
|
|
398
|
+
labelStack: optimizeLabelStack([], getReactUFOVersion(interaction.type)),
|
|
399
399
|
data: Object.assign(labelValue, {
|
|
400
400
|
[key]: value
|
|
401
401
|
})
|
|
@@ -407,7 +407,7 @@ function optimizeCustomData(interaction) {
|
|
|
407
407
|
}
|
|
408
408
|
return [...customDataMap.values()];
|
|
409
409
|
}
|
|
410
|
-
function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart) {
|
|
410
|
+
function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart, reactUFOVersion) {
|
|
411
411
|
const reactProfilerTimingsMap = reactProfilerTimings.reduce((result, {
|
|
412
412
|
labelStack,
|
|
413
413
|
startTime,
|
|
@@ -420,7 +420,7 @@ function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart) {
|
|
|
420
420
|
const start = Math.round(startTime);
|
|
421
421
|
const end = Math.round(commitTime);
|
|
422
422
|
const timing = result.get(label) || {
|
|
423
|
-
labelStack: optimizeLabelStack(labelStack),
|
|
423
|
+
labelStack: optimizeLabelStack(labelStack, reactUFOVersion),
|
|
424
424
|
startTime: start,
|
|
425
425
|
endTime: end,
|
|
426
426
|
mountCount: 0,
|
|
@@ -467,7 +467,7 @@ function optimizeRedirects(redirects, interactionStart) {
|
|
|
467
467
|
}, []);
|
|
468
468
|
return updatedRedirects;
|
|
469
469
|
}
|
|
470
|
-
function optimizeHoldInfo(holdInfo, interactionStart) {
|
|
470
|
+
function optimizeHoldInfo(holdInfo, interactionStart, reactUFOVersion) {
|
|
471
471
|
const holdInfoMap = holdInfo.reduce((result, hold) => {
|
|
472
472
|
const {
|
|
473
473
|
labelStack,
|
|
@@ -485,7 +485,7 @@ function optimizeHoldInfo(holdInfo, interactionStart) {
|
|
|
485
485
|
const timing = result.get(label) || {
|
|
486
486
|
labelStack: optimizeLabelStack([...labelStack, {
|
|
487
487
|
name
|
|
488
|
-
}]),
|
|
488
|
+
}], reactUFOVersion),
|
|
489
489
|
startTime,
|
|
490
490
|
endTime
|
|
491
491
|
};
|
|
@@ -501,7 +501,7 @@ function optimizeHoldInfo(holdInfo, interactionStart) {
|
|
|
501
501
|
}, new Map());
|
|
502
502
|
return [...holdInfoMap.values()];
|
|
503
503
|
}
|
|
504
|
-
function optimizeSpans(spans, interactionStart) {
|
|
504
|
+
function optimizeSpans(spans, interactionStart, reactUFOVersion) {
|
|
505
505
|
const updatedSpans = spans.reduce((result, span) => {
|
|
506
506
|
const {
|
|
507
507
|
labelStack,
|
|
@@ -514,7 +514,7 @@ function optimizeSpans(spans, interactionStart) {
|
|
|
514
514
|
result.push({
|
|
515
515
|
labelStack: optimizeLabelStack([...labelStack, {
|
|
516
516
|
name
|
|
517
|
-
}]),
|
|
517
|
+
}], reactUFOVersion),
|
|
518
518
|
startTime: Math.round(start),
|
|
519
519
|
endTime: Math.round(end),
|
|
520
520
|
type
|
|
@@ -524,7 +524,7 @@ function optimizeSpans(spans, interactionStart) {
|
|
|
524
524
|
}, []);
|
|
525
525
|
return updatedSpans;
|
|
526
526
|
}
|
|
527
|
-
function optimizeRequestInfo(requestInfo, interactionStart) {
|
|
527
|
+
function optimizeRequestInfo(requestInfo, interactionStart, reactUFOVersion) {
|
|
528
528
|
const updatedRequestInfo = requestInfo.reduce((result, reqInfo) => {
|
|
529
529
|
const {
|
|
530
530
|
labelStack,
|
|
@@ -540,7 +540,7 @@ function optimizeRequestInfo(requestInfo, interactionStart) {
|
|
|
540
540
|
result.push({
|
|
541
541
|
labelStack: optimizeLabelStack([...labelStack, {
|
|
542
542
|
name
|
|
543
|
-
}]),
|
|
543
|
+
}], reactUFOVersion),
|
|
544
544
|
startTime: Math.round(startTime),
|
|
545
545
|
endTime: Math.round(endTime)
|
|
546
546
|
});
|
|
@@ -565,18 +565,18 @@ function optimizeCustomTimings(customTimings, interactionStart) {
|
|
|
565
565
|
return result;
|
|
566
566
|
}, []);
|
|
567
567
|
}
|
|
568
|
-
function optimizeMarks(marks) {
|
|
568
|
+
function optimizeMarks(marks, reactUFOVersion) {
|
|
569
569
|
return marks.map(({
|
|
570
570
|
labelStack,
|
|
571
571
|
time,
|
|
572
572
|
...others
|
|
573
573
|
}) => ({
|
|
574
574
|
...others,
|
|
575
|
-
labelStack: labelStack && optimizeLabelStack(labelStack),
|
|
575
|
+
labelStack: labelStack && optimizeLabelStack(labelStack, reactUFOVersion),
|
|
576
576
|
time: Math.round(time)
|
|
577
577
|
}));
|
|
578
578
|
}
|
|
579
|
-
function optimizeApdex(apdex) {
|
|
579
|
+
function optimizeApdex(apdex, reactUFOVersion) {
|
|
580
580
|
return apdex.map(({
|
|
581
581
|
stopTime,
|
|
582
582
|
labelStack,
|
|
@@ -585,7 +585,7 @@ function optimizeApdex(apdex) {
|
|
|
585
585
|
...others,
|
|
586
586
|
stopTime: Math.round(stopTime),
|
|
587
587
|
...(labelStack ? {
|
|
588
|
-
labelStack: optimizeLabelStack(labelStack)
|
|
588
|
+
labelStack: optimizeLabelStack(labelStack, reactUFOVersion)
|
|
589
589
|
} : {})
|
|
590
590
|
}));
|
|
591
591
|
}
|
|
@@ -723,14 +723,14 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
723
723
|
const pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
724
724
|
const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
725
725
|
const segments = config.killswitchNestedSegments ? [] : knownSegments;
|
|
726
|
-
const segmentTree =
|
|
726
|
+
const segmentTree = getReactUFOVersion(interaction.type) === '2.0.0' ? buildSegmentTree(segments.map(segment => segment.labelStack)) : {};
|
|
727
727
|
const isDetailedPayload = pageVisibilityAtTTAI === 'visible';
|
|
728
728
|
const isPageLoad = type === 'page_load';
|
|
729
729
|
const calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
|
|
730
730
|
const moreAccuratePageVisibilityAtTTI = calculatePageVisibilityFromTheStartOfPageLoad ? getMoreAccuratePageVisibilityUpToTTI(interaction) : null;
|
|
731
731
|
const moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? getMoreAccuratePageVisibilityUpToTTAI(interaction) : null;
|
|
732
732
|
const labelStack = interaction.labelStack ? {
|
|
733
|
-
labelStack: optimizeLabelStack(interaction.labelStack)
|
|
733
|
+
labelStack: optimizeLabelStack(interaction.labelStack, getReactUFOVersion(interaction.type))
|
|
734
734
|
} : {};
|
|
735
735
|
// Page Load
|
|
736
736
|
const getPageLoadInteractionMetrics = () => {
|
|
@@ -762,13 +762,13 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
762
762
|
...others
|
|
763
763
|
}) => ({
|
|
764
764
|
...others,
|
|
765
|
-
labelStack: labelStack && optimizeLabelStack(labelStack)
|
|
765
|
+
labelStack: labelStack && optimizeLabelStack(labelStack, getReactUFOVersion(interaction.type))
|
|
766
766
|
})),
|
|
767
767
|
holdActive: [...interaction.holdActive.values()],
|
|
768
768
|
redirects: optimizeRedirects(interaction.redirects, start),
|
|
769
|
-
holdInfo: optimizeHoldInfo(experimental ? interaction.holdExpInfo : interaction.holdInfo, start),
|
|
770
|
-
spans: optimizeSpans(spans, start),
|
|
771
|
-
requestInfo: optimizeRequestInfo(interaction.requestInfo, start),
|
|
769
|
+
holdInfo: optimizeHoldInfo(experimental ? interaction.holdExpInfo : interaction.holdInfo, start, getReactUFOVersion(interaction.type)),
|
|
770
|
+
spans: optimizeSpans(spans, start, getReactUFOVersion(interaction.type)),
|
|
771
|
+
requestInfo: optimizeRequestInfo(interaction.requestInfo, start, getReactUFOVersion(interaction.type)),
|
|
772
772
|
customTimings: optimizeCustomTimings(interaction.customTimings, start),
|
|
773
773
|
bundleEvalTimings: objectToArray(getBundleEvalTimings(start)),
|
|
774
774
|
resourceTimings: objectToArray(resourceTimings)
|
|
@@ -808,8 +808,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
808
808
|
'event:sizeInKb': 0,
|
|
809
809
|
'event:source': {
|
|
810
810
|
name: 'react-ufo/web',
|
|
811
|
-
version:
|
|
812
|
-
payloadSource: 'platform'
|
|
811
|
+
version: getReactUFOVersion(interaction.type)
|
|
813
812
|
},
|
|
814
813
|
'event:region': config.region || 'unknown',
|
|
815
814
|
'experience:key': experimental ? 'custom.experimental-interaction-metrics' : 'custom.interaction-metrics',
|
|
@@ -845,19 +844,19 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
845
844
|
isPreviousInteractionAborted,
|
|
846
845
|
abortedByInteractionName,
|
|
847
846
|
// performance
|
|
848
|
-
apdex: optimizeApdex(interaction.apdex),
|
|
847
|
+
apdex: optimizeApdex(interaction.apdex, getReactUFOVersion(interaction.type)),
|
|
849
848
|
end: Math.round(end),
|
|
850
849
|
start: Math.round(start),
|
|
851
|
-
segments:
|
|
850
|
+
segments: getReactUFOVersion(interaction.type) === '2.0.0' ? segmentTree : segments.map(({
|
|
852
851
|
labelStack,
|
|
853
852
|
...others
|
|
854
853
|
}) => ({
|
|
855
854
|
...others,
|
|
856
|
-
labelStack: optimizeLabelStack(labelStack)
|
|
855
|
+
labelStack: optimizeLabelStack(labelStack, getReactUFOVersion(interaction.type))
|
|
857
856
|
})),
|
|
858
|
-
marks: optimizeMarks(interaction.marks),
|
|
857
|
+
marks: optimizeMarks(interaction.marks, getReactUFOVersion(interaction.type)),
|
|
859
858
|
customData: optimizeCustomData(interaction),
|
|
860
|
-
reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start),
|
|
859
|
+
reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start, getReactUFOVersion(interaction.type)),
|
|
861
860
|
...labelStack,
|
|
862
861
|
...getPageLoadInteractionMetrics(),
|
|
863
862
|
...getDetailedInteractionMetrics(resourceTimings),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import coinflip from '../coinflip';
|
|
2
|
-
import {
|
|
2
|
+
import { getReactUFOVersion } from '../common/constants';
|
|
3
3
|
import { getConfig, getPostInteractionRate } from '../config';
|
|
4
4
|
import { isSegmentLabel, sanitizeUfoName } from '../create-payload/common/utils';
|
|
5
5
|
import { getPageVisibilityState } from '../hidden-timing';
|
|
@@ -168,7 +168,7 @@ export default function createPostInteractionLogPayload({
|
|
|
168
168
|
'event:schema': '1.0.0',
|
|
169
169
|
'event:source': {
|
|
170
170
|
name: 'react-ufo/web',
|
|
171
|
-
version:
|
|
171
|
+
version: getReactUFOVersion(lastInteractionFinish.type),
|
|
172
172
|
payloadSource: 'platform'
|
|
173
173
|
},
|
|
174
174
|
'event:region': config.region || 'unknown',
|
|
@@ -541,7 +541,7 @@ export class VCObserver {
|
|
|
541
541
|
if ((VC[key] === null || VC[key] === undefined) && VCRatio >= value / 100) {
|
|
542
542
|
var _componentsLog$time;
|
|
543
543
|
VC[key] = time;
|
|
544
|
-
VCBox[key] = (_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.map(v => v.targetName);
|
|
544
|
+
VCBox[key] = [...new Set((_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.map(v => v.targetName))];
|
|
545
545
|
}
|
|
546
546
|
});
|
|
547
547
|
return VCRatio;
|
|
@@ -550,7 +550,7 @@ export class VCObserver {
|
|
|
550
550
|
var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
|
|
551
551
|
const currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
|
|
552
552
|
const currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
|
|
553
|
-
const logEntry = (_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.map(v => v.targetName);
|
|
553
|
+
const logEntry = [...new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.map(v => v.targetName))];
|
|
554
554
|
const ratioDelta = (currentlyPaintedRatio - ((_acc$rel$vc = (_acc$rel = acc.rel[i - 1]) === null || _acc$rel === void 0 ? void 0 : _acc$rel.vc) !== null && _acc$rel$vc !== void 0 ? _acc$rel$vc : 0)) / 100;
|
|
555
555
|
if (isCalcSpeedIndexEnabled) {
|
|
556
556
|
const speedIndex = timestamp * ratioDelta;
|
|
@@ -1,43 +1,56 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { ViewportUpdateClassifier } from './ViewportUpdateClassifier';
|
|
4
|
+
const legacyIgnoreReasons = ['image', 'ssr-hydration', 'editor-lazy-node-view', 'editor-container-mutation'];
|
|
5
|
+
export class FY25_01Classifier extends ViewportUpdateClassifier {
|
|
6
|
+
VCCalculationMethod({
|
|
7
|
+
VCParts,
|
|
8
|
+
entries,
|
|
9
|
+
totalPainted,
|
|
10
|
+
componentsLog
|
|
9
11
|
}) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const VC = {};
|
|
13
|
+
const VCBox = {};
|
|
14
|
+
entries.reduce((acc = 0, v) => {
|
|
15
|
+
let VCRatio = v[1] / totalPainted + acc;
|
|
16
|
+
const time = v[0];
|
|
17
|
+
if (fg('platform_ufo_fix_vc_observer_rounding_error')) {
|
|
18
|
+
// @todo apply fix to include small changes into accumulator
|
|
19
|
+
const preciseCurrRatio = Math.round(100 * (v[1] / totalPainted));
|
|
20
|
+
const preciseAccRatio = Math.round(acc * 100);
|
|
21
|
+
VCRatio = (preciseCurrRatio + preciseAccRatio) / 100;
|
|
22
|
+
}
|
|
23
|
+
VCParts.forEach(value => {
|
|
24
|
+
if ((VC[value] === null || VC[value] === undefined) && VCRatio >= value / 100) {
|
|
25
|
+
var _componentsLog$time;
|
|
26
|
+
VC[value] = time;
|
|
27
|
+
VCBox[value] = new Set();
|
|
28
|
+
(_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.forEach(v => {
|
|
29
|
+
var _VCBox$value;
|
|
30
|
+
return (_VCBox$value = VCBox[value]) === null || _VCBox$value === void 0 ? void 0 : _VCBox$value.add(v.targetName);
|
|
31
|
+
});
|
|
18
32
|
}
|
|
19
33
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
return VCRatio;
|
|
35
|
+
}, 0);
|
|
36
|
+
return {
|
|
37
|
+
VC,
|
|
38
|
+
VCBox
|
|
39
|
+
};
|
|
26
40
|
}
|
|
27
41
|
constructor() {
|
|
28
42
|
super();
|
|
29
43
|
_defineProperty(this, "revision", 'fy25.01');
|
|
30
|
-
_defineProperty(this, "types", ['
|
|
44
|
+
_defineProperty(this, "types", ['html', 'text']);
|
|
31
45
|
_defineProperty(this, "filters", [{
|
|
32
|
-
name: '
|
|
46
|
+
name: 'default-ignore-reasons',
|
|
33
47
|
filter: ({
|
|
34
48
|
type,
|
|
35
49
|
ignoreReason
|
|
36
50
|
}) => {
|
|
37
|
-
return !
|
|
51
|
+
return !ignoreReason || !legacyIgnoreReasons.includes(ignoreReason);
|
|
38
52
|
}
|
|
39
53
|
}]);
|
|
40
|
-
_defineProperty(this, "removedFilters", []);
|
|
41
54
|
this.mergeConfig();
|
|
42
55
|
}
|
|
43
56
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { FY25_01Classifier } from './fy25_01';
|
|
4
|
+
export class FY25_02Classifier extends FY25_01Classifier {
|
|
5
|
+
// @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
|
|
6
|
+
filterComponentsLog({
|
|
7
|
+
componentsLog,
|
|
8
|
+
ttai
|
|
9
|
+
}) {
|
|
10
|
+
let _componentsLog = {};
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
13
|
+
if (fg('ufo-remove-vc-component-observations-after-ttai')) {
|
|
14
|
+
Object.entries(componentsLog).forEach(([_timestamp, value]) => {
|
|
15
|
+
const timestamp = Number(_timestamp);
|
|
16
|
+
if (ttai > timestamp) {
|
|
17
|
+
_componentsLog[timestamp] = value;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
_componentsLog = {
|
|
22
|
+
...componentsLog
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return _componentsLog;
|
|
26
|
+
}
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
_defineProperty(this, "revision", 'fy25.02');
|
|
30
|
+
_defineProperty(this, "types", ['attr']);
|
|
31
|
+
_defineProperty(this, "filters", [{
|
|
32
|
+
name: 'not-visible',
|
|
33
|
+
filter: ({
|
|
34
|
+
type,
|
|
35
|
+
ignoreReason
|
|
36
|
+
}) => {
|
|
37
|
+
return !(ignoreReason !== null && ignoreReason !== void 0 && ignoreReason.includes('not-visible'));
|
|
38
|
+
}
|
|
39
|
+
}]);
|
|
40
|
+
_defineProperty(this, "removedFilters", []);
|
|
41
|
+
this.mergeConfig();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export const revFY25_02Classifier = new FY25_02Classifier();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { revFY24_01Classifier } from './fy24_01';
|
|
2
1
|
import { revFY25_01Classifier } from './fy25_01';
|
|
2
|
+
import { revFY25_02Classifier } from './fy25_02';
|
|
3
3
|
const Revisions = [{
|
|
4
|
-
name: 'fy24.01',
|
|
5
|
-
classifier: revFY24_01Classifier
|
|
6
|
-
}, {
|
|
7
4
|
name: 'fy25.01',
|
|
8
5
|
classifier: revFY25_01Classifier
|
|
6
|
+
}, {
|
|
7
|
+
name: 'fy25.02',
|
|
8
|
+
classifier: revFY25_02Classifier
|
|
9
9
|
}];
|
|
10
10
|
let revisionResultCache = null;
|
|
11
11
|
export const getRevisions = () => {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
export var getReactUFOVersion = function getReactUFOVersion(interactionType) {
|
|
3
|
+
if (interactionType !== 'page_load' && interactionType !== 'transition') {
|
|
4
|
+
return '1.0.1';
|
|
5
|
+
}
|
|
2
6
|
|
|
3
|
-
// eslint-disable-next-line @atlaskit/platform/
|
|
4
|
-
|
|
7
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
8
|
+
if (!fg('enable-react-ufo-payload-segment-compressed')) {
|
|
9
|
+
return '1.0.1';
|
|
10
|
+
}
|
|
11
|
+
return '2.0.0';
|
|
12
|
+
};
|
|
@@ -1,8 +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
|
-
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
|
5
|
-
import { REACT_UFO_VERSION } from '../../../common/constants';
|
|
6
4
|
export var sanitizeUfoName = function sanitizeUfoName(name) {
|
|
7
5
|
return name.replace(/_/g, '-');
|
|
8
6
|
};
|
|
@@ -51,8 +49,8 @@ function getLabelStackReference(labelStack) {
|
|
|
51
49
|
export function labelStackStartWith(labelStack, startWith) {
|
|
52
50
|
return stringifyLabelStackFully(labelStack).startsWith(stringifyLabelStackFully(startWith));
|
|
53
51
|
}
|
|
54
|
-
export function optimizeLabelStack(labelStack) {
|
|
55
|
-
return
|
|
52
|
+
export function optimizeLabelStack(labelStack, reactUFOVersion) {
|
|
53
|
+
return reactUFOVersion ? getLabelStackReference(labelStack) : labelStack.map(function (ls) {
|
|
56
54
|
return _objectSpread({
|
|
57
55
|
n: ls.name
|
|
58
56
|
}, ls.segmentId ? {
|
|
@@ -14,7 +14,7 @@ import { getLighthouseMetrics } from '../additional-payload';
|
|
|
14
14
|
import { CHRReporter } from '../assets';
|
|
15
15
|
import * as bundleEvalTiming from '../bundle-eval-timing';
|
|
16
16
|
import coinflip from '../coinflip';
|
|
17
|
-
import {
|
|
17
|
+
import { getReactUFOVersion } from '../common/constants';
|
|
18
18
|
import { getConfig, getExperimentalInteractionRate, getUfoNameOverrides } from '../config';
|
|
19
19
|
import { getExperimentalVCMetrics } from '../create-experimental-interaction-metrics-payload';
|
|
20
20
|
import { getBm3Timings } from '../custom-timings';
|
|
@@ -382,7 +382,7 @@ function optimizeCustomData(interaction) {
|
|
|
382
382
|
var label = stringifyLabelStackFully(labelStack);
|
|
383
383
|
var value = (_result$get$data = (_result$get = result.get(label)) === null || _result$get === void 0 ? void 0 : _result$get.data) !== null && _result$get$data !== void 0 ? _result$get$data : {};
|
|
384
384
|
result.set(label, {
|
|
385
|
-
labelStack: optimizeLabelStack(labelStack),
|
|
385
|
+
labelStack: optimizeLabelStack(labelStack, getReactUFOVersion(interaction.type)),
|
|
386
386
|
data: Object.assign(value, data)
|
|
387
387
|
});
|
|
388
388
|
return result;
|
|
@@ -399,7 +399,7 @@ function optimizeCustomData(interaction) {
|
|
|
399
399
|
var label = stringifyLabelStackFully([]);
|
|
400
400
|
var labelValue = (_result$get$data2 = (_result$get2 = result.get(label)) === null || _result$get2 === void 0 ? void 0 : _result$get2.data) !== null && _result$get$data2 !== void 0 ? _result$get$data2 : {};
|
|
401
401
|
result.set(label, {
|
|
402
|
-
labelStack: optimizeLabelStack([]),
|
|
402
|
+
labelStack: optimizeLabelStack([], getReactUFOVersion(interaction.type)),
|
|
403
403
|
data: Object.assign(labelValue, _defineProperty({}, _key, value))
|
|
404
404
|
});
|
|
405
405
|
}
|
|
@@ -409,7 +409,7 @@ function optimizeCustomData(interaction) {
|
|
|
409
409
|
}
|
|
410
410
|
return _toConsumableArray(customDataMap.values());
|
|
411
411
|
}
|
|
412
|
-
function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart) {
|
|
412
|
+
function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart, reactUFOVersion) {
|
|
413
413
|
var reactProfilerTimingsMap = reactProfilerTimings.reduce(function (result, _ref3) {
|
|
414
414
|
var labelStack = _ref3.labelStack,
|
|
415
415
|
startTime = _ref3.startTime,
|
|
@@ -421,7 +421,7 @@ function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart) {
|
|
|
421
421
|
var start = Math.round(startTime);
|
|
422
422
|
var end = Math.round(commitTime);
|
|
423
423
|
var timing = result.get(label) || {
|
|
424
|
-
labelStack: optimizeLabelStack(labelStack),
|
|
424
|
+
labelStack: optimizeLabelStack(labelStack, reactUFOVersion),
|
|
425
425
|
startTime: start,
|
|
426
426
|
endTime: end,
|
|
427
427
|
mountCount: 0,
|
|
@@ -468,7 +468,7 @@ function optimizeRedirects(redirects, interactionStart) {
|
|
|
468
468
|
}, []);
|
|
469
469
|
return updatedRedirects;
|
|
470
470
|
}
|
|
471
|
-
function optimizeHoldInfo(holdInfo, interactionStart) {
|
|
471
|
+
function optimizeHoldInfo(holdInfo, interactionStart, reactUFOVersion) {
|
|
472
472
|
var holdInfoMap = holdInfo.reduce(function (result, hold) {
|
|
473
473
|
var labelStack = hold.labelStack,
|
|
474
474
|
name = hold.name,
|
|
@@ -484,7 +484,7 @@ function optimizeHoldInfo(holdInfo, interactionStart) {
|
|
|
484
484
|
var timing = result.get(label) || {
|
|
485
485
|
labelStack: optimizeLabelStack([].concat(_toConsumableArray(labelStack), [{
|
|
486
486
|
name: name
|
|
487
|
-
}])),
|
|
487
|
+
}]), reactUFOVersion),
|
|
488
488
|
startTime: startTime,
|
|
489
489
|
endTime: endTime
|
|
490
490
|
};
|
|
@@ -500,7 +500,7 @@ function optimizeHoldInfo(holdInfo, interactionStart) {
|
|
|
500
500
|
}, new Map());
|
|
501
501
|
return _toConsumableArray(holdInfoMap.values());
|
|
502
502
|
}
|
|
503
|
-
function optimizeSpans(spans, interactionStart) {
|
|
503
|
+
function optimizeSpans(spans, interactionStart, reactUFOVersion) {
|
|
504
504
|
var updatedSpans = spans.reduce(function (result, span) {
|
|
505
505
|
var labelStack = span.labelStack,
|
|
506
506
|
type = span.type,
|
|
@@ -511,7 +511,7 @@ function optimizeSpans(spans, interactionStart) {
|
|
|
511
511
|
result.push({
|
|
512
512
|
labelStack: optimizeLabelStack([].concat(_toConsumableArray(labelStack), [{
|
|
513
513
|
name: name
|
|
514
|
-
}])),
|
|
514
|
+
}]), reactUFOVersion),
|
|
515
515
|
startTime: Math.round(start),
|
|
516
516
|
endTime: Math.round(end),
|
|
517
517
|
type: type
|
|
@@ -521,7 +521,7 @@ function optimizeSpans(spans, interactionStart) {
|
|
|
521
521
|
}, []);
|
|
522
522
|
return updatedSpans;
|
|
523
523
|
}
|
|
524
|
-
function optimizeRequestInfo(requestInfo, interactionStart) {
|
|
524
|
+
function optimizeRequestInfo(requestInfo, interactionStart, reactUFOVersion) {
|
|
525
525
|
var updatedRequestInfo = requestInfo.reduce(function (result, reqInfo) {
|
|
526
526
|
var labelStack = reqInfo.labelStack,
|
|
527
527
|
name = reqInfo.name,
|
|
@@ -535,7 +535,7 @@ function optimizeRequestInfo(requestInfo, interactionStart) {
|
|
|
535
535
|
result.push({
|
|
536
536
|
labelStack: optimizeLabelStack([].concat(_toConsumableArray(labelStack), [{
|
|
537
537
|
name: name
|
|
538
|
-
}])),
|
|
538
|
+
}]), reactUFOVersion),
|
|
539
539
|
startTime: Math.round(startTime),
|
|
540
540
|
endTime: Math.round(endTime)
|
|
541
541
|
});
|
|
@@ -560,18 +560,18 @@ function optimizeCustomTimings(customTimings, interactionStart) {
|
|
|
560
560
|
return result;
|
|
561
561
|
}, []);
|
|
562
562
|
}
|
|
563
|
-
function optimizeMarks(marks) {
|
|
563
|
+
function optimizeMarks(marks, reactUFOVersion) {
|
|
564
564
|
return marks.map(function (_ref4) {
|
|
565
565
|
var labelStack = _ref4.labelStack,
|
|
566
566
|
time = _ref4.time,
|
|
567
567
|
others = _objectWithoutProperties(_ref4, _excluded);
|
|
568
568
|
return _objectSpread(_objectSpread({}, others), {}, {
|
|
569
|
-
labelStack: labelStack && optimizeLabelStack(labelStack),
|
|
569
|
+
labelStack: labelStack && optimizeLabelStack(labelStack, reactUFOVersion),
|
|
570
570
|
time: Math.round(time)
|
|
571
571
|
});
|
|
572
572
|
});
|
|
573
573
|
}
|
|
574
|
-
function optimizeApdex(apdex) {
|
|
574
|
+
function optimizeApdex(apdex, reactUFOVersion) {
|
|
575
575
|
return apdex.map(function (_ref5) {
|
|
576
576
|
var stopTime = _ref5.stopTime,
|
|
577
577
|
labelStack = _ref5.labelStack,
|
|
@@ -579,7 +579,7 @@ function optimizeApdex(apdex) {
|
|
|
579
579
|
return _objectSpread(_objectSpread({}, others), {}, {
|
|
580
580
|
stopTime: Math.round(stopTime)
|
|
581
581
|
}, labelStack ? {
|
|
582
|
-
labelStack: optimizeLabelStack(labelStack)
|
|
582
|
+
labelStack: optimizeLabelStack(labelStack, reactUFOVersion)
|
|
583
583
|
} : {});
|
|
584
584
|
});
|
|
585
585
|
}
|
|
@@ -715,7 +715,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
715
715
|
var pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
716
716
|
var pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
717
717
|
var segments = config.killswitchNestedSegments ? [] : knownSegments;
|
|
718
|
-
var segmentTree =
|
|
718
|
+
var segmentTree = getReactUFOVersion(interaction.type) === '2.0.0' ? buildSegmentTree(segments.map(function (segment) {
|
|
719
719
|
return segment.labelStack;
|
|
720
720
|
})) : {};
|
|
721
721
|
var isDetailedPayload = pageVisibilityAtTTAI === 'visible';
|
|
@@ -724,7 +724,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
724
724
|
var moreAccuratePageVisibilityAtTTI = calculatePageVisibilityFromTheStartOfPageLoad ? getMoreAccuratePageVisibilityUpToTTI(interaction) : null;
|
|
725
725
|
var moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? getMoreAccuratePageVisibilityUpToTTAI(interaction) : null;
|
|
726
726
|
var labelStack = interaction.labelStack ? {
|
|
727
|
-
labelStack: optimizeLabelStack(interaction.labelStack)
|
|
727
|
+
labelStack: optimizeLabelStack(interaction.labelStack, getReactUFOVersion(interaction.type))
|
|
728
728
|
} : {};
|
|
729
729
|
// Page Load
|
|
730
730
|
var getPageLoadInteractionMetrics = function getPageLoadInteractionMetrics() {
|
|
@@ -754,14 +754,14 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
754
754
|
var labelStack = _ref6.labelStack,
|
|
755
755
|
others = _objectWithoutProperties(_ref6, _excluded3);
|
|
756
756
|
return _objectSpread(_objectSpread({}, others), {}, {
|
|
757
|
-
labelStack: labelStack && optimizeLabelStack(labelStack)
|
|
757
|
+
labelStack: labelStack && optimizeLabelStack(labelStack, getReactUFOVersion(interaction.type))
|
|
758
758
|
});
|
|
759
759
|
}),
|
|
760
760
|
holdActive: _toConsumableArray(interaction.holdActive.values()),
|
|
761
761
|
redirects: optimizeRedirects(interaction.redirects, start),
|
|
762
|
-
holdInfo: optimizeHoldInfo(experimental ? interaction.holdExpInfo : interaction.holdInfo, start),
|
|
763
|
-
spans: optimizeSpans(spans, start),
|
|
764
|
-
requestInfo: optimizeRequestInfo(interaction.requestInfo, start),
|
|
762
|
+
holdInfo: optimizeHoldInfo(experimental ? interaction.holdExpInfo : interaction.holdInfo, start, getReactUFOVersion(interaction.type)),
|
|
763
|
+
spans: optimizeSpans(spans, start, getReactUFOVersion(interaction.type)),
|
|
764
|
+
requestInfo: optimizeRequestInfo(interaction.requestInfo, start, getReactUFOVersion(interaction.type)),
|
|
765
765
|
customTimings: optimizeCustomTimings(interaction.customTimings, start),
|
|
766
766
|
bundleEvalTimings: objectToArray(getBundleEvalTimings(start)),
|
|
767
767
|
resourceTimings: objectToArray(resourceTimings)
|
|
@@ -801,8 +801,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
801
801
|
'event:sizeInKb': 0,
|
|
802
802
|
'event:source': {
|
|
803
803
|
name: 'react-ufo/web',
|
|
804
|
-
version:
|
|
805
|
-
payloadSource: 'platform'
|
|
804
|
+
version: getReactUFOVersion(interaction.type)
|
|
806
805
|
},
|
|
807
806
|
'event:region': config.region || 'unknown',
|
|
808
807
|
'experience:key': experimental ? 'custom.experimental-interaction-metrics' : 'custom.interaction-metrics',
|
|
@@ -826,19 +825,19 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
826
825
|
isPreviousInteractionAborted: isPreviousInteractionAborted,
|
|
827
826
|
abortedByInteractionName: abortedByInteractionName,
|
|
828
827
|
// performance
|
|
829
|
-
apdex: optimizeApdex(interaction.apdex),
|
|
828
|
+
apdex: optimizeApdex(interaction.apdex, getReactUFOVersion(interaction.type)),
|
|
830
829
|
end: Math.round(end),
|
|
831
830
|
start: Math.round(start),
|
|
832
|
-
segments:
|
|
831
|
+
segments: getReactUFOVersion(interaction.type) === '2.0.0' ? segmentTree : segments.map(function (_ref7) {
|
|
833
832
|
var labelStack = _ref7.labelStack,
|
|
834
833
|
others = _objectWithoutProperties(_ref7, _excluded4);
|
|
835
834
|
return _objectSpread(_objectSpread({}, others), {}, {
|
|
836
|
-
labelStack: optimizeLabelStack(labelStack)
|
|
835
|
+
labelStack: optimizeLabelStack(labelStack, getReactUFOVersion(interaction.type))
|
|
837
836
|
});
|
|
838
837
|
}),
|
|
839
|
-
marks: optimizeMarks(interaction.marks),
|
|
838
|
+
marks: optimizeMarks(interaction.marks, getReactUFOVersion(interaction.type)),
|
|
840
839
|
customData: optimizeCustomData(interaction),
|
|
841
|
-
reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start)
|
|
840
|
+
reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start, getReactUFOVersion(interaction.type))
|
|
842
841
|
}, labelStack), getPageLoadInteractionMetrics()), getDetailedInteractionMetrics(resourceTimings)), getPageLoadDetailedInteractionMetrics()), getBm3TrackerTimings(interaction)), {}, {
|
|
843
842
|
'metric:ttai': experimental ? regularTTAI || expTTAI : undefined,
|
|
844
843
|
'metric:experimental:ttai': expTTAI
|
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
import coinflip from '../coinflip';
|
|
6
|
-
import {
|
|
6
|
+
import { getReactUFOVersion } from '../common/constants';
|
|
7
7
|
import { getConfig, getPostInteractionRate } from '../config';
|
|
8
8
|
import { isSegmentLabel, sanitizeUfoName } from '../create-payload/common/utils';
|
|
9
9
|
import { getPageVisibilityState } from '../hidden-timing';
|
|
@@ -181,7 +181,7 @@ export default function createPostInteractionLogPayload(_ref2) {
|
|
|
181
181
|
'event:schema': '1.0.0',
|
|
182
182
|
'event:source': {
|
|
183
183
|
name: 'react-ufo/web',
|
|
184
|
-
version:
|
|
184
|
+
version: getReactUFOVersion(lastInteractionFinish.type),
|
|
185
185
|
payloadSource: 'platform'
|
|
186
186
|
},
|
|
187
187
|
'event:region': config.region || 'unknown',
|