@atlaskit/react-ufo 4.14.4 → 4.14.6

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.14.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`95ab6a9cc653c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/95ab6a9cc653c) -
8
+ Auto add SSR entry for TTVC v4 onwards
9
+
10
+ ## 4.14.5
11
+
12
+ ### Patch Changes
13
+
14
+ - [`7fa9699d9340f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7fa9699d9340f) -
15
+ Marks first ufo segment load time
16
+
3
17
  ## 4.14.4
4
18
 
5
19
  ### Patch Changes
@@ -35,7 +35,9 @@ exports.addSpanToAll = addSpanToAll;
35
35
  exports.extractModuleName = extractModuleName;
36
36
  exports.getActiveInteraction = getActiveInteraction;
37
37
  exports.getCurrentInteractionType = getCurrentInteractionType;
38
- exports.postInteractionLog = exports.interactionSpans = exports.interactionExtraMetrics = exports.getPerformanceObserver = void 0;
38
+ exports.interactionSpans = exports.interactionExtraMetrics = exports.getPerformanceObserver = void 0;
39
+ exports.markFirstSegmentLoad = markFirstSegmentLoad;
40
+ exports.postInteractionLog = void 0;
39
41
  exports.remove = remove;
40
42
  exports.removeHoldByID = removeHoldByID;
41
43
  exports.removeSegment = removeSegment;
@@ -78,6 +80,7 @@ var interactionQueue = [];
78
80
  var segmentCache = new Map();
79
81
  var segmentUnmountCache = exports.segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
80
82
 
83
+ var firstSegmentLoadMarked = false;
81
84
  var segmentObservers = [];
82
85
  function getActiveInteraction() {
83
86
  var interactionId = (0, _interactionIdContext.getInteractionId)();
@@ -274,6 +277,22 @@ function addMark(interactionId, type, name, labelStack) {
274
277
  });
275
278
  }
276
279
  }
280
+ function markFirstSegmentLoad(interactionId, labelStack) {
281
+ var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : performance.now();
282
+ if (!(0, _platformFeatureFlags.fg)('platform_mark_ufo_segment_first_load')) {
283
+ return;
284
+ }
285
+ var interaction = _constants.interactions.get(interactionId);
286
+ if (interaction != null && !firstSegmentLoadMarked) {
287
+ firstSegmentLoadMarked = true;
288
+ interaction.marks.push({
289
+ type: 'first_segment_load',
290
+ name: 'first_segment_load',
291
+ labelStack: labelStack,
292
+ time: time
293
+ });
294
+ }
295
+ }
277
296
  function addMarkToAll(type, name, labelStack) {
278
297
  var time = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : performance.now();
279
298
  _constants.interactions.forEach(function (interaction) {
@@ -24,6 +24,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
24
24
  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; }
25
25
  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; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
26
26
  var tryCompleteHandle;
27
+ var hasMarkedFirstSegmentLoad = false;
27
28
 
28
29
  /** A portion of the page we apply measurement to */
29
30
  function UFOSegment(_ref) {
@@ -66,6 +67,10 @@ function UFOSegment(_ref) {
66
67
  } : {})];
67
68
  }, [parentContext, segmentName, segmentId, type]);
68
69
  var interactionId = (0, _react.useContext)(_interactionIdContext.default);
