@atlaskit/react-ufo 4.4.3 → 4.4.4

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 (63) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/create-interaction-extra-metrics-payload/index.js +116 -0
  3. package/dist/cjs/create-payload/index.js +3 -2
  4. package/dist/cjs/create-payload/utils/get-vc-metrics.js +37 -21
  5. package/dist/cjs/interaction-metrics/index.js +306 -232
  6. package/dist/cjs/interaction-metrics/interaction-extra-metrics.js +89 -0
  7. package/dist/cjs/interaction-metrics-init/index.js +51 -7
  8. package/dist/cjs/segment/third-party-segment.js +3 -1
  9. package/dist/cjs/ssr/index.js +3 -2
  10. package/dist/cjs/vc/index.js +4 -3
  11. package/dist/cjs/vc/vc-observer/index.js +3 -46
  12. package/dist/cjs/vc/vc-observer-new/index.js +4 -3
  13. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +3 -3
  14. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +4 -4
  15. package/dist/es2019/create-interaction-extra-metrics-payload/index.js +93 -0
  16. package/dist/es2019/create-payload/index.js +3 -3
  17. package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -2
  18. package/dist/es2019/interaction-metrics/index.js +310 -233
  19. package/dist/es2019/interaction-metrics/interaction-extra-metrics.js +63 -0
  20. package/dist/es2019/interaction-metrics-init/index.js +29 -2
  21. package/dist/es2019/segment/third-party-segment.js +3 -1
  22. package/dist/es2019/ssr/index.js +3 -2
  23. package/dist/es2019/vc/index.js +4 -2
  24. package/dist/es2019/vc/vc-observer/index.js +0 -43
  25. package/dist/es2019/vc/vc-observer-new/index.js +4 -2
  26. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +3 -2
  27. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +4 -4
  28. package/dist/esm/create-interaction-extra-metrics-payload/index.js +109 -0
  29. package/dist/esm/create-payload/index.js +3 -3
  30. package/dist/esm/create-payload/utils/get-vc-metrics.js +37 -21
  31. package/dist/esm/interaction-metrics/index.js +305 -231
  32. package/dist/esm/interaction-metrics/interaction-extra-metrics.js +83 -0
  33. package/dist/esm/interaction-metrics-init/index.js +48 -6
  34. package/dist/esm/segment/third-party-segment.js +3 -1
  35. package/dist/esm/ssr/index.js +3 -2
  36. package/dist/esm/vc/index.js +4 -3
  37. package/dist/esm/vc/vc-observer/index.js +3 -46
  38. package/dist/esm/vc/vc-observer-new/index.js +4 -3
  39. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +3 -3
  40. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +4 -4
  41. package/dist/types/common/common/types.d.ts +2 -0
  42. package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +45 -0
  43. package/dist/types/create-payload/index.d.ts +1 -0
  44. package/dist/types/create-payload/utils/get-vc-metrics.d.ts +1 -1
  45. package/dist/types/interaction-metrics/index.d.ts +2 -0
  46. package/dist/types/interaction-metrics/interaction-extra-metrics.d.ts +17 -0
  47. package/dist/types/vc/types.d.ts +1 -0
  48. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
  49. package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
  50. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  51. package/dist/types/vc/vc-observer-new/types.d.ts +1 -0
  52. package/dist/types-ts4.5/common/common/types.d.ts +2 -0
  53. package/dist/types-ts4.5/create-interaction-extra-metrics-payload/index.d.ts +45 -0
  54. package/dist/types-ts4.5/create-payload/index.d.ts +1 -0
  55. package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +1 -1
  56. package/dist/types-ts4.5/interaction-metrics/index.d.ts +2 -0
  57. package/dist/types-ts4.5/interaction-metrics/interaction-extra-metrics.d.ts +17 -0
  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 +1 -1
  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/types.d.ts +1 -0
  63. package/package.json +4 -7
@@ -35,7 +35,7 @@ exports.addSpanToAll = addSpanToAll;
35
35
  exports.extractModuleName = extractModuleName;
36
36
  exports.getActiveInteraction = getActiveInteraction;
37
37
  exports.getCurrentInteractionType = getCurrentInteractionType;
38
- exports.postInteractionLog = exports.interactionSpans = exports.getPerformanceObserver = void 0;
38
+ exports.postInteractionLog = exports.interactionSpans = exports.interactionExtraMetrics = exports.getPerformanceObserver = void 0;
39
39
  exports.remove = remove;
40
40
  exports.removeHoldByID = removeHoldByID;
