@atlaskit/react-ufo 4.4.3 → 4.4.5

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 (67) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/create-interaction-extra-metrics-payload/index.js +116 -0
  3. package/dist/cjs/create-payload/index.js +3 -2
  4. package/dist/cjs/create-payload/utils/get-vc-metrics.js +37 -21
  5. package/dist/cjs/interaction-metrics/index.js +313 -259
  6. package/dist/cjs/interaction-metrics/interaction-extra-metrics.js +89 -0
  7. package/dist/cjs/interaction-metrics-init/index.js +51 -7
  8. package/dist/cjs/segment/third-party-segment.js +3 -1
  9. package/dist/cjs/ssr/index.js +3 -2
  10. package/dist/cjs/vc/index.js +4 -3
  11. package/dist/cjs/vc/vc-observer/index.js +31 -51
  12. package/dist/cjs/vc/vc-observer-new/index.js +4 -3
  13. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +7 -5
  14. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +15 -6
  15. package/dist/es2019/create-interaction-extra-metrics-payload/index.js +93 -0
  16. package/dist/es2019/create-payload/index.js +3 -3
  17. package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -2
  18. package/dist/es2019/interaction-metrics/index.js +317 -260
  19. package/dist/es2019/interaction-metrics/interaction-extra-metrics.js +63 -0
  20. package/dist/es2019/interaction-metrics-init/index.js +29 -2
  21. package/dist/es2019/segment/third-party-segment.js +3 -1
  22. package/dist/es2019/ssr/index.js +3 -2
  23. package/dist/es2019/vc/index.js +4 -2
  24. package/dist/es2019/vc/vc-observer/index.js +41 -61
  25. package/dist/es2019/vc/vc-observer-new/index.js +4 -2
  26. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +7 -3
  27. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +12 -5
  28. package/dist/esm/create-interaction-extra-metrics-payload/index.js +109 -0
  29. package/dist/esm/create-payload/index.js +3 -3
  30. package/dist/esm/create-payload/utils/get-vc-metrics.js +37 -21
  31. package/dist/esm/interaction-metrics/index.js +312 -258
  32. package/dist/esm/interaction-metrics/interaction-extra-metrics.js +83 -0
  33. package/dist/esm/interaction-metrics-init/index.js +48 -6
  34. package/dist/esm/segment/third-party-segment.js +3 -1
  35. package/dist/esm/ssr/index.js +3 -2
  36. package/dist/esm/vc/index.js +4 -3
  37. package/dist/esm/vc/vc-observer/index.js +31 -51
  38. package/dist/esm/vc/vc-observer-new/index.js +4 -3
  39. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +7 -5
  40. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +15 -6
  41. package/dist/types/common/common/types.d.ts +2 -0
  42. package/dist/types/common/vc/types.d.ts +1 -0
  43. package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +45 -0
  44. package/dist/types/create-payload/index.d.ts +1 -0
  45. package/dist/types/create-payload/utils/get-vc-metrics.d.ts +1 -1
  46. package/dist/types/interaction-metrics/index.d.ts +2 -0
  47. package/dist/types/interaction-metrics/interaction-extra-metrics.d.ts +17 -0
  48. package/dist/types/vc/types.d.ts +1 -0
  49. package/dist/types/vc/vc-observer/getVCRevisionDebugDetails.d.ts +1 -0
  50. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +3 -2
  51. package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +2 -2
  52. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  53. package/dist/types/vc/vc-observer-new/types.d.ts +1 -0
  54. package/dist/types-ts4.5/common/common/types.d.ts +2 -0
  55. package/dist/types-ts4.5/common/vc/types.d.ts +1 -0
  56. package/dist/types-ts4.5/create-interaction-extra-metrics-payload/index.d.ts +45 -0
  57. package/dist/types-ts4.5/create-payload/index.d.ts +1 -0
  58. package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +1 -1
  59. package/dist/types-ts4.5/interaction-metrics/index.d.ts +2 -0
  60. package/dist/types-ts4.5/interaction-metrics/interaction-extra-metrics.d.ts +17 -0
  61. package/dist/types-ts4.5/vc/types.d.ts +1 -0
  62. package/dist/types-ts4.5/vc/vc-observer/getVCRevisionDebugDetails.d.ts +1 -0
  63. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +3 -2
  64. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +2 -2
  65. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  66. package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -0
  67. package/package.json +7 -10
