@atlaskit/react-ufo 5.5.0 → 5.5.2

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.
@@ -12,7 +12,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
12
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
13
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
14
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _percentileCalc = require("./percentile-calc");
17
16
  var _detectLayoutShiftCause = require("./utils/detect-layout-shift-cause");
18
17
  var _getViewportHeight = _interopRequireDefault(require("./utils/get-viewport-height"));
@@ -253,7 +252,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
253
252
  viewportPercentage: log.viewportPercentage
254
253
  });
255
254
  }) : []; // If 3p metric enabled - calculate the debug details
256
- shouldCalculate3p = include3p && (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p'); // Only calculate enhanced debug details if devtool callbacks exist
255
+ shouldCalculate3p = include3p; // Only calculate enhanced debug details if devtool callbacks exist
257
256
  shouldCalculateDebugDetails = !isPostInteraction && (typeof ((_window = window) === null || _window === void 0 ? void 0 : _window.__ufo_devtool_onVCRevisionReady__) === 'function' || typeof ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.__on_ufo_vc_debug_data_ready) === 'function' || typeof ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.__ufo_devtool_vc_3p_debug_data) === 'function');
258
257
  if (shouldCalculateDebugDetails && allEntries && vcLogs) {
259
258
  // Pre-sort vcLogs by time for efficient lookups
@@ -366,22 +366,20 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
366
366
  }
367
367
  };
368
368
  }