41
41
  exports.removeSegment = removeSegment;
@@ -61,6 +61,7 @@ var _featureFlagsAccessed = require("../feature-flags-accessed");
61
61
  var _interactionIdContext = require("../interaction-id-context");
62
62
  var _vc = require("../vc");
63
63
  var _constants = require("./common/constants");
64
+ var _interactionExtraMetrics = _interopRequireDefault(require("./interaction-extra-metrics"));
64
65
  var _postInteractionLog = _interopRequireDefault(require("./post-interaction-log"));
65
66
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
66
67
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -72,6 +73,7 @@ var PreviousInteractionLog = {
72
73
  isAborted: undefined
73
74
  };
74
75
  var postInteractionLog = exports.postInteractionLog = new _postInteractionLog.default();
76
+ var interactionExtraMetrics = exports.interactionExtraMetrics = new _interactionExtraMetrics.default();
75
77
  var interactionQueue = [];
76
78
  var segmentCache = new Map();
77
79
  var segmentUnmountCache = exports.segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
@@ -238,23 +240,16 @@ function addCustomTiming(interactionId, labelStack, data) {
238
240
  endTime = timingData.endTime;
239
241
  try {
240
242
  // for Firefox 102 and older
241
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
242
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, key), " [custom_timing]"), {
243
- start: startTime,
244
- end: endTime,
245
- detail: {
246
- devtools: {
247
- track: '🛸 reactUFO detailed timings',
248
- color: 'tertiary-light'
249
- }
243
+ performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, key), " [custom_timing]"), {
244
+ start: startTime,
245
+ end: endTime,
246
+ detail: {
247
+ devtools: {
248
+ track: '🛸 reactUFO detailed timings',
249
+ color: 'tertiary-light'
250
250
  }
251
- });
252
- } else {
253
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, key), " [custom_timing]"), {
254
- start: startTime,
255
- end: endTime
256
- });
257
- }
251
+ }
252
+ });
258
253
  } catch (e) {
259
254
  // do nothing
260
255
  }
@@ -311,23 +306,16 @@ function addSpan(interactionId, type, name, labelStack, start) {
311
306
  if (isPerformanceTracingEnabled()) {
312
307
  try {
313
308
  // for Firefox 102 and older
314
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
315
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
316
- start: start,
317
- end: end,
318
- detail: {
319
- devtools: {
320
- track: '🛸 reactUFO detailed timings',
321
- color: 'secondary'
322
- }
309
+ performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
310
+ start: start,
311
+ end: end,
312
+ detail: {
313
+ devtools: {
314
+ track: '🛸 reactUFO detailed timings',
315
+ color: 'secondary'
323
316
  }
324
- });
325
- } else {
326
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
327
- start: start,
328
- end: end
329
- });
330
- }
317
+ }
318
+ });
331
319
  } catch (e) {
332
320
  // do nothing
333
321
  }
@@ -350,23 +338,16 @@ function addSpanToAll(type, name, labelStack, start) {
350
338
  if (isPerformanceTracingEnabled()) {
351
339
  try {
352
340
  // for Firefox 102 and older
353
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
354
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
355
- start: start,
356
- end: end,
357
- detail: {
358
- devtools: {
359
- track: '🛸 reactUFO detailed timings',
360
- color: 'secondary'
361
- }
341
+ performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
342
+ start: start,
343
+ end: end,
344
+ detail: {
345
+ devtools: {
346
+ track: '🛸 reactUFO detailed timings',
347
+ color: 'secondary'
362
348
  }
363
- });
364
- } else {
365
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
366
- start: start,
367
- end: end
368
- });
369
- }
349
+ }
350
+ });
370
351
  } catch (e) {
371
352
  // do nothing
372
353
  }
