@atlaskit/react-ufo 5.4.11 → 5.5.1

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.
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  import { calculateTTVCPercentilesWithDebugInfo } from './percentile-calc';
3
2
  import { detectLayoutShiftCause } from './utils/detect-layout-shift-cause';
4
3
  import getViewportHeight from './utils/get-viewport-height';
@@ -162,7 +161,7 @@ export default class AbstractVCCalculatorBase {
162
161
  })) : [];
163
162
 
164
163
  // If 3p metric enabled - calculate the debug details
165
- const shouldCalculate3p = include3p && fg('platform_ufo_enable_ttai_with_3p');
164
+ const shouldCalculate3p = include3p;
166
165
  // Only calculate enhanced debug details if devtool callbacks exist
167
166
 
168
167
  const 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');
@@ -295,23 +295,21 @@ export default class ViewportObserver {
295
295
  }
296
296
  };
297
297
  }
298
- if (fg('platform_ufo_exclude_3p_attribute_changes')) {
299
- const {
300
- isWithin: isWithinThirdPartySegment
301
- } = this.enableThirdPartyTracking ? checkWithinComponent(target, 'UFOThirdPartySegment', this.mapIs3pResult) : {
302
- isWithin: false
298
+ const {
299
+ isWithin: isWithinThirdPartySegment
300
+ } = this.enableThirdPartyTracking ? checkWithinComponent(target, 'UFOThirdPartySegment', this.mapIs3pResult) : {
301
+ isWithin: false
302
+ };
303
+ if (isWithinThirdPartySegment) {
304
+ return {
305
+ type: 'mutation:third-party-attribute',
306
+ mutationData: {
307
+ attributeName,
308
+ oldValue,
309
+ newValue,
310
+ timestamp
311
+ }
303
312
  };
304
- if (isWithinThirdPartySegment) {
305
- return {
306
- type: 'mutation:third-party-attribute',
307
- mutationData: {
308
- attributeName,
309
- oldValue,
310
- newValue,
311
- timestamp
312
- }
313
- };
314
- }
315
313
  }
316
314
  if (this.shouldCheckSmartAnswersMutations() && isContainedWithinSmartAnswers(target)) {
317
315
  return {
@@ -372,35 +372,20 @@ export function addHold(interactionId, labelStack, name, experimental) {
372
372
  name: name,
373
373
  start: start
374
374
  };
375
- if (fg('platform_ufo_enable_ttai_with_3p')) {
376
- var is3pHold = labelStack.some(function (l) {
377
- return 'type' in l && l.type === 'third-party';
378
- });
379
- if (is3pHold) {
380
- if (!interaction.hold3pActive) {
381
- interaction.hold3pActive = new Map();
382
- }
383
- interaction.hold3pActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
384
- start: start
385
- }));
386
- } else {
387
- interaction.holdActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
388
- start: start
389
- }));
390
- addHoldCriterion(id, labelStack, name, start);
375
+ var is3pHold = labelStack.some(function (l) {
376
+ return 'type' in l && l.type === 'third-party';
377
+ });
378
+ if (is3pHold) {
379
+ if (!interaction.hold3pActive) {
380
+ interaction.hold3pActive = new Map();
391
381
  }
382
+ interaction.hold3pActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
383
+ start: start
384
+ }));
392
385
  } else {
393
- var _getConfig2;
394
- if ((_getConfig2 = getConfig()) !== null && _getConfig2 !== void 0 && (_getConfig2 = _getConfig2.experimentalInteractionMetrics) !== null && _getConfig2 !== void 0 && _getConfig2.enabled && experimental) {
395
- interaction.holdExpActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
396
- start: start
397
- }));
398
- }
399
- if (!experimental) {
400
- interaction.holdActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
401
- start: start
402
- }));
403
- }
386
+ interaction.holdActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
387
+ start: start
388
+ }));
404
389
  addHoldCriterion(id, labelStack, name, start);
405
390
  }
406
391
  return function () {
@@ -439,18 +424,16 @@ export function addHold(interactionId, labelStack, name, experimental) {
439
424
  }));
440
425
  interaction.holdExpActive.delete(id);
441
426
  }
