@atlaskit/react-ufo 3.3.0 → 3.3.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 +16 -0
- package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +1 -0
- package/dist/cjs/create-payload/index.js +63 -156
- package/dist/cjs/create-payload/utils/get-interaction-status.js +37 -0
- package/dist/cjs/create-payload/utils/get-page-visibility-up-to-ttai.js +12 -0
- package/dist/cjs/create-payload/utils/get-ssr-done-time-value.js +14 -0
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +96 -0
- package/dist/cjs/interaction-metrics/post-interaction-log.js +1 -0
- package/dist/cjs/vc/vc-observer/heatmap/heatmap.js +4 -1
- package/dist/cjs/vc/vc-observer/index.js +27 -30
- package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +1 -0
- package/dist/es2019/create-payload/index.js +11 -80
- package/dist/es2019/create-payload/utils/get-interaction-status.js +31 -0
- package/dist/es2019/create-payload/utils/get-page-visibility-up-to-ttai.js +8 -0
- package/dist/es2019/create-payload/utils/get-ssr-done-time-value.js +5 -0
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +53 -0
- package/dist/es2019/interaction-metrics/post-interaction-log.js +1 -0
- package/dist/es2019/vc/vc-observer/heatmap/heatmap.js +4 -1
- package/dist/es2019/vc/vc-observer/index.js +29 -29
- package/dist/esm/create-experimental-interaction-metrics-payload/index.js +1 -0
- package/dist/esm/create-payload/index.js +56 -149
- package/dist/esm/create-payload/utils/get-interaction-status.js +31 -0
- package/dist/esm/create-payload/utils/get-page-visibility-up-to-ttai.js +6 -0
- package/dist/esm/create-payload/utils/get-ssr-done-time-value.js +5 -0
- package/dist/esm/create-payload/utils/get-vc-metrics.js +89 -0
- package/dist/esm/interaction-metrics/post-interaction-log.js +1 -0
- package/dist/esm/vc/vc-observer/heatmap/heatmap.js +4 -1
- package/dist/esm/vc/vc-observer/index.js +27 -30
- package/dist/types/create-payload/utils/get-interaction-status.d.ts +27 -0
- package/dist/types/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +2 -0
- package/dist/types/create-payload/utils/get-ssr-done-time-value.d.ts +2 -0
- package/dist/types/create-payload/utils/get-vc-metrics.d.ts +5 -0
- package/dist/types/vc/types.d.ts +1 -0
- package/dist/types/vc/vc-observer/heatmap/heatmap.d.ts +2 -0
- package/dist/types/vc/vc-observer/index.d.ts +1 -1
- package/dist/types-ts4.5/create-payload/utils/get-interaction-status.d.ts +27 -0
- package/dist/types-ts4.5/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +2 -0
- package/dist/types-ts4.5/create-payload/utils/get-ssr-done-time-value.d.ts +2 -0
- package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +5 -0
- package/dist/types-ts4.5/vc/types.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/heatmap/heatmap.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +1 -1
- package/package.json +7 -4
|
@@ -96,11 +96,11 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
96
96
|
});
|
|
97
97
|
_defineProperty(this, "getVCResult", /*#__PURE__*/function () {
|
|
98
98
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
|
|
99
|
-
var start, stop, tti, prefix, ssr, vc, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, _VCObserver$calculate, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, isMultiHeatmapEnabled, revisionsData, isCalcSpeedIndexEnabled;
|
|
99
|
+
var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, _VCObserver$calculate, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, isMultiHeatmapEnabled, revisionsData, isCalcSpeedIndexEnabled, speedIndex;
|
|
100
100
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
101
101
|
while (1) switch (_context.prev = _context.next) {
|
|
102
102
|
case 0:
|
|
103
|
-
start = _ref3.start, stop = _ref3.stop, tti = _ref3.tti, prefix = _ref3.prefix, ssr = _ref3.ssr, vc = _ref3.vc;
|
|
103
|
+
start = _ref3.start, stop = _ref3.stop, tti = _ref3.tti, prefix = _ref3.prefix, ssr = _ref3.ssr, vc = _ref3.vc, isEventAborted = _ref3.isEventAborted;
|
|
104
104
|
startTime = performance.now(); // add local measurement
|
|
105
105
|
fullPrefix = prefix !== undefined && prefix !== '' ? "".concat(prefix, ":") : '';
|
|
106
106
|
rawData = vc !== undefined ? vc : _this.getVCRawData();
|
|
@@ -233,8 +233,8 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
233
233
|
} catch (e) {
|
|
234
234
|
/* do nothing */
|
|
235
235
|
}
|
|
236
|
-
isMultiHeatmapEnabled = fg('
|
|
237
|
-
revisionsData = isMultiHeatmapEnabled && multiHeatmap !== null ? _defineProperty({}, "".concat(fullPrefix, "vc:rev"), multiHeatmap.getPayloadShapedData({
|
|
236
|
+
isMultiHeatmapEnabled = !fg('platform_ufo_multiheatmap_killswitch');
|
|
237
|
+
revisionsData = isMultiHeatmapEnabled && multiHeatmap !== null ? _defineProperty({}, "".concat(fullPrefix, "vc:rev"), multiHeatmap === null || multiHeatmap === void 0 ? void 0 : multiHeatmap.getPayloadShapedData({
|
|
238
238
|
VCParts: VCObserver.VCParts.map(function (v) {
|
|
239
239
|
return parseInt(v);
|
|
240
240
|
}),
|
|
@@ -246,15 +246,18 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
246
246
|
var classifier = _ref10.classifier;
|
|
247
247
|
return classifier.filterComponentsLog;
|
|
248
248
|
}),
|
|
249
|
+
isEventAborted: isEventAborted,
|
|
250
|
+
interactionStart: start,
|
|
249
251
|
ttai: stop,
|
|
250
252
|
ssr: ssr,
|
|
251
253
|
clean: !abortReasonInfo
|
|
252
254
|
})) : null; // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
253
255
|
isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
|
|
256
|
+
speedIndex = _defineProperty(_defineProperty({}, "ufo:speedIndex", VCEntries.speedIndex), "ufo:next:speedIndex", vcNext.VCEntries.speedIndex);
|
|
254
257
|
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
255
258
|
'metrics:vc': VC
|
|
256
|
-
}, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), !abortReasonInfo), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData),
|
|
257
|
-
case
|
|
259
|
+
}, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), !abortReasonInfo), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), isCalcSpeedIndexEnabled ? speedIndex : {}));
|
|
260
|
+
case 24:
|
|
258
261
|
case "end":
|
|
259
262
|
return _context.stop();
|
|
260
263
|
}
|
|
@@ -267,16 +270,14 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
267
270
|
_defineProperty(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason) {
|
|
268
271
|
_this.measureStart();
|
|
269
272
|
_this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason);
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
});
|
|
279
|
-
}
|
|
273
|
+
_this.onViewportChangeDetected({
|
|
274
|
+
timestamp: rawTime,
|
|
275
|
+
intersectionRect: intersectionRect,
|
|
276
|
+
targetName: targetName,
|
|
277
|
+
element: element,
|
|
278
|
+
type: type,
|
|
279
|
+
ignoreReason: ignoreReason
|
|
280
|
+
});
|
|
280
281
|
_this.measureStop();
|
|
281
282
|
});
|
|
282
283
|
_defineProperty(this, "legacyHandleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason) {
|
|
@@ -416,13 +417,11 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
416
417
|
});
|
|
417
418
|
this.heatmap = this.getCleanHeatmap();
|
|
418
419
|
this.heatmapNext = this.getCleanHeatmap();
|
|
419
|
-
|
|
420
|
-
this.
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
});
|
|
425
|
-
}
|
|
420
|
+
this.multiHeatmap = new MultiRevisionHeatmap({
|
|
421
|
+
viewport: this.viewport,
|
|
422
|
+
revisions: getRevisions(),
|
|
423
|
+
devToolsEnabled: this.devToolsEnabled
|
|
424
|
+
});
|
|
426
425
|
this.isPostInteraction = options.isPostInteraction || false;
|
|
427
426
|
}
|
|
428
427
|
return _createClass(VCObserver, [{
|
|
@@ -505,13 +504,11 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
505
504
|
this.detachAbortListeners();
|
|
506
505
|
this.heatmap = this.getCleanHeatmap();
|
|
507
506
|
this.heatmapNext = this.getCleanHeatmap();
|
|
508
|
-
|
|
509
|
-
this.
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
});
|
|
514
|
-
}
|
|
507
|
+
this.multiHeatmap = new MultiRevisionHeatmap({
|
|
508
|
+
viewport: this.viewport,
|
|
509
|
+
revisions: getRevisions(),
|
|
510
|
+
devToolsEnabled: this.devToolsEnabled
|
|
511
|
+
});
|
|
515
512
|
this.totalTime = 0;
|
|
516
513
|
this.componentsLog = {};
|
|
517
514
|
this.vcRatios = {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InteractionMetrics } from '../../common';
|
|
2
|
+
/**
|
|
3
|
+
* Determines the interaction status based on abort reason and BM3 TTI presence.
|
|
4
|
+
*
|
|
5
|
+
* @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
|
|
6
|
+
* @returns {{
|
|
7
|
+
* originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
|
|
8
|
+
* overrideStatus: 'ABORTED' | 'SUCCEEDED'
|
|
9
|
+
* }} An object containing both the original and override status
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* This function evaluates the interaction status in two ways:
|
|
13
|
+
* 1. originalInteractionStatus: Based on whether there's an abort reason
|
|
14
|
+
* 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const interaction = {
|
|
18
|
+
* abortReason: null,
|
|
19
|
+
* apdex: [1, 2, 3]
|
|
20
|
+
* };
|
|
21
|
+
* const result = getInteractionStatus(interaction);
|
|
22
|
+
* // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
|
|
23
|
+
*/
|
|
24
|
+
export default function getInteractionStatus(interaction: InteractionMetrics): {
|
|
25
|
+
readonly originalInteractionStatus: "ABORTED" | "SUCCEEDED";
|
|
26
|
+
readonly overrideStatus: "ABORTED" | "SUCCEEDED";
|
|
27
|
+
};
|
package/dist/types/vc/types.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare class VCObserver implements VCObserverInterface {
|
|
|
41
41
|
targetName: string;
|
|
42
42
|
ignoreReason: VCIgnoreReason | undefined;
|
|
43
43
|
}[];
|
|
44
|
-
getVCResult: ({ start, stop, tti, prefix, ssr, vc, }: GetVCResultType) => Promise<VCResult>;
|
|
44
|
+
getVCResult: ({ start, stop, tti, prefix, ssr, vc, isEventAborted, }: GetVCResultType) => Promise<VCResult>;
|
|
45
45
|
static calculateVC({ heatmap, ssr, componentsLog, viewport, }: {
|
|
46
46
|
heatmap: number[][];
|
|
47
47
|
ssr?: number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InteractionMetrics } from '../../common';
|
|
2
|
+
/**
|
|
3
|
+
* Determines the interaction status based on abort reason and BM3 TTI presence.
|
|
4
|
+
*
|
|
5
|
+
* @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
|
|
6
|
+
* @returns {{
|
|
7
|
+
* originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
|
|
8
|
+
* overrideStatus: 'ABORTED' | 'SUCCEEDED'
|
|
9
|
+
* }} An object containing both the original and override status
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* This function evaluates the interaction status in two ways:
|
|
13
|
+
* 1. originalInteractionStatus: Based on whether there's an abort reason
|
|
14
|
+
* 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const interaction = {
|
|
18
|
+
* abortReason: null,
|
|
19
|
+
* apdex: [1, 2, 3]
|
|
20
|
+
* };
|
|
21
|
+
* const result = getInteractionStatus(interaction);
|
|
22
|
+
* // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
|
|
23
|
+
*/
|
|
24
|
+
export default function getInteractionStatus(interaction: InteractionMetrics): {
|
|
25
|
+
readonly originalInteractionStatus: "ABORTED" | "SUCCEEDED";
|
|
26
|
+
readonly overrideStatus: "ABORTED" | "SUCCEEDED";
|
|
27
|
+
};
|
|
@@ -51,7 +51,7 @@ export declare class VCObserver implements VCObserverInterface {
|
|
|
51
51
|
targetName: string;
|
|
52
52
|
ignoreReason: VCIgnoreReason | undefined;
|
|
53
53
|
}[];
|
|
54
|
-
getVCResult: ({ start, stop, tti, prefix, ssr, vc, }: GetVCResultType) => Promise<VCResult>;
|
|
54
|
+
getVCResult: ({ start, stop, tti, prefix, ssr, vc, isEventAborted, }: GetVCResultType) => Promise<VCResult>;
|
|
55
55
|
static calculateVC({ heatmap, ssr, componentsLog, viewport, }: {
|
|
56
56
|
heatmap: number[][];
|
|
57
57
|
ssr?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -151,9 +151,6 @@
|
|
|
151
151
|
"ufo-remove-vc-component-observations-after-ttai": {
|
|
152
152
|
"type": "boolean"
|
|
153
153
|
},
|
|
154
|
-
"ufo_vc_multiheatmap": {
|
|
155
|
-
"type": "boolean"
|
|
156
|
-
},
|
|
157
154
|
"ufo-calc-speed-index": {
|
|
158
155
|
"type": "boolean"
|
|
159
156
|
},
|
|
@@ -174,6 +171,12 @@
|
|
|
174
171
|
},
|
|
175
172
|
"enable_ufo_devtools_api_for_extra_events": {
|
|
176
173
|
"type": "boolean"
|
|
174
|
+
},
|
|
175
|
+
"platform_ufo_multiheatmap_killswitch": {
|
|
176
|
+
"type": "boolean"
|
|
177
|
+
},
|
|
178
|
+
"platform_ufo_no_vc_on_aborted": {
|
|
179
|
+
"type": "boolean"
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
}
|