@@ -404,46 +385,58 @@ function addHold(interactionId, labelStack, name, experimental) {
404
385
  var interaction = _constants.interactions.get(interactionId);
405
386
  var id = (0, _uuid.v4)();
406
387
  if (interaction != null) {
407
- var _getConfig2;
408
388
  var start = performance.now();
409
389
  var holdActive = {
410
390
  labelStack: labelStack,
411
391
  name: name,
412
392
  start: start
413
393
  };
414
- if ((_getConfig2 = (0, _config.getConfig)()) !== null && _getConfig2 !== void 0 && (_getConfig2 = _getConfig2.experimentalInteractionMetrics) !== null && _getConfig2 !== void 0 && _getConfig2.enabled && experimental) {
415
- interaction.holdExpActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
416
- start: start
417
- }));
418
- }
419
- if (!experimental) {
420
- interaction.holdActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
421
- start: start
422
- }));
394
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
395
+ var is3pHold = labelStack.some(function (l) {
396
+ return 'type' in l && l.type === 'third-party';
397
+ });
398
+ if (is3pHold) {
399
+ if (!interaction.hold3pActive) {
400
+ interaction.hold3pActive = new Map();
401
+ }
402
+ interaction.hold3pActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
403
+ start: start
404
+ }));
405
+ } else {
406
+ interaction.holdActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
407
+ start: start
408
+ }));
409
+ addHoldCriterion(id, labelStack, name, start);
410
+ }
411
+ } else {
412
+ var _getConfig2;
413
+ if ((_getConfig2 = (0, _config.getConfig)()) !== null && _getConfig2 !== void 0 && (_getConfig2 = _getConfig2.experimentalInteractionMetrics) !== null && _getConfig2 !== void 0 && _getConfig2.enabled && experimental) {
414
+ interaction.holdExpActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
415
+ start: start
416
+ }));
417
+ }
418
+ if (!experimental) {
419
+ interaction.holdActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
420
+ start: start
421
+ }));
422
+ }
423
+ addHoldCriterion(id, labelStack, name, start);
423
424
  }
424
- addHoldCriterion(id, labelStack, name, start);
425
425
  return function () {
426
426
  var end = performance.now();
427
427
  if (isPerformanceTracingEnabled()) {
428
428
  try {
429
429
  // for Firefox 102 and older
430
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
431
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [hold]"), {
432
- start: start,
433
- end: end,
434
- detail: {
435
- devtools: {
436
- track: '🛸 reactUFO detailed timings',
437
- color: 'secondary-light'
438
- }
430
+ performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [hold]"), {
431
+ start: start,
432
+ end: end,
433
+ detail: {
434
+ devtools: {
435
+ track: '🛸 reactUFO detailed timings',
436
+ color: 'secondary-light'
439
437
  }
440
- });
441
- } else {
442
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [hold]"), {
443
- start: start,
444
- end: end
445
- });
446
- }
438
+ }
439
+ });
447
440
  } catch (e) {
448
441
  // do nothing
449
442
  }
@@ -465,6 +458,20 @@ function addHold(interactionId, labelStack, name, experimental) {
465
458
  }));
466
459
  interaction.holdExpActive.delete(id);
467
460
  }
461
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
462
+ if (interaction.hold3pActive) {
463
+ var current3pHold = interaction.hold3pActive.get(id);
464
+ if (current3pHold != null) {
465
+ if (!currentInteraction.hold3pInfo) {
466
+ currentInteraction.hold3pInfo = [];
467
+ }
468
+ currentInteraction.hold3pInfo.push(_objectSpread(_objectSpread({}, current3pHold), {}, {
469
+ end: end
470
+ }));
471
+ interaction.hold3pActive.delete(id);
472
+ }
473
+ }
474
+ }
468
475
  }
469
476
  };
470
477
  }
@@ -474,13 +481,38 @@ function addHoldByID(interactionId, labelStack, name, id, ignoreOnSubmit) {
474
481
  var interaction = _constants.interactions.get(interactionId);
475
482
  if (interaction != null) {
476
483
  var start = performance.now();
477
- interaction.holdActive.set(id, {
478
- labelStack: labelStack,
479
- name: name,
480
- start: start,
481
- ignoreOnSubmit: ignoreOnSubmit
482
- });
483
- addHoldCriterion(id, labelStack, name, start);
484
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
485
+ var is3pHold = labelStack.some(function (l) {
486
+ return 'type' in l && l.type === 'third-party';
487
+ });
488
+ if (is3pHold) {
489
+ if (!interaction.hold3pActive) {
490
+ interaction.hold3pActive = new Map();
491
+ }
492
+ interaction.hold3pActive.set(id, {
493
+ labelStack: labelStack,
494
+ name: name,
495
+ start: start,
496
+ ignoreOnSubmit: ignoreOnSubmit
497
+ });
498
+ } else {
499
+ interaction.holdActive.set(id, {
500
+ labelStack: labelStack,
501
+ name: name,
502
+ start: start,
503
+ ignoreOnSubmit: ignoreOnSubmit
504
+ });
505
+ addHoldCriterion(id, labelStack, name, start);
506
+ }
507
+ } else {
508
+ interaction.holdActive.set(id, {
509
+ labelStack: labelStack,
510
+ name: name,
511
+ start: start,
512
+ ignoreOnSubmit: ignoreOnSubmit
513
+ });
514
+ addHoldCriterion(id, labelStack, name, start);
515
+ }
484
516
  }
