@atlaskit/react-ufo 3.2.0 → 3.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 +16 -0
- package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +1 -0
- package/dist/cjs/create-payload/index.js +10 -18
- package/dist/cjs/interaction-metrics/post-interaction-log.js +1 -0
- package/dist/cjs/interaction-metrics-init/index.js +16 -0
- package/dist/cjs/vc/vc-observer/heatmap/heatmap.js +4 -1
- package/dist/cjs/vc/vc-observer/index.js +27 -30
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +1 -1
- package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +1 -0
- package/dist/es2019/create-payload/index.js +3 -12
- package/dist/es2019/interaction-metrics/post-interaction-log.js +1 -0
- package/dist/es2019/interaction-metrics-init/index.js +16 -0
- package/dist/es2019/vc/vc-observer/heatmap/heatmap.js +4 -1
- package/dist/es2019/vc/vc-observer/index.js +29 -29
- package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +1 -1
- package/dist/esm/create-experimental-interaction-metrics-payload/index.js +1 -0
- package/dist/esm/create-payload/index.js +10 -18
- package/dist/esm/interaction-metrics/post-interaction-log.js +1 -0
- package/dist/esm/interaction-metrics-init/index.js +16 -0
- package/dist/esm/vc/vc-observer/heatmap/heatmap.js +4 -1
- package/dist/esm/vc/vc-observer/index.js +27 -30
- package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +1 -1
- package/dist/types/common/index.d.ts +1 -1
- 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/common/index.d.ts +1 -1
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 3.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#122115](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/122115)
|
|
8
|
+
[`b39ca387a9eb6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b39ca387a9eb6) -
|
|
9
|
+
Remove VC multiheatmap FG
|
|
10
|
+
|
|
11
|
+
## 3.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#120083](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120083)
|
|
16
|
+
[`25a022df71ba2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/25a022df71ba2) -
|
|
17
|
+
add UFO devtools chrome extension api for more events
|
|
18
|
+
|
|
3
19
|
## 3.2.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -105,6 +105,7 @@ var getExperimentalVCMetrics = exports.getExperimentalVCMetrics = /*#__PURE__*/f
|
|
|
105
105
|
start: interaction.start,
|
|
106
106
|
stop: interaction.end,
|
|
107
107
|
tti: (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime,
|
|
108
|
+
isEventAborted: !!interaction.abortReason,
|
|
108
109
|
prefix: prefix,
|
|
109
110
|
vc: interaction.vc
|
|
110
111
|
});
|
|
@@ -192,7 +192,7 @@ var getTTAI = function getTTAI(interaction) {
|
|
|
192
192
|
var getVCMetrics = /*#__PURE__*/function () {
|
|
193
193
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interaction) {
|
|
194
194
|
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
|
|
195
|
-
var config, isSSREnabled, ssr, tti, prefix,
|
|
195
|
+
var config, isSSREnabled, ssr, tti, prefix, interactionStatus, pageVisibilityUpToTTAI, result, VC;
|
|
196
196
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
197
197
|
while (1) switch (_context.prev = _context.next) {
|
|
198
198
|
case 0:
|
|
@@ -216,15 +216,18 @@ var getVCMetrics = /*#__PURE__*/function () {
|
|
|
216
216
|
_interactionMetrics.postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
217
217
|
tti = (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime;
|
|
218
218
|
prefix = 'ufo';
|
|
219
|
-
|
|
219
|
+
interactionStatus = getInteractionStatus(interaction);
|
|
220
|
+
pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
221
|
+
_context.next = 14;
|
|
220
222
|
return (0, _vc.getVCObserver)().getVCResult(_objectSpread({
|
|
221
223
|
start: interaction.start,
|
|
222
224
|
stop: interaction.end,
|
|
223
225
|
tti: tti,
|
|
224
226
|
prefix: prefix,
|
|
225
|
-
vc: interaction.vc
|
|
227
|
+
vc: interaction.vc,
|
|
228
|
+
isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED'
|
|
226
229
|
}, ssr));
|
|
227
|
-
case
|
|
230
|
+
case 14:
|
|
228
231
|
result = _context.sent;
|
|
229
232
|
if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
|
|
230
233
|
(0, _vc.getVCObserver)().stop();
|
|
@@ -232,32 +235,21 @@ var getVCMetrics = /*#__PURE__*/function () {
|
|
|
232
235
|
_interactionMetrics.postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
233
236
|
VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
|
|
234
237
|
if (!(!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")]))) {
|
|
235
|
-
_context.next =
|
|
238
|
+
_context.next = 20;
|
|
236
239
|
break;
|
|
237
240
|
}
|
|
238
241
|
return _context.abrupt("return", result);
|
|
239
|
-
case
|
|
240
|
-
interactionStatus = getInteractionStatus(interaction);
|
|
241
|
-
pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
242
|
+
case 20:
|
|
242
243
|
if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible')) {
|
|
243
244
|
_context.next = 22;
|
|
244
245
|
break;
|
|
245
246
|
}
|
|
246
247
|
return _context.abrupt("return", result);
|
|
247
248
|
case 22:
|
|
248
|
-
if ((0, _platformFeatureFlags.fg)('ufo_vc_multiheatmap')) {
|
|
249
|
-
(_result = result["".concat(prefix, ":vc:rev")]) === null || _result === void 0 || _result.forEach(function (element) {
|
|
250
|
-
var _element$vcDetails;
|
|
251
|
-
if ((_element$vcDetails = element.vcDetails) !== null && _element$vcDetails !== void 0 && (_element$vcDetails = _element$vcDetails['90']) !== null && _element$vcDetails !== void 0 && _element$vcDetails.t) {
|
|
252
|
-
var _element$vcDetails$;
|
|
253
|
-
element['metric:vc90'] = (_element$vcDetails$ = element.vcDetails['90']) === null || _element$vcDetails$ === void 0 ? void 0 : _element$vcDetails$.t;
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
249
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
258
250
|
'metric:vc90': VC['90']
|
|
259
251
|
}));
|
|
260
|
-
case
|
|
252
|
+
case 23:
|
|
261
253
|
case "end":
|
|
262
254
|
return _context.stop();
|
|
263
255
|
}
|
|
@@ -137,6 +137,7 @@ var PostInteractionLog = exports.default = /*#__PURE__*/function () {
|
|
|
137
137
|
stop: performance.now(),
|
|
138
138
|
tti: -1,
|
|
139
139
|
// no need for TTI value here
|
|
140
|
+
isEventAborted: !!this.lastInteractionFinish.abortReason,
|
|
140
141
|
prefix: 'ufo'
|
|
141
142
|
}, this.vcObserverSSRConfig));
|
|
142
143
|
case 6:
|
|
@@ -8,6 +8,7 @@ exports.init = void 0;
|
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _scheduler = require("scheduler");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _additionalPayload = require("../additional-payload");
|
|
12
13
|
var _config = require("../config");
|
|
13
14
|
var _createExperimentalInteractionMetricsPayload = require("../create-experimental-interaction-metrics-payload");
|
|
@@ -21,6 +22,7 @@ function sinkInteraction(instance, payloadPackage) {
|
|
|
21
22
|
(0, _interactionMetrics.sinkInteractionHandler)(function (interactionId, interaction) {
|
|
22
23
|
(0, _scheduler.unstable_scheduleCallback)(_scheduler.unstable_IdlePriority, function () {
|
|
23
24
|
payloadPackage.createPayloads(interactionId, interaction).then(function (payloads) {
|
|
25
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and Criterion
|
|
24
26
|
var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
25
27
|
payloads === null || payloads === void 0 || payloads.forEach(function (payload) {
|
|
26
28
|
if (typeof devToolObserver === 'function') {
|
|
@@ -39,6 +41,13 @@ function sinkExperimentalInteractionMetrics(instance, payloadPackage) {
|
|
|
39
41
|
(0, _scheduler.unstable_scheduleCallback)(_scheduler.unstable_IdlePriority, function () {
|
|
40
42
|
var payload = payloadPackage.createExperimentalMetricsPayload(interactionId, interaction);
|
|
41
43
|
if (payload) {
|
|
44
|
+
if ((0, _platformFeatureFlags.fg)('enable_ufo_devtools_api_for_extra_events')) {
|
|
45
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and Criterion
|
|
46
|
+
var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
47
|
+
if (typeof devToolObserver === 'function') {
|
|
48
|
+
devToolObserver === null || devToolObserver === void 0 || devToolObserver(payload);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
42
51
|
instance.sendOperationalEvent(payload);
|
|
43
52
|
}
|
|
44
53
|
});
|
|
@@ -49,6 +58,13 @@ function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
|
|
|
49
58
|
(0, _scheduler.unstable_scheduleCallback)(_scheduler.unstable_IdlePriority, function () {
|
|
50
59
|
var payload = createPostInteractionLogPayload(logOutput);
|
|
51
60
|
if (payload) {
|
|
61
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and also by Criterion
|
|
62
|
+
if ((0, _platformFeatureFlags.fg)('enable_ufo_devtools_api_for_extra_events')) {
|
|
63
|
+
var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
64
|
+
if (typeof devToolObserver === 'function') {
|
|
65
|
+
devToolObserver === null || devToolObserver === void 0 || devToolObserver(payload);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
52
68
|
instance.sendOperationalEvent(payload);
|
|
53
69
|
}
|
|
54
70
|
});
|
|
@@ -10,6 +10,7 @@ var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _hiddenTiming = require("../../../hidden-timing");
|
|
13
14
|
var UNUSED_SECTOR = 0;
|
|
14
15
|
var MultiRevisionHeatmap = exports.MultiRevisionHeatmap = /*#__PURE__*/function () {
|
|
15
16
|
function MultiRevisionHeatmap(_ref) {
|
|
@@ -107,8 +108,10 @@ var MultiRevisionHeatmap = exports.MultiRevisionHeatmap = /*#__PURE__*/function
|
|
|
107
108
|
}, {
|
|
108
109
|
key: "getPayloadShapedData",
|
|
109
110
|
value: function getPayloadShapedData(args) {
|
|
111
|
+
var pageVisibilityUpToTTAI = (0, _hiddenTiming.getPageVisibilityState)(args.interactionStart, args.ttai);
|
|
110
112
|
var result = this.processData(args);
|
|
111
113
|
var payload = this.revisions.map(function (rev, i) {
|
|
114
|
+
var _vcDetails$;
|
|
112
115
|
var vcDetails = {};
|
|
113
116
|
args.VCParts.forEach(function (VCPart) {
|
|
114
117
|
vcDetails[VCPart] = {
|
|
@@ -120,7 +123,7 @@ var MultiRevisionHeatmap = exports.MultiRevisionHeatmap = /*#__PURE__*/function
|
|
|
120
123
|
revision: rev.name,
|
|
121
124
|
vcDetails: vcDetails,
|
|
122
125
|
clean: args.clean,
|
|
123
|
-
'metric:vc90': null
|
|
126
|
+
'metric:vc90': args.clean && !args.isEventAborted && pageVisibilityUpToTTAI === 'visible' ? vcDetails === null || vcDetails === void 0 || (_vcDetails$ = vcDetails['90']) === null || _vcDetails$ === void 0 ? void 0 : _vcDetails$.t : null
|
|
124
127
|
};
|
|
125
128
|
});
|
|
126
129
|
return payload;
|
|
@@ -103,11 +103,11 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
103
103
|
});
|
|
104
104
|
(0, _defineProperty2.default)(this, "getVCResult", /*#__PURE__*/function () {
|
|
105
105
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref3) {
|
|
106
|
-
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;
|
|
106
|
+
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;
|
|
107
107
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
108
108
|
while (1) switch (_context.prev = _context.next) {
|
|
109
109
|
case 0:
|
|
110
|
-
start = _ref3.start, stop = _ref3.stop, tti = _ref3.tti, prefix = _ref3.prefix, ssr = _ref3.ssr, vc = _ref3.vc;
|
|
110
|
+
start = _ref3.start, stop = _ref3.stop, tti = _ref3.tti, prefix = _ref3.prefix, ssr = _ref3.ssr, vc = _ref3.vc, isEventAborted = _ref3.isEventAborted;
|
|
111
111
|
startTime = performance.now(); // add local measurement
|
|
112
112
|
fullPrefix = prefix !== undefined && prefix !== '' ? "".concat(prefix, ":") : '';
|
|
113
113
|
rawData = vc !== undefined ? vc : _this.getVCRawData();
|
|
@@ -240,8 +240,8 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
240
240
|
} catch (e) {
|
|
241
241
|
/* do nothing */
|
|
242
242
|
}
|
|
243
|
-
isMultiHeatmapEnabled = (0, _platformFeatureFlags.fg)('
|
|
244
|
-
revisionsData = isMultiHeatmapEnabled && multiHeatmap !== null ? (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:rev"), multiHeatmap.getPayloadShapedData({
|
|
243
|
+
isMultiHeatmapEnabled = !(0, _platformFeatureFlags.fg)('platform_ufo_multiheatmap_killswitch');
|
|
244
|
+
revisionsData = isMultiHeatmapEnabled && multiHeatmap !== null ? (0, _defineProperty2.default)({}, "".concat(fullPrefix, "vc:rev"), multiHeatmap === null || multiHeatmap === void 0 ? void 0 : multiHeatmap.getPayloadShapedData({
|
|
245
245
|
VCParts: VCObserver.VCParts.map(function (v) {
|
|
246
246
|
return parseInt(v);
|
|
247
247
|
}),
|
|
@@ -253,15 +253,18 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
253
253
|
var classifier = _ref10.classifier;
|
|
254
254
|
return classifier.filterComponentsLog;
|
|
255
255
|
}),
|
|
256
|
+
isEventAborted: isEventAborted,
|
|
257
|
+
interactionStart: start,
|
|
256
258
|
ttai: stop,
|
|
257
259
|
ssr: ssr,
|
|
258
260
|
clean: !abortReasonInfo
|
|
259
261
|
})) : null; // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
260
262
|
isCalcSpeedIndexEnabled = (0, _platformFeatureFlags.fg)('ufo-calc-speed-index');
|
|
263
|
+
speedIndex = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "ufo:speedIndex", VCEntries.speedIndex), "ufo:next:speedIndex", vcNext.VCEntries.speedIndex);
|
|
261
264
|
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
262
265
|
'metrics:vc': VC
|
|
263
|
-
}, "".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), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".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),
|
|
264
|
-
case
|
|
266
|
+
}, "".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), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".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 : {}));
|
|
267
|
+
case 24:
|
|
265
268
|
case "end":
|
|
266
269
|
return _context.stop();
|
|
267
270
|
}
|
|
@@ -274,16 +277,14 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
274
277
|
(0, _defineProperty2.default)(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason) {
|
|
275
278
|
_this.measureStart();
|
|
276
279
|
_this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
});
|
|
286
|
-
}
|
|
280
|
+
_this.onViewportChangeDetected({
|
|
281
|
+
timestamp: rawTime,
|
|
282
|
+
intersectionRect: intersectionRect,
|
|
283
|
+
targetName: targetName,
|
|
284
|
+
element: element,
|
|
285
|
+
type: type,
|
|
286
|
+
ignoreReason: ignoreReason
|
|
287
|
+
});
|
|
287
288
|
_this.measureStop();
|
|
288
289
|
});
|
|
289
290
|
(0, _defineProperty2.default)(this, "legacyHandleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason) {
|
|
@@ -423,13 +424,11 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
423
424
|
});
|
|
424
425
|
this.heatmap = this.getCleanHeatmap();
|
|
425
426
|
this.heatmapNext = this.getCleanHeatmap();
|
|
426
|
-
|
|
427
|
-
this.
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
});
|
|
432
|
-
}
|
|
427
|
+
this.multiHeatmap = new _heatmap.MultiRevisionHeatmap({
|
|
428
|
+
viewport: this.viewport,
|
|
429
|
+
revisions: (0, _revisions.getRevisions)(),
|
|
430
|
+
devToolsEnabled: this.devToolsEnabled
|
|
431
|
+
});
|
|
433
432
|
this.isPostInteraction = options.isPostInteraction || false;
|
|
434
433
|
}
|
|
435
434
|
return (0, _createClass2.default)(VCObserver, [{
|
|
@@ -512,13 +511,11 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
512
511
|
this.detachAbortListeners();
|
|
513
512
|
this.heatmap = this.getCleanHeatmap();
|
|
514
513
|
this.heatmapNext = this.getCleanHeatmap();
|
|
515
|
-
|
|
516
|
-
this.
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
});
|
|
521
|
-
}
|
|
514
|
+
this.multiHeatmap = new _heatmap.MultiRevisionHeatmap({
|
|
515
|
+
viewport: this.viewport,
|
|
516
|
+
revisions: (0, _revisions.getRevisions)(),
|
|
517
|
+
devToolsEnabled: this.devToolsEnabled
|
|
518
|
+
});
|
|
522
519
|
this.totalTime = 0;
|
|
523
520
|
this.componentsLog = {};
|
|
524
521
|
this.vcRatios = {};
|
package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js
CHANGED
|
@@ -63,7 +63,7 @@ var ViewportCanvas = exports.ViewportCanvas = /*#__PURE__*/function () {
|
|
|
63
63
|
throw new Error('Could not get canvas context');
|
|
64
64
|
}
|
|
65
65
|
this.ctx = ctx;
|
|
66
|
-
this.ctx.globalCompositeOperation =
|
|
66
|
+
this.ctx.globalCompositeOperation = 'source-over';
|
|
67
67
|
this.clear();
|
|
68
68
|
}
|
|
69
69
|
return (0, _createClass2.default)(ViewportCanvas, [{
|
|
@@ -65,6 +65,7 @@ export const getExperimentalVCMetrics = async interaction => {
|
|
|
65
65
|
start: interaction.start,
|
|
66
66
|
stop: interaction.end,
|
|
67
67
|
tti: (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 ? void 0 : (_interaction$apdex$ = _interaction$apdex[0]) === null || _interaction$apdex$ === void 0 ? void 0 : _interaction$apdex$.stopTime,
|
|
68
|
+
isEventAborted: !!interaction.abortReason,
|
|
68
69
|
prefix,
|
|
69
70
|
vc: interaction.vc
|
|
70
71
|
});
|
|
@@ -181,12 +181,15 @@ const getVCMetrics = async interaction => {
|
|
|
181
181
|
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
182
182
|
const tti = (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 ? void 0 : (_interaction$apdex$ = _interaction$apdex[0]) === null || _interaction$apdex$ === void 0 ? void 0 : _interaction$apdex$.stopTime;
|
|
183
183
|
const prefix = 'ufo';
|
|
184
|
+
const interactionStatus = getInteractionStatus(interaction);
|
|
185
|
+
const pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
184
186
|
const result = await getVCObserver().getVCResult({
|
|
185
187
|
start: interaction.start,
|
|
186
188
|
stop: interaction.end,
|
|
187
189
|
tti,
|
|
188
190
|
prefix,
|
|
189
191
|
vc: interaction.vc,
|
|
192
|
+
isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED',
|
|
190
193
|
...ssr
|
|
191
194
|
});
|
|
192
195
|
if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
|
|
@@ -197,21 +200,9 @@ const getVCMetrics = async interaction => {
|
|
|
197
200
|
if (!VC || !(result !== null && result !== void 0 && result[`${prefix}:vc:clean`])) {
|
|
198
201
|
return result;
|
|
199
202
|
}
|
|
200
|
-
const interactionStatus = getInteractionStatus(interaction);
|
|
201
|
-
const pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
202
203
|
if (interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') {
|
|
203
204
|
return result;
|
|
204
205
|
}
|
|
205
|
-
if (fg('ufo_vc_multiheatmap')) {
|
|
206
|
-
var _result;
|
|
207
|
-
(_result = result[`${prefix}:vc:rev`]) === null || _result === void 0 ? void 0 : _result.forEach(element => {
|
|
208
|
-
var _element$vcDetails, _element$vcDetails$;
|
|
209
|
-
if ((_element$vcDetails = element.vcDetails) !== null && _element$vcDetails !== void 0 && (_element$vcDetails$ = _element$vcDetails['90']) !== null && _element$vcDetails$ !== void 0 && _element$vcDetails$.t) {
|
|
210
|
-
var _element$vcDetails$2;
|
|
211
|
-
element['metric:vc90'] = (_element$vcDetails$2 = element.vcDetails['90']) === null || _element$vcDetails$2 === void 0 ? void 0 : _element$vcDetails$2.t;
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
206
|
return {
|
|
216
207
|
...result,
|
|
217
208
|
'metric:vc90': VC['90']
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { unstable_IdlePriority as idlePriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { startLighthouseObserver } from '../additional-payload';
|
|
3
4
|
import { setUFOConfig } from '../config';
|
|
4
5
|
import { experimentalVC, sinkExperimentalHandler } from '../create-experimental-interaction-metrics-payload';
|
|
@@ -10,6 +11,7 @@ function sinkInteraction(instance, payloadPackage) {
|
|
|
10
11
|
sinkInteractionHandler((interactionId, interaction) => {
|
|
11
12
|
scheduleCallback(idlePriority, () => {
|
|
12
13
|
payloadPackage.createPayloads(interactionId, interaction).then(payloads => {
|
|
14
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and Criterion
|
|
13
15
|
const devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
14
16
|
payloads === null || payloads === void 0 ? void 0 : payloads.forEach(payload => {
|
|
15
17
|
if (typeof devToolObserver === 'function') {
|
|
@@ -28,6 +30,13 @@ function sinkExperimentalInteractionMetrics(instance, payloadPackage) {
|
|
|
28
30
|
scheduleCallback(idlePriority, () => {
|
|
29
31
|
const payload = payloadPackage.createExperimentalMetricsPayload(interactionId, interaction);
|
|
30
32
|
if (payload) {
|
|
33
|
+
if (fg('enable_ufo_devtools_api_for_extra_events')) {
|
|
34
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and Criterion
|
|
35
|
+
const devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
36
|
+
if (typeof devToolObserver === 'function') {
|
|
37
|
+
devToolObserver === null || devToolObserver === void 0 ? void 0 : devToolObserver(payload);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
31
40
|
instance.sendOperationalEvent(payload);
|
|
32
41
|
}
|
|
33
42
|
});
|
|
@@ -38,6 +47,13 @@ function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
|
|
|
38
47
|
scheduleCallback(idlePriority, () => {
|
|
39
48
|
const payload = createPostInteractionLogPayload(logOutput);
|
|
40
49
|
if (payload) {
|
|
50
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and also by Criterion
|
|
51
|
+
if (fg('enable_ufo_devtools_api_for_extra_events')) {
|
|
52
|
+
const devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
53
|
+
if (typeof devToolObserver === 'function') {
|
|
54
|
+
devToolObserver === null || devToolObserver === void 0 ? void 0 : devToolObserver(payload);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
41
57
|
instance.sendOperationalEvent(payload);
|
|
42
58
|
}
|
|
43
59
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { getPageVisibilityState } from '../../../hidden-timing';
|
|
2
3
|
const UNUSED_SECTOR = 0;
|
|
3
4
|
export class MultiRevisionHeatmap {
|
|
4
5
|
constructor({
|
|
@@ -91,8 +92,10 @@ export class MultiRevisionHeatmap {
|
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
94
|
getPayloadShapedData(args) {
|
|
95
|
+
const pageVisibilityUpToTTAI = getPageVisibilityState(args.interactionStart, args.ttai);
|
|
94
96
|
const result = this.processData(args);
|
|
95
97
|
const payload = this.revisions.map((rev, i) => {
|
|
98
|
+
var _vcDetails$;
|
|
96
99
|
const vcDetails = {};
|
|
97
100
|
args.VCParts.forEach(VCPart => {
|
|
98
101
|
vcDetails[VCPart] = {
|
|
@@ -104,7 +107,7 @@ export class MultiRevisionHeatmap {
|
|
|
104
107
|
revision: rev.name,
|
|
105
108
|
vcDetails,
|
|
106
109
|
clean: args.clean,
|
|
107
|
-
'metric:vc90': null
|
|
110
|
+
'metric:vc90': args.clean && !args.isEventAborted && pageVisibilityUpToTTAI === 'visible' ? vcDetails === null || vcDetails === void 0 ? void 0 : (_vcDetails$ = vcDetails['90']) === null || _vcDetails$ === void 0 ? void 0 : _vcDetails$.t : null
|
|
108
111
|
};
|
|
109
112
|
});
|
|
110
113
|
return payload;
|
|
@@ -91,7 +91,8 @@ export class VCObserver {
|
|
|
91
91
|
tti,
|
|
92
92
|
prefix,
|
|
93
93
|
ssr,
|
|
94
|
-
vc
|
|
94
|
+
vc,
|
|
95
|
+
isEventAborted
|
|
95
96
|
}) => {
|
|
96
97
|
const startTime = performance.now();
|
|
97
98
|
// add local measurement
|
|
@@ -249,9 +250,9 @@ export class VCObserver {
|
|
|
249
250
|
} catch (e) {
|
|
250
251
|
/* do nothing */
|
|
251
252
|
}
|
|
252
|
-
const isMultiHeatmapEnabled = fg('
|
|
253
|
+
const isMultiHeatmapEnabled = !fg('platform_ufo_multiheatmap_killswitch');
|
|
253
254
|
const revisionsData = isMultiHeatmapEnabled && multiHeatmap !== null ? {
|
|
254
|
-
[`${fullPrefix}vc:rev`]: multiHeatmap.getPayloadShapedData({
|
|
255
|
+
[`${fullPrefix}vc:rev`]: multiHeatmap === null || multiHeatmap === void 0 ? void 0 : multiHeatmap.getPayloadShapedData({
|
|
255
256
|
VCParts: VCObserver.VCParts.map(v => parseInt(v)),
|
|
256
257
|
VCCalculationMethods: getRevisions().map(({
|
|
257
258
|
classifier
|
|
@@ -259,6 +260,8 @@ export class VCObserver {
|
|
|
259
260
|
filterComponentsLog: getRevisions().map(({
|
|
260
261
|
classifier
|
|
261
262
|
}) => classifier.filterComponentsLog),
|
|
263
|
+
isEventAborted,
|
|
264
|
+
interactionStart: start,
|
|
262
265
|
ttai: stop,
|
|
263
266
|
ssr,
|
|
264
267
|
clean: !abortReasonInfo
|
|
@@ -266,6 +269,10 @@ export class VCObserver {
|
|
|
266
269
|
} : null;
|
|
267
270
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
268
271
|
const isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
|
|
272
|
+
const speedIndex = {
|
|
273
|
+
[`ufo:speedIndex`]: VCEntries.speedIndex,
|
|
274
|
+
[`ufo:next:speedIndex`]: vcNext.VCEntries.speedIndex
|
|
275
|
+
};
|
|
269
276
|
return {
|
|
270
277
|
'metrics:vc': VC,
|
|
271
278
|
[`${fullPrefix}vc:state`]: true,
|
|
@@ -284,23 +291,20 @@ export class VCObserver {
|
|
|
284
291
|
//...oldDomUpdates,
|
|
285
292
|
[`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog),
|
|
286
293
|
...revisionsData,
|
|
287
|
-
|
|
288
|
-
[`ufo:next:speedIndex`]: isCalcSpeedIndexEnabled ? vcNext.VCEntries.speedIndex : undefined
|
|
294
|
+
...(isCalcSpeedIndexEnabled ? speedIndex : {})
|
|
289
295
|
};
|
|
290
296
|
});
|
|
291
297
|
_defineProperty(this, "handleUpdate", (rawTime, intersectionRect, targetName, element, type, ignoreReason) => {
|
|
292
298
|
this.measureStart();
|
|
293
299
|
this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
});
|
|
303
|
-
}
|
|
300
|
+
this.onViewportChangeDetected({
|
|
301
|
+
timestamp: rawTime,
|
|
302
|
+
intersectionRect,
|
|
303
|
+
targetName,
|
|
304
|
+
element,
|
|
305
|
+
type,
|
|
306
|
+
ignoreReason
|
|
307
|
+
});
|
|
304
308
|
this.measureStop();
|
|
305
309
|
});
|
|
306
310
|
_defineProperty(this, "legacyHandleUpdate", (rawTime, intersectionRect, targetName, element, type, ignoreReason) => {
|
|
@@ -441,13 +445,11 @@ export class VCObserver {
|
|
|
441
445
|
});
|
|
442
446
|
this.heatmap = this.getCleanHeatmap();
|
|
443
447
|
this.heatmapNext = this.getCleanHeatmap();
|
|
444
|
-
|
|
445
|
-
this.
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
});
|
|
450
|
-
}
|
|
448
|
+
this.multiHeatmap = new MultiRevisionHeatmap({
|
|
449
|
+
viewport: this.viewport,
|
|
450
|
+
revisions: getRevisions(),
|
|
451
|
+
devToolsEnabled: this.devToolsEnabled
|
|
452
|
+
});
|
|
451
453
|
this.isPostInteraction = options.isPostInteraction || false;
|
|
452
454
|
}
|
|
453
455
|
start({
|
|
@@ -606,13 +608,11 @@ export class VCObserver {
|
|
|
606
608
|
this.detachAbortListeners();
|
|
607
609
|
this.heatmap = this.getCleanHeatmap();
|
|
608
610
|
this.heatmapNext = this.getCleanHeatmap();
|
|
609
|
-
|
|
610
|
-
this.
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
});
|
|
615
|
-
}
|
|
611
|
+
this.multiHeatmap = new MultiRevisionHeatmap({
|
|
612
|
+
viewport: this.viewport,
|
|
613
|
+
revisions: getRevisions(),
|
|
614
|
+
devToolsEnabled: this.devToolsEnabled
|
|
615
|
+
});
|
|
616
616
|
this.totalTime = 0;
|
|
617
617
|
this.componentsLog = {};
|
|
618
618
|
this.vcRatios = {};
|
|
@@ -50,7 +50,7 @@ export class ViewportCanvas {
|
|
|
50
50
|
throw new Error('Could not get canvas context');
|
|
51
51
|
}
|
|
52
52
|
this.ctx = ctx;
|
|
53
|
-
this.ctx.globalCompositeOperation =
|
|
53
|
+
this.ctx.globalCompositeOperation = 'source-over';
|
|
54
54
|
this.clear();
|
|
55
55
|
}
|
|
56
56
|
getScaledDimensions() {
|
|
@@ -95,6 +95,7 @@ export var getExperimentalVCMetrics = /*#__PURE__*/function () {
|
|
|
95
95
|
start: interaction.start,
|
|
96
96
|
stop: interaction.end,
|
|
97
97
|
tti: (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime,
|
|
98
|
+
isEventAborted: !!interaction.abortReason,
|
|
98
99
|
prefix: prefix,
|
|
99
100
|
vc: interaction.vc
|
|
100
101
|
});
|
|
@@ -181,7 +181,7 @@ var getTTAI = function getTTAI(interaction) {
|
|
|
181
181
|
var getVCMetrics = /*#__PURE__*/function () {
|
|
182
182
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
|
|
183
183
|
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
|
|
184
|
-
var config, isSSREnabled, ssr, tti, prefix,
|
|
184
|
+
var config, isSSREnabled, ssr, tti, prefix, interactionStatus, pageVisibilityUpToTTAI, result, VC;
|
|
185
185
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
186
186
|
while (1) switch (_context.prev = _context.next) {
|
|
187
187
|
case 0:
|
|
@@ -205,15 +205,18 @@ var getVCMetrics = /*#__PURE__*/function () {
|
|
|
205
205
|
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
206
206
|
tti = (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime;
|
|
207
207
|
prefix = 'ufo';
|
|
208
|
-
|
|
208
|
+
interactionStatus = getInteractionStatus(interaction);
|
|
209
|
+
pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
210
|
+
_context.next = 14;
|
|
209
211
|
return getVCObserver().getVCResult(_objectSpread({
|
|
210
212
|
start: interaction.start,
|
|
211
213
|
stop: interaction.end,
|
|
212
214
|
tti: tti,
|
|
213
215
|
prefix: prefix,
|
|
214
|
-
vc: interaction.vc
|
|
216
|
+
vc: interaction.vc,
|
|
217
|
+
isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED'
|
|
215
218
|
}, ssr));
|
|
216
|
-
case
|
|
219
|
+
case 14:
|
|
217
220
|
result = _context.sent;
|
|
218
221
|
if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
|
|
219
222
|
getVCObserver().stop();
|
|
@@ -221,32 +224,21 @@ var getVCMetrics = /*#__PURE__*/function () {
|
|
|
221
224
|
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
222
225
|
VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
|
|
223
226
|
if (!(!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")]))) {
|
|
224
|
-
_context.next =
|
|
227
|
+
_context.next = 20;
|
|
225
228
|
break;
|
|
226
229
|
}
|
|
227
230
|
return _context.abrupt("return", result);
|
|
228
|
-
case
|
|
229
|
-
interactionStatus = getInteractionStatus(interaction);
|
|
230
|
-
pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
231
|
+
case 20:
|
|
231
232
|
if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible')) {
|
|
232
233
|
_context.next = 22;
|
|
233
234
|
break;
|
|
234
235
|
}
|
|
235
236
|
return _context.abrupt("return", result);
|
|
236
237
|
case 22:
|
|
237
|
-
if (fg('ufo_vc_multiheatmap')) {
|
|
238
|
-
(_result = result["".concat(prefix, ":vc:rev")]) === null || _result === void 0 || _result.forEach(function (element) {
|
|
239
|
-
var _element$vcDetails;
|
|
240
|
-
if ((_element$vcDetails = element.vcDetails) !== null && _element$vcDetails !== void 0 && (_element$vcDetails = _element$vcDetails['90']) !== null && _element$vcDetails !== void 0 && _element$vcDetails.t) {
|
|
241
|
-
var _element$vcDetails$;
|
|
242
|
-
element['metric:vc90'] = (_element$vcDetails$ = element.vcDetails['90']) === null || _element$vcDetails$ === void 0 ? void 0 : _element$vcDetails$.t;
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
238
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
247
239
|
'metric:vc90': VC['90']
|
|
248
240
|
}));
|
|
249
|
-
case
|
|
241
|
+
case 23:
|
|
250
242
|
case "end":
|
|
251
243
|
return _context.stop();
|
|
252
244
|
}
|
|
@@ -130,6 +130,7 @@ var PostInteractionLog = /*#__PURE__*/function () {
|
|
|
130
130
|
stop: performance.now(),
|
|
131
131
|
tti: -1,
|
|
132
132
|
// no need for TTI value here
|
|
133
|
+
isEventAborted: !!this.lastInteractionFinish.abortReason,
|
|
133
134
|
prefix: 'ufo'
|
|
134
135
|
}, this.vcObserverSSRConfig));
|
|
135
136
|
case 6:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { unstable_IdlePriority as idlePriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { startLighthouseObserver } from '../additional-payload';
|
|
4
5
|
import { setUFOConfig } from '../config';
|
|
5
6
|
import { experimentalVC, sinkExperimentalHandler } from '../create-experimental-interaction-metrics-payload';
|
|
@@ -11,6 +12,7 @@ function sinkInteraction(instance, payloadPackage) {
|
|
|
11
12
|
sinkInteractionHandler(function (interactionId, interaction) {
|
|
12
13
|
scheduleCallback(idlePriority, function () {
|
|
13
14
|
payloadPackage.createPayloads(interactionId, interaction).then(function (payloads) {
|
|
15
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and Criterion
|
|
14
16
|
var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
15
17
|
payloads === null || payloads === void 0 || payloads.forEach(function (payload) {
|
|
16
18
|
if (typeof devToolObserver === 'function') {
|
|
@@ -29,6 +31,13 @@ function sinkExperimentalInteractionMetrics(instance, payloadPackage) {
|
|
|
29
31
|
scheduleCallback(idlePriority, function () {
|
|
30
32
|
var payload = payloadPackage.createExperimentalMetricsPayload(interactionId, interaction);
|
|
31
33
|
if (payload) {
|
|
34
|
+
if (fg('enable_ufo_devtools_api_for_extra_events')) {
|
|
35
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and Criterion
|
|
36
|
+
var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
37
|
+
if (typeof devToolObserver === 'function') {
|
|
38
|
+
devToolObserver === null || devToolObserver === void 0 || devToolObserver(payload);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
32
41
|
instance.sendOperationalEvent(payload);
|
|
33
42
|
}
|
|
34
43
|
});
|
|
@@ -39,6 +48,13 @@ function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
|
|
|
39
48
|
scheduleCallback(idlePriority, function () {
|
|
40
49
|
var payload = createPostInteractionLogPayload(logOutput);
|
|
41
50
|
if (payload) {
|
|
51
|
+
// NOTE: This API is used by the UFO DevTool Chrome Extension and also by Criterion
|
|
52
|
+
if (fg('enable_ufo_devtools_api_for_extra_events')) {
|
|
53
|
+
var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
|
|
54
|
+
if (typeof devToolObserver === 'function') {
|
|
55
|
+
devToolObserver === null || devToolObserver === void 0 || devToolObserver(payload);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
42
58
|
instance.sendOperationalEvent(payload);
|
|
43
59
|
}
|
|
44
60
|
});
|
|
@@ -3,6 +3,7 @@ import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructurin
|
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
+
import { getPageVisibilityState } from '../../../hidden-timing';
|
|
6
7
|
var UNUSED_SECTOR = 0;
|
|
7
8
|
export var MultiRevisionHeatmap = /*#__PURE__*/function () {
|
|
8
9
|
function MultiRevisionHeatmap(_ref) {
|
|
@@ -100,8 +101,10 @@ export var MultiRevisionHeatmap = /*#__PURE__*/function () {
|
|
|
100
101
|
}, {
|
|
101
102
|
key: "getPayloadShapedData",
|
|
102
103
|
value: function getPayloadShapedData(args) {
|
|
104
|
+
var pageVisibilityUpToTTAI = getPageVisibilityState(args.interactionStart, args.ttai);
|
|
103
105
|
var result = this.processData(args);
|
|
104
106
|
var payload = this.revisions.map(function (rev, i) {
|
|
107
|
+
var _vcDetails$;
|
|
105
108
|
var vcDetails = {};
|
|
106
109
|
args.VCParts.forEach(function (VCPart) {
|
|
107
110
|
vcDetails[VCPart] = {
|
|
@@ -113,7 +116,7 @@ export var MultiRevisionHeatmap = /*#__PURE__*/function () {
|
|
|
113
116
|
revision: rev.name,
|
|
114
117
|
vcDetails: vcDetails,
|
|
115
118
|
clean: args.clean,
|
|
116
|
-
'metric:vc90': null
|
|
119
|
+
'metric:vc90': args.clean && !args.isEventAborted && pageVisibilityUpToTTAI === 'visible' ? vcDetails === null || vcDetails === void 0 || (_vcDetails$ = vcDetails['90']) === null || _vcDetails$ === void 0 ? void 0 : _vcDetails$.t : null
|
|
117
120
|
};
|
|
118
121
|
});
|
|
119
122
|
return payload;
|
|
@@ -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 = {};
|
package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js
CHANGED
|
@@ -56,7 +56,7 @@ export var ViewportCanvas = /*#__PURE__*/function () {
|
|
|
56
56
|
throw new Error('Could not get canvas context');
|
|
57
57
|
}
|
|
58
58
|
this.ctx = ctx;
|
|
59
|
-
this.ctx.globalCompositeOperation =
|
|
59
|
+
this.ctx.globalCompositeOperation = 'source-over';
|
|
60
60
|
this.clear();
|
|
61
61
|
}
|
|
62
62
|
return _createClass(ViewportCanvas, [{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { AssetResourceEntry, AssetsClassification, AssetsData, AssetsReporter, } from './assets/types';
|
|
2
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';
|
|
3
|
-
export type { MultiHeatmapPayload
|
|
3
|
+
export type { MultiHeatmapPayload } from './vc/types';
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Prefer import from @atlaskit/react-ufo/interaction-context
|
|
6
6
|
*/
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { AssetResourceEntry, AssetsClassification, AssetsData, AssetsReporter, } from './assets/types';
|
|
2
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';
|
|
3
|
-
export type { MultiHeatmapPayload
|
|
3
|
+
export type { MultiHeatmapPayload } from './vc/types';
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Prefer import from @atlaskit/react-ufo/interaction-context
|
|
6
6
|
*/
|
|
@@ -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
|
+
"version": "3.3.1",
|
|
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
|
},
|
|
@@ -171,6 +168,12 @@
|
|
|
171
168
|
},
|
|
172
169
|
"platform_ufo_vc_ttai_on_paint": {
|
|
173
170
|
"type": "boolean"
|
|
171
|
+
},
|
|
172
|
+
"enable_ufo_devtools_api_for_extra_events": {
|
|
173
|
+
"type": "boolean"
|
|
174
|
+
},
|
|
175
|
+
"platform_ufo_multiheatmap_killswitch": {
|
|
176
|
+
"type": "boolean"
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
179
|
}
|