@atlaskit/react-ufo 4.4.2 → 4.4.4

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 (66) hide show
  1. package/CHANGELOG.md +18 -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 +306 -232
  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/trace-interaction/internal/trace-ufo-interaction.js +3 -8
  11. package/dist/cjs/vc/index.js +4 -3
  12. package/dist/cjs/vc/vc-observer/index.js +3 -46
  13. package/dist/cjs/vc/vc-observer-new/index.js +4 -3
  14. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +3 -3
  15. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +4 -4
  16. package/dist/es2019/create-interaction-extra-metrics-payload/index.js +93 -0
  17. package/dist/es2019/create-payload/index.js +3 -3
  18. package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -2
  19. package/dist/es2019/interaction-metrics/index.js +310 -233
  20. package/dist/es2019/interaction-metrics/interaction-extra-metrics.js +63 -0
  21. package/dist/es2019/interaction-metrics-init/index.js +29 -2
  22. package/dist/es2019/segment/third-party-segment.js +3 -1
  23. package/dist/es2019/ssr/index.js +3 -2
  24. package/dist/es2019/trace-interaction/internal/trace-ufo-interaction.js +3 -8
  25. package/dist/es2019/vc/index.js +4 -2
  26. package/dist/es2019/vc/vc-observer/index.js +0 -43
  27. package/dist/es2019/vc/vc-observer-new/index.js +4 -2
  28. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +3 -2
  29. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +4 -4
  30. package/dist/esm/create-interaction-extra-metrics-payload/index.js +109 -0
  31. package/dist/esm/create-payload/index.js +3 -3
  32. package/dist/esm/create-payload/utils/get-vc-metrics.js +37 -21
  33. package/dist/esm/interaction-metrics/index.js +305 -231
  34. package/dist/esm/interaction-metrics/interaction-extra-metrics.js +83 -0
  35. package/dist/esm/interaction-metrics-init/index.js +48 -6
  36. package/dist/esm/segment/third-party-segment.js +3 -1
  37. package/dist/esm/ssr/index.js +3 -2
  38. package/dist/esm/trace-interaction/internal/trace-ufo-interaction.js +3 -8
  39. package/dist/esm/vc/index.js +4 -3
  40. package/dist/esm/vc/vc-observer/index.js +3 -46
  41. package/dist/esm/vc/vc-observer-new/index.js +4 -3
  42. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +3 -3
  43. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +4 -4
  44. package/dist/types/common/common/types.d.ts +2 -0
  45. package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +45 -0
  46. package/dist/types/create-payload/index.d.ts +1 -0
  47. package/dist/types/create-payload/utils/get-vc-metrics.d.ts +1 -1
  48. package/dist/types/interaction-metrics/index.d.ts +2 -0
  49. package/dist/types/interaction-metrics/interaction-extra-metrics.d.ts +17 -0
  50. package/dist/types/vc/types.d.ts +1 -0
  51. package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
  52. package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
  53. package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  54. package/dist/types/vc/vc-observer-new/types.d.ts +1 -0
  55. package/dist/types-ts4.5/common/common/types.d.ts +2 -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-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
  63. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
  64. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
  65. package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -0
  66. package/package.json +4 -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
  }
@@ -1,5 +1,4 @@
1
1
  import { v4 as createUUID } from 'uuid';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import coinflip from '../../coinflip';
4
3
  import { getDoNotAbortActivePressInteraction, getInteractionRate } from '../../config';
5
4
  import { getActiveTrace, setInteractionActiveTrace } from '../../experience-trace-id-context';
@@ -15,15 +14,11 @@ function traceUFOInteraction(name, interactionType, startTime) {
15
14
  return;
16
15
  }
17
16
  } else {
18
- if (fg('platform_ufo_abort_measurement_fix')) {
19
- // abort any existing interaction regardless if the next interaction's coinflip returns true or false
20
- abortAll('new_interaction', name);
21
- }
17
+ // Abort any existing interaction regardless of the coinflip outcome
18
+ // Ensures measurements are not carried over between distinct interactions
19
+ abortAll('new_interaction', name);
22
20
  }
23
21
  if (coinflip(rate)) {
24
- if (!fg('platform_ufo_abort_measurement_fix')) {
25
- abortAll('new_interaction', name);
26
- }
27
22
  var startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
28
23
  var newId = createUUID();
29
24
  DefaultInteractionID.current = newId;
@@ -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;
@@ -9,7 +9,6 @@ var _excluded = ["__debug__element"];
9
9
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  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; }
11
11
  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; }
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import { isVCRevisionEnabled } from '../../config';
14
13
  import { getActiveInteraction } from '../../interaction-metrics';
15
14
  import { attachAbortListeners } from './attachAbortListeners';
@@ -172,48 +171,6 @@ export var VCObserver = /*#__PURE__*/function () {
172
171
  viewport: viewport,
173
172
  fixSSRAttribution: includeSSRRatio
174
173
  });
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
174
  outOfBoundary = outOfBoundaryInfo ? _defineProperty({}, "".concat(fullPrefix, "vc:oob"), outOfBoundaryInfo) : {}; //const oldDomUpdates = oldDomUpdatesEnabled ? { [`${fullPrefix}vc:old:dom`]: vcNext.VCBox } : {};