442
- if (fg('platform_ufo_enable_ttai_with_3p')) {
443
- if (interaction.hold3pActive) {
444
- var current3pHold = interaction.hold3pActive.get(id);
445
- if (current3pHold != null) {
446
- if (!currentInteraction.hold3pInfo) {
447
- currentInteraction.hold3pInfo = [];
448
- }
449
- currentInteraction.hold3pInfo.push(_objectSpread(_objectSpread({}, current3pHold), {}, {
450
- end: end
451
- }));
452
- interaction.hold3pActive.delete(id);
427
+ if (interaction.hold3pActive) {
428
+ var current3pHold = interaction.hold3pActive.get(id);
429
+ if (current3pHold != null) {
430
+ if (!currentInteraction.hold3pInfo) {
431
+ currentInteraction.hold3pInfo = [];
453
432
  }
433
+ currentInteraction.hold3pInfo.push(_objectSpread(_objectSpread({}, current3pHold), {}, {
434
+ end: end
435
+ }));
436
+ interaction.hold3pActive.delete(id);
454
437
  }
455
438
  }
456
439
  }
@@ -462,29 +445,19 @@ export function addHoldByID(interactionId, labelStack, name, id, ignoreOnSubmit)
462
445
  var interaction = interactions.get(interactionId);
463
446
  if (interaction != null) {
464
447
  var start = performance.now();
465
- if (fg('platform_ufo_enable_ttai_with_3p')) {
466
- var is3pHold = labelStack.some(function (l) {
467
- return 'type' in l && l.type === 'third-party';
468
- });
469
- if (is3pHold) {
470
- if (!interaction.hold3pActive) {
471
- interaction.hold3pActive = new Map();
472
- }
473
- interaction.hold3pActive.set(id, {
474
- labelStack: labelStack,
475
- name: name,
476
- start: start,
477
- ignoreOnSubmit: ignoreOnSubmit
478
- });
479
- } else {
480
- interaction.holdActive.set(id, {
481
- labelStack: labelStack,
482
- name: name,
483
- start: start,
484
- ignoreOnSubmit: ignoreOnSubmit
485
- });
486
- addHoldCriterion(id, labelStack, name, start);
448
+ var is3pHold = labelStack.some(function (l) {
449
+ return 'type' in l && l.type === 'third-party';
450
+ });
451
+ if (is3pHold) {
452
+ if (!interaction.hold3pActive) {
453
+ interaction.hold3pActive = new Map();
487
454
  }
455
+ interaction.hold3pActive.set(id, {
456
+ labelStack: labelStack,
457
+ name: name,
458
+ start: start,
459
+ ignoreOnSubmit: ignoreOnSubmit
460
+ });
488
461
  } else {
489
462
  interaction.holdActive.set(id, {
490
463
  labelStack: labelStack,
@@ -510,18 +483,16 @@ export function removeHoldByID(interactionId, id) {
510
483
  interaction.holdActive.delete(id);
511
484
  removeHoldCriterion(id);
512
485
  }
513
- if (fg('platform_ufo_enable_ttai_with_3p')) {
514
- if (interaction.hold3pActive) {
515
- var current3pHold = interaction.hold3pActive.get(id);
516
- if (currentInteraction != null && current3pHold != null) {
517
- if (!currentInteraction.hold3pInfo) {
518
- currentInteraction.hold3pInfo = [];
519
- }
520
- currentInteraction.hold3pInfo.push(_objectSpread(_objectSpread({}, current3pHold), {}, {
521
- end: end
522
- }));
523
- interaction.hold3pActive.delete(id);
486
+ if (interaction.hold3pActive) {
487
+ var current3pHold = interaction.hold3pActive.get(id);
488
+ if (currentInteraction != null && current3pHold != null) {
489
+ if (!currentInteraction.hold3pInfo) {
490
+ currentInteraction.hold3pInfo = [];
524
491
  }
492
+ currentInteraction.hold3pInfo.push(_objectSpread(_objectSpread({}, current3pHold), {}, {
493
+ end: end
494
+ }));
495
+ interaction.hold3pActive.delete(id);
525
496
  }
526
497
  }
527
498
  }
@@ -597,7 +568,7 @@ export function addErrorToAll(name, labelStack, errorType, errorMessage, errorSt
597
568
  });
598
569
  }
599
570
  export function addProfilerTimings(interactionId, labelStack, type, actualDuration, baseDuration, startTime, commitTime) {
600
- var _getConfig3;
571
+ var _getConfig2;
601
572
  if (isPerformanceTracingEnabled()) {
602
573
  try {
603
574
  // for Firefox 102 and older
@@ -625,7 +596,7 @@ export function addProfilerTimings(interactionId, labelStack, type, actualDurati
625
596
  startTime: startTime,
626
597
  commitTime: commitTime
627
598
  });
628
- } else if ((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.postInteractionLog) !== null && _getConfig3 !== void 0 && _getConfig3.enabled) {
599
+ } else if ((_getConfig2 = getConfig()) !== null && _getConfig2 !== void 0 && (_getConfig2 = _getConfig2.postInteractionLog) !== null && _getConfig2 !== void 0 && _getConfig2.enabled) {
629
600
  postInteractionLog.addProfilerTimings(labelStack, type, actualDuration, baseDuration, startTime, commitTime);
630
601
  }
631
602
  }
@@ -642,7 +613,7 @@ function callCleanUpCallbacks(interaction) {
642
613
  });
643
614
  }
644
615
  function finishInteraction(id, data) {
645
- var _getConfig4;
616
+ var _getConfig3;
646
617
  var endTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : performance.now();
647
618
  data.end = endTime;
648
619
  try {
@@ -675,7 +646,7 @@ function finishInteraction(id, data) {
675
646
  clearActiveTrace();
676
647
  callCleanUpCallbacks(data);
677
648
  flushSsrRenderProfilerTraces();
678
- if ((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.vc) !== null && _getConfig4 !== void 0 && _getConfig4.stopVCAtInteractionFinish) {
649
+ if ((_getConfig3 = getConfig()) !== null && _getConfig3 !== void 0 && (_getConfig3 = _getConfig3.vc) !== null && _getConfig3 !== void 0 && _getConfig3.stopVCAtInteractionFinish) {
679
650
  // Use per-interaction VC observer if available, otherwise fall back to global
680
651
  var observer = data.vcObserver;
681
652
  if (observer) {
@@ -691,19 +662,11 @@ function finishInteraction(id, data) {
691
662
  if (!coinflip(getPostInteractionRate(sanitisedUfoName, data.type))) {
692
663
  postInteractionLog.stopVCObserver();
693
664
  }
694
- if (fg('platform_ufo_enable_ttai_with_3p')) {
695
- var _sanitisedUfoName = sanitizeUfoName(data.ufoName);
696
- if (!coinflip(getExtraInteractionRate(_sanitisedUfoName, data.type))) {
697
- interactionExtraMetrics.stopAll(id);
698
- } else if (!data.hold3pActive || data.hold3pActive.size === 0) {
699
- var _getConfig5;
700
- if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
701
- remove(id);
702
- }
703
- }
704
- } else {
705
- var _getConfig6;
706
- if (!((_getConfig6 = getConfig()) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.experimentalInteractionMetrics) !== null && _getConfig6 !== void 0 && _getConfig6.enabled)) {
665
+ if (!coinflip(getExtraInteractionRate(sanitisedUfoName, data.type))) {
666
+ interactionExtraMetrics.stopAll(id);
667
+ } else if (!data.hold3pActive || data.hold3pActive.size === 0) {
668
+ var _getConfig4;
669
+ if (!((_getConfig4 = getConfig()) !== null && _getConfig4 !== void 0 && (_getConfig4 = _getConfig4.experimentalInteractionMetrics) !== null && _getConfig4 !== void 0 && _getConfig4.enabled)) {
707
670
  remove(id);
708
671
  }
709
672
  }
@@ -715,13 +678,9 @@ function finishInteraction(id, data) {
715
678
  PreviousInteractionLog.name = data.ufoName || 'unknown';
716
679
  PreviousInteractionLog.isAborted = data.abortReason != null;
717
680
  if (data.ufoName) {
718
- if (fg('platform_ufo_enable_ttai_with_3p')) {
719
- var _interactionExtraMetr;
720
- if (((_interactionExtraMetr = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr === void 0 ? void 0 : _interactionExtraMetr.id) !== id) {
721
- // If this same interaction was not already handled, handle it
722
- handleInteraction(id, data);
723
- }
724
- } else {
681
+ var _interactionExtraMetr;
682
+ if (((_interactionExtraMetr = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr === void 0 ? void 0 : _interactionExtraMetr.id) !== id) {
683
+ // If this same interaction was not already handled, handle it
725
684
  handleInteraction(id, data);
726
685
  }
727
686
  }
@@ -797,21 +756,22 @@ var activeSubmitted = false;
797
756
  export function tryComplete(interactionId, endTime) {
798
757
  var interaction = interactions.get(interactionId);
799
758
  if (interaction != null) {
759
+ var _interaction$hold3pAc;
800
760
  var noMoreActiveHolds = interaction.holdActive.size === 0;
801
761
  var noMoreExpHolds = interaction.holdExpActive.size === 0;
802
762
  var shouldUseRawDataThirdParty = shouldUseRawDataThirdPartyBehavior(interaction.ufoName, interaction.type);
803
763
  var postInteraction = /*#__PURE__*/function () {
804
764
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
805
- var _getConfig7;
806
- var _getConfig8, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _interactionExtraMetr2, _getConfig9, _getConfig0;
765
+ var _getConfig5, _interactionExtraMetr2;
766
+ var _getConfig6, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _getConfig7;
807
767
  return _regeneratorRuntime.wrap(function _callee$(_context) {
808
768
  while (1) switch (_context.prev = _context.next) {
809
769
  case 0:
810
- if (!((_getConfig7 = getConfig()) !== null && _getConfig7 !== void 0 && (_getConfig7 = _getConfig7.postInteractionLog) !== null && _getConfig7 !== void 0 && _getConfig7.enabled)) {
770
+ if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.postInteractionLog) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
811
771
  _context.next = 17;
812
772
  break;
813
773
  }
814
- if (!((_getConfig8 = getConfig()) !== null && _getConfig8 !== void 0 && (_getConfig8 = _getConfig8.experimentalInteractionMetrics) !== null && _getConfig8 !== void 0 && _getConfig8.enabled)) {
774
+ if (!((_getConfig6 = getConfig()) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.experimentalInteractionMetrics) !== null && _getConfig6 !== void 0 && _getConfig6.enabled)) {
815
775
  _context.next = 16;
816
776
  break;
817
777
  }
@@ -845,15 +805,9 @@ export function tryComplete(interactionId, endTime) {
845
805
  experimentalVC90: experimentalVC90
846
806
  }));
847
807
  case 17:
848
- if (fg('platform_ufo_enable_ttai_with_3p')) {
849
- if (((_interactionExtraMetr2 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr2 === void 0 ? void 0 : _interactionExtraMetr2.id) !== interactionId) {
850
- // If interactionExtraMetrics is not waiting for measuring this interaction
851
- if ((_getConfig9 = getConfig()) !== null && _getConfig9 !== void 0 && (_getConfig9 = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9 !== void 0 && _getConfig9.enabled) {
852
- remove(interactionId);
853
- }
854
- }
855
- } else {
856
- if ((_getConfig0 = getConfig()) !== null && _getConfig0 !== void 0 && (_getConfig0 = _getConfig0.experimentalInteractionMetrics) !== null && _getConfig0 !== void 0 && _getConfig0.enabled) {
808
+ if (((_interactionExtraMetr2 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr2 === void 0 ? void 0 : _interactionExtraMetr2.id) !== interactionId) {
809
+ // If interactionExtraMetrics is not waiting for measuring this interaction
810
+ if ((_getConfig7 = getConfig()) !== null && _getConfig7 !== void 0 && (_getConfig7 = _getConfig7.experimentalInteractionMetrics) !== null && _getConfig7 !== void 0 && _getConfig7.enabled) {
857
811
  remove(interactionId);
858
812
  }
859
813
  }
@@ -868,103 +822,82 @@ export function tryComplete(interactionId, endTime) {
868
822
  return _ref.apply(this, arguments);
869
823
  };
870
824
  }();
871
- if (fg('platform_ufo_enable_ttai_with_3p')) {
872
- var _interaction$hold3pAc;
873
- var noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
825
+ var noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
874
826
 
875
- // If using raw data third party behavior, wait for 3p holds to clear
876
- if (shouldUseRawDataThirdParty) {
877
- // If there are no non-3p holds active, mark the interaction as successful
878
- // but don't finish until 3p holds are cleared
879
- if (noMoreActiveHolds && !noMoreActive3pHolds) {
880
- // Mark interaction as successful by setting endTime, but don't finish yet
881
- if (endTime !== undefined && interaction.end === 0) {
882
- interaction.end = endTime;
883
- }
884
- // Wait for 3p holds to clear before finishing
885
- return;
827
+ // If using raw data third party behavior, wait for 3p holds to clear
828
+ if (shouldUseRawDataThirdParty) {
829
+ // If there are no non-3p holds active, mark the interaction as successful
830
+ // but don't finish until 3p holds are cleared
831
+ if (noMoreActiveHolds && !noMoreActive3pHolds) {
832
+ // Mark interaction as successful by setting endTime, but don't finish yet
833
+ if (endTime !== undefined && interaction.end === 0) {
834
+ interaction.end = endTime;
886
835
  }
836
+ // Wait for 3p holds to clear before finishing
837
+ return;
838
+ }
887
839
 
888
- // If all holds (including 3p) are cleared, finish the interaction
889
- if (noMoreActiveHolds && noMoreActive3pHolds) {
890
- if (!activeSubmitted) {
891
- var _getConfig1, _getConfig10, _getConfig11;
892
- // Set end3p to current time when 3p holds cleared, but ensure it's at least interaction.end
893
- var currentTime = endTime !== null && endTime !== void 0 ? endTime : performance.now();
894
- interaction.end3p = interaction.end !== 0 && currentTime < interaction.end ? interaction.end : currentTime;
895
- finishInteraction(interactionId, interaction, interaction.end !== 0 ? interaction.end : endTime);
896
- if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.extraInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
897
- interactionExtraMetrics.updateFinishedInteraction(interaction);
898
- }
899
- 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)) {
900
- onSearchPageInteractionComplete(interactionId, interaction);
901
- }
902
- activeSubmitted = true;
840
+ // If all holds (including 3p) are cleared, finish the interaction
841
+ if (noMoreActiveHolds && noMoreActive3pHolds) {
842
+ if (!activeSubmitted) {
843
+ var _getConfig8, _getConfig9, _getConfig0;
844
+ // Set end3p to current time when 3p holds cleared, but ensure it's at least interaction.end
845
+ var currentTime = endTime !== null && endTime !== void 0 ? endTime : performance.now();
846
+ interaction.end3p = interaction.end !== 0 && currentTime < interaction.end ? interaction.end : currentTime;
847
+ finishInteraction(interactionId, interaction, interaction.end !== 0 ? interaction.end : endTime);
848
+ if ((_getConfig8 = getConfig()) !== null && _getConfig8 !== void 0 && (_getConfig8 = _getConfig8.extraInteractionMetrics) !== null && _getConfig8 !== void 0 && _getConfig8.enabled) {
849
+ interactionExtraMetrics.updateFinishedInteraction(interaction);
903
850
  }
904
- if (noMoreExpHolds) {
905
- var _getConfig12;
906
- if ((_getConfig12 = getConfig()) !== null && _getConfig12 !== void 0 && (_getConfig12 = _getConfig12.experimentalInteractionMetrics) !== null && _getConfig12 !== void 0 && _getConfig12.enabled) {
907
- onExperimentalInteractionComplete(interactionId, interaction, endTime || interaction.end);
908
- }
909
- postInteraction();
851
+ if ((_getConfig9 = getConfig()) !== null && _getConfig9 !== void 0 && (_getConfig9 = _getConfig9.extraSearchPageInteraction) !== null && _getConfig9 !== void 0 && _getConfig9.enabled && interaction.ufoName === ((_getConfig0 = getConfig()) === null || _getConfig0 === void 0 || (_getConfig0 = _getConfig0.extraSearchPageInteraction) === null || _getConfig0 === void 0 ? void 0 : _getConfig0.searchPageMetricName)) {
852
+ onSearchPageInteractionComplete(interactionId, interaction);
910
853
  }
854
+ activeSubmitted = true;
911
855
  }
912
- // Send separated third-party event even when feature flag is active
913
- if (noMoreActiveHolds && noMoreActive3pHolds) {
914
- var data = _objectSpread(_objectSpread({}, interaction), {}, {
915
- end: endTime || interaction.end
916
- });
917
- interactionExtraMetrics.onInteractionComplete(interactionId, data);
918
- }
919
- } else {
920
- var _interactionExtraMetr3;
921
- // Original behavior when feature flag is not active
922
- if (noMoreActiveHolds && ((_interactionExtraMetr3 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr3 === void 0 ? void 0 : _interactionExtraMetr3.id) !== interactionId) {
923
- // If it's not waiting for extra metrics to complete, finish the interaction as normal
924
- if (!activeSubmitted) {
925
- var _getConfig13, _getConfig14, _getConfig15;
926
- finishInteraction(interactionId, interaction, endTime);
927
- if ((_getConfig13 = getConfig()) !== null && _getConfig13 !== void 0 && (_getConfig13 = _getConfig13.extraInteractionMetrics) !== null && _getConfig13 !== void 0 && _getConfig13.enabled) {
928
- interactionExtraMetrics.updateFinishedInteraction(interaction);
929
- }
930
- if ((_getConfig14 = getConfig()) !== null && _getConfig14 !== void 0 && (_getConfig14 = _getConfig14.extraSearchPageInteraction) !== null && _getConfig14 !== void 0 && _getConfig14.enabled && interaction.ufoName === ((_getConfig15 = getConfig()) === null || _getConfig15 === void 0 || (_getConfig15 = _getConfig15.extraSearchPageInteraction) === null || _getConfig15 === void 0 ? void 0 : _getConfig15.searchPageMetricName)) {
931
- onSearchPageInteractionComplete(interactionId, interaction);
932
- }
933
- activeSubmitted = true;
934
- }
935
- if (noMoreExpHolds) {
936
- var _getConfig16;
937
- if ((_getConfig16 = getConfig()) !== null && _getConfig16 !== void 0 && (_getConfig16 = _getConfig16.experimentalInteractionMetrics) !== null && _getConfig16 !== void 0 && _getConfig16.enabled) {
938
- onExperimentalInteractionComplete(interactionId, interaction, endTime);
939
- }
940
- postInteraction();
856
+ if (noMoreExpHolds) {
857
+ var _getConfig1;
858
+ if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.experimentalInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
859
+ onExperimentalInteractionComplete(interactionId, interaction, endTime || interaction.end);
941
860
  }
861
+ postInteraction();
942
862
  }
943
- if (noMoreActiveHolds && noMoreActive3pHolds) {
944
- var _data2 = _objectSpread(_objectSpread({}, interaction), {}, {
945
- end: endTime
946
- });
947
- interactionExtraMetrics.onInteractionComplete(interactionId, _data2);
948
- }
863
+ }
864
+ // Send separated third-party event even when feature flag is active
865
+ if (noMoreActiveHolds && noMoreActive3pHolds) {
866
+ var data = _objectSpread(_objectSpread({}, interaction), {}, {
867
+ end: endTime || interaction.end
868
+ });
869
+ interactionExtraMetrics.onInteractionComplete(interactionId, data);
949
870
  }
950
871
  } else {
951
- if (noMoreActiveHolds) {
872
+ var _interactionExtraMetr3;
873
+ // Original behavior when feature flag is not active
874
+ if (noMoreActiveHolds && ((_interactionExtraMetr3 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr3 === void 0 ? void 0 : _interactionExtraMetr3.id) !== interactionId) {
875
+ // If it's not waiting for extra metrics to complete, finish the interaction as normal
952
876
  if (!activeSubmitted) {
953
- var _getConfig17, _getConfig18;
877
+ var _getConfig10, _getConfig11, _getConfig12;
954
878
  finishInteraction(interactionId, interaction, endTime);
955
- if ((_getConfig17 = getConfig()) !== null && _getConfig17 !== void 0 && (_getConfig17 = _getConfig17.extraSearchPageInteraction) !== null && _getConfig17 !== void 0 && _getConfig17.enabled && interaction.ufoName === ((_getConfig18 = getConfig()) === null || _getConfig18 === void 0 || (_getConfig18 = _getConfig18.extraSearchPageInteraction) === null || _getConfig18 === void 0 ? void 0 : _getConfig18.searchPageMetricName)) {
879
+ if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.extraInteractionMetrics) !== null && _getConfig10 !== void 0 && _getConfig10.enabled) {
880
+ interactionExtraMetrics.updateFinishedInteraction(interaction);
881
+ }
882
+ if ((_getConfig11 = getConfig()) !== null && _getConfig11 !== void 0 && (_getConfig11 = _getConfig11.extraSearchPageInteraction) !== null && _getConfig11 !== void 0 && _getConfig11.enabled && interaction.ufoName === ((_getConfig12 = getConfig()) === null || _getConfig12 === void 0 || (_getConfig12 = _getConfig12.extraSearchPageInteraction) === null || _getConfig12 === void 0 ? void 0 : _getConfig12.searchPageMetricName)) {
956
883
  onSearchPageInteractionComplete(interactionId, interaction);
957
884
  }
958
885
  activeSubmitted = true;
959
886
  }
960
887
  if (noMoreExpHolds) {
961
- var _getConfig19;
962
- if ((_getConfig19 = getConfig()) !== null && _getConfig19 !== void 0 && (_getConfig19 = _getConfig19.experimentalInteractionMetrics) !== null && _getConfig19 !== void 0 && _getConfig19.enabled) {
888
+ var _getConfig13;
889
+ if ((_getConfig13 = getConfig()) !== null && _getConfig13 !== void 0 && (_getConfig13 = _getConfig13.experimentalInteractionMetrics) !== null && _getConfig13 !== void 0 && _getConfig13.enabled) {
963
890
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
964
891
  }
965
892
  postInteraction();
966
893
  }
967
894
  }
895
+ if (noMoreActiveHolds && noMoreActive3pHolds) {
896
+ var _data2 = _objectSpread(_objectSpread({}, interaction), {}, {
897
+ end: endTime
898
+ });
899
+ interactionExtraMetrics.onInteractionComplete(interactionId, _data2);
900
+ }
968
901
  }
969
902
  }
970
903
  }
@@ -987,9 +920,7 @@ export function abort(interactionId, abortReason) {
987
920
  finishInteraction(interactionId, interaction, endTime);
988
921
  postInteractionLog.reset();
989
922
  postInteractionLog.stopVCObserver();
990
- if (fg('platform_ufo_enable_ttai_with_3p')) {
991
- interactionExtraMetrics.stopAll(interactionId);
992
- }
923
+ interactionExtraMetrics.stopAll(interactionId);
993
924
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
994
925
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
995
926
  remove(interactionId);
@@ -1001,9 +932,7 @@ export function abort(interactionId, abortReason) {
1001
932
  finishInteraction(interactionId, interaction);
1002
933
  postInteractionLog.reset();
1003
934
  postInteractionLog.stopVCObserver();
1004
- if (fg('platform_ufo_enable_ttai_with_3p')) {
1005
- interactionExtraMetrics.stopAll(interactionId);
1006
- }
935
+ interactionExtraMetrics.stopAll(interactionId);
1007
936
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
1008
937
  onExperimentalInteractionComplete(interactionId, interaction);
1009
938
  remove(interactionId);
@@ -1025,9 +954,7 @@ export function abortByNewInteraction(interactionId, interactionName) {
1025
954
  finishInteraction(interactionId, interaction, endTime);
1026
955
  postInteractionLog.reset();
1027
956
  postInteractionLog.stopVCObserver();
1028
- if (fg('platform_ufo_enable_ttai_with_3p')) {
1029
- interactionExtraMetrics.stopAll(interactionId);
1030
- }
957
+ interactionExtraMetrics.stopAll(interactionId);
1031
958
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
1032
959
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
1033
960
  remove(interactionId);
@@ -1040,9 +967,7 @@ export function abortByNewInteraction(interactionId, interactionName) {
1040
967
  finishInteraction(interactionId, interaction);
1041
968
  postInteractionLog.reset();
1042
969
  postInteractionLog.stopVCObserver();
1043
- if (fg('platform_ufo_enable_ttai_with_3p')) {
1044
- interactionExtraMetrics.stopAll(interactionId);
1045
- }
970
+ interactionExtraMetrics.stopAll(interactionId);
1046
971
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
1047
972
  onExperimentalInteractionComplete(interactionId, interaction);
1048
973
  remove(interactionId);
@@ -1075,9 +1000,7 @@ export function abortAll(abortReason, abortedByInteractionName) {
1075
1000
  finishInteraction(interactionId, interaction, endTime);
1076
1001
  postInteractionLog.reset();
1077
1002
  postInteractionLog.stopVCObserver();
1078
- if (fg('platform_ufo_enable_ttai_with_3p')) {
1079
- interactionExtraMetrics.stopAll(interactionId);
1080
- }
1003
+ interactionExtraMetrics.stopAll(interactionId);
1081
1004
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
1082
1005
  onExperimentalInteractionComplete(interactionId, interaction, endTime);
1083
1006
  remove(interactionId);
@@ -1094,9 +1017,7 @@ export function abortAll(abortReason, abortedByInteractionName) {
1094
1017
  finishInteraction(interactionId, interaction);
1095
1018
  postInteractionLog.reset();
1096
1019
  postInteractionLog.stopVCObserver();
1097
- if (fg('platform_ufo_enable_ttai_with_3p')) {
1098
- interactionExtraMetrics.stopAll(interactionId);
1099
- }
1020
+ interactionExtraMetrics.stopAll(interactionId);
1100
1021
  if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
1101
1022
  onExperimentalInteractionComplete(interactionId, interaction);
1102
1023
  remove(interactionId);
@@ -1227,7 +1148,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
1227
1148
  addHoldByID(interactionId, [], ufoName, ufoName, true);
1228
1149
  }
1229
1150
  if (type === 'transition' || type === 'page_load') {
1230
- var _getConfig20, _config$extraInteract;
1151
+ var _getConfig14, _config$extraInteract;
1231
1152
  // Use per-interaction VC observer if available, otherwise fall back to global
1232
1153
  var observer = vcObserver;
1233
1154
  if (observer) {
@@ -1238,7 +1159,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
1238
1159
  }
1239
1160
  // Start post interaction observer for all if config is enabled
1240
1161
  // in case ufoName is updated at later time
1241
- if ((_getConfig20 = getConfig()) !== null && _getConfig20 !== void 0 && (_getConfig20 = _getConfig20.postInteractionLog) !== null && _getConfig20 !== void 0 && _getConfig20.enabled) {
1162
+ if ((_getConfig14 = getConfig()) !== null && _getConfig14 !== void 0 && (_getConfig14 = _getConfig14.postInteractionLog) !== null && _getConfig14 !== void 0 && _getConfig14.enabled) {
1242
1163
  postInteractionLog.startVCObserver({
1243
1164
  startTime: startTime
1244
1165
  });
@@ -1248,7 +1169,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
1248
1169
  startTime: startTime
1249
1170
  });
1250
1171
  }
1251
- 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')) {
1172
+ if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
1252
1173
  interactionExtraMetrics.startVCObserver({
1253
1174
  startTime: startTime
1254
1175
  }, interactionId);
@@ -191,7 +191,7 @@ export function init(analyticsWebClientAsync, config) {
191
191
  if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
192
192
  sinkPostInteractionLog(instance, createPostInteractionLogPayloadPackage.default);
193
193
  }
194
- 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')) {
194
+ if (config !== null && config !== void 0 && (_config$extraInteract2 = config.extraInteractionMetrics) !== null && _config$extraInteract2 !== void 0 && _config$extraInteract2.enabled) {
195
195
  sinkInteractionExtraMetrics(instance, createInteractionExtraMetricsPayloadPackage.default);
196
196
  }
197
197
  if (config !== null && config !== void 0 && (_config$extraSearchPa = config.extraSearchPageInteraction) !== null && _config$extraSearchPa !== void 0 && _config$extraSearchPa.enabled) {
@@ -210,7 +210,7 @@ export function init(analyticsWebClientAsync, config) {
210
210
  if ((_config$postInteracti2 = config.postInteractionLog) !== null && _config$postInteracti2 !== void 0 && _config$postInteracti2.enabled) {
211
211
  sinkPostInteractionLog(awc, createPostInteractionLogPayloadPackage.default);
212
212
  }
213
- 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')) {
213
+ if (config !== null && config !== void 0 && (_config$extraInteract3 = config.extraInteractionMetrics) !== null && _config$extraInteract3 !== void 0 && _config$extraInteract3.enabled) {
214
214
  sinkInteractionExtraMetrics(awc, createInteractionExtraMetricsPayloadPackage.default);
215
215
  }
216
216
  if (config !== null && config !== void 0 && (_config$extraSearchPa2 = config.extraSearchPageInteraction) !== null && _config$extraSearchPa2 !== void 0 && _config$extraSearchPa2.enabled) {
@@ -2,19 +2,12 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["children"];
4
4
  import React from 'react';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
- import UFOIgnoreHolds from '../ignore-holds';
7
5
  import UFOSegment from './segment';
8
6
  export var UFOThirdPartySegment = function UFOThirdPartySegment(props) {
9
7
  var children = props.children,
10
8
  otherProps = _objectWithoutProperties(props, _excluded);
11
- return fg('platform_ufo_enable_ttai_with_3p') ? /*#__PURE__*/React.createElement(UFOSegment, _extends({
9
+ return /*#__PURE__*/React.createElement(UFOSegment, _extends({
12
10
  type: "third-party"
13
- }, otherProps), children) : /*#__PURE__*/React.createElement(UFOSegment, _extends({
14
- type: "third-party"
15
- }, otherProps), /*#__PURE__*/React.createElement(UFOIgnoreHolds, {
16
- ignore: fg('platform_ufo_exclude_3p_elements_from_ttai'),
17
- reason: "third-party-element"
18
- }, children));
11
+ }, otherProps), children);
19
12
  };
20
13
  UFOThirdPartySegment.displayName = 'UFOThirdPartySegment';