@atlaskit/react-ufo 4.2.5 → 4.3.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 (69) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/additional-payload/package.json +1 -1
  3. package/bundle-eval-timing/package.json +1 -1
  4. package/coinflip/package.json +1 -1
  5. package/common/package.json +1 -1
  6. package/config/package.json +1 -1
  7. package/create-experimental-interaction-metrics-payload/package.json +1 -1
  8. package/create-payload/package.json +1 -1
  9. package/create-post-interaction-log-payload/package.json +1 -1
  10. package/custom-cohort-data/package.json +1 -1
  11. package/custom-data/package.json +1 -1
  12. package/custom-mark/package.json +1 -1
  13. package/custom-spans/package.json +1 -1
  14. package/custom-timings/package.json +1 -1
  15. package/dist/cjs/config/index.js +39 -24
  16. package/dist/cjs/create-payload/common/utils/index.js +4 -4
  17. package/dist/cjs/create-payload/index.js +13 -5
  18. package/dist/cjs/interaction-metrics/index.js +1 -0
  19. package/dist/cjs/segment/segment.js +2 -3
  20. package/dist/es2019/config/index.js +14 -0
  21. package/dist/es2019/create-payload/common/utils/index.js +4 -4
  22. package/dist/es2019/create-payload/index.js +11 -1
  23. package/dist/es2019/interaction-metrics/index.js +2 -1
  24. package/dist/es2019/segment/segment.js +2 -3
  25. package/dist/esm/config/index.js +38 -24
  26. package/dist/esm/create-payload/common/utils/index.js +4 -4
  27. package/dist/esm/create-payload/index.js +13 -5
  28. package/dist/esm/interaction-metrics/index.js +2 -1
  29. package/dist/esm/segment/segment.js +2 -3
  30. package/dist/types/common/common/types.d.ts +2 -0
  31. package/dist/types/config/index.d.ts +24 -0
  32. package/dist/types/create-payload/index.d.ts +25346 -146
  33. package/dist/types-ts4.5/common/common/types.d.ts +2 -0
  34. package/dist/types-ts4.5/config/index.d.ts +24 -0
  35. package/dist/types-ts4.5/create-payload/index.d.ts +25346 -146
  36. package/experience-trace-id-context/package.json +1 -1
  37. package/feature-flags-accessed/package.json +1 -1
  38. package/generate-id/package.json +1 -1
  39. package/global-error-handler/package.json +1 -1
  40. package/hidden-timing/package.json +1 -1
  41. package/initial-page-load-extra-timing/package.json +1 -1
  42. package/interaction-context/package.json +1 -1
  43. package/interaction-id-context/package.json +1 -1
  44. package/interaction-ignore/package.json +1 -1
  45. package/interaction-metrics/package.json +1 -1
  46. package/interaction-metrics-init/package.json +1 -1
  47. package/label/package.json +1 -1
  48. package/load-hold/package.json +1 -1
  49. package/package.json +1 -4
  50. package/placeholder/package.json +1 -1
  51. package/resource-timing/package.json +1 -1
  52. package/round-number/package.json +1 -1
  53. package/route-name/package.json +1 -1
  54. package/route-name-context/package.json +1 -1
  55. package/segment/package.json +1 -1
  56. package/set-interaction-error/package.json +1 -1
  57. package/short-id/package.json +1 -1
  58. package/ssr/package.json +1 -1
  59. package/ssr-scripts/package.json +1 -1
  60. package/suspense/package.json +1 -1
  61. package/trace-interaction/package.json +1 -1
  62. package/trace-pageload/package.json +1 -1
  63. package/trace-press/package.json +1 -1
  64. package/trace-redirect/package.json +1 -1
  65. package/trace-transition/package.json +1 -1
  66. package/typing-performance-tracing/package.json +1 -1
  67. package/use-press-tracing/package.json +1 -1
  68. package/vc/package.json +1 -1
  69. package/vc-media/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`45299e3f3ebab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/45299e3f3ebab) -
8
+ Add React hydration property to UFO metrics for initial page load
9
+
10
+ ## 4.2.6
11
+
12
+ ### Patch Changes
13
+
14
+ - [#201076](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/201076)
15
+ [`eda3ae04eeeb4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eda3ae04eeeb4) -
16
+ FG clean up React UFO
17
+
3
18
  ## 4.2.5