@@ -0,0 +1,83 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
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
+ 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
+ import { VCObserverWrapper } from '../vc';
7
+ import { interactions } from './common/constants';
8
+ import { remove } from './index';
9
+ var InteractionExtraMetrics = /*#__PURE__*/function () {
10
+ function InteractionExtraMetrics() {
11
+ _classCallCheck(this, InteractionExtraMetrics);
12
+ // Store the finished interaction ID (as non-3p interaction)
13
+ _defineProperty(this, "finishedInteractionId", null);
14
+ // independent VC observer, that observes until `custom.post-interaction-logs` event is sent
15
+ _defineProperty(this, "vcObserver", null);
16
+ _defineProperty(this, "sinkHandlerFn", function () {});
17
+ }
18
+ return _createClass(InteractionExtraMetrics, [{
19
+ key: "initializeVCObserver",
20
+ value: function initializeVCObserver(options) {
21
+ this.vcObserver = new VCObserverWrapper(_objectSpread(_objectSpread({}, options), {}, {
22
+ isPostInteraction: true
23
+ }));
24
+ }
25
+ }, {
26
+ key: "startVCObserver",
27
+ value: function startVCObserver(_ref, interactionId) {
28
+ var startTime = _ref.startTime;
29
+ if (this.eligibleToMeasure(interactionId)) {
30
+ var _this$vcObserver;
31
+ (_this$vcObserver = this.vcObserver) === null || _this$vcObserver === void 0 || _this$vcObserver.start({
32
+ startTime: startTime
33
+ });
34
+ }
35
+ }
36
+ }, {
37
+ key: "stopVCObserver",
38
+ value: function stopVCObserver() {
39
+ var _this$vcObserver2;
40
+ (_this$vcObserver2 = this.vcObserver) === null || _this$vcObserver2 === void 0 || _this$vcObserver2.stop();
41
+ }
42
+
43
+ // Check if the current interaction is eligible for measurement
44
+ }, {
45
+ key: "eligibleToMeasure",
46
+ value: function eligibleToMeasure(interactionId) {
47
+ var interaction = interactions.get(interactionId);
48
+ return (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'page_load' || (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'transition';
49
+ }
50
+ }, {
51
+ key: "updateFinishedInteractionId",
52
+ value: function updateFinishedInteractionId(interactionId) {
53
+ if (this.eligibleToMeasure(interactionId)) {
54
+ this.finishedInteractionId = interactionId;
55
+ }
56
+ }
57
+ }, {
58
+ key: "sinkHandler",
59
+ value: function sinkHandler(fn) {
60
+ this.sinkHandlerFn = fn;
61
+ }
62
+ }, {
63
+ key: "onInteractionComplete",
64
+ value: function onInteractionComplete(id, data) {
65
+ if (data.ufoName) {
66
+ var _this$vcObserver3;
67
+ var updatedData = _objectSpread(_objectSpread({}, data), {}, {
68
+ vcObserver: (_this$vcObserver3 = this.vcObserver) !== null && _this$vcObserver3 !== void 0 ? _this$vcObserver3 : undefined
69
+ });
70
+ this.sinkHandlerFn(id, updatedData);
71
+ }
72
+ this.stopVCObserver();
73
+ remove(id);
74
+ this.reset();
75
+ }
76
+ }, {
77
+ key: "reset",
78
+ value: function reset() {
79
+ this.finishedInteractionId = null;
80
+ }
81
+ }]);
82
+ }();
83
+ export { InteractionExtraMetrics as default };
@@ -1,10 +1,12 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
4
  import { fg } from '@atlaskit/platform-feature-flags';
3
5
  import { startLighthouseObserver } from '../additional-payload';
4
6
  import { setUFOConfig } from '../config';
5
7
  import { experimentalVC, sinkExperimentalHandler } from '../create-experimental-interaction-metrics-payload';
6
8
  import { setupHiddenTimingCapture } from '../hidden-timing';
7
- import { postInteractionLog, sinkInteractionHandler, sinkPostInteractionLogHandler } from '../interaction-metrics';
9
+ import { interactionExtraMetrics, postInteractionLog, sinkInteractionHandler, sinkPostInteractionLogHandler } from '../interaction-metrics';
8
10
  import { getPerformanceObserver } from '../interactions-performance-observer';
9
11
  import { initialiseMemoryObserver, initialisePressureObserver } from '../machine-utilisation';
10
12
  import scheduleIdleCallback from './schedule-idle-callback';
@@ -69,6 +71,36 @@ function sinkPostInteractionLog(instance, createPostInteractionLogPayload) {
69
71
  });
70
72
  });
71
73
  }
