@atlaskit/react-ufo 4.7.6 → 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 (65) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/create-extra-search-page-interaction-payload/index.js +50 -0
  3. package/dist/cjs/create-interaction-extra-metrics-payload/index.js +1 -1
  4. package/dist/cjs/create-payload/index.js +63 -0
  5. package/dist/cjs/create-payload/utils/get-vc-metrics.js +15 -12
  6. package/dist/cjs/interaction-metrics/index.js +15 -7
  7. package/dist/cjs/interaction-metrics-init/index.js +29 -2
  8. package/dist/cjs/vc/index.js +5 -4
  9. package/dist/cjs/vc/vc-observer-new/index.js +28 -4
  10. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +8 -8
  11. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +7 -3
  12. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js +27 -0
  13. package/dist/cjs/vc/vc-observer-new/metric-calculator/vcnext/index.js +41 -0
  14. package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +46 -26
  15. package/dist/es2019/create-extra-search-page-interaction-payload/index.js +32 -0
  16. package/dist/es2019/create-interaction-extra-metrics-payload/index.js +1 -1
  17. package/dist/es2019/create-payload/index.js +49 -0
  18. package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -2
  19. package/dist/es2019/interaction-metrics/index.js +15 -7
  20. package/dist/es2019/interaction-metrics-init/index.js +29 -2
  21. package/dist/es2019/vc/index.js +5 -3
  22. package/dist/es2019/vc/vc-observer-new/index.js +21 -2
  23. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +6 -5
  24. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +7 -3
  25. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js +22 -0
  26. package/dist/es2019/vc/vc-observer-new/metric-calculator/vcnext/index.js +21 -0
  27. package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +29 -14
  28. package/dist/esm/create-extra-search-page-interaction-payload/index.js +43 -0
  29. package/dist/esm/create-interaction-extra-metrics-payload/index.js +1 -1
  30. package/dist/esm/create-payload/index.js +62 -0
  31. package/dist/esm/create-payload/utils/get-vc-metrics.js +15 -12
  32. package/dist/esm/interaction-metrics/index.js +15 -7
  33. package/dist/esm/interaction-metrics-init/index.js +29 -2
  34. package/dist/esm/vc/index.js +5 -4
  35. package/dist/esm/vc/vc-observer-new/index.js +28 -4
  36. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +8 -8
  37. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +7 -3
  38. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.js +21 -0
  39. package/dist/esm/vc/vc-observer-new/metric-calculator/vcnext/index.js +36 -0
  40. package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +46 -26
  41. package/dist/types/config/index.d.ts +8 -1
  42. package/dist/types/create-extra-search-page-interaction-payload/index.d.ts +3 -0
  43. package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +1 -1
  44. package/dist/types/create-payload/index.d.ts +25434 -0
  45. package/dist/types/create-payload/utils/get-vc-metrics.d.ts +1 -1
  46. package/dist/types/vc/types.d.ts +1 -0
  47. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
  48. package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +2 -2
  49. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  50. package/dist/types/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.d.ts +2 -0
  51. package/dist/types/vc/vc-observer-new/metric-calculator/vcnext/index.d.ts +6 -0
  52. package/dist/types/vc/vc-observer-new/types.d.ts +2 -1
  53. package/dist/types-ts4.5/config/index.d.ts +8 -1
  54. package/dist/types-ts4.5/create-extra-search-page-interaction-payload/index.d.ts +3 -0
  55. package/dist/types-ts4.5/create-interaction-extra-metrics-payload/index.d.ts +1 -1
  56. package/dist/types-ts4.5/create-payload/index.d.ts +25434 -0
  57. package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +1 -1
  58. package/dist/types-ts4.5/vc/types.d.ts +1 -0
  59. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
  60. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +2 -2
  61. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  62. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/is-entry-smart-answers-in-search.d.ts +2 -0
  63. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/vcnext/index.d.ts +6 -0
  64. package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +2 -1
  65. package/package.json +7 -1
@@ -187,19 +187,34 @@ export default class ViewportObserver {
187
187
  (_this$intersectionObs7 = this.intersectionObserver) === null || _this$intersectionObs7 === void 0 ? void 0 : _this$intersectionObs7.watchAndTag(addedNode, 'mutation:third-party-element');
188
188
  continue;
189
189
  }