4
19
 
5
20
  ### Patch Changes
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/additional-payload/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/additional-payload/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/bundle-eval-timing/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/bundle-eval-timing/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/coinflip/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/coinflip/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/common/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/common/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/config/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/config/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/create-experimental-interaction-metrics-payload/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/create-experimental-interaction-metrics-payload/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/create-payload/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/create-payload/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/create-post-interaction-log-payload/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/custom-cohort-data/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/custom-cohort-data/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/custom-data/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/custom-data/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/custom-mark/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/custom-mark/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/custom-spans/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/custom-spans/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/custom-timings/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/custom-timings/index.d.ts"
12
12
  ]
@@ -16,6 +16,7 @@ exports.getInteractionRate = getInteractionRate;
16
16
  exports.getInteractionTimeout = getInteractionTimeout;
17
17
  exports.getMostRecentVCRevision = getMostRecentVCRevision;
18
18
  exports.getPostInteractionRate = getPostInteractionRate;
19
+ exports.getReactHydrationStats = getReactHydrationStats;
19
20
  exports.getTypingPerformanceTracingMethod = getTypingPerformanceTracingMethod;
20
21
  exports.getUfoNameOverrides = getUfoNameOverrides;
21
22
  exports.isVCRevisionEnabled = isVCRevisionEnabled;
@@ -90,17 +91,31 @@ function getMostRecentVCRevision() {
90
91
  var enabledVCRevisions = getEnabledVCRevisions(experienceKey);
91
92
  return enabledVCRevisions[enabledVCRevisions.length - 1];
92
93
  }
