@atlaskit/react-ufo 4.1.11 → 4.1.13

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,21 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.1.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [#195513](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/195513)
8
+ [`49b7bf5d4e698`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/49b7bf5d4e698) -
9
+ Added reactUFO as marks to Dev Tools
10
+
11
+ ## 4.1.12
12
+
13
+ ### Patch Changes
14
+
15
+ - [#195371](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/195371)
16
+ [`928a3cc316c8f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/928a3cc316c8f) -
17
+ Fix post interaction log naming issue
18
+
3
19
  ## 4.1.11
4
20
 
5
21
  ### Patch Changes
@@ -33,6 +33,7 @@ var _roundNumber = require("../round-number");
33
33
  var ssr = _interopRequireWildcard(require("../ssr"));
34
34
  var _utils = require("./common/utils");
35
35
  var _criticalMetricsPayload = require("./critical-metrics-payload");
36
+ var _addPerformanceMeasures = require("./utils/add-performance-measures");
36
37
  var _getBrowserMetadata = require("./utils/get-browser-metadata");
37
38
  var _getInteractionStatus = _interopRequireDefault(require("./utils/get-interaction-status"));
38
39
  var _getNavigationMetrics = require("./utils/get-navigation-metrics");
@@ -201,7 +202,7 @@ function getPPSMetrics(interaction) {
201
202
  function getSSRProperties(type) {
202
203
  var ssrPhases = getSSRPhaseSuccess(type);
203
204
  return _objectSpread(_objectSpread({
204
- 'ssr:success': (0, _getSsrSuccess.default)(type),
205
+ 'ssr:success': (ssrPhases === null || ssrPhases === void 0 ? void 0 : ssrPhases.done) != null ? ssrPhases.done : (0, _getSsrSuccess.default)(type),
205
206
  'ssr:featureFlags': getSSRFeatureFlags(type)
206
207
  }, (ssrPhases === null || ssrPhases === void 0 ? void 0 : ssrPhases.earlyFlush) != null ? {
207
208
  'ssr:earlyflush:success': ssrPhases.earlyFlush
@@ -619,9 +620,23 @@ function _createInteractionMetricsPayload() {
619
620
  var SSRDoneTime = SSRDoneTimeValue !== undefined ? {
620
621
  SSRDoneTime: Math.round(SSRDoneTimeValue)
621
622
  } : {};
623
+ var isBM3ConfigSSRDoneAsFmp = interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp;
624
+ var isUFOConfigSSRDoneAsFmp = interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp || !!(config !== null && config !== void 0 && (_config$ssr = config.ssr) !== null && _config$ssr !== void 0 && _config$ssr.getSSRDoneTime);
625
+ if (!experimental && (isBM3ConfigSSRDoneAsFmp || isUFOConfigSSRDoneAsFmp) && SSRDoneTimeValue !== undefined && (0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
626
+ try {
627
+ performance.mark("FMP", {
628
+ startTime: SSRDoneTimeValue,
629
+ detail: {
630
+ devtools: {
631
+ dataType: 'marker'
632
+ }
633
+ }
634
+ });
635
+ } catch (e) {}
636
+ }
622
637
  return _objectSpread(_objectSpread({}, SSRDoneTime), {}, {
623
- isBM3ConfigSSRDoneAsFmp: interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp,
624
- isUFOConfigSSRDoneAsFmp: interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp || !!(config !== null && config !== void 0 && (_config$ssr = config.ssr) !== null && _config$ssr !== void 0 && _config$ssr.getSSRDoneTime)
638
+ isBM3ConfigSSRDoneAsFmp: isBM3ConfigSSRDoneAsFmp,
639
+ isUFOConfigSSRDoneAsFmp: isUFOConfigSSRDoneAsFmp
625
640
  });
626
641
  };
627
642
  pageLoadInteractionMetrics = getInitialPageLoadSSRMetrics(); // Detailed payload. Page visibility = visible
@@ -690,6 +705,9 @@ function _createInteractionMetricsPayload() {
690
705
  finalVCMetrics = _yield$Promise$all2[0];
691
706
  experimentalMetrics = _yield$Promise$all2[1];
692
707
  paintMetrics = _yield$Promise$all2[2];
708
+ if (!experimental) {
709
+ (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']) || []));
710
+ }
693
711
  payload = {
694
712
  actionSubject: 'experience',
695
713
  action: 'measured',
@@ -768,7 +786,7 @@ function _createInteractionMetricsPayload() {
768
786
  }
769
787
  payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
770
788
  return _context.abrupt("return", payload);
771
- case 43:
789
+ case 44:
772
790
  case "end":
773
791
  return _context.stop();
774
792
  }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addPerformanceMeasures = void 0;
7
+ var addPerformanceMeasures = exports.addPerformanceMeasures = function addPerformanceMeasures(start, measures) {
8
+ try {
9
+ measures.sort(function (a, b) {
10
+ return b.revision.localeCompare(a.revision);
11
+ }).slice(0, 2).forEach(function (entry) {
12
+ var _entry$vcDetails;
13
+ if (((_entry$vcDetails = entry.vcDetails) === null || _entry$vcDetails === void 0 || (_entry$vcDetails = _entry$vcDetails['90']) === null || _entry$vcDetails === void 0 ? void 0 : _entry$vcDetails.t) !== undefined) {
14
+ var _entry$vcDetails2;
15
+ performance.mark("VC90 (".concat(entry.revision, ")"), {
16
+ startTime: start + ((_entry$vcDetails2 = entry.vcDetails) === null || _entry$vcDetails2 === void 0 || (_entry$vcDetails2 = _entry$vcDetails2['90']) === null || _entry$vcDetails2 === void 0 ? void 0 : _entry$vcDetails2.t),
17
+ detail: {
18
+ devtools: {
19
+ dataType: 'marker'
20
+ }
21
+ }
22
+ });
23
+ }
24
+ });
25
+ measures.forEach(function (entry) {
26
+ var _entry$vcDetails3;
27
+ if (!entry || !entry.vcDetails) {
28
+ return;
29
+ }
30
+ var VCParts = Object.keys(entry.vcDetails);
31
+ performance.measure("VC90 (".concat(entry.revision, ")"), {
32
+ start: start,
33
+ duration: (_entry$vcDetails3 = entry.vcDetails) === null || _entry$vcDetails3 === void 0 || (_entry$vcDetails3 = _entry$vcDetails3['90']) === null || _entry$vcDetails3 === void 0 ? void 0 : _entry$vcDetails3.t,
34
+ detail: {
35
+ devtools: {
36
+ track: "main metrics",
37
+ trackGroup: '🛸 reactUFO metrics',
38
+ color: 'tertiary'
39
+ }
40
+ }
41
+ });
42
+ VCParts.forEach(function (key) {
43
+ var _entry$vcDetails4;
44
+ var duration = (_entry$vcDetails4 = entry.vcDetails) === null || _entry$vcDetails4 === void 0 ? void 0 : _entry$vcDetails4[key].t;
45
+ if (typeof duration !== 'number') {
46
+ return;
47
+ }
48
+ performance.measure("VC".concat(key), {
49
+ start: start,
50
+ duration: duration,
51
+ detail: {
52
+ devtools: {
53
+ track: "VC ".concat(entry.revision),
54
+ trackGroup: '🛸 reactUFO metrics',
55
+ color: key === '90' ? 'tertiary' : 'primary-light'
56
+ }
57
+ }
58
+ });
59
+ });
60
+ });
61
+ } catch (error) {}
62
+ };
@@ -54,6 +54,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
54
54
  var _coinflip = _interopRequireDefault(require("../coinflip"));
55
55
  var _config = require("../config");
56
56
  var _createExperimentalInteractionMetricsPayload = require("../create-experimental-interaction-metrics-payload");
57
+ var _utils = require("../create-payload/common/utils");
57
58
  var _experienceTraceIdContext = require("../experience-trace-id-context");
58
59
  var _featureFlagsAccessed = require("../feature-flags-accessed");
59
60
  var _interactionIdContext = require("../interaction-id-context");
@@ -620,6 +621,7 @@ function finishInteraction(id, data) {
620
621
  data.end = endTime;
621
622
  try {
622
623
  // for Firefox 102 and older
624
+
623
625
  if ((0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift')) {
624
626
  performance.measure("\uD83D\uDEF8 [".concat(data.type, "] ").concat(data.ufoName, " [ttai]"), {
625
627
  start: data.start,
@@ -632,6 +634,14 @@ function finishInteraction(id, data) {
632
634
  }
633
635
  }
634
636
  });
637
+ performance.mark("TTAI", {
638
+ startTime: data.end,
639
+ detail: {
640
+ devtools: {
641
+ dataType: 'marker'
642
+ }
643
+ }
644
+ });
635
645
  } else {
636
646
  performance.measure("\uD83D\uDEF8 [".concat(data.type, "] ").concat(data.ufoName, " [ttai]"), {
637
647
  start: data.start,
@@ -653,6 +663,18 @@ function finishInteraction(id, data) {
653
663
  data.vc = observer.getVCRawData();
654
664
  }
655
665
  }
666
+
667
+ // By this time, stop the post interaction log observer if coinflip rate is 0
668
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_post_interaction_check_name')) {
669
+ var sanitisedUfoName = (0, _utils.sanitizeUfoName)(data.ufoName);
670
+ if (!(0, _coinflip.default)((0, _config.getPostInteractionRate)(sanitisedUfoName, data.type))) {
671
+ postInteractionLog.stopVCObserver();
672
+ }
673
+ } else {
674
+ if (!(0, _coinflip.default)((0, _config.getPostInteractionRate)(data.routeName || data.ufoName, data.type))) {
675
+ postInteractionLog.stopVCObserver();
676
+ }
677
+ }
656
678
  if (!((_getConfig5 = (0, _config.getConfig)()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
657
679
  remove(id);
658
680
  }
@@ -875,8 +897,12 @@ function addOnCancelCallback(id, cancelCallback) {
875
897
  }
876
898
  function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName) {
877
899
  var trace = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
878
- if ((0, _coinflip.default)((0, _config.getPostInteractionRate)(routeName || ufoName, type))) {
900
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_post_interaction_check_name')) {
879
901
  postInteractionLog.reset();
902
+ } else {
903
+ if ((0, _coinflip.default)((0, _config.getPostInteractionRate)(routeName || ufoName, type))) {
904
+ postInteractionLog.reset();
905
+ }
880
906
  }
881
907
  var vcObserver;
882
908
  var previousTime = startTime;
@@ -995,10 +1021,21 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
995
1021
  experienceKey: ufoName
996
1022
  });
997
1023
  }
998
- if ((0, _coinflip.default)((0, _config.getPostInteractionRate)(routeName || ufoName, type))) {
999
- postInteractionLog.startVCObserver({
1000
- startTime: startTime
1001
- });
1024
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_post_interaction_check_name')) {
1025
+ var _getConfig0;
1026
+ // Start post interaction observer for all if config is enabled
1027
+ // in case ufoName is updated at later time
1028
+ if ((_getConfig0 = (0, _config.getConfig)()) !== null && _getConfig0 !== void 0 && (_getConfig0 = _getConfig0.postInteractionLog) !== null && _getConfig0 !== void 0 && _getConfig0.enabled) {
1029
+ postInteractionLog.startVCObserver({
1030
+ startTime: startTime
1031
+ });
1032
+ }
1033
+ } else {
1034
+ if ((0, _coinflip.default)((0, _config.getPostInteractionRate)(routeName || ufoName, type))) {
1035
+ postInteractionLog.startVCObserver({
1036
+ startTime: startTime
1037
+ });
1038
+ }
1002
1039
  }
1003
1040
  if ((0, _coinflip.default)((0, _config.getExperimentalInteractionRate)(ufoName, type))) {
1004
1041
  _createExperimentalInteractionMetricsPayload.experimentalVC.start({
@@ -1046,6 +1083,14 @@ function addApdexToAll(apdex) {
1046
1083
  }
1047
1084
  }
1048
1085
  });
1086
+ performance.mark("[bm3] TTI", {
1087
+ startTime: apdex.stopTime,
1088
+ detail: {
1089
+ devtools: {
1090
+ dataType: 'marker'
1091
+ }
1092
+ }
1093
+ });
1049
1094
  } else {
1050
1095
  var _apdex$startTime2;
1051
1096
  performance.measure("\uD83D\uDEF8 ".concat(apdex.key, " [bm3_tti]"), {
@@ -1080,6 +1125,14 @@ function addApdex(interactionId, apdexInfo) {
1080
1125
  }
1081
1126
  }
1082
1127
  });
1128
+ performance.mark("[bm3] TTI", {
1129
+ startTime: apdexInfo.stopTime,
1130
+ detail: {
1131
+ devtools: {
1132
+ dataType: 'marker'
1133
+ }
1134
+ }
1135
+ });
1083
1136
  } else {
1084
1137
  var _apdexInfo$startTime2;
1085
1138
  performance.measure("\uD83D\uDEF8 ".concat(apdexInfo.key, " [bm3_tti]"), {
@@ -120,8 +120,8 @@ var PostInteractionLog = exports.default = /*#__PURE__*/function () {
120
120
  key: "sendPostInteractionLog",
121
121
  value: (function () {
122
122
  var _sendPostInteractionLog = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
123
- var _this$vcObserver4, _this$vcObserver5;
124
- var _this$vcObserver3, postInteractionFinishVCResult;
123
+ var _this$vcObserver4, _config$vc, _config$vc2, _this$vcObserver5;
124
+ var _this$vcObserver3, config, postInteractionFinishVCResult;
125
125
  return _regenerator.default.wrap(function _callee$(_context) {
126
126
  while (1) switch (_context.prev = _context.next) {
127
127
  case 0:
@@ -133,18 +133,21 @@ var PostInteractionLog = exports.default = /*#__PURE__*/function () {
133
133
  (_this$vcObserver3 = this.vcObserver) === null || _this$vcObserver3 === void 0 || _this$vcObserver3.stop();
134
134
  return _context.abrupt("return");
135
135
  case 4:
136
- _context.next = 6;
137
- return (_this$vcObserver4 = this.vcObserver) === null || _this$vcObserver4 === void 0 ? void 0 : _this$vcObserver4.getVCResult(_objectSpread(_objectSpread({
136
+ config = (0, _config.getConfig)();
137
+ _context.next = 7;
138
+ return (_this$vcObserver4 = this.vcObserver) === null || _this$vcObserver4 === void 0 ? void 0 : _this$vcObserver4.getVCResult(_objectSpread({
138
139
  start: this.lastInteractionFinish.start,
139
140
  stop: performance.now(),
140
141
  tti: -1,
141
142
  // no need for TTI value here
142
143
  isEventAborted: !!this.lastInteractionFinish.abortReason,
143
- prefix: 'ufo'
144
- }, this.vcObserverSSRConfig), {}, {
145
- experienceKey: this.lastInteractionFinish.ufoName
146
- }));
147
- case 6:
144
+ prefix: 'ufo',
145
+ experienceKey: this.lastInteractionFinish.ufoName,
146
+ interactionId: this.lastInteractionFinish.id,
147
+ includeSSRInV3: config === null || config === void 0 || (_config$vc = config.vc) === null || _config$vc === void 0 ? void 0 : _config$vc.includeSSRInV3,
148
+ includeSSRRatio: config === null || config === void 0 || (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRRatio
149
+ }, this.vcObserverSSRConfig));
150
+ case 7:
148
151
  postInteractionFinishVCResult = _context.sent;
149
152
  (_this$vcObserver5 = this.vcObserver) === null || _this$vcObserver5 === void 0 || _this$vcObserver5.stop();
150
153
  this.sinkHandlerFn({
@@ -154,7 +157,7 @@ var PostInteractionLog = exports.default = /*#__PURE__*/function () {
154
157
  lastInteractionFinishVCResult: this.lastInteractionFinishVCResult
155
158
  });
156
159
  this.reset();
157
- case 10:
160
+ case 11:
158
161
  case "end":
159
162
  return _context.stop();
160
163
  }
@@ -14,7 +14,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
16
16
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
17
  var _config = require("../config");
19
18
  var _noOpVcObserver = require("./no-op-vc-observer");
20
19
  var _vcObserver = require("./vc-observer");
@@ -169,17 +168,16 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
169
168
  _context.t1 = [];
170
169
  case 16:
171
170
  v3Result = _context.t1;
172
- (0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift') && this.addPerformanceMeasures(param.start, [].concat((0, _toConsumableArray2.default)((v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) || []), (0, _toConsumableArray2.default)(v3Result !== null && v3Result !== void 0 ? v3Result : [])));
173
171
  if (v3Result) {
174
- _context.next = 20;
172
+ _context.next = 19;
175
173
  break;
176
174
  }
177
175
  return _context.abrupt("return", v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {});
178
- case 20:
176
+ case 19:
179
177
  return _context.abrupt("return", _objectSpread(_objectSpread({}, v1v2Result), {}, {
180
178
  '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
179
  }));
182
- case 21:
180
+ case 20:
183
181
  case "end":
184
182
  return _context.stop();
185
183
  }
@@ -216,48 +214,6 @@ var VCObserverWrapper = exports.VCObserverWrapper = /*#__PURE__*/function () {
216
214
  value: function collectSSRPlaceholders() {
217
215
  this.ssrPlaceholderHandler.collectExistingPlaceholders();
218
216
  }
219
- }, {
220
- key: "addPerformanceMeasures",
221
- value: function addPerformanceMeasures(start, measures) {
222
- try {
223
- measures.forEach(function (entry) {
224
- var _entry$vcDetails;
225
- if (!entry || !entry.vcDetails) {
226
- return;
227
- }
228
- var VCParts = Object.keys(entry.vcDetails);
229
- performance.measure("VC90 (".concat(entry.revision, ")"), {
230
- start: start,
231
- duration: (_entry$vcDetails = entry.vcDetails) === null || _entry$vcDetails === void 0 || (_entry$vcDetails = _entry$vcDetails['90']) === null || _entry$vcDetails === void 0 ? void 0 : _entry$vcDetails.t,
232
- detail: {
233
- devtools: {
234
- track: "main metrics",
235
- trackGroup: '🛸 reactUFO metrics',
236
- color: 'tertiary'
237
- }
238
- }
239
- });
240
- VCParts.forEach(function (key) {
241
- var _entry$vcDetails2;
242
- var duration = (_entry$vcDetails2 = entry.vcDetails) === null || _entry$vcDetails2 === void 0 ? void 0 : _entry$vcDetails2[key].t;
243
- if (typeof duration !== 'number') {
244
- return;
245
- }
246
- performance.measure("VC".concat(key), {
247
- start: start,
248
- duration: duration,
249
- detail: {
250
- devtools: {
251
- track: "VC ".concat(entry.revision),
252
- trackGroup: '🛸 reactUFO metrics',
253
- color: key === '90' ? 'tertiary' : 'primary-light'
254
- }
255
- }
256
- });
257
- });
258
- });
259
- } catch (error) {}
260
- }
261
217
  }]);
262
218
  }(); // Some products set this variable to indicate it is running in SSR
263
219
  var isServer = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__SERVER__);
@@ -21,6 +21,7 @@ import { roundEpsilon } from '../round-number';
21
21
  import * as ssr from '../ssr';
22
22
  import { buildSegmentTree, labelStackStartWith, optimizeLabelStack, sanitizeUfoName, stringifyLabelStackFully } from './common/utils';
23
23
  import { createCriticalMetricsPayloads } from './critical-metrics-payload';
24
+ import { addPerformanceMeasures } from './utils/add-performance-measures';
24
25
  import { getBrowserMetadataToLegacyFormat } from './utils/get-browser-metadata';
25
26
  import getInteractionStatus from './utils/get-interaction-status';
26
27
  import { getNavigationMetricsToLegacyFormat } from './utils/get-navigation-metrics';
@@ -186,7 +187,7 @@ function getPPSMetrics(interaction) {
186
187
  function getSSRProperties(type) {
187
188
  const ssrPhases = getSSRPhaseSuccess(type);
188
189
  return {
189
- 'ssr:success': getSSRSuccessUtil(type),
190
+ 'ssr:success': (ssrPhases === null || ssrPhases === void 0 ? void 0 : ssrPhases.done) != null ? ssrPhases.done : getSSRSuccessUtil(type),
190
191
  'ssr:featureFlags': getSSRFeatureFlags(type),
191
192
  ...((ssrPhases === null || ssrPhases === void 0 ? void 0 : ssrPhases.earlyFlush) != null ? {
192
193
  'ssr:earlyflush:success': ssrPhases.earlyFlush
@@ -622,10 +623,24 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
622
623
  const SSRDoneTime = SSRDoneTimeValue !== undefined ? {
623
624
  SSRDoneTime: Math.round(SSRDoneTimeValue)
624
625
  } : {};
626
+ const isBM3ConfigSSRDoneAsFmp = interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp;
627
+ const isUFOConfigSSRDoneAsFmp = interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp || !!(config !== null && config !== void 0 && (_config$ssr = config.ssr) !== null && _config$ssr !== void 0 && _config$ssr.getSSRDoneTime);
628
+ if (!experimental && (isBM3ConfigSSRDoneAsFmp || isUFOConfigSSRDoneAsFmp) && SSRDoneTimeValue !== undefined && fg('ufo_chrome_devtools_uplift')) {
629
+ try {
630
+ performance.mark(`FMP`, {
631
+ startTime: SSRDoneTimeValue,
632
+ detail: {
633
+ devtools: {
634
+ dataType: 'marker'
635
+ }
636
+ }
637
+ });
638
+ } catch (e) {}
639
+ }
625
640
  return {
626
641
  ...SSRDoneTime,
627
- isBM3ConfigSSRDoneAsFmp: interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp,
628
- isUFOConfigSSRDoneAsFmp: interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp || !!(config !== null && config !== void 0 && (_config$ssr = config.ssr) !== null && _config$ssr !== void 0 && _config$ssr.getSSRDoneTime)
642
+ isBM3ConfigSSRDoneAsFmp,
643
+ isUFOConfigSSRDoneAsFmp
629
644
  };
630
645
  };
631
646
  const pageLoadInteractionMetrics = getInitialPageLoadSSRMetrics();
@@ -675,6 +690,9 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
675
690
  const newUFOName = sanitizeUfoName(ufoName);
676
691
  const resourceTimings = getResourceTimings(start, end);
677
692
  const [finalVCMetrics, experimentalMetrics, paintMetrics] = await Promise.all([vcMetrics || (await getVCMetrics(interaction)), experimental ? getExperimentalVCMetrics(interaction) : Promise.resolve(undefined), getPaintMetricsToLegacyFormat(type, end)]);
693
+ if (!experimental) {
694
+ fg('ufo_chrome_devtools_uplift') && addPerformanceMeasures(interaction.start, [...((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || [])]);
695
+ }
678
696
  const payload = {
679
697
  actionSubject: 'experience',
680
698
  action: 'measured',
@@ -0,0 +1,54 @@
1
+ export const addPerformanceMeasures = (start, measures) => {
2
+ try {
3
+ measures.sort((a, b) => b.revision.localeCompare(a.revision)).slice(0, 2).forEach(entry => {
4
+ var _entry$vcDetails, _entry$vcDetails$;
5
+ if (((_entry$vcDetails = entry.vcDetails) === null || _entry$vcDetails === void 0 ? void 0 : (_entry$vcDetails$ = _entry$vcDetails['90']) === null || _entry$vcDetails$ === void 0 ? void 0 : _entry$vcDetails$.t) !== undefined) {
6
+ var _entry$vcDetails2, _entry$vcDetails2$;
7
+ performance.mark(`VC90 (${entry.revision})`, {
8
+ startTime: start + ((_entry$vcDetails2 = entry.vcDetails) === null || _entry$vcDetails2 === void 0 ? void 0 : (_entry$vcDetails2$ = _entry$vcDetails2['90']) === null || _entry$vcDetails2$ === void 0 ? void 0 : _entry$vcDetails2$.t),
9
+ detail: {
10
+ devtools: {
11
+ dataType: 'marker'
12
+ }
13
+ }
14
+ });
15
+ }
16
+ });
17
+ measures.forEach(entry => {
18
+ var _entry$vcDetails3, _entry$vcDetails3$;
19
+ if (!entry || !entry.vcDetails) {
20
+ return;
21
+ }
22
+ const VCParts = Object.keys(entry.vcDetails);
23
+ performance.measure(`VC90 (${entry.revision})`, {
24
+ start,
25
+ duration: (_entry$vcDetails3 = entry.vcDetails) === null || _entry$vcDetails3 === void 0 ? void 0 : (_entry$vcDetails3$ = _entry$vcDetails3['90']) === null || _entry$vcDetails3$ === void 0 ? void 0 : _entry$vcDetails3$.t,
26
+ detail: {
27
+ devtools: {
28
+ track: `main metrics`,
29
+ trackGroup: '🛸 reactUFO metrics',
30
+ color: 'tertiary'
31
+ }
32
+ }
33
+ });
34
+ VCParts.forEach(key => {
35
+ var _entry$vcDetails4;
36
+ const duration = (_entry$vcDetails4 = entry.vcDetails) === null || _entry$vcDetails4 === void 0 ? void 0 : _entry$vcDetails4[key].t;
37
+ if (typeof duration !== 'number') {
38
+ return;
39
+ }
40
+ performance.measure(`VC${key}`, {
41
+ start,
42
+ duration,
43
+ detail: {
44
+ devtools: {
45
+ track: `VC ${entry.revision}`,
46
+ trackGroup: '🛸 reactUFO metrics',
47
+ color: key === '90' ? 'tertiary' : 'primary-light'
48
+ }
49
+ }
50
+ });
51
+ });
52
+ });
53
+ } catch (error) {}
54
+ };
@@ -3,6 +3,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import coinflip from '../coinflip';
4
4
  import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate } from '../config';
5
5
  import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
6
+ import { sanitizeUfoName } from '../create-payload/common/utils';
6
7
  import { clearActiveTrace } from '../experience-trace-id-context';
7
8
  import { allFeatureFlagsAccessed, currentFeatureFlagsAccessed } from '../feature-flags-accessed';
8
9
  import { getInteractionId } from '../interaction-id-context';
@@ -538,6 +539,7 @@ function finishInteraction(id, data, endTime = performance.now()) {
538
539
  data.end = endTime;
539
540
  try {
540
541
  // for Firefox 102 and older
542
+
541
543
  if (fg('ufo_chrome_devtools_uplift')) {
542
544
  performance.measure(`🛸 [${data.type}] ${data.ufoName} [ttai]`, {
543
545
  start: data.start,
@@ -550,6 +552,14 @@ function finishInteraction(id, data, endTime = performance.now()) {
550
552
  }
551
553
  }
552
554
  });
555
+ performance.mark(`TTAI`, {
556
+ startTime: data.end,
557
+ detail: {
558
+ devtools: {
559
+ dataType: 'marker'
560
+ }
561
+ }
562
+ });
553
563
  } else {
554
564
  performance.measure(`🛸 [${data.type}] ${data.ufoName} [ttai]`, {
555
565
  start: data.start,
@@ -571,6 +581,18 @@ function finishInteraction(id, data, endTime = performance.now()) {
571
581
  data.vc = observer.getVCRawData();
572
582
  }
573
583
  }
584
+
585
+ // By this time, stop the post interaction log observer if coinflip rate is 0
586
+ if (fg('platform_ufo_post_interaction_check_name')) {
587
+ const sanitisedUfoName = sanitizeUfoName(data.ufoName);
588
+ if (!coinflip(getPostInteractionRate(sanitisedUfoName, data.type))) {
589
+ postInteractionLog.stopVCObserver();
590
+ }
591
+ } else {
592
+ if (!coinflip(getPostInteractionRate(data.routeName || data.ufoName, data.type))) {
593
+ postInteractionLog.stopVCObserver();
594
+ }
595
+ }
574
596
  if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5$experimen = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5$experimen !== void 0 && _getConfig5$experimen.enabled)) {
575
597
  remove(id);
576
598
  }
@@ -750,8 +772,12 @@ export function addOnCancelCallback(id, cancelCallback) {
750
772
  interaction === null || interaction === void 0 ? void 0 : interaction.cancelCallbacks.push(cancelCallback);
751
773
  }
752
774
  export function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName, trace = null) {
753
- if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
775
+ if (fg('platform_ufo_post_interaction_check_name')) {
754
776
  postInteractionLog.reset();
777
+ } else {
778
+ if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
779
+ postInteractionLog.reset();
780
+ }
755
781
  }
756
782
  let vcObserver;
757
783
  let previousTime = startTime;
@@ -870,10 +896,21 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
870
896
  experienceKey: ufoName
871
897
  });
872
898
  }
873
- if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
874
- postInteractionLog.startVCObserver({
875
- startTime
876
- });
899
+ if (fg('platform_ufo_post_interaction_check_name')) {
900
+ var _getConfig0, _getConfig0$postInter;
901
+ // Start post interaction observer for all if config is enabled
902
+ // in case ufoName is updated at later time
903
+ if ((_getConfig0 = getConfig()) !== null && _getConfig0 !== void 0 && (_getConfig0$postInter = _getConfig0.postInteractionLog) !== null && _getConfig0$postInter !== void 0 && _getConfig0$postInter.enabled) {
904
+ postInteractionLog.startVCObserver({
905
+ startTime
906
+ });
907
+ }
908
+ } else {
909
+ if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
910
+ postInteractionLog.startVCObserver({
911
+ startTime
912
+ });
913
+ }
877
914
  }
878
915
  if (coinflip(getExperimentalInteractionRate(ufoName, type))) {
879
916
  experimentalVC.start({
@@ -921,6 +958,14 @@ export function addApdexToAll(apdex) {
921
958
  }
922
959
  }
923
960
  });
961
+ performance.mark(`[bm3] TTI`, {
962
+ startTime: apdex.stopTime,
963
+ detail: {
964
+ devtools: {
965
+ dataType: 'marker'
966
+ }
967
+ }
968
+ });
924
969
  } else {
925
970
  var _apdex$startTime2;
926
971
  performance.measure(`🛸 ${apdex.key} [bm3_tti]`, {
@@ -955,6 +1000,14 @@ export function addApdex(interactionId, apdexInfo) {
955
1000
  }
956
1001
  }
957
1002
  });
1003
+ performance.mark(`[bm3] TTI`, {
1004
+ startTime: apdexInfo.stopTime,
1005
+ detail: {
1006
+ devtools: {
1007
+ dataType: 'marker'
1008
+ }
1009
+ }
1010
+ });
958
1011
  } else {
959
1012
  var _apdexInfo$startTime2;
960
1013
  performance.measure(`🛸 ${apdexInfo.key} [bm3_tti]`, {
@@ -88,13 +88,14 @@ export default class PostInteractionLog {
88
88
  * Send the log if there is data
89
89
  */
90
90
  async sendPostInteractionLog() {
91
- var _this$vcObserver4, _this$vcObserver5;
91
+ var _this$vcObserver4, _config$vc, _config$vc2, _this$vcObserver5;
92
92
  if (!this.hasData() || !this.lastInteractionFinish || !this.sinkHandlerFn) {
93
93
  var _this$vcObserver3;
94
94
  this.reset();
95
95
  (_this$vcObserver3 = this.vcObserver) === null || _this$vcObserver3 === void 0 ? void 0 : _this$vcObserver3.stop();
96
96
  return;
97
97
  }
98
+ const config = getConfig();
98
99
  const postInteractionFinishVCResult = await ((_this$vcObserver4 = this.vcObserver) === null || _this$vcObserver4 === void 0 ? void 0 : _this$vcObserver4.getVCResult({
99
100
  start: this.lastInteractionFinish.start,
100
101
  stop: performance.now(),
@@ -102,8 +103,11 @@ export default class PostInteractionLog {
102
103
  // no need for TTI value here
103
104
  isEventAborted: !!this.lastInteractionFinish.abortReason,
104
105
  prefix: 'ufo',
105
- ...this.vcObserverSSRConfig,
106
- experienceKey: this.lastInteractionFinish.ufoName
106
+ experienceKey: this.lastInteractionFinish.ufoName,
107
+ interactionId: this.lastInteractionFinish.id,
108
+ includeSSRInV3: config === null || config === void 0 ? void 0 : (_config$vc = config.vc) === null || _config$vc === void 0 ? void 0 : _config$vc.includeSSRInV3,
109
+ includeSSRRatio: config === null || config === void 0 ? void 0 : (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRRatio,
110
+ ...this.vcObserverSSRConfig
107
111
  }));
108
112
  (_this$vcObserver5 = this.vcObserver) === null || _this$vcObserver5 === void 0 ? void 0 : _this$vcObserver5.stop();
109
113
  this.sinkHandlerFn({
@@ -1,5 +1,4 @@
1
1
  var _process, _process$env;
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { isVCRevisionEnabled } from '../config';
4
3
  import { VCObserverNOOP } from './no-op-vc-observer';
5
4
  import { VCObserver } from './vc-observer';
@@ -112,7 +111,6 @@ export class VCObserverWrapper {
112
111
  interactionId: param.interactionId,
113
112
  ssr: param.includeSSRInV3 ? param.ssr : undefined
114
113
  })) : [];
115
- fg('ufo_chrome_devtools_uplift') && this.addPerformanceMeasures(param.start, [...((v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) || []), ...(v3Result !== null && v3Result !== void 0 ? v3Result : [])]);
116
114
  if (!v3Result) {
117
115
  return v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {};
118
116
  }
@@ -139,46 +137,6 @@ export class VCObserverWrapper {
139
137
  collectSSRPlaceholders() {
140
138
  this.ssrPlaceholderHandler.collectExistingPlaceholders();
141
139
  }
142
- addPerformanceMeasures(start, measures) {
143
- try {
144
- measures.forEach(entry => {
145
- var _entry$vcDetails, _entry$vcDetails$;
146
- if (!entry || !entry.vcDetails) {
147
- return;
148
- }
149
- const VCParts = Object.keys(entry.vcDetails);
150
- performance.measure(`VC90 (${entry.revision})`, {
151
- start,
152
- duration: (_entry$vcDetails = entry.vcDetails) === null || _entry$vcDetails === void 0 ? void 0 : (_entry$vcDetails$ = _entry$vcDetails['90']) === null || _entry$vcDetails$ === void 0 ? void 0 : _entry$vcDetails$.t,
153
- detail: {
154
- devtools: {
155
- track: `main metrics`,
156
- trackGroup: '🛸 reactUFO metrics',
157
- color: 'tertiary'
158
- }
159
- }
160
- });
161
- VCParts.forEach(key => {
162
- var _entry$vcDetails2;
163
- const duration = (_entry$vcDetails2 = entry.vcDetails) === null || _entry$vcDetails2 === void 0 ? void 0 : _entry$vcDetails2[key].t;
164
- if (typeof duration !== 'number') {
165
- return;
166
- }
167
- performance.measure(`VC${key}`, {
168
- start,
169
- duration,
170
- detail: {
171
- devtools: {
172
- track: `VC ${entry.revision}`,
173
- trackGroup: '🛸 reactUFO metrics',
174
- color: key === '90' ? 'tertiary' : 'primary-light'
175
- }
176
- }
177
- });
178
- });
179
- });
180
- } catch (error) {}
181
- }
182
140
  }
183
141
 
184
142
  // Some products set this variable to indicate it is running in SSR
@@ -33,6 +33,7 @@ import { roundEpsilon } from '../round-number';
33
33
  import * as ssr from '../ssr';
34
34
  import { buildSegmentTree, labelStackStartWith, optimizeLabelStack, sanitizeUfoName, stringifyLabelStackFully } from './common/utils';
35
35
  import { createCriticalMetricsPayloads } from './critical-metrics-payload';
36
+ import { addPerformanceMeasures } from './utils/add-performance-measures';
36
37
  import { getBrowserMetadataToLegacyFormat } from './utils/get-browser-metadata';
37
38
  import getInteractionStatus from './utils/get-interaction-status';
38
39
  import { getNavigationMetricsToLegacyFormat } from './utils/get-navigation-metrics';
@@ -194,7 +195,7 @@ function getPPSMetrics(interaction) {
194
195
  function getSSRProperties(type) {
195
196
  var ssrPhases = getSSRPhaseSuccess(type);
196
197
  return _objectSpread(_objectSpread({
197
- 'ssr:success': getSSRSuccessUtil(type),
198
+ 'ssr:success': (ssrPhases === null || ssrPhases === void 0 ? void 0 : ssrPhases.done) != null ? ssrPhases.done : getSSRSuccessUtil(type),
198
199
  'ssr:featureFlags': getSSRFeatureFlags(type)
199
200
  }, (ssrPhases === null || ssrPhases === void 0 ? void 0 : ssrPhases.earlyFlush) != null ? {
200
201
  'ssr:earlyflush:success': ssrPhases.earlyFlush
@@ -612,9 +613,23 @@ function _createInteractionMetricsPayload() {
612
613
  var SSRDoneTime = SSRDoneTimeValue !== undefined ? {
613
614
  SSRDoneTime: Math.round(SSRDoneTimeValue)
614
615
  } : {};
616
+ var isBM3ConfigSSRDoneAsFmp = interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp;
617
+ var isUFOConfigSSRDoneAsFmp = interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp || !!(config !== null && config !== void 0 && (_config$ssr = config.ssr) !== null && _config$ssr !== void 0 && _config$ssr.getSSRDoneTime);
618
+ if (!experimental && (isBM3ConfigSSRDoneAsFmp || isUFOConfigSSRDoneAsFmp) && SSRDoneTimeValue !== undefined && fg('ufo_chrome_devtools_uplift')) {
619
+ try {
620
+ performance.mark("FMP", {
621
+ startTime: SSRDoneTimeValue,
622
+ detail: {
623
+ devtools: {
624
+ dataType: 'marker'
625
+ }
626
+ }
627
+ });
628
+ } catch (e) {}
629
+ }
615
630
  return _objectSpread(_objectSpread({}, SSRDoneTime), {}, {
616
- isBM3ConfigSSRDoneAsFmp: interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp,
617
- isUFOConfigSSRDoneAsFmp: interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp || !!(config !== null && config !== void 0 && (_config$ssr = config.ssr) !== null && _config$ssr !== void 0 && _config$ssr.getSSRDoneTime)
631
+ isBM3ConfigSSRDoneAsFmp: isBM3ConfigSSRDoneAsFmp,
632
+ isUFOConfigSSRDoneAsFmp: isUFOConfigSSRDoneAsFmp
618
633
  });
619
634
  };
620
635
  pageLoadInteractionMetrics = getInitialPageLoadSSRMetrics(); // Detailed payload. Page visibility = visible
@@ -683,6 +698,9 @@ function _createInteractionMetricsPayload() {
683
698
  finalVCMetrics = _yield$Promise$all2[0];
684
699
  experimentalMetrics = _yield$Promise$all2[1];
685
700
  paintMetrics = _yield$Promise$all2[2];
701
+ if (!experimental) {
702
+ fg('ufo_chrome_devtools_uplift') && addPerformanceMeasures(interaction.start, _toConsumableArray((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || []));
703
+ }
686
704
  payload = {
687
705
  actionSubject: 'experience',
688
706
  action: 'measured',
@@ -761,7 +779,7 @@ function _createInteractionMetricsPayload() {
761
779
  }
762
780
  payload.attributes.properties['event:sizeInKb'] = getPayloadSize(payload.attributes.properties);
763
781
  return _context.abrupt("return", payload);
764
- case 43:
782
+ case 44:
765
783
  case "end":
766
784
  return _context.stop();
767
785
  }
@@ -0,0 +1,56 @@
1
+ export var addPerformanceMeasures = function addPerformanceMeasures(start, measures) {
2
+ try {
3
+ measures.sort(function (a, b) {
4
+ return b.revision.localeCompare(a.revision);
5
+ }).slice(0, 2).forEach(function (entry) {
6
+ var _entry$vcDetails;
7
+ if (((_entry$vcDetails = entry.vcDetails) === null || _entry$vcDetails === void 0 || (_entry$vcDetails = _entry$vcDetails['90']) === null || _entry$vcDetails === void 0 ? void 0 : _entry$vcDetails.t) !== undefined) {
8
+ var _entry$vcDetails2;
9
+ performance.mark("VC90 (".concat(entry.revision, ")"), {
10
+ startTime: start + ((_entry$vcDetails2 = entry.vcDetails) === null || _entry$vcDetails2 === void 0 || (_entry$vcDetails2 = _entry$vcDetails2['90']) === null || _entry$vcDetails2 === void 0 ? void 0 : _entry$vcDetails2.t),
11
+ detail: {
12
+ devtools: {
13
+ dataType: 'marker'
14
+ }
15
+ }
16
+ });
17
+ }
18
+ });
19
+ measures.forEach(function (entry) {
20
+ var _entry$vcDetails3;
21
+ if (!entry || !entry.vcDetails) {
22
+ return;
23
+ }
24
+ var VCParts = Object.keys(entry.vcDetails);
25
+ performance.measure("VC90 (".concat(entry.revision, ")"), {
26
+ start: start,
27
+ duration: (_entry$vcDetails3 = entry.vcDetails) === null || _entry$vcDetails3 === void 0 || (_entry$vcDetails3 = _entry$vcDetails3['90']) === null || _entry$vcDetails3 === void 0 ? void 0 : _entry$vcDetails3.t,
28
+ detail: {
29
+ devtools: {
30
+ track: "main metrics",
31
+ trackGroup: '🛸 reactUFO metrics',
32
+ color: 'tertiary'
33
+ }
34
+ }
35
+ });
36
+ VCParts.forEach(function (key) {
37
+ var _entry$vcDetails4;
38
+ var duration = (_entry$vcDetails4 = entry.vcDetails) === null || _entry$vcDetails4 === void 0 ? void 0 : _entry$vcDetails4[key].t;
39
+ if (typeof duration !== 'number') {
40
+ return;
41
+ }
42
+ performance.measure("VC".concat(key), {
43
+ start: start,
44
+ duration: duration,
45
+ detail: {
46
+ devtools: {
47
+ track: "VC ".concat(entry.revision),
48
+ trackGroup: '🛸 reactUFO metrics',
49
+ color: key === '90' ? 'tertiary' : 'primary-light'
50
+ }
51
+ }
52
+ });
53
+ });
54
+ });
55
+ } catch (error) {}
56
+ };
@@ -13,6 +13,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
13
13
  import coinflip from '../coinflip';
14
14
  import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate } from '../config';
15
15
  import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
16
+ import { sanitizeUfoName } from '../create-payload/common/utils';
16
17
  import { clearActiveTrace } from '../experience-trace-id-context';
17
18
  import { allFeatureFlagsAccessed, currentFeatureFlagsAccessed } from '../feature-flags-accessed';
18
19
  import { getInteractionId } from '../interaction-id-context';
@@ -574,6 +575,7 @@ function finishInteraction(id, data) {
574
575
  data.end = endTime;
575
576
  try {
576
577
  // for Firefox 102 and older
578
+
577
579
  if (fg('ufo_chrome_devtools_uplift')) {
578
580
  performance.measure("\uD83D\uDEF8 [".concat(data.type, "] ").concat(data.ufoName, " [ttai]"), {
579
581
  start: data.start,
@@ -586,6 +588,14 @@ function finishInteraction(id, data) {
586
588
  }
587
589
  }
588
590
  });
591
+ performance.mark("TTAI", {
592
+ startTime: data.end,
593
+ detail: {
594
+ devtools: {
595
+ dataType: 'marker'
596
+ }
597
+ }
598
+ });
589
599
  } else {
590
600
  performance.measure("\uD83D\uDEF8 [".concat(data.type, "] ").concat(data.ufoName, " [ttai]"), {
591
601
  start: data.start,
@@ -607,6 +617,18 @@ function finishInteraction(id, data) {
607
617
  data.vc = observer.getVCRawData();
608
618
  }
609
619
  }
620
+
621
+ // By this time, stop the post interaction log observer if coinflip rate is 0
622
+ if (fg('platform_ufo_post_interaction_check_name')) {
623
+ var sanitisedUfoName = sanitizeUfoName(data.ufoName);
624
+ if (!coinflip(getPostInteractionRate(sanitisedUfoName, data.type))) {
625
+ postInteractionLog.stopVCObserver();
626
+ }
627
+ } else {
628
+ if (!coinflip(getPostInteractionRate(data.routeName || data.ufoName, data.type))) {
629
+ postInteractionLog.stopVCObserver();
630
+ }
631
+ }
610
632
  if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
611
633
  remove(id);
612
634
  }
@@ -829,8 +851,12 @@ export function addOnCancelCallback(id, cancelCallback) {
829
851
  }
830
852
  export function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName) {
831
853
  var trace = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
832
- if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
854
+ if (fg('platform_ufo_post_interaction_check_name')) {
833
855
  postInteractionLog.reset();
856
+ } else {
857
+ if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
858
+ postInteractionLog.reset();
859
+ }
834
860
  }
835
861
  var vcObserver;
836
862
  var previousTime = startTime;
@@ -949,10 +975,21 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
949
975
  experienceKey: ufoName
950
976
  });
951
977
  }
952
- if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
953
- postInteractionLog.startVCObserver({
954
- startTime: startTime
955
- });
978
+ if (fg('platform_ufo_post_interaction_check_name')) {
979
+ var _getConfig0;
980
+ // Start post interaction observer for all if config is enabled
981
+ // in case ufoName is updated at later time
982
+ if ((_getConfig0 = getConfig()) !== null && _getConfig0 !== void 0 && (_getConfig0 = _getConfig0.postInteractionLog) !== null && _getConfig0 !== void 0 && _getConfig0.enabled) {
983
+ postInteractionLog.startVCObserver({
984
+ startTime: startTime
985
+ });
986
+ }
987
+ } else {
988
+ if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
989
+ postInteractionLog.startVCObserver({
990
+ startTime: startTime
991
+ });
992
+ }
956
993
  }
957
994
  if (coinflip(getExperimentalInteractionRate(ufoName, type))) {
958
995
  experimentalVC.start({
@@ -1000,6 +1037,14 @@ export function addApdexToAll(apdex) {
1000
1037
  }
1001
1038
  }
1002
1039
  });
1040
+ performance.mark("[bm3] TTI", {
1041
+ startTime: apdex.stopTime,
1042
+ detail: {
1043
+ devtools: {
1044
+ dataType: 'marker'
1045
+ }
1046
+ }
1047
+ });
1003
1048
  } else {
1004
1049
  var _apdex$startTime2;
1005
1050
  performance.measure("\uD83D\uDEF8 ".concat(apdex.key, " [bm3_tti]"), {
@@ -1034,6 +1079,14 @@ export function addApdex(interactionId, apdexInfo) {
1034
1079
  }
1035
1080
  }
1036
1081
  });
1082
+ performance.mark("[bm3] TTI", {
1083
+ startTime: apdexInfo.stopTime,
1084
+ detail: {
1085
+ devtools: {
1086
+ dataType: 'marker'
1087
+ }
1088
+ }
1089
+ });
1037
1090
  } else {
1038
1091
  var _apdexInfo$startTime2;
1039
1092
  performance.measure("\uD83D\uDEF8 ".concat(apdexInfo.key, " [bm3_tti]"), {
@@ -113,8 +113,8 @@ var PostInteractionLog = /*#__PURE__*/function () {
113
113
  key: "sendPostInteractionLog",
114
114
  value: (function () {
115
115
  var _sendPostInteractionLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
116
- var _this$vcObserver4, _this$vcObserver5;
117
- var _this$vcObserver3, postInteractionFinishVCResult;
116
+ var _this$vcObserver4, _config$vc, _config$vc2, _this$vcObserver5;
117
+ var _this$vcObserver3, config, postInteractionFinishVCResult;
118
118
  return _regeneratorRuntime.wrap(function _callee$(_context) {
119
119
  while (1) switch (_context.prev = _context.next) {
120
120
  case 0:
@@ -126,18 +126,21 @@ var PostInteractionLog = /*#__PURE__*/function () {
126
126
  (_this$vcObserver3 = this.vcObserver) === null || _this$vcObserver3 === void 0 || _this$vcObserver3.stop();
127
127
  return _context.abrupt("return");
128
128
  case 4:
129
- _context.next = 6;
130
- return (_this$vcObserver4 = this.vcObserver) === null || _this$vcObserver4 === void 0 ? void 0 : _this$vcObserver4.getVCResult(_objectSpread(_objectSpread({
129
+ config = getConfig();
130
+ _context.next = 7;
131
+ return (_this$vcObserver4 = this.vcObserver) === null || _this$vcObserver4 === void 0 ? void 0 : _this$vcObserver4.getVCResult(_objectSpread({
131
132
  start: this.lastInteractionFinish.start,
132
133
  stop: performance.now(),
133
134
  tti: -1,
134
135
  // no need for TTI value here
135
136
  isEventAborted: !!this.lastInteractionFinish.abortReason,
136
- prefix: 'ufo'
137
- }, this.vcObserverSSRConfig), {}, {
138
- experienceKey: this.lastInteractionFinish.ufoName
139
- }));
140
- case 6:
137
+ prefix: 'ufo',
138
+ experienceKey: this.lastInteractionFinish.ufoName,
139
+ interactionId: this.lastInteractionFinish.id,
140
+ includeSSRInV3: config === null || config === void 0 || (_config$vc = config.vc) === null || _config$vc === void 0 ? void 0 : _config$vc.includeSSRInV3,
141
+ includeSSRRatio: config === null || config === void 0 || (_config$vc2 = config.vc) === null || _config$vc2 === void 0 ? void 0 : _config$vc2.includeSSRRatio
142
+ }, this.vcObserverSSRConfig));
143
+ case 7:
141
144
  postInteractionFinishVCResult = _context.sent;
142
145
  (_this$vcObserver5 = this.vcObserver) === null || _this$vcObserver5 === void 0 || _this$vcObserver5.stop();
143
146
  this.sinkHandlerFn({
@@ -147,7 +150,7 @@ var PostInteractionLog = /*#__PURE__*/function () {
147
150
  lastInteractionFinishVCResult: this.lastInteractionFinishVCResult
148
151
  });
149
152
  this.reset();
150
- case 10:
153
+ case 11:
151
154
  case "end":
152
155
  return _context.stop();
153
156
  }
@@ -7,7 +7,6 @@ var _process;
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  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; }
9
9
  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) { _defineProperty(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; }
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { isVCRevisionEnabled } from '../config';
12
11
  import { VCObserverNOOP } from './no-op-vc-observer';
13
12
  import { VCObserver } from './vc-observer';
@@ -159,17 +158,16 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
159
158
  _context.t1 = [];
160
159
  case 16:
161
160
  v3Result = _context.t1;
162
- fg('ufo_chrome_devtools_uplift') && this.addPerformanceMeasures(param.start, [].concat(_toConsumableArray((v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) || []), _toConsumableArray(v3Result !== null && v3Result !== void 0 ? v3Result : [])));
163
161
  if (v3Result) {
164
- _context.next = 20;
162
+ _context.next = 19;
165
163
  break;
166
164
  }
167
165
  return _context.abrupt("return", v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {});
168
- case 20:
166
+ case 19:
169
167
  return _context.abrupt("return", _objectSpread(_objectSpread({}, v1v2Result), {}, {
170
168
  '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
169
  }));
172
- case 21:
170
+ case 20:
173
171
  case "end":
174
172
  return _context.stop();
175
173
  }
@@ -206,48 +204,6 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
206
204
  value: function collectSSRPlaceholders() {
207
205
  this.ssrPlaceholderHandler.collectExistingPlaceholders();
208
206
  }
209
- }, {
210
- key: "addPerformanceMeasures",
211
- value: function addPerformanceMeasures(start, measures) {
212
- try {
213
- measures.forEach(function (entry) {
214
- var _entry$vcDetails;
215
- if (!entry || !entry.vcDetails) {
216
- return;
217
- }
218
- var VCParts = Object.keys(entry.vcDetails);
219
- performance.measure("VC90 (".concat(entry.revision, ")"), {
220
- start: start,
221
- duration: (_entry$vcDetails = entry.vcDetails) === null || _entry$vcDetails === void 0 || (_entry$vcDetails = _entry$vcDetails['90']) === null || _entry$vcDetails === void 0 ? void 0 : _entry$vcDetails.t,
222
- detail: {
223
- devtools: {
224
- track: "main metrics",
225
- trackGroup: '🛸 reactUFO metrics',
226
- color: 'tertiary'
227
- }
228
- }
229
- });
230
- VCParts.forEach(function (key) {
231
- var _entry$vcDetails2;
232
- var duration = (_entry$vcDetails2 = entry.vcDetails) === null || _entry$vcDetails2 === void 0 ? void 0 : _entry$vcDetails2[key].t;
233
- if (typeof duration !== 'number') {
234
- return;
235
- }
236
- performance.measure("VC".concat(key), {
237
- start: start,
238
- duration: duration,
239
- detail: {
240
- devtools: {
241
- track: "VC ".concat(entry.revision),
242
- trackGroup: '🛸 reactUFO metrics',
243
- color: key === '90' ? 'tertiary' : 'primary-light'
244
- }
245
- }
246
- });
247
- });
248
- });
249
- } catch (error) {}
250
- }
251
207
  }]);
252
208
  }();
253
209
 
@@ -0,0 +1,2 @@
1
+ import type { RevisionPayload } from '../../common/vc/types';
2
+ export declare const addPerformanceMeasures: (start: number, measures: RevisionPayload) => void;
@@ -12,7 +12,8 @@ export type SSRFeatureFlags = {
12
12
  };
13
13
  export type SSRConfig = {
14
14
  /**
15
- * Used to represent whether SSR as a whole was considered successful. You can consider this the success of the "render" phase success
15
+ * Used to represent whether SSR as a whole was considered successful. You can consider this the success of the "render" phase success.
16
+ * Also may be used as the FMP mark
16
17
  */
17
18
  getDoneMark: () => number | null;
18
19
  /**
@@ -31,6 +32,10 @@ export type SSRConfig = {
31
32
  * This is generally expected to be earlier than / independant of the prefetch data and may even be non-visual (eg: <link rel="preload" href="..."> tags).
32
33
  */
33
34
  earlyFlush?: boolean;
35
+ /**
36
+ * "done" if present can override the presence / absence of the done mark in the overral SSR success status ('ssr:success').
37
+ */
38
+ done?: boolean;
34
39
  };
35
40
  getFeatureFlags: () => SSRFeatureFlags | null;
36
41
  getTimings?: () => ReportedTimings | null;
@@ -41,6 +46,7 @@ export declare function getSSRSuccess(): boolean;
41
46
  export declare function getSSRPhaseSuccess(): {
42
47
  prefetch?: boolean;
43
48
  earlyFlush?: boolean;
49
+ done?: boolean;
44
50
  } | undefined;
45
51
  export declare function getSSRDoneTime(): number | undefined;
46
52
  export declare function getSSRFeatureFlags(): SSRFeatureFlags | undefined;
@@ -21,7 +21,6 @@ export declare class VCObserverWrapper implements VCObserverInterface {
21
21
  setReactRootRenderStart(startTime: number): void;
22
22
  setReactRootRenderStop(stopTime: number): void;
23
23
  collectSSRPlaceholders(): void;
24
- private addPerformanceMeasures;
25
24
  }
26
25
  export declare function isEnvironmentSupported(): boolean;
27
26
  export declare function getVCObserver(opts?: VCObserverOptions): VCObserverInterface;
@@ -0,0 +1,2 @@
1
+ import type { RevisionPayload } from '../../common/vc/types';
2
+ export declare const addPerformanceMeasures: (start: number, measures: RevisionPayload) => void;
@@ -12,7 +12,8 @@ export type SSRFeatureFlags = {
12
12
  };
13
13
  export type SSRConfig = {
14
14
  /**
15
- * Used to represent whether SSR as a whole was considered successful. You can consider this the success of the "render" phase success
15
+ * Used to represent whether SSR as a whole was considered successful. You can consider this the success of the "render" phase success.
16
+ * Also may be used as the FMP mark
16
17
  */
17
18
  getDoneMark: () => number | null;
18
19
  /**
@@ -31,6 +32,10 @@ export type SSRConfig = {
31
32
  * This is generally expected to be earlier than / independant of the prefetch data and may even be non-visual (eg: <link rel="preload" href="..."> tags).
32
33
  */
33
34
  earlyFlush?: boolean;
35
+ /**
36
+ * "done" if present can override the presence / absence of the done mark in the overral SSR success status ('ssr:success').
37
+ */
38
+ done?: boolean;
34
39
  };
35
40
  getFeatureFlags: () => SSRFeatureFlags | null;
36
41
  getTimings?: () => ReportedTimings | null;
@@ -41,6 +46,7 @@ export declare function getSSRSuccess(): boolean;
41
46
  export declare function getSSRPhaseSuccess(): {
42
47
  prefetch?: boolean;
43
48
  earlyFlush?: boolean;
49
+ done?: boolean;
44
50
  } | undefined;
45
51
  export declare function getSSRDoneTime(): number | undefined;
46
52
  export declare function getSSRFeatureFlags(): SSRFeatureFlags | undefined;
@@ -21,7 +21,6 @@ export declare class VCObserverWrapper implements VCObserverInterface {
21
21
  setReactRootRenderStart(startTime: number): void;
22
22
  setReactRootRenderStop(stopTime: number): void;
23
23
  collectSSRPlaceholders(): void;
24
- private addPerformanceMeasures;
25
24
  }
26
25
  export declare function isEnvironmentSupported(): boolean;
27
26
  export declare function getVCObserver(opts?: VCObserverOptions): VCObserverInterface;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.1.11",
3
+ "version": "4.1.13",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -194,6 +194,9 @@
194
194
  },
195
195
  "ufo_chrome_devtools_uplift": {
196
196
  "type": "boolean"
197
+ },
198
+ "platform_ufo_post_interaction_check_name": {
199
+ "type": "boolean"
197
200
  }
198
201
  }
199
202
  }