70
+ if (interactionId.current != null && !hasMarkedFirstSegmentLoad) {
71
+ (0, _interactionMetrics.markFirstSegmentLoad)(interactionId.current, labelStack, performance.now());
72
+ hasMarkedFirstSegmentLoad = true;
73
+ }
69
74
  var interactionContext = (0, _react.useMemo)(function () {
70
75
  var lastCompleteEndTime = 0;
71
76
  function complete() {
@@ -122,7 +122,7 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
122
122
  value: function () {
123
123
  var _getVCResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(param) {
124
124
  var _this$oldVCObserver4, _this$newVCObserver3, _ref2;
125
- var experienceKey, include3p, excludeSmartAnswersInSearch, includeSSRRatio, includeRawData, v1v2Result, v3Result, ssrRatio;
125
+ var experienceKey, include3p, excludeSmartAnswersInSearch, includeSSRRatio, includeRawData, v1v2Result, v3v4Result, ssrRatio;
126
126
  return _regenerator.default.wrap(function _callee$(_context) {
127
127
  while (1) switch (_context.prev = _context.next) {
128
128
  case 0:
@@ -150,14 +150,15 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
150
150
  start: param.start,
151
151
  stop: param.stop,
152
152
  interactionId: param.interactionId,
153
- ssr: param.includeSSRInV3 ? param.ssr : undefined,
153
+ ssr: param.ssr,
154
154
  include3p: include3p,
155
155
  excludeSmartAnswersInSearch: excludeSmartAnswersInSearch,
156
156
  includeSSRRatio: includeSSRRatio,
157
157
  interactionType: param.interactionType,
158
158
  isPageVisible: param.isPageVisible,
159
159
  interactionAbortReason: param.interactionAbortReason,
160
- includeRawData: includeRawData
160
+ includeRawData: includeRawData,
161
+ includeSSRInV3: param.includeSSRInV3
161
162
  });
162
163
  case 12:
163
164
  _context.t1 = _context.sent;
@@ -166,18 +167,18 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
166
167
  case 15:
167
168
  _context.t1 = [];
168
169
  case 16:
169
- v3Result = _context.t1;
170
- if (v3Result) {
170
+ v3v4Result = _context.t1;
171
+ if (v3v4Result) {
171
172
  _context.next = 19;
172
173
  break;
173
174
  }
174
175
  return _context.abrupt("return", v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {});
175
176
  case 19:
176
- ssrRatio = v3Result[0].ssrRatio;
177
+ ssrRatio = v3v4Result[0].ssrRatio;
177
178
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, includeSSRRatio && ssrRatio !== undefined ? {
178
179
  'ufo:vc:ssrRatio': ssrRatio
179
180
  } : {}), v1v2Result), {}, {
180
- 'ufo:vc:rev': [].concat((0, _toConsumableArray2.default)((_ref2 = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref2 !== void 0 ? _ref2 : []), (0, _toConsumableArray2.default)(v3Result !== null && v3Result !== void 0 ? v3Result : []))
181
+ 'ufo:vc:rev': [].concat((0, _toConsumableArray2.default)((_ref2 = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref2 !== void 0 ? _ref2 : []), (0, _toConsumableArray2.default)(v3v4Result !== null && v3v4Result !== void 0 ? v3v4Result : []))
181
182
  }));
182
183
  case 21:
183
184
  case "end":
@@ -248,7 +248,7 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
248
248
  this.addStartEntry(start);
249
249
  feVCCalculationStartTime = performance.now();
250
250
  calculator_fy25_03 = new _fy25_.default();
251
- if (param.ssr) {
251
+ if (param.includeSSRInV3 && param.ssr) {
252
252
  this.addSSR(param.ssr);
253
253
  }
254
254
  orderedEntries = this.entriesTimeline.getOrderedEntries({
@@ -275,9 +275,15 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
275
275
  results.push(fy25_03);
276
276
  }
277
277
 
278
+ // From TTVC v4 onwards, ensuring that SSR entry is always auto-added, whenever it is configured.
279
+ // From the next major version release (where TTVC v4 becomes the default TTVC version), the config for `includeSSRInV3` will be deprecated
280
+ if (param.ssr && !param.includeSSRInV3 && (0, _platformFeatureFlags.fg)('platform_ufo_auto_add_ssr_entry_in_ttvc_v4')) {
281
+ this.addSSR(param.ssr);
282
+ }
283
+
278
284
  // TODO on cleanup: put behind `enabledVCRevisions` config
279
285
  calculator_next = new _vcnext.default();
280
- _context.next = 14;
286
+ _context.next = 15;
281
287
  return calculator_next.calculate({
282
288
  orderedEntries: orderedEntries,
283
289
  startTime: start,
@@ -290,35 +296,35 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
290
296
  isPageVisible: isPageVisible,
291
297
  interactionAbortReason: interactionAbortReason
292
298
  });
293
- case 14:
299
+ case 15:
294
300
  vcNext = _context.sent;
295
301
  if (vcNext) {
296
302
  results.push(vcNext);
297
303
  }
298
304
  feVCCalculationEndTime = performance.now();
299
305
  if (!(includeRawData && (0, _platformFeatureFlags.fg)('platform_ufo_enable_vc_raw_data'))) {
300
- _context.next = 24;
306
+ _context.next = 25;
301
307
  break;
302
308
  }
303
309
  rawVCCalculationStartTime = performance.now();
304
310
  rawHandler = new _rawDataHandler.default();
305
- _context.next = 22;
311
+ _context.next = 23;
306
312
  return rawHandler.getRawData({
307
313
  entries: orderedEntries,
308
314
  startTime: start,
309
315
  stopTime: stop,
310
316
  isPageVisible: isPageVisible
311
317
  });
312
- case 22:
318
+ case 23:
313
319
  raw = _context.sent;
314
320
  if (raw) {
315
321
  raw.rawVCTime = Number((performance.now() - rawVCCalculationStartTime).toFixed(2));
316
322
  raw.feVCTime = Number((feVCCalculationEndTime - feVCCalculationStartTime).toFixed(2));
317
323
  results.push(raw);
318
324
  }
319
- case 24:
320
- return _context.abrupt("return", results);
321
325
  case 25:
326
+ return _context.abrupt("return", results);
327
+ case 26:
322
328
  case "end":
323
329
  return _context.stop();
324
330
  }
@@ -23,6 +23,7 @@ const interactionQueue = [];
23
23
  const segmentCache = new Map();
24
24
  export const segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
25
25
 
26
+ let firstSegmentLoadMarked = false;
26
27
  const segmentObservers = [];
27
28
  export function getActiveInteraction() {
28
29
  const interactionId = getInteractionId();
@@ -194,6 +195,21 @@ export function addMark(interactionId, type, name, labelStack, time = performanc
194
195
  });
195
196
  }
196
197
  }
198
+ export function markFirstSegmentLoad(interactionId, labelStack, time = performance.now()) {
199
+ if (!fg('platform_mark_ufo_segment_first_load')) {
200
+ return;
201
+ }
202
+ const interaction = interactions.get(interactionId);
203
+ if (interaction != null && !firstSegmentLoadMarked) {
204
+ firstSegmentLoadMarked = true;
205
+ interaction.marks.push({
206
+ type: 'first_segment_load',
207
+ name: 'first_segment_load',
208
+ labelStack,
209
+ time
210
+ });
211
+ }
212
+ }
197
213
  export function addMarkToAll(type, name, labelStack, time = performance.now()) {
198
214
  interactions.forEach(interaction => {
199
215
  interaction.marks.push({
@@ -7,11 +7,12 @@ import { getConfig, getDoNotAbortActivePressInteraction, getInteractionRate, get
7
7
  import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
8
8
  import UFOInteractionContext from '../interaction-context';
9
9
  import UFOInteractionIDContext from '../interaction-id-context';
10
- import { abortByNewInteraction, addApdex, addCustomData, addCustomTiming, addHold, addHoldByID, addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, getActiveInteraction, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
10
+ import { abortByNewInteraction, addApdex, addCustomData, addCustomTiming, addHold, addHoldByID, addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, getActiveInteraction, markFirstSegmentLoad, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
11
11
  import UFORouteName from '../route-name-context';
12
12
  import generateId from '../short-id';
13
13
  import scheduleOnPaint from './schedule-on-paint';
14
14
  let tryCompleteHandle;
15
+ let hasMarkedFirstSegmentLoad = false;
15
16
 
16
17
  /** A portion of the page we apply measurement to */
17
18
  export default function UFOSegment({
@@ -53,6 +54,10 @@ export default function UFOSegment({
53
54
  } : {})
54
55
  }], [parentContext, segmentName, segmentId, type]);
55
56
  const interactionId = useContext(UFOInteractionIDContext);
57
+ if (interactionId.current != null && !hasMarkedFirstSegmentLoad) {
58
+ markFirstSegmentLoad(interactionId.current, labelStack, performance.now());
59
+ hasMarkedFirstSegmentLoad = true;
60
+ }
56
61
  const interactionContext = useMemo(() => {
57
62
  let lastCompleteEndTime = 0;
58
63
  function complete(endTime = performance.now()) {
@@ -101,29 +101,30 @@ export class VCObserverWrapper {
101
101
  includeRawData
102
102
  } = param;
103
103
  const v1v2Result = isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey) ? await ((_this$oldVCObserver4 = this.oldVCObserver) === null || _this$oldVCObserver4 === void 0 ? void 0 : _this$oldVCObserver4.getVCResult(param)) : {};
104
- const v3Result = isVCRevisionEnabled('fy25.03', experienceKey) ? await ((_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
104
+ const v3v4Result = isVCRevisionEnabled('fy25.03', experienceKey) ? await ((_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
105
105
  start: param.start,
106
106
  stop: param.stop,
107
107
  interactionId: param.interactionId,
108
- ssr: param.includeSSRInV3 ? param.ssr : undefined,
108
+ ssr: param.ssr,
109
109
  include3p,
110
110
  excludeSmartAnswersInSearch,
111
111
  includeSSRRatio,
112
112
  interactionType: param.interactionType,
113
113
  isPageVisible: param.isPageVisible,
114
114
  interactionAbortReason: param.interactionAbortReason,
115
- includeRawData
115
+ includeRawData,
116
+ includeSSRInV3: param.includeSSRInV3
116
117
  })) : [];
117
- if (!v3Result) {
118
+ if (!v3v4Result) {
118
119
  return v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {};
119
120
  }
120
- const ssrRatio = v3Result[0].ssrRatio;
121
+ const ssrRatio = v3v4Result[0].ssrRatio;
121
122
  return {
122
123
  ...(includeSSRRatio && ssrRatio !== undefined ? {
123
124
  'ufo:vc:ssrRatio': ssrRatio
124
125
  } : {}),
125
126
  ...v1v2Result,
126
- 'ufo:vc:rev': [...((_ref = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref !== void 0 ? _ref : []), ...(v3Result !== null && v3Result !== void 0 ? v3Result : [])]
127
+ 'ufo:vc:rev': [...((_ref = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref !== void 0 ? _ref : []), ...(v3v4Result !== null && v3v4Result !== void 0 ? v3v4Result : [])]
127
128
  };
128
129
  }
129
130
  setSSRElement(element) {
@@ -209,7 +209,7 @@ export default class VCObserverNew {
209
209
  this.addStartEntry(start);
210
210
  const feVCCalculationStartTime = performance.now();
211
211
  const calculator_fy25_03 = new VCCalculator_FY25_03();
212
- if (param.ssr) {
212
+ if (param.includeSSRInV3 && param.ssr) {
213
213
  this.addSSR(param.ssr);
214
214
  }
215
215
  const orderedEntries = this.entriesTimeline.getOrderedEntries({
@@ -233,6 +233,12 @@ export default class VCObserverNew {
233
233
  results.push(fy25_03);
234
234
  }
235
235
 
236
+ // From TTVC v4 onwards, ensuring that SSR entry is always auto-added, whenever it is configured.
237
+ // From the next major version release (where TTVC v4 becomes the default TTVC version), the config for `includeSSRInV3` will be deprecated
238
+ if (param.ssr && !param.includeSSRInV3 && fg('platform_ufo_auto_add_ssr_entry_in_ttvc_v4')) {
239
+ this.addSSR(param.ssr);
240
+ }
241
+
236
242
  // TODO on cleanup: put behind `enabledVCRevisions` config
237
243
  const calculator_next = new VCNextCalculator();
238
244
  const vcNext = await calculator_next.calculate({
@@ -33,6 +33,7 @@ var interactionQueue = [];
33
33
  var segmentCache = new Map();
34
34
  export var segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
35
35
 
36
+ var firstSegmentLoadMarked = false;
36
37
  var segmentObservers = [];
37
38
  export function getActiveInteraction() {
38
39
  var interactionId = getInteractionId();
@@ -229,6 +230,22 @@ export function addMark(interactionId, type, name, labelStack) {
229
230
  });
230
231
  }
231
232
  }
233
+ export function markFirstSegmentLoad(interactionId, labelStack) {
234
+ var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : performance.now();
235
+ if (!fg('platform_mark_ufo_segment_first_load')) {
236
+ return;
237
+ }
238
+ var interaction = interactions.get(interactionId);
239
+ if (interaction != null && !firstSegmentLoadMarked) {
240
+ firstSegmentLoadMarked = true;
241
+ interaction.marks.push({
242
+ type: 'first_segment_load',
243
+ name: 'first_segment_load',
244
+ labelStack: labelStack,
245
+ time: time
246
+ });
247
+ }
248
+ }
232
249
  export function addMarkToAll(type, name, labelStack) {
233
250
  var time = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : performance.now();
234
251
  interactions.forEach(function (interaction) {
@@ -11,11 +11,12 @@ import { getConfig, getDoNotAbortActivePressInteraction, getInteractionRate, get
11
11
  import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
12
12
  import UFOInteractionContext from '../interaction-context';
13
13
  import UFOInteractionIDContext from '../interaction-id-context';
14
- import { abortByNewInteraction, addApdex as _addApdex, addCustomData as _addCustomData, addCustomTiming, addHold, addHoldByID, addMark as _addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, getActiveInteraction, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
14
+ import { abortByNewInteraction, addApdex as _addApdex, addCustomData as _addCustomData, addCustomTiming, addHold, addHoldByID, addMark as _addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, getActiveInteraction, markFirstSegmentLoad, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
15
15
  import UFORouteName from '../route-name-context';
16
16
  import generateId from '../short-id';
17
17
  import scheduleOnPaint from './schedule-on-paint';
18
18
  var tryCompleteHandle;
19
+ var hasMarkedFirstSegmentLoad = false;
19
20
 
20
21
  /** A portion of the page we apply measurement to */
21
22
  export default function UFOSegment(_ref) {
@@ -58,6 +59,10 @@ export default function UFOSegment(_ref) {
58
59
  } : {})];
59
60
  }, [parentContext, segmentName, segmentId, type]);
60
61
  var interactionId = useContext(UFOInteractionIDContext);
62
+ if (interactionId.current != null && !hasMarkedFirstSegmentLoad) {
63
+ markFirstSegmentLoad(interactionId.current, labelStack, performance.now());
64
+ hasMarkedFirstSegmentLoad = true;
65
+ }
61
66
  var interactionContext = useMemo(function () {
62
67
  var lastCompleteEndTime = 0;
63
68
  function complete() {
@@ -112,7 +112,7 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
112
112
  value: function () {
113
113
  var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
114
114
  var _this$oldVCObserver4, _this$newVCObserver3, _ref2;
115
- var experienceKey, include3p, excludeSmartAnswersInSearch, includeSSRRatio, includeRawData, v1v2Result, v3Result, ssrRatio;
115
+ var experienceKey, include3p, excludeSmartAnswersInSearch, includeSSRRatio, includeRawData, v1v2Result, v3v4Result, ssrRatio;
116
116
  return _regeneratorRuntime.wrap(function _callee$(_context) {
117
117
  while (1) switch (_context.prev = _context.next) {
118
118
  case 0:
@@ -140,14 +140,15 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
140
140
  start: param.start,
141
141
  stop: param.stop,
142
142
  interactionId: param.interactionId,
143
- ssr: param.includeSSRInV3 ? param.ssr : undefined,
143
+ ssr: param.ssr,
144
144
  include3p: include3p,
145
145
  excludeSmartAnswersInSearch: excludeSmartAnswersInSearch,
146
146
  includeSSRRatio: includeSSRRatio,
147
147
  interactionType: param.interactionType,
148
148
  isPageVisible: param.isPageVisible,
149
149
  interactionAbortReason: param.interactionAbortReason,
150
- includeRawData: includeRawData
150
+ includeRawData: includeRawData,
151
+ includeSSRInV3: param.includeSSRInV3
151
152
  });
152
153
  case 12:
153
154
  _context.t1 = _context.sent;
@@ -156,18 +157,18 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
156
157
  case 15:
157
158
  _context.t1 = [];
158
159
  case 16:
159
- v3Result = _context.t1;
160
- if (v3Result) {
160
+ v3v4Result = _context.t1;
161
+ if (v3v4Result) {
161
162
  _context.next = 19;
162
163
  break;
163
164
  }
164
165
  return _context.abrupt("return", v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {});
165
166
  case 19:
166
- ssrRatio = v3Result[0].ssrRatio;
167
+ ssrRatio = v3v4Result[0].ssrRatio;
167
168
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, includeSSRRatio && ssrRatio !== undefined ? {
168
169
  'ufo:vc:ssrRatio': ssrRatio
169
170
  } : {}), v1v2Result), {}, {
170
- 'ufo:vc:rev': [].concat(_toConsumableArray((_ref2 = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref2 !== void 0 ? _ref2 : []), _toConsumableArray(v3Result !== null && v3Result !== void 0 ? v3Result : []))
171
+ 'ufo:vc:rev': [].concat(_toConsumableArray((_ref2 = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref2 !== void 0 ? _ref2 : []), _toConsumableArray(v3v4Result !== null && v3v4Result !== void 0 ? v3v4Result : []))
171
172
  }));
172
173
  case 21:
173
174
  case "end":
@@ -241,7 +241,7 @@ var VCObserverNew = /*#__PURE__*/function () {
241
241
  this.addStartEntry(start);
242
242
  feVCCalculationStartTime = performance.now();
243
243
  calculator_fy25_03 = new VCCalculator_FY25_03();
244
- if (param.ssr) {
244
+ if (param.includeSSRInV3 && param.ssr) {
245
245
  this.addSSR(param.ssr);
246
246
  }
247
247
  orderedEntries = this.entriesTimeline.getOrderedEntries({
@@ -268,9 +268,15 @@ var VCObserverNew = /*#__PURE__*/function () {
268
268
  results.push(fy25_03);
269
269
  }
270
270
 
271
+ // From TTVC v4 onwards, ensuring that SSR entry is always auto-added, whenever it is configured.
272
+ // From the next major version release (where TTVC v4 becomes the default TTVC version), the config for `includeSSRInV3` will be deprecated
273
+ if (param.ssr && !param.includeSSRInV3 && fg('platform_ufo_auto_add_ssr_entry_in_ttvc_v4')) {
274
+ this.addSSR(param.ssr);
275
+ }
276
+
271
277
  // TODO on cleanup: put behind `enabledVCRevisions` config
272
278
  calculator_next = new VCNextCalculator();
273
- _context.next = 14;
279
+ _context.next = 15;
274
280
  return calculator_next.calculate({
275
281
  orderedEntries: orderedEntries,
276
282
  startTime: start,
@@ -283,35 +289,35 @@ var VCObserverNew = /*#__PURE__*/function () {
283
289
  isPageVisible: isPageVisible,
284
290
  interactionAbortReason: interactionAbortReason
285
291
  });
286
- case 14:
292
+ case 15:
287
293
  vcNext = _context.sent;
288
294
  if (vcNext) {
289
295
  results.push(vcNext);
290
296
  }
291
297
  feVCCalculationEndTime = performance.now();
292
298
  if (!(includeRawData && fg('platform_ufo_enable_vc_raw_data'))) {
293
- _context.next = 24;
299
+ _context.next = 25;
294
300
  break;
295
301
  }
296
302
  rawVCCalculationStartTime = performance.now();
297
303
  rawHandler = new RawDataHandler();
298
- _context.next = 22;
304
+ _context.next = 23;
299
305
  return rawHandler.getRawData({
300
306
  entries: orderedEntries,
301
307
  startTime: start,
302
308
  stopTime: stop,
303
309
  isPageVisible: isPageVisible
304
310
  });
305
- case 22:
311
+ case 23:
306
312
  raw = _context.sent;
307
313
  if (raw) {
308
314
  raw.rawVCTime = Number((performance.now() - rawVCCalculationStartTime).toFixed(2));
309
315
  raw.feVCTime = Number((feVCCalculationEndTime - feVCCalculationStartTime).toFixed(2));
310
316
  results.push(raw);
311
317
  }
312
- case 24:
313
- return _context.abrupt("return", results);
314
318
  case 25:
319
+ return _context.abrupt("return", results);
320
+ case 26:
315
321
  case "end":
316
322
  return _context.stop();
317
323
  }
@@ -4,7 +4,7 @@ import type { LabelStack, UFOInteractionContextType } from '../../interaction-co
4
4
  import type { VCObserverInterface } from '../../vc/types';
5
5
  import { type VCRawDataType, type VCResult } from '../vc/types';
6
6
  export type LifecycleMarkType = 'render' | 'beforePaint' | 'afterPaint' | 'nextTick' | 'mount' | 'commit';
7
- export type MarkType = ('placeholder' | 'bm3_stop' | 'bundle_preload' | 'custom') | LifecycleMarkType;
7
+ export type MarkType = ('placeholder' | 'bm3_stop' | 'bundle_preload' | 'custom' | 'first_segment_load') | LifecycleMarkType;
8
8
  export type SpanType = 'placeholder' | 'relay' | 'hidden_timing' | 'bundle_load' | 'graphql' | 'fetch' | 'reducer' | 'custom';
9
9
  export type InteractionType = 'page_load' | 'press' | 'typing' | 'transition' | 'segment';
10
10
  export type AbortReasonType = 'new_interaction' | 'unload' | 'transition' | 'timeout' | 'excluded_by_sampling';
@@ -18,6 +18,7 @@ export declare function addCustomData(interactionId: string, labelStack: LabelSt
18
18
  export declare function addCohortingCustomData(interactionId: string, key: string, value: number | boolean | string | null | undefined): void;
19
19
  export declare function addCustomTiming(interactionId: string, labelStack: LabelStack, data: CustomTiming): void;
20
20
  export declare function addMark(interactionId: string, type: MarkType, name: string, labelStack: LabelStack | null, time?: number): void;
21
+ export declare function markFirstSegmentLoad(interactionId: string, labelStack: LabelStack | null, time?: number): void;
21
22
  export declare function addMarkToAll(type: MarkType, name: string, labelStack: LabelStack | null, time?: number): void;
22
23
  export declare function addSpan(interactionId: string, type: SpanType, name: string, labelStack: LabelStack | null, start: number, end?: number, size?: number): void;
23
24
  export declare function addSpanToAll(type: SpanType, name: string, labelStack: LabelStack | null, start: number, end?: number, size?: number): void;
@@ -37,4 +37,5 @@ export type VCObserverGetVCResultParam = {
37
37
  isPageVisible: boolean;
38
38
  interactionAbortReason?: AbortReasonType;
39
39
  includeRawData?: boolean;
40
+ includeSSRInV3?: boolean;
40
41
  };
@@ -4,7 +4,7 @@ import type { LabelStack, UFOInteractionContextType } from '../../interaction-co
4
4
  import type { VCObserverInterface } from '../../vc/types';
5
5
  import { type VCRawDataType, type VCResult } from '../vc/types';
6
6
  export type LifecycleMarkType = 'render' | 'beforePaint' | 'afterPaint' | 'nextTick' | 'mount' | 'commit';
7
- export type MarkType = ('placeholder' | 'bm3_stop' | 'bundle_preload' | 'custom') | LifecycleMarkType;
7
+ export type MarkType = ('placeholder' | 'bm3_stop' | 'bundle_preload' | 'custom' | 'first_segment_load') | LifecycleMarkType;
8
8
  export type SpanType = 'placeholder' | 'relay' | 'hidden_timing' | 'bundle_load' | 'graphql' | 'fetch' | 'reducer' | 'custom';
9
9
  export type InteractionType = 'page_load' | 'press' | 'typing' | 'transition' | 'segment';
10
10
  export type AbortReasonType = 'new_interaction' | 'unload' | 'transition' | 'timeout' | 'excluded_by_sampling';
@@ -18,6 +18,7 @@ export declare function addCustomData(interactionId: string, labelStack: LabelSt
18
18
  export declare function addCohortingCustomData(interactionId: string, key: string, value: number | boolean | string | null | undefined): void;
19
19
  export declare function addCustomTiming(interactionId: string, labelStack: LabelStack, data: CustomTiming): void;
20
20
  export declare function addMark(interactionId: string, type: MarkType, name: string, labelStack: LabelStack | null, time?: number): void;
21
+ export declare function markFirstSegmentLoad(interactionId: string, labelStack: LabelStack | null, time?: number): void;
21
22
  export declare function addMarkToAll(type: MarkType, name: string, labelStack: LabelStack | null, time?: number): void;
22
23
  export declare function addSpan(interactionId: string, type: SpanType, name: string, labelStack: LabelStack | null, start: number, end?: number, size?: number): void;
23
24
  export declare function addSpanToAll(type: SpanType, name: string, labelStack: LabelStack | null, start: number, end?: number, size?: number): void;
@@ -37,4 +37,5 @@ export type VCObserverGetVCResultParam = {
37
37
  isPageVisible: boolean;
38
38
  interactionAbortReason?: AbortReasonType;
39
39
  includeRawData?: boolean;
40
+ includeSSRInV3?: boolean;
40
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.14.4",
3
+ "version": "4.14.6",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -110,9 +110,6 @@
110
110
  "platform_ufo_remove_ssr_placeholder_in_ttvc_v4": {
111
111
  "type": "boolean"
112
112
  },
113
- "platform_ufo_enable_interactivity_jsm": {
114
- "type": "boolean"
115
- },
116
113
  "platform_ufo_exclude_3p_elements_from_ttai": {
117
114
  "type": "boolean"
118
115
  },
@@ -170,8 +167,14 @@
170
167
  "platform_ufo_exclude_3p_attribute_changes": {
171
168
  "type": "boolean"
172
169
  },
170
+ "platform_ufo_auto_add_ssr_entry_in_ttvc_v4": {
171
+ "type": "boolean"
172
+ },
173
173
  "platform_ufo_enable_vc_raw_data": {
174
174
  "type": "boolean"
175
+ },
176
+ "platform_mark_ufo_segment_first_load": {
177
+ "type": "boolean"
175
178
  }
176
179
  }
177
180
  }