@atlaskit/react-ufo 4.8.0 → 4.9.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 (52) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/create-extra-search-page-interaction-payload/index.js +50 -0
  3. package/dist/cjs/create-payload/index.js +63 -0
  4. package/dist/cjs/create-payload/utils/get-vc-metrics.js +15 -12
  5. package/dist/cjs/interaction-metrics/index.js +15 -7
  6. package/dist/cjs/interaction-metrics-init/index.js +29 -2
  7. package/dist/cjs/vc/index.js +4 -3
  8. package/dist/cjs/vc/vc-observer-new/index.js +4 -3
  9. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +8 -8
  10. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +5 -1
  11. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js +27 -0
  12. package/dist/es2019/create-extra-search-page-interaction-payload/index.js +32 -0
  13. package/dist/es2019/create-payload/index.js +49 -0
  14. package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -2
  15. package/dist/es2019/interaction-metrics/index.js +15 -7
  16. package/dist/es2019/interaction-metrics-init/index.js +29 -2
  17. package/dist/es2019/vc/index.js +4 -2
  18. package/dist/es2019/vc/vc-observer-new/index.js +4 -2
  19. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +6 -5
  20. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +5 -1
  21. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js +22 -0
  22. package/dist/esm/create-extra-search-page-interaction-payload/index.js +43 -0
  23. package/dist/esm/create-payload/index.js +62 -0
  24. package/dist/esm/create-payload/utils/get-vc-metrics.js +15 -12
  25. package/dist/esm/interaction-metrics/index.js +15 -7
  26. package/dist/esm/interaction-metrics-init/index.js +29 -2
  27. package/dist/esm/vc/index.js +4 -3
  28. package/dist/esm/vc/vc-observer-new/index.js +4 -3
  29. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +8 -8
  30. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +5 -1
  31. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js +21 -0
  32. package/dist/types/config/index.d.ts +7 -0
  33. package/dist/types/create-extra-search-page-interaction-payload/index.d.ts +3 -0
  34. package/dist/types/create-payload/index.d.ts +25434 -0
  35. package/dist/types/create-payload/utils/get-vc-metrics.d.ts +1 -1
  36. package/dist/types/vc/types.d.ts +1 -0
  37. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
  38. package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
  39. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  40. package/dist/types/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.d.ts +2 -0
  41. package/dist/types/vc/vc-observer-new/types.d.ts +1 -0
  42. package/dist/types-ts4.5/config/index.d.ts +7 -0
  43. package/dist/types-ts4.5/create-extra-search-page-interaction-payload/index.d.ts +3 -0
  44. package/dist/types-ts4.5/create-payload/index.d.ts +25434 -0
  45. package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +1 -1
  46. package/dist/types-ts4.5/vc/types.d.ts +1 -0
  47. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
  48. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
  49. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  50. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.d.ts +2 -0
  51. package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -0
  52. package/package.json +4 -1
@@ -231,11 +231,11 @@ var VCObserverNew = /*#__PURE__*/function () {
231
231
  key: "getVCResult",
232
232
  value: function () {
233
233
  var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
234
- var start, stop, interactionId, include3p, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
234
+ var start, stop, interactionId, include3p, excludeSmartAnswersInSearch, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
235
235
  return _regeneratorRuntime.wrap(function _callee$(_context) {
236
236
  while (1) switch (_context.prev = _context.next) {
237
237
  case 0:
238
- start = param.start, stop = param.stop, interactionId = param.interactionId, include3p = param.include3p;
238
+ start = param.start, stop = param.stop, interactionId = param.interactionId, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
239
239
  results = [];
240
240
  this.addStartEntry(start);
241
241
  calculator_fy25_03 = new VCCalculator_FY25_03();
@@ -253,7 +253,8 @@ var VCObserverNew = /*#__PURE__*/function () {
253
253
  stopTime: stop,
254
254
  interactionId: interactionId,
255
255
  isPostInteraction: this.isPostInteraction,
256
- include3p: include3p
256
+ include3p: include3p,
257
+ excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
257
258
  });
258
259
  case 8:
259
260
  fy25_03 = _context.sent;
@@ -105,7 +105,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
105
105
  }, {
106
106
  key: "calculateWithDebugInfo",
107
107
  value: function () {
108
- var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p) {
108
+ var _calculateWithDebugInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, allEntries, include3p, excludeSmartAnswersInSearch) {
109
109
  var _window, _window2, _window6, _window8;
110
110
  var percentiles, viewportEntries, vcLogs, vcDetails, percentileIndex, entryDataBuffer, _iterator4, _step4, _entry3, time, viewportPercentage, entries, elementNames, previousResult, i, percentile, enhancedVcLogs, shouldCalculate3p, shouldCalculateDebugDetails, _window3, _window4, _window5, 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, _activeInteractionId$, activeInteractionId, activeInteraction, pageVisibilityUpToTTAI, isBackgrounded, _window7, _window7$__ufo_devtoo, _window9, _window9$__on_ufo_vc_;
111
111
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -258,7 +258,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
258
258
  try {
259
259
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
260
260
  _entry4 = _step6.value;
261
- if ('rect' in _entry4.data && !this.isEntryIncluded(_entry4, include3p)) {
261
+ if ('rect' in _entry4.data && !this.isEntryIncluded(_entry4, include3p, excludeSmartAnswersInSearch)) {
262
262
  viewportData = _entry4.data;
263
263
  timestamp = Math.round(_entry4.time);
264
264
  if (!ignoredEntriesByTime.has(timestamp)) {
@@ -365,7 +365,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
365
365
  }
366
366
  }, _callee, this, [[10, 22, 25, 28]]);
367
367
  }));
368
- function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9) {
368
+ function calculateWithDebugInfo(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0) {
369
369
  return _calculateWithDebugInfo.apply(this, arguments);
370
370
  }
371
371
  return calculateWithDebugInfo;
@@ -377,13 +377,13 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
377
377
  var _this = this,
378
378
  _vcDetails$90$t,
379
379
  _vcDetails$;
380
- var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
380
+ var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, excludeSmartAnswersInSearch, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
381
381
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
382
382
  while (1) switch (_context2.prev = _context2.next) {
383
383
  case 0:
384
- startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p;
384
+ startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p, excludeSmartAnswersInSearch = _ref.excludeSmartAnswersInSearch;
385
385
  filteredEntries = orderedEntries.filter(function (entry) {
386
- return _this.isEntryIncluded(entry, include3p);
386
+ return _this.isEntryIncluded(entry, include3p, excludeSmartAnswersInSearch);
387
387
  });
388
388
  getVCCleanStatusResult = this.getVCCleanStatus(filteredEntries);
389
389
  isVCClean = getVCCleanStatusResult.isVCClean;
@@ -401,7 +401,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
401
401
  });
402
402
  case 7:
403
403
  _context2.next = 9;
404
- return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries, include3p);
404
+ return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries, include3p, excludeSmartAnswersInSearch);
405
405
  case 9:
