@atlaskit/react-ufo 3.4.10 → 3.4.11

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.
@@ -39,15 +39,28 @@ export default async function getVCMetrics(interaction) {
39
39
  getVCObserver().stop();
40
40
  }
41
41
  postInteractionLog.setLastInteractionFinishVCResult(result);
42
- const VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
43
- if (!VC || !(result !== null && result !== void 0 && result[`${prefix}:vc:clean`])) {
44
- return result;
42
+ if (fg('platform_ufo_disable_ttvc_v1')) {
43
+ const ttvcV2Revision = (result === null || result === void 0 ? void 0 : result['ufo:vc:rev']).find(({
44
+ revision
45
+ }) => revision === 'fy25.02');
46
+ if (!(ttvcV2Revision !== null && ttvcV2Revision !== void 0 && ttvcV2Revision.clean)) {
47
+ return result;
48
+ }
49
+ return {
50
+ ...result,
51
+ 'metric:vc90': ttvcV2Revision['metric:vc90']
52
+ };
53
+ } else {
54
+ const VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
55
+ if (!VC || !(result !== null && result !== void 0 && result[`${prefix}:vc:clean`])) {
56
+ return result;
57
+ }
58
+ if (interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') {
59
+ return result;
60
+ }
61
+ return {
62
+ ...result,
63
+ 'metric:vc90': VC['90']
64
+ };
45
65
  }
46
- if (interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') {
47
- return result;
48
- }
49
- return {
50
- ...result,
51
- 'metric:vc90': VC['90']
52
- };
53
66
  }
@@ -0,0 +1,76 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { getPageVisibilityState } from '../../hidden-timing';
3
+ import { getRevisions } from './revisions/revisions';
4
+ const VCParts = ['25', '50', '75', '80', '85', '90', '95', '98', '99'];
5
+ export function getVCRevisionsData({
6
+ fullPrefix,
7
+ interaction,
8
+ isVCClean,
9
+ isEventAborted,
10
+ multiHeatmap,
11
+ ssr,
12
+ calculatedVC,
13
+ calculatedVCNext
14
+ }) {
15
+ const isMultiHeatmapEnabled = !fg('platform_ufo_multiheatmap_killswitch');
16
+ if (!isMultiHeatmapEnabled) {
17
+ return null;
18
+ }
19
+ if (!fg('platform_ufo_vc_observer_new')) {
20
+ if (!multiHeatmap) {
21
+ return null;
22
+ }
23
+ return {
24
+ [`${fullPrefix}vc:rev`]: multiHeatmap === null || multiHeatmap === void 0 ? void 0 : multiHeatmap.getPayloadShapedData({
25
+ VCParts: VCParts.map(v => parseInt(v)),
26
+ VCCalculationMethods: getRevisions().map(({
27
+ classifier
28
+ }) => classifier.VCCalculationMethod),
29
+ filterComponentsLog: getRevisions().map(({
30
+ classifier
31
+ }) => classifier.filterComponentsLog),
32
+ isEventAborted,
33
+ interactionStart: interaction.start,
34
+ ttai: interaction.end,
35
+ ssr,
36
+ clean: isVCClean
37
+ })
38
+ };
39
+ }
40
+ const pageVisibilityUpToTTAI = getPageVisibilityState(interaction.start, interaction.end);
41
+ const isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
42
+ const shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
43
+ const ttvcV1Revision = {
44
+ revision: 'fy25.01',
45
+ clean: isVCClean,
46
+ 'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
47
+ vcDetails: shouldHaveVCmetric ? Object.fromEntries(VCParts.map(key => {
48
+ var _calculatedVC$VCBox$k;
49
+ return [key, {
50
+ t: calculatedVC.VC[key],
51
+ e: (_calculatedVC$VCBox$k = calculatedVC.VCBox[key]) !== null && _calculatedVC$VCBox$k !== void 0 ? _calculatedVC$VCBox$k : []
52
+ }];
53
+ })) : {}
54
+ };
55
+ const ttvcV2ReportedMetric = fg('platform_ufo_fix_v2_reported_vc90') ? calculatedVCNext.VC['90'] : calculatedVC.VC['90'];
56
+ const ttvcV2Revision = {
57
+ revision: 'fy25.02',
58
+ clean: isVCClean,
59
+ 'metric:vc90': shouldHaveVCmetric ? ttvcV2ReportedMetric : null,
60
+ vcDetails: shouldHaveVCmetric ? Object.fromEntries(VCParts.map(key => {
61
+ var _calculatedVCNext$VCB;
62
+ return [key, {
63
+ t: calculatedVCNext.VC[key],
64
+ e: (_calculatedVCNext$VCB = calculatedVCNext.VCBox[key]) !== null && _calculatedVCNext$VCB !== void 0 ? _calculatedVCNext$VCB : []
65
+ }];
66
+ })) : {}
67
+ };
68
+ if (fg('platform_ufo_disable_ttvc_v1')) {
69
+ return {
70
+ [`${fullPrefix}vc:rev`]: [ttvcV2Revision]
71
+ };
72
+ }
73
+ return {
74
+ [`${fullPrefix}vc:rev`]: [ttvcV1Revision, ttvcV2Revision]
75
+ };
76
+ }
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
- import { getPageVisibilityState } from '../../hidden-timing';
4
3
  import { attachAbortListeners } from './attachAbortListeners';
