@atlaskit/react-ufo 4.4.6 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/create-interaction-extra-metrics-payload/index.js +30 -25
  3. package/dist/cjs/create-payload/index.js +1 -0
  4. package/dist/cjs/create-payload/utils/get-vc-metrics.js +4 -1
  5. package/dist/cjs/interaction-metrics/index.js +29 -35
  6. package/dist/cjs/interaction-metrics/interaction-extra-metrics.js +7 -0
  7. package/dist/cjs/interaction-metrics-init/index.js +7 -10
  8. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +7 -2
  9. package/dist/es2019/create-interaction-extra-metrics-payload/index.js +14 -15
  10. package/dist/es2019/create-payload/index.js +1 -1
  11. package/dist/es2019/create-payload/utils/get-vc-metrics.js +4 -1
  12. package/dist/es2019/interaction-metrics/index.js +30 -36
  13. package/dist/es2019/interaction-metrics/interaction-extra-metrics.js +5 -0
  14. package/dist/es2019/interaction-metrics-init/index.js +7 -10
  15. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +6 -1
  16. package/dist/esm/create-interaction-extra-metrics-payload/index.js +32 -27
  17. package/dist/esm/create-payload/index.js +1 -1
  18. package/dist/esm/create-payload/utils/get-vc-metrics.js +4 -1
  19. package/dist/esm/interaction-metrics/index.js +29 -35
  20. package/dist/esm/interaction-metrics/interaction-extra-metrics.js +7 -0
  21. package/dist/esm/interaction-metrics-init/index.js +7 -10
  22. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +6 -1
  23. package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +3 -4
  24. package/dist/types/create-payload/index.d.ts +2 -0
  25. package/dist/types/interaction-metrics/interaction-extra-metrics.d.ts +1 -0
  26. package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -0
  27. package/dist/types-ts4.5/create-interaction-extra-metrics-payload/index.d.ts +3 -4
  28. package/dist/types-ts4.5/create-payload/index.d.ts +2 -0
  29. package/dist/types-ts4.5/interaction-metrics/interaction-extra-metrics.d.ts +1 -0
  30. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -0
  31. package/package.json +4 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b0a4a5983f4e8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b0a4a5983f4e8) -
8
+ Update extra metrics onComplete logic and modify its payload
9
+
10
+ ## 4.5.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`2a4662d3e7eb5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2a4662d3e7eb5) -
15
+ fixing Grammarly extension name and adding common browser extensions to exclude list for TTVC
16
+
3
17
  ## 4.4.6
4
18
 
5
19
  ### Patch Changes
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
12
  var _coinflip = _interopRequireDefault(require("../coinflip"));
11
13
  var _config = require("../config");
12
14
  var _createPayload = require("../create-payload");
