@atlaskit/react-ufo 2.15.0 → 2.16.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 +8 -0
- package/dist/cjs/assets/index.js +96 -0
- package/dist/cjs/assets/utils.js +32 -0
- package/dist/cjs/common/assets/types.js +5 -0
- package/dist/cjs/create-payload/index.js +32 -5
- package/dist/cjs/vc/vc-observer/heatmap/heatmap.js +9 -20
- package/dist/cjs/vc/vc-observer/index.js +32 -28
- package/dist/cjs/vc/vc-observer/revisions/ViewportUpdateClassifier.js +8 -0
- package/dist/cjs/vc/vc-observer/revisions/fy24_01.js +34 -2
- package/dist/es2019/assets/index.js +82 -0
- package/dist/es2019/assets/utils.js +26 -0
- package/dist/es2019/common/assets/types.js +1 -0
- package/dist/es2019/create-payload/index.js +33 -3
- package/dist/es2019/vc/vc-observer/heatmap/heatmap.js +10 -18
- package/dist/es2019/vc/vc-observer/index.js +3 -0
- package/dist/es2019/vc/vc-observer/revisions/ViewportUpdateClassifier.js +6 -0
- package/dist/es2019/vc/vc-observer/revisions/fy24_01.js +29 -0
- package/dist/esm/assets/index.js +89 -0
- package/dist/esm/assets/utils.js +26 -0
- package/dist/esm/common/assets/types.js +1 -0
- package/dist/esm/create-payload/index.js +32 -5
- package/dist/esm/vc/vc-observer/heatmap/heatmap.js +9 -20
- package/dist/esm/vc/vc-observer/index.js +32 -28
- package/dist/esm/vc/vc-observer/revisions/ViewportUpdateClassifier.js +8 -0
- package/dist/esm/vc/vc-observer/revisions/fy24_01.js +34 -2
- package/dist/types/assets/index.d.ts +25 -0
- package/dist/types/assets/utils.d.ts +6 -0
- package/dist/types/common/assets/types.d.ts +18 -0
- package/dist/types/common/index.d.ts +1 -0
- package/dist/types/config/index.d.ts +2 -1
- package/dist/types/create-payload/index.d.ts +11616 -0
- package/dist/types/resource-timing/index.d.ts +1 -1
- package/dist/types/vc/vc-observer/heatmap/heatmap.d.ts +5 -8
- package/dist/types/vc/vc-observer/revisions/ViewportUpdateClassifier.d.ts +5 -0
- package/dist/types/vc/vc-observer/revisions/fy24_01.d.ts +2 -0
- package/dist/types/vc/vc-observer/revisions/types.d.ts +18 -0
- package/dist/types-ts4.5/assets/index.d.ts +25 -0
- package/dist/types-ts4.5/assets/utils.d.ts +6 -0
- package/dist/types-ts4.5/common/assets/types.d.ts +18 -0
- package/dist/types-ts4.5/common/index.d.ts +1 -0
- package/dist/types-ts4.5/config/index.d.ts +2 -1
- package/dist/types-ts4.5/create-payload/index.d.ts +11616 -0
- package/dist/types-ts4.5/resource-timing/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer/heatmap/heatmap.d.ts +5 -8
- package/dist/types-ts4.5/vc/vc-observer/revisions/ViewportUpdateClassifier.d.ts +5 -0
- package/dist/types-ts4.5/vc/vc-observer/revisions/fy24_01.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer/revisions/types.d.ts +18 -0
- package/package.json +4 -1
|
@@ -111,6 +111,7 @@ export class MultiRevisionHeatmap {
|
|
|
111
111
|
}
|
|
112
112
|
processData({
|
|
113
113
|
VCParts,
|
|
114
|
+
VCCalculationMethods,
|
|
114
115
|
ssr = UNUSED_SECTOR
|
|
115
116
|
}) {
|
|
116
117
|
return this.heatmaps.map((heatmap, i) => {
|
|
@@ -149,24 +150,15 @@ export class MultiRevisionHeatmap {
|
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
const entries = Object.entries(lastUpdate).map(a => [parseInt(a[0], 10), a[1]]).sort((a, b) => a[0] > b[0] ? 1 : -1);
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
VCBox[value] = new Set();
|
|
162
|
-
(_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.forEach(v => {
|
|
163
|
-
var _VCBox$value;
|
|
164
|
-
return (_VCBox$value = VCBox[value]) === null || _VCBox$value === void 0 ? void 0 : _VCBox$value.add(v.targetName);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
return VCRatio;
|
|
169
|
-
}, 0);
|
|
153
|
+
const {
|
|
154
|
+
VC,
|
|
155
|
+
VCBox
|
|
156
|
+
} = VCCalculationMethods[i]({
|
|
157
|
+
VCParts,
|
|
158
|
+
componentsLog,
|
|
159
|
+
entries,
|
|
160
|
+
totalPainted
|
|
161
|
+
});
|
|
170
162
|
const VCEntries = entries.reduce((acc, [timestamp, entryPainted], i) => {
|
|
171
163
|
var _acc$abs, _componentsLog$timest;
|
|
172
164
|
const currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
|
|
@@ -253,6 +253,9 @@ export class VCObserver {
|
|
|
253
253
|
const revisionsData = isMultiHeatmapEnabled && multiHeatmap !== null ? {
|
|
254
254
|
[`${fullPrefix}vc:rev`]: multiHeatmap.getPayloadShapedData({
|
|
255
255
|
VCParts: VCObserver.VCParts.map(v => parseInt(v)),
|
|
256
|
+
VCCalculationMethods: getRevisions().map(({
|
|
257
|
+
classifier
|
|
258
|
+
}) => classifier.VCCalculationMethod),
|
|
256
259
|
ssr,
|
|
257
260
|
clean: !abortReasonInfo
|
|
258
261
|
})
|
|
@@ -7,6 +7,12 @@ export class ViewportUpdateClassifier {
|
|
|
7
7
|
_defineProperty(this, "__combinedTypes", []);
|
|
8
8
|
_defineProperty(this, "__combinedFilters", []);
|
|
9
9
|
}
|
|
10
|
+
VCCalculationMethod(_) {
|
|
11
|
+
return {
|
|
12
|
+
VC: {},
|
|
13
|
+
VCBox: {}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
10
16
|
mergeConfig() {
|
|
11
17
|
this.__combinedTypes = [...this.types, ...((this === null || this === void 0 ? void 0 : this.__combinedTypes) || [])];
|
|
12
18
|
const previousFilters = this.removedFilters.length === 0 ? this.__combinedFilters : this.__combinedFilters.filter(filter => !this.removedFilters.includes(filter.name));
|
|
@@ -2,6 +2,35 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import { ViewportUpdateClassifier } from './ViewportUpdateClassifier';
|
|
3
3
|
const legacyIgnoreReasons = ['image', 'ssr-hydration', 'editor-lazy-node-view', 'editor-container-mutation'];
|
|
4
4
|
export class FY24_01Classifier extends ViewportUpdateClassifier {
|
|
5
|
+
VCCalculationMethod({
|
|
6
|
+
VCParts,
|
|
7
|
+
entries,
|
|
8
|
+
totalPainted,
|
|
9
|
+
componentsLog
|
|
10
|
+
}) {
|
|
11
|
+
const VC = {};
|
|
12
|
+
const VCBox = {};
|
|
13
|
+
entries.reduce((acc = 0, v) => {
|
|
14
|
+
const VCRatio = v[1] / totalPainted + acc;
|
|
15
|
+
const time = v[0];
|
|
16
|
+
VCParts.forEach(value => {
|
|
17
|
+
if ((VC[value] === null || VC[value] === undefined) && VCRatio >= value / 100) {
|
|
18
|
+
var _componentsLog$time;
|
|
19
|
+
VC[value] = time;
|
|
20
|
+
VCBox[value] = new Set();
|
|
21
|
+
(_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.forEach(v => {
|
|
22
|
+
var _VCBox$value;
|
|
23
|
+
return (_VCBox$value = VCBox[value]) === null || _VCBox$value === void 0 ? void 0 : _VCBox$value.add(v.targetName);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return VCRatio;
|
|
28
|
+
}, 0);
|
|
29
|
+
return {
|
|
30
|
+
VC,
|
|
31
|
+
VCBox
|
|
32
|
+
};
|
|
33
|
+
}
|
|
5
34
|
constructor() {
|
|
6
35
|
super();
|
|
7
36
|
_defineProperty(this, "revision", 'fy24.01');
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
import { calculateTransferType, DISK_KEY, MEMORY_KEY, NETWORK_KEY, round } from './utils';
|
|
6
|
+
export var CHRSummary = /*#__PURE__*/function () {
|
|
7
|
+
function CHRSummary() {
|
|
8
|
+
_classCallCheck(this, CHRSummary);
|
|
9
|
+
_defineProperty(this, "bundles", _defineProperty(_defineProperty(_defineProperty({}, MEMORY_KEY, 0), DISK_KEY, 0), NETWORK_KEY, 0));
|
|
10
|
+
_defineProperty(this, "bundlesCount", 0);
|
|
11
|
+
_defineProperty(this, "size", _defineProperty(_defineProperty(_defineProperty({}, MEMORY_KEY, 0), DISK_KEY, 0), NETWORK_KEY, 0));
|
|
12
|
+
_defineProperty(this, "sizeTotal", 0);
|
|
13
|
+
}
|
|
14
|
+
return _createClass(CHRSummary, [{
|
|
15
|
+
key: "add",
|
|
16
|
+
value: function add(asset) {
|
|
17
|
+
var size = 'size' in asset ? asset.size : undefined;
|
|
18
|
+
var encodedSize = 'encodedSize' in asset ? Number(asset.encodedSize) : 0;
|
|
19
|
+
var type = calculateTransferType(asset.type, asset.duration, size);
|
|
20
|
+
if (type === null) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.bundles[type] += 1;
|
|
24
|
+
this.bundlesCount += 1;
|
|
25
|
+
this.size[type] += encodedSize;
|
|
26
|
+
this.sizeTotal += encodedSize;
|
|
27
|
+
}
|
|
28
|
+
}], [{
|
|
29
|
+
key: "makePayload",
|
|
30
|
+
value: function makePayload(summary) {
|
|
31
|
+
var size = summary.size,
|
|
32
|
+
bundlesCount = summary.bundlesCount,
|
|
33
|
+
sizeTotal = summary.sizeTotal;
|
|
34
|
+
var cachedSize = size[MEMORY_KEY] + size[DISK_KEY];
|
|
35
|
+
var sizeRatio = round(cachedSize / summary.sizeTotal);
|
|
36
|
+
return {
|
|
37
|
+
size: sizeTotal,
|
|
38
|
+
chr: sizeRatio,
|
|
39
|
+
count: bundlesCount
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}]);
|
|
43
|
+
}();
|
|
44
|
+
export var CHRReporter = /*#__PURE__*/function () {
|
|
45
|
+
function CHRReporter() {
|
|
46
|
+
_classCallCheck(this, CHRReporter);
|
|
47
|
+
_defineProperty(this, "all", new CHRSummary());
|
|
48
|
+
_defineProperty(this, "allAtlassian", new CHRSummary());
|
|
49
|
+
_defineProperty(this, "preloaded", new CHRSummary());
|
|
50
|
+
}
|
|
51
|
+
return _createClass(CHRReporter, [{
|
|
52
|
+
key: "get",
|
|
53
|
+
value: function get(resourceTimings, assetsClassification) {
|
|
54
|
+
var _this = this;
|
|
55
|
+
try {
|
|
56
|
+
Object.entries(resourceTimings).map(function (_ref) {
|
|
57
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
58
|
+
label = _ref2[0],
|
|
59
|
+
entry = _ref2[1];
|
|
60
|
+
if (assetsClassification.all) {
|
|
61
|
+
_this.all.add(entry);
|
|
62
|
+
}
|
|
63
|
+
if (assetsClassification.allAtlassian({
|
|
64
|
+
label: label,
|
|
65
|
+
entry: entry
|
|
66
|
+
})) {
|
|
67
|
+
_this.allAtlassian.add(entry);
|
|
68
|
+
}
|
|
69
|
+
if (assetsClassification.preloaded({
|
|
70
|
+
label: label,
|
|
71
|
+
entry: entry
|
|
72
|
+
})) {
|
|
73
|
+
_this.preloaded.add(entry);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
if (this.all.bundlesCount === 0) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
all: CHRSummary.makePayload(this.all),
|
|
81
|
+
allAtlassian: CHRSummary.makePayload(this.allAtlassian),
|
|
82
|
+
preloaded: CHRSummary.makePayload(this.preloaded)
|
|
83
|
+
};
|
|
84
|
+
} catch (error) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}]);
|
|
89
|
+
}();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* Borrowed from https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/performance/browser-metrics/src/plugins/timings/resource.ts */
|
|
2
|
+
export var cacheableTypes = ['script', 'link'];
|
|
3
|
+
export var MEMORY_KEY = 'mem';
|
|
4
|
+
export var DISK_KEY = 'disk';
|
|
5
|
+
export var NETWORK_KEY = 'net';
|
|
6
|
+
export var calculateTransferType = function calculateTransferType(type, duration, size) {
|
|
7
|
+
if (!cacheableTypes.includes(type)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
if ((size === undefined || size === 0) && duration === 0) {
|
|
11
|
+
return MEMORY_KEY;
|
|
12
|
+
}
|
|
13
|
+
if (size === 0 && duration > 0) {
|
|
14
|
+
return DISK_KEY;
|
|
15
|
+
}
|
|
16
|
+
if (size === undefined) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return NETWORK_KEY;
|
|
20
|
+
};
|
|
21
|
+
export var round = function round(n) {
|
|
22
|
+
if (isNaN(n)) {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
return Math.round(n * 10000) / 10000;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,6 +11,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
import Bowser from 'bowser-ultralight';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { getLighthouseMetrics } from '../additional-payload';
|
|
14
|
+
import { CHRReporter } from '../assets';
|
|
14
15
|
import * as bundleEvalTiming from '../bundle-eval-timing';
|
|
15
16
|
import coinflip from '../coinflip';
|
|
16
17
|
import { REACT_UFO_VERSION } from '../common/constants';
|
|
@@ -304,6 +305,31 @@ function getSSRProperties(type) {
|
|
|
304
305
|
'ssr:featureFlags': getSSRFeatureFlags(type)
|
|
305
306
|
};
|
|
306
307
|
}
|
|
308
|
+
var getAssetsMetrics = function getAssetsMetrics(interaction, resourceTimings) {
|
|
309
|
+
try {
|
|
310
|
+
var config = getConfig();
|
|
311
|
+
var type = interaction.type;
|
|
312
|
+
var isCHREnabled = fg('ufo_chr_config');
|
|
313
|
+
var allowedTypes = ['page_load', 'transition'];
|
|
314
|
+
var assetsClassification = config === null || config === void 0 ? void 0 : config.assetsClassification;
|
|
315
|
+
if (!isCHREnabled || !allowedTypes.includes(type) || !assetsClassification) {
|
|
316
|
+
// Skip if: FG disabled, not allowed type or assetsClassification isn't configured
|
|
317
|
+
return {};
|
|
318
|
+
}
|
|
319
|
+
var reporter = new CHRReporter();
|
|
320
|
+
var assets = reporter.get(resourceTimings, assetsClassification);
|
|
321
|
+
if (assets) {
|
|
322
|
+
// Only add assets in case it exists
|
|
323
|
+
return {
|
|
324
|
+
'event:assets': assets
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
return {};
|
|
328
|
+
} catch (error) {
|
|
329
|
+
// Skip CHR in case of error
|
|
330
|
+
return {};
|
|
331
|
+
}
|
|
332
|
+
};
|
|
307
333
|
var getBrowserMetadata = function getBrowserMetadata() {
|
|
308
334
|
var data = {};
|
|
309
335
|
var now = new Date();
|
|
@@ -718,7 +744,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
718
744
|
});
|
|
719
745
|
};
|
|
720
746
|
// Detailed payload. Page visibility = visible
|
|
721
|
-
var getDetailedInteractionMetrics = function getDetailedInteractionMetrics() {
|
|
747
|
+
var getDetailedInteractionMetrics = function getDetailedInteractionMetrics(resourceTimings) {
|
|
722
748
|
if (experimental || window.__UFO_COMPACT_PAYLOAD__ || !isDetailedPayload) {
|
|
723
749
|
return {};
|
|
724
750
|
}
|
|
@@ -739,7 +765,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
739
765
|
requestInfo: optimizeRequestInfo(interaction.requestInfo, start),
|
|
740
766
|
customTimings: optimizeCustomTimings(interaction.customTimings, start),
|
|
741
767
|
bundleEvalTimings: objectToArray(getBundleEvalTimings(start)),
|
|
742
|
-
resourceTimings: objectToArray(
|
|
768
|
+
resourceTimings: objectToArray(resourceTimings)
|
|
743
769
|
};
|
|
744
770
|
};
|
|
745
771
|
// Page load & detailed payload
|
|
@@ -760,6 +786,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
760
786
|
regularTTAI = getTTAI(interaction);
|
|
761
787
|
}
|
|
762
788
|
var newUFOName = sanitizeUfoName(ufoName);
|
|
789
|
+
var resourceTimings = getResourceTimings(start, end);
|
|
763
790
|
var payload = {
|
|
764
791
|
actionSubject: 'experience',
|
|
765
792
|
action: 'measured',
|
|
@@ -767,7 +794,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
767
794
|
source: 'measured',
|
|
768
795
|
tags: ['observability'],
|
|
769
796
|
attributes: {
|
|
770
|
-
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
797
|
+
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
771
798
|
// basic
|
|
772
799
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
773
800
|
'event:product': config.product,
|
|
@@ -781,7 +808,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
781
808
|
'event:region': config.region || 'unknown',
|
|
782
809
|
'experience:key': experimental ? 'custom.experimental-interaction-metrics' : 'custom.interaction-metrics',
|
|
783
810
|
'experience:name': newUFOName
|
|
784
|
-
}, getBrowserMetadata()), getSSRProperties(type)), getPPSMetrics(interaction)), getPaintMetrics(type)), getNavigationMetrics(type)), getVCMetrics(interaction)), experimental ? getExperimentalVCMetrics(interaction) : undefined), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), {}, {
|
|
811
|
+
}, getBrowserMetadata()), getSSRProperties(type)), getAssetsMetrics(interaction, resourceTimings)), getPPSMetrics(interaction)), getPaintMetrics(type)), getNavigationMetrics(type)), getVCMetrics(interaction)), experimental ? getExperimentalVCMetrics(interaction) : undefined), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), {}, {
|
|
785
812
|
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
786
813
|
namePrefix: config.namePrefix || '',
|
|
787
814
|
segmentPrefix: config.segmentPrefix || '',
|
|
@@ -813,7 +840,7 @@ function createInteractionMetricsPayload(interaction, interactionId, experimenta
|
|
|
813
840
|
marks: optimizeMarks(interaction.marks),
|
|
814
841
|
customData: optimizeCustomData(interaction),
|
|
815
842
|
reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start)
|
|
816
|
-
}, labelStack), getPageLoadInteractionMetrics()), getDetailedInteractionMetrics()), getPageLoadDetailedInteractionMetrics()), getBm3TrackerTimings(interaction)), {}, {
|
|
843
|
+
}, labelStack), getPageLoadInteractionMetrics()), getDetailedInteractionMetrics(resourceTimings)), getPageLoadDetailedInteractionMetrics()), getBm3TrackerTimings(interaction)), {}, {
|
|
817
844
|
'metric:ttai': experimental ? regularTTAI || expTTAI : undefined,
|
|
818
845
|
'metric:experimental:ttai': expTTAI
|
|
819
846
|
}),
|
|
@@ -123,6 +123,7 @@ export var MultiRevisionHeatmap = /*#__PURE__*/function () {
|
|
|
123
123
|
value: function processData(_ref4) {
|
|
124
124
|
var _this3 = this;
|
|
125
125
|
var VCParts = _ref4.VCParts,
|
|
126
|
+
VCCalculationMethods = _ref4.VCCalculationMethods,
|
|
126
127
|
_ref4$ssr = _ref4.ssr,
|
|
127
128
|
ssr = _ref4$ssr === void 0 ? UNUSED_SECTOR : _ref4$ssr;
|
|
128
129
|
return this.heatmaps.map(function (heatmap, i) {
|
|
@@ -165,26 +166,14 @@ export var MultiRevisionHeatmap = /*#__PURE__*/function () {
|
|
|
165
166
|
}).sort(function (a, b) {
|
|
166
167
|
return a[0] > b[0] ? 1 : -1;
|
|
167
168
|
});
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if ((VC[value] === null || VC[value] === undefined) && VCRatio >= value / 100) {
|
|
177
|
-
var _componentsLog$time;
|
|
178
|
-
VC[value] = time;
|
|
179
|
-
VCBox[value] = new Set();
|
|
180
|
-
(_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 || _componentsLog$time.forEach(function (v) {
|
|
181
|
-
var _VCBox$value;
|
|
182
|
-
return (_VCBox$value = VCBox[value]) === null || _VCBox$value === void 0 ? void 0 : _VCBox$value.add(v.targetName);
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
return VCRatio;
|
|
187
|
-
}, 0);
|
|
169
|
+
var _VCCalculationMethods = VCCalculationMethods[i]({
|
|
170
|
+
VCParts: VCParts,
|
|
171
|
+
componentsLog: componentsLog,
|
|
172
|
+
entries: entries,
|
|
173
|
+
totalPainted: totalPainted
|
|
174
|
+
}),
|
|
175
|
+
VC = _VCCalculationMethods.VC,
|
|
176
|
+
VCBox = _VCCalculationMethods.VCBox;
|
|
188
177
|
var VCEntries = entries.reduce(function (acc, _ref5, i) {
|
|
189
178
|
var _acc$abs, _componentsLog$timest;
|
|
190
179
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
@@ -249,6 +249,10 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
249
249
|
VCParts: VCObserver.VCParts.map(function (v) {
|
|
250
250
|
return parseInt(v);
|
|
251
251
|
}),
|
|
252
|
+
VCCalculationMethods: getRevisions().map(function (_ref8) {
|
|
253
|
+
var classifier = _ref8.classifier;
|
|
254
|
+
return classifier.VCCalculationMethod;
|
|
255
|
+
}),
|
|
252
256
|
ssr: ssr,
|
|
253
257
|
clean: !abortReasonInfo
|
|
254
258
|
})) : null;
|
|
@@ -295,13 +299,13 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
295
299
|
});
|
|
296
300
|
}
|
|
297
301
|
});
|
|
298
|
-
_defineProperty(this, "onViewportChangeDetected", function (
|
|
299
|
-
var element =
|
|
300
|
-
type =
|
|
301
|
-
ignoreReason =
|
|
302
|
-
timestamp =
|
|
303
|
-
targetName =
|
|
304
|
-
intersectionRect =
|
|
302
|
+
_defineProperty(this, "onViewportChangeDetected", function (_ref10) {
|
|
303
|
+
var element = _ref10.element,
|
|
304
|
+
type = _ref10.type,
|
|
305
|
+
ignoreReason = _ref10.ignoreReason,
|
|
306
|
+
timestamp = _ref10.timestamp,
|
|
307
|
+
targetName = _ref10.targetName,
|
|
308
|
+
intersectionRect = _ref10.intersectionRect;
|
|
305
309
|
if (_this.multiHeatmap === null) {
|
|
306
310
|
return;
|
|
307
311
|
}
|
|
@@ -383,10 +387,10 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
383
387
|
var unbinds = attachAbortListeners(window, _this.viewport, _this.abortReasonCallback);
|
|
384
388
|
if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
|
|
385
389
|
var _window2;
|
|
386
|
-
Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (
|
|
387
|
-
var
|
|
388
|
-
key =
|
|
389
|
-
time =
|
|
390
|
+
Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(function (_ref11) {
|
|
391
|
+
var _ref12 = _slicedToArray(_ref11, 2),
|
|
392
|
+
key = _ref12[0],
|
|
393
|
+
time = _ref12[1];
|
|
390
394
|
if (time) {
|
|
391
395
|
_this.abortReasonCallback(key, time);
|
|
392
396
|
}
|
|
@@ -421,8 +425,8 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
421
425
|
}
|
|
422
426
|
return _createClass(VCObserver, [{
|
|
423
427
|
key: "start",
|
|
424
|
-
value: function start(
|
|
425
|
-
var startTime =
|
|
428
|
+
value: function start(_ref13) {
|
|
429
|
+
var startTime = _ref13.startTime;
|
|
426
430
|
this.active = true;
|
|
427
431
|
if (this.observers.isBrowserSupported()) {
|
|
428
432
|
this.setViewportSize();
|
|
@@ -444,12 +448,12 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
444
448
|
}, {
|
|
445
449
|
key: "getIgnoredElements",
|
|
446
450
|
value: function getIgnoredElements(componentsLog) {
|
|
447
|
-
return Object.values(componentsLog).flat().filter(function (
|
|
448
|
-
var ignoreReason =
|
|
451
|
+
return Object.values(componentsLog).flat().filter(function (_ref14) {
|
|
452
|
+
var ignoreReason = _ref14.ignoreReason;
|
|
449
453
|
return Boolean(ignoreReason);
|
|
450
|
-
}).map(function (
|
|
451
|
-
var targetName =
|
|
452
|
-
ignoreReason =
|
|
454
|
+
}).map(function (_ref15) {
|
|
455
|
+
var targetName = _ref15.targetName,
|
|
456
|
+
ignoreReason = _ref15.ignoreReason;
|
|
453
457
|
return {
|
|
454
458
|
targetName: targetName,
|
|
455
459
|
ignoreReason: ignoreReason
|
|
@@ -570,12 +574,12 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
570
574
|
}
|
|
571
575
|
}], [{
|
|
572
576
|
key: "calculateVC",
|
|
573
|
-
value: function calculateVC(
|
|
574
|
-
var heatmap =
|
|
575
|
-
|
|
576
|
-
ssr =
|
|
577
|
-
componentsLog =
|
|
578
|
-
viewport =
|
|
577
|
+
value: function calculateVC(_ref16) {
|
|
578
|
+
var heatmap = _ref16.heatmap,
|
|
579
|
+
_ref16$ssr = _ref16.ssr,
|
|
580
|
+
ssr = _ref16$ssr === void 0 ? UNUSED_SECTOR : _ref16$ssr,
|
|
581
|
+
componentsLog = _ref16.componentsLog,
|
|
582
|
+
viewport = _ref16.viewport;
|
|
579
583
|
var lastUpdate = {};
|
|
580
584
|
var totalPainted = 0;
|
|
581
585
|
if (ssr !== UNUSED_SECTOR) {
|
|
@@ -644,11 +648,11 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
644
648
|
});
|
|
645
649
|
return VCRatio;
|
|
646
650
|
}, 0);
|
|
647
|
-
var VCEntries = entries.reduce(function (acc,
|
|
651
|
+
var VCEntries = entries.reduce(function (acc, _ref17, i) {
|
|
648
652
|
var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
|
|
649
|
-
var
|
|
650
|
-
timestamp =
|
|
651
|
-
entryPainted =
|
|
653
|
+
var _ref18 = _slicedToArray(_ref17, 2),
|
|
654
|
+
timestamp = _ref18[0],
|
|
655
|
+
entryPainted = _ref18[1];
|
|
652
656
|
var currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
|
|
653
657
|
var currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
|
|
654
658
|
var logEntry = (_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.map(function (v) {
|
|
@@ -12,6 +12,14 @@ export var ViewportUpdateClassifier = /*#__PURE__*/function () {
|
|
|
12
12
|
_defineProperty(this, "__combinedFilters", []);
|
|
13
13
|
}
|
|
14
14
|
return _createClass(ViewportUpdateClassifier, [{
|
|
15
|
+
key: "VCCalculationMethod",
|
|
16
|
+
value: function VCCalculationMethod(_) {
|
|
17
|
+
return {
|
|
18
|
+
VC: {},
|
|
19
|
+
VCBox: {}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}, {
|
|
15
23
|
key: "mergeConfig",
|
|
16
24
|
value: function mergeConfig() {
|
|
17
25
|
var _this = this;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
@@ -27,6 +27,38 @@ export var FY24_01Classifier = /*#__PURE__*/function (_ViewportUpdateClassi) {
|
|
|
27
27
|
return _this;
|
|
28
28
|
}
|
|
29
29
|
_inherits(FY24_01Classifier, _ViewportUpdateClassi);
|
|
30
|
-
return _createClass(FY24_01Classifier
|
|
30
|
+
return _createClass(FY24_01Classifier, [{
|
|
31
|
+
key: "VCCalculationMethod",
|
|
32
|
+
value: function VCCalculationMethod(_ref2) {
|
|
33
|
+
var VCParts = _ref2.VCParts,
|
|
34
|
+
entries = _ref2.entries,
|
|
35
|
+
totalPainted = _ref2.totalPainted,
|
|
36
|
+
componentsLog = _ref2.componentsLog;
|
|
37
|
+
var VC = {};
|
|
38
|
+
var VCBox = {};
|
|
39
|
+
entries.reduce(function () {
|
|
40
|
+
var acc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
41
|
+
var v = arguments.length > 1 ? arguments[1] : undefined;
|
|
42
|
+
var VCRatio = v[1] / totalPainted + acc;
|
|
43
|
+
var time = v[0];
|
|
44
|
+
VCParts.forEach(function (value) {
|
|
45
|
+
if ((VC[value] === null || VC[value] === undefined) && VCRatio >= value / 100) {
|
|
46
|
+
var _componentsLog$time;
|
|
47
|
+
VC[value] = time;
|
|
48
|
+
VCBox[value] = new Set();
|
|
49
|
+
(_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 || _componentsLog$time.forEach(function (v) {
|
|
50
|
+
var _VCBox$value;
|
|
51
|
+
return (_VCBox$value = VCBox[value]) === null || _VCBox$value === void 0 ? void 0 : _VCBox$value.add(v.targetName);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return VCRatio;
|
|
56
|
+
}, 0);
|
|
57
|
+
return {
|
|
58
|
+
VC: VC,
|
|
59
|
+
VCBox: VCBox
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
31
63
|
}(ViewportUpdateClassifier);
|
|
32
64
|
export var revFY24_01Classifier = new FY24_01Classifier();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AssetsClassification, AssetsData, AssetsReporter } from '../common';
|
|
2
|
+
import type { ResourceTiming, ResourceTimings } from '../resource-timing';
|
|
3
|
+
export declare class CHRSummary {
|
|
4
|
+
bundles: {
|
|
5
|
+
mem: number;
|
|
6
|
+
disk: number;
|
|
7
|
+
net: number;
|
|
8
|
+
};
|
|
9
|
+
bundlesCount: number;
|
|
10
|
+
size: {
|
|
11
|
+
mem: number;
|
|
12
|
+
disk: number;
|
|
13
|
+
net: number;
|
|
14
|
+
};
|
|
15
|
+
sizeTotal: number;
|
|
16
|
+
add(asset: ResourceTiming): void;
|
|
17
|
+
static makePayload(summary: CHRSummary): AssetsReporter;
|
|
18
|
+
}
|
|
19
|
+
export declare class CHRReporter {
|
|
20
|
+
all: CHRSummary;
|
|
21
|
+
allAtlassian: CHRSummary;
|
|
22
|
+
preloaded: CHRSummary;
|
|
23
|
+
constructor();
|
|
24
|
+
get(resourceTimings: ResourceTimings, assetsClassification: AssetsClassification): AssetsData | null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const cacheableTypes: string[];
|
|
2
|
+
export declare const MEMORY_KEY = "mem";
|
|
3
|
+
export declare const DISK_KEY = "disk";
|
|
4
|
+
export declare const NETWORK_KEY = "net";
|
|
5
|
+
export declare const calculateTransferType: (type: string, duration: number, size: number | undefined) => "disk" | "mem" | "net" | null;
|
|
6
|
+
export declare const round: (n: number) => number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ResourceTiming } from '../../resource-timing';
|
|
2
|
+
export type AssetResourceEntry = {
|
|
3
|
+
label: string;
|
|
4
|
+
entry: ResourceTiming;
|
|
5
|
+
};
|
|
6
|
+
export type AssetsClassification = {
|
|
7
|
+
all: boolean;
|
|
8
|
+
allAtlassian: (entry: AssetResourceEntry) => boolean;
|
|
9
|
+
preloaded: (entry: AssetResourceEntry) => boolean;
|
|
10
|
+
};
|
|
11
|
+
export type AssetsReporter = {
|
|
12
|
+
size: number | null;
|
|
13
|
+
chr: number | null;
|
|
14
|
+
count: number;
|
|
15
|
+
};
|
|
16
|
+
export interface AssetsData {
|
|
17
|
+
[key: string]: AssetsReporter;
|
|
18
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { AssetResourceEntry, AssetsClassification, AssetsData, AssetsReporter, } from './assets/types';
|
|
1
2
|
export type { LifecycleMarkType, MarkType, SpanType, InteractionType, AbortReasonType, CustomTiming, HoldInfo, LoadProfilerEventInfo, ReactProfilerTiming, Span, Mark, InteractionError, RequestInfo, ApdexType, SegmentInfo, CustomData, HoldActive, Redirect, InteractionMetrics, EnhancedUFOInteractionContextType, BM3Event, PostInteractionLogOutput, LastInteractionFinishInfo, } from './common/types';
|
|
2
3
|
/**
|
|
3
4
|
* @deprecated Prefer import from @atlaskit/react-ufo/interaction-context
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InteractionMetrics, InteractionType } from '../common';
|
|
1
|
+
import type { AssetsClassification, InteractionMetrics, InteractionType } from '../common';
|
|
2
2
|
export interface AdditionalData {
|
|
3
3
|
[key: string]: null | string | number | boolean | undefined | AdditionalData | Record<string, AdditionalData> | Array<AdditionalData>;
|
|
4
4
|
}
|
|
@@ -57,6 +57,7 @@ export type Config = {
|
|
|
57
57
|
readonly getSSRTimings?: () => SSRTiming[];
|
|
58
58
|
readonly getSSRDoneTime?: () => number | undefined;
|
|
59
59
|
};
|
|
60
|
+
readonly assetsClassification?: AssetsClassification;
|
|
60
61
|
readonly enableBetterPageVisibilityApi?: boolean;
|
|
61
62
|
readonly vc?: {
|
|
62
63
|
readonly enabled?: boolean;
|