94
+ function getReactHydrationStats() {
95
+ if (!config) {
96
+ return undefined;
97
+ }
98
+ try {
99
+ var _config, _config$getReactHydra;
100
+ var stats = (_config = config) === null || _config === void 0 || (_config$getReactHydra = _config.getReactHydrationStats) === null || _config$getReactHydra === void 0 ? void 0 : _config$getReactHydra.call(_config);
101
+ return stats !== null && stats !== void 0 ? stats : undefined;
102
+ } catch (e) {
103
+ // eslint-disable-next-line no-console
104
+ console.error('getReactHydrationStats threw an error: ', e);
105
+ return undefined;
106
+ }
107
+ }
93
108
  function getInteractionRate(name, interactionKind) {
94
109
  try {
95
110
  if (!config) {
96
111
  return 0;
97
112
  }
98
- var _config = config,
99
- killswitch = _config.killswitch,
100
- rates = _config.rates,
101
- rules = _config.rules,
102
- kind = _config.kind,
103
- autoGeneratedRate = _config.autoGeneratedRate;
113
+ var _config2 = config,
114
+ killswitch = _config2.killswitch,
115
+ rates = _config2.rates,
116
+ rules = _config2.rules,
117
+ kind = _config2.kind,
118
+ autoGeneratedRate = _config2.autoGeneratedRate;
104
119
  if (killswitch != null) {
105
120
  // Specifically kill certain events
106
121
  if (killswitch.includes(name)) {
@@ -150,8 +165,8 @@ function getExperimentalInteractionRate(name, interactionType) {
150
165
  if (!config) {
151
166
  return 0;
152
167
  }
153
- var _config2 = config,
154
- experimentalInteractionMetrics = _config2.experimentalInteractionMetrics;
168
+ var _config3 = config,
169
+ experimentalInteractionMetrics = _config3.experimentalInteractionMetrics;
155
170
  if (!(experimentalInteractionMetrics !== null && experimentalInteractionMetrics !== void 0 && experimentalInteractionMetrics.enabled)) {
156
171
  return 0;
157
172
  }
@@ -171,8 +186,8 @@ function getPostInteractionRate(name, interactionType) {
171
186
  if (!config) {
172
187
  return 0;
173
188
  }
174
- var _config3 = config,
175
- postInteractionLog = _config3.postInteractionLog;
189
+ var _config4 = config,
190
+ postInteractionLog = _config4.postInteractionLog;
176
191
  if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
177
192
  return 0;
178
193
  }
@@ -198,8 +213,8 @@ function getCapabilityRate(capability) {
198
213
  if (!config) {
199
214
  return 0;
200
215
  }
201
- var _config4 = config,
202
- capabilityRate = _config4.capability;
216
+ var _config5 = config,
217
+ capabilityRate = _config5.capability;
203
218
  if (capabilityRate != null) {
204
219
  var rate = capabilityRate[capability];
205
220
  if (rate != null) {
@@ -218,8 +233,8 @@ function getTypingPerformanceTracingMethod() {
218
233
  if (!config) {
219
234
  return defaultMethod;
220
235
  }
221
- var _config5 = config,
222
- typingMethod = _config5.typingMethod;
236
+ var _config6 = config,
237
+ typingMethod = _config6.typingMethod;
223
238
  if (typingMethod != null && validTypingMethods.find(function (m) {
224
239
  return m === typingMethod;
225
240
  })) {
@@ -238,8 +253,8 @@ function getAwaitBM3TTIList() {
238
253
  if (!config) {
239
254
  return [];
240
255
  }
241
- var _config6 = config,
242
- awaitBM3TTI = _config6.awaitBM3TTI;
256
+ var _config7 = config,
257
+ awaitBM3TTI = _config7.awaitBM3TTI;
243
258
  if (awaitBM3TTI != null) {
244
259
  return awaitBM3TTI;
245
260
  } else {
@@ -259,8 +274,8 @@ function getUfoNameOverrides() {
259
274
  if (!config) {
260
275
  return undefined;
261
276
  }
262
- var _config7 = config,
263
- ufoNameOverrides = _config7.ufoNameOverrides;
277
+ var _config8 = config,
278
+ ufoNameOverrides = _config8.ufoNameOverrides;
264
279
  if (ufoNameOverrides != null) {
265
280
  return ufoNameOverrides;
266
281
  }
@@ -276,8 +291,8 @@ function getDoNotAbortActivePressInteraction() {
276
291
  if (!config) {
277
292
  return undefined;
278
293
  }
279
- var _config8 = config,
280
- doNotAbortActivePressInteraction = _config8.doNotAbortActivePressInteraction;
294
+ var _config9 = config,
295
+ doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
281
296
  return doNotAbortActivePressInteraction;
282
297
  } catch (e) {
283
298
  return undefined;
@@ -290,8 +305,8 @@ function getDoNotAbortActivePressInteractionOnTransition() {
290
305
  if (!config) {
291
306
  return undefined;
292
307
  }
293
- var _config9 = config,
294
- doNotAbortActivePressInteractionOnTransition = _config9.doNotAbortActivePressInteractionOnTransition;
308
+ var _config0 = config,
309
+ doNotAbortActivePressInteractionOnTransition = _config0.doNotAbortActivePressInteractionOnTransition;
295
310
  return doNotAbortActivePressInteractionOnTransition;
296
311
  } catch (e) {
297
312
  return undefined;
@@ -303,8 +318,8 @@ function getInteractionTimeout(ufoName) {
303
318
  if (!config) {
304
319
  return CLEANUP_TIMEOUT;
305
320
  }
306
- var _config0 = config,
307
- interactionTimeout = _config0.interactionTimeout;
321
+ var _config1 = config,
322
+ interactionTimeout = _config1.interactionTimeout;
308
323
  if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
309
324
  return interactionTimeout[ufoName];
310
325
  }
@@ -67,7 +67,7 @@ function buildSegmentTree(labelStacks) {
67
67
  if (!currentNode.c[key]) {
68
68
  currentNode.c[key] = _objectSpread({
69
69
  n: name
70
- }, type && (0, _platformFeatureFlags.fg)('platform_ufo_add_type_for_3p_segments') ? {
70
+ }, type ? {
71
71
  t: type
72
72
  } : {});
73
73
  }
@@ -93,7 +93,7 @@ function buildSegmentTree(labelStacks) {
93
93
  if (!currentNode.c[key]) {
94
94
  currentNode.c[key] = _objectSpread({
95
95
  n: name
96
- }, type && (0, _platformFeatureFlags.fg)('platform_ufo_add_type_for_3p_segments') ? {
96
+ }, type ? {
97
97
  t: type
98
98
  } : {});
99
99
  }
@@ -135,7 +135,7 @@ function optimizeLabelStack(labelStack, reactUFOVersion) {
135
135
  n: ls.name
136
136
  }, ls.segmentId ? {
137
137
  s: ls.segmentId
138
- } : {}), ls.type && (0, _platformFeatureFlags.fg)('platform_ufo_add_type_for_3p_segments') ? {
138
+ } : {}), ls.type ? {
139
139
  t: ls.type
140
140
  } : {});
141
141
  });
@@ -169,7 +169,7 @@ function getOldSegmentsLabelStack(segments, interactionType) {
169
169
  n: ls.name
170
170
  }, ls.segmentId ? {
171
171
  s: ls.segmentId
172
- } : {}), ls.type && (0, _platformFeatureFlags.fg)('platform_ufo_add_type_for_3p_segments') ? {
172
+ } : {}), ls.type ? {
173
173
  t: ls.type
174
174
  } : {}));
175
175
  }
@@ -582,7 +582,7 @@ function createInteractionMetricsPayload(_x, _x2, _x3, _x4, _x5) {
582
582
  function _createInteractionMetricsPayload() {
583
583
  _createInteractionMetricsPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interaction, interactionId, experimental, criticalPayloadCount, vcMetrics) {
584
584
  var _window$location, _config$additionalPay;
585
- var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, payload;
585
+ var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, hydration, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, getReactHydrationStats, payload;
586
586
  return _regenerator.default.wrap(function _callee$(_context) {
587
587
  while (1) switch (_context.prev = _context.next) {
588
588
  case 0:
@@ -594,7 +594,7 @@ function _createInteractionMetricsPayload() {
594
594
  }
595
595
  throw Error('UFO Configuration not provided');
596
596
  case 4:
597
- end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, knownSegments = interaction.knownSegments, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, featureFlags = interaction.featureFlags, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, responsiveness = interaction.responsiveness, unknownElementName = interaction.unknownElementName, unknownElementHierarchy = interaction.unknownElementHierarchy;
597
+ end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, knownSegments = interaction.knownSegments, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, featureFlags = interaction.featureFlags, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, responsiveness = interaction.responsiveness, unknownElementName = interaction.unknownElementName, unknownElementHierarchy = interaction.unknownElementHierarchy, hydration = interaction.hydration;
598
598
  pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
599
599
  pageVisibilityAtTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
600
600
  segments = !(0, _platformFeatureFlags.fg)('platform_ufo_remove_deprecated_config_fields') && config.killswitchNestedSegments ? [] : knownSegments;
@@ -707,6 +707,14 @@ function _createInteractionMetricsPayload() {
707
707
  if (!experimental) {
708
708
  (0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift') && (0, _addPerformanceMeasures.addPerformanceMeasures)(interaction.start, (0, _toConsumableArray2.default)((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || []));
709
709
  }
710
+ getReactHydrationStats = function getReactHydrationStats() {
711
+ if (!isPageLoad || !hydration) {
712
+ return {};
713
+ }
714
+ return {
715
+ hydration: hydration
716
+ };
717
+ };
710
718
  payload = {
711
719
  actionSubject: 'experience',
712
720
  action: 'measured',
@@ -714,7 +722,7 @@ function _createInteractionMetricsPayload() {
714
722
  source: 'measured',
715
723
  tags: ['observability'],
716
724
  attributes: {
717
- properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
725
+ properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
718
726
  // basic
719
727
  'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
720
728
  'event:product': config.product,
@@ -733,7 +741,7 @@ function _createInteractionMetricsPayload() {
733
741
  }, criticalPayloadCount !== undefined ? {
734
742
  'ufo:multipayload': true,
735
743
  'ufo:criticalPayloadCount': criticalPayloadCount
736
- } : {}), (0, _getBrowserMetadata.getBrowserMetadataToLegacyFormat)()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), (0, _getNavigationMetrics.getNavigationMetricsToLegacyFormat)(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), {}, {
744
+ } : {}), (0, _getBrowserMetadata.getBrowserMetadataToLegacyFormat)()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), (0, _getNavigationMetrics.getNavigationMetricsToLegacyFormat)(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
737
745
  interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
738
746
  namePrefix: config.namePrefix || '',
739
747
  segmentPrefix: config.segmentPrefix || '',
@@ -779,7 +787,7 @@ function _createInteractionMetricsPayload() {
779
787
  }
780
788
  payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
781
789
  return _context.abrupt("return", payload);
782
- case 44:
790
+ case 45:
783
791
  case "end":
784
792
  return _context.stop();
785
793
  }
@@ -663,6 +663,7 @@ function finishInteraction(id, data) {
663
663
  data.vc = observer.getVCRawData();
664
664
  }
665
665
  }
666
+ data.hydration = (0, _config.getReactHydrationStats)();
666
667
 
667
668
  // By this time, stop the post interaction log observer if coinflip rate is 0
668
669
  if ((0, _platformFeatureFlags.fg)('platform_ufo_post_interaction_check_name')) {
@@ -11,7 +11,6 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _scheduler = require("scheduler");
13
13
  var _uuid = require("uuid");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _coinflip = _interopRequireDefault(require("../coinflip"));
16
15
  var _config = require("../config");
17
16
  var _experienceTraceIdContext = require("../experience-trace-id-context");
@@ -67,13 +66,13 @@ function UFOSegment(_ref) {
67
66
  return parentContext !== null && parentContext !== void 0 && parentContext.labelStack ? [].concat((0, _toConsumableArray2.default)(parentContext.labelStack), [_objectSpread({
68
67
  name: segmentName,
69
68
  segmentId: segmentId
70
- }, type !== 'first-party' && (0, _platformFeatureFlags.fg)('platform_ufo_add_type_for_3p_segments') ? {
69
+ }, type !== 'first-party' ? {
71
70
  type: type
72
71
  } : {}) // Only pass non-default types (not 'first-party') in payload to reduce size
73
72
  ]) : [_objectSpread({
74
73
  name: segmentName,
75
74
  segmentId: segmentId
76
- }, type !== 'first-party' && (0, _platformFeatureFlags.fg)('platform_ufo_add_type_for_3p_segments') ? {
75
+ }, type !== 'first-party' ? {
77
76
  type: type
78
77
  } : {})];
79
78
  }, [parentContext, segmentName, segmentId, type]);
@@ -67,6 +67,20 @@ export function getMostRecentVCRevision(experienceKey = '') {
67
67
  const enabledVCRevisions = getEnabledVCRevisions(experienceKey);
68
68
  return enabledVCRevisions[enabledVCRevisions.length - 1];
69
69
  }
70
+ export function getReactHydrationStats() {
71
+ if (!config) {
72
+ return undefined;
73
+ }
74
+ try {
75
+ var _config, _config$getReactHydra;
76
+ const stats = (_config = config) === null || _config === void 0 ? void 0 : (_config$getReactHydra = _config.getReactHydrationStats) === null || _config$getReactHydra === void 0 ? void 0 : _config$getReactHydra.call(_config);
77
+ return stats !== null && stats !== void 0 ? stats : undefined;
78
+ } catch (e) {
79
+ // eslint-disable-next-line no-console
80
+ console.error('getReactHydrationStats threw an error: ', e);
81
+ return undefined;
82
+ }
83
+ }
70
84
  export function getInteractionRate(name, interactionKind) {
71
85
  try {
72
86
  if (!config) {
@@ -40,7 +40,7 @@ export function buildSegmentTree(labelStacks) {
40
40
  if (!currentNode.c[key]) {
41
41
  currentNode.c[key] = {
42
42
  n: name,
43
- ...(type && fg('platform_ufo_add_type_for_3p_segments') ? {
43
+ ...(type ? {
44
44
  t: type
45
45
  } : {})
46
46
  };
@@ -62,7 +62,7 @@ export function buildSegmentTree(labelStacks) {
62
62
  if (!currentNode.c[key]) {
63
63
  currentNode.c[key] = {
64
64
  n: name,
65
- ...(type && fg('platform_ufo_add_type_for_3p_segments') ? {
65
+ ...(type ? {
66
66
  t: type
67
67
  } : {})
68
68
  };
@@ -103,7 +103,7 @@ export function optimizeLabelStack(labelStack, reactUFOVersion) {
103
103
  ...(ls.segmentId ? {
104
104
  s: ls.segmentId
105
105
  } : {}),
106
- ...(ls.type && fg('platform_ufo_add_type_for_3p_segments') ? {
106
+ ...(ls.type ? {
107
107
  t: ls.type
108
108
  } : {})
109
109
  }));
@@ -135,7 +135,7 @@ export function getOldSegmentsLabelStack(segments, interactionType) {
135
135
  ...(ls.segmentId ? {
136
136
  s: ls.segmentId
137
137
  } : {}),
138
- ...(ls.type && fg('platform_ufo_add_type_for_3p_segments') ? {
138
+ ...(ls.type ? {
139
139
  t: ls.type
140
140
  } : {})
141
141
  });
@@ -598,7 +598,8 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
598
598
  abortedByInteractionName,
599
599
  responsiveness,
600
600
  unknownElementName,
601
- unknownElementHierarchy
601
+ unknownElementHierarchy,
602
+ hydration
602
603
  } = interaction;
603
604
  const pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
604
605
  const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
@@ -693,6 +694,14 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
693
694
  if (!experimental) {
694
695
  fg('ufo_chrome_devtools_uplift') && addPerformanceMeasures(interaction.start, [...((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || [])]);
695
696
  }
697
+ const getReactHydrationStats = () => {
698
+ if (!isPageLoad || !hydration) {
699
+ return {};
700
+ }
701
+ return {
702
+ hydration
703
+ };
704
+ };
696
705
  const payload = {
697
706
  actionSubject: 'experience',
698
707
  action: 'measured',
@@ -733,6 +742,7 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
733
742
  ...getTracingContextData(interaction),
734
743
  ...getStylesheetMetrics(),
735
744
  ...getErrorCounts(interaction),
745
+ ...getReactHydrationStats(),
736
746
  interactionMetrics: {
737
747
  namePrefix: config.namePrefix || '',
738
748
  segmentPrefix: config.segmentPrefix || '',
@@ -1,7 +1,7 @@
1
1
  import { v4 as createUUID } from 'uuid';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import coinflip from '../coinflip';
4
- import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate } from '../config';
4
+ import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
5
5
  import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
6
6
  import { sanitizeUfoName } from '../create-payload/common/utils';
7
7
  import { clearActiveTrace } from '../experience-trace-id-context';
@@ -581,6 +581,7 @@ function finishInteraction(id, data, endTime = performance.now()) {
581
581
  data.vc = observer.getVCRawData();
582
582
  }
583
583
  }
584
+ data.hydration = getReactHydrationStats();
584
585
 
585
586
  // By this time, stop the post interaction log observer if coinflip rate is 0
586
587
  if (fg('platform_ufo_post_interaction_check_name')) {
@@ -1,7 +1,6 @@
1
1
  import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
2
2
  import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
3
3
  import { v4 as createUUID } from 'uuid';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import coinflip from '../coinflip';
6
5
  import { getConfig, getInteractionRate } from '../config';
7
6
  import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
@@ -46,14 +45,14 @@ export default function UFOSegment({
46
45
  const labelStack = useMemo(() => parentContext !== null && parentContext !== void 0 && parentContext.labelStack ? [...parentContext.labelStack, {
47
46
  name: segmentName,
48
47
  segmentId,
49
- ...(type !== 'first-party' && fg('platform_ufo_add_type_for_3p_segments') ? {
48
+ ...(type !== 'first-party' ? {
50
49
  type
51
50
  } : {})
52
51
  } // Only pass non-default types (not 'first-party') in payload to reduce size
53
52
  ] : [{
54
53
  name: segmentName,
55
54
  segmentId,
56
- ...(type !== 'first-party' && fg('platform_ufo_add_type_for_3p_segments') ? {
55
+ ...(type !== 'first-party' ? {
57
56
  type
58
57
  } : {})
59
58
  }], [parentContext, segmentName, segmentId, type]);