485
517
  return function () {};
486
518
  }
@@ -497,6 +529,20 @@ function removeHoldByID(interactionId, id) {
497
529
  interaction.holdActive.delete(id);
498
530
  removeHoldCriterion(id);
499
531
  }
532
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
533
+ if (interaction.hold3pActive) {
534
+ var current3pHold = interaction.hold3pActive.get(id);
535
+ if (currentInteraction != null && current3pHold != null) {
536
+ if (!currentInteraction.hold3pInfo) {
537
+ currentInteraction.hold3pInfo = [];
538
+ }
539
+ currentInteraction.hold3pInfo.push(_objectSpread(_objectSpread({}, current3pHold), {}, {
540
+ end: end
541
+ }));
542
+ interaction.hold3pActive.delete(id);
543
+ }
544
+ }
545
+ }
500
546
  }
501
547
  }
502
548
  function getCurrentInteractionType(interactionId) {
@@ -570,23 +616,16 @@ function addProfilerTimings(interactionId, labelStack, type, actualDuration, bas
570
616
  if (isPerformanceTracingEnabled()) {
571
617
  try {
572
618
  // for Firefox 102 and older
573
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
574
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [react-profiler] ").concat(type), {
575
- start: startTime,
576
- duration: actualDuration,
577
- detail: {
578
- devtools: {
579
- track: '🛸 reactUFO detailed timings',
580
- color: 'secondary-dark'
581
- }
619
+ performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [react-profiler] ").concat(type), {
620
+ start: startTime,
621
+ duration: actualDuration,
622
+ detail: {
623
+ devtools: {
624
+ track: '🛸 reactUFO detailed timings',
625
+ color: 'secondary-dark'
582
626
  }
583
- });
584
- } else {
585
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [react-profiler] ").concat(type), {
586
- start: startTime,
587
- duration: actualDuration
588
- });
589
- }
627
+ }
628
+ });
590
629
  } catch (e) {
591
630
  // do nothing
592
631
  }
@@ -618,38 +657,30 @@ function callCleanUpCallbacks(interaction) {
618
657
  });
619
658
  }
620
659
  function finishInteraction(id, data) {
621
- var _getConfig4, _getConfig5;
660
+ var _getConfig4;
622
661
  var endTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : performance.now();
623
662
  data.end = endTime;
624
663
  try {
625
664
  // for Firefox 102 and older
626
-
627
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
628
- performance.measure("\uD83D\uDEF8 [".concat(data.type, "] ").concat(data.ufoName, " [ttai]"), {
629
- start: data.start,
630
- end: data.end,
631
- detail: {
632
- devtools: {
633
- track: 'main metrics',
634
- trackGroup: '🛸 reactUFO metrics',
635
- color: 'tertiary'
636
- }
665
+ performance.measure("\uD83D\uDEF8 [".concat(data.type, "] ").concat(data.ufoName, " [ttai]"), {
666
+ start: data.start,
667
+ end: data.end,
668
+ detail: {
669
+ devtools: {
670
+ track: 'main metrics',
671
+ trackGroup: '🛸 reactUFO metrics',
672
+ color: 'tertiary'
637
673
  }
638
- });
639
- performance.mark("TTAI", {
640
- startTime: data.end,
641
- detail: {
642
- devtools: {
643
- dataType: 'marker'
644
- }
674
+ }
675
+ });
676
+ performance.mark("TTAI", {
677
+ startTime: data.end,
678
+ detail: {
679
+ devtools: {
680
+ dataType: 'marker'
645
681
  }
646
- });
647
- } else {
648
- performance.measure("\uD83D\uDEF8 [".concat(data.type, "] ").concat(data.ufoName, " [ttai]"), {
649
- start: data.start,
650
- end: data.end
651
- });
652
- }
682
+ }
683
+ });
653
684
  } catch (e) {
654
685
  // do nothing
655
686
  }
@@ -678,13 +709,31 @@ function finishInteraction(id, data) {
678
709
  postInteractionLog.stopVCObserver();
679
710
  }
680
711
  }
681
- if (!((_getConfig5 = (0, _config.getConfig)()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
682
- remove(id);
712
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
713
+ if (!data.hold3pActive || data.hold3pActive.size === 0) {
714
+ var _getConfig5;
715
+ if (!((_getConfig5 = (0, _config.getConfig)()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
716
+ remove(id);
717
+ }
718
+ interactionExtraMetrics.stopVCObserver();
719
+ }
720
+ } else {
721
+ var _getConfig6;
722
+ if (!((_getConfig6 = (0, _config.getConfig)()) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.experimentalInteractionMetrics) !== null && _getConfig6 !== void 0 && _getConfig6.enabled)) {
723
+ remove(id);
724
+ }
683
725
  }
684
726
  PreviousInteractionLog.name = data.ufoName || 'unknown';
685
727
  PreviousInteractionLog.isAborted = data.abortReason != null;
686
728
  if (data.ufoName) {
687
- handleInteraction(id, data);
729
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
730
+ if (interactionExtraMetrics.finishedInteractionId !== id) {
731
+ // If this same interaction was not already handled, handle it
732
+ handleInteraction(id, data);
733
+ }
734
+ } else {
735
+ handleInteraction(id, data);
736
+ }
688
737
  }
689
738
  if (isPerformanceTracingEnabled()) {
690
739
  var profilerTimingMap = new Map();
@@ -711,23 +760,16 @@ function finishInteraction(id, data) {
711
760
  labelStack = _step3$value$.labelStack,
712
761
  start = _step3$value$.start,
713
762
  end = _step3$value$.end;
714
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
715
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [segment_ttai]"), {
716
- start: start,
717
- end: end,
718
- detail: {
719
- devtools: {
720
- track: '🛸 reactUFO detailed timings',
721
- color: 'secondary-dark'
722
- }
763
+ performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [segment_ttai]"), {
764
+ start: start,
765
+ end: end,
766
+ detail: {
767
+ devtools: {
768
+ track: '🛸 reactUFO detailed timings',
769
+ color: 'secondary-dark'
723
770
  }
724
- });
725
- } else {
726
- performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [segment_ttai]"), {
727
- start: start,
728
- end: end
729
- });
730
- }
771
+ }
772
+ });
731
773
  }
