@atlaskit/react-ufo 5.2.2 → 5.2.4

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 5.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`596fad901c189`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/596fad901c189) -
8
+ Add routeName to ufo terminal error metric & exclude client network errors
9
+ - [`615a53a036cf9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/615a53a036cf9) -
10
+ FG cleanup - platform_ufo_ttvc_v4_speed_index
11
+
12
+ ## 5.2.3
13
+
14
+ ### Patch Changes
15
+
16
+ - [`c7cf6502b98d5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c7cf6502b98d5) -
17
+ FG cleanup - platform_ufo_dedupe_repeated_vc_offenders
18
+
3
19
  ## 5.2.2
4
20
 
5
21
  ### Patch Changes
@@ -11,6 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
  var _react = require("react");
12
12
  var _interactionContext = require("../interaction-context");
13
13
  var _interactionMetrics = require("../interaction-metrics");
14
+ var _routeNameContext = _interopRequireDefault(require("../route-name-context"));
14
15
  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; }
15
16
  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) { (0, _defineProperty2.default)(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; }
16
17
  var sinkHandlerFn = function sinkHandlerFn() {};
@@ -18,7 +19,11 @@ function sinkTerminalErrorHandler(fn) {
18
19
  sinkHandlerFn = fn;
19
20
  }
20
21
  function setTerminalError(error, additionalAttributes, labelStack) {
21
- var _activeInteraction$uf, _activeInteraction$id, _activeInteraction$ty, _PreviousInteractionL, _PreviousInteractionL2, _PreviousInteractionL3;
22
+ var _activeInteraction$uf, _activeInteraction$id, _activeInteraction$ty, _PreviousInteractionL, _PreviousInteractionL2, _PreviousInteractionL3, _UFORouteName$current;
23
+ if (additionalAttributes !== null && additionalAttributes !== void 0 && additionalAttributes.isClientNetworkError) {
24
+ // Exclude client network errors from being reported to UFO
25
+ return;
26
+ }
22
27
  var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
23
28
  var currentTime = performance.now();
24
29
  var errorData = _objectSpread({
@@ -37,7 +42,8 @@ function setTerminalError(error, additionalAttributes, labelStack) {
37
42
  previousInteractionId: (_PreviousInteractionL = _interactionMetrics.PreviousInteractionLog.id) !== null && _PreviousInteractionL !== void 0 ? _PreviousInteractionL : null,
38
43
  previousInteractionName: (_PreviousInteractionL2 = _interactionMetrics.PreviousInteractionLog.name) !== null && _PreviousInteractionL2 !== void 0 ? _PreviousInteractionL2 : null,
39
44
  previousInteractionType: (_PreviousInteractionL3 = _interactionMetrics.PreviousInteractionLog.type) !== null && _PreviousInteractionL3 !== void 0 ? _PreviousInteractionL3 : null,
40
- timeSincePreviousInteraction: timeSincePreviousInteraction
45
+ timeSincePreviousInteraction: timeSincePreviousInteraction,
46
+ routeName: (_UFORouteName$current = _routeNameContext.default.current) !== null && _UFORouteName$current !== void 0 ? _UFORouteName$current : null
41
47
  };
42
48
  sinkHandlerFn(errorData, context);
43
49
  }
@@ -120,14 +120,13 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
120
120
  value: function () {
121
121
  var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio) {
122
122
  var _window, _window2, _window3, _window4, _window6;
123
- var percentiles, viewportEntries, shouldCalculateSpeedIndex, _yield$calculateTTVCP, vcLogs, speedIndex, vcDetails, percentileIndex, entryDataBuffer, ssrRatio, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window5, _window5$__ufo_devtoo, _window7, _window7$__on_ufo_vc_;
123
+ var percentiles, viewportEntries, _yield$calculateTTVCP, vcLogs, speedIndex, vcDetails, percentileIndex, entryDataBuffer, ssrRatio, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window5, _window5$__ufo_devtoo, _window7, _window7$__on_ufo_vc_;
124
124
  return _regenerator.default.wrap(function _callee$(_context) {
125
125
  while (1) switch (_context.prev = _context.next) {
126
126
  case 0:
127
127
  percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99, 100];
128
128
  viewportEntries = this.filterViewportEntries(filteredEntries);
129
- shouldCalculateSpeedIndex = (0, _platformFeatureFlags.fg)('platform_ufo_ttvc_v4_speed_index');
130
- _context.next = 5;
129
+ _context.next = 4;
131
130
  return (0, _percentileCalc.calculateTTVCPercentilesWithDebugInfo)({
132
131
  viewport: {
133
132
  width: (0, _getViewportWidth.default)(),
@@ -135,10 +134,9 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
135
134
  },
136
135
  startTime: startTime,
137
136
  stopTime: stopTime,
138
- orderedEntries: viewportEntries,
139
- calculateSpeedIndex: shouldCalculateSpeedIndex
137
+ orderedEntries: viewportEntries
140
138
  });
141
- case 5:
139
+ case 4:
142
140
  _yield$calculateTTVCP = _context.sent;
143
141
  vcLogs = _yield$calculateTTVCP.entries;
144
142
  speedIndex = _yield$calculateTTVCP.speedIndex;
@@ -147,15 +145,15 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
147
145
  entryDataBuffer = new Set();
148
146
  ssrRatio = -1;
149
147
  if (!vcLogs) {
150
- _context.next = 33;
148
+ _context.next = 32;
151
149
  break;
152
150
  }
153
151
  _iterator4 = _createForOfIteratorHelper(vcLogs);
154
- _context.prev = 14;
152
+ _context.prev = 13;
155
153
  _iterator4.s();
156
- case 16:
154
+ case 15:
157
155
  if ((_step4 = _iterator4.n()).done) {
158
- _context.next = 25;
156
+ _context.next = 24;
159
157
  break;
160
158
  }
161
159
  _entry3 = _step4.value;
@@ -168,25 +166,16 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
168
166
 
169
167
  // Only process entries if we haven't reached all percentiles
170
168
  if (!(percentileIndex >= percentiles.length)) {
171
- _context.next = 22;
169
+ _context.next = 21;
172
170
  break;
173
171
  }
174
- return _context.abrupt("break", 25);
175
- case 22:
172
+ return _context.abrupt("break", 24);
173
+ case 21:
176
174
  // Check if this entry matches any checkpoint percentiles
177
175
  if (viewportPercentage >= percentiles[percentileIndex]) {
178
- elementNames = [];
179
- if ((0, _platformFeatureFlags.fg)('platform_ufo_dedupe_repeated_vc_offenders')) {
180
- elementNames = (0, _toConsumableArray2.default)(new Set(entries.map(function (e) {
181
- return e.elementName;
182
- })));
183
- } else {
184
- elementNames = entries.map(function (e) {
185
- return e.elementName;
186
- });
187
- }
188
-
189
- // Process all matching percentiles in one go
176
+ elementNames = (0, _toConsumableArray2.default)(new Set(entries.map(function (e) {
177
+ return e.elementName;
178
+ }))); // Process all matching percentiles in one go
190
179
  while (percentileIndex < percentiles.length && viewportPercentage >= percentiles[percentileIndex]) {
191
180
  vcDetails["".concat(percentiles[percentileIndex])] = {
192
181
  t: Math.round(time),
@@ -203,21 +192,21 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
203
192
  return entryDataBuffer.add(e);
204
193
  });
205
194
  }
206
- case 23:
207
- _context.next = 16;
195
+ case 22:
196
+ _context.next = 15;
208
197
  break;
209
- case 25:
210
- _context.next = 30;
198
+ case 24:
199
+ _context.next = 29;
211
200
  break;
212
- case 27:
213
- _context.prev = 27;
214
- _context.t0 = _context["catch"](14);
201
+ case 26:
202
+ _context.prev = 26;
203
+ _context.t0 = _context["catch"](13);
215
204
  _iterator4.e(_context.t0);
216
- case 30:
217
- _context.prev = 30;
205
+ case 29:
206
+ _context.prev = 29;
218
207
  _iterator4.f();
219
- return _context.finish(30);
220
- case 33:
208
+ return _context.finish(29);
209
+ case 32:
221
210
  // Fill in any missing percentiles with the last known values
222
211
  previousResult = {
223
212
  t: 0,
@@ -380,11 +369,11 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
380
369
  ssrRatio: ssrRatio,
381
370
  speedIndex: speedIndex
382
371
  });
383
- case 45:
372
+ case 44:
384
373
  case "end":
385
374
  return _context.stop();
386
375
  }
387
- }, _callee, this, [[14, 27, 30, 33]]);
376
+ }, _callee, this, [[13, 26, 29, 32]]);
388
377
  }));
