@atlaskit/react-ufo 4.0.1 → 4.0.3
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-payload/critical-metrics-payload/index.js +5 -2
- package/dist/cjs/create-payload/critical-metrics-payload/root-metrics.js +13 -7
- package/dist/cjs/create-payload/critical-metrics-payload/segment-metrics/create-segment-metrics.js +25 -18
- package/dist/cjs/create-post-interaction-log-payload/index.js +2 -3
- package/dist/es2019/create-payload/critical-metrics-payload/index.js +3 -2
- package/dist/es2019/create-payload/critical-metrics-payload/root-metrics.js +4 -0
- package/dist/es2019/create-payload/critical-metrics-payload/segment-metrics/create-segment-metrics.js +4 -0
- package/dist/es2019/create-post-interaction-log-payload/index.js +2 -3
- package/dist/esm/create-payload/critical-metrics-payload/index.js +5 -2
- package/dist/esm/create-payload/critical-metrics-payload/root-metrics.js +13 -7
- package/dist/esm/create-payload/critical-metrics-payload/segment-metrics/create-segment-metrics.js +25 -18
- package/dist/esm/create-post-interaction-log-payload/index.js +2 -3
- package/dist/types/config/index.d.ts +6 -6
- package/dist/types/create-payload/critical-metrics-payload/root-metrics.d.ts +1 -1
- package/dist/types-ts4.5/config/index.d.ts +6 -6
- package/dist/types-ts4.5/create-payload/critical-metrics-payload/root-metrics.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#186813](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/186813)
|
|
8
|
+
[`b0dd8177f1f10`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b0dd8177f1f10) -
|
|
9
|
+
HOT-119287 only produce critical metrics for root and successful interaction
|
|
10
|
+
|
|
11
|
+
## 4.0.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#185693](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/185693)
|
|
16
|
+
[`c8e0df9e675c4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c8e0df9e675c4) -
|
|
17
|
+
FG cleanup platform_ufo_post_interaction_most_recent_vc_rev
|
|
18
|
+
|
|
3
19
|
## 4.0.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -9,6 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _rootMetrics = require("./root-metrics");
|
|
13
14
|
var _createSegmentMetrics = require("./segment-metrics/create-segment-metrics");
|
|
14
15
|
function createCriticalMetricsPayloads(_x, _x2, _x3) {
|
|
@@ -21,13 +22,15 @@ function _createCriticalMetricsPayloads() {
|
|
|
21
22
|
while (1) switch (_context.prev = _context.next) {
|
|
22
23
|
case 0:
|
|
23
24
|
_context.next = 2;
|
|
24
|
-
return Promise.all([(0, _rootMetrics.createRootCriticalMetricsPayload)(interactionId, interaction, vcMetrics), (0, _createSegmentMetrics.createSegmentMetricsPayloads)(interactionId, interaction)]);
|
|
25
|
+
return Promise.all([(0, _rootMetrics.createRootCriticalMetricsPayload)(interactionId, interaction, vcMetrics), (0, _platformFeatureFlags.fg)('platform_ufo_segment_critical_metrics') ? (0, _createSegmentMetrics.createSegmentMetricsPayloads)(interactionId, interaction) : []]);
|
|
25
26
|
case 2:
|
|
26
27
|
_yield$Promise$all = _context.sent;
|
|
27
28
|
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
|
|
28
29
|
rootPayload = _yield$Promise$all2[0];
|
|
29
30
|
segmentPayloads = _yield$Promise$all2[1];
|
|
30
|
-
return _context.abrupt("return", [rootPayload].concat((0, _toConsumableArray2.default)(segmentPayloads)))
|
|
31
|
+
return _context.abrupt("return", [rootPayload].concat((0, _toConsumableArray2.default)(segmentPayloads)).filter(function (v) {
|
|
32
|
+
return v != null;
|
|
33
|
+
}));
|
|
31
34
|
case 7:
|
|
32
35
|
case "end":
|
|
33
36
|
return _context.stop();
|
|
@@ -57,11 +57,17 @@ function _createRootCriticalMetricsPayload() {
|
|
|
57
57
|
pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
58
58
|
pageVisibilityAtTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
|
|
59
59
|
interactionStatus = (0, _getInteractionStatus.default)(interaction);
|
|
60
|
+
if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED')) {
|
|
61
|
+
_context.next = 9;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
return _context.abrupt("return", null);
|
|
65
|
+
case 9:
|
|
60
66
|
newUFOName = (0, _utils.sanitizeUfoName)(ufoName); // Get performance metrics
|
|
61
67
|
ttai = (0, _getTtai.default)(interaction);
|
|
62
|
-
_context.next =
|
|
68
|
+
_context.next = 13;
|
|
63
69
|
return (0, _getPaintMetrics.default)(type, end);
|
|
64
|
-
case
|
|
70
|
+
case 13:
|
|
65
71
|
paintMetrics = _context.sent;
|
|
66
72
|
navigationMetrics = (0, _getNavigationMetrics.default)(type);
|
|
67
73
|
ssrSuccess = (0, _getSsrSuccess.default)(type); // Calculate BM3 metrics (TTI and FMP) directly
|
|
@@ -74,14 +80,14 @@ function _createRootCriticalMetricsPayload() {
|
|
|
74
80
|
}); // Use provided vcMetrics or calculate if not provided
|
|
75
81
|
_context.t0 = vcMetrics;
|
|
76
82
|
if (_context.t0) {
|
|
77
|
-
_context.next =
|
|
83
|
+
_context.next = 25;
|
|
78
84
|
break;
|
|
79
85
|
}
|
|
80
|
-
_context.next =
|
|
86
|
+
_context.next = 24;
|
|
81
87
|
return (0, _getVcMetrics.default)(interaction);
|
|
82
|
-
case
|
|
88
|
+
case 24:
|
|
83
89
|
_context.t0 = _context.sent;
|
|
84
|
-
case
|
|
90
|
+
case 25:
|
|
85
91
|
finalVCMetrics = _context.t0;
|
|
86
92
|
ttvc = (_finalVCMetrics$ufoV = finalVCMetrics['ufo:vc:rev']) === null || _finalVCMetrics$ufoV === void 0 ? void 0 : _finalVCMetrics$ufoV.map(function (revision) {
|
|
87
93
|
if (revision['metric:vc90'] === null || revision.clean !== true) {
|
|
@@ -170,7 +176,7 @@ function _createRootCriticalMetricsPayload() {
|
|
|
170
176
|
}
|
|
171
177
|
};
|
|
172
178
|
return _context.abrupt("return", payload);
|
|
173
|
-
case
|
|
179
|
+
case 32:
|
|
174
180
|
case "end":
|
|
175
181
|
return _context.stop();
|
|
176
182
|
}
|
package/dist/cjs/create-payload/critical-metrics-payload/segment-metrics/create-segment-metrics.js
CHANGED
|
@@ -26,7 +26,7 @@ function createSegmentMetricsPayloads(_x, _x2) {
|
|
|
26
26
|
function _createSegmentMetricsPayloads() {
|
|
27
27
|
_createSegmentMetricsPayloads = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interactionId, interaction) {
|
|
28
28
|
var _interaction$cohortin;
|
|
29
|
-
var config, browserMetadata, cohortingCustomData, pageVisibilityAtTTAI, knownSegments, reactProfilerTimings, rate, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, segmentsByName, _iterator, _step, _loop, _ret, payloads, _iterator2, _step2, _loop2;
|
|
29
|
+
var config, browserMetadata, cohortingCustomData, pageVisibilityAtTTAI, knownSegments, reactProfilerTimings, rate, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, segmentsByName, _iterator, _step, _loop, _ret, payloads, _iterator2, _step2, _loop2, _ret2;
|
|
30
30
|
return _regenerator.default.wrap(function _callee$(_context3) {
|
|
31
31
|
while (1) switch (_context3.prev = _context3.next) {
|
|
32
32
|
case 0:
|
|
@@ -148,13 +148,19 @@ function _createSegmentMetricsPayloads() {
|
|
|
148
148
|
_context2.next = 8;
|
|
149
149
|
break;
|
|
150
150
|
}
|
|
151
|
-
return _context2.abrupt("return",
|
|
151
|
+
return _context2.abrupt("return", 0);
|
|
152
152
|
case 8:
|
|
153
153
|
lastTiming = segmentProfilerTimings[segmentProfilerTimings.length - 1];
|
|
154
154
|
startTime = isRootSegment ? interaction.start : firstMountTiming.startTime;
|
|
155
155
|
endTime = lastTiming.commitTime;
|
|
156
156
|
ttai = Math.round(endTime - startTime);
|
|
157
157
|
_getSegmentStatus = (0, _getSegmentStatus2.default)(interaction, segment), status = _getSegmentStatus.status, segmentAbortReason = _getSegmentStatus.abortReason;
|
|
158
|
+
if (!(status !== 'SUCCEEDED')) {
|
|
159
|
+
_context2.next = 15;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
return _context2.abrupt("return", 0);
|
|
163
|
+
case 15:
|
|
158
164
|
properties = _objectSpread({
|
|
159
165
|
// Basic metadata
|
|
160
166
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
@@ -206,7 +212,7 @@ function _createSegmentMetricsPayloads() {
|
|
|
206
212
|
}
|
|
207
213
|
};
|
|
208
214
|
payloads.push(payload);
|
|
209
|
-
case
|
|
215
|
+
case 18:
|
|
210
216
|
case "end":
|
|
211
217
|
return _context2.stop();
|
|
212
218
|
}
|
|
@@ -215,37 +221,38 @@ function _createSegmentMetricsPayloads() {
|
|
|
215
221
|
_iterator2.s();
|
|
216
222
|
case 32:
|
|
217
223
|
if ((_step2 = _iterator2.n()).done) {
|
|
218
|
-
_context3.next =
|
|
224
|
+
_context3.next = 39;
|
|
219
225
|
break;
|
|
220
226
|
}
|
|
221
227
|
return _context3.delegateYield(_loop2(), "t2", 34);
|
|
222
228
|
case 34:
|
|
223
|
-
|
|
224
|
-
|
|
229
|
+
_ret2 = _context3.t2;
|
|
230
|
+
if (!(_ret2 === 0)) {
|
|
231
|
+
_context3.next = 37;
|
|
225
232
|
break;
|
|
226
233
|
}
|
|
227
|
-
return _context3.abrupt("continue",
|
|
228
|
-
case
|
|
234
|
+
return _context3.abrupt("continue", 37);
|
|
235
|
+
case 37:
|
|
229
236
|
_context3.next = 32;
|
|
230
237
|
break;
|
|
231
|
-
case
|
|
232
|
-
_context3.next =
|
|
238
|
+
case 39:
|
|
239
|
+
_context3.next = 44;
|
|
233
240
|
break;
|
|
234
|
-
case
|
|
235
|
-
_context3.prev =
|
|
241
|
+
case 41:
|
|
242
|
+
_context3.prev = 41;
|
|
236
243
|
_context3.t3 = _context3["catch"](29);
|
|
237
244
|
_iterator2.e(_context3.t3);
|
|
238
|
-
case
|
|
239
|
-
_context3.prev =
|
|
245
|
+
case 44:
|
|
246
|
+
_context3.prev = 44;
|
|
240
247
|
_iterator2.f();
|
|
241
|
-
return _context3.finish(
|
|
242
|
-
case 46:
|
|
243
|
-
return _context3.abrupt("return", payloads);
|
|
248
|
+
return _context3.finish(44);
|
|
244
249
|
case 47:
|
|
250
|
+
return _context3.abrupt("return", payloads);
|
|
251
|
+
case 48:
|
|
245
252
|
case "end":
|
|
246
253
|
return _context3.stop();
|
|
247
254
|
}
|
|
248
|
-
}, _callee, null, [[9, 21, 24, 27], [29,
|
|
255
|
+
}, _callee, null, [[9, 21, 24, 27], [29, 41, 44, 47]]);
|
|
249
256
|
}));
|
|
250
257
|
return _createSegmentMetricsPayloads.apply(this, arguments);
|
|
251
258
|
}
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var _coinflip = _interopRequireDefault(require("../coinflip"));
|
|
12
11
|
var _config = require("../config");
|
|
13
12
|
var _utils = require("../create-payload/common/utils");
|
|
@@ -115,7 +114,7 @@ function transformReactProfilerTimings(reactProfilerTimings) {
|
|
|
115
114
|
return (0, _toConsumableArray2.default)(reactProfilerTimingsMap.values());
|
|
116
115
|
}
|
|
117
116
|
function createPostInteractionLogPayload(_ref2) {
|
|
118
|
-
var _window$location;
|
|
117
|
+
var _getMostRecentVCRevis, _window$location;
|
|
119
118
|
var lastInteractionFinish = _ref2.lastInteractionFinish,
|
|
120
119
|
reactProfilerTimings = _ref2.reactProfilerTimings,
|
|
121
120
|
lastInteractionFinishVCResult = _ref2.lastInteractionFinishVCResult,
|
|
@@ -154,7 +153,7 @@ function createPostInteractionLogPayload(_ref2) {
|
|
|
154
153
|
var lastInteractionFinishStart = Math.round(lastInteractionFinish.start);
|
|
155
154
|
var lastInteractionFinishEnd = Math.round(lastInteractionFinish.end);
|
|
156
155
|
var lastInteractionFinishTTAI = Math.round(lastInteractionFinish.end - lastInteractionFinish.start);
|
|
157
|
-
var mostRecentVCRevision = (
|
|
156
|
+
var mostRecentVCRevision = (_getMostRecentVCRevis = (0, _config.getMostRecentVCRevision)(lastInteractionFinish.ufoName)) !== null && _getMostRecentVCRevis !== void 0 ? _getMostRecentVCRevis : _config.DEFAULT_TTVC_REVISION;
|
|
158
157
|
var lastInteractionFinishVC90 = null;
|
|
159
158
|
var lastInteractionFinishVCClean = false;
|
|
160
159
|
var lastInteractionFinishVCRev = lastInteractionFinishVCResult === null || lastInteractionFinishVCResult === void 0 ? void 0 : lastInteractionFinishVCResult['ufo:vc:rev'];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { createRootCriticalMetricsPayload } from './root-metrics';
|
|
2
3
|
import { createSegmentMetricsPayloads } from './segment-metrics/create-segment-metrics';
|
|
3
4
|
export async function createCriticalMetricsPayloads(interactionId, interaction, vcMetrics) {
|
|
4
|
-
const [rootPayload, segmentPayloads] = await Promise.all([createRootCriticalMetricsPayload(interactionId, interaction, vcMetrics), createSegmentMetricsPayloads(interactionId, interaction)]);
|
|
5
|
-
return [rootPayload, ...segmentPayloads];
|
|
5
|
+
const [rootPayload, segmentPayloads] = await Promise.all([createRootCriticalMetricsPayload(interactionId, interaction, vcMetrics), fg('platform_ufo_segment_critical_metrics') ? createSegmentMetricsPayloads(interactionId, interaction) : []]);
|
|
6
|
+
return [rootPayload, ...segmentPayloads].filter(v => v != null);
|
|
6
7
|
}
|
|
@@ -50,6 +50,10 @@ export async function createRootCriticalMetricsPayload(interactionId, interactio
|
|
|
50
50
|
const pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
51
51
|
const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
52
52
|
const interactionStatus = getInteractionStatus(interaction);
|
|
53
|
+
if (interactionStatus.originalInteractionStatus !== 'SUCCEEDED') {
|
|
54
|
+
// To reduce payload sent from the client, we don't send critical perf metrics for non-success interactions
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
53
57
|
const newUFOName = sanitizeUfoName(ufoName);
|
|
54
58
|
|
|
55
59
|
// Get performance metrics
|
|
@@ -97,6 +97,10 @@ export async function createSegmentMetricsPayloads(interactionId, interaction) {
|
|
|
97
97
|
status,
|
|
98
98
|
abortReason: segmentAbortReason
|
|
99
99
|
} = getSegmentStatus(interaction, segment);
|
|
100
|
+
if (status !== 'SUCCEEDED') {
|
|
101
|
+
// To reduce payload sent from the client, we don't send critical perf metrics for non-success interactions
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
100
104
|
const properties = {
|
|
101
105
|
// Basic metadata
|
|
102
106
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import coinflip from '../coinflip';
|
|
3
2
|
import { DEFAULT_TTVC_REVISION, getConfig, getMostRecentVCRevision, getPostInteractionRate } from '../config';
|
|
4
3
|
import { isSegmentLabel, sanitizeUfoName } from '../create-payload/common/utils';
|
|
@@ -106,7 +105,7 @@ function createPostInteractionLogPayload({
|
|
|
106
105
|
lastInteractionFinishVCResult,
|
|
107
106
|
postInteractionFinishVCResult
|
|
108
107
|
}) {
|
|
109
|
-
var _window$location;
|
|
108
|
+
var _getMostRecentVCRevis, _window$location;
|
|
110
109
|
const config = getConfig();
|
|
111
110
|
if (!config) {
|
|
112
111
|
throw Error('UFO Configuration not provided');
|
|
@@ -139,7 +138,7 @@ function createPostInteractionLogPayload({
|
|
|
139
138
|
const lastInteractionFinishStart = Math.round(lastInteractionFinish.start);
|
|
140
139
|
const lastInteractionFinishEnd = Math.round(lastInteractionFinish.end);
|
|
141
140
|
const lastInteractionFinishTTAI = Math.round(lastInteractionFinish.end - lastInteractionFinish.start);
|
|
142
|
-
const mostRecentVCRevision =
|
|
141
|
+
const mostRecentVCRevision = (_getMostRecentVCRevis = getMostRecentVCRevision(lastInteractionFinish.ufoName)) !== null && _getMostRecentVCRevis !== void 0 ? _getMostRecentVCRevis : DEFAULT_TTVC_REVISION;
|
|
143
142
|
let lastInteractionFinishVC90 = null;
|
|
144
143
|
let lastInteractionFinishVCClean = false;
|
|
145
144
|
const lastInteractionFinishVCRev = lastInteractionFinishVCResult === null || lastInteractionFinishVCResult === void 0 ? void 0 : lastInteractionFinishVCResult['ufo:vc:rev'];
|
|
@@ -2,6 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { createRootCriticalMetricsPayload } from './root-metrics';
|
|
6
7
|
import { createSegmentMetricsPayloads } from './segment-metrics/create-segment-metrics';
|
|
7
8
|
export function createCriticalMetricsPayloads(_x, _x2, _x3) {
|
|
@@ -14,13 +15,15 @@ function _createCriticalMetricsPayloads() {
|
|
|
14
15
|
while (1) switch (_context.prev = _context.next) {
|
|
15
16
|
case 0:
|
|
16
17
|
_context.next = 2;
|
|
17
|
-
return Promise.all([createRootCriticalMetricsPayload(interactionId, interaction, vcMetrics), createSegmentMetricsPayloads(interactionId, interaction)]);
|
|
18
|
+
return Promise.all([createRootCriticalMetricsPayload(interactionId, interaction, vcMetrics), fg('platform_ufo_segment_critical_metrics') ? createSegmentMetricsPayloads(interactionId, interaction) : []]);
|
|
18
19
|
case 2:
|
|
19
20
|
_yield$Promise$all = _context.sent;
|
|
20
21
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
21
22
|
rootPayload = _yield$Promise$all2[0];
|
|
22
23
|
segmentPayloads = _yield$Promise$all2[1];
|
|
23
|
-
return _context.abrupt("return", [rootPayload].concat(_toConsumableArray(segmentPayloads)))
|
|
24
|
+
return _context.abrupt("return", [rootPayload].concat(_toConsumableArray(segmentPayloads)).filter(function (v) {
|
|
25
|
+
return v != null;
|
|
26
|
+
}));
|
|
24
27
|
case 7:
|
|
25
28
|
case "end":
|
|
26
29
|
return _context.stop();
|
|
@@ -51,11 +51,17 @@ function _createRootCriticalMetricsPayload() {
|
|
|
51
51
|
pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
52
52
|
pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
53
53
|
interactionStatus = getInteractionStatus(interaction);
|
|
54
|
+
if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED')) {
|
|
55
|
+
_context.next = 9;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
return _context.abrupt("return", null);
|
|
59
|
+
case 9:
|
|
54
60
|
newUFOName = sanitizeUfoName(ufoName); // Get performance metrics
|
|
55
61
|
ttai = getTTAI(interaction);
|
|
56
|
-
_context.next =
|
|
62
|
+
_context.next = 13;
|
|
57
63
|
return getPaintMetrics(type, end);
|
|
58
|
-
case
|
|
64
|
+
case 13:
|
|
59
65
|
paintMetrics = _context.sent;
|
|
60
66
|
navigationMetrics = getNavigationMetrics(type);
|
|
61
67
|
ssrSuccess = getSSRSuccess(type); // Calculate BM3 metrics (TTI and FMP) directly
|
|
@@ -68,14 +74,14 @@ function _createRootCriticalMetricsPayload() {
|
|
|
68
74
|
}); // Use provided vcMetrics or calculate if not provided
|
|
69
75
|
_context.t0 = vcMetrics;
|
|
70
76
|
if (_context.t0) {
|
|
71
|
-
_context.next =
|
|
77
|
+
_context.next = 25;
|
|
72
78
|
break;
|
|
73
79
|
}
|
|
74
|
-
_context.next =
|
|
80
|
+
_context.next = 24;
|
|
75
81
|
return getVCMetrics(interaction);
|
|
76
|
-
case
|
|
82
|
+
case 24:
|
|
77
83
|
_context.t0 = _context.sent;
|
|
78
|
-
case
|
|
84
|
+
case 25:
|
|
79
85
|
finalVCMetrics = _context.t0;
|
|
80
86
|
ttvc = (_finalVCMetrics$ufoV = finalVCMetrics['ufo:vc:rev']) === null || _finalVCMetrics$ufoV === void 0 ? void 0 : _finalVCMetrics$ufoV.map(function (revision) {
|
|
81
87
|
if (revision['metric:vc90'] === null || revision.clean !== true) {
|
|
@@ -164,7 +170,7 @@ function _createRootCriticalMetricsPayload() {
|
|
|
164
170
|
}
|
|
165
171
|
};
|
|
166
172
|
return _context.abrupt("return", payload);
|
|
167
|
-
case
|
|
173
|
+
case 32:
|
|
168
174
|
case "end":
|
|
169
175
|
return _context.stop();
|
|
170
176
|
}
|
package/dist/esm/create-payload/critical-metrics-payload/segment-metrics/create-segment-metrics.js
CHANGED
|
@@ -19,7 +19,7 @@ export function createSegmentMetricsPayloads(_x, _x2) {
|
|
|
19
19
|
function _createSegmentMetricsPayloads() {
|
|
20
20
|
_createSegmentMetricsPayloads = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interactionId, interaction) {
|
|
21
21
|
var _interaction$cohortin;
|
|
22
|
-
var config, browserMetadata, cohortingCustomData, pageVisibilityAtTTAI, knownSegments, reactProfilerTimings, rate, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, segmentsByName, _iterator, _step, _loop, _ret, payloads, _iterator2, _step2, _loop2;
|
|
22
|
+
var config, browserMetadata, cohortingCustomData, pageVisibilityAtTTAI, knownSegments, reactProfilerTimings, rate, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, segmentsByName, _iterator, _step, _loop, _ret, payloads, _iterator2, _step2, _loop2, _ret2;
|
|
23
23
|
return _regeneratorRuntime.wrap(function _callee$(_context3) {
|
|
24
24
|
while (1) switch (_context3.prev = _context3.next) {
|
|
25
25
|
case 0:
|
|
@@ -141,13 +141,19 @@ function _createSegmentMetricsPayloads() {
|
|
|
141
141
|
_context2.next = 8;
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
|
-
return _context2.abrupt("return",
|
|
144
|
+
return _context2.abrupt("return", 0);
|
|
145
145
|
case 8:
|
|
146
146
|
lastTiming = segmentProfilerTimings[segmentProfilerTimings.length - 1];
|
|
147
147
|
startTime = isRootSegment ? interaction.start : firstMountTiming.startTime;
|
|
148
148
|
endTime = lastTiming.commitTime;
|
|
149
149
|
ttai = Math.round(endTime - startTime);
|
|
150
150
|
_getSegmentStatus = getSegmentStatus(interaction, segment), status = _getSegmentStatus.status, segmentAbortReason = _getSegmentStatus.abortReason;
|
|
151
|
+
if (!(status !== 'SUCCEEDED')) {
|
|
152
|
+
_context2.next = 15;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
return _context2.abrupt("return", 0);
|
|
156
|
+
case 15:
|
|
151
157
|
properties = _objectSpread({
|
|
152
158
|
// Basic metadata
|
|
153
159
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
@@ -199,7 +205,7 @@ function _createSegmentMetricsPayloads() {
|
|
|
199
205
|
}
|
|
200
206
|
};
|
|
201
207
|
payloads.push(payload);
|
|
202
|
-
case
|
|
208
|
+
case 18:
|
|
203
209
|
case "end":
|
|
204
210
|
return _context2.stop();
|
|
205
211
|
}
|
|
@@ -208,37 +214,38 @@ function _createSegmentMetricsPayloads() {
|
|
|
208
214
|
_iterator2.s();
|
|
209
215
|
case 32:
|
|
210
216
|
if ((_step2 = _iterator2.n()).done) {
|
|
211
|
-
_context3.next =
|
|
217
|
+
_context3.next = 39;
|
|
212
218
|
break;
|
|
213
219
|
}
|
|
214
220
|
return _context3.delegateYield(_loop2(), "t2", 34);
|
|
215
221
|
case 34:
|
|
216
|
-
|
|
217
|
-
|
|
222
|
+
_ret2 = _context3.t2;
|
|
223
|
+
if (!(_ret2 === 0)) {
|
|
224
|
+
_context3.next = 37;
|
|
218
225
|
break;
|
|
219
226
|
}
|
|
220
|
-
return _context3.abrupt("continue",
|
|
221
|
-
case
|
|
227
|
+
return _context3.abrupt("continue", 37);
|
|
228
|
+
case 37:
|
|
222
229
|
_context3.next = 32;
|
|
223
230
|
break;
|
|
224
|
-
case
|
|
225
|
-
_context3.next =
|
|
231
|
+
case 39:
|
|
232
|
+
_context3.next = 44;
|
|
226
233
|
break;
|
|
227
|
-
case
|
|
228
|
-
_context3.prev =
|
|
234
|
+
case 41:
|
|
235
|
+
_context3.prev = 41;
|
|
229
236
|
_context3.t3 = _context3["catch"](29);
|
|
230
237
|
_iterator2.e(_context3.t3);
|
|
231
|
-
case
|
|
232
|
-
_context3.prev =
|
|
238
|
+
case 44:
|
|
239
|
+
_context3.prev = 44;
|
|
233
240
|
_iterator2.f();
|
|
234
|
-
return _context3.finish(
|
|
235
|
-
case 46:
|
|
236
|
-
return _context3.abrupt("return", payloads);
|
|
241
|
+
return _context3.finish(44);
|
|
237
242
|
case 47:
|
|
243
|
+
return _context3.abrupt("return", payloads);
|
|
244
|
+
case 48:
|
|
238
245
|
case "end":
|
|
239
246
|
return _context3.stop();
|
|
240
247
|
}
|
|
241
|
-
}, _callee, null, [[9, 21, 24, 27], [29,
|
|
248
|
+
}, _callee, null, [[9, 21, 24, 27], [29, 41, 44, 47]]);
|
|
242
249
|
}));
|
|
243
250
|
return _createSegmentMetricsPayloads.apply(this, arguments);
|
|
244
251
|
}
|
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import coinflip from '../coinflip';
|
|
7
6
|
import { DEFAULT_TTVC_REVISION, getConfig, getMostRecentVCRevision, getPostInteractionRate } from '../config';
|
|
8
7
|
import { isSegmentLabel, sanitizeUfoName } from '../create-payload/common/utils';
|
|
@@ -108,7 +107,7 @@ function transformReactProfilerTimings(reactProfilerTimings) {
|
|
|
108
107
|
return _toConsumableArray(reactProfilerTimingsMap.values());
|
|
109
108
|
}
|
|
110
109
|
function createPostInteractionLogPayload(_ref2) {
|
|
111
|
-
var _window$location;
|
|
110
|
+
var _getMostRecentVCRevis, _window$location;
|
|
112
111
|
var lastInteractionFinish = _ref2.lastInteractionFinish,
|
|
113
112
|
reactProfilerTimings = _ref2.reactProfilerTimings,
|
|
114
113
|
lastInteractionFinishVCResult = _ref2.lastInteractionFinishVCResult,
|
|
@@ -147,7 +146,7 @@ function createPostInteractionLogPayload(_ref2) {
|
|
|
147
146
|
var lastInteractionFinishStart = Math.round(lastInteractionFinish.start);
|
|
148
147
|
var lastInteractionFinishEnd = Math.round(lastInteractionFinish.end);
|
|
149
148
|
var lastInteractionFinishTTAI = Math.round(lastInteractionFinish.end - lastInteractionFinish.start);
|
|
150
|
-
var mostRecentVCRevision =
|
|
149
|
+
var mostRecentVCRevision = (_getMostRecentVCRevis = getMostRecentVCRevision(lastInteractionFinish.ufoName)) !== null && _getMostRecentVCRevis !== void 0 ? _getMostRecentVCRevis : DEFAULT_TTVC_REVISION;
|
|
151
150
|
var lastInteractionFinishVC90 = null;
|
|
152
151
|
var lastInteractionFinishVCClean = false;
|
|
153
152
|
var lastInteractionFinishVCRev = lastInteractionFinishVCResult === null || lastInteractionFinishVCResult === void 0 ? void 0 : lastInteractionFinishVCResult['ufo:vc:rev'];
|
|
@@ -27,7 +27,7 @@ type SelectorConfig = {
|
|
|
27
27
|
type Rates = {
|
|
28
28
|
readonly [key: string]: number;
|
|
29
29
|
};
|
|
30
|
-
export type
|
|
30
|
+
export type TTVCRevision = 'fy25.01' | 'fy25.02' | 'fy25.03';
|
|
31
31
|
export declare const DEFAULT_TTVC_REVISION = "fy25.03";
|
|
32
32
|
export type Config = {
|
|
33
33
|
readonly enabled?: boolean;
|
|
@@ -92,8 +92,8 @@ export type Config = {
|
|
|
92
92
|
* i.e. every element for all `byExperience` entry configs should exist in the `all` config
|
|
93
93
|
*/
|
|
94
94
|
readonly enabledVCRevisions?: {
|
|
95
|
-
all: readonly
|
|
96
|
-
byExperience?: Record<string, readonly
|
|
95
|
+
all: readonly TTVCRevision[];
|
|
96
|
+
byExperience?: Record<string, readonly TTVCRevision[]>;
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
readonly postInteractionLog?: {
|
|
@@ -118,9 +118,9 @@ export type Config = {
|
|
|
118
118
|
};
|
|
119
119
|
export declare function setUFOConfig(newConfig: Config): void;
|
|
120
120
|
export declare function getConfig(): Config | undefined;
|
|
121
|
-
export declare function getEnabledVCRevisions(experienceKey?: string): readonly
|
|
122
|
-
export declare function isVCRevisionEnabled(revision:
|
|
123
|
-
export declare function getMostRecentVCRevision(experienceKey?: string):
|
|
121
|
+
export declare function getEnabledVCRevisions(experienceKey?: string): readonly TTVCRevision[];
|
|
122
|
+
export declare function isVCRevisionEnabled(revision: TTVCRevision, experienceKey?: string): boolean;
|
|
123
|
+
export declare function getMostRecentVCRevision(experienceKey?: string): TTVCRevision;
|
|
124
124
|
export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
|
|
125
125
|
export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
|
|
126
126
|
export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
|
|
@@ -4,4 +4,4 @@ import type { CriticalMetricsPayload } from './types';
|
|
|
4
4
|
export type { CriticalMetricsPayload, CriticalMetricsPayloadProperties } from './types';
|
|
5
5
|
export declare function createRootCriticalMetricsPayload(interactionId: string, interaction: InteractionMetrics, vcMetrics?: VCResult & {
|
|
6
6
|
'metric:vc90'?: number | null;
|
|
7
|
-
}): Promise<CriticalMetricsPayload>;
|
|
7
|
+
}): Promise<CriticalMetricsPayload | null>;
|
|
@@ -27,7 +27,7 @@ type SelectorConfig = {
|
|
|
27
27
|
type Rates = {
|
|
28
28
|
readonly [key: string]: number;
|
|
29
29
|
};
|
|
30
|
-
export type
|
|
30
|
+
export type TTVCRevision = 'fy25.01' | 'fy25.02' | 'fy25.03';
|
|
31
31
|
export declare const DEFAULT_TTVC_REVISION = "fy25.03";
|
|
32
32
|
export type Config = {
|
|
33
33
|
readonly enabled?: boolean;
|
|
@@ -92,8 +92,8 @@ export type Config = {
|
|
|
92
92
|
* i.e. every element for all `byExperience` entry configs should exist in the `all` config
|
|
93
93
|
*/
|
|
94
94
|
readonly enabledVCRevisions?: {
|
|
95
|
-
all: readonly
|
|
96
|
-
byExperience?: Record<string, readonly
|
|
95
|
+
all: readonly TTVCRevision[];
|
|
96
|
+
byExperience?: Record<string, readonly TTVCRevision[]>;
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
readonly postInteractionLog?: {
|
|
@@ -118,9 +118,9 @@ export type Config = {
|
|
|
118
118
|
};
|
|
119
119
|
export declare function setUFOConfig(newConfig: Config): void;
|
|
120
120
|
export declare function getConfig(): Config | undefined;
|
|
121
|
-
export declare function getEnabledVCRevisions(experienceKey?: string): readonly
|
|
122
|
-
export declare function isVCRevisionEnabled(revision:
|
|
123
|
-
export declare function getMostRecentVCRevision(experienceKey?: string):
|
|
121
|
+
export declare function getEnabledVCRevisions(experienceKey?: string): readonly TTVCRevision[];
|
|
122
|
+
export declare function isVCRevisionEnabled(revision: TTVCRevision, experienceKey?: string): boolean;
|
|
123
|
+
export declare function getMostRecentVCRevision(experienceKey?: string): TTVCRevision;
|
|
124
124
|
export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
|
|
125
125
|
export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
|
|
126
126
|
export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
|
|
@@ -4,4 +4,4 @@ import type { CriticalMetricsPayload } from './types';
|
|
|
4
4
|
export type { CriticalMetricsPayload, CriticalMetricsPayloadProperties } from './types';
|
|
5
5
|
export declare function createRootCriticalMetricsPayload(interactionId: string, interaction: InteractionMetrics, vcMetrics?: VCResult & {
|
|
6
6
|
'metric:vc90'?: number | null;
|
|
7
|
-
}): Promise<CriticalMetricsPayload>;
|
|
7
|
+
}): Promise<CriticalMetricsPayload | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -182,9 +182,6 @@
|
|
|
182
182
|
"platform_ufo_enable_interactivity_jsm": {
|
|
183
183
|
"type": "boolean"
|
|
184
184
|
},
|
|
185
|
-
"platform_ufo_post_interaction_most_recent_vc_rev": {
|
|
186
|
-
"type": "boolean"
|
|
187
|
-
},
|
|
188
185
|
"platform_ufo_ignore_extra_attributes": {
|
|
189
186
|
"type": "boolean"
|
|
190
187
|
},
|
|
@@ -217,6 +214,9 @@
|
|
|
217
214
|
},
|
|
218
215
|
"platform_ufo_handle_non_react_element_for_3p": {
|
|
219
216
|
"type": "boolean"
|
|
217
|
+
},
|
|
218
|
+
"platform_ufo_segment_critical_metrics": {
|
|
219
|
+
"type": "boolean"
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|