4
+ import { getVCRevisionsData } from './getVCRevisionsData';
5
5
  import { getViewportHeight, getViewportWidth } from './getViewport';
6
6
  import { MultiRevisionHeatmap } from './heatmap/heatmap';
7
7
  import { Observers } from './observers';
@@ -128,12 +128,17 @@ export class VCObserver {
128
128
  [`${fullPrefix}vc:abort:timestamp`]: abortReason.timestamp
129
129
  };
130
130
  }
131
- const {
132
- VC,
133
- VCBox,
134
- VCEntries,
135
- totalPainted
136
- } = VCObserver.calculateVC({
131
+ const isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
132
+ const ttvcV1Result = isTTVCv1Disabled ? {
133
+ VC: {},
134
+ VCBox: {},
135
+ VCEntries: {
136
+ abs: [],
137
+ rel: [],
138
+ speedIndex: -1
139
+ },
140
+ totalPainted: -1
141
+ } : VCObserver.calculateVC({
137
142
  heatmap,
138
143
  ssr,
139
144
  componentsLog: {
@@ -141,35 +146,19 @@ export class VCObserver {
141
146
  },
142
147
  viewport
143
148
  });
144
- try {
145
- if (!this.isPostInteraction) {
146
- VCObserver.VCParts.forEach(key => {
147
- const duration = VC[key];
148
- if (duration !== null && duration !== undefined) {
149
- performance.measure(`VC${key}`, {
150
- start,
151
- duration
152
- });
153
- }
154
- });
149
+ const {
150
+ VC,
151
+ VCBox,
152
+ VCEntries,
153
+ totalPainted
154
+ } = ttvcV1Result;
155
+ const _componentsLog = {};
156
+ Object.entries(this.componentsLog).forEach(([_timestamp, value]) => {
157
+ const timestamp = Number(_timestamp);
158
+ if (stop > timestamp) {
159
+ _componentsLog[timestamp] = value;
155
160
  }
156
- } catch (e) {
157
- /* empty */
158
- }
159
- let _componentsLog = {};
160
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
161
- if (fg('ufo-remove-vc-component-observations-after-ttai')) {
162
- Object.entries(this.componentsLog).forEach(([_timestamp, value]) => {
163
- const timestamp = Number(_timestamp);
164
- if (stop > timestamp) {
165
- _componentsLog[timestamp] = value;
166
- }
167
- });
168
- } else {
169
- _componentsLog = {
170
- ...componentsLog
171
- };
172
- }
161
+ });
173
162
  const vcNext = VCObserver.calculateVC({
174
163
  heatmap: heatmapNext,
175
164
  ssr,
@@ -179,12 +168,33 @@ export class VCObserver {
179
168
  try {
180
169
  if (!this.isPostInteraction) {
181
170
  VCObserver.VCParts.forEach(key => {
182
- const duration = vcNext.VC[key];
183
- if (duration !== null && duration !== undefined) {
184
- performance.measure(`VC_Next${key}`, {
185
- start,
186
- duration
187
- });
171
+ if (isTTVCv1Disabled) {
172
+ const duration = vcNext.VC[key];
173
+ if (duration !== null && duration !== undefined) {
174
+ performance.measure(`VC${key}`, {
175
+ start,
176
+ duration
177
+ });
178
+ performance.measure(`VC_Next${key}`, {
179
+ start,
180
+ duration
181
+ });
182
+ }
183
+ } else {
184
+ const ttvcV1duration = VC[key];
185
+ if (ttvcV1duration !== null && ttvcV1duration !== undefined) {
186
+ performance.measure(`VC${key}`, {
187
+ start,
188
+ duration: ttvcV1duration
189
+ });
190
+ }
191
+ const ttvcV2duration = vcNext.VC[key];
192
+ if (ttvcV2duration !== null && ttvcV2duration !== undefined) {
193
+ performance.measure(`VC_Next${key}`, {
194
+ start,
195
+ duration: ttvcV2duration
196
+ });
197
+ }
188
198
  }
189
199
  });
190
200
  }
@@ -201,7 +211,7 @@ export class VCObserver {
201
211
  // exposing data to devtools
202
212
  try {
203
213
  if (!this.isPostInteraction && devToolsEnabled) {
204
- window.__vc = {
214
+ const ttvcV1DevToolInfo = isTTVCv1Disabled ? undefined : {
205
215
  entries: VCEntries.rel,
206
216
  log: componentsLog,
207
217
  metrics: {
@@ -220,7 +230,7 @@ export class VCObserver {
220
230
  heatmap,
221
231
  ratios
222
232
  };
223
- window.__vcNext = {
233
+ const ttvcV2DevToolInfo = {
224
234
  entries: vcNext.VCEntries.rel,
225
235
  log: componentsLog,
226
236
  metrics: {
@@ -239,12 +249,19 @@ export class VCObserver {
239
249
  heatmap: heatmapNext,
240
250
  ratios
241
251
  };
252
+ if (isTTVCv1Disabled) {
253
+ window.__vc = ttvcV2DevToolInfo;
254
+ window.__vcNext = ttvcV2DevToolInfo;
255
+ } else {
256
+ window.__vc = ttvcV1DevToolInfo;
257
+ window.__vcNext = ttvcV2DevToolInfo;
258
+ }
242
259
 
243
260
  // Emitting a custom event to make it available in the Chrome extension
244
261
  window.dispatchEvent(new CustomEvent('vcReady', {
245
262
  detail: {
246
263
  log: filterComponentsLog(componentsLog),
247
- entries: VCEntries.rel
264
+ entries: isTTVCv1Disabled ? vcNext.VCEntries.rel : VCEntries.rel
248
265
  }
249
266
  }));
250
267
  }
@@ -252,56 +269,42 @@ export class VCObserver {
252
269
  /* do nothing */
253
270
  }
254
271
  const isVCClean = !abortReasonInfo;
255
- const isMultiHeatmapEnabled = !fg('platform_ufo_multiheatmap_killswitch');
256
- const pageVisibilityUpToTTAI = getPageVisibilityState(start, stop);
257
- const isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
258
- const shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
259
- const revisionsData = isMultiHeatmapEnabled ? fg('platform_ufo_vc_observer_new') ? {
260
- [`${fullPrefix}vc:rev`]: [{
261
- revision: 'fy25.01',
262
- clean: isVCClean,
263
- 'metric:vc90': shouldHaveVCmetric ? VC['90'] : null,
264
- vcDetails: shouldHaveVCmetric ? Object.fromEntries(VCObserver.VCParts.map(key => {
265
- var _VCBox$key;
266
- return [key, {
267
- t: VC[key],
268
- e: (_VCBox$key = VCBox[key]) !== null && _VCBox$key !== void 0 ? _VCBox$key : []
269
- }];
270
- })) : []
271
- }, {
272
- revision: 'fy25.02',
273
- clean: isVCClean,
274
- 'metric:vc90': shouldHaveVCmetric ? VC['90'] : null,
275
- vcDetails: shouldHaveVCmetric ? Object.fromEntries(VCObserver.VCParts.map(key => {
276
- var _vcNext$VCBox$key;
277
- return [key, {
278
- t: vcNext.VC[key],
279
- e: (_vcNext$VCBox$key = vcNext.VCBox[key]) !== null && _vcNext$VCBox$key !== void 0 ? _vcNext$VCBox$key : []
280
- }];
281
- })) : []
282
- }]
283
- } : multiHeatmap !== null ? {
284
- [`${fullPrefix}vc:rev`]: multiHeatmap === null || multiHeatmap === void 0 ? void 0 : multiHeatmap.getPayloadShapedData({
285
- VCParts: VCObserver.VCParts.map(v => parseInt(v)),
286
- VCCalculationMethods: getRevisions().map(({
287
- classifier
288
- }) => classifier.VCCalculationMethod),
289
- filterComponentsLog: getRevisions().map(({
290
- classifier
291
- }) => classifier.filterComponentsLog),
292
- isEventAborted,
293
- interactionStart: start,
294
- ttai: stop,
295
- ssr,
296
- clean: isVCClean
297
- })
298
- } : null : null;
272
+ const revisionsData = getVCRevisionsData({
273
+ fullPrefix,
274
+ interaction: {
275
+ start,
276
+ end: stop
277
+ },
278
+ isVCClean,
279
+ multiHeatmap,
280
+ ssr,
281
+ calculatedVC: {
282
+ VC,
283
+ VCBox
284
+ },
285
+ calculatedVCNext: {
286
+ VC: vcNext.VC,
287
+ VCBox: vcNext.VCBox
288
+ },
289
+ isEventAborted
290
+ });
299
291
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
300
292
  const isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
301
293
  const speedIndex = {
302
- [`ufo:speedIndex`]: VCEntries.speedIndex,
294
+ [`ufo:speedIndex`]: isTTVCv1Disabled ? vcNext.VCEntries.speedIndex : VCEntries.speedIndex,
303
295
  [`ufo:next:speedIndex`]: vcNext.VCEntries.speedIndex
304
296
  };
297
+ if (isTTVCv1Disabled) {
298
+ return {
299
+ [`${fullPrefix}vc:size`]: viewport,
300
+ [`${fullPrefix}vc:time`]: Math.round(totalTime + (stopTime - startTime)),
301
+ [`${fullPrefix}vc:ratios`]: ratios,
302
+ ...outOfBoundary,
303
+ [`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog),
304
+ ...revisionsData,
305
+ ...(isCalcSpeedIndexEnabled ? speedIndex : {})
306
+ };
307
+ }
305
308
  return {
306
309
  'metrics:vc': VC,
307
310
  [`${fullPrefix}vc:state`]: true,
@@ -317,7 +320,6 @@ export class VCObserver {
317
320
  [`${fullPrefix}vc:next`]: vcNext.VC,
318
321
  [`${fullPrefix}vc:next:updates`]: vcNext.VCEntries.rel.slice(0, 50),
319
322
  [`${fullPrefix}vc:next:dom`]: vcNext.VCBox,
320
- //...oldDomUpdates,
321
323
  [`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog),
322
324
  ...revisionsData,
323
325
  ...(isCalcSpeedIndexEnabled ? speedIndex : {})
@@ -346,7 +348,8 @@ export class VCObserver {
346
348
  if (!ignoreReason) {
347
349
  this.applyChangesToHeatMap(mappedValues, time, this.heatmapNext);
348
350
  }
349
- if ((!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
351
+ const isTTVCv1Disabled = fg('platform_ufo_disable_ttvc_v1');
352
+ if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
350
353
  this.applyChangesToHeatMap(mappedValues, time, this.heatmap);
351
354
  }
352
355
  if (!this.componentsLog[time]) {
@@ -474,7 +477,7 @@ export class VCObserver {
474
477
  dataVC: true
475
478
  }
476
479
  });
477
- this.heatmap = this.getCleanHeatmap();
480
+ this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
478
481
  this.heatmapNext = this.getCleanHeatmap();
479
482
  this.multiHeatmap = new MultiRevisionHeatmap({
480
483
  viewport: this.viewport,
@@ -637,7 +640,7 @@ export class VCObserver {
637
640
  blocking: false
638
641
  };
639
642
  this.detachAbortListeners();
640
- this.heatmap = this.getCleanHeatmap();
643
+ this.heatmap = fg('platform_ufo_disable_ttvc_v1') ? [] : this.getCleanHeatmap();
641
644
  this.heatmapNext = this.getCleanHeatmap();
642
645
  this.multiHeatmap = new MultiRevisionHeatmap({
643
646
  viewport: this.viewport,
@@ -80,7 +80,7 @@ export class Observers {
80
80
  renderStop: -1
81
81
  };
82
82
  (_this$mutationObserve = this.mutationObserver) === null || _this$mutationObserve === void 0 ? void 0 : _this$mutationObserve.observe(document.body, {
83
- attributeFilter: fg('platform-ufo-vc-observe-attributes') ? ['hidden', 'style', 'src', 'class'] : ['hidden', 'style', 'src'],
83
+ attributeFilter: ['hidden', 'style', 'src', 'class'],
84
84
  attributeOldValue: true,
85
85
  attributes: true,
86
86
  childList: true,
@@ -249,10 +249,8 @@ export class Observers {
249
249
  // ignore intersection report without recent mutation
250
250
  return;
251
251
  }
252
- if (fg('platform-ufo-invisible-element-vc-calculations')) {
253
- if (!isElementVisible(target)) {
254
- data.ignoreReason = 'not-visible';
255
- }
252
+ if (!isElementVisible(target)) {
253
+ data.ignoreReason = 'not-visible';
256
254
  }
257
255
  if (fg('platform_editor_ed-25937_ignore_mutations_for_ttvc')) {
258
256
  if (isInsideEditorContainer(target)) {
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { FY25_01Classifier } from './fy25_01';
4
3
  export class FY25_02Classifier extends FY25_01Classifier {
5
4
  // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
@@ -7,21 +6,13 @@ export class FY25_02Classifier extends FY25_01Classifier {
7
6
  componentsLog,
8
7
  ttai
9
8
  }) {
10
- let _componentsLog = {};
11
-
12
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
13
- if (fg('ufo-remove-vc-component-observations-after-ttai')) {
14
- Object.entries(componentsLog).forEach(([_timestamp, value]) => {
15
- const timestamp = Number(_timestamp);
16
- if (ttai > timestamp) {
17
- _componentsLog[timestamp] = value;
18
- }
19
- });
20
- } else {
21
- _componentsLog = {
22
- ...componentsLog
23
- };
24
- }
9
+ const _componentsLog = {};
10
+ Object.entries(componentsLog).forEach(([_timestamp, value]) => {
11
+ const timestamp = Number(_timestamp);
12
+ if (Math.ceil(ttai) >= timestamp) {
13
+ _componentsLog[timestamp] = value;
14
+ }
15
+ });
25
16
  return _componentsLog;
26
17
  }
27
18
  constructor() {
@@ -1,19 +1,18 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  import { revFY25_01Classifier } from './fy25_01';
2
3
  import { revFY25_02Classifier } from './fy25_02';
3
- const Revisions = [{
4
- name: 'fy25.01',
5
- classifier: revFY25_01Classifier
6
- }, {
7
- name: 'fy25.02',
8
- classifier: revFY25_02Classifier
9
- }];
10
- let revisionResultCache = null;
11
4
  export const getRevisions = () => {
12
- if (revisionResultCache !== null) {
13
- return revisionResultCache;
5
+ if (fg('platform_ufo_disable_ttvc_v1')) {
6
+ return [{
7
+ name: 'fy25.02',
8
+ classifier: revFY25_02Classifier
9
+ }];
14
10
  }
15
- revisionResultCache = [...Revisions
16
- //...(fg('next_available') ? [{name: 'next', classifier:NEXT}] : [])
17
- ];
18
- return revisionResultCache;
11
+ return [{
12
+ name: 'fy25.01',
13
+ classifier: revFY25_01Classifier
14
+ }, {
15
+ name: 'fy25.02',
16
+ classifier: revFY25_02Classifier
17
+ }];
19
18
  };
@@ -16,7 +16,7 @@ export default function getVCMetrics(_x) {
16
16
  function _getVCMetrics() {
17
17
  _getVCMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
18
18
  var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
19
- var config, interactionStatus, pageVisibilityUpToTTAI, isSSREnabled, ssr, tti, prefix, result, VC;
19
+ var config, interactionStatus, pageVisibilityUpToTTAI, isSSREnabled, ssr, tti, prefix, result, ttvcV2Revision, VC;
20
20
  return _regeneratorRuntime.wrap(function _callee$(_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
@@ -63,23 +63,41 @@ function _getVCMetrics() {
63
63
  getVCObserver().stop();
64
64
  }
65
65
  postInteractionLog.setLastInteractionFinishVCResult(result);
66
+ if (!fg('platform_ufo_disable_ttvc_v1')) {
67
+ _context.next = 26;
68
+ break;
69
+ }
70
+ ttvcV2Revision = (result === null || result === void 0 ? void 0 : result['ufo:vc:rev']).find(function (_ref) {
71
+ var revision = _ref.revision;
72
+ return revision === 'fy25.02';
73
+ });
74
+ if (ttvcV2Revision !== null && ttvcV2Revision !== void 0 && ttvcV2Revision.clean) {
75
+ _context.next = 23;
76
+ break;
77
+ }
78
+ return _context.abrupt("return", result);
79
+ case 23:
80
+ return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
81
+ 'metric:vc90': ttvcV2Revision['metric:vc90']
82
+ }));
83
+ case 26:
66
84
  VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
67
85
  if (!(!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")]))) {
68
- _context.next = 22;
86
+ _context.next = 29;
69
87
  break;
70
88
  }
71
89
  return _context.abrupt("return", result);
72
- case 22:
90
+ case 29:
73
91
  if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible')) {
74
- _context.next = 24;
92
+ _context.next = 31;
75
93
  break;
76
94
  }
77
95
  return _context.abrupt("return", result);
78
- case 24:
96
+ case 31:
79
97
  return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
80
98
  'metric:vc90': VC['90']
81
99
  }));
82
- case 25:
100
+ case 32:
83
101
  case "end":
84
102
  return _context.stop();
85
103
  }
@@ -0,0 +1,74 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { getPageVisibilityState } from '../../hidden-timing';
4
+ import { getRevisions } from './revisions/revisions';
5
+ var VCParts = ['25', '50', '75', '80', '85', '90', '95', '98', '99'];
6
+ export function getVCRevisionsData(_ref) {
7
+ var fullPrefix = _ref.fullPrefix,
8
+ interaction = _ref.interaction,
9
+ isVCClean = _ref.isVCClean,
10
+ isEventAborted = _ref.isEventAborted,
11
+ multiHeatmap = _ref.multiHeatmap,
12
+ ssr = _ref.ssr,
13
+ calculatedVC = _ref.calculatedVC,
14
+ calculatedVCNext = _ref.calculatedVCNext;
15
+ var isMultiHeatmapEnabled = !fg('platform_ufo_multiheatmap_killswitch');
16
+ if (!isMultiHeatmapEnabled) {
17
+ return null;
18
+ }
19
+ if (!fg('platform_ufo_vc_observer_new')) {
20
+ if (!multiHeatmap) {
21
+ return null;
22
+ }
23
+ return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), multiHeatmap === null || multiHeatmap === void 0 ? void 0 : multiHeatmap.getPayloadShapedData({
24
+ VCParts: VCParts.map(function (v) {
25
+ return parseInt(v);
26
+ }),
27
+ VCCalculationMethods: getRevisions().map(function (_ref2) {
28
+ var classifier = _ref2.classifier;
29
+ return classifier.VCCalculationMethod;
30
+ }),
31
+ filterComponentsLog: getRevisions().map(function (_ref3) {
32
+ var classifier = _ref3.classifier;
33
+ return classifier.filterComponentsLog;
34
+ }),
35
+ isEventAborted: isEventAborted,
36
+ interactionStart: interaction.start,
37
+ ttai: interaction.end,
38
+ ssr: ssr,
39
+ clean: isVCClean
40
+ }));
41
+ }
42
+ var pageVisibilityUpToTTAI = getPageVisibilityState(interaction.start, interaction.end);
43
+ var isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
44
+ var shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
45
+ var ttvcV1Revision = {
46
+ revision: 'fy25.01',
47
+ clean: isVCClean,
48
+ 'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
49
+ vcDetails: shouldHaveVCmetric ? Object.fromEntries(VCParts.map(function (key) {
50
+ var _calculatedVC$VCBox$k;
51
+ return [key, {
52
+ t: calculatedVC.VC[key],
53
+ e: (_calculatedVC$VCBox$k = calculatedVC.VCBox[key]) !== null && _calculatedVC$VCBox$k !== void 0 ? _calculatedVC$VCBox$k : []
54
+ }];
55
+ })) : {}
56
+ };
57
+ var ttvcV2ReportedMetric = fg('platform_ufo_fix_v2_reported_vc90') ? calculatedVCNext.VC['90'] : calculatedVC.VC['90'];
58
+ var ttvcV2Revision = {
59
+ revision: 'fy25.02',
60
+ clean: isVCClean,
61
+ 'metric:vc90': shouldHaveVCmetric ? ttvcV2ReportedMetric : null,
62
+ vcDetails: shouldHaveVCmetric ? Object.fromEntries(VCParts.map(function (key) {
63
+ var _calculatedVCNext$VCB;
64
+ return [key, {
65
+ t: calculatedVCNext.VC[key],
66
+ e: (_calculatedVCNext$VCB = calculatedVCNext.VCBox[key]) !== null && _calculatedVCNext$VCB !== void 0 ? _calculatedVCNext$VCB : []
67
+ }];
68
+ })) : {}
69
+ };
70
+ if (fg('platform_ufo_disable_ttvc_v1')) {
71
+ return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [ttvcV2Revision]);
72
+ }
73
+ return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [ttvcV1Revision, ttvcV2Revision]);
74
+ }