@atlaskit/react-ufo 2.14.2 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/create-payload/index.js +11 -0
  3. package/dist/cjs/experience-trace-id-context/index.js +5 -1
  4. package/dist/cjs/segment/segment.js +7 -1
  5. package/dist/cjs/vc/vc-observer/heatmap/heatmap.js +275 -0
  6. package/dist/cjs/vc/vc-observer/index.js +133 -29
  7. package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +16 -27
  8. package/dist/cjs/vc/vc-observer/revisions/ViewportUpdateClassifier.js +52 -0
  9. package/dist/cjs/vc/vc-observer/revisions/fy24_01.js +39 -0
  10. package/dist/cjs/vc/vc-observer/revisions/fy25_01.js +39 -0
  11. package/dist/cjs/vc/vc-observer/revisions/revisions.js +23 -0
  12. package/dist/cjs/vc/vc-observer/revisions/types.js +5 -0
  13. package/dist/es2019/create-payload/index.js +11 -0
  14. package/dist/es2019/experience-trace-id-context/index.js +4 -0
  15. package/dist/es2019/segment/segment.js +11 -3
  16. package/dist/es2019/vc/vc-observer/heatmap/heatmap.js +238 -0
  17. package/dist/es2019/vc/vc-observer/index.js +115 -7
  18. package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +16 -27
  19. package/dist/es2019/vc/vc-observer/revisions/ViewportUpdateClassifier.js +35 -0
  20. package/dist/es2019/vc/vc-observer/revisions/fy24_01.js +21 -0
  21. package/dist/es2019/vc/vc-observer/revisions/fy25_01.js +21 -0
  22. package/dist/es2019/vc/vc-observer/revisions/revisions.js +19 -0
  23. package/dist/es2019/vc/vc-observer/revisions/types.js +1 -0
  24. package/dist/esm/create-payload/index.js +11 -0
  25. package/dist/esm/experience-trace-id-context/index.js +4 -0
  26. package/dist/esm/segment/segment.js +7 -1
  27. package/dist/esm/vc/vc-observer/heatmap/heatmap.js +268 -0
  28. package/dist/esm/vc/vc-observer/index.js +133 -29
  29. package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +16 -27
  30. package/dist/esm/vc/vc-observer/revisions/ViewportUpdateClassifier.js +45 -0
  31. package/dist/esm/vc/vc-observer/revisions/fy24_01.js +32 -0
  32. package/dist/esm/vc/vc-observer/revisions/fy25_01.js +32 -0
  33. package/dist/esm/vc/vc-observer/revisions/revisions.js +17 -0
  34. package/dist/esm/vc/vc-observer/revisions/types.js +1 -0
  35. package/dist/types/common/vc/types.d.ts +28 -9
  36. package/dist/types/create-payload/index.d.ts +16 -0
  37. package/dist/types/experience-trace-id-context/index.d.ts +1 -0
  38. package/dist/types/interaction-ignore/ufo-interaction-ignore.d.ts +2 -2
  39. package/dist/types/label/UFOLabel.d.ts +2 -2
  40. package/dist/types/load-hold/UFOLoadHold.d.ts +2 -2
  41. package/dist/types/placeholder/Placeholder.d.ts +2 -2
  42. package/dist/types/placeholder/loosely-lazy/lazy-suspense.d.ts +2 -2
  43. package/dist/types/segment/segment-highlight.d.ts +2 -2
  44. package/dist/types/segment/segment.d.ts +2 -2
  45. package/dist/types/vc/vc-observer/heatmap/heatmap.d.ts +75 -0
  46. package/dist/types/vc/vc-observer/index.d.ts +6 -1
  47. package/dist/types/vc/vc-observer/media-wrapper/MediaWrapper.d.ts +1 -1
  48. package/dist/types/vc/vc-observer/revisions/ViewportUpdateClassifier.d.ts +25 -0
  49. package/dist/types/vc/vc-observer/revisions/fy24_01.d.ts +11 -0
  50. package/dist/types/vc/vc-observer/revisions/fy25_01.d.ts +13 -0
  51. package/dist/types/vc/vc-observer/revisions/revisions.d.ts +2 -0
  52. package/dist/types/vc/vc-observer/revisions/types.d.ts +5 -0
  53. package/dist/types-ts4.5/common/vc/types.d.ts +28 -9
  54. package/dist/types-ts4.5/create-payload/index.d.ts +16 -0
  55. package/dist/types-ts4.5/experience-trace-id-context/index.d.ts +1 -0
  56. package/dist/types-ts4.5/interaction-ignore/ufo-interaction-ignore.d.ts +2 -2
  57. package/dist/types-ts4.5/label/UFOLabel.d.ts +2 -2
  58. package/dist/types-ts4.5/load-hold/UFOLoadHold.d.ts +2 -2
  59. package/dist/types-ts4.5/placeholder/Placeholder.d.ts +2 -2
  60. package/dist/types-ts4.5/placeholder/loosely-lazy/lazy-suspense.d.ts +2 -2
  61. package/dist/types-ts4.5/segment/segment-highlight.d.ts +2 -2
  62. package/dist/types-ts4.5/segment/segment.d.ts +2 -2
  63. package/dist/types-ts4.5/vc/vc-observer/heatmap/heatmap.d.ts +75 -0
  64. package/dist/types-ts4.5/vc/vc-observer/index.d.ts +16 -1
  65. package/dist/types-ts4.5/vc/vc-observer/media-wrapper/MediaWrapper.d.ts +1 -1
  66. package/dist/types-ts4.5/vc/vc-observer/revisions/ViewportUpdateClassifier.d.ts +25 -0
  67. package/dist/types-ts4.5/vc/vc-observer/revisions/fy24_01.d.ts +11 -0
  68. package/dist/types-ts4.5/vc/vc-observer/revisions/fy25_01.d.ts +13 -0
  69. package/dist/types-ts4.5/vc/vc-observer/revisions/revisions.d.ts +2 -0
  70. package/dist/types-ts4.5/vc/vc-observer/revisions/types.d.ts +5 -0
  71. package/package.json +17 -6
