@atlaskit/react-ufo 4.5.11 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/config/index.js +19 -6
  3. package/dist/cjs/create-payload/index.js +3 -1
  4. package/dist/cjs/create-payload/utils/get-vc-metrics.js +5 -13
  5. package/dist/cjs/interaction-metrics/index.js +2 -1
  6. package/dist/cjs/segment/segment.js +19 -2
  7. package/dist/cjs/trace-hover/index.js +12 -0
  8. package/dist/cjs/trace-interaction/internal/trace-ufo-interaction.js +23 -6
  9. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +14 -3
  10. package/dist/es2019/config/index.js +13 -0
  11. package/dist/es2019/create-payload/index.js +3 -0
  12. package/dist/es2019/create-payload/utils/get-vc-metrics.js +0 -5
  13. package/dist/es2019/interaction-metrics/index.js +2 -1
  14. package/dist/es2019/segment/segment.js +21 -4
  15. package/dist/es2019/trace-hover/index.js +5 -0
  16. package/dist/es2019/trace-interaction/internal/trace-ufo-interaction.js +24 -7
  17. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +15 -1
  18. package/dist/esm/config/index.js +18 -6
  19. package/dist/esm/create-payload/index.js +3 -1
  20. package/dist/esm/create-payload/utils/get-vc-metrics.js +5 -13
  21. package/dist/esm/interaction-metrics/index.js +2 -1
  22. package/dist/esm/segment/segment.js +21 -4
  23. package/dist/esm/trace-hover/index.js +5 -0
  24. package/dist/esm/trace-interaction/internal/trace-ufo-interaction.js +24 -7
  25. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +14 -3
  26. package/dist/types/common/common/types.d.ts +5 -0
  27. package/dist/types/common/react-ufo-payload-schema.d.ts +2 -1
  28. package/dist/types/config/index.d.ts +2 -0
  29. package/dist/types/create-payload/index.d.ts +512 -0
  30. package/dist/types/trace-hover/index.d.ts +2 -0
  31. package/dist/types-ts4.5/common/common/types.d.ts +5 -0
  32. package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +2 -1
  33. package/dist/types-ts4.5/config/index.d.ts +2 -0
  34. package/dist/types-ts4.5/create-payload/index.d.ts +512 -0
  35. package/dist/types-ts4.5/trace-hover/index.d.ts +2 -0
  36. package/package.json +6 -3
  37. package/trace-hover/package.json +15 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`a5c2905c301d6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a5c2905c301d6) -
8
+ add tracking of minor interactions
9
+
10
+ ### Patch Changes
11
+
12
+ - [`135fc7330f9f3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/135fc7330f9f3) -
13
+ serialise TTVC v3 debug data rectangles
14
+
15
+ ## 4.5.12
16
+
17
+ ### Patch Changes
18
+
19
+ - [`2c7a56c2db1f8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2c7a56c2db1f8) -
20
+ cleanup platform_ufo_no_vc_on_aborted
21
+
3
22
  ## 4.5.11
4
23
 
5
24
  ### Patch Changes
@@ -15,6 +15,7 @@ exports.getExperimentalInteractionRate = getExperimentalInteractionRate;
15
15
  exports.getExtraInteractionRate = getExtraInteractionRate;
16
16
  exports.getInteractionRate = getInteractionRate;
17
17
  exports.getInteractionTimeout = getInteractionTimeout;
18
+ exports.getMinorInteractions = getMinorInteractions;
18
19
  exports.getMostRecentVCRevision = getMostRecentVCRevision;
19
20
  exports.getPostInteractionRate = getPostInteractionRate;
20
21
  exports.getReactHydrationStats = getReactHydrationStats;
@@ -299,6 +300,18 @@ function getUfoNameOverrides() {
299
300
  return undefined;
300
301
  }
301
302
  }
303
+ function getMinorInteractions() {
304
+ try {
305
+ if (!config) {
306
+ return undefined;
307
+ }
308
+ var _config8 = config,
309
+ minorInteractions = _config8.minorInteractions;
310
+ return minorInteractions;
311
+ } catch (e) {
312
+ return undefined;
313
+ }
314
+ }
302
315
 
303
316
  // Contains the list of interactions that do not abort existing known interactions
304
317
  function getDoNotAbortActivePressInteraction() {
@@ -306,8 +319,8 @@ function getDoNotAbortActivePressInteraction() {
306
319
  if (!config) {
307
320
  return undefined;
308
321
  }
309
- var _config8 = config,
310
- doNotAbortActivePressInteraction = _config8.doNotAbortActivePressInteraction;
322
+ var _config9 = config,
323
+ doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
311
324
  return doNotAbortActivePressInteraction;
312
325
  } catch (e) {
313
326
  return undefined;
@@ -320,8 +333,8 @@ function getDoNotAbortActivePressInteractionOnTransition() {
320
333
  if (!config) {
321
334
  return undefined;
322
335
  }
323
- var _config9 = config,
324
- doNotAbortActivePressInteractionOnTransition = _config9.doNotAbortActivePressInteractionOnTransition;
336
+ var _config0 = config,
337
+ doNotAbortActivePressInteractionOnTransition = _config0.doNotAbortActivePressInteractionOnTransition;
325
338
  return doNotAbortActivePressInteractionOnTransition;
326
339
  } catch (e) {
327
340
  return undefined;
@@ -333,8 +346,8 @@ function getInteractionTimeout(ufoName) {
333
346
  if (!config) {
334
347
  return CLEANUP_TIMEOUT;
335
348
  }
336
- var _config0 = config,
337
- interactionTimeout = _config0.interactionTimeout;
349
+ var _config1 = config,
350
+ interactionTimeout = _config1.interactionTimeout;
338
351
  if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
339
352
  return interactionTimeout[ufoName];
340
353
  }
@@ -748,7 +748,7 @@ function _createInteractionMetricsPayload() {
748
748
  'ufo:multipayload': true,
749
749
  'ufo:criticalPayloadCount': criticalPayloadCount
750
750
  } : {}), (0, _getBrowserMetadata.getBrowserMetadataToLegacyFormat)()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), (0, _getNavigationMetrics.getNavigationMetricsToLegacyFormat)(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
751
- interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
751
+ interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
752
752
  namePrefix: config.namePrefix || '',
753
753
  segmentPrefix: config.segmentPrefix || '',
754
754
  interactionId: interactionId,
@@ -782,6 +782,8 @@ function _createInteractionMetricsPayload() {
782
782
  unknownElementName: unknownElementName
783
783
  } : {}), unknownElementHierarchy ? {
784
784
  unknownElementHierarchy: unknownElementHierarchy
785
+ } : {}), (0, _platformFeatureFlags.fg)('platform_ufo_enable_minor_interactions') ? {
786
+ minorInteractions: interaction.minorInteractions
785
787
  } : {}),
786
788
  'ufo:payloadTime': (0, _roundNumber.roundEpsilon)(performance.now() - interactionPayloadStart)
787
789
  })
@@ -8,7 +8,6 @@ exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
11
  var _config = require("../../config");
13
12
  var _interactionMetrics = require("../../interaction-metrics");
14
13
  var _getInteractionStatus = _interopRequireDefault(require("./get-interaction-status"));
@@ -63,13 +62,6 @@ function _getVCMetrics() {
63
62
  }
64
63
  return _context.abrupt("return", {});
65
64
  case 12:
66
- if (!(!shouldReportVCMetrics && (0, _platformFeatureFlags.fg)('platform_ufo_no_vc_on_aborted'))) {
67
- _context.next = 15;
68
- break;
69
- }
70
- observer.stop(interaction.ufoName);
71
- return _context.abrupt("return", {});
72
- case 15:
73
65
  isSSREnabled = interaction.type === 'page_load' && ((config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 || (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName)));
74
66
  ssr = interaction.type === 'page_load' && isSSREnabled ? {
75
67
  ssr: (0, _getSsrDoneTimeValue.default)(config)
@@ -77,7 +69,7 @@ function _getVCMetrics() {
77
69
  _interactionMetrics.postInteractionLog.setVCObserverSSRConfig(ssr);
78
70
  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;
79
71
  prefix = 'ufo';
80
- _context.next = 22;
72
+ _context.next = 19;
81
73
  return observer.getVCResult(_objectSpread(_objectSpread({
82
74
  start: interaction.start,
83
75
  stop: interaction.end,
@@ -92,7 +84,7 @@ function _getVCMetrics() {
92
84
  }, ssr), {}, {
93
85
  include3p: include3p
94
86
  }));
95
- case 22:
87
+ case 19:
96
88
  result = _context.sent;
97
89
  observer.stop(interaction.ufoName);
98
90
  if (!include3p) {
@@ -105,15 +97,15 @@ function _getVCMetrics() {
105
97
  return revision === mostRecentVCRevision;
106
98
  });
107
99
  if (!(!shouldReportVCMetrics || !(mostRecentVCRevisionPayload !== null && mostRecentVCRevisionPayload !== void 0 && mostRecentVCRevisionPayload.clean))) {
108
- _context.next = 29;
100
+ _context.next = 26;
109
101
  break;
110
102
  }
111
103
  return _context.abrupt("return", result);
112
- case 29:
104
+ case 26:
113
105
  return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
114
106
  'metric:vc90': mostRecentVCRevisionPayload['metric:vc90']
115
107
  }));
116
- case 30:
108
+ case 27:
117
109
  case "end":
118
110
  return _context.stop();
119
111
  }
@@ -1101,7 +1101,8 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1101
1101
  trace: trace,
1102
1102
  vcObserver: vcObserver,
1103
1103
  hold3pActive: new Map(),
1104
- hold3pInfo: []
1104
+ hold3pInfo: [],
1105
+ minorInteractions: []
1105
1106
  };
1106
1107
  if (addFeatureFlagsToInteraction) {
1107
1108
  _featureFlagsAccessed.currentFeatureFlagsAccessed.clear();
@@ -11,6 +11,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _scheduler = require("scheduler");
13
13
  var _uuid = require("uuid");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _coinflip = _interopRequireDefault(require("../coinflip"));
15
16
  var _config = require("../config");
16
17
  var _experienceTraceIdContext = require("../experience-trace-id-context");
@@ -172,8 +173,24 @@ function UFOSegment(_ref) {
172
173
  tracePress: function tracePress() {
173
174
  var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'unknown';
174
175
  var timestamp = arguments.length > 1 ? arguments[1] : undefined;
175
- if (interactionId.current != null) {
176
- (0, _interactionMetrics.abortByNewInteraction)(interactionId.current, name);
176
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_minor_interactions')) {
177
+ var _getDoNotAbortActiveP, _getMinorInteractions;
178
+ var minorInteractions = [].concat((0, _toConsumableArray2.default)((_getDoNotAbortActiveP = (0, _config.getDoNotAbortActivePressInteraction)()) !== null && _getDoNotAbortActiveP !== void 0 ? _getDoNotAbortActiveP : []), (0, _toConsumableArray2.default)((_getMinorInteractions = (0, _config.getMinorInteractions)()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []));
179
+ if (minorInteractions.includes(name)) {
180
+ var _activeInteraction$mi;
181
+ var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
182
+ activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
183
+ name: name,
184
+ startTime: timestamp !== null && timestamp !== void 0 ? timestamp : performance.now()
185
+ });
186
+ return;
187
+ } else if (interactionId.current != null) {
188
+ (0, _interactionMetrics.abortByNewInteraction)(interactionId.current, name);
189
+ }
190
+ } else {
191
+ if (interactionId.current != null) {
192
+ (0, _interactionMetrics.abortByNewInteraction)(interactionId.current, name);
193
+ }
177
194
  }
178
195
  var rate = (0, _config.getInteractionRate)(name, 'press');
179
196
  if ((0, _coinflip.default)(rate)) {
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _traceUfoInteraction = _interopRequireDefault(require("../trace-interaction/internal/trace-ufo-interaction"));
9
+ function traceUFOHover(name, timestamp) {
10
+ return (0, _traceUfoInteraction.default)(name, 'hover', timestamp);
11
+ }
12
+ var _default = exports.default = traceUFOHover;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _uuid = require("uuid");
9
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
10
  var _coinflip = _interopRequireDefault(require("../../coinflip"));
10
11
  var _config = require("../../config");
11
12
  var _experienceTraceIdContext = require("../../experience-trace-id-context");
@@ -15,15 +16,31 @@ var _routeNameContext = _interopRequireDefault(require("../../route-name-context
15
16
  function traceUFOInteraction(name, interactionType, startTime) {
16
17
  var rate = (0, _config.getInteractionRate)(name, interactionType);
17
18
  var pressInteractionsList = (0, _config.getDoNotAbortActivePressInteraction)();
18
- if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
19
- var interaction = (0, _interactionMetrics.getActiveInteraction)();
20
- if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
19
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_minor_interactions')) {
20
+ var _getMinorInteractions;
21
+ var minorInteractions = (pressInteractionsList !== null && pressInteractionsList !== void 0 ? pressInteractionsList : []).concat((_getMinorInteractions = (0, _config.getMinorInteractions)()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []);
22
+ if (minorInteractions.includes(name)) {
23
+ var _activeInteraction$mi;
24
+ var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
25
+ activeInteraction === null || activeInteraction === void 0 || (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 || _activeInteraction$mi.push({
26
+ name: name,
27
+ startTime: startTime !== null && startTime !== void 0 ? startTime : performance.now()
28
+ });
21
29
  return;
30
+ } else {
31
+ (0, _interactionMetrics.abortAll)('new_interaction', name);
22
32
  }
23
33
  } else {
24
- // Abort any existing interaction regardless of the coinflip outcome
25
- // Ensures measurements are not carried over between distinct interactions
26
- (0, _interactionMetrics.abortAll)('new_interaction', name);
34
+ if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
35
+ var interaction = (0, _interactionMetrics.getActiveInteraction)();
36
+ if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
37
+ return;
38
+ }
39
+ } else {
40
+ // Abort any existing interaction regardless of the coinflip outcome
41
+ // Ensures measurements are not carried over between distinct interactions
42
+ (0, _interactionMetrics.abortAll)('new_interaction', name);
43
+ }
27
44
  }
28
45
  if ((0, _coinflip.default)(rate)) {
29
46
  var startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
@@ -87,7 +87,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
87
87
  value: function () {
88
88
  var _calculateWithDebugInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p) {
89
89
  var _window, _window2, _window3, _window5;
90
- var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator4, _step4, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator5, _step5, _entry3, _ignoredEntriesByTime, viewportData, timestamp, additionalVcLogs, _iterator6, _step6, _step6$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window4, _window4$__ufo_devtoo, _window6, _window6$__on_ufo_vc_;
90
+ var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator3, _step3, _entry2, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, sortedVcLogs, maxViewportPercentageAtTime, maxSoFar, _iterator4, _step4, log, getBiggestPreviousViewportPercentage, ignoredEntriesByTime, _iterator5, _step5, _entry3, _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou, viewportData, timestamp, additionalVcLogs, _iterator6, _step6, _step6$value, _timestamp, ignoredEntries, _viewportPercentage, v3RevisionDebugDetails, _window4, _window4$__ufo_devtoo, _window6, _window6$__on_ufo_vc_;
91
91
  return _regenerator.default.wrap(function _callee$(_context) {
92
92
  while (1) switch (_context.prev = _context.next) {
93
93
  case 0:
@@ -181,7 +181,15 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
181
181
  }
182
182
  }
183
183
  enhancedVcLogs = vcLogs ? vcLogs.map(function (log) {
184
- return _objectSpread(_objectSpread({}, log), {}, {
184
+ return _objectSpread(_objectSpread(_objectSpread({}, log), (0, _platformFeatureFlags.fg)('platform_ufo_serialise_ttvc_v3_debug_data') && {
185
+ entries: log.entries.map(function (entry) {
186
+ var _entry$rect, _entry$previousRect;
187
+ return _objectSpread(_objectSpread({}, entry), {}, {
188
+ rect: (_entry$rect = entry.rect) === null || _entry$rect === void 0 ? void 0 : _entry$rect.toJSON(),
189
+ previousRect: (_entry$previousRect = entry.previousRect) === null || _entry$previousRect === void 0 ? void 0 : _entry$previousRect.toJSON()
190
+ });
191
+ })
192
+ }), {}, {
185
193
  viewportPercentage: log.viewportPercentage
186
194
  });
187
195
  }) : []; // If 3p metric enabled - calculate the debug details
@@ -237,7 +245,10 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
237
245
  if (!ignoredEntriesByTime.has(timestamp)) {
238
246
  ignoredEntriesByTime.set(timestamp, []);
239
247
  }
240
- (_ignoredEntriesByTime = ignoredEntriesByTime.get(timestamp)) === null || _ignoredEntriesByTime === void 0 || _ignoredEntriesByTime.push(_objectSpread(_objectSpread({}, viewportData), {}, {
248
+ (_ignoredEntriesByTime = ignoredEntriesByTime.get(timestamp)) === null || _ignoredEntriesByTime === void 0 || _ignoredEntriesByTime.push(_objectSpread(_objectSpread(_objectSpread({}, viewportData), (0, _platformFeatureFlags.fg)('platform_ufo_serialise_ttvc_v3_debug_data') && {
249
+ rect: (_viewportData$rect = viewportData.rect) === null || _viewportData$rect === void 0 ? void 0 : _viewportData$rect.toJSON(),
250
+ previousRect: (_viewportData$previou = viewportData.previousRect) === null || _viewportData$previou === void 0 ? void 0 : _viewportData$previou.toJSON()
251
+ }), {}, {
241
252
  ignoreReason: viewportData.visible ? viewportData.type : 'not-visible'
242
253
  }));
243
254
  }
@@ -280,6 +280,19 @@ export function getUfoNameOverrides() {
280
280
  return undefined;
281
281
  }
282
282
  }
283
+ export function getMinorInteractions() {
284
+ try {
285
+ if (!config) {
286
+ return undefined;
287
+ }
288
+ const {
289
+ minorInteractions
290
+ } = config;
291
+ return minorInteractions;
292
+ } catch (e) {
293
+ return undefined;
294
+ }
295
+ }
283
296
 
284
297
  // Contains the list of interactions that do not abort existing known interactions
285
298
  export function getDoNotAbortActivePressInteraction() {
@@ -787,6 +787,9 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
787
787
  } : {}),
788
788
  ...(unknownElementHierarchy ? {
789
789
  unknownElementHierarchy
790
+ } : {}),
791
+ ...(fg('platform_ufo_enable_minor_interactions') ? {
792
+ minorInteractions: interaction.minorInteractions
790
793
  } : {})
791
794
  },
792
795
  'ufo:payloadTime': roundEpsilon(performance.now() - interactionPayloadStart)
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  import { getConfig, getMostRecentVCRevision } from '../../config';
3
2
  import { postInteractionLog } from '../../interaction-metrics';
4
3
  import getInteractionStatus from './get-interaction-status';
@@ -22,10 +21,6 @@ async function getVCMetrics(interaction, include3p = false) {
22
21
  if (!observer) {
23
22
  return {};
24
23
  }
25
- if (!shouldReportVCMetrics && fg('platform_ufo_no_vc_on_aborted')) {
26
- observer.stop(interaction.ufoName);
27
- return {};
28
- }
29
24
  const isSSREnabled = interaction.type === 'page_load' && ((config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 ? void 0 : (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName)));
30
25
  const ssr = interaction.type === 'page_load' && isSSREnabled ? {
31
26
  ssr: getSSRDoneTimeValue(config)
@@ -979,7 +979,8 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
979
979
  trace,
980
980
  vcObserver,
981
981
  hold3pActive: new Map(),
982
- hold3pInfo: []
982
+ hold3pInfo: [],
983
+ minorInteractions: []
983
984
  };
984
985
  if (addFeatureFlagsToInteraction) {
985
986
  currentFeatureFlagsAccessed.clear();
@@ -1,12 +1,13 @@
1
1
  import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
2
2
  import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
3
3
  import { v4 as createUUID } from 'uuid';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import coinflip from '../coinflip';
5
- import { getConfig, getInteractionRate } from '../config';
6
+ import { getConfig, getDoNotAbortActivePressInteraction, getInteractionRate, getMinorInteractions } from '../config';
6
7
  import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
7
8
  import UFOInteractionContext from '../interaction-context';
8
9
  import UFOInteractionIDContext from '../interaction-id-context';
9
- import { abortByNewInteraction, addApdex, addCustomData, addCustomTiming, addHold, addHoldByID, addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
10
+ import { abortByNewInteraction, addApdex, addCustomData, addCustomTiming, addHold, addHoldByID, addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, getActiveInteraction, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
10
11
  import UFORouteName from '../route-name-context';
11
12
  import generateId from '../short-id';
12
13
  import scheduleOnPaint from './schedule-on-paint';
@@ -145,8 +146,24 @@ export default function UFOSegment({
145
146
  this._internalHoldByID(labelStack, id, name, true);
146
147
  },
147
148
  tracePress(name = 'unknown', timestamp) {
148
- if (interactionId.current != null) {
149
- abortByNewInteraction(interactionId.current, name);
149
+ if (fg('platform_ufo_enable_minor_interactions')) {
150
+ var _getDoNotAbortActiveP, _getMinorInteractions;
151
+ const minorInteractions = [...((_getDoNotAbortActiveP = getDoNotAbortActivePressInteraction()) !== null && _getDoNotAbortActiveP !== void 0 ? _getDoNotAbortActiveP : []), ...((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : [])];
152
+ if (minorInteractions.includes(name)) {
153
+ var _activeInteraction$mi;
154
+ const activeInteraction = getActiveInteraction();
155
+ activeInteraction === null || activeInteraction === void 0 ? void 0 : (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 ? void 0 : _activeInteraction$mi.push({
156
+ name,
157
+ startTime: timestamp !== null && timestamp !== void 0 ? timestamp : performance.now()
158
+ });
159
+ return;
160
+ } else if (interactionId.current != null) {
161
+ abortByNewInteraction(interactionId.current, name);
162
+ }
163
+ } else {
164
+ if (interactionId.current != null) {
165
+ abortByNewInteraction(interactionId.current, name);
166
+ }
150
167
  }
151
168
  const rate = getInteractionRate(name, 'press');
152
169
  if (coinflip(rate)) {
@@ -0,0 +1,5 @@
1
+ import { default as internal_traceUFOInteraction } from '../trace-interaction/internal/trace-ufo-interaction';
2
+ function traceUFOHover(name, timestamp) {
3
+ return internal_traceUFOInteraction(name, 'hover', timestamp);
4
+ }
5
+ export default traceUFOHover;
@@ -1,6 +1,7 @@
1
1
  import { v4 as createUUID } from 'uuid';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import coinflip from '../../coinflip';
3
- import { getDoNotAbortActivePressInteraction, getInteractionRate } from '../../config';
4
+ import { getDoNotAbortActivePressInteraction, getInteractionRate, getMinorInteractions } from '../../config';
4
5
  import { getActiveTrace, setInteractionActiveTrace } from '../../experience-trace-id-context';
5
6
  import { DefaultInteractionID } from '../../interaction-id-context';
6
7
  import { abortAll, addNewInteraction, getActiveInteraction } from '../../interaction-metrics';
@@ -8,15 +9,31 @@ import UFORouteName from '../../route-name-context';
8
9
  function traceUFOInteraction(name, interactionType, startTime) {
9
10
  const rate = getInteractionRate(name, interactionType);
10
11
  const pressInteractionsList = getDoNotAbortActivePressInteraction();
11
- if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
12
- const interaction = getActiveInteraction();
13
- if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
12
+ if (fg('platform_ufo_enable_minor_interactions')) {
13
+ var _getMinorInteractions;
14
+ const minorInteractions = (pressInteractionsList !== null && pressInteractionsList !== void 0 ? pressInteractionsList : []).concat((_getMinorInteractions = getMinorInteractions()) !== null && _getMinorInteractions !== void 0 ? _getMinorInteractions : []);
15
+ if (minorInteractions.includes(name)) {
16
+ var _activeInteraction$mi;
17
+ const activeInteraction = getActiveInteraction();
18
+ activeInteraction === null || activeInteraction === void 0 ? void 0 : (_activeInteraction$mi = activeInteraction.minorInteractions) === null || _activeInteraction$mi === void 0 ? void 0 : _activeInteraction$mi.push({
19
+ name,
20
+ startTime: startTime !== null && startTime !== void 0 ? startTime : performance.now()
21
+ });
14
22
  return;
23
+ } else {
24
+ abortAll('new_interaction', name);
15
25
  }
16
26
  } else {
17
- // Abort any existing interaction regardless of the coinflip outcome
18
- // Ensures measurements are not carried over between distinct interactions
19
- abortAll('new_interaction', name);
27
+ if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
28
+ const interaction = getActiveInteraction();
29
+ if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
30
+ return;
31
+ }
32
+ } else {
33
+ // Abort any existing interaction regardless of the coinflip outcome
34
+ // Ensures measurements are not carried over between distinct interactions
35
+ abortAll('new_interaction', name);
36
+ }
20
37
  }
21
38
  if (coinflip(rate)) {
22
39
  const startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
@@ -109,6 +109,16 @@ export default class AbstractVCCalculatorBase {
109
109
  }
110
110
  let enhancedVcLogs = vcLogs ? vcLogs.map(log => ({
111
111
  ...log,
112
+ ...(fg('platform_ufo_serialise_ttvc_v3_debug_data') && {
113
+ entries: log.entries.map(entry => {
114
+ var _entry$rect, _entry$previousRect;
115
+ return {
116
+ ...entry,
117
+ rect: (_entry$rect = entry.rect) === null || _entry$rect === void 0 ? void 0 : _entry$rect.toJSON(),
118
+ previousRect: (_entry$previousRect = entry.previousRect) === null || _entry$previousRect === void 0 ? void 0 : _entry$previousRect.toJSON()
119
+ };
120
+ })
121
+ }),
112
122
  viewportPercentage: log.viewportPercentage
113
123
  })) : [];
114
124
 
@@ -152,7 +162,7 @@ export default class AbstractVCCalculatorBase {
152
162
  const ignoredEntriesByTime = new Map();
153
163
  for (const entry of allEntries) {
154
164
  if ('rect' in entry.data && !this.isEntryIncluded(entry, include3p)) {
155
- var _ignoredEntriesByTime;
165
+ var _ignoredEntriesByTime, _viewportData$rect, _viewportData$previou;
156
166
  const viewportData = entry.data;
157
167
  const timestamp = Math.round(entry.time);
158
168
  if (!ignoredEntriesByTime.has(timestamp)) {
@@ -160,6 +170,10 @@ export default class AbstractVCCalculatorBase {
160
170
  }
161
171
  (_ignoredEntriesByTime = ignoredEntriesByTime.get(timestamp)) === null || _ignoredEntriesByTime === void 0 ? void 0 : _ignoredEntriesByTime.push({
162
172
  ...viewportData,
173
+ ...(fg('platform_ufo_serialise_ttvc_v3_debug_data') && {
174
+ rect: (_viewportData$rect = viewportData.rect) === null || _viewportData$rect === void 0 ? void 0 : _viewportData$rect.toJSON(),
175
+ previousRect: (_viewportData$previou = viewportData.previousRect) === null || _viewportData$previou === void 0 ? void 0 : _viewportData$previou.toJSON()
176
+ }),
163
177
  ignoreReason: viewportData.visible ? viewportData.type : 'not-visible'
164
178
  });
165
179
  }
@@ -275,6 +275,18 @@ export function getUfoNameOverrides() {
275
275
  return undefined;
276
276
  }
277
277
  }
278
+ export function getMinorInteractions() {
279
+ try {
280
+ if (!config) {
281
+ return undefined;
282
+ }
283
+ var _config8 = config,
284
+ minorInteractions = _config8.minorInteractions;
285
+ return minorInteractions;
286
+ } catch (e) {
287
+ return undefined;
288
+ }
289
+ }
278
290
 
279
291
  // Contains the list of interactions that do not abort existing known interactions
280
292
  export function getDoNotAbortActivePressInteraction() {
@@ -282,8 +294,8 @@ export function getDoNotAbortActivePressInteraction() {
282
294
  if (!config) {
283
295
  return undefined;
284
296
  }
285
- var _config8 = config,
286
- doNotAbortActivePressInteraction = _config8.doNotAbortActivePressInteraction;
297
+ var _config9 = config,
298
+ doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
287
299
  return doNotAbortActivePressInteraction;
288
300
  } catch (e) {
289
301
  return undefined;
@@ -296,8 +308,8 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
296
308
  if (!config) {
297
309
  return undefined;
298
310
  }
299
- var _config9 = config,
300
- doNotAbortActivePressInteractionOnTransition = _config9.doNotAbortActivePressInteractionOnTransition;
311
+ var _config0 = config,
312
+ doNotAbortActivePressInteractionOnTransition = _config0.doNotAbortActivePressInteractionOnTransition;
301
313
  return doNotAbortActivePressInteractionOnTransition;
302
314
  } catch (e) {
303
315
  return undefined;
@@ -309,8 +321,8 @@ export function getInteractionTimeout(ufoName) {
309
321
  if (!config) {
310
322
  return CLEANUP_TIMEOUT;
311
323
  }
312
- var _config0 = config,
313
- interactionTimeout = _config0.interactionTimeout;
324
+ var _config1 = config,
325
+ interactionTimeout = _config1.interactionTimeout;
314
326
  if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
315
327
  return interactionTimeout[ufoName];
316
328
  }
@@ -739,7 +739,7 @@ function _createInteractionMetricsPayload() {
739
739
  'ufo:multipayload': true,
740
740
  'ufo:criticalPayloadCount': criticalPayloadCount
741
741
  } : {}), getBrowserMetadataToLegacyFormat()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), getNavigationMetricsToLegacyFormat(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
742
- interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
742
+ interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
743
743
  namePrefix: config.namePrefix || '',
744
744
  segmentPrefix: config.segmentPrefix || '',
745
745
  interactionId: interactionId,
@@ -773,6 +773,8 @@ function _createInteractionMetricsPayload() {
773
773
  unknownElementName: unknownElementName
774
774
  } : {}), unknownElementHierarchy ? {
775
775
  unknownElementHierarchy: unknownElementHierarchy
776
+ } : {}), fg('platform_ufo_enable_minor_interactions') ? {
777
+ minorInteractions: interaction.minorInteractions
776
778
  } : {}),
777
779
  'ufo:payloadTime': roundEpsilon(performance.now() - interactionPayloadStart)
778
780
  })
@@ -3,7 +3,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  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; }
5
5
  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; }
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { getConfig, getMostRecentVCRevision } from '../../config';
8
7
  import { postInteractionLog } from '../../interaction-metrics';
9
8
  import getInteractionStatus from './get-interaction-status';
@@ -56,13 +55,6 @@ function _getVCMetrics() {
56
55
  }
57
56
  return _context.abrupt("return", {});
58
57
  case 12:
59
- if (!(!shouldReportVCMetrics && fg('platform_ufo_no_vc_on_aborted'))) {
60
- _context.next = 15;
61
- break;
62
- }
63
- observer.stop(interaction.ufoName);
64
- return _context.abrupt("return", {});
65
- case 15:
66
58
  isSSREnabled = interaction.type === 'page_load' && ((config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 || (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName)));
67
59
  ssr = interaction.type === 'page_load' && isSSREnabled ? {
68
60
  ssr: getSSRDoneTimeValue(config)
@@ -70,7 +62,7 @@ function _getVCMetrics() {
70
62
  postInteractionLog.setVCObserverSSRConfig(ssr);
71
63
  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;
72
64
  prefix = 'ufo';
73
- _context.next = 22;
65
+ _context.next = 19;
74
66
  return observer.getVCResult(_objectSpread(_objectSpread({
75
67
  start: interaction.start,
76
68
  stop: interaction.end,
@@ -85,7 +77,7 @@ function _getVCMetrics() {
85
77
  }, ssr), {}, {
86
78
  include3p: include3p
87
79
  }));
88
- case 22:
80
+ case 19:
89
81
  result = _context.sent;
90
82
  observer.stop(interaction.ufoName);
91
83
  if (!include3p) {
@@ -98,15 +90,15 @@ function _getVCMetrics() {
98
90
  return revision === mostRecentVCRevision;
99
91
  });
100
92
  if (!(!shouldReportVCMetrics || !(mostRecentVCRevisionPayload !== null && mostRecentVCRevisionPayload !== void 0 && mostRecentVCRevisionPayload.clean))) {
101
- _context.next = 29;
93
+ _context.next = 26;
102
94
  break;
103
95
  }
104
96
  return _context.abrupt("return", result);
105
- case 29:
97
+ case 26:
106
98
  return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
107
99
  'metric:vc90': mostRecentVCRevisionPayload['metric:vc90']
108
100
  }));
109
- case 30:
101
+ case 27:
110
102
  case "end":
111
103
  return _context.stop();
112
104
  }