218
175
  stopTime = performance.now(); // exposing data to devtools
219
176
  try {
@@ -337,16 +294,16 @@ export var VCObserver = /*#__PURE__*/function () {
337
294
  SSRRatioNext = VCObserver.getSSRRatio(vcNext.VCEntries.rel, ssr);
338
295
  SSRRatioPayload = includeSSRRatio ? _defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:ssrRatio"), isTTVCv1Disabled ? SSRRatioNext : SSRRatio), "".concat(fullPrefix, "vc:next:ssrRatio"), SSRRatioNext) : {};
339
296
  if (!isTTVCv1Disabled) {
340
- _context.next = 30;
297
+ _context.next = 29;
341
298
  break;
342
299
  }
343
300
  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:
301
+ case 29:
345
302
  isTTVCv3Enabled = isVCRevisionEnabled('fy25.03', experienceKey);
346
303
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
347
304
  'metrics:vc': VC
348
305
  }, "".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:
306
+ case 31:
350
307
  case "end":
351
308
  return _context.stop();
352
309
  }
@@ -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;
@@ -10,12 +10,12 @@ import AbstractVCCalculatorBase from '../abstract-base-vc-calculator';
10
10
  import isViewportEntryData from '../utils/is-viewport-entry-data';
11
11
  var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
12
12
  var REVISION_NO = 'fy25.03';
13
- var getConsideredEntryTypes = function getConsideredEntryTypes() {
13
+ var getConsideredEntryTypes = function getConsideredEntryTypes(include3p) {
14
14
  var entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'window:event'];
15
15
 
16
16
  // If not exclude 3p elements from ttvc,
17
17
  // 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')) {
18
+ if (!fg('platform_ufo_exclude_3p_elements_from_ttvc') || include3p) {
19
19
  entryTypes.push('mutation:third-party-element');
20
20
  }
21
21
  if (fg('platform_ufo_enable_media_for_ttvc_v3')) {
@@ -39,8 +39,8 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
39
39
  _inherits(VCCalculator_FY25_03, _AbstractVCCalculator);
40
40
  return _createClass(VCCalculator_FY25_03, [{
41
41
  key: "isEntryIncluded",
42
- value: function isEntryIncluded(entry) {
43
- if (!getConsideredEntryTypes().includes(entry.data.type)) {
42
+ value: function isEntryIncluded(entry, include3p) {
43
+ if (!getConsideredEntryTypes(include3p).includes(entry.data.type)) {
44
44
  return false;
45
45
  }
46
46
  if (entry.data.type === 'mutation:attribute') {
@@ -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;
@@ -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;
@@ -11,7 +11,7 @@ declare global {
11
11
  export default abstract class AbstractVCCalculatorBase implements VCCalculator {
12
12
  private revisionNo;
13
13
  constructor(revisionNo: string);
14
- protected abstract isEntryIncluded(entry: VCObserverEntry): boolean;
14
+ protected abstract isEntryIncluded(entry: VCObserverEntry, include3p?: boolean): boolean;
15
15
  protected abstract getVCCleanStatus(filteredEntries: ReadonlyArray<VCObserverEntry>): {
16
16
  isVCClean: boolean;
17
17
  dirtyReason?: VCAbortReason;
@@ -22,5 +22,5 @@ export default abstract class AbstractVCCalculatorBase implements VCCalculator {
22
22
  */
23
23
  private calculateRatios;
24
24
  private calculateWithDebugInfo;
25
- calculate({ startTime, stopTime, orderedEntries, interactionId, isPostInteraction, }: VCCalculatorParam): Promise<RevisionPayloadEntry | undefined>;
25
+ calculate({ startTime, stopTime, orderedEntries, interactionId, isPostInteraction, include3p, }: VCCalculatorParam): Promise<RevisionPayloadEntry | undefined>;
26
26
  }
@@ -4,7 +4,7 @@ export declare const KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS: string[
4
4
  export declare const NON_VISUAL_ARIA_ATTRIBUTES: string[];
5
5
  export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
6
6
  constructor();
7
- protected isEntryIncluded(entry: VCObserverEntry): boolean;
7
+ protected isEntryIncluded(entry: VCObserverEntry, include3p?: boolean): boolean;
8
8
  protected getVCCleanStatus(filteredEntries: readonly VCObserverEntry[]): {
9
9
  isVCClean: boolean;
10
10
  dirtyReason: never;
@@ -6,6 +6,7 @@ export type VCCalculatorParam = {
6
6
  orderedEntries: ReadonlyArray<VCObserverEntry>;
7
7
  interactionId?: string;
8
8
  isPostInteraction: boolean;
9
+ include3p?: boolean;
9
10
  };
10
11
  export interface VCCalculator {
11
12
  calculate(param: VCCalculatorParam): Promise<RevisionPayloadEntry | undefined>;
@@ -23,4 +23,5 @@ export type VCObserverGetVCResultParam = {
23
23
  stop: number;
24
24
  interactionId?: string;
25
25
  ssr?: number;
26
+ include3p?: boolean;
26
27
  };
@@ -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;
@@ -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;