@atlaskit/react-ufo 4.11.2 → 4.11.3

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 (31) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/create-interaction-extra-metrics-payload/index.js +58 -11
  3. package/dist/cjs/create-payload/utils/get-vc-metrics.js +1 -0
  4. package/dist/cjs/interaction-metrics/index.js +7 -6
  5. package/dist/cjs/interaction-metrics/interaction-extra-metrics.js +17 -10
  6. package/dist/cjs/interaction-metrics-init/index.js +2 -2
  7. package/dist/cjs/segment/segment.js +3 -19
  8. package/dist/es2019/create-interaction-extra-metrics-payload/index.js +40 -5
  9. package/dist/es2019/create-payload/utils/get-vc-metrics.js +2 -1
  10. package/dist/es2019/interaction-metrics/index.js +7 -5
  11. package/dist/es2019/interaction-metrics/interaction-extra-metrics.js +14 -9
  12. package/dist/es2019/interaction-metrics-init/index.js +2 -2
  13. package/dist/es2019/segment/segment.js +2 -12
  14. package/dist/esm/create-interaction-extra-metrics-payload/index.js +58 -11
  15. package/dist/esm/create-payload/utils/get-vc-metrics.js +2 -1
  16. package/dist/esm/interaction-metrics/index.js +7 -6
  17. package/dist/esm/interaction-metrics/interaction-extra-metrics.js +17 -10
  18. package/dist/esm/interaction-metrics-init/index.js +2 -2
  19. package/dist/esm/segment/segment.js +2 -16
  20. package/dist/types/config/index.d.ts +4 -0
  21. package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +9 -1
  22. package/dist/types/interaction-metrics/interaction-extra-metrics.d.ts +6 -3
  23. package/dist/types-ts4.5/config/index.d.ts +4 -0
  24. package/dist/types-ts4.5/create-interaction-extra-metrics-payload/index.d.ts +9 -1
  25. package/dist/types-ts4.5/interaction-metrics/interaction-extra-metrics.d.ts +6 -3
  26. package/package.json +1 -1
  27. package/dist/cjs/segment/segment-highlight.js +0 -39
  28. package/dist/es2019/segment/segment-highlight.js +0 -27
  29. package/dist/esm/segment/segment-highlight.js +0 -30
  30. package/dist/types/segment/segment-highlight.d.ts +0 -6
  31. package/dist/types-ts4.5/segment/segment-highlight.d.ts +0 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.11.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`be9b699c35606`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be9b699c35606) -
8
+ deprecate UFO segment highlighting
9
+
3
10
  ## 4.11.2
4
11
 
5
12
  ### Patch Changes
@@ -31,13 +31,13 @@ var _interactionMetrics = require("../interaction-metrics");
31
31
  var _excluded = ["labelStack"];
32
32
  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; }
33
33
  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; }