369
- if ((0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_attribute_changes')) {
370
- var _ref0 = _this.enableThirdPartyTracking ? (0, _checkWithinComponent.default)(target, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
371
- isWithin: false
372
- },
373
- isWithinThirdPartySegment = _ref0.isWithin;
374
- if (isWithinThirdPartySegment) {
375
- return {
376
- type: 'mutation:third-party-attribute',
377
- mutationData: {
378
- attributeName: attributeName,
379
- oldValue: oldValue,
380
- newValue: newValue,
381
- timestamp: timestamp
382
- }
383
- };
384
- }
369
+ var _ref0 = _this.enableThirdPartyTracking ? (0, _checkWithinComponent.default)(target, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
370
+ isWithin: false
371
+ },
372
+ isWithinThirdPartySegment = _ref0.isWithin;
373
+ if (isWithinThirdPartySegment) {
374
+ return {
375
+ type: 'mutation:third-party-attribute',
376
+ mutationData: {
377
+ attributeName: attributeName,
378
+ oldValue: oldValue,
379
+ newValue: newValue,
380
+ timestamp: timestamp
381
+ }
382
+ };
385
383
  }
386
384
  if (_this.shouldCheckSmartAnswersMutations() && (0, _isContainedWithinSmartAnswers.isContainedWithinSmartAnswers)(target)) {
387
385
  return {
@@ -316,7 +316,7 @@ function removeHoldCriterion(id) {
316
316
  }
317
317
  window.__CRITERION__.removeUFOHold(id);
318
318
  }
319
- export function addHold(interactionId, labelStack, name, experimental) {
319
+ export function addHold(interactionId, labelStack, name, _experimental) {
320
320
  const interaction = interactions.get(interactionId);
321
321
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
322
322
  const id = createUUID();
@@ -331,37 +331,20 @@ export function addHold(interactionId, labelStack, name, experimental) {
331
331
  name,
332
332
  start
333
333
  };
334
- if (fg('platform_ufo_enable_ttai_with_3p')) {
335
- const is3pHold = labelStack.some(l => 'type' in l && l.type === 'third-party');
336
- if (is3pHold) {
337
- if (!interaction.hold3pActive) {
338
- interaction.hold3pActive = new Map();
339
- }
340
- interaction.hold3pActive.set(id, {
341
- ...holdActive,
342
- start
343
- });
344
- } else {
345
- interaction.holdActive.set(id, {
346
- ...holdActive,
347
- start
348
- });
349
- addHoldCriterion(id, labelStack, name, start);
334
+ const is3pHold = labelStack.some(l => 'type' in l && l.type === 'third-party');
335
+ if (is3pHold) {
336
+ if (!interaction.hold3pActive) {
337
+ interaction.hold3pActive = new Map();
350
338
  }
339
+ interaction.hold3pActive.set(id, {
340
+ ...holdActive,
341
+ start
342
+ });
351
343
  } else {
352
- var _getConfig2, _getConfig2$experimen;
353
- if ((_getConfig2 = getConfig()) !== null && _getConfig2 !== void 0 && (_getConfig2$experimen = _getConfig2.experimentalInteractionMetrics) !== null && _getConfig2$experimen !== void 0 && _getConfig2$experimen.enabled && experimental) {
354
- interaction.holdExpActive.set(id, {
355
- ...holdActive,
356
- start
357
- });
358
- }
359
- if (!experimental) {
360
- interaction.holdActive.set(id, {
361
- ...holdActive,
362
- start
363
- });
364
- }
344
+ interaction.holdActive.set(id, {
345
+ ...holdActive,
346
+ start
347
+ });
365
348
  addHoldCriterion(id, labelStack, name, start);
366
349
  }
367
350
  return () => {
@@ -402,19 +385,17 @@ export function addHold(interactionId, labelStack, name, experimental) {
402
385
  });
403
386
  interaction.holdExpActive.delete(id);
404
387
  }
405
- if (fg('platform_ufo_enable_ttai_with_3p')) {
406
- if (interaction.hold3pActive) {
407
- const current3pHold = interaction.hold3pActive.get(id);
408
- if (current3pHold != null) {
409
- if (!currentInteraction.hold3pInfo) {
410
- currentInteraction.hold3pInfo = [];
411
- }
412
- currentInteraction.hold3pInfo.push({
413
- ...current3pHold,
414
- end
415
- });
416
- interaction.hold3pActive.delete(id);
388
+ if (interaction.hold3pActive) {
389
+ const current3pHold = interaction.hold3pActive.get(id);
390
+ if (current3pHold != null) {
391
+ if (!currentInteraction.hold3pInfo) {
392
+ currentInteraction.hold3pInfo = [];
417
393
  }
394
+ currentInteraction.hold3pInfo.push({
395
+ ...current3pHold,
396
+ end
397
+ });
398
+ interaction.hold3pActive.delete(id);
418
399
  }
419
400
  }
420
401
  }
@@ -426,27 +407,17 @@ export function addHoldByID(interactionId, labelStack, name, id, ignoreOnSubmit)
426
407
  const interaction = interactions.get(interactionId);
427
408
  if (interaction != null) {
428
409
  const start = performance.now();
429
- if (fg('platform_ufo_enable_ttai_with_3p')) {
430
- const is3pHold = labelStack.some(l => 'type' in l && l.type === 'third-party');
431
- if (is3pHold) {
432
- if (!interaction.hold3pActive) {
433
- interaction.hold3pActive = new Map();
434
- }
435
- interaction.hold3pActive.set(id, {
436
- labelStack,
437
- name,
438
- start,
439
- ignoreOnSubmit
440
- });
441
- } else {
442
- interaction.holdActive.set(id, {
443
- labelStack,
444
- name,
445
- start,
446
- ignoreOnSubmit
447
- });
448
- addHoldCriterion(id, labelStack, name, start);
410
+ const is3pHold = labelStack.some(l => 'type' in l && l.type === 'third-party');
411
+ if (is3pHold) {
412
+ if (!interaction.hold3pActive) {
413
+ interaction.hold3pActive = new Map();
449
414
  }
415
+ interaction.hold3pActive.set(id, {
416
+ labelStack,
417
+ name,
418
+ start,
419
+ ignoreOnSubmit
420
+ });
450
421
  } else {
451
422
  interaction.holdActive.set(id, {
452
423
  labelStack,
@@ -473,19 +444,17 @@ export function removeHoldByID(interactionId, id) {
473
444
  interaction.holdActive.delete(id);
474
445
  removeHoldCriterion(id);
475
446
  }
476
- if (fg('platform_ufo_enable_ttai_with_3p')) {
477
- if (interaction.hold3pActive) {
478
- const current3pHold = interaction.hold3pActive.get(id);
479
- if (currentInteraction != null && current3pHold != null) {
480
- if (!currentInteraction.hold3pInfo) {
481
- currentInteraction.hold3pInfo = [];
482
- }
483
- currentInteraction.hold3pInfo.push({
484
- ...current3pHold,
485
- end
486
- });
487
- interaction.hold3pActive.delete(id);
447
+ if (interaction.hold3pActive) {
448
+ const current3pHold = interaction.hold3pActive.get(id);
449
+ if (currentInteraction != null && current3pHold != null) {
450
+ if (!currentInteraction.hold3pInfo) {
451
+ currentInteraction.hold3pInfo = [];
488
452
  }
453
+ currentInteraction.hold3pInfo.push({
454
+ ...current3pHold,
455
+ end
456
+ });
457
+ interaction.hold3pActive.delete(id);
489
458
  }
490
459
  }
491
460
  }
@@ -561,7 +530,7 @@ export function addErrorToAll(name, labelStack, errorType, errorMessage, errorSt
561
530
  });
562
531
  }
563
532
  export function addProfilerTimings(interactionId, labelStack, type, actualDuration, baseDuration, startTime, commitTime) {
564
- var _getConfig3, _getConfig3$postInter;
533
+ var _getConfig2, _getConfig2$postInter;
565
534
  if (isPerformanceTracingEnabled()) {
566
535
  try {
567
536
  // for Firefox 102 and older
@@ -589,7 +558,7 @@ export function addProfilerTimings(interactionId, labelStack, type, actualDurati
589
558
  startTime,
590
559
  commitTime
591
560
  });
592
- } else if ((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3$postInter = _getConfig3.postInteractionLog) !== null && _getConfig3$postInter !== void 0 && _getConfig3$postInter.enabled) {
561
+ } else if ((_getConfig2 = getConfig()) !== null && _getConfig2 !== void 0 && (_getConfig2$postInter = _getConfig2.postInteractionLog) !== null && _getConfig2$postInter !== void 0 && _getConfig2$postInter.enabled) {
593
562
  postInteractionLog.addProfilerTimings(labelStack, type, actualDuration, baseDuration, startTime, commitTime);
594
563
  }
595
564
  }
@@ -606,7 +575,7 @@ function callCleanUpCallbacks(interaction) {
606
575
  });
607
576
  }
608
577
  function finishInteraction(id, data, endTime = performance.now()) {
609
- var _getConfig4, _getConfig4$vc;
578
+ var _getConfig3, _getConfig3$vc;
610
579
  data.end = endTime;
611
580
  try {
612
581
  // for Firefox 102 and older
@@ -638,7 +607,7 @@ function finishInteraction(id, data, endTime = performance.now()) {
638
607
  clearActiveTrace();
639
608
  callCleanUpCallbacks(data);
640
609
  flushSsrRenderProfilerTraces();
641
- if ((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4$vc = _getConfig4.vc) !== null && _getConfig4$vc !== void 0 && _getConfig4$vc.stopVCAtInteractionFinish) {
610
+ if ((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3$vc = _getConfig3.vc) !== null && _getConfig3$vc !== void 0 && _getConfig3$vc.stopVCAtInteractionFinish) {
642
611
  // Use per-interaction VC observer if available, otherwise fall back to global
643
612
  const observer = data.vcObserver;
644
613
  if (observer) {
@@ -654,19 +623,11 @@ function finishInteraction(id, data, endTime = performance.now()) {
654
623
  if (!coinflip(getPostInteractionRate(sanitisedUfoName, data.type))) {
655
624
  postInteractionLog.stopVCObserver();
656
625
  }
657
- if (fg('platform_ufo_enable_ttai_with_3p')) {
658
- const sanitisedUfoName = sanitizeUfoName(data.ufoName);
659
- if (!coinflip(getExtraInteractionRate(sanitisedUfoName, data.type))) {
660
- interactionExtraMetrics.stopAll(id);
661
- } else if (!data.hold3pActive || data.hold3pActive.size === 0) {
662
- var _getConfig5, _getConfig5$experimen;
663
- if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5$experimen = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5$experimen !== void 0 && _getConfig5$experimen.enabled)) {
664
- remove(id);
665
- }
666
- }
667
- } else {
668
- var _getConfig6, _getConfig6$experimen;
669
- if (!((_getConfig6 = getConfig()) !== null && _getConfig6 !== void 0 && (_getConfig6$experimen = _getConfig6.experimentalInteractionMetrics) !== null && _getConfig6$experimen !== void 0 && _getConfig6$experimen.enabled)) {
626
+ if (!coinflip(getExtraInteractionRate(sanitisedUfoName, data.type))) {
627
+ interactionExtraMetrics.stopAll(id);
628
+ } else if (!data.hold3pActive || data.hold3pActive.size === 0) {
629
+ var _getConfig4, _getConfig4$experimen;
630
+ if (!((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4$experimen = _getConfig4.experimentalInteractionMetrics) !== null && _getConfig4$experimen !== void 0 && _getConfig4$experimen.enabled)) {
670
631
  remove(id);
671
632
  }
672
633
  }
@@ -678,13 +639,9 @@ function finishInteraction(id, data, endTime = performance.now()) {
678
639
  PreviousInteractionLog.name = data.ufoName || 'unknown';
679
640
  PreviousInteractionLog.isAborted = data.abortReason != null;
680
641
  if (data.ufoName) {
681
- if (fg('platform_ufo_enable_ttai_with_3p')) {
682
- var _interactionExtraMetr;
683
- if (((_interactionExtraMetr = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr === void 0 ? void 0 : _interactionExtraMetr.id) !== id) {
684
- // If this same interaction was not already handled, handle it
685
- handleInteraction(id, data);
686
- }
687
- } else {
642
+ var _interactionExtraMetr;
643
+ if (((_interactionExtraMetr = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr === void 0 ? void 0 : _interactionExtraMetr.id) !== id) {
644
+ // If this same interaction was not already handled, handle it
688
645
  handleInteraction(id, data);
689
646
  }
690
647
  }
@@ -751,16 +708,17 @@ let activeSubmitted = false;
751
708
  export function tryComplete(interactionId, endTime) {
752
709
  const interaction = interactions.get(interactionId);
753
710
  if (interaction != null) {
711
+ var _interaction$hold3pAc;
754
712
  const noMoreActiveHolds = interaction.holdActive.size === 0;
755
713
  const noMoreExpHolds = interaction.holdExpActive.size === 0;
756
714
  const shouldUseRawDataThirdParty = shouldUseRawDataThirdPartyBehavior(interaction.ufoName, interaction.type);
757
715
  const postInteraction = async () => {
758
- var _getConfig7, _getConfig7$postInter;
759
- if ((_getConfig7 = getConfig()) !== null && _getConfig7 !== void 0 && (_getConfig7$postInter = _getConfig7.postInteractionLog) !== null && _getConfig7$postInter !== void 0 && _getConfig7$postInter.enabled) {
760
- var _getConfig8, _getConfig8$experimen;
716
+ var _getConfig5, _getConfig5$postInter, _interactionExtraMetr2;
717
+ if ((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5$postInter = _getConfig5.postInteractionLog) !== null && _getConfig5$postInter !== void 0 && _getConfig5$postInter.enabled) {
718
+ var _getConfig6, _getConfig6$experimen;
761
719
  let experimentalVC90;
762
720
  let experimentalTTAI;
763
- if ((_getConfig8 = getConfig()) !== null && _getConfig8 !== void 0 && (_getConfig8$experimen = _getConfig8.experimentalInteractionMetrics) !== null && _getConfig8$experimen !== void 0 && _getConfig8$experimen.enabled) {
721
+ if ((_getConfig6 = getConfig()) !== null && _getConfig6 !== void 0 && (_getConfig6$experimen = _getConfig6.experimentalInteractionMetrics) !== null && _getConfig6$experimen !== void 0 && _getConfig6$experimen.enabled) {
764
722
  var _await$getExperimenta;
765
723
  experimentalVC90 = (_await$getExperimenta = await getExperimentalVCMetrics(interaction)) === null || _await$getExperimenta === void 0 ? void 0 : _await$getExperimenta['metric:experimental:vc90'];
766
724
  const {
@@ -775,122 +733,93 @@ export function tryComplete(interactionId, endTime) {
775
733
  experimentalVC90
776
734
  });
777
735
  }
778
- if (fg('platform_ufo_enable_ttai_with_3p')) {
779
- var _interactionExtraMetr2;
780
- if (((_interactionExtraMetr2 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr2 === void 0 ? void 0 : _interactionExtraMetr2.id) !== interactionId) {
781
- var _getConfig9, _getConfig9$experimen;
782
- // If interactionExtraMetrics is not waiting for measuring this interaction
783
- if ((_getConfig9 = getConfig()) !== null && _getConfig9 !== void 0 && (_getConfig9$experimen = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9$experimen !== void 0 && _getConfig9$experimen.enabled) {
784
- remove(interactionId);
785
- }
786
- }
787
- } else {
788
- var _getConfig0, _getConfig0$experimen;
789
- if ((_getConfig0 = getConfig()) !== null && _getConfig0 !== void 0 && (_getConfig0$experimen = _getConfig0.experimentalInteractionMetrics) !== null && _getConfig0$experimen !== void 0 && _getConfig0$experimen.enabled) {
736
+ if (((_interactionExtraMetr2 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr2 === void 0 ? void 0 : _interactionExtraMetr2.id) !== interactionId) {
737
+ var _getConfig7, _getConfig7$experimen;
738
+ // If interactionExtraMetrics is not waiting for measuring this interaction
739
+ if ((_getConfig7 = getConfig()) !== null && _getConfig7 !== void 0 && (_getConfig7$experimen = _getConfig7.experimentalInteractionMetrics) !== null && _getConfig7$experimen !== void 0 && _getConfig7$experimen.enabled) {
790
740
  remove(interactionId);
791
741
  }
792
742
  }
793
743
  activeSubmitted = false;
794
744
  };
795
- if (fg('platform_ufo_enable_ttai_with_3p')) {
796
- var _interaction$hold3pAc;
797
- const noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
745
+ const noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
798
746
 
799
- // If using raw data third party behavior, wait for 3p holds to clear
800
- if (shouldUseRawDataThirdParty) {
801
- // If there are no non-3p holds active, mark the interaction as successful
802
- // but don't finish until 3p holds are cleared
803
- if (noMoreActiveHolds && !noMoreActive3pHolds) {
804
- // Mark interaction as successful by setting endTime, but don't finish yet
805
- if (endTime !== undefined && interaction.end === 0) {
806
- interaction.end = endTime;
807
- }
808
- // Wait for 3p holds to clear before finishing
809
- return;
747
+ // If using raw data third party behavior, wait for 3p holds to clear
748
+ if (shouldUseRawDataThirdParty) {
749
+ // If there are no non-3p holds active, mark the interaction as successful
750
+ // but don't finish until 3p holds are cleared
751
+ if (noMoreActiveHolds && !noMoreActive3pHolds) {
752
+ // Mark interaction as successful by setting endTime, but don't finish yet
753
+ if (endTime !== undefined && interaction.end === 0) {
754
+ interaction.end = endTime;
810
755
  }
756
+ // Wait for 3p holds to clear before finishing
757
+ return;
758
+ }
811
759
 
812
- // If all holds (including 3p) are cleared, finish the interaction
813
- if (noMoreActiveHolds && noMoreActive3pHolds) {
814
- if (!activeSubmitted) {
815
- var _getConfig1, _getConfig1$extraInte, _getConfig10, _getConfig10$extraSea, _getConfig11, _getConfig11$extraSea;
816
- // Set end3p to current time when 3p holds cleared, but ensure it's at least interaction.end
817
- const currentTime = endTime !== null && endTime !== void 0 ? endTime : performance.now();
818
- interaction.end3p = interaction.end !== 0 && currentTime < interaction.end ? interaction.end : currentTime;
819
- finishInteraction(interactionId, interaction, interaction.end !== 0 ? interaction.end : endTime);
820
- if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1$extraInte = _getConfig1.extraInteractionMetrics) !== null && _getConfig1$extraInte !== void 0 && _getConfig1$extraInte.enabled) {
821
- interactionExtraMetrics.updateFinishedInteraction(interaction);
822
- }
823
- if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10$extraSea = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10$extraSea !== void 0 && _getConfig10$extraSea.enabled && interaction.ufoName === ((_getConfig11 = getConfig()) === null || _getConfig11 === void 0 ? void 0 : (_getConfig11$extraSea = _getConfig11.extraSearchPageInteraction) === null || _getConfig11$extraSea === void 0 ? void 0 : _getConfig11$extraSea.searchPageMetricName)) {
824
- onSearchPageInteractionComplete(interactionId, interaction);
825
- }
826
- activeSubmitted = true;
760
+ // If all holds (including 3p) are cleared, finish the interaction
761
+ if (noMoreActiveHolds && noMoreActive3pHolds) {
762
+ if (!activeSubmitted) {
763
+ var _getConfig8, _getConfig8$extraInte, _getConfig9, _getConfig9$extraSear, _getConfig0, _getConfig0$extraSear;
764
+ // Set end3p to current time when 3p holds cleared, but ensure it's at least interaction.end
765
+ const currentTime = endTime !== null && endTime !== void 0 ? endTime : performance.now();
766
+ interaction.end3p = interaction.end !== 0 && currentTime < interaction.end ? interaction.end : currentTime;
767
+ finishInteraction(interactionId, interaction, interaction.end !== 0 ? interaction.end : endTime);
768
+ if ((_getConfig8 = getConfig()) !== null && _getConfig8 !== void 0 && (_getConfig8$extraInte = _getConfig8.extraInteractionMetrics) !== null && _getConfig8$extraInte !== void 0 && _getConfig8$extraInte.enabled) {
769
+ interactionExtraMetrics.updateFinishedInteraction(interaction);
827
770
  }
828
- if (noMoreExpHolds) {
829
- var _getConfig12, _getConfig12$experime;
830
- if ((_getConfig12 = getConfig()) !== null && _getConfig12 !== void 0 && (_getConfig12$experime = _getConfig12.experimentalInteractionMetrics) !== null && _getConfig12$experime !== void 0 && _getConfig12$experime.enabled) {
831
- onExperimentalInteractionComplete(interactionId, interaction, endTime || interaction.end);
832
- }
833
- postInteraction();
771
+ if ((_getConfig9 = getConfig()) !== null && _getConfig9 !== void 0 && (_getConfig9$extraSear = _getConfig9.extraSearchPageInteraction) !== null && _getConfig9$extraSear !== void 0 && _getConfig9$extraSear.enabled && interaction.ufoName === ((_getConfig0 = getConfig()) === null || _getConfig0 === void 0 ? void 0 : (_getConfig0$extraSear = _getConfig0.extraSearchPageInteraction) === null || _getConfig0$extraSear === void 0 ? void 0 : _getConfig0$extraSear.searchPageMetricName)) {
772
+ onSearchPageInteractionComplete(interactionId, interaction);
834
773
  }
774
+ activeSubmitted = true;
835
775
  }
836
- // Send separated third-party event even when feature flag is active
837
- if (noMoreActiveHolds && noMoreActive3pHolds) {
838
- const data = {
839
- ...interaction,
840
- end: endTime || interaction.end
841
- };
842
- interactionExtraMetrics.onInteractionComplete(interactionId, data);
843
- }
844
- } else {
845
- var _interactionExtraMetr3;
846
- // Original behavior when feature flag is not active
847
- if (noMoreActiveHolds && ((_interactionExtraMetr3 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr3 === void 0 ? void 0 : _interactionExtraMetr3.id) !== interactionId) {
848
- // If it's not waiting for extra metrics to complete, finish the interaction as normal
849
- if (!activeSubmitted) {
850
- var _getConfig13, _getConfig13$extraInt, _getConfig14, _getConfig14$extraSea, _getConfig15, _getConfig15$extraSea;
851
- finishInteraction(interactionId, interaction, endTime);
852
- if ((_getConfig13 = getConfig()) !== null && _getConfig13 !== void 0 && (_getConfig13$extraInt = _getConfig13.extraInteractionMetrics) !== null && _getConfig13$extraInt !== void 0 && _getConfig13$extraInt.enabled) {
853
- interactionExtraMetrics.updateFinishedInteraction(interaction);
854
- }
855
- if ((_getConfig14 = getConfig()) !== null && _getConfig14 !== void 0 && (_getConfig14$extraSea = _getConfig14.extraSearchPageInteraction) !== null && _getConfig14$extraSea !== void 0 && _getConfig14$extraSea.enabled && interaction.ufoName === ((_getConfig15 = getConfig()) === null || _getConfig15 === void 0 ? void 0 : (_getConfig15$extraSea = _getConfig15.extraSearchPageInteraction) === null || _getConfig15$extraSea === void 0 ? void 0 : _getConfig15$extraSea.searchPageMetricName)) {
856
- onSearchPageInteractionComplete(interactionId, interaction);
857
- }
858
- activeSubmitted = true;
859
- }
860
- if (noMoreExpHolds) {
861
- var _getConfig16, _getConfig16$experime;
862
- if ((_getConfig16 = getConfig()) !== null && _getConfig16 !== void 0 && (_getConfig16$experime = _getConfig16.experimentalInteractionMetrics) !== null && _getConfig16$experime !== void 0 && _getConfig16$experime.enabled) {
863
- onExperimentalInteractionComplete(interactionId, interaction, endTime);
864
- }
865
- postInteraction();
776
+ if (noMoreExpHolds) {
777
+ var _getConfig1, _getConfig1$experimen;
778
+ if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1$experimen = _getConfig1.experimentalInteractionMetrics) !== null && _getConfig1$experimen !== void 0 && _getConfig1$experimen.enabled) {
779
+ onExperimentalInteractionComplete(interactionId, interaction, endTime || interaction.end);
866
780
  }
781
+ postInteraction();
867
782
  }
868
- if (noMoreActiveHolds && noMoreActive3pHolds) {
869
- const data = {
870
- ...interaction,
871
- end: endTime
872
- };
873
- interactionExtraMetrics.onInteractionComplete(interactionId, data);
874
- }
783
+ }
784
+ // Send separated third-party event even when feature flag is active
785
+ if (noMoreActiveHolds && noMoreActive3pHolds) {
786
+ const data = {
787
+ ...interaction,
788
+ end: endTime || interaction.end
789
+ };
790
+ interactionExtraMetrics.onInteractionComplete(interactionId, data);
875
791
  }
876
792
  } else {
877
- if (noMoreActiveHolds) {
793
+ var _interactionExtraMetr3;
794
+ // Original behavior when feature flag is not active
795
+ if (noMoreActiveHolds && ((_interactionExtraMetr3 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr3 === void 0 ? void 0 : _interactionExtraMetr3.id) !== interactionId) {
796
+ // If it's not waiting for extra metrics to complete, finish the interaction as normal
878
797
  if (!activeSubmitted) {
879
- var _getConfig17, _getConfig17$extraSea, _getConfig18, _getConfig18$extraSea;
798
+ var _getConfig10, _getConfig10$extraInt, _getConfig11, _getConfig11$extraSea, _getConfig12, _getConfig12$extraSea;
880
799
  finishInteraction(interactionId, interaction, endTime);
881
- if ((_getConfig17 = getConfig()) !== null && _getConfig17 !== void 0 && (_getConfig17$extraSea = _getConfig17.extraSearchPageInteraction) !== null && _getConfig17$extraSea !== void 0 && _getConfig17$extraSea.enabled && interaction.ufoName === ((_getConfig18 = getConfig()) === null || _getConfig18 === void 0 ? void 0 : (_getConfig18$extraSea = _getConfig18.extraSearchPageInteraction) === null || _getConfig18$extraSea === void 0 ? void 0 : _getConfig18$extraSea.searchPageMetricName)) {
800
+ if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10$extraInt = _getConfig10.extraInteractionMetrics) !== null && _getConfig10$extraInt !== void 0 && _getConfig10$extraInt.enabled) {
801
+ interactionExtraMetrics.updateFinishedInteraction(interaction);
802
+ }
803
+ if ((_getConfig11 = getConfig()) !== null && _getConfig11 !== void 0 && (_getConfig11$extraSea = _getConfig11.extraSearchPageInteraction) !== null && _getConfig11$extraSea !== void 0 && _getConfig11$extraSea.enabled && interaction.ufoName === ((_getConfig12 = getConfig()) === null || _getConfig12 === void 0 ? void 0 : (_getConfig12$extraSea = _getConfig12.extraSearchPageInteraction) === null || _getConfig12$extraSea === void 0 ? void 0 : _getConfig12$extraSea.searchPageMetricName)) {
882
804
  onSearchPageInteractionComplete(interactionId, interaction);
883
805
  }
884
806
  activeSubmitted = true;
885
807
  }
886
808
  if (noMoreExpHolds) {
887
- var _getConfig19, _getConfig19$experime;
888
- if ((_getConfig19 = getConfig()) !== null && _getConfig19 !== void 0 && (_getConfig19$experime = _getConfig19.experimentalInteractionMetrics) !== null && _getConfig19$experime !== void 0 && _getConfig19$experime.enabled) {
809
+ var _getConfig13, _getConfig13$experime;
810
+ if ((_getConfig13 = getConfig()) !== null && _getConfig13 !== void 0 && (_getConfig13$experime = _getConfig13.experimentalInteractionMetrics) !== null && _getConfig13$experime !== void 0 && _getConfig13$experime.enabled) {
889
811
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
890
812
  }
891
813
  postInteraction();
892
814
  }
893
815
  }
816
+ if (noMoreActiveHolds && noMoreActive3pHolds) {
817
+ const data = {
818
+ ...interaction,
819
+ end: endTime
820
+ };
821
+ interactionExtraMetrics.onInteractionComplete(interactionId, data);
822
+ }
894
823
  }
895
824
  }
896
825
  }
@@ -913,9 +842,7 @@ export function abort(interactionId, abortReason) {
913
842
  finishInteraction(interactionId, interaction, endTime);
914
843
  postInteractionLog.reset();
915
844
  postInteractionLog.stopVCObserver();
916
- if (fg('platform_ufo_enable_ttai_with_3p')) {
917
- interactionExtraMetrics.stopAll(interactionId);
918
- }
845
+ interactionExtraMetrics.stopAll(interactionId);
919
846
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
920
847
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
921
848
  remove(interactionId);
@@ -927,9 +854,7 @@ export function abort(interactionId, abortReason) {
927
854
  finishInteraction(interactionId, interaction);
928
855
  postInteractionLog.reset();
929
856
  postInteractionLog.stopVCObserver();
930
- if (fg('platform_ufo_enable_ttai_with_3p')) {
931
- interactionExtraMetrics.stopAll(interactionId);
932
- }
857
+ interactionExtraMetrics.stopAll(interactionId);
933
858
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
934
859
  onExperimentalInteractionComplete(interactionId, interaction);
935
860
  remove(interactionId);
@@ -951,9 +876,7 @@ export function abortByNewInteraction(interactionId, interactionName) {
951
876
  finishInteraction(interactionId, interaction, endTime);
952
877
  postInteractionLog.reset();
953
878
  postInteractionLog.stopVCObserver();
954
- if (fg('platform_ufo_enable_ttai_with_3p')) {
955
- interactionExtraMetrics.stopAll(interactionId);
956
- }
879
+ interactionExtraMetrics.stopAll(interactionId);
957
880
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
958
881
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
959
882
  remove(interactionId);
@@ -966,9 +889,7 @@ export function abortByNewInteraction(interactionId, interactionName) {
966
889
  finishInteraction(interactionId, interaction);
967
890
  postInteractionLog.reset();
968
891
  postInteractionLog.stopVCObserver();
969
- if (fg('platform_ufo_enable_ttai_with_3p')) {
970
- interactionExtraMetrics.stopAll(interactionId);
971
- }
892
+ interactionExtraMetrics.stopAll(interactionId);
972
893
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
973
894
  onExperimentalInteractionComplete(interactionId, interaction);
974
895
  remove(interactionId);
@@ -987,7 +908,7 @@ export function abortAll(abortReason, abortedByInteractionName) {
987
908
  interactions.forEach((interaction, interactionId) => {
988
909
  const isActiveInteraction = activeInteraction === interaction;
989
910
  let hasFinished = interaction.holdActive.size === 0;
990
- if (isActiveInteraction && abortReason === 'transition' && interaction.type === 'press' && finishInteractions !== null && finishInteractions !== void 0 && finishInteractions.includes(interaction.ufoName) && fg('platform_ufo_enable_finish_interaction_transition')) {
911
+ if (isActiveInteraction && abortReason === 'transition' && interaction.type === 'press' && finishInteractions !== null && finishInteractions !== void 0 && finishInteractions.includes(interaction.ufoName)) {
991
912
  hasFinished = true;
992
913
  }
993
914
  const shouldUseRawDataThirdParty = shouldUseRawDataThirdPartyBehavior(interaction.ufoName, interaction.type);
@@ -1001,9 +922,7 @@ export function abortAll(abortReason, abortedByInteractionName) {
1001
922
  finishInteraction(interactionId, interaction, endTime);
1002
923
  postInteractionLog.reset();
1003
924
  postInteractionLog.stopVCObserver();
1004
- if (fg('platform_ufo_enable_ttai_with_3p')) {
1005
- interactionExtraMetrics.stopAll(interactionId);
1006
- }
925
+ interactionExtraMetrics.stopAll(interactionId);
1007
926
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
1008
927
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
1009
928
  remove(interactionId);
@@ -1020,9 +939,7 @@ export function abortAll(abortReason, abortedByInteractionName) {
1020
939
  finishInteraction(interactionId, interaction);
1021
940
  postInteractionLog.reset();
1022
941
  postInteractionLog.stopVCObserver();
1023
- if (fg('platform_ufo_enable_ttai_with_3p')) {
1024
- interactionExtraMetrics.stopAll(interactionId);
1025
- }
942
+ interactionExtraMetrics.stopAll(interactionId);
1026
943
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
1027
944
  onExperimentalInteractionComplete(interactionId, interaction);
1028
945
  remove(interactionId);
@@ -1152,7 +1069,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
1152
1069
  addHoldByID(interactionId, [], ufoName, ufoName, true);
1153
1070
  }
1154
1071
  if (type === 'transition' || type === 'page_load') {
1155
- var _getConfig20, _getConfig20$postInte, _config$extraInteract;
1072
+ var _getConfig14, _getConfig14$postInte, _config$extraInteract;
1156
1073
  // Use per-interaction VC observer if available, otherwise fall back to global
1157
1074
  const observer = vcObserver;
1158
1075
  if (observer) {
@@ -1163,7 +1080,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
1163
1080
  }
1164
1081
  // Start post interaction observer for all if config is enabled
1165
1082
  // in case ufoName is updated at later time
1166
- if ((_getConfig20 = getConfig()) !== null && _getConfig20 !== void 0 && (_getConfig20$postInte = _getConfig20.postInteractionLog) !== null && _getConfig20$postInte !== void 0 && _getConfig20$postInte.enabled) {
1083
+ if ((_getConfig14 = getConfig()) !== null && _getConfig14 !== void 0 && (_getConfig14$postInte = _getConfig14.postInteractionLog) !== null && _getConfig14$postInte !== void 0 && _getConfig14$postInte.enabled) {
1167
1084
  postInteractionLog.startVCObserver({
1168
1085
  startTime
1169
1086
  });
@@ -1173,7 +1090,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
1173
1090
  startTime
1174
1091
  });
1175
1092
  }
1176
- if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled && fg('platform_ufo_enable_ttai_with_3p')) {
1093
+ if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
1177
1094
  interactionExtraMetrics.startVCObserver({
1178
1095
  startTime
1179
1096
  }, interactionId);
@@ -170,7 +170,7 @@ export function init(analyticsWebClientAsync, config) {
170
170
  if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
171
171
  sinkPostInteractionLog(instance, createPostInteractionLogPayloadPackage.default);
172
172
  }
173
- 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')) {
173
+ if (config !== null && config !== void 0 && (_config$extraInteract2 = config.extraInteractionMetrics) !== null && _config$extraInteract2 !== void 0 && _config$extraInteract2.enabled) {
174
174
  sinkInteractionExtraMetrics(instance, createInteractionExtraMetricsPayloadPackage.default);
175
175
  }
176
176
  if (config !== null && config !== void 0 && (_config$extraSearchPa = config.extraSearchPageInteraction) !== null && _config$extraSearchPa !== void 0 && _config$extraSearchPa.enabled) {
@@ -189,7 +189,7 @@ export function init(analyticsWebClientAsync, config) {
189
189
  if ((_config$postInteracti2 = config.postInteractionLog) !== null && _config$postInteracti2 !== void 0 && _config$postInteracti2.enabled) {
190
190
  sinkPostInteractionLog(awc, createPostInteractionLogPayloadPackage.default);
191
191
  }
192
- 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')) {
192
+ if (config !== null && config !== void 0 && (_config$extraInteract3 = config.extraInteractionMetrics) !== null && _config$extraInteract3 !== void 0 && _config$extraInteract3.enabled) {
193
193
  sinkInteractionExtraMetrics(awc, createInteractionExtraMetricsPayloadPackage.default);
194
194
  }
195
195
  if (config !== null && config !== void 0 && (_config$extraSearchPa2 = config.extraSearchPageInteraction) !== null && _config$extraSearchPa2 !== void 0 && _config$extraSearchPa2.enabled) {