@@ -2,7 +2,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import { attachAbortListeners } from './attachAbortListeners';
4
4
  import { getViewportHeight, getViewportWidth } from './getViewport';
5
+ import { MultiRevisionHeatmap } from './heatmap/heatmap';
5
6
  import { Observers } from './observers';
7
+ import { getRevisions } from './revisions/revisions';
6
8
  const abortReason = {
7
9
  scroll: 'scroll',
8
10
  keypress: 'keypress',
@@ -35,6 +37,7 @@ export class VCObserver {
35
37
  });
36
38
  /* heatmap */
37
39
  _defineProperty(this, "arraySize", 0);
40
+ _defineProperty(this, "multiHeatmap", null);
38
41
  _defineProperty(this, "componentsLog", {});
39
42
  _defineProperty(this, "vcRatios", {});
40
43
  _defineProperty(this, "active", false);
@@ -68,6 +71,7 @@ export class VCObserver {
68
71
  },
69
72
  heatmap: this.heatmap,
70
73
  heatmapNext: this.heatmapNext,
74
+ multiHeatmap: this.multiHeatmap,
71
75
  outOfBoundaryInfo: this.outOfBoundaryInfo,
72
76
  totalTime: Math.round(this.totalTime + this.observers.getTotalTime()),
73
77
  componentsLog: {
@@ -106,7 +110,8 @@ export class VCObserver {
106
110
  componentsLog,
107
111
  viewport,
108
112
  devToolsEnabled,
109
- ratios
113
+ ratios,
114
+ multiHeatmap
110
115
  } = rawData;
111
116
  if (abortReasonInfo !== null && abortReason.blocking) {
112
117
  // exposing data to devtools
@@ -150,6 +155,7 @@ export class VCObserver {
150
155
  /* empty */
151
156
  }
152
157
  let _componentsLog = {};
158
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
153
159
  if (fg('ufo-remove-vc-component-observations-after-ttai')) {
154
160
  Object.entries(this.componentsLog).forEach(([_timestamp, value]) => {
155
161
  const timestamp = Number(_timestamp);
@@ -207,9 +213,30 @@ export class VCObserver {
207
213
  tti,
208
214
  ttai: stop - start
209
215
  },
216
+ start,
217
+ stop,
210
218
  heatmap,
211
219
  ratios
212
220
  };
221
+ window.__vcNext = {
222
+ entries: vcNext.VCEntries.rel,
223
+ log: componentsLog,
224
+ metrics: {
225
+ '75': vcNext.VC['75'],
226
+ '80': vcNext.VC['80'],
227
+ '85': vcNext.VC['85'],
228
+ '90': vcNext.VC['90'],
229
+ '95': vcNext.VC['95'],
230
+ '98': vcNext.VC['98'],
231
+ '99': vcNext.VC['99'],
232
+ tti,
233
+ ttai: stop - start
234
+ },
235
+ start,
236
+ stop,
237
+ heatmap: heatmapNext,
238
+ ratios
239
+ };
213
240
 
214
241
  // Emitting a custom event to make it available in the Chrome extension
215
242
  window.dispatchEvent(new CustomEvent('vcReady', {
@@ -222,6 +249,16 @@ export class VCObserver {
222
249
  } catch (e) {
223
250
  /* do nothing */
224
251
  }
252
+ const isMultiHeatmapEnabled = fg('ufo_vc_multiheatmap');
253
+ const revisionsData = isMultiHeatmapEnabled && multiHeatmap !== null ? {
254
+ [`${fullPrefix}vc:rev`]: multiHeatmap.getPayloadShapedData({
255
+ VCParts: VCObserver.VCParts.map(v => parseInt(v)),
256
+ ssr,
257
+ clean: !abortReasonInfo
258
+ })
259
+ } : null;
260
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
261
+ const isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
225
262
  return {
226
263
  'metrics:vc': VC,
227
264
  [`${fullPrefix}vc:state`]: true,
@@ -238,11 +275,28 @@ export class VCObserver {
238
275
  [`${fullPrefix}vc:next:updates`]: vcNext.VCEntries.rel.slice(0, 50),
239
276
  [`${fullPrefix}vc:next:dom`]: vcNext.VCBox,
240
277
  //...oldDomUpdates,
241
- [`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog)
278
+ [`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog),
279
+ ...revisionsData,
280
+ [`ufo:speedIndex`]: isCalcSpeedIndexEnabled ? VCEntries.speedIndex : undefined,
281
+ [`ufo:next:speedIndex`]: isCalcSpeedIndexEnabled ? vcNext.VCEntries.speedIndex : undefined
242
282
  };
243
283
  });
244
284
  _defineProperty(this, "handleUpdate", (rawTime, intersectionRect, targetName, element, type, ignoreReason) => {
245
285
  this.measureStart();
286
+ this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason);
287
+ if (fg('ufo_vc_multiheatmap')) {
288
+ this.onViewportChangeDetected({
289
+ timestamp: rawTime,
290
+ intersectionRect,
291
+ targetName,
292
+ element,
293
+ type,
294
+ ignoreReason
295
+ });
296
+ }
297
+ this.measureStop();
298
+ });
299
+ _defineProperty(this, "legacyHandleUpdate", (rawTime, intersectionRect, targetName, element, type, ignoreReason) => {
246
300
  if (this.abortReason.reason === null || this.abortReason.blocking === false) {
247
301
  const time = Math.round(rawTime - this.startTime);
248
302
  const mappedValues = this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
@@ -263,8 +317,39 @@ export class VCObserver {
263
317
  ignoreReason
264
318
  });
265
319
  }
266
- // devtools export
267
- this.measureStop();
320
+ });
321
+ _defineProperty(this, "onViewportChangeDetected", ({
322
+ element,
323
+ type,
324
+ ignoreReason,
325
+ timestamp,
326
+ targetName,
327
+ intersectionRect
328
+ }) => {
329
+ if (this.multiHeatmap === null) {
330
+ return;
331
+ }
332
+ // @todo add abort reason handling
333
+ const time = Math.round(timestamp - this.startTime);
334
+ const revisions = getRevisions();
335
+ const revisionsClassification = revisions.map(revision => {
336
+ return revision.classifier.classifyUpdate({
337
+ element,
338
+ type,
339
+ ignoreReason
340
+ });
341
+ }, []);
342
+ this.multiHeatmap.handleUpdate({
343
+ time,
344
+ targetName,
345
+ intersectionRect,
346
+ type,
347
+ element,
348
+ classification: revisionsClassification,
349
+ onError: error => {
350
+ this.setAbortReason(abortReason.error, error.time, error.error);
351
+ }
352
+ });
268
353
  });
269
354
  _defineProperty(this, "mapPixelsToHeatmap", (left, top, width, height) => {
270
355
  const {
@@ -349,6 +434,13 @@ export class VCObserver {
349
434
  });
350
435
  this.heatmap = this.getCleanHeatmap();
351
436
  this.heatmapNext = this.getCleanHeatmap();
437
+ if (fg('ufo_vc_multiheatmap')) {
438
+ this.multiHeatmap = new MultiRevisionHeatmap({
439
+ viewport: this.viewport,
440
+ revisions: getRevisions(),
441
+ devToolsEnabled: this.devToolsEnabled
442
+ });
443
+ }
352
444
  this.isPostInteraction = options.isPostInteraction || false;
353
445
  }
354
446
  start({
@@ -425,8 +517,17 @@ export class VCObserver {
425
517
  const entries = Object.entries(lastUpdate).map(a => [parseInt(a[0], 10), a[1]]).sort((a, b) => a[0] > b[0] ? 1 : -1);
426
518
  const VC = VCObserver.makeVCReturnObj();
427
519
  const VCBox = VCObserver.makeVCReturnObj();
520
+
521
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
522
+ const isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
428
523
  entries.reduce((acc = 0, v) => {
429
- const VCRatio = v[1] / totalPainted + acc;
524
+ const currRatio = v[1] / totalPainted;
525
+ let VCRatio = currRatio + acc;
526
+ if (fg('platform_ufo_fix_vc_observer_rounding_error')) {
527
+ const preciseCurrRatio = Math.round(100 * (v[1] / totalPainted));
528
+ const preciseAccRatio = Math.round(acc * 100);
529
+ VCRatio = (preciseCurrRatio + preciseAccRatio) / 100;
530
+ }
430
531
  const time = v[0];
431
532
  VCObserver.VCParts.forEach(key => {
432
533
  const value = parseInt(key, 10);
@@ -439,10 +540,15 @@ export class VCObserver {
439
540
  return VCRatio;
440
541
  }, 0);
441
542
  const VCEntries = entries.reduce((acc, [timestamp, entryPainted], i) => {
442
- var _acc$abs, _componentsLog$timest;
543
+ var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
443
544
  const currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
444
545
  const currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
445
546
  const logEntry = (_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.map(v => v.targetName);
547
+ const ratioDelta = (currentlyPaintedRatio - ((_acc$rel$vc = (_acc$rel = acc.rel[i - 1]) === null || _acc$rel === void 0 ? void 0 : _acc$rel.vc) !== null && _acc$rel$vc !== void 0 ? _acc$rel$vc : 0)) / 100;
548
+ if (isCalcSpeedIndexEnabled) {
549
+ const speedIndex = timestamp * ratioDelta;
550
+ acc.speedIndex += speedIndex;
551
+ }
446
552
  acc.abs.push([timestamp, currentlyPainted]);
447
553
  acc.rel.push({
448
554
  time: timestamp,
@@ -452,8 +558,10 @@ export class VCObserver {
452
558
  return acc;
453
559
  }, {
454
560
  abs: [],
455
- rel: []
561
+ rel: [],
562
+ speedIndex: 0
456
563
  });
564
+ VCEntries.speedIndex = Math.round(VCEntries.speedIndex);
457
565
  return {
458
566
  VC,
459
567
  VCBox,
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  const EQUALITY_THRESHOLD = 0.1;
4
3
  const ANCESTOR_LOOKUP_LIMIT = 10;
5
4
  export class SSRPlaceholderHandlers {
@@ -26,20 +25,15 @@ export class SSRPlaceholderHandlers {
26
25
  return;
27
26
  }
28
27
  const rect = this.staticPlaceholders.get(staticKey);
29
- if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
30
- const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
31
- if (hasSameSizePosition || this.isDummyRect(rect)) {
32
- resolve(hasSameSizePosition);
33
- } else {
34
- requestAnimationFrame(() => {
35
- const targetRect = target.getBoundingClientRect();
36
- const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
37
- resolve(hasSameSizePosition);
38
- });
39
- }
40
- } else {
41
- const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
28
+ const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
29
+ if (hasSameSizePosition || this.isDummyRect(rect)) {
42
30
  resolve(hasSameSizePosition);
31
+ } else {
32
+ requestAnimationFrame(() => {
33
+ const targetRect = target.getBoundingClientRect();
34
+ const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
35
+ resolve(hasSameSizePosition);
36
+ });
43
37
  }
44
38
  this.callbacks.delete(staticKey);
45
39
  }
@@ -50,20 +44,15 @@ export class SSRPlaceholderHandlers {
50
44
  return;
51
45
  }
52
46
  const rect = this.staticPlaceholders.get(key);
53
- if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
54
- const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
55
- if (hasSameSizePosition || this.isDummyRect(rect)) {
56
- resolve(hasSameSizePosition);
57
- } else {
58
- requestAnimationFrame(() => {
59
- const targetRect = target.getBoundingClientRect();
60
- const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
61
- resolve(hasSameSizePosition);
62
- });
63
- }
64
- } else {
65
- const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
47
+ const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
48
+ if (hasSameSizePosition || this.isDummyRect(rect)) {
66
49
  resolve(hasSameSizePosition);
50
+ } else {
51
+ requestAnimationFrame(() => {
52
+ const targetRect = target.getBoundingClientRect();
53
+ const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
54
+ resolve(hasSameSizePosition);
55
+ });
67
56
  }
68
57
  this.staticPlaceholders.delete(staticKey);
69
58
  this.reactValidateCallbacks.delete(staticKey);
@@ -0,0 +1,35 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ export class ViewportUpdateClassifier {
3
+ constructor() {
4
+ _defineProperty(this, "types", []);
5
+ _defineProperty(this, "filters", []);
6
+ _defineProperty(this, "removedFilters", []);
7
+ _defineProperty(this, "__combinedTypes", []);
8
+ _defineProperty(this, "__combinedFilters", []);
9
+ }
10
+ mergeConfig() {
11
+ this.__combinedTypes = [...this.types, ...((this === null || this === void 0 ? void 0 : this.__combinedTypes) || [])];
12
+ const previousFilters = this.removedFilters.length === 0 ? this.__combinedFilters : this.__combinedFilters.filter(filter => !this.removedFilters.includes(filter.name));
13
+ this.__combinedFilters = [...this.filters, ...previousFilters];
14
+ }
15
+ classifyUpdate({
16
+ element,
17
+ type,
18
+ tags,
19
+ ignoreReason
20
+ }) {
21
+ if (!this.__combinedTypes.includes(type)) {
22
+ return false;
23
+ }
24
+ return this.__combinedFilters.every(({
25
+ filter,
26
+ name
27
+ }) => {
28
+ return filter({
29
+ type,
30
+ tags,
31
+ ignoreReason
32
+ });
33
+ });
34
+ }
35
+ }
@@ -0,0 +1,21 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { ViewportUpdateClassifier } from './ViewportUpdateClassifier';
3
+ const legacyIgnoreReasons = ['image', 'ssr-hydration', 'editor-lazy-node-view', 'editor-container-mutation'];
4
+ export class FY24_01Classifier extends ViewportUpdateClassifier {
5
+ constructor() {
6
+ super();
7
+ _defineProperty(this, "revision", 'fy24.01');
8
+ _defineProperty(this, "types", ['html', 'text']);
9
+ _defineProperty(this, "filters", [{
10
+ name: 'default-ignore-reasons',
11
+ filter: ({
12
+ type,
13
+ ignoreReason
14
+ }) => {
15
+ return !ignoreReason || !legacyIgnoreReasons.includes(ignoreReason);
16
+ }
17
+ }]);
18
+ this.mergeConfig();
19
+ }
20
+ }
21
+ export const revFY24_01Classifier = new FY24_01Classifier();
@@ -0,0 +1,21 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { FY24_01Classifier } from './fy24_01';
3
+ export class FY25_01Classifier extends FY24_01Classifier {
4
+ constructor() {
5
+ super();
6
+ _defineProperty(this, "revision", 'fy25.01');
7
+ _defineProperty(this, "types", ['attr']);
8
+ _defineProperty(this, "filters", [{
9
+ name: 'not-visible',
10
+ filter: ({
11
+ type,
12
+ ignoreReason
13
+ }) => {
14
+ return !(ignoreReason !== null && ignoreReason !== void 0 && ignoreReason.includes('not-visible'));
15
+ }
16
+ }]);
17
+ _defineProperty(this, "removedFilters", []);
18
+ this.mergeConfig();
19
+ }
20
+ }
21
+ export const revFY25_01Classifier = new FY25_01Classifier();
@@ -0,0 +1,19 @@
1
+ import { revFY24_01Classifier } from './fy24_01';
2
+ import { revFY25_01Classifier } from './fy25_01';
3
+ const Revisions = [{
4
+ name: 'fy24.01',
5
+ classifier: revFY24_01Classifier
6
+ }, {
7
+ name: 'fy25.01',
8
+ classifier: revFY25_01Classifier
9
+ }];
10
+ let revisionResultCache = null;
11
+ export const getRevisions = () => {
12
+ if (revisionResultCache !== null) {
13
+ return revisionResultCache;
14
+ }
15
+ revisionResultCache = [...Revisions
16
+ //...(fg('next_available') ? [{name: 'next', classifier:NEXT}] : [])
17
+ ];
18
+ return revisionResultCache;
19
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -211,6 +211,16 @@ var getVCMetrics = function getVCMetrics(interaction) {
211
211
  if (interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') {
212
212
  return result;
213
213
  }
214
+ if (fg('ufo_vc_multiheatmap')) {
215
+ var _result;
216
+ (_result = result["".concat(prefix, ":vc:rev")]) === null || _result === void 0 || _result.forEach(function (element) {
217
+ var _element$vcDetails;
218
+ if ((_element$vcDetails = element.vcDetails) !== null && _element$vcDetails !== void 0 && (_element$vcDetails = _element$vcDetails['90']) !== null && _element$vcDetails !== void 0 && _element$vcDetails.t) {
219
+ var _element$vcDetails$;
220
+ element['metric:vc90'] = (_element$vcDetails$ = element.vcDetails['90']) === null || _element$vcDetails$ === void 0 ? void 0 : _element$vcDetails$.t;
221
+ }
222
+ });
223
+ }
214
224
  return _objectSpread(_objectSpread({}, result), {}, {
215
225
  'metric:vc90': VC['90']
216
226
  });
@@ -611,6 +621,7 @@ function getPayloadSize(payload) {
611
621
  return Math.round(new TextEncoder().encode(JSON.stringify(payload)).length / 1024);
612
622
  }
613
623
  function getStylesheetMetrics() {
624
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
614
625
  if (!fg('ufo_capture_stylesheet_metrics')) {
615
626
  return {};
616
627
  }
@@ -31,4 +31,8 @@ export var getActiveTraceHttpRequestHeaders = function getActiveTraceHttpRequest
31
31
  traceId = _state$context.traceId,
32
32
  spanId = _state$context.spanId;
33
33
  return makeTraceHttpRequestHeaders(traceId, spanId);
34
+ };
35
+ export var getActiveTraceAsQueryParams = function getActiveTraceAsQueryParams(_url) {
36
+ var traceHeaders = getActiveTraceHttpRequestHeaders(_url);
37
+ return traceHeaders ? new URLSearchParams(traceHeaders).toString().toLowerCase() : null;
34
38
  };
@@ -5,6 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
6
6
  import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
7
7
  import { v4 as createUUID } from 'uuid';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import coinflip from '../coinflip';
9
10
  import { getConfig, getInteractionRate } from '../config';
10
11
  import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
@@ -42,7 +43,9 @@ export default function UFOSegment(_ref) {
42
43
  }, [parentContext, segmentName, segmentId]);
43
44
  var interactionId = useContext(UFOInteractionIDContext);
44
45
  var interactionContext = useMemo(function () {
45
- addSegment(labelStack);
46
+ if (!fg('platform-ufo-add-segment-use-effect')) {
47
+ addSegment(labelStack);
48
+ }
46
49
  var lastCompleteEndTime = 0;
47
50
  function complete() {
48
51
  var endTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : performance.now();
@@ -221,6 +224,9 @@ export default function UFOSegment(_ref) {
221
224
  }
222
225
  }, [interactionContext]);
223
226
  useEffect(function () {
227
+ if (fg('platform-ufo-add-segment-use-effect')) {
228
+ addSegment(labelStack);
229
+ }
224
230
  return function () {
225
231
  removeSegment(labelStack);
226
232
  };