@@ -16,13 +18,15 @@ var _getPayloadSize = _interopRequireDefault(require("../create-payload/utils/ge
16
18
  var _getReactUfoPayloadVersion = require("../create-payload/utils/get-react-ufo-payload-version");
17
19
  var _getTtai = _interopRequireDefault(require("../create-payload/utils/get-ttai"));
18
20
  var _getVcMetrics = _interopRequireDefault(require("../create-payload/utils/get-vc-metrics"));
21
+ 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; }
22
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
23
  function createInteractionExtraLogPayload(_x, _x2) {
20
24
  return _createInteractionExtraLogPayload.apply(this, arguments);
21
25
  }
22
26
  function _createInteractionExtraLogPayload() {
23
27
  _createInteractionExtraLogPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interactionId, interaction) {
24
- var _getTTAI, _finalVCMetrics$ufoV, _window$location;
25
- var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, ttvc, payload;
28
+ var _getTTAI, _interaction$hold3pIn, _window$location;
29
+ var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, sanitisedUfoName, configRate, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, holdInfo, segments3p, segmentTree, payload;
26
30
  return _regenerator.default.wrap(function _callee$(_context) {
27
31
  while (1) switch (_context.prev = _context.next) {
28
32
  case 0:
@@ -33,41 +37,40 @@ function _createInteractionExtraLogPayload() {
33
37
  }
34
38
  throw Error('UFO Configuration not provided');
35
39
  case 3:
36
- end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName;
37
- configRate = (0, _config.getExtraInteractionRate)(ufoName, type);
40
+ end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, knownSegments = interaction.knownSegments;
41
+ sanitisedUfoName = (0, _utils.sanitizeUfoName)(ufoName);
42
+ configRate = (0, _config.getExtraInteractionRate)(sanitisedUfoName, type);
38
43
  if ((0, _coinflip.default)(configRate)) {
39
- _context.next = 7;
44
+ _context.next = 8;
40
45
  break;
41
46
  }
42
47
  return _context.abrupt("return", null);
43
- case 7:
48
+ case 8:
44
49
  pageVisibilityAtTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
45
50
  isPageLoad = type === 'page_load' || type === 'transition';
46
51
  if (isPageLoad) {
47
- _context.next = 11;
52
+ _context.next = 12;
48
53
  break;
49
54
  }
50
55
  return _context.abrupt("return", null);
51
- case 11:
56
+ case 12:
52
57
  calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
53
58
  moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? (0, _createPayload.getMoreAccuratePageVisibilityUpToTTAI)(interaction) : null;
54
59
  extraTTAI = (_getTTAI = (0, _getTtai.default)(interaction)) !== null && _getTTAI !== void 0 ? _getTTAI : undefined;
55
60
  newUFOName = (0, _utils.sanitizeUfoName)(ufoName);
56
- _context.next = 17;
61
+ _context.next = 18;
57
62
  return (0, _getVcMetrics.default)(interaction, true);
58
- case 17:
63
+ case 18:
59
64
  finalVCMetrics = _context.sent;
60
- ttvc = (_finalVCMetrics$ufoV = finalVCMetrics['ufo:vc:rev']) === null || _finalVCMetrics$ufoV === void 0 ? void 0 : _finalVCMetrics$ufoV.map(function (revision) {
61
- if (revision['metric:vc90'] === null || revision.clean !== true) {
62
- return null;
63
- }
64
- return {
65
- revision: revision.revision,
66
- vc90: revision['metric:vc90']
67
- };
68
- }).filter(function (revision) {
69
- return revision != null;
65
+ holdInfo = (0, _createPayload.optimizeHoldInfo)((_interaction$hold3pIn = interaction.hold3pInfo) !== null && _interaction$hold3pIn !== void 0 ? _interaction$hold3pIn : [], start, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type));
66
+ segments3p = !(0, _platformFeatureFlags.fg)('platform_ufo_remove_deprecated_config_fields') && config.killswitchNestedSegments ? [] : knownSegments.filter(function (knownSegment) {
67
+ return knownSegment.labelStack.some(function (entry) {
68
+ return 'type' in entry && entry.type === 'third-party';
69
+ });
70
70
  });
71
+ segmentTree = (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type) === '2.0.0' ? (0, _utils.buildSegmentTree)(segments3p.map(function (segment) {
72
+ return segment.labelStack;
73
+ })) : {};
71
74
  payload = {
72
75
  actionSubject: 'experience',
73
76
  action: 'measured',
@@ -88,7 +91,7 @@ function _createInteractionExtraLogPayload() {
88
91
  'event:region': config.region || 'unknown',
89
92
  'experience:key': 'custom.interaction-extra-metrics',
90
93
  'experience:name': newUFOName,
91
- interactionMetrics: {
94
+ interactionMetrics: _objectSpread(_objectSpread({
92
95
  namePrefix: config.namePrefix || '',
93
96
  segmentPrefix: config.segmentPrefix || '',
94
97
  interactionId: interactionId,
@@ -105,15 +108,17 @@ function _createInteractionExtraLogPayload() {
105
108
  // performance
106
109
  end: Math.round(end),
107
110
  start: Math.round(start),
108
- 'metric:ttai:3p': extraTTAI,
109
- ttvc: ttvc !== null && ttvc !== void 0 ? ttvc : undefined
110
- }
111
+ 'metric:ttai:3p': extraTTAI
112
+ }, finalVCMetrics), {}, {
113
+ holdInfo: holdInfo,
114
+ segments: (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type) === '2.0.0' ? segmentTree : (0, _utils.getOldSegmentsLabelStack)(segments3p, interaction.type)
115
+ })
111
116
  }
112
117
  }
113
118
  };
114
119
  payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
115
120
  return _context.abrupt("return", payload);
116
- case 22:
121
+ case 25:
117
122
  case "end":
118
123
  return _context.stop();
119
124
  }
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.createExperimentalMetricsPayload = createExperimentalMetricsPayload;
9
9
  exports.createPayloads = createPayloads;
10
10
  exports.getMoreAccuratePageVisibilityUpToTTAI = getMoreAccuratePageVisibilityUpToTTAI;
11
+ exports.optimizeHoldInfo = optimizeHoldInfo;
11
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
12
13
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -108,7 +108,10 @@ function _getVCMetrics() {
108
108
  case 27:
109
109
  result = _context.sent;
110
110
  observer.stop(interaction.ufoName);
111
- _interactionMetrics.postInteractionLog.setLastInteractionFinishVCResult(result);
111
+ if (!include3p) {
112
+ // For Post Interaction, last interaction should be without 3p
113
+ _interactionMetrics.postInteractionLog.setLastInteractionFinishVCResult(result);
114
+ }
112
115
  mostRecentVCRevision = (0, _config.getMostRecentVCRevision)(interaction.ufoName);
113
116
  mostRecentVCRevisionPayload = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
114
117
  var revision = _ref.revision;
@@ -704,15 +704,14 @@ function finishInteraction(id, data) {
704
704
  postInteractionLog.stopVCObserver();
705
705
  }
706
706
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
707
- if (!data.hold3pActive || data.hold3pActive.size === 0) {
707
+ var _sanitisedUfoName = (0, _utils.sanitizeUfoName)(data.ufoName);
708
+ if (!(0, _coinflip.default)((0, _config.getExtraInteractionRate)(_sanitisedUfoName, data.type))) {
709
+ interactionExtraMetrics.stopAll(id);
710
+ } else if (!data.hold3pActive || data.hold3pActive.size === 0) {
708
711
  var _getConfig5;
709
712
  if (!((_getConfig5 = (0, _config.getConfig)()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
710
713
  remove(id);
711
714
  }
712
- var _sanitisedUfoName = (0, _utils.sanitizeUfoName)(data.ufoName);
713
- if (!(0, _coinflip.default)((0, _config.getExtraInteractionRate)(_sanitisedUfoName, data.type))) {
714
- interactionExtraMetrics.stopVCObserver();
715
- }
716
715
  }
717
716
  } else {
718
717
  var _getConfig6;
@@ -877,25 +876,29 @@ function tryComplete(interactionId, endTime) {
877
876
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
878
877
  var _interaction$hold3pAc;
879
878
  var noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
880
- if (noMoreActiveHolds) {
879
+ if (noMoreActiveHolds && interactionExtraMetrics.finishedInteractionId !== interactionId) {
880
+ // If it's not waiting for extra metrics to complete, finish the interaction as normal
881
881
  if (!activeSubmitted) {
882
+ var _getConfig1;
882
883
  finishInteraction(interactionId, interaction, endTime);
883
- interactionExtraMetrics.updateFinishedInteractionId(interactionId);
884
+ if ((_getConfig1 = (0, _config.getConfig)()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.extraInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
885
+ interactionExtraMetrics.updateFinishedInteractionId(interactionId);
886
+ }
884
887
  activeSubmitted = true;
885
888
  }
886
889
  if (noMoreExpHolds) {
887
- var _getConfig1;
888
- if ((_getConfig1 = (0, _config.getConfig)()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.experimentalInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
890
+ var _getConfig10;
891
+ if ((_getConfig10 = (0, _config.getConfig)()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.experimentalInteractionMetrics) !== null && _getConfig10 !== void 0 && _getConfig10.enabled) {
889
892
  (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction, endTime);
890
893
  }
891
894
  postInteraction();
892
895
  }
893
- if (noMoreActive3pHolds) {
894
- var data = _objectSpread(_objectSpread({}, interaction), {}, {
895
- end: endTime
896
- });
897
- interactionExtraMetrics.onInteractionComplete(interactionId, data);
898
- }
896
+ }
897
+ if (noMoreActiveHolds && noMoreActive3pHolds) {
898
+ var data = _objectSpread(_objectSpread({}, interaction), {}, {
899
+ end: endTime
900
+ });
901
+ interactionExtraMetrics.onInteractionComplete(interactionId, data);
899
902
  }
900
903
  } else {
901
904
  if (noMoreActiveHolds) {
@@ -904,8 +907,8 @@ function tryComplete(interactionId, endTime) {
904
907
  activeSubmitted = true;
905
908
  }
906
909
  if (noMoreExpHolds) {
907
- var _getConfig10;
908
- if ((_getConfig10 = (0, _config.getConfig)()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.experimentalInteractionMetrics) !== null && _getConfig10 !== void 0 && _getConfig10.enabled) {
910
+ var _getConfig11;
911
+ if ((_getConfig11 = (0, _config.getConfig)()) !== null && _getConfig11 !== void 0 && (_getConfig11 = _getConfig11.experimentalInteractionMetrics) !== null && _getConfig11 !== void 0 && _getConfig11.enabled) {
909
912
  (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction, endTime);
910
913
  }
911
914
  postInteraction();
@@ -938,9 +941,7 @@ function abort(interactionId, abortReason) {
938
941
  postInteractionLog.reset();
939
942
  postInteractionLog.stopVCObserver();
940
943
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
941
- interactionExtraMetrics.stopVCObserver();
942
- interactionExtraMetrics.reset();
943
- remove(interactionId);
944
+ interactionExtraMetrics.stopAll(interactionId);
944
945
  }
945
946
  if ((0, _coinflip.default)((0, _config.getExperimentalInteractionRate)(interaction.ufoName, interaction.type))) {
946
947
  (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction);
@@ -968,9 +969,7 @@ function abortByNewInteraction(interactionId, interactionName) {
968
969
  postInteractionLog.reset();
969
970
  postInteractionLog.stopVCObserver();
970
971
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
971
- interactionExtraMetrics.stopVCObserver();
972
- interactionExtraMetrics.reset();
973
- remove(interactionId);
972
+ interactionExtraMetrics.stopAll(interactionId);
974
973
  }
975
974
  if ((0, _coinflip.default)((0, _config.getExperimentalInteractionRate)(interaction.ufoName, interaction.type))) {
976
975
  (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction);
@@ -1002,9 +1001,7 @@ function abortAll(abortReason, abortedByInteractionName) {
1002
1001
  postInteractionLog.reset();
1003
1002
  postInteractionLog.stopVCObserver();
1004
1003
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
1005
- interactionExtraMetrics.stopVCObserver();
1006
- interactionExtraMetrics.reset();
1007
- remove(interactionId);
1004
+ interactionExtraMetrics.stopAll(interactionId);
1008
1005
  }
1009
1006
  if ((0, _coinflip.default)((0, _config.getExperimentalInteractionRate)(interaction.ufoName, interaction.type))) {
1010
1007
  (0, _createExperimentalInteractionMetricsPayload.onExperimentalInteractionComplete)(interactionId, interaction);
@@ -1129,7 +1126,7 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1129
1126
  addHoldByID(interactionId, [], ufoName, ufoName, true);
1130
1127
  }
1131
1128
  if (type === 'transition' || type === 'page_load') {
1132
- var _getConfig11;
1129
+ var _getConfig12, _config$extraInteract;
1133
1130
  // Use per-interaction VC observer if available, otherwise fall back to global
1134
1131
  var observer = vcObserver;
1135
1132
  if (observer) {
@@ -1140,7 +1137,7 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1140
1137
  }
1141
1138
  // Start post interaction observer for all if config is enabled
1142
1139
  // in case ufoName is updated at later time
1143
- if ((_getConfig11 = (0, _config.getConfig)()) !== null && _getConfig11 !== void 0 && (_getConfig11 = _getConfig11.postInteractionLog) !== null && _getConfig11 !== void 0 && _getConfig11.enabled) {
1140
+ if ((_getConfig12 = (0, _config.getConfig)()) !== null && _getConfig12 !== void 0 && (_getConfig12 = _getConfig12.postInteractionLog) !== null && _getConfig12 !== void 0 && _getConfig12.enabled) {
1144
1141
  postInteractionLog.startVCObserver({
1145
1142
  startTime: startTime
1146
1143
  });
@@ -1150,13 +1147,10 @@ function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelS
1150
1147
  startTime: startTime
1151
1148
  });
1152
1149
  }
1153
- if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
1154
- var _config$extraInteract;
1155
- if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
1156
- interactionExtraMetrics.startVCObserver({
1157
- startTime: startTime
1158
- }, interactionId);
1159
- }
1150
+ if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled && (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
1151
+ interactionExtraMetrics.startVCObserver({
1152
+ startTime: startTime
1153
+ }, interactionId);
1160
1154
  }
1161
1155
  }
1162
1156
  if (type === 'press' && (0, _platformFeatureFlags.fg)('platform_ufo_enable_vc_press_interactions')) {
@@ -85,5 +85,12 @@ var InteractionExtraMetrics = exports.default = /*#__PURE__*/function () {
85
85
  value: function reset() {
86
86
  this.finishedInteractionId = null;
87
87
  }
88
+ }, {
89
+ key: "stopAll",
90
+ value: function stopAll(id) {
91
+ this.stopVCObserver();
92
+ (0, _index.remove)(id);
93
+ this.reset();
94
+ }
88
95
  }]);
89
96
  }();
@@ -121,7 +121,7 @@ function init(analyticsWebClientAsync, config) {
121
121
  (0, _machineUtilisation.initialiseMemoryObserver)();
122
122
  (0, _config.setUFOConfig)(config);
123
123
  if ((_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled) {
124
- var _config$experimentalI;
124
+ var _config$experimentalI, _config$extraInteract;
125
125
  var vcOptions = {
126
126
  heatmapSize: config.vc.heatmapSize,
127
127
  oldDomUpdates: config.vc.oldDomUpdates,
@@ -135,11 +135,8 @@ function init(analyticsWebClientAsync, config) {
135
135
  startTime: 0
136
136
  });
137
137
  }
138
- if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
139
- var _config$extraInteract;
140
- if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled) {
141
- _interactionMetrics.interactionExtraMetrics.initializeVCObserver(vcOptions);
142
- }
138
+ if (config !== null && config !== void 0 && (_config$extraInteract = config.extraInteractionMetrics) !== null && _config$extraInteract !== void 0 && _config$extraInteract.enabled && (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
139
+ _interactionMetrics.interactionExtraMetrics.initializeVCObserver(vcOptions);
143
140
  }
144
141
  }
145
142
  (0, _hiddenTiming.setupHiddenTimingCapture)();
@@ -167,7 +164,7 @@ function init(analyticsWebClientAsync, config) {
167
164
  createInteractionExtraMetricsPayloadPackage = _ref3[3];
168
165
  if (awc.getAnalyticsWebClientPromise) {
169
166
  awc.getAnalyticsWebClientPromise().then(function (client) {
170
- var _config$experimentalI2, _config$postInteracti;
167
+ var _config$experimentalI2, _config$postInteracti, _config$extraInteract2;
171
168
  var instance = client.getInstance();
172
169
  sinkInteraction(instance, payloadPackage);
173
170
  if (config !== null && config !== void 0 && (_config$experimentalI2 = config.experimentalInteractionMetrics) !== null && _config$experimentalI2 !== void 0 && _config$experimentalI2.enabled) {
@@ -176,12 +173,12 @@ function init(analyticsWebClientAsync, config) {
176
173
  if ((_config$postInteracti = config.postInteractionLog) !== null && _config$postInteracti !== void 0 && _config$postInteracti.enabled) {
177
174
  sinkPostInteractionLog(instance, createPostInteractionLogPayloadPackage.default);
178
175
  }
179
- if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
176
+ if (config !== null && config !== void 0 && (_config$extraInteract2 = config.extraInteractionMetrics) !== null && _config$extraInteract2 !== void 0 && _config$extraInteract2.enabled && (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
180
177
  sinkInteractionExtraMetrics(instance, createInteractionExtraMetricsPayloadPackage.default);
181
178
  }
182
179
  });
183
180
  } else if (awc.sendOperationalEvent) {
184
- var _config$experimentalI3, _config$postInteracti2;
181
+ var _config$experimentalI3, _config$postInteracti2, _config$extraInteract3;
185
182
  sinkInteraction(awc, payloadPackage);
186
183
  if (config !== null && config !== void 0 && (_config$experimentalI3 = config.experimentalInteractionMetrics) !== null && _config$experimentalI3 !== void 0 && _config$experimentalI3.enabled) {
187
184
  sinkExperimentalInteractionMetrics(awc, payloadPackage);
@@ -189,7 +186,7 @@ function init(analyticsWebClientAsync, config) {
189
186
  if ((_config$postInteracti2 = config.postInteractionLog) !== null && _config$postInteracti2 !== void 0 && _config$postInteracti2.enabled) {
190
187
  sinkPostInteractionLog(awc, createPostInteractionLogPayloadPackage.default);
191
188
  }
192
- if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
189
+ if (config !== null && config !== void 0 && (_config$extraInteract3 = config.extraInteractionMetrics) !== null && _config$extraInteract3 !== void 0 && _config$extraInteract3.enabled && (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
193
190
  sinkInteractionExtraMetrics(awc, createInteractionExtraMetricsPayloadPackage.default);
194
191
  }
195
192
  }
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = exports.NON_VISUAL_ARIA_ATTRIBUTES = exports.KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS = void 0;
7
+ exports.default = exports.THIRD_PARTY_BROWSER_EXTENSION_ATTRIBUTES = exports.NON_VISUAL_ARIA_ATTRIBUTES = exports.KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -41,6 +41,11 @@ var KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS = exports.KNOWN_ATTRIBUTE
41
41
 
42
42
  // Common aria attributes that don't cause visual layout shifts
43
43
  var NON_VISUAL_ARIA_ATTRIBUTES = exports.NON_VISUAL_ARIA_ATTRIBUTES = ['aria-label', 'aria-labelledby', 'aria-describedby', 'aria-hidden', 'aria-expanded', 'aria-controls', 'aria-selected', 'aria-checked', 'aria-disabled', 'aria-required', 'aria-current', 'aria-haspopup', 'aria-pressed', 'aria-atomic', 'aria-live'];
44
+
45
+ // Common third party browser extension attributes
46
+ var THIRD_PARTY_BROWSER_EXTENSION_ATTRIBUTES = exports.THIRD_PARTY_BROWSER_EXTENSION_ATTRIBUTES = ['bis_skin_checked', 'cz-shortcut-listen', 'monica-version', 'data-gr-ext-installed', 'data-dashlane-rid', 'sapling-installed', 'data-gptw',
47
+ // grammarly extensions
48
+ 'data-new-gr-c-s-loaded', 'data-gr-aaa-notch-connection-id', 'data-gr-aaa-loaded'];
44
49
  var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCCalculator) {
45
50
  function VCCalculator_FY25_03() {
46
51
  (0, _classCallCheck2.default)(this, VCCalculator_FY25_03);
@@ -59,7 +64,7 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
59
64
  if (!attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(attributeName)) {
60
65
  return false;
61
66
  }
62
- if (attributeName.startsWith('data-test') || attributeName === 'data-aui-version' || attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-renderer-start-pos' || attributeName === 'data-table-local-id' || attributeName === 'spellcheck' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || attributeName === 'data-new-gr-c-c-s-loaded' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
67
+ if (attributeName.startsWith('data-test') || attributeName === 'data-aui-version' || attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-renderer-start-pos' || attributeName === 'data-table-local-id' || attributeName === 'spellcheck' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName) || THIRD_PARTY_BROWSER_EXTENSION_ATTRIBUTES.includes(attributeName) && (0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_extensions_from_ttvc')) {
63
68
  return false;
64
69
  }
65
70
  return true;
@@ -1,14 +1,15 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  import coinflip from '../coinflip';
2
3
  import { getConfig, getExtraInteractionRate } from '../config';
3
- import { getMoreAccuratePageVisibilityUpToTTAI } from '../create-payload';
4
- import { sanitizeUfoName } from '../create-payload/common/utils';
4
+ import { getMoreAccuratePageVisibilityUpToTTAI, optimizeHoldInfo } from '../create-payload';
5
+ import { buildSegmentTree, getOldSegmentsLabelStack, sanitizeUfoName } from '../create-payload/common/utils';
5
6
  import getPageVisibilityUpToTTAI from '../create-payload/utils/get-page-visibility-up-to-ttai';
6
7
  import getPayloadSize from '../create-payload/utils/get-payload-size';
7
8
  import { getReactUFOPayloadVersion } from '../create-payload/utils/get-react-ufo-payload-version';
8
9
  import getTTAI from '../create-payload/utils/get-ttai';
9
10
  import getVCMetrics from '../create-payload/utils/get-vc-metrics';
10
11
  async function createInteractionExtraLogPayload(interactionId, interaction) {
11
- var _getTTAI, _finalVCMetrics$ufoV, _window$location;
12
+ var _getTTAI, _interaction$hold3pIn, _window$location;
12
13
  const config = getConfig();
13
14
  if (!config) {
14
15
  throw Error('UFO Configuration not provided');
@@ -23,9 +24,11 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
23
24
  routeName,
24
25
  previousInteractionName,
25
26
  isPreviousInteractionAborted,
26
- abortedByInteractionName
27
+ abortedByInteractionName,
28
+ knownSegments
27
29
  } = interaction;
28
- const configRate = getExtraInteractionRate(ufoName, type);
30
+ const sanitisedUfoName = sanitizeUfoName(ufoName);
31
+ const configRate = getExtraInteractionRate(sanitisedUfoName, type);
29
32
  if (!coinflip(configRate)) {
30
33
  return null;
31
34
  }
@@ -40,15 +43,9 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
40
43
  const extraTTAI = (_getTTAI = getTTAI(interaction)) !== null && _getTTAI !== void 0 ? _getTTAI : undefined;
41
44
  const newUFOName = sanitizeUfoName(ufoName);
42
45
  const finalVCMetrics = await getVCMetrics(interaction, true);
43
- const ttvc = (_finalVCMetrics$ufoV = finalVCMetrics['ufo:vc:rev']) === null || _finalVCMetrics$ufoV === void 0 ? void 0 : _finalVCMetrics$ufoV.map(revision => {
44
- if (revision['metric:vc90'] === null || revision.clean !== true) {
45
- return null;
46
- }
47
- return {
48
- revision: revision.revision,
49
- vc90: revision['metric:vc90']
50
- };
51
- }).filter(revision => revision != null);
46
+ const holdInfo = optimizeHoldInfo((_interaction$hold3pIn = interaction.hold3pInfo) !== null && _interaction$hold3pIn !== void 0 ? _interaction$hold3pIn : [], start, getReactUFOPayloadVersion(interaction.type));
47
+ const segments3p = !fg('platform_ufo_remove_deprecated_config_fields') && config.killswitchNestedSegments ? [] : knownSegments.filter(knownSegment => knownSegment.labelStack.some(entry => 'type' in entry && entry.type === 'third-party'));
48
+ const segmentTree = getReactUFOPayloadVersion(interaction.type) === '2.0.0' ? buildSegmentTree(segments3p.map(segment => segment.labelStack)) : {};
52
49
  const payload = {
53
50
  actionSubject: 'experience',
54
51
  action: 'measured',
@@ -87,7 +84,9 @@ async function createInteractionExtraLogPayload(interactionId, interaction) {
87
84
  end: Math.round(end),
88
85
  start: Math.round(start),
89
86
  'metric:ttai:3p': extraTTAI,
90
- ttvc: ttvc !== null && ttvc !== void 0 ? ttvc : undefined
87
+ ...finalVCMetrics,
88
+ holdInfo,
89
+ segments: getReactUFOPayloadVersion(interaction.type) === '2.0.0' ? segmentTree : getOldSegmentsLabelStack(segments3p, interaction.type)
91
90
  }
92
91
  }
93
92
  }
@@ -355,7 +355,7 @@ function optimizeRedirects(redirects, interactionStart) {
355
355
  }, []);
356
356
  return updatedRedirects;
357
357
  }
358
- function optimizeHoldInfo(holdInfo, interactionStart, reactUFOVersion) {
358
+ export function optimizeHoldInfo(holdInfo, interactionStart, reactUFOVersion) {
359
359
  const holdInfoMap = holdInfo.reduce((result, hold) => {
360
360
  const {
361
361
  labelStack,
@@ -54,7 +54,10 @@ async function getVCMetrics(interaction, include3p = false) {
54
54
  include3p
55
55
  });
56
56
  observer.stop(interaction.ufoName);
57
- postInteractionLog.setLastInteractionFinishVCResult(result);
57
+ if (!include3p) {
58
+ // For Post Interaction, last interaction should be without 3p
59
+ postInteractionLog.setLastInteractionFinishVCResult(result);
60
+ }
58
61
  const mostRecentVCRevision = getMostRecentVCRevision(interaction.ufoName);
59
62
  const mostRecentVCRevisionPayload = result === null || result === void 0 ? void 0 : (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(({
60
63
  revision