406
406
  vcDetails = _context2.sent;
407
407
  result = {
@@ -424,7 +424,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
424
424
  }
425
425
  }, _callee2, this);
426
426
  }));
427
- function calculate(_x0) {
427
+ function calculate(_x1) {
428
428
  return _calculate.apply(this, arguments);
429
429
  }
430
430
  return calculate;
@@ -7,6 +7,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
7
7
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import AbstractVCCalculatorBase from '../abstract-base-vc-calculator';
10
+ import { isEntrySmartAnswersInSearch } from '../utils/is-entry-smart-answers-in-search';
10
11
  import isViewportEntryData from '../utils/is-viewport-entry-data';
11
12
  var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
12
13
  var REVISION_NO = 'fy25.03';
@@ -44,10 +45,13 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
44
45
  _inherits(VCCalculator_FY25_03, _AbstractVCCalculator);
45
46
  return _createClass(VCCalculator_FY25_03, [{
46
47
  key: "isEntryIncluded",
47
- value: function isEntryIncluded(entry, include3p) {
48
+ value: function isEntryIncluded(entry, include3p, excludeSmartAnswersInSearch) {
48
49
  if (!getConsideredEntryTypes(include3p).includes(entry.data.type)) {
49
50
  return false;
50
51
  }
52
+ if (excludeSmartAnswersInSearch && isEntrySmartAnswersInSearch(entry)) {
53
+ return false;
54
+ }
51
55
  if (entry.data.type === 'mutation:attribute') {
52
56
  var entryData = entry.data;
53
57
  var attributeName = entryData.attributeName;
@@ -0,0 +1,21 @@
1
+ import { getDocument } from '@atlaskit/browser-apis';
2
+ export function isEntrySmartAnswersInSearch(entry) {
3
+ var _ref = entry.data,
4
+ elementName = _ref.elementName;
5
+ if (!elementName || elementName === 'START') {
6
+ return false;
7
+ }
8
+ var doc = getDocument();
9
+ if (!doc) {
10
+ return false;
11
+ }
12
+ var smartAnswersElement = doc.getElementById('search-page-smart-answers');
13
+ if (!smartAnswersElement) {
14
+ return false;
15
+ }
16
+ var entryDOMElement = doc.querySelector(elementName);
17
+ if (!entryDOMElement) {
18
+ return false;
19
+ }
20
+ return smartAnswersElement.contains(entryDOMElement);
21
+ }
@@ -150,6 +150,13 @@ export type Config = {
150
150
  * Whether ttvc with 3p measurement is enabled and sent new event for experiences with sample rates
151
151
  */
152
152
  readonly extraInteractionMetrics?: InteractionMetricsConfig;
153
+ /**
154
+ * Option to enable an additional metric to track search page load times with SAIN ignored
155
+ */
156
+ readonly extraSearchPageInteraction?: {
157
+ readonly enabled: boolean;
158
+ readonly searchPageMetricName: string;
159
+ };
153
160
  };
154
161
  export declare function setUFOConfig(newConfig: Config): void;
155
162
  export declare function getConfig(): Config | undefined;
@@ -0,0 +1,3 @@
1
+ import type { InteractionMetrics } from '../common';
2
+ export declare function sinkExtraSearchPageInteractionHandler(sinkFn: (interactionId: string, interaction: InteractionMetrics) => void | Promise<void>): void;
3
+ export declare function onSearchPageInteractionComplete(interactionId: string, data: InteractionMetrics): void;