190
- if (fg('platform_ufo_display_content_resolution_ttvc_v3')) {
191
- // Check if the target has display:content css property, return array of valid targets
192
- const validTargets = checkCssProperty(addedNode);
193
- for (const validTarget of validTargets) {
194
- var _this$intersectionObs8;
195
- (_this$intersectionObs8 = this.intersectionObserver) === null || _this$intersectionObs8 === void 0 ? void 0 : _this$intersectionObs8.watchAndTag(validTarget, createElementMutationsWatcher(removedNodeRects));
190
+ if (fg('platform_ufo_vcnext_v4_enabled')) {
191
+ var _window, _window$getComputedSt;
192
+ if (((_window = window) === null || _window === void 0 ? void 0 : (_window$getComputedSt = _window.getComputedStyle(addedNode)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.display) === 'contents') {
193
+ for (const child of addedNode.children) {
194
+ if (child instanceof HTMLElement) {
195
+ var _this$intersectionObs8;
196
+ (_this$intersectionObs8 = this.intersectionObserver) === null || _this$intersectionObs8 === void 0 ? void 0 : _this$intersectionObs8.watchAndTag(child, 'mutation:display-contents-children-element');
197
+ }
198
+ }
199
+ } else {
200
+ var _this$intersectionObs9;
201
+ (_this$intersectionObs9 = this.intersectionObserver) === null || _this$intersectionObs9 === void 0 ? void 0 : _this$intersectionObs9.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
196
202
  }
197
203
  } else {
198
- var _this$intersectionObs9;
199
- if (fg('platform_ufo_display_content_track_occurrence')) {
200
- trackDisplayContentsOccurrence(addedNode);
204
+ if (fg('platform_ufo_display_content_resolution_ttvc_v3')) {
205
+ // Check if the target has display:content css property, return array of valid targets
206
+ const validTargets = checkCssProperty(addedNode);
207
+ for (const validTarget of validTargets) {
208
+ var _this$intersectionObs0;
209
+ (_this$intersectionObs0 = this.intersectionObserver) === null || _this$intersectionObs0 === void 0 ? void 0 : _this$intersectionObs0.watchAndTag(validTarget, createElementMutationsWatcher(removedNodeRects));
210
+ }
211
+ } else {
212
+ var _this$intersectionObs1;
213
+ if (fg('platform_ufo_display_content_track_occurrence')) {
214
+ trackDisplayContentsOccurrence(addedNode);
215
+ }
216
+ (_this$intersectionObs1 = this.intersectionObserver) === null || _this$intersectionObs1 === void 0 ? void 0 : _this$intersectionObs1.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
201
217
  }
202
- (_this$intersectionObs9 = this.intersectionObserver) === null || _this$intersectionObs9 === void 0 ? void 0 : _this$intersectionObs9.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
203
218
  }
204
219
  }
205
220
  });
@@ -209,8 +224,8 @@ export default class ViewportObserver {
209
224
  oldValue,
210
225
  newValue
211
226
  }) => {
212
- var _this$intersectionObs0;
213
- (_this$intersectionObs0 = this.intersectionObserver) === null || _this$intersectionObs0 === void 0 ? void 0 : _this$intersectionObs0.watchAndTag(target, ({
227
+ var _this$intersectionObs10;
228
+ (_this$intersectionObs10 = this.intersectionObserver) === null || _this$intersectionObs10 === void 0 ? void 0 : _this$intersectionObs10.watchAndTag(target, ({
214
229
  target,
215
230
  rect
216
231
  }) => {
@@ -352,12 +367,12 @@ export default class ViewportObserver {
352
367
  this.isStarted = true;
353
368
  }
354
369
  stop() {
355
- var _this$mutationObserve2, _this$intersectionObs1, _this$performanceObse2;
370
+ var _this$mutationObserve2, _this$intersectionObs11, _this$performanceObse2;
356
371
  if (!this.isStarted) {
357
372
  return;
358
373
  }
359
374
  (_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 ? void 0 : _this$mutationObserve2.disconnect();
360
- (_this$intersectionObs1 = this.intersectionObserver) === null || _this$intersectionObs1 === void 0 ? void 0 : _this$intersectionObs1.disconnect();
375
+ (_this$intersectionObs11 = this.intersectionObserver) === null || _this$intersectionObs11 === void 0 ? void 0 : _this$intersectionObs11.disconnect();
361
376
  (_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 ? void 0 : _this$performanceObse2.disconnect();
362
377
  this.isStarted = false;
363
378
  // Clean up caches when stopping
@@ -0,0 +1,43 @@
1
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
3
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
+ var interactionBuffer = [];
5
+ var bufferInteractionData = function bufferInteractionData(interactionId, data) {
6
+ interactionBuffer.push({
7
+ interactionId: interactionId,
8
+ data: data
9
+ });
10
+ };
11
+ function clearInteractionBuffer() {
12
+ interactionBuffer.length = 0;
13
+ }
14
+ function appendInteractionData(interactionId, data) {
15
+ bufferInteractionData(interactionId, data);
16
+ }
17
+ function installInteractionSink(handler) {
18
+ var _iterator = _createForOfIteratorHelper(interactionBuffer),
19
+ _step;
20
+ try {
21
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
22
+ var _step$value = _step.value,
23
+ _interactionId = _step$value.interactionId,
24
+ data = _step$value.data;
25
+ handler(_interactionId, data);
26
+ }
27
+ } catch (err) {
28
+ _iterator.e(err);
29
+ } finally {
30
+ _iterator.f();
31
+ }
32
+ clearInteractionBuffer();
33
+ bufferInteractionData = handler;
34
+ }
35
+ export function sinkExtraSearchPageInteractionHandler(sinkFn) {
36
+ installInteractionSink(sinkFn);
37
+ }
38
+ export function onSearchPageInteractionComplete(interactionId, data) {
39
+ if (data.ufoName) {
40
+ appendInteractionData(interactionId, data);
41
+ clearInteractionBuffer();
42
+ }
43
+ }
@@ -72,7 +72,7 @@ function _createInteractionExtraLogPayload() {
72
72
  var revision = _ref.revision;
73
73
  return revision === DEFAULT_TTVC_REVISION;
74
74
  });
75
- if (!(!(effectiveVCRevisionPayload !== null && effectiveVCRevisionPayload !== void 0 && effectiveVCRevisionPayload.clean) || (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined)) {
75
+ if (!(!(effectiveVCRevisionPayload !== null && effectiveVCRevisionPayload !== void 0 && effectiveVCRevisionPayload.clean) || (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number' || extraTTAI === undefined || typeof extraTTAI !== 'number' || interaction.errors.length > 0)) {
76
76
  _context.next = 23;
77
77
  break;
78
78
  }
@@ -696,4 +696,66 @@ function _createExperimentalMetricsPayload() {
696
696
  }, _callee3);
697
697
  }));
698
698
  return _createExperimentalMetricsPayload.apply(this, arguments);
699
+ }
700
+ export function createExtraSearchPageInteractionPayload(_x0, _x1) {
701
+ return _createExtraSearchPageInteractionPayload.apply(this, arguments);
702
+ }
703
+ function _createExtraSearchPageInteractionPayload() {
704
+ _createExtraSearchPageInteractionPayload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(interactionId, interaction) {
705
+ var SAIN_HOLD_NAMES, NAME_OVERRIDE, SEARCH_PAGE_SMART_ANSWERS_SEGMENT_LABEL, newInteractionId, newEnd, holdInfo, reactProfilerTimings, lastHold, isLastHoldSAIN, lastFilteredTime, filteredReactProfilerTimings, lastTiming, modifiedInteraction, payloads, vcMetrics, interactionMetricsPayload;
706
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
707
+ while (1) switch (_context4.prev = _context4.next) {
708
+ case 0:
709
+ SAIN_HOLD_NAMES = ['search-ai-dialog-visible-text-loading', 'search-ai-dialog-all-text-loading'];
710
+ NAME_OVERRIDE = 'search-page-ignoring-smart-answers';
711
+ SEARCH_PAGE_SMART_ANSWERS_SEGMENT_LABEL = 'search-page-smart-answers';
712
+ newInteractionId = "".concat(interactionId, "-ignoring-smart-answers"); // Calculate a new end time which excludes SAIN holds
713
+ holdInfo = interaction.holdInfo, reactProfilerTimings = interaction.reactProfilerTimings;
714
+ lastHold = holdInfo.at(-1);
715
+ isLastHoldSAIN = Boolean(lastHold && SAIN_HOLD_NAMES.includes(lastHold.name)); // A new end time is only calculated if the last hold is a SAIN hold
716
+ if (isLastHoldSAIN) {
717
+ lastFilteredTime = null;
718
+ filteredReactProfilerTimings = reactProfilerTimings.filter(function (timing) {
719
+ if (timing.commitTime === lastFilteredTime) {
720
+ return false;
721
+ }
722
+ var isTimingSmartAnswersInSearch = timing.labelStack.some(function (label) {
723
+ return label.name === SEARCH_PAGE_SMART_ANSWERS_SEGMENT_LABEL;
724
+ });
725
+ if (isTimingSmartAnswersInSearch) {
726
+ lastFilteredTime = timing.commitTime;
727
+ return false;
728
+ }
729
+ return true;
730
+ });
731
+ lastTiming = filteredReactProfilerTimings.at(-1);
732
+ if (lastTiming) {
733
+ newEnd = lastTiming.commitTime;
734
+ }
735
+ }
736
+ modifiedInteraction = _objectSpread(_objectSpread({}, interaction), {}, {
737
+ end: newEnd !== null && newEnd !== void 0 ? newEnd : interaction.end,
738
+ holdInfo: [],
739
+ knownSegments: [],
740
+ reactProfilerTimings: [],
741
+ ufoName: NAME_OVERRIDE
742
+ });
743
+ payloads = [];
744
+ _context4.next = 12;
745
+ return getVCMetrics(interaction, false, true);
746
+ case 12:
747
+ vcMetrics = _context4.sent;
748
+ _context4.next = 15;
749
+ return createInteractionMetricsPayload(modifiedInteraction, newInteractionId, undefined, undefined, vcMetrics);
750
+ case 15:
751
+ interactionMetricsPayload = _context4.sent;
752
+ payloads.push(interactionMetricsPayload);
753
+ return _context4.abrupt("return", payloads.filter(Boolean));
754
+ case 18:
755
+ case "end":
756
+ return _context4.stop();
757
+ }
758
+ }, _callee4);
759
+ }));
760
+ return _createExtraSearchPageInteractionPayload.apply(this, arguments);
699
761
  }
@@ -15,6 +15,7 @@ function _getVCMetrics() {
15
15
  _getVCMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
16
16
  var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$vc2, _config$vc3, _result$ufoVcRev;
17
17
  var include3p,
18
+ excludeSmartAnswersInSearch,
18
19
  config,
19
20
  interactionStatus,
20
21
  pageVisibilityUpToTTAI,
@@ -32,29 +33,30 @@ function _getVCMetrics() {
32
33
  while (1) switch (_context.prev = _context.next) {
33
34
  case 0:
34
35
  include3p = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
36
+ excludeSmartAnswersInSearch = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
35
37
  config = getConfig();
36
38
  if (config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
37
- _context.next = 4;
39
+ _context.next = 5;
38
40
  break;
39
41
  }
40
42
  return _context.abrupt("return", {});
41
- case 4:
43
+ case 5:
42
44
  if (!(interaction.type !== 'page_load' && interaction.type !== 'transition' && interaction.type !== 'press')) {
43
- _context.next = 6;
45
+ _context.next = 7;
44
46
  break;
45
47
  }
46
48
  return _context.abrupt("return", {});
47
- case 6:
49
+ case 7:
48
50
  interactionStatus = getInteractionStatus(interaction);
49
51
  pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
50
52
  shouldReportVCMetrics = interactionStatus.originalInteractionStatus === 'SUCCEEDED' && pageVisibilityUpToTTAI === 'visible'; // Use per-interaction VC observer if available, otherwise fall back to global
51
53
  observer = interaction.vcObserver;
52
54
  if (observer) {
53
- _context.next = 12;
55
+ _context.next = 13;
54
56
  break;
55
57
  }
56
58
  return _context.abrupt("return", {});
57
- case 12:
59
+ case 13:
58
60
  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)));
59
61
  ssr = interaction.type === 'page_load' && isSSREnabled ? {
60
62
  ssr: getSSRDoneTimeValue(config)
@@ -62,7 +64,7 @@ function _getVCMetrics() {
62
64
  postInteractionLog.setVCObserverSSRConfig(ssr);
63
65
  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;
64
66
  prefix = 'ufo';
65
- _context.next = 19;
67
+ _context.next = 20;
66
68
  return observer.getVCResult(_objectSpread(_objectSpread({
67
69
  start: interaction.start,
68
70
  stop: interaction.end,
@@ -75,9 +77,10 @@ function _getVCMetrics() {
75
77
  interactionId: interaction.id,
76
78
  includeSSRRatio: (_config$vc3 = config.vc) === null || _config$vc3 === void 0 ? void 0 : _config$vc3.includeSSRRatio
77
79
  }, ssr), {}, {
78
- include3p: include3p
80
+ include3p: include3p,
81
+ excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
79
82
  }));
80
- case 19:
83
+ case 20:
81
84
  result = _context.sent;
82
85
  observer.stop(interaction.ufoName);
83
86
  if (!include3p) {
@@ -90,15 +93,15 @@ function _getVCMetrics() {
90
93
  return revision === mostRecentVCRevision;
91
94
  });
92
95
  if (!(!shouldReportVCMetrics || !(mostRecentVCRevisionPayload !== null && mostRecentVCRevisionPayload !== void 0 && mostRecentVCRevisionPayload.clean))) {
93
- _context.next = 26;
96
+ _context.next = 27;
94
97
  break;
95
98
  }
96
99
  return _context.abrupt("return", result);
97
- case 26:
100
+ case 27:
98
101
  return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
99
102
  'metric:vc90': mostRecentVCRevisionPayload['metric:vc90']
100
103
  }));
101
- case 27:
104
+ case 28:
102
105
  case "end":
103
106
  return _context.stop();
104
107
  }
@@ -13,6 +13,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
13
13
  import coinflip from '../coinflip';
14
14
  import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getExtraInteractionRate, getFinishInteractionOnTransition, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
15
15
  import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
16
+ import { onSearchPageInteractionComplete } from '../create-extra-search-page-interaction-payload';
16
17
  import { sanitizeUfoName, stringifyLabelStackFully } from '../create-payload/common/utils';
17
18
  import { clearActiveTrace } from '../experience-trace-id-context';
18
19
  import { allFeatureFlagsAccessed, currentFeatureFlagsAccessed } from '../feature-flags-accessed';
@@ -835,16 +836,19 @@ export function tryComplete(interactionId, endTime) {
835
836
  if (noMoreActiveHolds && interactionExtraMetrics.finishedInteractionId !== interactionId) {
836
837
  // If it's not waiting for extra metrics to complete, finish the interaction as normal
837
838
  if (!activeSubmitted) {
838
- var _getConfig1;
839
+ var _getConfig1, _getConfig10, _getConfig11;
839
840
  finishInteraction(interactionId, interaction, endTime);
840
841
  if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.extraInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
841
842
  interactionExtraMetrics.updateFinishedInteractionId(interactionId);
842
843
  }
844
+ if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10 !== void 0 && _getConfig10.enabled && interaction.ufoName === ((_getConfig11 = getConfig()) === null || _getConfig11 === void 0 || (_getConfig11 = _getConfig11.extraSearchPageInteraction) === null || _getConfig11 === void 0 ? void 0 : _getConfig11.searchPageMetricName) && fg('react_ufo_unified_search_ignoring_sain_metric')) {
845
+ onSearchPageInteractionComplete(interactionId, interaction);
846
+ }
843
847
  activeSubmitted = true;
844
848
  }
845
849
  if (noMoreExpHolds) {
846
- var _getConfig10;
847
- if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.experimentalInteractionMetrics) !== null && _getConfig10 !== void 0 && _getConfig10.enabled) {
850
+ var _getConfig12;
851
+ if ((_getConfig12 = getConfig()) !== null && _getConfig12 !== void 0 && (_getConfig12 = _getConfig12.experimentalInteractionMetrics) !== null && _getConfig12 !== void 0 && _getConfig12.enabled) {
848
852
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
849
853
  }
850
854
  postInteraction();
@@ -859,12 +863,16 @@ export function tryComplete(interactionId, endTime) {
859
863
  } else {
860
864
  if (noMoreActiveHolds) {
861
865
  if (!activeSubmitted) {
866
+ var _getConfig13, _getConfig14;
862
867
  finishInteraction(interactionId, interaction, endTime);
868
+ if ((_getConfig13 = getConfig()) !== null && _getConfig13 !== void 0 && (_getConfig13 = _getConfig13.extraSearchPageInteraction) !== null && _getConfig13 !== void 0 && _getConfig13.enabled && interaction.ufoName === ((_getConfig14 = getConfig()) === null || _getConfig14 === void 0 || (_getConfig14 = _getConfig14.extraSearchPageInteraction) === null || _getConfig14 === void 0 ? void 0 : _getConfig14.searchPageMetricName) && fg('react_ufo_unified_search_ignoring_sain_metric')) {
869
+ onSearchPageInteractionComplete(interactionId, interaction);
870
+ }
863
871
  activeSubmitted = true;
864
872
  }
865
873
  if (noMoreExpHolds) {
866
- var _getConfig11;
867
- if ((_getConfig11 = getConfig()) !== null && _getConfig11 !== void 0 && (_getConfig11 = _getConfig11.experimentalInteractionMetrics) !== null && _getConfig11 !== void 0 && _getConfig11.enabled) {
874
+ var _getConfig15;
875
+ if ((_getConfig15 = getConfig()) !== null && _getConfig15 !== void 0 && (_getConfig15 = _getConfig15.experimentalInteractionMetrics) !== null && _getConfig15 !== void 0 && _getConfig15.enabled) {
868
876
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
869
877
  }
870
878
  postInteraction();
@@ -1061,7 +1069,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
1061
1069
  addHoldByID(interactionId, [], ufoName, ufoName, true);
1062
1070
  }
1063
1071
  if (type === 'transition' || type === 'page_load') {
1064
- var _getConfig12, _config$extraInteract;
1072
+ var _getConfig16, _config$extraInteract;
1065
1073
  // Use per-interaction VC observer if available, otherwise fall back to global
1066
1074
  var observer = vcObserver;
1067
1075
  if (observer) {
@@ -1072,7 +1080,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
1072
1080
  }
1073
1081
  // Start post interaction observer for all if config is enabled
1074
1082
  // in case ufoName is updated at later time
1075
- if ((_getConfig12 = getConfig()) !== null && _getConfig12 !== void 0 && (_getConfig12 = _getConfig12.postInteractionLog) !== null && _getConfig12 !== void 0 && _getConfig12.enabled) {
1083
+ if ((_getConfig16 = getConfig()) !== null && _getConfig16 !== void 0 && (_getConfig16 = _getConfig16.postInteractionLog) !== null && _getConfig16 !== void 0 && _getConfig16.enabled) {
1076
1084
  postInteractionLog.startVCObserver({
1077
1085
  startTime: startTime
1078
1086
  });
@@ -5,6 +5,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
5
5
  import { startLighthouseObserver } from '../additional-payload';
6
6
  import { setUFOConfig } from '../config';
7
7
  import { experimentalVC, sinkExperimentalHandler } from '../create-experimental-interaction-metrics-payload';
8
+ import { sinkExtraSearchPageInteractionHandler } from '../create-extra-search-page-interaction-payload';
8
9
  import { setupHiddenTimingCapture } from '../hidden-timing';
9
10
  import { interactionExtraMetrics, postInteractionLog, sinkInteractionHandler, sinkPostInteractionLogHandler } from '../interaction-metrics';
10
11
  import { getPerformanceObserver } from '../interactions-performance-observer';
@@ -101,6 +102,26 @@ function sinkInteractionExtraMetrics(instance, createInteractionExtraLogPayload)
101
102
  })));
102
103
  });
103
104
  }