74
+ function sinkInteractionExtraMetrics(instance, createInteractionExtraLogPayload) {
75
+ interactionExtraMetrics.sinkHandler(function (interactionId, interaction) {
76
+ scheduleIdleCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
77
+ var payload, devToolObserver;
78
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
79
+ while (1) switch (_context.prev = _context.next) {
80
+ case 0:
81
+ _context.next = 2;
82
+ return createInteractionExtraLogPayload(interactionId, interaction);
83
+ case 2:
84
+ payload = _context.sent;
85
+ if (payload) {
86
+ // NOTE: This API is used by the UFO DevTool Chrome Extension and also by Criterion
87
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
88
+ if (fg('enable_ufo_devtools_api_for_extra_events')) {
89
+ devToolObserver = globalThis.__ufo_devtool_onUfoPayload;
90
+ if (typeof devToolObserver === 'function') {
91
+ devToolObserver === null || devToolObserver === void 0 || devToolObserver(payload);
92
+ }
93
+ }
94
+ instance.sendOperationalEvent(payload);
95
+ }
96
+ case 4:
97
+ case "end":
98
+ return _context.stop();
99
+ }
100
+ }, _callee);
101
+ })));
102
+ });
103
+ }
72
104
  export function init(analyticsWebClientAsync, config) {
73
105
  var _config$vc;
74
106
  if (initialized) {
@@ -94,6 +126,9 @@ export function init(analyticsWebClientAsync, config) {
94
126
  startTime: 0
95
127
  });
96
128
  }
129
+ if (fg('platform_ufo_enable_ttai_with_3p')) {
130
+ interactionExtraMetrics.initializeVCObserver(vcOptions);
131
+ }
97
132
  }
98
133
  setupHiddenTimingCapture();
99
134
  startLighthouseObserver();
@@ -106,11 +141,12 @@ export function init(analyticsWebClientAsync, config) {
106
141
  durationThreshold: 16
107
142
  });
108
143
  }