389
378
  function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12) {
390
379
  return _calculateWithDebugInfo.apply(this, arguments);
@@ -439,8 +428,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
439
428
  result.ssrRatio = ssrRatio;
440
429
  }
441
430
 
442
- // speedIndex is only calculated when platform_ufo_ttvc_v4_speed_index is enabled,
443
- // so we only include it in the result when it has a meaningful value (> 0)
431
+ // speedIndex is only included in the result when it has a meaningful value (> 0)
444
432
  if (speedIndex > 0) {
445
433
  result.speedIndex = speedIndex;
446
434
  }
@@ -85,11 +85,11 @@ function calculateTTVCPercentilesWithDebugInfo(_x2) {
85
85
  }
86
86
  function _calculateTTVCPercentilesWithDebugInfo() {
87
87
  _calculateTTVCPercentilesWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref2) {
88
- var viewport, orderedEntries, startTime, _ref2$calculateSpeedI, calculateSpeedIndex, canvas, elementMap, _iterator3, _step3, entry, rect, timePixelCounts, canvasDimensions, totalPixels;
88
+ var viewport, orderedEntries, startTime, canvas, elementMap, _iterator3, _step3, entry, rect, timePixelCounts, canvasDimensions, totalPixels;
89
89
  return _regenerator.default.wrap(function _callee2$(_context2) {
90
90
  while (1) switch (_context2.prev = _context2.next) {
91
91
  case 0:
92
- viewport = _ref2.viewport, orderedEntries = _ref2.orderedEntries, startTime = _ref2.startTime, _ref2$calculateSpeedI = _ref2.calculateSpeedIndex, calculateSpeedIndex = _ref2$calculateSpeedI === void 0 ? false : _ref2$calculateSpeedI;
92
+ viewport = _ref2.viewport, orderedEntries = _ref2.orderedEntries, startTime = _ref2.startTime;
93
93
  canvas = new _canvasPixel.ViewportCanvas(viewport, (0, _platformFeatureFlags.fg)('platform_ufo_canvas_heatmap_full_precision') ? 1 : 0.25);
94
94
  elementMap = new Map();
95
95
  _iterator3 = _createForOfIteratorHelper(orderedEntries);
@@ -134,7 +134,7 @@ function _calculateTTVCPercentilesWithDebugInfo() {
134
134
  timePixelCounts = _context2.sent;
135
135
  canvasDimensions = canvas.getScaledDimensions();
136
136
  totalPixels = canvasDimensions.width * canvasDimensions.height;
137
- return _context2.abrupt("return", calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime, calculateSpeedIndex));
137
+ return _context2.abrupt("return", calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime));
138
138
  case 30:
139
139
  case "end":
140
140
  return _context2.stop();
@@ -209,7 +209,6 @@ function calculatePercentiles(timePixelCounts, elementMap, unorderedPercentiles,
209
209
  return results;
210
210
  }
211
211
  function calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime) {
212
- var calculateSpeedIndex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
213
212
  var entries = new Array(elementMap.size);
214
213
  var cumulativePixels = 0;
215
214
  var speedIndex = 0;
@@ -236,12 +235,9 @@ function calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPix
236
235
  };
237
236
 
238
237
  // Speed index calculation: sum of (time × incremental viewport percentage)
239
- // Only calculate when feature flag is enabled
240
- if (calculateSpeedIndex) {
241
- var ratioDelta = (percentCovered - previousPercentCovered) / 100;
242
- speedIndex += relativeTime * ratioDelta;
243
- previousPercentCovered = percentCovered;
244
- }
238
+ var ratioDelta = (percentCovered - previousPercentCovered) / 100;
239
+ speedIndex += relativeTime * ratioDelta;
240
+ previousPercentCovered = percentCovered;
245
241
  }
246
242
  return {
247
243
  entries: entries,
@@ -1,12 +1,17 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  import { useInteractionContext } from '../interaction-context';
3
3
  import { getActiveInteraction, PreviousInteractionLog } from '../interaction-metrics';
4
+ import UFORouteName from '../route-name-context';
4
5
  let sinkHandlerFn = () => {};
5
6
  export function sinkTerminalErrorHandler(fn) {
6
7
  sinkHandlerFn = fn;
7
8
  }
8
9
  export function setTerminalError(error, additionalAttributes, labelStack) {
9
- var _activeInteraction$uf, _activeInteraction$id, _activeInteraction$ty, _PreviousInteractionL, _PreviousInteractionL2, _PreviousInteractionL3;
10
+ var _activeInteraction$uf, _activeInteraction$id, _activeInteraction$ty, _PreviousInteractionL, _PreviousInteractionL2, _PreviousInteractionL3, _UFORouteName$current;
11
+ if (additionalAttributes !== null && additionalAttributes !== void 0 && additionalAttributes.isClientNetworkError) {
12
+ // Exclude client network errors from being reported to UFO
13
+ return;
14
+ }
10
15
  const activeInteraction = getActiveInteraction();
11
16
  const currentTime = performance.now();
12
17
  const errorData = {
@@ -26,7 +31,8 @@ export function setTerminalError(error, additionalAttributes, labelStack) {
26
31
  previousInteractionId: (_PreviousInteractionL = PreviousInteractionLog.id) !== null && _PreviousInteractionL !== void 0 ? _PreviousInteractionL : null,
27
32
  previousInteractionName: (_PreviousInteractionL2 = PreviousInteractionLog.name) !== null && _PreviousInteractionL2 !== void 0 ? _PreviousInteractionL2 : null,
28
33
  previousInteractionType: (_PreviousInteractionL3 = PreviousInteractionLog.type) !== null && _PreviousInteractionL3 !== void 0 ? _PreviousInteractionL3 : null,
29
- timeSincePreviousInteraction
34
+ timeSincePreviousInteraction,
35
+ routeName: (_UFORouteName$current = UFORouteName.current) !== null && _UFORouteName$current !== void 0 ? _UFORouteName$current : null
30
36
  };
31
37
  sinkHandlerFn(errorData, context);
32
38
  }
@@ -64,7 +64,6 @@ export default class AbstractVCCalculatorBase {
64
64
  var _window, _window2, _window3, _window4, _window6;
65
65
  const percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99, 100];
66
66
  const viewportEntries = this.filterViewportEntries(filteredEntries);
67
- const shouldCalculateSpeedIndex = fg('platform_ufo_ttvc_v4_speed_index');
68
67
  const {
69
68
  entries: vcLogs,
70
69
  speedIndex
@@ -75,8 +74,7 @@ export default class AbstractVCCalculatorBase {
75
74
  },
76
75
  startTime,
77
76
  stopTime,
78
- orderedEntries: viewportEntries,
79
- calculateSpeedIndex: shouldCalculateSpeedIndex
77
+ orderedEntries: viewportEntries
80
78
  });
81
79
  const vcDetails = {};
82
80
  let percentileIndex = 0;
@@ -100,12 +98,7 @@ export default class AbstractVCCalculatorBase {
100
98
 
101
99
  // Check if this entry matches any checkpoint percentiles
102
100
  if (viewportPercentage >= percentiles[percentileIndex]) {
103
- let elementNames = [];
104
- if (fg('platform_ufo_dedupe_repeated_vc_offenders')) {
105
- elementNames = [...new Set(entries.map(e => e.elementName))];
106
- } else {
107
- elementNames = entries.map(e => e.elementName);
108
- }
101
+ const elementNames = [...new Set(entries.map(e => e.elementName))];
109
102
 
110
103
  // Process all matching percentiles in one go
111
104
  while (percentileIndex < percentiles.length && viewportPercentage >= percentiles[percentileIndex]) {
@@ -319,8 +312,7 @@ export default class AbstractVCCalculatorBase {
319
312
  result.ssrRatio = ssrRatio;
320
313
  }
321
314
 
322
- // speedIndex is only calculated when platform_ufo_ttvc_v4_speed_index is enabled,
323
- // so we only include it in the result when it has a meaningful value (> 0)
315
+ // speedIndex is only included in the result when it has a meaningful value (> 0)
324
316
  if (speedIndex > 0) {
325
317
  result.speedIndex = speedIndex;
326
318
  }
@@ -30,8 +30,7 @@ async function calculateTTVCPercentiles({
30
30
  async function calculateTTVCPercentilesWithDebugInfo({
31
31
  viewport,
32
32
  orderedEntries,
33
- startTime,
34
- calculateSpeedIndex = false
33
+ startTime
35
34
  }) {
36
35
  const canvas = new ViewportCanvas(viewport, fg('platform_ufo_canvas_heatmap_full_precision') ? 1 : 0.25);
37
36
  const elementMap = new Map();
@@ -51,7 +50,7 @@ async function calculateTTVCPercentilesWithDebugInfo({
51
50
  const timePixelCounts = await canvas.getPixelCounts();
52
51
  const canvasDimensions = canvas.getScaledDimensions();
53
52
  const totalPixels = canvasDimensions.width * canvasDimensions.height;
54
- return calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime, calculateSpeedIndex);
53
+ return calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime);
55
54
  }
56
55
  export default calculateTTVCPercentiles;
57
56
  export function calculatePercentiles(timePixelCounts, elementMap, unorderedPercentiles, totalPixels, startTime) {
@@ -97,7 +96,7 @@ export function calculatePercentiles(timePixelCounts, elementMap, unorderedPerce
97
96
  }
98
97
  return results;
99
98
  }
100
- export function calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime, calculateSpeedIndex = false) {
99
+ export function calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime) {
101
100
  const entries = new Array(elementMap.size);
102
101
  let cumulativePixels = 0;
103
102
  let speedIndex = 0;
@@ -116,12 +115,9 @@ export function calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, t
116
115
  };
117
116
 
118
117
  // Speed index calculation: sum of (time × incremental viewport percentage)
119
- // Only calculate when feature flag is enabled
120
- if (calculateSpeedIndex) {
121
- const ratioDelta = (percentCovered - previousPercentCovered) / 100;
122
- speedIndex += relativeTime * ratioDelta;
123
- previousPercentCovered = percentCovered;
124
- }
118
+ const ratioDelta = (percentCovered - previousPercentCovered) / 100;
119
+ speedIndex += relativeTime * ratioDelta;
120
+ previousPercentCovered = percentCovered;
125
121
  }
126
122
  return {
127
123
  entries,
@@ -4,12 +4,17 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { useEffect, useRef } from 'react';
5
5
  import { useInteractionContext } from '../interaction-context';
6
6
  import { getActiveInteraction, PreviousInteractionLog } from '../interaction-metrics';
7
+ import UFORouteName from '../route-name-context';
7
8
  var sinkHandlerFn = function sinkHandlerFn() {};
8
9
  export function sinkTerminalErrorHandler(fn) {
9
10
  sinkHandlerFn = fn;
10
11
  }
11
12
  export function setTerminalError(error, additionalAttributes, labelStack) {
12
- var _activeInteraction$uf, _activeInteraction$id, _activeInteraction$ty, _PreviousInteractionL, _PreviousInteractionL2, _PreviousInteractionL3;
13
+ var _activeInteraction$uf, _activeInteraction$id, _activeInteraction$ty, _PreviousInteractionL, _PreviousInteractionL2, _PreviousInteractionL3, _UFORouteName$current;
14
+ if (additionalAttributes !== null && additionalAttributes !== void 0 && additionalAttributes.isClientNetworkError) {
15
+ // Exclude client network errors from being reported to UFO
16
+ return;
17
+ }
13
18
  var activeInteraction = getActiveInteraction();
14
19
  var currentTime = performance.now();
15
20
  var errorData = _objectSpread({
@@ -28,7 +33,8 @@ export function setTerminalError(error, additionalAttributes, labelStack) {
28
33
  previousInteractionId: (_PreviousInteractionL = PreviousInteractionLog.id) !== null && _PreviousInteractionL !== void 0 ? _PreviousInteractionL : null,
29
34
  previousInteractionName: (_PreviousInteractionL2 = PreviousInteractionLog.name) !== null && _PreviousInteractionL2 !== void 0 ? _PreviousInteractionL2 : null,
30
35
  previousInteractionType: (_PreviousInteractionL3 = PreviousInteractionLog.type) !== null && _PreviousInteractionL3 !== void 0 ? _PreviousInteractionL3 : null,
31
- timeSincePreviousInteraction: timeSincePreviousInteraction
36
+ timeSincePreviousInteraction: timeSincePreviousInteraction,
37
+ routeName: (_UFORouteName$current = UFORouteName.current) !== null && _UFORouteName$current !== void 0 ? _UFORouteName$current : null
32
38
  };
33
39
  sinkHandlerFn(errorData, context);
34
40
  }
@@ -114,14 +114,13 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
114
114
  value: function () {
115
115
  var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionType, isPageVisible, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch, interactionAbortReason, includeSSRRatio) {
116
116
  var _window, _window2, _window3, _window4, _window6;
117
- var percentiles, viewportEntries, shouldCalculateSpeedIndex, _yield$calculateTTVCP, vcLogs, speedIndex, vcDetails, percentileIndex, entryDataBuffer, ssrRatio, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window5, _window5$__ufo_devtoo, _window7, _window7$__on_ufo_vc_;
117
+ var percentiles, viewportEntries, _yield$calculateTTVCP, vcLogs, speedIndex, vcDetails, percentileIndex, entryDataBuffer, ssrRatio, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator5, _step5, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator6, _step6, _entry4, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator7, _step7, _step7$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window5, _window5$__ufo_devtoo, _window7, _window7$__on_ufo_vc_;
118
118
  return _regeneratorRuntime.wrap(function _callee$(_context) {
119
119
  while (1) switch (_context.prev = _context.next) {
120
120
  case 0:
121
121
  percentiles = [25, 50, 75, 80, 85, 90, 95, 98, 99, 100];
122
122
  viewportEntries = this.filterViewportEntries(filteredEntries);
123
- shouldCalculateSpeedIndex = fg('platform_ufo_ttvc_v4_speed_index');
124
- _context.next = 5;
123
+ _context.next = 4;
125
124
  return calculateTTVCPercentilesWithDebugInfo({
126
125
  viewport: {
127
126
  width: getViewportWidth(),
@@ -129,10 +128,9 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
129
128
  },
130
129
  startTime: startTime,
131
130
  stopTime: stopTime,
132
- orderedEntries: viewportEntries,
133
- calculateSpeedIndex: shouldCalculateSpeedIndex
131
+ orderedEntries: viewportEntries
134
132
  });
135
- case 5:
133
+ case 4:
136
134
  _yield$calculateTTVCP = _context.sent;
137
135
  vcLogs = _yield$calculateTTVCP.entries;
138
136
  speedIndex = _yield$calculateTTVCP.speedIndex;
@@ -141,15 +139,15 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
141
139
  entryDataBuffer = new Set();
142
140
  ssrRatio = -1;
143
141
  if (!vcLogs) {
144
- _context.next = 33;
142
+ _context.next = 32;
145
143
  break;
146
144
  }
147
145
  _iterator4 = _createForOfIteratorHelper(vcLogs);
148
- _context.prev = 14;
146
+ _context.prev = 13;
149
147
  _iterator4.s();
150
- case 16:
148
+ case 15:
151
149
  if ((_step4 = _iterator4.n()).done) {
152
- _context.next = 25;
150
+ _context.next = 24;
153
151
  break;
154
152
  }
155
153
  _entry3 = _step4.value;
@@ -162,25 +160,16 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
162
160
 
163
161
  // Only process entries if we haven't reached all percentiles
164
162
  if (!(percentileIndex >= percentiles.length)) {
165
- _context.next = 22;
163
+ _context.next = 21;
166
164
  break;
167
165
  }
168
- return _context.abrupt("break", 25);
169
- case 22:
166
+ return _context.abrupt("break", 24);
167
+ case 21:
170
168
  // Check if this entry matches any checkpoint percentiles
171
169
  if (viewportPercentage >= percentiles[percentileIndex]) {
172
- elementNames = [];
173
- if (fg('platform_ufo_dedupe_repeated_vc_offenders')) {
174
- elementNames = _toConsumableArray(new Set(entries.map(function (e) {
175
- return e.elementName;
176
- })));
177
- } else {
178
- elementNames = entries.map(function (e) {
179
- return e.elementName;
180
- });
181
- }
182
-
183
- // Process all matching percentiles in one go
170
+ elementNames = _toConsumableArray(new Set(entries.map(function (e) {
171
+ return e.elementName;
172
+ }))); // Process all matching percentiles in one go
184
173
  while (percentileIndex < percentiles.length && viewportPercentage >= percentiles[percentileIndex]) {
185
174
  vcDetails["".concat(percentiles[percentileIndex])] = {
186
175
  t: Math.round(time),
@@ -197,21 +186,21 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
197
186
  return entryDataBuffer.add(e);
198
187
  });
199
188
  }
200
- case 23:
201
- _context.next = 16;
189
+ case 22:
190
+ _context.next = 15;
202
191
  break;
203
- case 25:
204
- _context.next = 30;
192
+ case 24:
193
+ _context.next = 29;
205
194
  break;
206
- case 27:
207
- _context.prev = 27;
208
- _context.t0 = _context["catch"](14);
195
+ case 26:
196
+ _context.prev = 26;
197
+ _context.t0 = _context["catch"](13);
209
198
  _iterator4.e(_context.t0);
210
- case 30:
211
- _context.prev = 30;
199
+ case 29:
200
+ _context.prev = 29;
212
201
  _iterator4.f();
213
- return _context.finish(30);
214
- case 33:
202
+ return _context.finish(29);
203
+ case 32:
215
204
  // Fill in any missing percentiles with the last known values
216
205
  previousResult = {
217
206
  t: 0,
@@ -374,11 +363,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
374
363
  ssrRatio: ssrRatio,
375
364
  speedIndex: speedIndex
376
365
  });
377
- case 45:
366
+ case 44:
378
367
  case "end":
379
368
  return _context.stop();
380
369
  }
381
- }, _callee, this, [[14, 27, 30, 33]]);
370
+ }, _callee, this, [[13, 26, 29, 32]]);
382
371
  }));
383
372
  function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12) {
384
373
  return _calculateWithDebugInfo.apply(this, arguments);
@@ -433,8 +422,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
433
422
  result.ssrRatio = ssrRatio;
434
423
  }
435
424
 
436
- // speedIndex is only calculated when platform_ufo_ttvc_v4_speed_index is enabled,
437
- // so we only include it in the result when it has a meaningful value (> 0)
425
+ // speedIndex is only included in the result when it has a meaningful value (> 0)
438
426
  if (speedIndex > 0) {
439
427
  result.speedIndex = speedIndex;
440
428
  }
@@ -75,11 +75,11 @@ function calculateTTVCPercentilesWithDebugInfo(_x2) {
75
75
  }
76
76
  function _calculateTTVCPercentilesWithDebugInfo() {
77
77
  _calculateTTVCPercentilesWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
78
- var viewport, orderedEntries, startTime, _ref2$calculateSpeedI, calculateSpeedIndex, canvas, elementMap, _iterator3, _step3, entry, rect, timePixelCounts, canvasDimensions, totalPixels;
78
+ var viewport, orderedEntries, startTime, canvas, elementMap, _iterator3, _step3, entry, rect, timePixelCounts, canvasDimensions, totalPixels;
79
79
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
80
80
  while (1) switch (_context2.prev = _context2.next) {
81
81
  case 0:
82
- viewport = _ref2.viewport, orderedEntries = _ref2.orderedEntries, startTime = _ref2.startTime, _ref2$calculateSpeedI = _ref2.calculateSpeedIndex, calculateSpeedIndex = _ref2$calculateSpeedI === void 0 ? false : _ref2$calculateSpeedI;
82
+ viewport = _ref2.viewport, orderedEntries = _ref2.orderedEntries, startTime = _ref2.startTime;
83
83
  canvas = new ViewportCanvas(viewport, fg('platform_ufo_canvas_heatmap_full_precision') ? 1 : 0.25);
84
84
  elementMap = new Map();
85
85
  _iterator3 = _createForOfIteratorHelper(orderedEntries);
@@ -124,7 +124,7 @@ function _calculateTTVCPercentilesWithDebugInfo() {
124
124
  timePixelCounts = _context2.sent;
125
125
  canvasDimensions = canvas.getScaledDimensions();
126
126
  totalPixels = canvasDimensions.width * canvasDimensions.height;
127
- return _context2.abrupt("return", calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime, calculateSpeedIndex));
127
+ return _context2.abrupt("return", calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime));
128
128
  case 30:
129
129
  case "end":
130
130
  return _context2.stop();
@@ -199,7 +199,6 @@ export function calculatePercentiles(timePixelCounts, elementMap, unorderedPerce
199
199
  return results;
200
200
  }
201
201
  export function calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, totalPixels, startTime) {
202
- var calculateSpeedIndex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
203
202
  var entries = new Array(elementMap.size);
204
203
  var cumulativePixels = 0;
205
204
  var speedIndex = 0;
@@ -226,12 +225,9 @@ export function calculatePercentilesWithDebugInfo(timePixelCounts, elementMap, t
226
225
  };
227
226
 
228
227
  // Speed index calculation: sum of (time × incremental viewport percentage)
229
- // Only calculate when feature flag is enabled
230
- if (calculateSpeedIndex) {
231
- var ratioDelta = (percentCovered - previousPercentCovered) / 100;
232
- speedIndex += relativeTime * ratioDelta;
233
- previousPercentCovered = percentCovered;
234
- }
228
+ var ratioDelta = (percentCovered - previousPercentCovered) / 100;
229
+ speedIndex += relativeTime * ratioDelta;
230
+ previousPercentCovered = percentCovered;
235
231
  }
236
232
  return {
237
233
  entries: entries,
@@ -26,6 +26,7 @@ export interface TerminalErrorPayload {
26
26
  previousInteractionType: string | null;
27
27
  timeSincePreviousInteraction: number | null;
28
28
  labelStack: LabelStack | null;
29
+ routeName: string | null;
29
30
  };
30
31
  };
31
32
  }
@@ -7,6 +7,7 @@ export interface TerminalErrorAdditionalAttributes {
7
7
  traceId?: string;
8
8
  fallbackType?: 'page' | 'flag' | 'custom';
9
9
  statusCode?: number;
10
+ isClientNetworkError?: boolean;
10
11
  }
11
12
  export interface TerminalErrorData extends TerminalErrorAdditionalAttributes {
12
13
  errorType: string;
@@ -22,6 +23,7 @@ export interface TerminalErrorContext {
22
23
  previousInteractionName: string | null;
23
24
  previousInteractionType: string | null;
24
25
  timeSincePreviousInteraction: number | null;
26
+ routeName: string | null;
25
27
  }
26
28
  export declare function sinkTerminalErrorHandler(fn: (errorData: TerminalErrorData, context: TerminalErrorContext) => void | Promise<void>): void;
27
29
  export declare function setTerminalError(error: Error, additionalAttributes?: TerminalErrorAdditionalAttributes, labelStack?: LabelStack): void;
@@ -2,8 +2,8 @@ import type { RevisionPayloadVCDetails } from '../../../../../common/vc/types';
2
2
  import type { ViewportEntryData } from '../../../types';
3
3
  import type { CalcTTVCPercentilesArg, CalcTTVCPercentilesArgWithDebugInfo, PercentileCalcResultWithSpeedIndex } from '../types';
4
4
  declare function calculateTTVCPercentiles({ viewport, orderedEntries, percentiles, startTime, }: CalcTTVCPercentilesArg): Promise<RevisionPayloadVCDetails>;
5
- declare function calculateTTVCPercentilesWithDebugInfo({ viewport, orderedEntries, startTime, calculateSpeedIndex, }: CalcTTVCPercentilesArgWithDebugInfo): Promise<PercentileCalcResultWithSpeedIndex>;
5
+ declare function calculateTTVCPercentilesWithDebugInfo({ viewport, orderedEntries, startTime, }: CalcTTVCPercentilesArgWithDebugInfo): Promise<PercentileCalcResultWithSpeedIndex>;
6
6
  export default calculateTTVCPercentiles;
7
7
  export declare function calculatePercentiles(timePixelCounts: Map<DOMHighResTimeStamp, number>, elementMap: ReadonlyMap<DOMHighResTimeStamp, Set<string>>, unorderedPercentiles: number[], totalPixels: number, startTime: DOMHighResTimeStamp): RevisionPayloadVCDetails;
8
- export declare function calculatePercentilesWithDebugInfo(timePixelCounts: Map<DOMHighResTimeStamp, number>, elementMap: ReadonlyMap<DOMHighResTimeStamp, ViewportEntryData[]>, totalPixels: number, startTime: DOMHighResTimeStamp, calculateSpeedIndex?: boolean): PercentileCalcResultWithSpeedIndex;
8
+ export declare function calculatePercentilesWithDebugInfo(timePixelCounts: Map<DOMHighResTimeStamp, number>, elementMap: ReadonlyMap<DOMHighResTimeStamp, ViewportEntryData[]>, totalPixels: number, startTime: DOMHighResTimeStamp): PercentileCalcResultWithSpeedIndex;
9
9
  export { calculateTTVCPercentilesWithDebugInfo };
@@ -17,11 +17,6 @@ export type CalcTTVCPercentilesArgWithDebugInfo = {
17
17
  orderedEntries: ReadonlyArray<VCObserverEntry>;
18
18
  startTime: DOMHighResTimeStamp;
19
19
  stopTime: DOMHighResTimeStamp;
20
- /**
21
- * Whether to calculate speed index metric.
22
- * Controlled by platform_ufo_ttvc_v4_speed_index feature flag.
23
- */
24
- calculateSpeedIndex?: boolean;
25
20
  };
26
21
  export interface PercentileCalcResultItem {
27
22
  time: number;
@@ -26,6 +26,7 @@ export interface TerminalErrorPayload {
26
26
  previousInteractionType: string | null;
27
27
  timeSincePreviousInteraction: number | null;
28
28
  labelStack: LabelStack | null;
29
+ routeName: string | null;
29
30
  };
30
31
  };
31
32
  }
@@ -7,6 +7,7 @@ export interface TerminalErrorAdditionalAttributes {
7
7
  traceId?: string;
8
8
  fallbackType?: 'page' | 'flag' | 'custom';
9
9
  statusCode?: number;
10
+ isClientNetworkError?: boolean;
10
11
  }
11
12
  export interface TerminalErrorData extends TerminalErrorAdditionalAttributes {
12
13
  errorType: string;
@@ -22,6 +23,7 @@ export interface TerminalErrorContext {
22
23
  previousInteractionName: string | null;
23
24
  previousInteractionType: string | null;
24
25
  timeSincePreviousInteraction: number | null;
26
+ routeName: string | null;
25
27
  }
26
28
  export declare function sinkTerminalErrorHandler(fn: (errorData: TerminalErrorData, context: TerminalErrorContext) => void | Promise<void>): void;
27
29
  export declare function setTerminalError(error: Error, additionalAttributes?: TerminalErrorAdditionalAttributes, labelStack?: LabelStack): void;
@@ -2,8 +2,8 @@ import type { RevisionPayloadVCDetails } from '../../../../../common/vc/types';
2
2
  import type { ViewportEntryData } from '../../../types';
3
3
  import type { CalcTTVCPercentilesArg, CalcTTVCPercentilesArgWithDebugInfo, PercentileCalcResultWithSpeedIndex } from '../types';
4
4
  declare function calculateTTVCPercentiles({ viewport, orderedEntries, percentiles, startTime, }: CalcTTVCPercentilesArg): Promise<RevisionPayloadVCDetails>;
5
- declare function calculateTTVCPercentilesWithDebugInfo({ viewport, orderedEntries, startTime, calculateSpeedIndex, }: CalcTTVCPercentilesArgWithDebugInfo): Promise<PercentileCalcResultWithSpeedIndex>;
5
+ declare function calculateTTVCPercentilesWithDebugInfo({ viewport, orderedEntries, startTime, }: CalcTTVCPercentilesArgWithDebugInfo): Promise<PercentileCalcResultWithSpeedIndex>;
6
6
  export default calculateTTVCPercentiles;
7
7
  export declare function calculatePercentiles(timePixelCounts: Map<DOMHighResTimeStamp, number>, elementMap: ReadonlyMap<DOMHighResTimeStamp, Set<string>>, unorderedPercentiles: number[], totalPixels: number, startTime: DOMHighResTimeStamp): RevisionPayloadVCDetails;
8
- export declare function calculatePercentilesWithDebugInfo(timePixelCounts: Map<DOMHighResTimeStamp, number>, elementMap: ReadonlyMap<DOMHighResTimeStamp, ViewportEntryData[]>, totalPixels: number, startTime: DOMHighResTimeStamp, calculateSpeedIndex?: boolean): PercentileCalcResultWithSpeedIndex;
8
+ export declare function calculatePercentilesWithDebugInfo(timePixelCounts: Map<DOMHighResTimeStamp, number>, elementMap: ReadonlyMap<DOMHighResTimeStamp, ViewportEntryData[]>, totalPixels: number, startTime: DOMHighResTimeStamp): PercentileCalcResultWithSpeedIndex;
9
9
  export { calculateTTVCPercentilesWithDebugInfo };
@@ -17,11 +17,6 @@ export type CalcTTVCPercentilesArgWithDebugInfo = {
17
17
  orderedEntries: ReadonlyArray<VCObserverEntry>;
18
18
  startTime: DOMHighResTimeStamp;
19
19
  stopTime: DOMHighResTimeStamp;
20
- /**
21
- * Whether to calculate speed index metric.
22
- * Controlled by platform_ufo_ttvc_v4_speed_index feature flag.
23
- */
24
- calculateSpeedIndex?: boolean;
25
20
  };
26
21
  export interface PercentileCalcResultItem {
27
22
  time: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "5.2.2",
3
+ "version": "5.2.4",
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_vc_raw_data": {
183
183
  "type": "boolean"
184
184
  },
185
- "platform_ufo_dedupe_repeated_vc_offenders": {
186
- "type": "boolean"
187
- },
188
185
  "platform_mark_ufo_segment_first_load": {
189
186
  "type": "boolean"
190
187
  },
@@ -211,9 +208,6 @@
211
208
  },
212
209
  "platform_ufo_enable_terminal_errors": {
213
210
  "type": "boolean"
214
- },
215
- "platform_ufo_ttvc_v4_speed_index": {
216
- "type": "boolean"
217
211
  }
218
212
  }
219
213
  }