105
+ function sinkExtraSearchPageInteraction(instance, payloadPackage) {
106
+ function sinkFn(interactionId, interaction) {
107
+ function onIdle() {
108
+ payloadPackage.createExtraSearchPageInteractionPayload(interactionId, interaction).then(function (payloads) {
109
+ // NOTE: This API is used by the UFO DevTool Chrome Extension and Criterion
110
+ var devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
111
+ payloads === null || payloads === void 0 || payloads.forEach(function (payload) {
112
+ if (typeof devToolObserver === 'function') {
113
+ devToolObserver === null || devToolObserver === void 0 || devToolObserver(payload);
114
+ }
115
+ instance.sendOperationalEvent(payload);
116
+ });
117
+ }).catch(function (error) {
118
+ throw error;
119
+ });
120
+ }
121
+ scheduleIdleCallback(onIdle);
122
+ }
123
+ sinkExtraSearchPageInteractionHandler(sinkFn);
124
+ }
104
125
  export function init(analyticsWebClientAsync, config) {
105
126
  var _config$vc;
106
127
  if (initialized) {
@@ -149,7 +170,7 @@ export function init(analyticsWebClientAsync, config) {
149
170
  createInteractionExtraMetricsPayloadPackage = _ref3[3];
150
171
  if (awc.getAnalyticsWebClientPromise) {
151
172
  awc.getAnalyticsWebClientPromise().then(function (client) {
152
- var _config$experimentalI2, _config$postInteracti, _config$extraInteract2;
173
+ var _config$experimentalI2, _config$postInteracti, _config$extraInteract2, _config$extraSearchPa;
153
174
  var instance = client.getInstance();
154
175
  sinkInteraction(instance, payloadPackage);
155
176
  if (config !== null && config !== void 0 && (_config$experimentalI2 = config.experimentalInteractionMetrics) !== null && _config$experimentalI2 !== void 0 && _config$experimentalI2.enabled) {
@@ -161,9 +182,12 @@ export function init(analyticsWebClientAsync, config) {
161
182
  if (config !== null && config !== void 0 && (_config$extraInteract2 = config.extraInteractionMetrics) !== null && _config$extraInteract2 !== void 0 && _config$extraInteract2.enabled && fg('platform_ufo_enable_ttai_with_3p')) {
162
183
  sinkInteractionExtraMetrics(instance, createInteractionExtraMetricsPayloadPackage.default);
163
184
  }
185
+ if (config !== null && config !== void 0 && (_config$extraSearchPa = config.extraSearchPageInteraction) !== null && _config$extraSearchPa !== void 0 && _config$extraSearchPa.enabled && fg('react_ufo_unified_search_ignoring_sain_metric')) {
186
+ sinkExtraSearchPageInteraction(instance, payloadPackage);
187
+ }
164
188
  });
165
189
  } else if (awc.sendOperationalEvent) {
166
- var _config$experimentalI3, _config$postInteracti2, _config$extraInteract3;
190
+ var _config$experimentalI3, _config$postInteracti2, _config$extraInteract3, _config$extraSearchPa2;
167
191
  sinkInteraction(awc, payloadPackage);
168
192
  if (config !== null && config !== void 0 && (_config$experimentalI3 = config.experimentalInteractionMetrics) !== null && _config$experimentalI3 !== void 0 && _config$experimentalI3.enabled) {
169
193
  sinkExperimentalInteractionMetrics(awc, payloadPackage);
@@ -174,6 +198,9 @@ export function init(analyticsWebClientAsync, config) {
174
198
  if (config !== null && config !== void 0 && (_config$extraInteract3 = config.extraInteractionMetrics) !== null && _config$extraInteract3 !== void 0 && _config$extraInteract3.enabled && fg('platform_ufo_enable_ttai_with_3p')) {
175
199
  sinkInteractionExtraMetrics(awc, createInteractionExtraMetricsPayloadPackage.default);
176
200
  }
201
+ if (config !== null && config !== void 0 && (_config$extraSearchPa2 = config.extraSearchPageInteraction) !== null && _config$extraSearchPa2 !== void 0 && _config$extraSearchPa2.enabled) {
202
+ sinkExtraSearchPageInteraction(awc, payloadPackage);
203
+ }
177
204
  }
178
205
  });
179
206
  }
@@ -25,7 +25,7 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
25
25
  this.ssrPlaceholderHandler = new SSRPlaceholderHandlers({
26
26
  enablePageLayoutPlaceholder: (_opts$ssrEnablePageLa = opts.ssrEnablePageLayoutPlaceholder) !== null && _opts$ssrEnablePageLa !== void 0 ? _opts$ssrEnablePageLa : false
27
27
  });
28
- if (isVCRevisionEnabled('fy25.03')) {
28
+ if (isVCRevisionEnabled('fy25.03') || isVCRevisionEnabled('next')) {
29
29
  var _opts$ssrEnablePageLa2;
30
30
  this.newVCObserver = new VCObserverNew({
31
31
  selectorConfig: opts.selectorConfig,
@@ -112,11 +112,11 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
112
112
  value: function () {
113
113
  var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
114
114
  var _this$oldVCObserver4, _this$newVCObserver3, _ref2;
115
- var experienceKey, include3p, v1v2Result, v3Result;
115
+ var experienceKey, include3p, excludeSmartAnswersInSearch, v1v2Result, v3Result;
116
116
  return _regeneratorRuntime.wrap(function _callee$(_context) {
117
117
  while (1) switch (_context.prev = _context.next) {
118
118
  case 0:
119
- experienceKey = param.experienceKey, include3p = param.include3p;
119
+ experienceKey = param.experienceKey, include3p = param.include3p, excludeSmartAnswersInSearch = param.excludeSmartAnswersInSearch;
120
120
  if (!(isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey))) {
121
121
  _context.next = 7;
122
122
  break;
@@ -141,7 +141,8 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
141
141
  stop: param.stop,
142
142
  interactionId: param.interactionId,
143
143
  ssr: param.includeSSRInV3 ? param.ssr : undefined,
144
- include3p: include3p
144
+ include3p: include3p,
145
+ excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
145
146
  });
146
147
  case 12:
147
148
  _context.t1 = _context.sent;
@@ -12,6 +12,7 @@ import _getElementName from './get-element-name';
12
12
  import VCCalculator_FY25_03 from './metric-calculator/fy25_03';
13
13
  import getViewportHeight from './metric-calculator/utils/get-viewport-height';
14
14
  import getViewportWidth from './metric-calculator/utils/get-viewport-width';
15
+ import VCNextCalculator from './metric-calculator/vcnext';
15
16
  import ViewportObserver from './viewport-observer';
16
17
  import WindowEventObserver from './window-event-observer';
17
18
  var SSRState = {
@@ -230,11 +231,11 @@ var VCObserverNew = /*#__PURE__*/function () {
230
231
  key: "getVCResult",
231
232
  value: function () {
232
233
  var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
233
- var start, stop, interactionId, include3p, results, calculator_fy25_03, orderedEntries, fy25_03;
234
+ var start, stop, interactionId, include3p, excludeSmartAnswersInSearch, results, calculator_fy25_03, orderedEntries, fy25_03, calculator_next, vcNext;
234
235
  return _regeneratorRuntime.wrap(function _callee$(_context) {
235
236
  while (1) switch (_context.prev = _context.next) {
236
237
  case 0:
237
- 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;
238
239
  results = [];
239
240
  this.addStartEntry(start);
240
241
  calculator_fy25_03 = new VCCalculator_FY25_03();
@@ -252,15 +253,38 @@ var VCObserverNew = /*#__PURE__*/function () {
252
253
  stopTime: stop,
253
254
  interactionId: interactionId,
254
255
  isPostInteraction: this.isPostInteraction,
255
- include3p: include3p
256
+ include3p: include3p,
257
+ excludeSmartAnswersInSearch: excludeSmartAnswersInSearch
256
258
  });
257
259
  case 8:
258
260
  fy25_03 = _context.sent;
259
261
  if (fy25_03) {
260
262
  results.push(fy25_03);
261
263
  }
264
+
265
+ // TODO on cleanup: put behind `enabledVCRevisions` config
266
+ if (!fg('platform_ufo_vcnext_v4_enabled')) {
267
+ _context.next = 16;
268
+ break;
269
+ }
270
+ calculator_next = new VCNextCalculator();
271
+ _context.next = 14;
272
+ return calculator_next.calculate({
273
+ orderedEntries: orderedEntries,
274
+ startTime: start,
275
+ stopTime: stop,
276
+ interactionId: interactionId,
277
+ isPostInteraction: this.isPostInteraction,
278
+ include3p: include3p
279
+ });
280
+ case 14:
281
+ vcNext = _context.sent;
282
+ if (vcNext) {
283
+ results.push(vcNext);
284
+ }
285
+ case 16:
262
286
  return _context.abrupt("return", results);
263
- case 11:
287
+ case 17:
264
288
  case "end":
265
289
  return _context.stop();
266
290
  }
@@ -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';
@@ -37,17 +38,20 @@ export var THIRD_PARTY_BROWSER_EXTENSION_ATTRIBUTES = ['bis_skin_checked', 'cz-s
37
38
  // grammarly extensions
38
39
  'data-new-gr-c-s-loaded', 'data-gr-aaa-notch-connection-id', 'data-gr-aaa-loaded'];
39
40
  var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
40
- function VCCalculator_FY25_03() {
41
+ function VCCalculator_FY25_03(revisionNo) {
41
42
  _classCallCheck(this, VCCalculator_FY25_03);
42
- return _callSuper(this, VCCalculator_FY25_03, [REVISION_NO]);
43
+ return _callSuper(this, VCCalculator_FY25_03, [revisionNo !== null && revisionNo !== void 0 ? revisionNo : REVISION_NO]);
43
44
  }
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
+ }