109
- Promise.all([analyticsWebClientAsync, import( /* webpackChunkName: "create-payloads" */'../create-payload'), import( /* webpackChunkName: "create-post-interaction-log-payload" */'../create-post-interaction-log-payload')]).then(function (_ref) {
110
- var _ref2 = _slicedToArray(_ref, 3),
111
- awc = _ref2[0],
112
- payloadPackage = _ref2[1],
113
- createPostInteractionLogPayloadPackage = _ref2[2];
144
+ Promise.all([analyticsWebClientAsync, import( /* webpackChunkName: "create-payloads" */'../create-payload'), import( /* webpackChunkName: "create-post-interaction-log-payload" */'../create-post-interaction-log-payload'), import( /* webpackChunkName: "create-interaction-extra-metrics-payload" */'../create-interaction-extra-metrics-payload')]).then(function (_ref2) {
145
+ var _ref3 = _slicedToArray(_ref2, 4),
146
+ awc = _ref3[0],
147
+ payloadPackage = _ref3[1],
148
+ createPostInteractionLogPayloadPackage = _ref3[2],
149
+ createInteractionExtraMetricsPayloadPackage = _ref3[3];
114
150
  if (awc.getAnalyticsWebClientPromise) {
115
151
  awc.getAnalyticsWebClientPromise().then(function (client) {
116
152
  var _config$experimentalI2, _config$postInteracti;
@@ -122,6 +158,9 @@ export function init(analyticsWebClientAsync, config) {
122
158
  if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
123
159
  sinkPostInteractionLog(instance, createPostInteractionLogPayloadPackage.default);
124
160
  }
161
+ if (fg('platform_ufo_enable_ttai_with_3p')) {
162
+ sinkInteractionExtraMetrics(instance, createInteractionExtraMetricsPayloadPackage.default);
163
+ }
125
164
  });
126
165
  } else if (awc.sendOperationalEvent) {
127
166
  var _config$experimentalI3, _config$postInteracti2;
@@ -132,6 +171,9 @@ export function init(analyticsWebClientAsync, config) {
132
171
  if ((_config$postInteracti2 = config.postInteractionLog) !== null && _config$postInteracti2 !== void 0 && _config$postInteracti2.enabled) {
133
172
  sinkPostInteractionLog(awc, createPostInteractionLogPayloadPackage.default);
134
173
  }
174
+ if (fg('platform_ufo_enable_ttai_with_3p')) {
175
+ sinkInteractionExtraMetrics(awc, createInteractionExtraMetricsPayloadPackage.default);
176
+ }
135
177
  }
136
178
  });
137
179
  }
@@ -8,7 +8,9 @@ import UFOSegment from './segment';
8
8
  export function UFOThirdPartySegment(props) {
9
9
  var children = props.children,
10
10
  otherProps = _objectWithoutProperties(props, _excluded);
11
- return /*#__PURE__*/React.createElement(UFOSegment, _extends({
11
+ return fg('platform_ufo_enable_ttai_with_3p') ? /*#__PURE__*/React.createElement(UFOSegment, _extends({
12
+ type: "third-party"
13
+ }, otherProps), children) : /*#__PURE__*/React.createElement(UFOSegment, _extends({
12
14
  type: "third-party"
13
15
  }, otherProps), /*#__PURE__*/React.createElement(UFOIgnoreHolds, {
14
16
  ignore: fg('platform_ufo_exclude_3p_elements_from_ttai'),
@@ -2,7 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _typeof from "@babel/runtime/helpers/typeof";
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 { fg } from '@atlaskit/platform-feature-flags';
5
+ //
6
+
6
7
  var NESTED_METRIC_SEPARATOR = '/';
7
8
  function filterEntry(entry) {
8
9
  return !(!entry || _typeof(entry) !== 'object' || entry.startTime < 0 || entry.duration < 0);
@@ -11,7 +12,7 @@ function mapEntry(entry) {
11
12
  return _objectSpread({
12
13
  startTime: Math.round(entry.startTime),
13
14
  duration: Math.round(entry.duration)
14
- }, entry.size && fg('platform_ufo_ssr_size_field') ? {
15
+ }, entry.size ? {
15
16
  size: Math.round(entry.size)
16
17
  } : {});
17
18
  }
@@ -112,11 +112,11 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
112
112
  value: function () {
113
113
  var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
114
114
  var _this$oldVCObserver4, _this$newVCObserver3, _ref2;
115
- var experienceKey, v1v2Result, v3Result;
115
+ var experienceKey, include3p, v1v2Result, v3Result;
116
116
  return _regeneratorRuntime.wrap(function _callee$(_context) {
117
117
  while (1) switch (_context.prev = _context.next) {
118
118
  case 0:
119
- experienceKey = param.experienceKey;
119
+ experienceKey = param.experienceKey, include3p = param.include3p;
120
120
  if (!(isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey))) {
121
121
  _context.next = 7;
122
122
  break;
@@ -140,7 +140,8 @@ export var VCObserverWrapper = /*#__PURE__*/function () {
140
140
  start: param.start,
141
141
  stop: param.stop,
142
142
  interactionId: param.interactionId,
143
- ssr: param.includeSSRInV3 ? param.ssr : undefined
143
+ ssr: param.includeSSRInV3 ? param.ssr : undefined,
144
+ include3p: include3p
144
145
  });
145
146
  case 12:
146
147
  _context.t1 = _context.sent;
@@ -96,7 +96,7 @@ export var VCObserver = /*#__PURE__*/function () {
96
96
  });
97
97
  _defineProperty(this, "getVCResult", /*#__PURE__*/function () {
98
98
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
99
- var start, stop, tti, prefix, ssr, vc, isEventAborted, experienceKey, interactionId, includeSSRRatio, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, isTTVCv1Disabled, vcAbortedResultWithRevisions, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, shouldCreateDebugDetails, v1RevisionDebugDetails, v2RevisionDebugDetails, _window$__ufo_devtool2, _window2, _window$__ufo_devtool, _window, _window$__on_ufo_vc_d2, _window4, _window$__on_ufo_vc_d, _window3, isVCClean, revisionsData, speedIndex, SSRRatio, SSRRatioNext, SSRRatioPayload, isTTVCv3Enabled;
99
+ var start, stop, tti, prefix, ssr, vc, isEventAborted, experienceKey, interactionId, includeSSRRatio, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, isTTVCv1Disabled, vcAbortedResultWithRevisions, _vcAbortedResultWithRevisions, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, shouldCreateDebugDetails, v1RevisionDebugDetails, v2RevisionDebugDetails, _window$__ufo_devtool2, _window2, _window$__ufo_devtool, _window, _window$__on_ufo_vc_d2, _window4, _window$__on_ufo_vc_d, _window3, isVCClean, revisionsData, speedIndex, SSRRatio, SSRRatioNext, SSRRatioPayload, isTTVCv3Enabled;
100
100
  return _regeneratorRuntime.wrap(function _callee$(_context) {
101
101
  while (1) switch (_context.prev = _context.next) {
102
102
  case 0:
@@ -113,7 +113,7 @@ export var VCObserver = /*#__PURE__*/function () {
113
113
  abortReason = rawData.abortReason, abortReasonInfo = rawData.abortReasonInfo, heatmap = rawData.heatmap, heatmapNext = rawData.heatmapNext, outOfBoundaryInfo = rawData.outOfBoundaryInfo, totalTime = rawData.totalTime, componentsLog = rawData.componentsLog, viewport = rawData.viewport, devToolsEnabled = rawData.devToolsEnabled, ratios = rawData.ratios;
114
114
  isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01', experienceKey);
115
115
  if (!(abortReasonInfo !== null)) {
116
- _context.next = 13;
116
+ _context.next = 19;
117
117
  break;
118
118
  }
119
119
  // exposing data to devtools
@@ -122,22 +122,44 @@ export var VCObserver = /*#__PURE__*/function () {
122
122
  window.__vcNotAvailableReason = abortReasonInfo;
123
123
  }
124
124
  } catch (e) {}
125
- vcAbortedResultWithRevisions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReason.reason), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp), "".concat(fullPrefix, "vc:rev"), [{
125
+ if (!fg('platform_ufo_abort_timestamp_by_revision')) {
126
+ _context.next = 16;
127
+ break;
128
+ }
129
+ vcAbortedResultWithRevisions = _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [{
126
130
  revision: 'fy25.02',
127
131
  clean: false,
128
132
  'metric:vc90': null,
129
- abortReason: abortReason.reason
133
+ abortReason: abortReason.reason,
134
+ abortTimestamp: Math.round(abortReason.timestamp)
130
135
  }]);
131
136
  if (!isTTVCv1Disabled) {
132
137
  vcAbortedResultWithRevisions["".concat(fullPrefix, "vc:rev")].push({
133
138
  revision: 'fy25.01',
134
139
  clean: false,
135
140
  'metric:vc90': null,
136
- abortReason: abortReason.reason
141
+ abortReason: abortReason.reason,
142
+ abortTimestamp: Math.round(abortReason.timestamp)
137
143
  });
138
144
  }
139
145
  return _context.abrupt("return", vcAbortedResultWithRevisions);
140
- case 13:
146
+ case 16:
147
+ _vcAbortedResultWithRevisions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:state"), false), "".concat(fullPrefix, "vc:abort:reason"), abortReason.reason), "".concat(fullPrefix, "vc:abort:timestamp"), abortReason.timestamp), "".concat(fullPrefix, "vc:rev"), [{
148
+ revision: 'fy25.02',
149
+ clean: false,
150
+ 'metric:vc90': null,
151
+ abortReason: abortReason.reason
152
+ }]);
153
+ if (!isTTVCv1Disabled) {
154
+ _vcAbortedResultWithRevisions["".concat(fullPrefix, "vc:rev")].push({
155
+ revision: 'fy25.01',
156
+ clean: false,
157
+ 'metric:vc90': null,
158
+ abortReason: abortReason.reason
159
+ });
160
+ }
161
+ return _context.abrupt("return", _vcAbortedResultWithRevisions);
162
+ case 19:
141
163
  ttvcV1Result = isTTVCv1Disabled ? {
142
164
  VC: {},
143
165
  VCBox: {},
@@ -172,48 +194,6 @@ export var VCObserver = /*#__PURE__*/function () {
172
194
  viewport: viewport,
173
195
  fixSSRAttribution: includeSSRRatio
174
196
  });
175
- try {
176
- if (!_this.isPostInteraction) {
177
- VCObserver.VCParts.forEach(function (key) {
178
- if (isTTVCv1Disabled) {
179
- var duration = vcNext.VC[key];
180
- if (duration !== null && duration !== undefined) {
181
- if (!fg('ufo_chrome_devtools_uplift')) {
182
- performance.measure("VC".concat(key), {
183
- start: start,
184
- duration: duration
185
- });
186
- performance.measure("VC_Next".concat(key), {
187
- start: start,
188
- duration: duration
189
- });
190
- }
191
- }
192
- } else {
193
- var ttvcV1duration = VC[key];
194
- if (ttvcV1duration !== null && ttvcV1duration !== undefined) {
195
- if (!fg('ufo_chrome_devtools_uplift')) {
196
- performance.measure("VC".concat(key), {
197
- start: start,
198
- duration: ttvcV1duration
199
- });
200
- }
201
- }
202
- var ttvcV2duration = vcNext.VC[key];
203
- if (ttvcV2duration !== null && ttvcV2duration !== undefined) {
204
- if (!fg('ufo_chrome_devtools_uplift')) {
205
- performance.measure("VC_Next".concat(key), {
206
- start: start,
207
- duration: ttvcV2duration
208
- });
209
- }
210
- }
211
- }
212
- });
213
- }
214
- } catch (e) {
215
- /* empty */
216
- }
217
197
  outOfBoundary = outOfBoundaryInfo ? _defineProperty({}, "".concat(fullPrefix, "vc:oob"), outOfBoundaryInfo) : {}; //const oldDomUpdates = oldDomUpdatesEnabled ? { [`${fullPrefix}vc:old:dom`]: vcNext.VCBox } : {};
218
198
  stopTime = performance.now(); // exposing data to devtools
219
199
  try {
@@ -337,16 +317,16 @@ export var VCObserver = /*#__PURE__*/function () {
337
317
  SSRRatioNext = VCObserver.getSSRRatio(vcNext.VCEntries.rel, ssr);
338
318
  SSRRatioPayload = includeSSRRatio ? _defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:ssrRatio"), isTTVCv1Disabled ? SSRRatioNext : SSRRatio), "".concat(fullPrefix, "vc:next:ssrRatio"), SSRRatioNext) : {};
339
319
  if (!isTTVCv1Disabled) {
340
- _context.next = 30;
320
+ _context.next = 35;
341
321
  break;
342
322
  }
343
323
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), SSRRatioPayload), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ssrRatio"), SSRRatioNext), revisionsData), speedIndex));
344
- case 30:
324
+ case 35:
345
325
  isTTVCv3Enabled = isVCRevisionEnabled('fy25.03', experienceKey);
346
326
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
347
327
  'metrics:vc': VC
348
328
  }, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), isTTVCv3Enabled ? undefined : VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), "".concat(fullPrefix, "vc:ssrRatio"), SSRRatio), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), isTTVCv3Enabled ? undefined : vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), SSRRatioPayload), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), speedIndex));
349
- case 32:
329
+ case 37:
350
330
  case "end":
351
331
  return _context.stop();
352
332
  }
@@ -220,11 +220,11 @@ var VCObserverNew = /*#__PURE__*/function () {
220
220
  key: "getVCResult",
221
221
  value: function () {
222
222
  var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
223
- var start, stop, interactionId, results, calculator_fy25_03, orderedEntries, fy25_03;
223
+ var start, stop, interactionId, include3p, results, calculator_fy25_03, orderedEntries, fy25_03;
224
224
  return _regeneratorRuntime.wrap(function _callee$(_context) {
225
225
  while (1) switch (_context.prev = _context.next) {
226
226
  case 0:
227
- start = param.start, stop = param.stop, interactionId = param.interactionId;
227
+ start = param.start, stop = param.stop, interactionId = param.interactionId, include3p = param.include3p;
228
228
  results = [];
229
229
  this.addStartEntry(start);
230
230
  calculator_fy25_03 = new VCCalculator_FY25_03();
@@ -241,7 +241,8 @@ var VCObserverNew = /*#__PURE__*/function () {
241
241
  startTime: start,
242
242
  stopTime: stop,
243
243
  interactionId: interactionId,
244
- isPostInteraction: this.isPostInteraction
244
+ isPostInteraction: this.isPostInteraction,
245
+ include3p: include3p
245
246
  });
246
247
  case 8:
247
248
  fy25_03 = _context.sent;
@@ -317,13 +317,13 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
317
317
  var _this = this,
318
318
  _vcDetails$90$t,
319
319
  _vcDetails$;
320
- var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
320
+ var startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, filteredEntries, isVCClean, dirtyReason, getVCCleanStatusResult, vcDetails, result;
321
321
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
322
322
  while (1) switch (_context2.prev = _context2.next) {
323
323
  case 0:
324
- startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction;
324
+ startTime = _ref.startTime, stopTime = _ref.stopTime, orderedEntries = _ref.orderedEntries, interactionId = _ref.interactionId, isPostInteraction = _ref.isPostInteraction, include3p = _ref.include3p;
325
325
  filteredEntries = orderedEntries.filter(function (entry) {
326
- return _this.isEntryIncluded(entry);
326
+ return _this.isEntryIncluded(entry, include3p);
327
327
  });
328
328
  getVCCleanStatusResult = this.getVCCleanStatus(filteredEntries);
329
329
  isVCClean = getVCCleanStatusResult.isVCClean;
@@ -332,12 +332,14 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
332
332
  _context2.next = 7;
333
333
  break;
334
334
  }
335
- return _context2.abrupt("return", {
335
+ return _context2.abrupt("return", _objectSpread({
336
336
  revision: this.revisionNo,
337
337
  'metric:vc90': null,
338
338
  clean: false,
339
339
  abortReason: dirtyReason
340
- });
340
+ }, fg('platform_ufo_abort_timestamp_by_revision') ? {
341
+ abortTimestamp: getVCCleanStatusResult.abortTimestamp
342
+ } : {}));
341
343
  case 7:
342
344
  _context2.next = 9;
343
345
  return this.calculateWithDebugInfo(filteredEntries, startTime, stopTime, isPostInteraction, isVCClean, interactionId, dirtyReason, orderedEntries);
@@ -1,8 +1,11 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
6
  import _inherits from "@babel/runtime/helpers/inherits";
7
+ 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; }
8
+ 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
9
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
7
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
11
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -10,12 +13,12 @@ import AbstractVCCalculatorBase from '../abstract-base-vc-calculator';
10
13
  import isViewportEntryData from '../utils/is-viewport-entry-data';
11
14
  var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
12
15
  var REVISION_NO = 'fy25.03';
13
- var getConsideredEntryTypes = function getConsideredEntryTypes() {
16
+ var getConsideredEntryTypes = function getConsideredEntryTypes(include3p) {
14
17
  var entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'window:event'];
15
18
 
16
19
  // If not exclude 3p elements from ttvc,
17
20
  // including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
18
- if (!fg('platform_ufo_exclude_3p_elements_from_ttvc')) {
21
+ if (!fg('platform_ufo_exclude_3p_elements_from_ttvc') || include3p) {
19
22
  entryTypes.push('mutation:third-party-element');
20
23
  }
21
24
  if (fg('platform_ufo_enable_media_for_ttvc_v3')) {
@@ -39,8 +42,8 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
39
42
  _inherits(VCCalculator_FY25_03, _AbstractVCCalculator);
40
43
  return _createClass(VCCalculator_FY25_03, [{
41
44
  key: "isEntryIncluded",
42
- value: function isEntryIncluded(entry) {
43
- if (!getConsideredEntryTypes().includes(entry.data.type)) {
45
+ value: function isEntryIncluded(entry, include3p) {
46
+ if (!getConsideredEntryTypes(include3p).includes(entry.data.type)) {
44
47
  return false;
45
48
  }
46
49
  if (entry.data.type === 'mutation:attribute') {
@@ -63,21 +66,27 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
63
66
  key: "getVCCleanStatus",
64
67
  value: function getVCCleanStatus(filteredEntries) {
65
68
  var dirtyReason = '';
69
+ var abortTimestamp = -1;
66
70
  var hasAbortEvent = filteredEntries.some(function (entry) {
67
71
  if (entry.data.type === 'window:event') {
68
72
  var data = entry.data;
69
73
  if (ABORTING_WINDOW_EVENT.includes(data.eventType)) {
70
74
  dirtyReason = data.eventType === 'keydown' ? 'keypress' : data.eventType;
75
+ if (fg('platform_ufo_abort_timestamp_by_revision')) {
76
+ abortTimestamp = Math.round(entry.time);
77
+ }
71
78
  return true;
72
79
  }
73
80
  }
74
81
  return false;
75
82
  });
76
83
  if (hasAbortEvent && dirtyReason) {
77
- return {
84
+ return _objectSpread({
78
85
  isVCClean: false,
79
86
  dirtyReason: dirtyReason
80
- };
87
+ }, fg('platform_ufo_abort_timestamp_by_revision') ? {
88
+ abortTimestamp: abortTimestamp
89
+ } : {});
81
90
  }
82
91
  return {
83
92
  isVCClean: true
@@ -168,6 +168,8 @@ export interface InteractionMetrics {
168
168
  experimentalVC90?: number;
169
169
  unknownElementName?: string;
170
170
  unknownElementHierarchy?: string;
171
+ hold3pActive?: Map<string, HoldActive>;
172
+ hold3pInfo?: HoldInfo[];
171
173
  }
172
174
  export type LoadProfilerEventInfo = {
173
175
  identifier: string;
@@ -115,6 +115,7 @@ export type RevisionPayloadEntry = {
115
115
  vcDetails?: RevisionPayloadVCDetails;
116
116
  ratios?: VCRatioType;
117
117
  abortReason?: VCAbortReason | null;
118
+ abortTimestamp?: number;
118
119
  childrenIgnoredCount?: number;
119
120
  };
120
121
  export type RevisionPayload = RevisionPayloadEntry[];
@@ -0,0 +1,45 @@
1
+ import type { InteractionMetrics } from '../common';
2
+ declare function createInteractionExtraLogPayload(interactionId: string, interaction: InteractionMetrics): Promise<{
3
+ actionSubject: string;
4
+ action: string;
5
+ eventType: string;
6
+ source: string;
7
+ tags: string[];
8
+ attributes: {
9
+ properties: {
10
+ 'event:hostname': string;
11
+ 'event:product': string;
12
+ 'event:schema': string;
13
+ 'event:sizeInKb': number;
14
+ 'event:source': {
15
+ name: string;
16
+ version: string;
17
+ };
18
+ 'event:region': string;
19
+ 'experience:key': string;
20
+ 'experience:name': string;
21
+ interactionMetrics: {
22
+ namePrefix: string;
23
+ segmentPrefix: string;
24
+ interactionId: string;
25
+ pageVisibilityAtTTAI: import("../common/react-ufo-payload-schema").PageVisibility;
26
+ experimental__pageVisibilityAtTTAI: import("../common/react-ufo-payload-schema").PageVisibility | null;
27
+ rate: number;
28
+ routeName: string | null;
29
+ type: "page_load" | "transition";
30
+ abortReason: import("../common").AbortReasonType | undefined;
31
+ previousInteractionName: string | undefined;
32
+ isPreviousInteractionAborted: boolean;
33
+ abortedByInteractionName: string | undefined;
34
+ end: number;
35
+ start: number;
36
+ 'metric:ttai:3p': number | undefined;
37
+ ttvc: {
38
+ revision: string;
39
+ vc90: number;
40
+ }[];
41
+ };
42
+ };
43
+ };
44
+ } | null>;
45
+ export default createInteractionExtraLogPayload;
@@ -3,6 +3,7 @@ import { type ResourceTiming } from '../common/react-ufo-payload-schema';
3
3
  import * as ssr from '../ssr';
4
4
  import type { OptimizedLabelStack } from './common/types';
5
5
  import type { CriticalMetricsPayload } from './critical-metrics-payload/types';
6
+ export declare function getMoreAccuratePageVisibilityUpToTTAI(interaction: InteractionMetrics): import("../common/react-ufo-payload-schema").PageVisibility;
6
7
  export declare function createPayloads(interactionId: string, interaction: InteractionMetrics): Promise<(CriticalMetricsPayload | {
7
8
  actionSubject: string;
8
9
  action: string;
@@ -1,6 +1,6 @@
1
1
  import { type InteractionMetrics } from '../../common';
2
2
  import type { VCResult } from '../../common/vc/types';
3
- declare function getVCMetrics(interaction: InteractionMetrics): Promise<VCResult & {
3
+ declare function getVCMetrics(interaction: InteractionMetrics, include3p?: boolean): Promise<VCResult & {
4
4
  'metric:vc90'?: number | null;
5
5
  }>;
6
6
  export default getVCMetrics;
@@ -2,9 +2,11 @@ import type { AbortReasonType, ApdexType, BM3Event, CustomData, CustomTiming, In
2
2
  import { type TraceIdContext } from '../experience-trace-id-context';
3
3
  import { type FeatureFlagValue } from '../feature-flags-accessed';
4
4
  import type { LabelStack } from '../interaction-context';
5
+ import InteractionExtraMetrics from './interaction-extra-metrics';
5
6
  import PostInteractionLog from './post-interaction-log';
6
7
  export type { InteractionMetrics, LifecycleMarkType, Span, Mark, MarkType, InteractionType, AbortReasonType, ReactProfilerTiming, RequestInfo, ApdexType, CustomData, CustomTiming, InteractionError, };
7
8
  export declare const postInteractionLog: PostInteractionLog;
9
+ export declare const interactionExtraMetrics: InteractionExtraMetrics;
8
10
  export declare const segmentUnmountCache: Map<string, number>;
9
11
  export declare function getActiveInteraction(): InteractionMetrics | undefined;
10
12
  export declare const getPerformanceObserver: () => PerformanceObserver;
@@ -0,0 +1,17 @@
1
+ import type { VCObserverInterface, VCObserverOptions } from '../vc/types';
2
+ import { type InteractionMetrics } from './index';
3
+ export default class InteractionExtraMetrics {
4
+ finishedInteractionId: string | null;
5
+ vcObserver: VCObserverInterface | null;
6
+ private sinkHandlerFn;
7
+ initializeVCObserver(options: VCObserverOptions): void;
8
+ startVCObserver({ startTime }: {
9
+ startTime: number;
10
+ }, interactionId: string): void;
11
+ stopVCObserver(): void;
12
+ eligibleToMeasure(interactionId: string): boolean;
13
+ updateFinishedInteractionId(interactionId: string): void;
14
+ sinkHandler(fn: (interactionId: string, interaction: InteractionMetrics) => void | Promise<void>): void;
15
+ onInteractionComplete(id: string, data: InteractionMetrics): void;
16
+ reset(): void;
17
+ }
@@ -11,6 +11,7 @@ export type GetVCResultType = {
11
11
  experienceKey: string;
12
12
  interactionId?: string;
13
13
  includeSSRRatio?: boolean;
14
+ include3p?: boolean;
14
15
  };
15
16
  export type SelectorConfig = {
16
17
  id: boolean;
@@ -18,6 +18,7 @@ export interface VCRevisionDebugDetails {
18
18
  revision: string;
19
19
  isClean: boolean;
20
20
  abortReason?: VCAbortReason | null;
21
+ abortTimestamp?: number;
21
22
  vcLogs: VCLogEntry[];
22
23
  interactionId?: string;
23
24
  }