@atlaskit/react-ufo 5.5.3 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 5.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`165ad4e461379`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/165ad4e461379) -
8
+ Allow sending custom.interaction-extra-metrics payload when 3P-inclusive VC is dirty behind
9
+ platform_ufo_send_extra_metrics_on_dirty_vc feature gate. Adds vcClean and vcAbortReason fields to
10
+ the payload properties.
11
+
12
+ ## 5.5.4
13
+
14
+ ### Patch Changes
15
+
16
+ - [`fe2db5c510193`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fe2db5c510193) -
17
+ Clean up feature gate platform_ufo_exclude_3p_elements_from_ttvc - gate always evaluates to true
18
+
3
19
  ## 5.5.3
4
20
 
5
21
  ### Patch Changes
@@ -36,8 +36,8 @@ function createInteractionExtraLogPayload(_x, _x2, _x3, _x4) {
36
36
  }
37
37
  function _createInteractionExtraLogPayload() {
38
38
  _createInteractionExtraLogPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
39
- var _getTTAI, _getMostRecentVCRevis, _lastInteractionFinis, _getTTAI2, _window$location;
40
- var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, _config, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveRevision, effectiveVCRevisionPayload, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
39
+ var _getTTAI, _getMostRecentVCRevis, _effectiveVCRevisionP, _effectiveVCRevisionP2, _lastInteractionFinis, _getTTAI2, _window$location;
40
+ var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, _config, pageVisibilityAtTTAI, isPageLoad, hasMinorInteractions, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveRevision, effectiveVCRevisionPayload, isVCCleanFor3p, vcAbortReasonFor3p, allowDirtyVC, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, _effectiveVCRevisionP3, _effectiveVCRevisionP4, 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:
@@ -70,19 +70,26 @@ function _createInteractionExtraLogPayload() {
70
70
  case 12:
71
71
  pageVisibilityAtTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
72
72
  isPageLoad = type === 'page_load' || type === 'transition';
73
- if (!(!isPageLoad || minorInteractions !== undefined && minorInteractions.length > 0)) {
74
- _context.next = 16;
73
+ hasMinorInteractions = minorInteractions !== undefined && minorInteractions.length > 0;
74
+ if (isPageLoad) {
75
+ _context.next = 17;
75
76
  break;
76
77
  }
77
78
  return _context.abrupt("return", null);
78
- case 16:
79
+ case 17:
80
+ if (!(hasMinorInteractions && !(0, _platformFeatureFlags.fg)('platform_ufo_send_extra_metrics_on_dirty_vc'))) {
81
+ _context.next = 19;
82
+ break;
83
+ }
84
+ return _context.abrupt("return", null);
85
+ case 19:
79
86
  calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
80
87
  moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? (0, _getMoreAccuratePageVisibilityUpToTtai.getMoreAccuratePageVisibilityUpToTTAI)(interaction) : null;
81
88
  extraTTAI = (_getTTAI = (0, _getTtai.default)(interaction)) !== null && _getTTAI !== void 0 ? _getTTAI : undefined;
82
89
  newUFOName = (0, _utils.sanitizeUfoName)(ufoName);
83
- _context.next = 22;
90
+ _context.next = 25;
84
91
  return (0, _getVcMetrics.default)(interaction, true);
85
- case 22:
92
+ case 25:
86
93
  finalVCMetrics = _context.sent;
87
94
  // Check if VC is clean and has valid metric
88
95
  vcRevisionPayload = finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev'];
@@ -91,25 +98,53 @@ function _createInteractionExtraLogPayload() {
91
98
  var revision = _ref.revision;
92
99
  return revision === effectiveRevision;
93
100
  });
94
- if (!(!(effectiveVCRevisionPayload !== null && effectiveVCRevisionPayload !== void 0 && effectiveVCRevisionPayload.clean) || (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number' || extraTTAI === undefined || typeof extraTTAI !== 'number' || interaction.errors.length > 0)) {
95
- _context.next = 28;
101
+ isVCCleanFor3p = (_effectiveVCRevisionP = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP !== void 0 ? _effectiveVCRevisionP : false;
102
+ vcAbortReasonFor3p = (_effectiveVCRevisionP2 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.abortReason) !== null && _effectiveVCRevisionP2 !== void 0 ? _effectiveVCRevisionP2 : undefined;
103
+ allowDirtyVC = (0, _platformFeatureFlags.fg)('platform_ufo_send_extra_metrics_on_dirty_vc'); // Always require valid TTAI
104
+ if (!(extraTTAI === undefined || typeof extraTTAI !== 'number')) {
105
+ _context.next = 34;
106
+ break;
107
+ }
108
+ return _context.abrupt("return", null);
109
+ case 34:
110
+ if (!(interaction.errors.length > 0 && !(0, _platformFeatureFlags.fg)('platform_ufo_send_extra_metrics_on_dirty_vc'))) {
111
+ _context.next = 36;
112
+ break;
113
+ }
114
+ return _context.abrupt("return", null);
115
+ case 36:
116
+ if (!isVCCleanFor3p) {
117
+ _context.next = 41;
118
+ break;
119
+ }
120
+ if (!((effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number')) {
121
+ _context.next = 39;
96
122
  break;
97
123
  }
98
124
  return _context.abrupt("return", null);
99
- case 28:
125
+ case 39:
126
+ _context.next = 43;
127
+ break;
128
+ case 41:
129
+ if (allowDirtyVC) {
130
+ _context.next = 43;
131
+ break;
132
+ }
133
+ return _context.abrupt("return", null);
134
+ case 43:
100
135
  if (!(!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length)) {
101
- _context.next = 30;
136
+ _context.next = 45;
102
137
  break;
103
138
  }
104
139
  return _context.abrupt("return", null);
105
- case 30:
140
+ case 45:
106
141
  normalTTAI = (_getTTAI2 = (0, _getTtai.default)(lastInteractionFinish)) !== null && _getTTAI2 !== void 0 ? _getTTAI2 : undefined;
107
142
  lastInteractionFinishStart = typeof lastInteractionFinish.start === 'number' ? Math.round(lastInteractionFinish.start) : undefined;
108
143
  lastInteractionFinishEnd = typeof lastInteractionFinish.end === 'number' ? Math.round(lastInteractionFinish.end) : undefined;
109
144
  lastInteractionFinishVC90 = null;
110
145
  lastInteractionFinishVCClean = false;
111
146
  if (!lastInteractionFinishVCResult) {
112
- _context.next = 46;
147
+ _context.next = 62;
113
148
  break;
114
149
  }
115
150
  lastInteractionFinishVCRev = lastInteractionFinishVCResult['ufo:vc:rev'];
@@ -118,25 +153,29 @@ function _createInteractionExtraLogPayload() {
118
153
  return revision === effectiveRevision;
119
154
  });
120
155
  if (!(lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean)) {
121
- _context.next = 43;
156
+ _context.next = 58;
122
157
  break;
123
158
  }
124
159
  lastInteractionFinishVCClean = true;
125
160
  lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
126
- _context.next = 44;
161
+ _context.next = 60;
127
162
  break;
128
- case 43:
163
+ case 58:
164
+ if (allowDirtyVC) {
165
+ _context.next = 60;
166
+ break;
167
+ }
129
168
  return _context.abrupt("return", null);
130
- case 44:
131
- _context.next = 47;
169
+ case 60:
170
+ _context.next = 63;
132
171
  break;
133
- case 46:
172
+ case 62:
134
173
  if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
135
174
  // Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
136
- lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
137
- lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
175
+ lastInteractionFinishVC90 = (_effectiveVCRevisionP3 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== null && _effectiveVCRevisionP3 !== void 0 ? _effectiveVCRevisionP3 : null;
176
+ lastInteractionFinishVCClean = (_effectiveVCRevisionP4 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP4 !== void 0 ? _effectiveVCRevisionP4 : false;
138
177
  }
139
- case 47:
178
+ case 63:
140
179
  // Helper function to check if labelStack contains third-party type
141
180
  isThirdParty = function isThirdParty(labelStack) {
142
181
  var _labelStack$some;
@@ -204,7 +243,7 @@ function _createInteractionExtraLogPayload() {
204
243
  source: 'measured',
205
244
  tags: ['observability'],
206
245
  attributes: {
207
- properties: {
246
+ properties: _objectSpread(_objectSpread({
208
247
  // basic
209
248
  'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
210
249
  'event:product': config.product,
@@ -242,6 +281,12 @@ function _createInteractionExtraLogPayload() {
242
281
  reactProfilerTimings: (0, _optimizeReactProfilerTimings.optimizeReactProfilerTimings)(filteredData.reactProfilerTimings, start, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type)),
243
282
  customData: filteredData.customData
244
283
  }, getDetailedInteractionMetrics()),
284
+ vcClean: isVCCleanFor3p
285
+ }, vcAbortReasonFor3p !== undefined && {
286
+ vcAbortReason: vcAbortReasonFor3p
287
+ }), {}, {
288
+ hasMinorInteractions: hasMinorInteractions,
289
+ hasErrors: interaction.errors.length > 0,
245
290
  'vc:effective:revision': effectiveRevision,
246
291
  lastInteractionFinish: {
247
292
  start: lastInteractionFinishStart,
@@ -250,12 +295,12 @@ function _createInteractionExtraLogPayload() {
250
295
  vc90: lastInteractionFinishVC90,
251
296
  vcClean: lastInteractionFinishVCClean
252
297
  }
253
- }
298
+ })
254
299
  }
255
300
  };
256
301
  payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
257
302
  return _context.abrupt("return", payload);
258
- case 56:
303
+ case 72:
259
304
  case "end":
260
305
  return _context.stop();
261
306
  }
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.containsDnDMutationInStyle = containsDnDMutationInStyle;
7
7
  exports.default = void 0;
8
8
  exports.isDnDStyleMutation = isDnDStyleMutation;
9
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
9
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
11
10
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
11
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -48,9 +47,6 @@ function isDnDStyleMutation(_ref) {
48
47
  attributeName = _ref.attributeName,
49
48
  oldValue = _ref.oldValue,
50
49
  newValue = _ref.newValue;
51
- if (!(0, _platformFeatureFlags.fg)('platform_editor_exclude_dnd_anchor_name_from_ttvc')) {
52
- return false;
53
- }
54
50
  if (!(target instanceof Element)) {
55
51
  return false;
56
52
  }
@@ -24,9 +24,8 @@ var REVISION_NO = 'fy25.03';
24
24
  var getConsideredEntryTypes = function getConsideredEntryTypes(include3p, excludeSmartAnswersInSearch) {
25
25
  var entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'layout-shift:same-rect', 'window:event'];
26
26
 
27
- // If not exclude 3p elements from ttvc,
28
- // including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
29
- if (!(0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_elements_from_ttvc') || include3p) {
27
+ // Only include third-party elements in TTVC calculation when explicitly requested
28
+ if (include3p) {
30
29
  entryTypes.push('mutation:third-party-element');
31
30
  entryTypes.push('mutation:third-party-attribute');
32
31
  }
@@ -17,7 +17,7 @@ import { optimizeRequestInfo } from '../create-payload/utils/optimize-request-in
17
17
  import { optimizeSpans } from '../create-payload/utils/optimize-spans';
18
18
  import { interactionSpans as atlaskitInteractionSpans } from '../interaction-metrics';
19
19
  async function createInteractionExtraLogPayload(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
20
- var _getTTAI, _getMostRecentVCRevis, _lastInteractionFinis, _getTTAI2, _window$location;
20
+ var _getTTAI, _getMostRecentVCRevis, _effectiveVCRevisionP, _effectiveVCRevisionP2, _lastInteractionFinis, _getTTAI2, _window$location;
21
21
  const config = getConfig();
22
22
  if (!config) {
23
23
  throw Error('UFO Configuration not provided');
@@ -49,9 +49,13 @@ async function createInteractionExtraLogPayload(interactionId, interaction, last
49
49
  }
50
50
  const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
51
51
  const isPageLoad = type === 'page_load' || type === 'transition';
52
- if (!isPageLoad || minorInteractions !== undefined && minorInteractions.length > 0) {
53
- // Not send if aborted by minor interaction for now
54
- // Only create payload for page load
52
+ const hasMinorInteractions = minorInteractions !== undefined && minorInteractions.length > 0;
53
+ if (!isPageLoad) {
54
+ // Only create payload for page load or transition
55
+ return null;
56
+ }
57
+ if (hasMinorInteractions && !fg('platform_ufo_send_extra_metrics_on_dirty_vc')) {
58
+ // Not send if aborted by minor interaction, unless feature gate is on
55
59
  return null;
56
60
  }
57
61
  const calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
@@ -66,9 +70,29 @@ async function createInteractionExtraLogPayload(interactionId, interaction, last
66
70
  const effectiveVCRevisionPayload = vcRevisionPayload === null || vcRevisionPayload === void 0 ? void 0 : vcRevisionPayload.find(({
67
71
  revision
68
72
  }) => revision === effectiveRevision);
69
- if (!(effectiveVCRevisionPayload !== null && effectiveVCRevisionPayload !== void 0 && effectiveVCRevisionPayload.clean) || (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number' || extraTTAI === undefined || typeof extraTTAI !== 'number' || interaction.errors.length > 0) {
73
+ const isVCCleanFor3p = (_effectiveVCRevisionP = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP !== void 0 ? _effectiveVCRevisionP : false;
74
+ const vcAbortReasonFor3p = (_effectiveVCRevisionP2 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.abortReason) !== null && _effectiveVCRevisionP2 !== void 0 ? _effectiveVCRevisionP2 : undefined;
75
+ const allowDirtyVC = fg('platform_ufo_send_extra_metrics_on_dirty_vc');
76
+
77
+ // Always require valid TTAI
78
+ if (extraTTAI === undefined || typeof extraTTAI !== 'number') {
79
+ return null;
80
+ }
81
+
82
+ // When feature gate is off, require no errors; when on, allow errors through
83
+ if (interaction.errors.length > 0 && !fg('platform_ufo_send_extra_metrics_on_dirty_vc')) {
84
+ return null;
85
+ }
86
+ if (isVCCleanFor3p) {
87
+ // When VC is clean, require a valid vc90 metric
88
+ if ((effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number') {
89
+ return null;
90
+ }
91
+ } else if (!allowDirtyVC) {
92
+ // When VC is dirty and feature gate is off, preserve existing behavior
70
93
  return null;
71
94
  }
95
+ // When VC is dirty and feature gate is on, continue to send payload
72
96
 
73
97
  // Get normal TTAI & VC90 for last finished interaction (without 3p)
74
98
  if (!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length) {
@@ -87,13 +111,14 @@ async function createInteractionExtraLogPayload(interactionId, interaction, last
87
111
  if (lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean) {
88
112
  lastInteractionFinishVCClean = true;
89
113
  lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
90
- } else {
114
+ } else if (!allowDirtyVC) {
91
115
  return null;
92
116
  }
93
117
  } else if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
118
+ var _effectiveVCRevisionP3, _effectiveVCRevisionP4;
94
119
  // Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
95
- lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
96
- lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
120
+ lastInteractionFinishVC90 = (_effectiveVCRevisionP3 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== null && _effectiveVCRevisionP3 !== void 0 ? _effectiveVCRevisionP3 : null;
121
+ lastInteractionFinishVCClean = (_effectiveVCRevisionP4 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP4 !== void 0 ? _effectiveVCRevisionP4 : false;
97
122
  }
98
123
 
99
124
  // Helper function to check if labelStack contains third-party type
@@ -183,6 +208,12 @@ async function createInteractionExtraLogPayload(interactionId, interaction, last
183
208
  customData: filteredData.customData,
184
209
  ...getDetailedInteractionMetrics()
185
210
  },
211
+ vcClean: isVCCleanFor3p,
212
+ ...(vcAbortReasonFor3p !== undefined && {
213
+ vcAbortReason: vcAbortReasonFor3p
214
+ }),
215
+ hasMinorInteractions,
216
+ hasErrors: interaction.errors.length > 0,
186
217
  'vc:effective:revision': effectiveRevision,
187
218
  lastInteractionFinish: {
188
219
  start: lastInteractionFinishStart,
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  const isDnDStyleChange = style => {
3
2
  return style.startsWith('anchor-name: --node-anchor');
4
3
  };
@@ -29,9 +28,6 @@ function isDnDStyleMutation({
29
28
  oldValue,
30
29
  newValue
31
30
  }) {
32
- if (!fg('platform_editor_exclude_dnd_anchor_name_from_ttvc')) {
33
- return false;
34
- }
35
31
  if (!(target instanceof Element)) {
36
32
  return false;
37
33
  }
@@ -10,9 +10,8 @@ const REVISION_NO = 'fy25.03';
10
10
  const getConsideredEntryTypes = (include3p, excludeSmartAnswersInSearch) => {
11
11
  const entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'layout-shift:same-rect', 'window:event'];
12
12
 
13
- // If not exclude 3p elements from ttvc,
14
- // including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
15
- if (!fg('platform_ufo_exclude_3p_elements_from_ttvc') || include3p) {
13
+ // Only include third-party elements in TTVC calculation when explicitly requested
14
+ if (include3p) {
16
15
  entryTypes.push('mutation:third-party-element');
17
16
  entryTypes.push('mutation:third-party-attribute');
18
17
  }
@@ -29,8 +29,8 @@ function createInteractionExtraLogPayload(_x, _x2, _x3, _x4) {
29
29
  }
30
30
  function _createInteractionExtraLogPayload() {
31
31
  _createInteractionExtraLogPayload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
32
- var _getTTAI, _getMostRecentVCRevis, _lastInteractionFinis, _getTTAI2, _window$location;
33
- var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, _config, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveRevision, effectiveVCRevisionPayload, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
32
+ var _getTTAI, _getMostRecentVCRevis, _effectiveVCRevisionP, _effectiveVCRevisionP2, _lastInteractionFinis, _getTTAI2, _window$location;
33
+ var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, _config, pageVisibilityAtTTAI, isPageLoad, hasMinorInteractions, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveRevision, effectiveVCRevisionPayload, isVCCleanFor3p, vcAbortReasonFor3p, allowDirtyVC, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, _effectiveVCRevisionP3, _effectiveVCRevisionP4, 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:
@@ -63,19 +63,26 @@ function _createInteractionExtraLogPayload() {
63
63
  case 12:
64
64
  pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
65
65
  isPageLoad = type === 'page_load' || type === 'transition';
66
- if (!(!isPageLoad || minorInteractions !== undefined && minorInteractions.length > 0)) {
67
- _context.next = 16;
66
+ hasMinorInteractions = minorInteractions !== undefined && minorInteractions.length > 0;
67
+ if (isPageLoad) {
68
+ _context.next = 17;
68
69
  break;
69
70
  }
70
71
  return _context.abrupt("return", null);
71
- case 16:
72
+ case 17:
73
+ if (!(hasMinorInteractions && !fg('platform_ufo_send_extra_metrics_on_dirty_vc'))) {
74
+ _context.next = 19;
75
+ break;
76
+ }
77
+ return _context.abrupt("return", null);
78
+ case 19:
72
79
  calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
73
80
  moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? getMoreAccuratePageVisibilityUpToTTAI(interaction) : null;
74
81
  extraTTAI = (_getTTAI = getTTAI(interaction)) !== null && _getTTAI !== void 0 ? _getTTAI : undefined;
75
82
  newUFOName = sanitizeUfoName(ufoName);
76
- _context.next = 22;
83
+ _context.next = 25;
77
84
  return getVCMetrics(interaction, true);
78
- case 22:
85
+ case 25:
79
86
  finalVCMetrics = _context.sent;
80
87
  // Check if VC is clean and has valid metric
81
88
  vcRevisionPayload = finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev'];
@@ -84,25 +91,53 @@ function _createInteractionExtraLogPayload() {
84
91
  var revision = _ref.revision;
85
92
  return revision === effectiveRevision;
86
93
  });
87
- if (!(!(effectiveVCRevisionPayload !== null && effectiveVCRevisionPayload !== void 0 && effectiveVCRevisionPayload.clean) || (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number' || extraTTAI === undefined || typeof extraTTAI !== 'number' || interaction.errors.length > 0)) {
88
- _context.next = 28;
94
+ isVCCleanFor3p = (_effectiveVCRevisionP = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP !== void 0 ? _effectiveVCRevisionP : false;
95
+ vcAbortReasonFor3p = (_effectiveVCRevisionP2 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.abortReason) !== null && _effectiveVCRevisionP2 !== void 0 ? _effectiveVCRevisionP2 : undefined;
96
+ allowDirtyVC = fg('platform_ufo_send_extra_metrics_on_dirty_vc'); // Always require valid TTAI
97
+ if (!(extraTTAI === undefined || typeof extraTTAI !== 'number')) {
98
+ _context.next = 34;
99
+ break;
100
+ }
101
+ return _context.abrupt("return", null);
102
+ case 34:
103
+ if (!(interaction.errors.length > 0 && !fg('platform_ufo_send_extra_metrics_on_dirty_vc'))) {
104
+ _context.next = 36;
105
+ break;
106
+ }
107
+ return _context.abrupt("return", null);
108
+ case 36:
109
+ if (!isVCCleanFor3p) {
110
+ _context.next = 41;
111
+ break;
112
+ }
113
+ if (!((effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number')) {
114
+ _context.next = 39;
89
115
  break;
90
116
  }
91
117
  return _context.abrupt("return", null);
92
- case 28:
118
+ case 39:
119
+ _context.next = 43;
120
+ break;
121
+ case 41:
122
+ if (allowDirtyVC) {
123
+ _context.next = 43;
124
+ break;
125
+ }
126
+ return _context.abrupt("return", null);
127
+ case 43:
93
128
  if (!(!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length)) {
94
- _context.next = 30;
129
+ _context.next = 45;
95
130
  break;
96
131
  }
97
132
  return _context.abrupt("return", null);
98
- case 30:
133
+ case 45:
99
134
  normalTTAI = (_getTTAI2 = getTTAI(lastInteractionFinish)) !== null && _getTTAI2 !== void 0 ? _getTTAI2 : undefined;
100
135
  lastInteractionFinishStart = typeof lastInteractionFinish.start === 'number' ? Math.round(lastInteractionFinish.start) : undefined;
101
136
  lastInteractionFinishEnd = typeof lastInteractionFinish.end === 'number' ? Math.round(lastInteractionFinish.end) : undefined;
102
137
  lastInteractionFinishVC90 = null;
103
138
  lastInteractionFinishVCClean = false;
104
139
  if (!lastInteractionFinishVCResult) {
105
- _context.next = 46;
140
+ _context.next = 62;
106
141
  break;
107
142
  }
108
143
  lastInteractionFinishVCRev = lastInteractionFinishVCResult['ufo:vc:rev'];
@@ -111,25 +146,29 @@ function _createInteractionExtraLogPayload() {
111
146
  return revision === effectiveRevision;
112
147
  });
113
148
  if (!(lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean)) {
114
- _context.next = 43;
149
+ _context.next = 58;
115
150
  break;
116
151
  }
117
152
  lastInteractionFinishVCClean = true;
118
153
  lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
119
- _context.next = 44;
154
+ _context.next = 60;
120
155
  break;
121
- case 43:
156
+ case 58:
157
+ if (allowDirtyVC) {
158
+ _context.next = 60;
159
+ break;
160
+ }
122
161
  return _context.abrupt("return", null);
123
- case 44:
124
- _context.next = 47;
162
+ case 60:
163
+ _context.next = 63;
125
164
  break;
126
- case 46:
165
+ case 62:
127
166
  if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
128
167
  // Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
129
- lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
130
- lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
168
+ lastInteractionFinishVC90 = (_effectiveVCRevisionP3 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== null && _effectiveVCRevisionP3 !== void 0 ? _effectiveVCRevisionP3 : null;
169
+ lastInteractionFinishVCClean = (_effectiveVCRevisionP4 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP4 !== void 0 ? _effectiveVCRevisionP4 : false;
131
170
  }
132
- case 47:
171
+ case 63:
133
172
  // Helper function to check if labelStack contains third-party type
134
173
  isThirdParty = function isThirdParty(labelStack) {
135
174
  var _labelStack$some;
@@ -197,7 +236,7 @@ function _createInteractionExtraLogPayload() {
197
236
  source: 'measured',
198
237
  tags: ['observability'],
199
238
  attributes: {
200
- properties: {
239
+ properties: _objectSpread(_objectSpread({
201
240
  // basic
202
241
  'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
203
242
  'event:product': config.product,
@@ -235,6 +274,12 @@ function _createInteractionExtraLogPayload() {
235
274
  reactProfilerTimings: optimizeReactProfilerTimings(filteredData.reactProfilerTimings, start, getReactUFOPayloadVersion(interaction.type)),
236
275
  customData: filteredData.customData
237
276
  }, getDetailedInteractionMetrics()),
277
+ vcClean: isVCCleanFor3p
278
+ }, vcAbortReasonFor3p !== undefined && {
279
+ vcAbortReason: vcAbortReasonFor3p
280
+ }), {}, {
281
+ hasMinorInteractions: hasMinorInteractions,
282
+ hasErrors: interaction.errors.length > 0,
238
283
  'vc:effective:revision': effectiveRevision,
239
284
  lastInteractionFinish: {
240
285
  start: lastInteractionFinishStart,
@@ -243,12 +288,12 @@ function _createInteractionExtraLogPayload() {
243
288
  vc90: lastInteractionFinishVC90,
244
289
  vcClean: lastInteractionFinishVCClean
245
290
  }
246
- }
291
+ })
247
292
  }
248
293
  };
249
294
  payload.attributes.properties['event:sizeInKb'] = getPayloadSize(payload.attributes.properties);
250
295
  return _context.abrupt("return", payload);
251
- case 56:
296
+ case 72:
252
297
  case "end":
253
298
  return _context.stop();
254
299
  }
@@ -1,7 +1,6 @@
1
1
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2
2
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
3
3
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  var isDnDStyleChange = function isDnDStyleChange(style) {
6
5
  return style.startsWith('anchor-name: --node-anchor');
7
6
  };
@@ -40,9 +39,6 @@ function isDnDStyleMutation(_ref) {
40
39
  attributeName = _ref.attributeName,
41
40
  oldValue = _ref.oldValue,
42
41
  newValue = _ref.newValue;
43
- if (!fg('platform_editor_exclude_dnd_anchor_name_from_ttvc')) {
44
- return false;
45
- }
46
42
  if (!(target instanceof Element)) {
47
43
  return false;
48
44
  }
@@ -17,9 +17,8 @@ var REVISION_NO = 'fy25.03';
17
17
  var getConsideredEntryTypes = function getConsideredEntryTypes(include3p, excludeSmartAnswersInSearch) {
18
18
  var entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'layout-shift:same-rect', 'window:event'];
19
19
 
20
- // If not exclude 3p elements from ttvc,
21
- // including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
22
- if (!fg('platform_ufo_exclude_3p_elements_from_ttvc') || include3p) {
20
+ // Only include third-party elements in TTVC calculation when explicitly requested
21
+ if (include3p) {
23
22
  entryTypes.push('mutation:third-party-element');
24
23
  entryTypes.push('mutation:third-party-attribute');
25
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "5.5.3",
3
+ "version": "5.6.0",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -113,9 +113,6 @@
113
113
  "ufo_fix_aborting_interaction_detection_during_ssr": {
114
114
  "type": "boolean"
115
115
  },
116
- "platform_ufo_exclude_3p_elements_from_ttvc": {
117
- "type": "boolean"
118
- },
119
116
  "platform_ufo_segment_critical_metrics": {
120
117
  "type": "boolean"
121
118
  },
@@ -137,9 +134,6 @@
137
134
  "platform_ufo_filter_cls_logs_same_rects_positions": {
138
135
  "type": "boolean"
139
136
  },
140
- "platform_editor_exclude_dnd_anchor_name_from_ttvc": {
141
- "type": "boolean"
142
- },
143
137
  "platform_ufo_ssr_render_profiler": {
144
138
  "type": "boolean"
145
139
  },
@@ -205,6 +199,9 @@
205
199
  },
206
200
  "platform_ufo_fix_abort_timestamp_raw_data": {
207
201
  "type": "boolean"
202
+ },
203
+ "platform_ufo_send_extra_metrics_on_dirty_vc": {
204
+ "type": "boolean"
208
205
  }
209
206
  }
210
207
  }