732
774
  } catch (err) {
733
775
  _iterator3.e(err);
@@ -769,16 +811,16 @@ function tryComplete(interactionId, endTime) {
769
811
  var noMoreExpHolds = interaction.holdExpActive.size === 0;
770
812
  var postInteraction = /*#__PURE__*/function () {
771
813
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
772
- var _getConfig6, _getConfig8;
773
- var _getConfig7, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end;
814
+ var _getConfig7;
815
+ var _getConfig8, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _getConfig9, _getConfig0;
774
816
  return _regenerator.default.wrap(function _callee$(_context) {
775
817
  while (1) switch (_context.prev = _context.next) {
776
818
  case 0:
777
- if (!((_getConfig6 = (0, _config.getConfig)()) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.postInteractionLog) !== null && _getConfig6 !== void 0 && _getConfig6.enabled)) {
819
+ if (!((_getConfig7 = (0, _config.getConfig)()) !== null && _getConfig7 !== void 0 && (_getConfig7 = _getConfig7.postInteractionLog) !== null && _getConfig7 !== void 0 && _getConfig7.enabled)) {
778
820
  _context.next = 17;
779
821
  break;
780
822
  }
781
- if (!((_getConfig7 = (0, _config.getConfig)()) !== null && _getConfig7 !== void 0 && (_getConfig7 = _getConfig7.experimentalInteractionMetrics) !== null && _getConfig7 !== void 0 && _getConfig7.enabled)) {
823
+ if (!((_getConfig8 = (0, _config.getConfig)()) !== null && _getConfig8 !== void 0 && (_getConfig8 = _getConfig8.experimentalInteractionMetrics) !== null && _getConfig8 !== void 0 && _getConfig8.enabled)) {
782
824
  _context.next = 16;
783
825
  break;
784
826
  }
@@ -812,8 +854,17 @@ function tryComplete(interactionId, endTime) {
812
854
  experimentalVC90: experimentalVC90
813
855
  }));
814
856
  case 17:
815
- if ((_getConfig8 = (0, _config.getConfig)()) !== null && _getConfig8 !== void 0 && (_getConfig8 = _getConfig8.experimentalInteractionMetrics) !== null && _getConfig8 !== void 0 && _getConfig8.enabled) {
816
- remove(interactionId);
857
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
858
+ if (interactionExtraMetrics.finishedInteractionId !== interactionId) {
859
+ // If interactionExtraMetrics is not waiting for measuring this interaction
860
+ if ((_getConfig9 = (0, _config.getConfig)()) !== null && _getConfig9 !== void 0 && (_getConfig9 = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9 !== void 0 && _getConfig9.enabled) {
861
+ remove(interactionId);
862
+ }
863
+ }
864
+ } else {
865
+ if ((_getConfig0 = (0, _config.getConfig)()) !== null && _getConfig0 !== void 0 && (_getConfig0 = _getConfig0.experimentalInteractionMetrics) !== null && _getConfig0 !== void 0 && _getConfig0.enabled) {
866
+ remove(interactionId);
867
+ }
817
868
  }
818
869
  activeSubmitted = false;
819
870
  case 19:
@@ -826,17 +877,42 @@ function tryComplete(interactionId, endTime) {
826
877
  return _ref.apply(this, arguments);
827
878
  };
828
879
  }();
829
- if (noMoreActiveHolds) {
830
- if (!activeSubmitted) {
831
- finishInteraction(interactionId, interaction, endTime);
832
- activeSubmitted = true;
880
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
881
+ var _interaction$hold3pAc;
882
+ var noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
883
+ if (noMoreActiveHolds) {
884
+ if (!activeSubmitted) {
885
+ finishInteraction(interactionId, interaction, endTime);
886
+ interactionExtraMetrics.updateFinishedInteractionId(interactionId);
887
+ activeSubmitted = true;
888
+ }
889
+ if (noMoreExpHolds) {
890
+ var _getConfig1;
891
+ if ((_getConfig1 = (0, _config.getConfig)()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.experimentalInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
892
+ (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction, endTime);
893
+ }
894
+ postInteraction();
895
+ }
896
+ if (noMoreActive3pHolds) {
897
+ var data = _objectSpread(_objectSpread({}, interaction), {}, {
898
+ end: endTime
899
+ });
900
+ interactionExtraMetrics.onInteractionComplete(interactionId, data);
901
+ }
833
902
  }
834
- if (noMoreExpHolds) {
835
- var _getConfig9;
836
- if ((_getConfig9 = (0, _config.getConfig)()) !== null && _getConfig9 !== void 0 && (_getConfig9 = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9 !== void 0 && _getConfig9.enabled) {
837
- (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction, endTime);
903
+ } else {
904
+ if (noMoreActiveHolds) {
905
+ if (!activeSubmitted) {
906
+ finishInteraction(interactionId, interaction, endTime);
907
+ activeSubmitted = true;
908
+ }
909
+ if (noMoreExpHolds) {
910
+ var _getConfig10;
911
+ if ((_getConfig10 = (0, _config.getConfig)()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.experimentalInteractionMetrics) !== null && _getConfig10 !== void 0 && _getConfig10.enabled) {
912
+ (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction, endTime);
913
+ }
914
+ postInteraction();
838
915
  }
839
- postInteraction();
840
916
  }
841
917
  }
842
918
  }
@@ -864,6 +940,11 @@ function abort(interactionId, abortReason) {
864
940
  finishInteraction(interactionId, interaction);
865
941
  postInteractionLog.reset();
866
942
  postInteractionLog.stopVCObserver();
943
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
944
+ interactionExtraMetrics.stopVCObserver();
945
+ interactionExtraMetrics.reset();
946
+ remove(interactionId);
947
+ }
867
948
  if ((0, _coinflip.default)((0, _config.getExperimentalInteractionRate)(interaction.ufoName, interaction.type))) {
868
949
  (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction);
869
950
  remove(interactionId);
@@ -889,6 +970,11 @@ function abortByNewInteraction(interactionId, interactionName) {
889
970
  finishInteraction(interactionId, interaction);
890
971
  postInteractionLog.reset();
891
972
  postInteractionLog.stopVCObserver();
973
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
974
+ interactionExtraMetrics.stopVCObserver();
975
+ interactionExtraMetrics.reset();
976
+ remove(interactionId);
977
+ }
892
978
  if ((0, _coinflip.default)((0, _config.getExperimentalInteractionRate)(interaction.ufoName, interaction.type))) {
893
979
  (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction);
894
980
  remove(interactionId);
@@ -918,6 +1004,11 @@ function abortAll(abortReason, abortedByInteractionName) {
918
1004
  finishInteraction(interactionId, interaction);
919
1005
  postInteractionLog.reset();
920
1006
  postInteractionLog.stopVCObserver();
1007
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
1008
+ interactionExtraMetrics.stopVCObserver();
1009
+ interactionExtraMetrics.reset();
1010
+ remove(interactionId);
1011
+ }
921
1012
  if ((0, _coinflip.default)((0, _config.getExperimentalInteractionRate)(interaction.ufoName, interaction.type))) {
922
1013
  (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction);
923
1014
  remove(interactionId);
@@ -1015,7 +1106,9 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1015
1106
  timerID: timerID,
1016
1107
  changeTimeout: changeTimeout,
1017
1108
  trace: trace,
1018
- vcObserver: vcObserver
1109
+ vcObserver: vcObserver,
1110
+ hold3pActive: new Map(),
1111
+ hold3pInfo: []
1019
1112
  };
1020
1113
  if (addFeatureFlagsToInteraction) {
1021
1114
  _featureFlagsAccessed.currentFeatureFlagsAccessed.clear();
@@ -1054,10 +1147,10 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1054
1147
  });
1055
1148
  }
1056
1149
  if ((0, _platformFeatureFlags.fg)('platform_ufo_post_interaction_check_name')) {
1057
- var _getConfig0;
1150
+ var _getConfig11;
1058
1151
  // Start post interaction observer for all if config is enabled
1059
1152
  // in case ufoName is updated at later time
1060
- if ((_getConfig0 = (0, _config.getConfig)()) !== null && _getConfig0 !== void 0 && (_getConfig0 = _getConfig0.postInteractionLog) !== null && _getConfig0 !== void 0 && _getConfig0.enabled) {
1153
+ if ((_getConfig11 = (0, _config.getConfig)()) !== null && _getConfig11 !== void 0 && (_getConfig11 = _getConfig11.postInteractionLog) !== null && _getConfig11 !== void 0 && _getConfig11.enabled) {
1061
1154
  postInteractionLog.startVCObserver({
1062
1155
  startTime: startTime
1063
1156
  });
@@ -1074,6 +1167,11 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1074
1167
  startTime: startTime
1075
1168
  });
1076
1169
  }
1170
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
1171
+ interactionExtraMetrics.startVCObserver({
1172
+ startTime: startTime
1173
+ }, interactionId);
1174
+ }
1077
1175
  }
1078
1176
  if (type === 'press' && (0, _platformFeatureFlags.fg)('platform_ufo_enable_vc_press_interactions')) {
1079
1177
  // Use per-interaction VC observer if available, otherwise fall back to global
@@ -1101,35 +1199,27 @@ function addApdexToAll(apdex) {
1101
1199
  _constants.interactions.forEach(function (interaction, key) {
1102
1200
  interaction.apdex.push(apdex);
1103
1201
  try {
1202
+ var _apdex$startTime;
1104
1203
  // for Firefox 102 and older
1105
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
1106
- var _apdex$startTime;
1107
- performance.measure("\uD83D\uDEF8 ".concat(apdex.key, " [bm3_tti]"), {
1108
- start: (_apdex$startTime = apdex.startTime) !== null && _apdex$startTime !== void 0 ? _apdex$startTime : interaction.start,
1109
- end: apdex.stopTime,
1110
- detail: {
1111
- devtools: {
1112
- track: 'main metrics',
1113
- trackGroup: '🛸 reactUFO metrics',
1114
- color: 'primary-dark'
1115
- }
1204
+ performance.measure("\uD83D\uDEF8 ".concat(apdex.key, " [bm3_tti]"), {
1205
+ start: (_apdex$startTime = apdex.startTime) !== null && _apdex$startTime !== void 0 ? _apdex$startTime : interaction.start,
1206
+ end: apdex.stopTime,
1207
+ detail: {
1208
+ devtools: {
1209
+ track: 'main metrics',
1210
+ trackGroup: '🛸 reactUFO metrics',
1211
+ color: 'primary-dark'
1116
1212
  }
1117
- });
1118
- performance.mark("[bm3] TTI", {
1119
- startTime: apdex.stopTime,
1120
- detail: {
1121
- devtools: {
1122
- dataType: 'marker'
1123
- }
1213
+ }
1214
+ });
1215
+ performance.mark("[bm3] TTI", {
1216
+ startTime: apdex.stopTime,
1217
+ detail: {
1218
+ devtools: {
1219
+ dataType: 'marker'
1124
1220
  }
1125
- });
1126
- } else {
1127
- var _apdex$startTime2;
1128
- performance.measure("\uD83D\uDEF8 ".concat(apdex.key, " [bm3_tti]"), {
1129
- start: (_apdex$startTime2 = apdex.startTime) !== null && _apdex$startTime2 !== void 0 ? _apdex$startTime2 : interaction.start,
1130
- end: apdex.stopTime
1131
- });
1132
- }
1221
+ }
1222
+ });
1133
1223
  } catch (e) {
1134
1224
  // do nothing
1135
1225
  }
@@ -1143,35 +1233,27 @@ function addApdex(interactionId, apdexInfo) {
1143
1233
  if (interaction != null) {
1144
1234
  interaction.apdex.push(apdexInfo);
1145
1235
  try {
1236
+ var _apdexInfo$startTime;
1146
1237
  // for Firefox 102 and older
1147
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
1148
- var _apdexInfo$startTime;
1149
- performance.measure("\uD83D\uDEF8 ".concat(apdexInfo.key, " [bm3_tti]"), {
1150
- start: (_apdexInfo$startTime = apdexInfo.startTime) !== null && _apdexInfo$startTime !== void 0 ? _apdexInfo$startTime : interaction.start,
1151
- end: apdexInfo.stopTime,
1152
- detail: {
1153
- devtools: {
1154
- track: 'main metrics',
1155
- trackGroup: '🛸 reactUFO metrics',
1156
- color: 'primary-dark'
1157
- }
1238
+ performance.measure("\uD83D\uDEF8 ".concat(apdexInfo.key, " [bm3_tti]"), {
1239
+ start: (_apdexInfo$startTime = apdexInfo.startTime) !== null && _apdexInfo$startTime !== void 0 ? _apdexInfo$startTime : interaction.start,
1240
+ end: apdexInfo.stopTime,
1241
+ detail: {
1242
+ devtools: {
1243
+ track: 'main metrics',
1244
+ trackGroup: '🛸 reactUFO metrics',
1245
+ color: 'primary-dark'
1158
1246
  }
1159
- });
1160
- performance.mark("[bm3] TTI", {
1161
- startTime: apdexInfo.stopTime,
1162
- detail: {
1163
- devtools: {
1164
- dataType: 'marker'
1165
- }
1247
+ }
1248
+ });
1249
+ performance.mark("[bm3] TTI", {
1250
+ startTime: apdexInfo.stopTime,
1251
+ detail: {
1252
+ devtools: {
1253
+ dataType: 'marker'
1166
1254
  }
1167
- });
1168
- } else {
1169
- var _apdexInfo$startTime2;
1170
- performance.measure("\uD83D\uDEF8 ".concat(apdexInfo.key, " [bm3_tti]"), {
1171
- start: (_apdexInfo$startTime2 = apdexInfo.startTime) !== null && _apdexInfo$startTime2 !== void 0 ? _apdexInfo$startTime2 : interaction.start,
1172
- end: apdexInfo.stopTime
1173
- });
1174
- }
1255
+ }
1256
+ });
1175
1257
  } catch (e) {
1176
1258
  // do nothing
1177
1259
  }
@@ -1238,26 +1320,18 @@ function addRedirect(interactionId, fromUfoName, nextUfoName, nextRouteName, tim
1238
1320
  if (isPerformanceTracingEnabled()) {
1239
1321
  var prevRedirect = interaction.redirects.at(-2);
1240
1322
  try {
1323
+ var _prevRedirect$time;
1241
1324
  // for Firefox 102 and older
1242
- if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
1243
- var _prevRedirect$time;
1244
- performance.measure("\uD83D\uDEF8 ".concat(nextUfoName, " [redirect]"), {
1245
- start: (_prevRedirect$time = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time !== void 0 ? _prevRedirect$time : interaction.start,
1246
- end: time,
1247
- detail: {
1248
- devtools: {
1249
- track: '🛸 reactUFO detailed timings',
1250
- color: 'tertiary'
1251
- }
1325
+ performance.measure("\uD83D\uDEF8 ".concat(nextUfoName, " [redirect]"), {
1326
+ start: (_prevRedirect$time = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time !== void 0 ? _prevRedirect$time : interaction.start,
1327
+ end: time,
1328
+ detail: {
1329
+ devtools: {
1330
+ track: '🛸 reactUFO detailed timings',
1331
+ color: 'tertiary'
1252
1332
  }
1253
- });
1254
- } else {
1255
- var _prevRedirect$time2;
1256
- performance.measure("\uD83D\uDEF8 ".concat(nextUfoName, " [redirect]"), {
1257
- start: (_prevRedirect$time2 = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time2 !== void 0 ? _prevRedirect$time2 : interaction.start,
1258
- end: time
1259
- });
1260
- }
1333
+ }
1334
+ });
1261
1335
  } catch (e) {
1262
1336
  // do nothing
1263
1337
  }