@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
@@ -0,0 +1,36 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
+ import _get from "@babel/runtime/helpers/get";
6
+ import _inherits from "@babel/runtime/helpers/inherits";
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
10
+ import VCCalculator_FY25_03 from '../fy25_03';
11
+
12
+ // NOTE: `next` to be renamed `fy26.04` once stable
13
+ var REVISION_NO = 'next';
14
+ var getConsideredEntryTypes = function getConsideredEntryTypes() {
15
+ return ['mutation:display-contents-children-element'];
16
+ };
17
+
18
+ // NOTE: `VCNext` to be renamed `FY26_04` once stable
19
+ var VCNextCalculator = /*#__PURE__*/function (_VCCalculator_FY25_) {
20
+ function VCNextCalculator() {
21
+ _classCallCheck(this, VCNextCalculator);
22
+ return _callSuper(this, VCNextCalculator, [REVISION_NO]);
23
+ }
24
+ _inherits(VCNextCalculator, _VCCalculator_FY25_);
25
+ return _createClass(VCNextCalculator, [{
26
+ key: "isEntryIncluded",
27
+ value: function isEntryIncluded(entry, include3p) {
28
+ var isEntryIncludedInV3 = _superPropGet(VCNextCalculator, "isEntryIncluded", this, 3)([entry, include3p]);
29
+ if (isEntryIncludedInV3) {
30
+ return true;
31
+ }
32
+ return getConsideredEntryTypes().includes(entry.data.type);
33
+ }
34
+ }]);
35
+ }(VCCalculator_FY25_03);
36
+ export { VCNextCalculator as default };
@@ -117,7 +117,7 @@ var ViewportObserver = /*#__PURE__*/function () {
117
117
  _iterator = _createForOfIteratorHelper(addedNodes);
118
118
  _context2.prev = 4;
119
119
  _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
120
- var addedNodeRef, addedNode, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _checkWithinComponent, isWithinThirdPartySegment, _this$intersectionObs7, validTargets, _iterator2, _step2, _this$intersectionObs8, validTarget, _this$intersectionObs9;
120
+ var addedNodeRef, addedNode, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _checkWithinComponent, isWithinThirdPartySegment, _this$intersectionObs7, _window, _iterator2, _step2, child, _this$intersectionObs8, _this$intersectionObs9, validTargets, _iterator3, _step3, _this$intersectionObs0, validTarget, _this$intersectionObs1;
121
121
  return _regeneratorRuntime.wrap(function _loop$(_context) {
122
122
  while (1) switch (_context.prev = _context.next) {
123
123
  case 0:
@@ -229,25 +229,45 @@ var ViewportObserver = /*#__PURE__*/function () {
229
229
  (_this$intersectionObs7 = _this.intersectionObserver) === null || _this$intersectionObs7 === void 0 || _this$intersectionObs7.watchAndTag(addedNode, 'mutation:third-party-element');
230
230
  return _context.abrupt("return", 0);
231
231
  case 45:
232
- if (fg('platform_ufo_display_content_resolution_ttvc_v3')) {
233
- // Check if the target has display:content css property, return array of valid targets
234
- validTargets = checkCssProperty(addedNode);
235
- _iterator2 = _createForOfIteratorHelper(validTargets);
236
- try {
237
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
238
- validTarget = _step2.value;
239
- (_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(validTarget, createElementMutationsWatcher(removedNodeRects));
232
+ if (fg('platform_ufo_vcnext_v4_enabled')) {
233
+ if (((_window = window) === null || _window === void 0 || (_window = _window.getComputedStyle(addedNode)) === null || _window === void 0 ? void 0 : _window.display) === 'contents') {
234
+ _iterator2 = _createForOfIteratorHelper(addedNode.children);
235
+ try {
236
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
237
+ child = _step2.value;
238
+ if (child instanceof HTMLElement) {
239
+ (_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(child, 'mutation:display-contents-children-element');
240
+ }
241
+ }
242
+ } catch (err) {
243
+ _iterator2.e(err);
244
+ } finally {
245
+ _iterator2.f();
240
246
  }
241
- } catch (err) {
242
- _iterator2.e(err);
243
- } finally {
244
- _iterator2.f();
247
+ } else {
248
+ (_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
245
249
  }
246
250
  } else {
247
- if (fg('platform_ufo_display_content_track_occurrence')) {
248
- trackDisplayContentsOccurrence(addedNode);
251
+ if (fg('platform_ufo_display_content_resolution_ttvc_v3')) {
252
+ // Check if the target has display:content css property, return array of valid targets
253
+ validTargets = checkCssProperty(addedNode);
254
+ _iterator3 = _createForOfIteratorHelper(validTargets);
255
+ try {
256
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
257
+ validTarget = _step3.value;
258
+ (_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(validTarget, createElementMutationsWatcher(removedNodeRects));
259
+ }
260
+ } catch (err) {
261
+ _iterator3.e(err);
262
+ } finally {
263
+ _iterator3.f();
264
+ }
265
+ } else {
266
+ if (fg('platform_ufo_display_content_track_occurrence')) {
267
+ trackDisplayContentsOccurrence(addedNode);
268
+ }
269
+ (_this$intersectionObs1 = _this.intersectionObserver) === null || _this$intersectionObs1 === void 0 || _this$intersectionObs1.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
249
270
  }
250
- (_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects));
251
271
  }
252
272
  case 46:
253
273
  case "end":
@@ -294,12 +314,12 @@ var ViewportObserver = /*#__PURE__*/function () {
294
314
  };
295
315
  }());
296
316
  _defineProperty(this, "handleAttributeMutation", function (_ref6) {
297
- var _this$intersectionObs0;
317
+ var _this$intersectionObs10;
298
318
  var target = _ref6.target,
299
319
  attributeName = _ref6.attributeName,
300
320
  oldValue = _ref6.oldValue,
301
321
  newValue = _ref6.newValue;
302
- (_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(target, function (_ref7) {
322
+ (_this$intersectionObs10 = _this.intersectionObserver) === null || _this$intersectionObs10 === void 0 || _this$intersectionObs10.watchAndTag(target, function (_ref7) {
303
323
  var target = _ref7.target,
304
324
  rect = _ref7.rect;
305
325
  if (isContainedWithinMediaWrapper(target)) {
@@ -377,11 +397,11 @@ var ViewportObserver = /*#__PURE__*/function () {
377
397
  _defineProperty(this, "handleLayoutShift", function (_ref8) {
378
398
  var time = _ref8.time,
379
399
  changedRects = _ref8.changedRects;
380
- var _iterator3 = _createForOfIteratorHelper(changedRects),
381
- _step3;
400
+ var _iterator4 = _createForOfIteratorHelper(changedRects),
401
+ _step4;
382
402
  try {
383
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
384
- var changedRect = _step3.value;
403
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
404
+ var changedRect = _step4.value;
385
405
  var target = changedRect.node;
386
406
  if (target) {
387
407
  _this.onChange({
@@ -395,9 +415,9 @@ var ViewportObserver = /*#__PURE__*/function () {
395
415
  }
396
416
  }
397
417
  } catch (err) {
398
- _iterator3.e(err);
418
+ _iterator4.e(err);
399
419
  } finally {
400
- _iterator3.f();
420
+ _iterator4.f();
401
421
  }
402
422
  });
403
423
  this.mapVisibleNodeRects = new WeakMap();
@@ -454,12 +474,12 @@ var ViewportObserver = /*#__PURE__*/function () {
454
474
  }, {
455
475
  key: "stop",
456
476
  value: function stop() {
457
- var _this$mutationObserve2, _this$intersectionObs1, _this$performanceObse2;
477
+ var _this$mutationObserve2, _this$intersectionObs11, _this$performanceObse2;
458
478
  if (!this.isStarted) {
459
479
  return;
460
480
  }
461
481
  (_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
462
- (_this$intersectionObs1 = this.intersectionObserver) === null || _this$intersectionObs1 === void 0 || _this$intersectionObs1.disconnect();
482
+ (_this$intersectionObs11 = this.intersectionObserver) === null || _this$intersectionObs11 === void 0 || _this$intersectionObs11.disconnect();
463
483
  (_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
464
484
  this.isStarted = false;
465
485
  // Clean up caches when stopping
@@ -35,7 +35,7 @@ type SegmentThreshold = {
35
35
  type Rates = {
36
36
  readonly [key: string]: number;
37
37
  };
38
- export type TTVCRevision = 'fy25.01' | 'fy25.02' | 'fy25.03';
38
+ export type TTVCRevision = 'fy25.01' | 'fy25.02' | 'fy25.03' | 'next';
39
39
  export declare const DEFAULT_TTVC_REVISION = "fy25.03";
40
40
  export declare const UNKNOWN_INTERACTION_RATE = 1000;
41
41
  export type ReactHydrationStats = {
@@ -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;
@@ -91,7 +91,7 @@ declare function createInteractionExtraLogPayload(interactionId: string, interac
91
91
  abortedByInteractionName: string | undefined;
92
92
  end: number;
93
93
  start: number;
94
- 'metric:ttai:3p': number | undefined;
94
+ 'metric:ttai:3p': number;
95
95
  };
96
96
  'vc:effective:revision': string;
97
97
  };