34
- function createInteractionExtraLogPayload(_x, _x2) {
34
+ function createInteractionExtraLogPayload(_x, _x2, _x3, _x4) {
35
35
  return _createInteractionExtraLogPayload.apply(this, arguments);
36
36
  }
37
37
  function _createInteractionExtraLogPayload() {
38
- _createInteractionExtraLogPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interactionId, interaction) {
39
- var _getTTAI, _window$location;
40
- var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, sanitisedUfoName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveVCRevisionPayload, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
38
+ _createInteractionExtraLogPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
39
+ var _getTTAI, _lastInteractionFinis, _getTTAI2, _window$location;
40
+ var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveVCRevisionPayload, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
41
41
  return _regenerator.default.wrap(function _callee$(_context) {
42
42
  while (1) switch (_context.prev = _context.next) {
43
43
  case 0:
@@ -48,7 +48,7 @@ function _createInteractionExtraLogPayload() {
48
48
  }
49
49
  throw Error('UFO Configuration not provided');
50
50
  case 3:
51
- end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, knownSegments = interaction.knownSegments;
51
+ end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, knownSegments = interaction.knownSegments, minorInteractions = interaction.minorInteractions;
52
52
  sanitisedUfoName = (0, _utils.sanitizeUfoName)(ufoName);
53
53
  configRate = (0, _config.getExtraInteractionRate)(sanitisedUfoName, type);
54
54
  if ((0, _coinflip.default)(configRate)) {
@@ -59,7 +59,7 @@ function _createInteractionExtraLogPayload() {
59
59
  case 8:
60
60
  pageVisibilityAtTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
61
61
  isPageLoad = type === 'page_load' || type === 'transition';
62
- if (isPageLoad) {
62
+ if (!(!isPageLoad || minorInteractions !== undefined && minorInteractions.length > 0)) {
63
63
  _context.next = 12;
64
64
  break;
65
65
  }
@@ -85,6 +85,46 @@ function _createInteractionExtraLogPayload() {
85
85
  }
86
86
  return _context.abrupt("return", null);
87
87
  case 23:
88
+ if (!(!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length)) {
89
+ _context.next = 25;
90
+ break;
91
+ }
92
+ return _context.abrupt("return", null);
93
+ case 25:
94
+ normalTTAI = (_getTTAI2 = (0, _getTtai.default)(lastInteractionFinish)) !== null && _getTTAI2 !== void 0 ? _getTTAI2 : undefined;
95
+ lastInteractionFinishStart = typeof lastInteractionFinish.start === 'number' ? Math.round(lastInteractionFinish.start) : undefined;
96
+ lastInteractionFinishEnd = typeof lastInteractionFinish.end === 'number' ? Math.round(lastInteractionFinish.end) : undefined;
97
+ lastInteractionFinishVC90 = null;
98
+ lastInteractionFinishVCClean = false;
99
+ if (!lastInteractionFinishVCResult) {
100
+ _context.next = 41;
101
+ break;
102
+ }
103
+ lastInteractionFinishVCRev = lastInteractionFinishVCResult['ufo:vc:rev'];
104
+ lastInteractionFinishRevision = lastInteractionFinishVCRev === null || lastInteractionFinishVCRev === void 0 ? void 0 : lastInteractionFinishVCRev.find(function (_ref2) {
105
+ var revision = _ref2.revision;
106
+ return revision === _config.DEFAULT_TTVC_REVISION;
107
+ });
108
+ if (!(lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean)) {
109
+ _context.next = 38;
110
+ break;
111
+ }
112
+ lastInteractionFinishVCClean = true;
113
+ lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
114
+ _context.next = 39;
115
+ break;
116
+ case 38:
117
+ return _context.abrupt("return", null);
118
+ case 39:
119
+ _context.next = 42;
120
+ break;
121
+ case 41:
122
+ if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
123
+ // Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
124
+ lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
125
+ lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
126
+ }
127
+ case 42:
88
128
  // Helper function to check if labelStack contains third-party type
89
129
  isThirdParty = function isThirdParty(labelStack) {
90
130
  var _labelStack$some;
@@ -127,9 +167,9 @@ function _createInteractionExtraLogPayload() {
127
167
  getDetailedInteractionMetrics = function getDetailedInteractionMetrics() {
128
168
  var _interaction$hold3pIn;
129
169
  return {
130
- errors: filteredData.errors.map(function (_ref2) {
131
- var labelStack = _ref2.labelStack,
132
- others = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
170
+ errors: filteredData.errors.map(function (_ref3) {
171
+ var labelStack = _ref3.labelStack,
172
+ others = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
133
173
  return _objectSpread(_objectSpread({}, others), {}, {
134
174
  labelStack: labelStack && (0, _utils.optimizeLabelStack)(labelStack, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type))
135
175
  });
@@ -190,13 +230,20 @@ function _createInteractionExtraLogPayload() {
190
230
  reactProfilerTimings: (0, _optimizeReactProfilerTimings.optimizeReactProfilerTimings)(filteredData.reactProfilerTimings, start, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type)),
191
231
  customData: filteredData.customData
192
232
  }, getDetailedInteractionMetrics()),
193
- 'vc:effective:revision': _config.DEFAULT_TTVC_REVISION
233
+ 'vc:effective:revision': _config.DEFAULT_TTVC_REVISION,
234
+ lastInteractionFinish: {
235
+ start: lastInteractionFinishStart,
236
+ end: lastInteractionFinishEnd,
237
+ ttai: normalTTAI,
238
+ vc90: lastInteractionFinishVC90,
239
+ vcClean: lastInteractionFinishVCClean
240
+ }
194
241
  }
195
242
  }
196
243
  };
197
244
  payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
198
245
  return _context.abrupt("return", payload);
199
- case 32:
246
+ case 51:
200
247
  case "end":
201
248
  return _context.stop();
202
249
  }
@@ -97,6 +97,7 @@ function _getVCMetrics() {
97
97
  if (!include3p) {
98
98
  // For Post Interaction, last interaction should be without 3p
99
99
  _interactionMetrics.postInteractionLog.setLastInteractionFinishVCResult(result);
100
+ _interactionMetrics.interactionExtraMetrics.setLastInteractionFinishVCResult(result);
100
101
  }
101
102
  mostRecentVCRevision = (0, _config.getMostRecentVCRevision)(interaction.ufoName);
102
103
  mostRecentVCRevisionPayload = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
@@ -734,7 +734,8 @@ function finishInteraction(id, data) {
734
734
  PreviousInteractionLog.isAborted = data.abortReason != null;
735
735
  if (data.ufoName) {
736
736
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
737
- if (interactionExtraMetrics.finishedInteractionId !== id) {
737
+ var _interactionExtraMetr;
738
+ if (((_interactionExtraMetr = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr === void 0 ? void 0 : _interactionExtraMetr.id) !== id) {
738
739
  // If this same interaction was not already handled, handle it
739
740
  handleInteraction(id, data);
740
741
  }
@@ -819,7 +820,7 @@ function tryComplete(interactionId, endTime) {
819
820
  var postInteraction = /*#__PURE__*/function () {
820
821
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
821
822
  var _getConfig7;
822
- var _getConfig8, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _getConfig9, _getConfig0;
823
+ var _getConfig8, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _interactionExtraMetr2, _getConfig9, _getConfig0;
823
824
  return _regenerator.default.wrap(function _callee$(_context) {
824
825
  while (1) switch (_context.prev = _context.next) {
825
826
  case 0:
@@ -862,7 +863,7 @@ function tryComplete(interactionId, endTime) {
862
863
  }));
863
864
  case 17:
864
865
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
865
- if (interactionExtraMetrics.finishedInteractionId !== interactionId) {
866
+ if (((_interactionExtraMetr2 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr2 === void 0 ? void 0 : _interactionExtraMetr2.id) !== interactionId) {
866
867
  // If interactionExtraMetrics is not waiting for measuring this interaction
867
868
  if ((_getConfig9 = (0, _config.getConfig)()) !== null && _getConfig9 !== void 0 && (_getConfig9 = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9 !== void 0 && _getConfig9.enabled) {
868
869
  remove(interactionId);
@@ -885,15 +886,15 @@ function tryComplete(interactionId, endTime) {
885
886
  };
886
887
  }();
887
888
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
888
- var _interaction$hold3pAc;
889
+ var _interaction$hold3pAc, _interactionExtraMetr3;
889
890
  var noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
890
- if (noMoreActiveHolds && interactionExtraMetrics.finishedInteractionId !== interactionId) {
891
+ if (noMoreActiveHolds && ((_interactionExtraMetr3 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr3 === void 0 ? void 0 : _interactionExtraMetr3.id) !== interactionId) {
891
892
  // If it's not waiting for extra metrics to complete, finish the interaction as normal
892
893
  if (!activeSubmitted) {
893
894
  var _getConfig1, _getConfig10, _getConfig11;
894
895
  finishInteraction(interactionId, interaction, endTime);
895
896
  if ((_getConfig1 = (0, _config.getConfig)()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.extraInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
896
- interactionExtraMetrics.updateFinishedInteractionId(interactionId);
897
+ interactionExtraMetrics.updateFinishedInteraction(interaction);
897
898
  }
898
899
  if ((_getConfig10 = (0, _config.getConfig)()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10 !== void 0 && _getConfig10.enabled && interaction.ufoName === ((_getConfig11 = (0, _config.getConfig)()) === null || _getConfig11 === void 0 || (_getConfig11 = _getConfig11.extraSearchPageInteraction) === null || _getConfig11 === void 0 ? void 0 : _getConfig11.searchPageMetricName) && (0, _platformFeatureFlags.fg)('react_ufo_unified_search_ignoring_sain_metric')) {
899
900
  (0, _createExtraSearchPageInteractionPayload.onSearchPageInteractionComplete)(interactionId, interaction);
@@ -16,8 +16,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  var InteractionExtraMetrics = exports.default = /*#__PURE__*/function () {
17
17
  function InteractionExtraMetrics() {
18
18
  (0, _classCallCheck2.default)(this, InteractionExtraMetrics);
19
- // Store the finished interaction ID (as non-3p interaction)
20
- (0, _defineProperty2.default)(this, "finishedInteractionId", null);
19
+ // Store the finished interaction (as non-3p interaction)
20
+ (0, _defineProperty2.default)(this, "finishedInteraction", null);
21
21
  // independent VC observer, that observes until `custom.post-interaction-logs` event is sent
22
22
  (0, _defineProperty2.default)(this, "vcObserver", null);
23
23
  (0, _defineProperty2.default)(this, "sinkHandlerFn", function () {});
@@ -55,12 +55,17 @@ var InteractionExtraMetrics = exports.default = /*#__PURE__*/function () {
55
55
  return (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition';
56
56
  }
57
57
  }, {
58
- key: "updateFinishedInteractionId",
59
- value: function updateFinishedInteractionId(interactionId) {
60
- if (this.eligibleToMeasure(interactionId)) {
61
- this.finishedInteractionId = interactionId;
58
+ key: "updateFinishedInteraction",
59
+ value: function updateFinishedInteraction(interaction) {
60
+ if ((interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition') {
61
+ this.finishedInteraction = interaction;
62
62
  }
63
63
  }
64
+ }, {
65
+ key: "setLastInteractionFinishVCResult",
66
+ value: function setLastInteractionFinishVCResult(result) {
67
+ this.lastInteractionFinishVCResult = result;
68
+ }
64
69
  }, {
65
70
  key: "sinkHandler",
66
71
  value: function sinkHandler(fn) {
@@ -74,7 +79,7 @@ var InteractionExtraMetrics = exports.default = /*#__PURE__*/function () {
74
79
  var updatedData = _objectSpread(_objectSpread({}, data), {}, {
75
80
  vcObserver: (_this$vcObserver3 = this.vcObserver) !== null && _this$vcObserver3 !== void 0 ? _this$vcObserver3 : undefined
76
81
  });
77
- this.sinkHandlerFn(id, updatedData);
82
+ this.sinkHandlerFn(id, updatedData, this.finishedInteraction, this.lastInteractionFinishVCResult);
78
83
  }
79
84
  this.stopVCObserver();
80
85
  (0, _index.remove)(id);
@@ -83,11 +88,13 @@ var InteractionExtraMetrics = exports.default = /*#__PURE__*/function () {
83
88
  }, {
84
89
  key: "reset",
85
90
  value: function reset() {
91
+ var _this$finishedInterac;
86
92
  this.stopVCObserver();
87
- if (this.finishedInteractionId) {
88
- (0, _index.remove)(this.finishedInteractionId);
93
+ if ((_this$finishedInterac = this.finishedInteraction) !== null && _this$finishedInterac !== void 0 && _this$finishedInterac.id) {
94
+ (0, _index.remove)(this.finishedInteraction.id);
89
95
  }
90
- this.finishedInteractionId = null;
96
+ this.finishedInteraction = null;
97
+ this.lastInteractionFinishVCResult = undefined;
91
98
  }
92
99
  }, {
93
100
  key: "stopAll",
@@ -82,14 +82,14 @@ function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
82
82
  });
83
83
  }
84
84
  function sinkInteractionExtraMetrics(instance, createInteractionExtraLogPayload) {
85
- _interactionMetrics.interactionExtraMetrics.sinkHandler(function (interactionId, interaction) {
85
+ _interactionMetrics.interactionExtraMetrics.sinkHandler(function (interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
86
86
  (0, _scheduleIdleCallback.default)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
87
87
  var payload, devToolObserver;
88
88
  return _regenerator.default.wrap(function _callee$(_context) {
89
89
  while (1) switch (_context.prev = _context.next) {
90
90
  case 0:
91
91
  _context.next = 2;
92
- return createInteractionExtraLogPayload(interactionId, interaction);
92
+ return createInteractionExtraLogPayload(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult);
93
93
  case 2:
94
94
  payload = _context.sent;
95
95
  if (payload) {
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = UFOSegment;
8
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
  var _react = _interopRequireWildcard(require("react"));
@@ -21,24 +21,13 @@ var _interactionMetrics = require("../interaction-metrics");
21
21
  var _routeNameContext = _interopRequireDefault(require("../route-name-context"));
22
22
  var _shortId = _interopRequireDefault(require("../short-id"));
23
23
  var _scheduleOnPaint = _interopRequireDefault(require("./schedule-on-paint"));
24
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
24
25
  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
26
  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; }
26
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
27
27
  var tryCompleteHandle;
28
- var AsyncSegmentHighlight = /*#__PURE__*/(0, _react.lazy)(function () {
29
- return Promise.resolve().then(function () {
30
- return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ufo-segment-highlight" */'./segment-highlight'));
31
- }).then(function (module) {
32
- return {
33
- default: module.SegmentHighlight
34
- };
35
- });
36
- });
37
28
 
38
- // KARL TODO: finish self profiling
39
29
  /** A portion of the page we apply measurement to */
40
30
  function UFOSegment(_ref) {
41
- var _getConfig2;
42
31
  var segmentName = _ref.name,
43
32
  children = _ref.children,
44
33
  _ref$mode = _ref.mode,
@@ -289,16 +278,11 @@ function UFOSegment(_ref) {
289
278
  return l.name;
290
279
  }).join('/');
291
280
  }, [labelStack]);
292
- var enableSegmentHighlighting = (_getConfig2 = (0, _config.getConfig)()) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.enableSegmentHighlighting;
293
281
  return /*#__PURE__*/_react.default.createElement(_interactionContext.default.Provider, {
294
282
  value: interactionContext
295
283
  }, /*#__PURE__*/_react.default.createElement(_react.Profiler, {
296
284
  id: reactProfilerId,
297
285
  onRender: onRender
298
- }, children, enableSegmentHighlighting && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
299
- fallback: null
300
- }, /*#__PURE__*/_react.default.createElement(AsyncSegmentHighlight, {
301
- segmentName: segmentName
302
- }))));
286
+ }, children));
303
287
  }
304
288
  UFOSegment.displayName = 'UFOSegment';
@@ -16,8 +16,8 @@ import { optimizeReactProfilerTimings } from '../create-payload/utils/optimize-r
16
16
  import { optimizeRequestInfo } from '../create-payload/utils/optimize-request-info';
17
17
  import { optimizeSpans } from '../create-payload/utils/optimize-spans';
18
18
  import { interactionSpans as atlaskitInteractionSpans } from '../interaction-metrics';
19
- async function createInteractionExtraLogPayload(interactionId, interaction) {
20
- var _getTTAI, _window$location;
19
+ async function createInteractionExtraLogPayload(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
20
+ var _getTTAI, _lastInteractionFinis, _getTTAI2, _window$location;
21
21
  const config = getConfig();
22
22
  if (!config) {
23
23
  throw Error('UFO Configuration not provided');
@@ -33,7 +33,8 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
33
33
  previousInteractionName,
34
34
  isPreviousInteractionAborted,
35
35
  abortedByInteractionName,
36
- knownSegments
36
+ knownSegments,
37
+ minorInteractions
37
38
  } = interaction;
38
39
  const sanitisedUfoName = sanitizeUfoName(ufoName);
39
40
  const configRate = getExtraInteractionRate(sanitisedUfoName, type);
@@ -42,7 +43,8 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
42
43
  }
43
44
  const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
44
45
  const isPageLoad = type === 'page_load' || type === 'transition';
45
- if (!isPageLoad) {
46
+ if (!isPageLoad || minorInteractions !== undefined && minorInteractions.length > 0) {
47
+ // Not send if aborted by minor interaction for now
46
48
  // Only create payload for page load
47
49
  return null;
48
50
  }
@@ -61,6 +63,32 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
61
63
  return null;
62
64
  }
63
65
 
66
+ // Get normal TTAI & VC90 for last finished interaction (without 3p)
67
+ if (!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length) {
68
+ return null;
69
+ }
70
+ const normalTTAI = (_getTTAI2 = getTTAI(lastInteractionFinish)) !== null && _getTTAI2 !== void 0 ? _getTTAI2 : undefined;
71
+ const lastInteractionFinishStart = typeof lastInteractionFinish.start === 'number' ? Math.round(lastInteractionFinish.start) : undefined;
72
+ const lastInteractionFinishEnd = typeof lastInteractionFinish.end === 'number' ? Math.round(lastInteractionFinish.end) : undefined;
73
+ let lastInteractionFinishVC90 = null;
74
+ let lastInteractionFinishVCClean = false;
75
+ if (lastInteractionFinishVCResult) {
76
+ const lastInteractionFinishVCRev = lastInteractionFinishVCResult['ufo:vc:rev'];
77
+ const lastInteractionFinishRevision = lastInteractionFinishVCRev === null || lastInteractionFinishVCRev === void 0 ? void 0 : lastInteractionFinishVCRev.find(({
78
+ revision
79
+ }) => revision === DEFAULT_TTVC_REVISION);
80
+ if (lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean) {
81
+ lastInteractionFinishVCClean = true;
82
+ lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
83
+ } else {
84
+ return null;
85
+ }
86
+ } else if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
87
+ // Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
88
+ lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
89
+ lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
90
+ }
91
+
64
92
  // Helper function to check if labelStack contains third-party type
65
93
  const isThirdParty = labelStack => {
66
94
  var _labelStack$some;
@@ -148,7 +176,14 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
148
176
  customData: filteredData.customData,
149
177
  ...getDetailedInteractionMetrics()
150
178
  },
151
- 'vc:effective:revision': DEFAULT_TTVC_REVISION
179
+ 'vc:effective:revision': DEFAULT_TTVC_REVISION,
180
+ lastInteractionFinish: {
181
+ start: lastInteractionFinishStart,
182
+ end: lastInteractionFinishEnd,
183
+ ttai: normalTTAI,
184
+ vc90: lastInteractionFinishVC90,
185
+ vcClean: lastInteractionFinishVCClean
186
+ }
152
187
  }
153
188
  }
154
189
  };
@@ -1,5 +1,5 @@
1
1
  import { getConfig, getMostRecentVCRevision } from '../../config';
2
- import { postInteractionLog } from '../../interaction-metrics';
2
+ import { interactionExtraMetrics, postInteractionLog } from '../../interaction-metrics';
3
3
  import getInteractionStatus from './get-interaction-status';
4
4
  import getPageVisibilityUpToTTAI from './get-page-visibility-up-to-ttai';
5
5
  import getSSRDoneTimeValue from './get-ssr-done-time-value';
@@ -50,6 +50,7 @@ async function getVCMetrics(interaction, include3p = false, excludeSmartAnswersI
50
50
  if (!include3p) {
51
51
  // For Post Interaction, last interaction should be without 3p
52
52
  postInteractionLog.setLastInteractionFinishVCResult(result);
53
+ interactionExtraMetrics.setLastInteractionFinishVCResult(result);
53
54
  }
54
55
  const mostRecentVCRevision = getMostRecentVCRevision(interaction.ufoName);
55
56
  const mostRecentVCRevisionPayload = result === null || result === void 0 ? void 0 : (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(({
@@ -652,7 +652,8 @@ function finishInteraction(id, data, endTime = performance.now()) {
652
652
  PreviousInteractionLog.isAborted = data.abortReason != null;
653
653
  if (data.ufoName) {
654
654
  if (fg('platform_ufo_enable_ttai_with_3p')) {
655
- if (interactionExtraMetrics.finishedInteractionId !== id) {
655
+ var _interactionExtraMetr;
656
+ if (((_interactionExtraMetr = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr === void 0 ? void 0 : _interactionExtraMetr.id) !== id) {
656
657
  // If this same interaction was not already handled, handle it
657
658
  handleInteraction(id, data);
658
659
  }
@@ -747,7 +748,8 @@ export function tryComplete(interactionId, endTime) {
747
748
  });
748
749
  }
749
750
  if (fg('platform_ufo_enable_ttai_with_3p')) {
750
- if (interactionExtraMetrics.finishedInteractionId !== interactionId) {
751
+ var _interactionExtraMetr2;
752
+ if (((_interactionExtraMetr2 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr2 === void 0 ? void 0 : _interactionExtraMetr2.id) !== interactionId) {
751
753
  var _getConfig9, _getConfig9$experimen;
752
754
  // If interactionExtraMetrics is not waiting for measuring this interaction
753
755
  if ((_getConfig9 = getConfig()) !== null && _getConfig9 !== void 0 && (_getConfig9$experimen = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9$experimen !== void 0 && _getConfig9$experimen.enabled) {
@@ -763,15 +765,15 @@ export function tryComplete(interactionId, endTime) {
763
765
  activeSubmitted = false;
764
766
  };
765
767
  if (fg('platform_ufo_enable_ttai_with_3p')) {
766
- var _interaction$hold3pAc;
768
+ var _interaction$hold3pAc, _interactionExtraMetr3;
767
769
  const noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
768
- if (noMoreActiveHolds && interactionExtraMetrics.finishedInteractionId !== interactionId) {
770
+ if (noMoreActiveHolds && ((_interactionExtraMetr3 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr3 === void 0 ? void 0 : _interactionExtraMetr3.id) !== interactionId) {
769
771
  // If it's not waiting for extra metrics to complete, finish the interaction as normal
770
772
  if (!activeSubmitted) {
771
773
  var _getConfig1, _getConfig1$extraInte, _getConfig10, _getConfig10$extraSea, _getConfig11, _getConfig11$extraSea;
772
774
  finishInteraction(interactionId, interaction, endTime);
773
775
  if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1$extraInte = _getConfig1.extraInteractionMetrics) !== null && _getConfig1$extraInte !== void 0 && _getConfig1$extraInte.enabled) {
774
- interactionExtraMetrics.updateFinishedInteractionId(interactionId);
776
+ interactionExtraMetrics.updateFinishedInteraction(interaction);
775
777
  }
776
778
  if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10$extraSea = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10$extraSea !== void 0 && _getConfig10$extraSea.enabled && interaction.ufoName === ((_getConfig11 = getConfig()) === null || _getConfig11 === void 0 ? void 0 : (_getConfig11$extraSea = _getConfig11.extraSearchPageInteraction) === null || _getConfig11$extraSea === void 0 ? void 0 : _getConfig11$extraSea.searchPageMetricName) && fg('react_ufo_unified_search_ignoring_sain_metric')) {
777
779
  onSearchPageInteractionComplete(interactionId, interaction);
@@ -4,8 +4,8 @@ import { interactions } from './common/constants';
4
4
  import { remove } from './index';
5
5
  export default class InteractionExtraMetrics {
6
6
  constructor() {
7
- // Store the finished interaction ID (as non-3p interaction)
8
- _defineProperty(this, "finishedInteractionId", null);
7
+ // Store the finished interaction (as non-3p interaction)
8
+ _defineProperty(this, "finishedInteraction", null);
9
9
  // independent VC observer, that observes until `custom.post-interaction-logs` event is sent
10
10
  _defineProperty(this, "vcObserver", null);
11
11
  _defineProperty(this, "sinkHandlerFn", () => {});
@@ -36,11 +36,14 @@ export default class InteractionExtraMetrics {
36
36
  const interaction = interactions.get(interactionId);
37
37
  return (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition';
38
38
  }
39
- updateFinishedInteractionId(interactionId) {
40
- if (this.eligibleToMeasure(interactionId)) {
41
- this.finishedInteractionId = interactionId;
39
+ updateFinishedInteraction(interaction) {
40
+ if ((interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition') {
41
+ this.finishedInteraction = interaction;
42
42
  }
43
43
  }
44
+ setLastInteractionFinishVCResult(result) {
45
+ this.lastInteractionFinishVCResult = result;
46
+ }
44
47
  sinkHandler(fn) {
45
48
  this.sinkHandlerFn = fn;
46
49
  }
@@ -51,18 +54,20 @@ export default class InteractionExtraMetrics {
51
54
  ...data,
52
55
  vcObserver: (_this$vcObserver3 = this.vcObserver) !== null && _this$vcObserver3 !== void 0 ? _this$vcObserver3 : undefined
53
56
  };
54
- this.sinkHandlerFn(id, updatedData);
57
+ this.sinkHandlerFn(id, updatedData, this.finishedInteraction, this.lastInteractionFinishVCResult);
55
58
  }
56
59
  this.stopVCObserver();
57
60
  remove(id);
58
61
  this.reset();
59
62
  }
60
63
  reset() {
64
+ var _this$finishedInterac;
61
65
  this.stopVCObserver();
62
- if (this.finishedInteractionId) {
63
- remove(this.finishedInteractionId);
66
+ if ((_this$finishedInterac = this.finishedInteraction) !== null && _this$finishedInterac !== void 0 && _this$finishedInterac.id) {
67
+ remove(this.finishedInteraction.id);
64
68
  }
65
- this.finishedInteractionId = null;
69
+ this.finishedInteraction = null;
70
+ this.lastInteractionFinishVCResult = undefined;
66
71
  }
67
72
  stopAll(id) {
68
73
  remove(id);
@@ -70,9 +70,9 @@ function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
70
70
  });
71
71
  }
72
72
  function sinkInteractionExtraMetrics(instance, createInteractionExtraLogPayload) {
73
- interactionExtraMetrics.sinkHandler((interactionId, interaction) => {
73
+ interactionExtraMetrics.sinkHandler((interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) => {
74
74
  scheduleIdleCallback(async () => {
75
- const payload = await createInteractionExtraLogPayload(interactionId, interaction);
75
+ const payload = await createInteractionExtraLogPayload(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult);
76
76
  if (payload) {
77
77
  // NOTE: This API is used by the UFO DevTool Chrome Extension and also by Criterion
78
78
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
@@ -1,4 +1,4 @@
1
- import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
1
+ import React, { Profiler, 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
4
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -12,11 +12,7 @@ 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
- const AsyncSegmentHighlight = /*#__PURE__*/lazy(() => import( /* webpackChunkName: "@atlaskit-internal_ufo-segment-highlight" */'./segment-highlight').then(module => ({
16
- default: module.SegmentHighlight
17
- })));
18
15
 
19
- // KARL TODO: finish self profiling
20
16
  /** A portion of the page we apply measurement to */
21
17
  export default function UFOSegment({
22
18
  name: segmentName,
@@ -24,7 +20,6 @@ export default function UFOSegment({
24
20
  mode = 'single',
25
21
  type = 'first-party'
26
22
  }) {
27
- var _getConfig2;
28
23
  const parentContext = useContext(UFOInteractionContext);
29
24
  const segmentIdMap = useMemo(() => {
30
25
  if (!(parentContext !== null && parentContext !== void 0 && parentContext.segmentIdMap)) {
@@ -260,16 +255,11 @@ export default function UFOSegment({
260
255
  };
261
256
  }, [interactionId, parentContext, interactionContext, labelStack]);
262
257
  const reactProfilerId = useMemo(() => labelStack.map(l => l.name).join('/'), [labelStack]);
263
- const enableSegmentHighlighting = (_getConfig2 = getConfig()) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.enableSegmentHighlighting;
264
258
  return /*#__PURE__*/React.createElement(UFOInteractionContext.Provider, {
265
259
  value: interactionContext
266
260
  }, /*#__PURE__*/React.createElement(Profiler, {
267
261
  id: reactProfilerId,
268
262
  onRender: onRender
269
- }, children, enableSegmentHighlighting && /*#__PURE__*/React.createElement(Suspense, {
270
- fallback: null
271
- }, /*#__PURE__*/React.createElement(AsyncSegmentHighlight, {
272
- segmentName: segmentName
273
- }))));
263
+ }, children));
274
264
  }
275
265
  UFOSegment.displayName = 'UFOSegment';
@@ -24,13 +24,13 @@ import { optimizeReactProfilerTimings } from '../create-payload/utils/optimize-r
24
24
  import { optimizeRequestInfo } from '../create-payload/utils/optimize-request-info';
25
25
  import { optimizeSpans } from '../create-payload/utils/optimize-spans';
26
26
  import { interactionSpans as atlaskitInteractionSpans } from '../interaction-metrics';
27
- function createInteractionExtraLogPayload(_x, _x2) {
27
+ function createInteractionExtraLogPayload(_x, _x2, _x3, _x4) {
28
28
  return _createInteractionExtraLogPayload.apply(this, arguments);
29
29
  }
30
30
  function _createInteractionExtraLogPayload() {
31
- _createInteractionExtraLogPayload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interactionId, interaction) {
32
- var _getTTAI, _window$location;
33
- var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, sanitisedUfoName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveVCRevisionPayload, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
31
+ _createInteractionExtraLogPayload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
32
+ var _getTTAI, _lastInteractionFinis, _getTTAI2, _window$location;
33
+ var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveVCRevisionPayload, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
34
34
  return _regeneratorRuntime.wrap(function _callee$(_context) {
35
35
  while (1) switch (_context.prev = _context.next) {
36
36
  case 0:
@@ -41,7 +41,7 @@ function _createInteractionExtraLogPayload() {
41
41
  }
42
42
  throw Error('UFO Configuration not provided');
43
43
  case 3:
44
- end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, knownSegments = interaction.knownSegments;
44
+ end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, knownSegments = interaction.knownSegments, minorInteractions = interaction.minorInteractions;
45
45
  sanitisedUfoName = sanitizeUfoName(ufoName);
46
46
  configRate = getExtraInteractionRate(sanitisedUfoName, type);
47
47
  if (coinflip(configRate)) {
@@ -52,7 +52,7 @@ function _createInteractionExtraLogPayload() {
52
52
  case 8:
53
53
  pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
54
54
  isPageLoad = type === 'page_load' || type === 'transition';
55
- if (isPageLoad) {
55
+ if (!(!isPageLoad || minorInteractions !== undefined && minorInteractions.length > 0)) {
56
56
  _context.next = 12;
57
57
  break;
58
58
  }
@@ -78,6 +78,46 @@ function _createInteractionExtraLogPayload() {
78
78
  }
79
79
  return _context.abrupt("return", null);
80
80
  case 23:
81
+ if (!(!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length)) {
82
+ _context.next = 25;
83
+ break;
84
+ }
85
+ return _context.abrupt("return", null);
86
+ case 25:
87
+ normalTTAI = (_getTTAI2 = getTTAI(lastInteractionFinish)) !== null && _getTTAI2 !== void 0 ? _getTTAI2 : undefined;
88
+ lastInteractionFinishStart = typeof lastInteractionFinish.start === 'number' ? Math.round(lastInteractionFinish.start) : undefined;
89
+ lastInteractionFinishEnd = typeof lastInteractionFinish.end === 'number' ? Math.round(lastInteractionFinish.end) : undefined;
90
+ lastInteractionFinishVC90 = null;
91
+ lastInteractionFinishVCClean = false;
92
+ if (!lastInteractionFinishVCResult) {
93
+ _context.next = 41;
94
+ break;
95
+ }
96
+ lastInteractionFinishVCRev = lastInteractionFinishVCResult['ufo:vc:rev'];
97
+ lastInteractionFinishRevision = lastInteractionFinishVCRev === null || lastInteractionFinishVCRev === void 0 ? void 0 : lastInteractionFinishVCRev.find(function (_ref2) {
98
+ var revision = _ref2.revision;
99
+ return revision === DEFAULT_TTVC_REVISION;
100
+ });
101
+ if (!(lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean)) {
102
+ _context.next = 38;
103
+ break;
104
+ }
105
+ lastInteractionFinishVCClean = true;
106
+ lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
107
+ _context.next = 39;
108
+ break;
109
+ case 38:
110
+ return _context.abrupt("return", null);
111
+ case 39:
112
+ _context.next = 42;
113
+ break;
114
+ case 41:
115
+ if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
116
+ // Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
117
+ lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
118
+ lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
119
+ }
120
+ case 42:
81
121
  // Helper function to check if labelStack contains third-party type
82
122
  isThirdParty = function isThirdParty(labelStack) {
83
123
  var _labelStack$some;
@@ -120,9 +160,9 @@ function _createInteractionExtraLogPayload() {
120
160
  getDetailedInteractionMetrics = function getDetailedInteractionMetrics() {
121
161
  var _interaction$hold3pIn;
122
162
  return {
123
- errors: filteredData.errors.map(function (_ref2) {
124
- var labelStack = _ref2.labelStack,
125
- others = _objectWithoutProperties(_ref2, _excluded);
163
+ errors: filteredData.errors.map(function (_ref3) {
164
+ var labelStack = _ref3.labelStack,
165
+ others = _objectWithoutProperties(_ref3, _excluded);
126
166
  return _objectSpread(_objectSpread({}, others), {}, {
127
167
  labelStack: labelStack && optimizeLabelStack(labelStack, getReactUFOPayloadVersion(interaction.type))
128
168
  });
@@ -183,13 +223,20 @@ function _createInteractionExtraLogPayload() {
183
223
  reactProfilerTimings: optimizeReactProfilerTimings(filteredData.reactProfilerTimings, start, getReactUFOPayloadVersion(interaction.type)),
184
224
  customData: filteredData.customData
185
225
  }, getDetailedInteractionMetrics()),
186
- 'vc:effective:revision': DEFAULT_TTVC_REVISION
226
+ 'vc:effective:revision': DEFAULT_TTVC_REVISION,
227
+ lastInteractionFinish: {
228
+ start: lastInteractionFinishStart,
229
+ end: lastInteractionFinishEnd,
230
+ ttai: normalTTAI,
231
+ vc90: lastInteractionFinishVC90,
232
+ vcClean: lastInteractionFinishVCClean
233
+ }
187
234
  }
188
235
  }
189
236
  };
190
237
  payload.attributes.properties['event:sizeInKb'] = getPayloadSize(payload.attributes.properties);
191
238
  return _context.abrupt("return", payload);
192
- case 32:
239
+ case 51:
193
240
  case "end":
194
241
  return _context.stop();
195
242
  }
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  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; }
5
5
  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; }
6
6
  import { getConfig, getMostRecentVCRevision } from '../../config';
7
- import { postInteractionLog } from '../../interaction-metrics';
7
+ import { interactionExtraMetrics, postInteractionLog } from '../../interaction-metrics';
8
8
  import getInteractionStatus from './get-interaction-status';
9
9
  import getPageVisibilityUpToTTAI from './get-page-visibility-up-to-ttai';
10
10
  import getSSRDoneTimeValue from './get-ssr-done-time-value';
@@ -90,6 +90,7 @@ function _getVCMetrics() {
90
90
  if (!include3p) {
91
91
  // For Post Interaction, last interaction should be without 3p
92
92
  postInteractionLog.setLastInteractionFinishVCResult(result);
93
+ interactionExtraMetrics.setLastInteractionFinishVCResult(result);
93
94
  }
94
95
  mostRecentVCRevision = getMostRecentVCRevision(interaction.ufoName);
95
96
  mostRecentVCRevisionPayload = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
@@ -688,7 +688,8 @@ function finishInteraction(id, data) {
688
688
  PreviousInteractionLog.isAborted = data.abortReason != null;
689
689
  if (data.ufoName) {
690
690
  if (fg('platform_ufo_enable_ttai_with_3p')) {
691
- if (interactionExtraMetrics.finishedInteractionId !== id) {
691
+ var _interactionExtraMetr;
692
+ if (((_interactionExtraMetr = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr === void 0 ? void 0 : _interactionExtraMetr.id) !== id) {
692
693
  // If this same interaction was not already handled, handle it
693
694
  handleInteraction(id, data);
694
695
  }
@@ -773,7 +774,7 @@ export function tryComplete(interactionId, endTime) {
773
774
  var postInteraction = /*#__PURE__*/function () {
774
775
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
775
776
  var _getConfig7;
776
- var _getConfig8, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _getConfig9, _getConfig0;
777
+ var _getConfig8, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _interactionExtraMetr2, _getConfig9, _getConfig0;
777
778
  return _regeneratorRuntime.wrap(function _callee$(_context) {
778
779
  while (1) switch (_context.prev = _context.next) {
779
780
  case 0:
@@ -816,7 +817,7 @@ export function tryComplete(interactionId, endTime) {
816
817
  }));
817
818
  case 17:
818
819
  if (fg('platform_ufo_enable_ttai_with_3p')) {
819
- if (interactionExtraMetrics.finishedInteractionId !== interactionId) {
820
+ if (((_interactionExtraMetr2 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr2 === void 0 ? void 0 : _interactionExtraMetr2.id) !== interactionId) {
820
821
  // If interactionExtraMetrics is not waiting for measuring this interaction
821
822
  if ((_getConfig9 = getConfig()) !== null && _getConfig9 !== void 0 && (_getConfig9 = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9 !== void 0 && _getConfig9.enabled) {
822
823
  remove(interactionId);
@@ -839,15 +840,15 @@ export function tryComplete(interactionId, endTime) {
839
840
  };
840
841
  }();
841
842
  if (fg('platform_ufo_enable_ttai_with_3p')) {
842
- var _interaction$hold3pAc;
843
+ var _interaction$hold3pAc, _interactionExtraMetr3;
843
844
  var noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
844
- if (noMoreActiveHolds && interactionExtraMetrics.finishedInteractionId !== interactionId) {
845
+ if (noMoreActiveHolds && ((_interactionExtraMetr3 = interactionExtraMetrics.finishedInteraction) === null || _interactionExtraMetr3 === void 0 ? void 0 : _interactionExtraMetr3.id) !== interactionId) {
845
846
  // If it's not waiting for extra metrics to complete, finish the interaction as normal
846
847
  if (!activeSubmitted) {
847
848
  var _getConfig1, _getConfig10, _getConfig11;
848
849
  finishInteraction(interactionId, interaction, endTime);
849
850
  if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.extraInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
850
- interactionExtraMetrics.updateFinishedInteractionId(interactionId);
851
+ interactionExtraMetrics.updateFinishedInteraction(interaction);
851
852
  }
852
853
  if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10 !== void 0 && _getConfig10.enabled && interaction.ufoName === ((_getConfig11 = getConfig()) === null || _getConfig11 === void 0 || (_getConfig11 = _getConfig11.extraSearchPageInteraction) === null || _getConfig11 === void 0 ? void 0 : _getConfig11.searchPageMetricName) && fg('react_ufo_unified_search_ignoring_sain_metric')) {
853
854
  onSearchPageInteractionComplete(interactionId, interaction);
@@ -9,8 +9,8 @@ import { remove } from './index';
9
9
  var InteractionExtraMetrics = /*#__PURE__*/function () {
10
10
  function InteractionExtraMetrics() {
11
11
  _classCallCheck(this, InteractionExtraMetrics);
12
- // Store the finished interaction ID (as non-3p interaction)
13
- _defineProperty(this, "finishedInteractionId", null);
12
+ // Store the finished interaction (as non-3p interaction)
13
+ _defineProperty(this, "finishedInteraction", null);
14
14
  // independent VC observer, that observes until `custom.post-interaction-logs` event is sent
15
15
  _defineProperty(this, "vcObserver", null);
16
16
  _defineProperty(this, "sinkHandlerFn", function () {});
@@ -48,12 +48,17 @@ var InteractionExtraMetrics = /*#__PURE__*/function () {
48
48
  return (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition';
49
49
  }
50
50
  }, {
51
- key: "updateFinishedInteractionId",
52
- value: function updateFinishedInteractionId(interactionId) {
53
- if (this.eligibleToMeasure(interactionId)) {
54
- this.finishedInteractionId = interactionId;
51
+ key: "updateFinishedInteraction",
52
+ value: function updateFinishedInteraction(interaction) {
53
+ if ((interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition') {
54
+ this.finishedInteraction = interaction;
55
55
  }
56
56
  }
57
+ }, {
58
+ key: "setLastInteractionFinishVCResult",
59
+ value: function setLastInteractionFinishVCResult(result) {
60
+ this.lastInteractionFinishVCResult = result;
61
+ }
57
62
  }, {
58
63
  key: "sinkHandler",
59
64
  value: function sinkHandler(fn) {
@@ -67,7 +72,7 @@ var InteractionExtraMetrics = /*#__PURE__*/function () {
67
72
  var updatedData = _objectSpread(_objectSpread({}, data), {}, {
68
73
  vcObserver: (_this$vcObserver3 = this.vcObserver) !== null && _this$vcObserver3 !== void 0 ? _this$vcObserver3 : undefined
69
74
  });
70
- this.sinkHandlerFn(id, updatedData);
75
+ this.sinkHandlerFn(id, updatedData, this.finishedInteraction, this.lastInteractionFinishVCResult);
71
76
  }
72
77
  this.stopVCObserver();
73
78
  remove(id);
@@ -76,11 +81,13 @@ var InteractionExtraMetrics = /*#__PURE__*/function () {
76
81
  }, {
77
82
  key: "reset",
78
83
  value: function reset() {
84
+ var _this$finishedInterac;
79
85
  this.stopVCObserver();
80
- if (this.finishedInteractionId) {
81
- remove(this.finishedInteractionId);
86
+ if ((_this$finishedInterac = this.finishedInteraction) !== null && _this$finishedInterac !== void 0 && _this$finishedInterac.id) {
87
+ remove(this.finishedInteraction.id);
82
88
  }
83
- this.finishedInteractionId = null;
89
+ this.finishedInteraction = null;
90
+ this.lastInteractionFinishVCResult = undefined;
84
91
  }
85
92
  }, {
86
93
  key: "stopAll",
@@ -73,14 +73,14 @@ function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
73
73
  });
74
74
  }
75
75
  function sinkInteractionExtraMetrics(instance, createInteractionExtraLogPayload) {
76
- interactionExtraMetrics.sinkHandler(function (interactionId, interaction) {
76
+ interactionExtraMetrics.sinkHandler(function (interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
77
77
  scheduleIdleCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
78
78
  var payload, devToolObserver;
79
79
  return _regeneratorRuntime.wrap(function _callee$(_context) {
80
80
  while (1) switch (_context.prev = _context.next) {
81
81
  case 0:
82
82
  _context.next = 2;
83
- return createInteractionExtraLogPayload(interactionId, interaction);
83
+ return createInteractionExtraLogPayload(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult);
84
84
  case 2:
85
85
  payload = _context.sent;
86
86
  if (payload) {
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  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; }
4
4
  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; }
5
- import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
5
+ import React, { Profiler, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
6
6
  import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
7
7
  import { v4 as createUUID } from 'uuid';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -16,18 +16,9 @@ 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 AsyncSegmentHighlight = /*#__PURE__*/lazy(function () {
20
- return import( /* webpackChunkName: "@atlaskit-internal_ufo-segment-highlight" */'./segment-highlight').then(function (module) {
21
- return {
22
- default: module.SegmentHighlight
23
- };
24
- });
25
- });
26
19
 
27
- // KARL TODO: finish self profiling
28
20
  /** A portion of the page we apply measurement to */
29
21
  export default function UFOSegment(_ref) {
30
- var _getConfig2;
31
22
  var segmentName = _ref.name,
32
23
  children = _ref.children,
33
24
  _ref$mode = _ref.mode,
@@ -278,16 +269,11 @@ export default function UFOSegment(_ref) {
278
269
  return l.name;
279
270
  }).join('/');
280
271
  }, [labelStack]);
281
- var enableSegmentHighlighting = (_getConfig2 = getConfig()) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.enableSegmentHighlighting;
282
272
  return /*#__PURE__*/React.createElement(UFOInteractionContext.Provider, {
283
273
  value: interactionContext
284
274
  }, /*#__PURE__*/React.createElement(Profiler, {
285
275
  id: reactProfilerId,
286
276
  onRender: onRender
287
- }, children, enableSegmentHighlighting && /*#__PURE__*/React.createElement(Suspense, {
288
- fallback: null
289
- }, /*#__PURE__*/React.createElement(AsyncSegmentHighlight, {
290
- segmentName: segmentName
291
- }))));
277
+ }, children));
292
278
  }
293
279
  UFOSegment.displayName = 'UFOSegment';
@@ -132,6 +132,10 @@ export type Config = {
132
132
  readonly rates?: Rates;
133
133
  readonly kind?: Record<InteractionType, number>;
134
134
  };
135
+ /**
136
+ * @private
137
+ * @deprecated - to be removed on next major version
138
+ */
135
139
  readonly enableSegmentHighlighting?: boolean;
136
140
  readonly enableAdditionalPerformanceMarks?: boolean;
137
141
  /**
@@ -1,6 +1,7 @@
1
1
  import type { InteractionMetrics } from '../common';
2
+ import type { VCResult } from '../common/vc/types';
2
3
  import type { LabelStack } from '../interaction-context';
3
- declare function createInteractionExtraLogPayload(interactionId: string, interaction: InteractionMetrics): Promise<{
4
+ declare function createInteractionExtraLogPayload(interactionId: string, interaction: InteractionMetrics, lastInteractionFinish: InteractionMetrics | null, lastInteractionFinishVCResult?: VCResult): Promise<{
4
5
  actionSubject: string;
5
6
  action: string;
6
7
  eventType: string;
@@ -96,6 +97,13 @@ declare function createInteractionExtraLogPayload(interactionId: string, interac
96
97
  'metric:ttai:3p': number;
97
98
  };
98
99
  'vc:effective:revision': string;
100
+ lastInteractionFinish: {
101
+ start: number | undefined;
102
+ end: number | undefined;
103
+ ttai: number | undefined;
104
+ vc90: number | null;
105
+ vcClean: boolean;
106
+ };
99
107
  };
100
108
  };
101
109
  } | null>;
@@ -1,8 +1,10 @@
1
+ import { type VCResult } from '../common/vc/types';
1
2
  import type { VCObserverInterface, VCObserverOptions } from '../vc/types';
2
3
  import { type InteractionMetrics } from './index';
3
4
  export default class InteractionExtraMetrics {
4
- finishedInteractionId: string | null;
5
+ finishedInteraction: InteractionMetrics | null;
5
6
  vcObserver: VCObserverInterface | null;
7
+ lastInteractionFinishVCResult?: VCResult;
6
8
  private sinkHandlerFn;
7
9
  initializeVCObserver(options: VCObserverOptions): void;
8
10
  startVCObserver({ startTime }: {
@@ -10,8 +12,9 @@ export default class InteractionExtraMetrics {
10
12
  }, interactionId: string): void;
11
13
  stopVCObserver(): void;
12
14
  eligibleToMeasure(interactionId: string): boolean;
13
- updateFinishedInteractionId(interactionId: string): void;
14
- sinkHandler(fn: (interactionId: string, interaction: InteractionMetrics) => void | Promise<void>): void;
15
+ updateFinishedInteraction(interaction: InteractionMetrics): void;
16
+ setLastInteractionFinishVCResult(result: VCResult): void;
17
+ sinkHandler(fn: (interactionId: string, interaction: InteractionMetrics, lastInteractionFinish: InteractionMetrics | null, lastInteractionFinishVCResult?: VCResult) => void | Promise<void>): void;
15
18
  onInteractionComplete(id: string, data: InteractionMetrics): void;
16
19
  reset(): void;
17
20
  stopAll(id: string): void;
@@ -132,6 +132,10 @@ export type Config = {
132
132
  readonly rates?: Rates;
133
133
  readonly kind?: Record<InteractionType, number>;
134
134
  };
135
+ /**
136
+ * @private
137
+ * @deprecated - to be removed on next major version
138
+ */
135
139
  readonly enableSegmentHighlighting?: boolean;
136
140
  readonly enableAdditionalPerformanceMarks?: boolean;
137
141
  /**
@@ -1,6 +1,7 @@
1
1
  import type { InteractionMetrics } from '../common';
2
+ import type { VCResult } from '../common/vc/types';
2
3
  import type { LabelStack } from '../interaction-context';
3
- declare function createInteractionExtraLogPayload(interactionId: string, interaction: InteractionMetrics): Promise<{
4
+ declare function createInteractionExtraLogPayload(interactionId: string, interaction: InteractionMetrics, lastInteractionFinish: InteractionMetrics | null, lastInteractionFinishVCResult?: VCResult): Promise<{
4
5
  actionSubject: string;
5
6
  action: string;
6
7
  eventType: string;
@@ -96,6 +97,13 @@ declare function createInteractionExtraLogPayload(interactionId: string, interac
96
97
  'metric:ttai:3p': number;
97
98
  };
98
99
  'vc:effective:revision': string;
100
+ lastInteractionFinish: {
101
+ start: number | undefined;
102
+ end: number | undefined;
103
+ ttai: number | undefined;
104
+ vc90: number | null;
105
+ vcClean: boolean;
106
+ };
99
107
  };
100
108
  };
101
109
  } | null>;
@@ -1,8 +1,10 @@
1
+ import { type VCResult } from '../common/vc/types';
1
2
  import type { VCObserverInterface, VCObserverOptions } from '../vc/types';
2
3
  import { type InteractionMetrics } from './index';
3
4
  export default class InteractionExtraMetrics {
4
- finishedInteractionId: string | null;
5
+ finishedInteraction: InteractionMetrics | null;
5
6
  vcObserver: VCObserverInterface | null;
7
+ lastInteractionFinishVCResult?: VCResult;
6
8
  private sinkHandlerFn;
7
9
  initializeVCObserver(options: VCObserverOptions): void;
8
10
  startVCObserver({ startTime }: {
@@ -10,8 +12,9 @@ export default class InteractionExtraMetrics {
10
12
  }, interactionId: string): void;
11
13
  stopVCObserver(): void;
12
14
  eligibleToMeasure(interactionId: string): boolean;
13
- updateFinishedInteractionId(interactionId: string): void;
14
- sinkHandler(fn: (interactionId: string, interaction: InteractionMetrics) => void | Promise<void>): void;
15
+ updateFinishedInteraction(interaction: InteractionMetrics): void;
16
+ setLastInteractionFinishVCResult(result: VCResult): void;
17
+ sinkHandler(fn: (interactionId: string, interaction: InteractionMetrics, lastInteractionFinish: InteractionMetrics | null, lastInteractionFinishVCResult?: VCResult) => void | Promise<void>): void;
15
18
  onInteractionComplete(id: string, data: InteractionMetrics): void;
16
19
  reset(): void;
17
20
  stopAll(id: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.11.2",
3
+ "version": "4.11.3",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.SegmentHighlight = SegmentHighlight;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
12
- function SegmentHighlight(_ref) {
13
- var segmentName = _ref.segmentName;
14
- var _useState = (0, _react.useState)(false),
15
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
16
- segmentHighlight = _useState2[0],
17
- setSegmentHighlight = _useState2[1];
18
- (0, _react.useEffect)(function () {
19
- try {
20
- var shouldHighlightSegments = sessionStorage.getItem('segmentsHighlight') === 'true';
21
- setSegmentHighlight(shouldHighlightSegments);
22
- } catch (err) {
23
- /* do nothing */
24
- }
25
- }, []);
26
- if (segmentHighlight) {
27
- return (
28
- /*#__PURE__*/
29
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
30
- _react.default.createElement("span", {
31
- "data-segment-name": segmentName,
32
- style: {
33
- display: 'none'
34
- }
35
- })
36
- );
37
- }
38
- return null;
39
- }
@@ -1,27 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- export function SegmentHighlight({
3
- segmentName
4
- }) {
5
- const [segmentHighlight, setSegmentHighlight] = useState(false);
6
- useEffect(() => {
7
- try {
8
- const shouldHighlightSegments = sessionStorage.getItem('segmentsHighlight') === 'true';
9
- setSegmentHighlight(shouldHighlightSegments);
10
- } catch (err) {
11
- /* do nothing */
12
- }
13
- }, []);
14
- if (segmentHighlight) {
15
- return (
16
- /*#__PURE__*/
17
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
18
- React.createElement("span", {
19
- "data-segment-name": segmentName,
20
- style: {
21
- display: 'none'
22
- }
23
- })
24
- );
25
- }
26
- return null;
27
- }
@@ -1,30 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useEffect, useState } from 'react';
3
- export function SegmentHighlight(_ref) {
4
- var segmentName = _ref.segmentName;
5
- var _useState = useState(false),
6
- _useState2 = _slicedToArray(_useState, 2),
7
- segmentHighlight = _useState2[0],
8
- setSegmentHighlight = _useState2[1];
9
- useEffect(function () {
10
- try {
11
- var shouldHighlightSegments = sessionStorage.getItem('segmentsHighlight') === 'true';
12
- setSegmentHighlight(shouldHighlightSegments);
13
- } catch (err) {
14
- /* do nothing */
15
- }
16
- }, []);
17
- if (segmentHighlight) {
18
- return (
19
- /*#__PURE__*/
20
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
21
- React.createElement("span", {
22
- "data-segment-name": segmentName,
23
- style: {
24
- display: 'none'
25
- }
26
- })
27
- );
28
- }
29
- return null;
30
- }
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- type Props = {
3
- segmentName: string;
4
- };
5
- export declare function SegmentHighlight({ segmentName }: Props): React.JSX.Element | null;
6
- export {};
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- type Props = {
3
- segmentName: string;
4
- };
5
- export declare function SegmentHighlight({ segmentName }: Props): React.JSX.Element | null;
6
- export {};