@atlaskit/react-ufo 4.16.7 → 4.16.8

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,12 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.16.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4272868869ef8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4272868869ef8) -
8
+ Updated threshold for observations and keep SSR entry
9
+
3
10
  ## 4.16.7
4
11
 
5
12
  ### Patch Changes
@@ -10,7 +10,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
13
  var _config = require("../config");
15
14
  var _hiddenTiming = require("../hidden-timing");
16
15
  var _vc = require("../vc");
@@ -129,7 +128,7 @@ var PostInteractionLog = exports.default = /*#__PURE__*/function () {
129
128
  return _regenerator.default.wrap(function _callee$(_context) {
130
129
  while (1) switch (_context.prev = _context.next) {
131
130
  case 0:
132
- if (!(!this.lastInteractionFinish || !this.sinkHandlerFn || !this.hasData() && !(0, _platformFeatureFlags.fg)('platform_ufo_always_send_post_interaction_log'))) {
131
+ if (!(!this.lastInteractionFinish || !this.sinkHandlerFn)) {
133
132
  _context.next = 4;
134
133
  break;
135
134
  }
@@ -19,7 +19,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
19
19
  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; }
20
20
  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; }
21
21
  var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
22
- var MAX_OBSERVATIONS = 100;
22
+ var MAX_OBSERVATIONS = 200;
23
23
  function isWindowEventEntryData(data) {
24
24
  return data.type === 'window:event' && 'eventType' in data;
25
25
  }
@@ -59,7 +59,7 @@ var RawDataHandler = exports.default = /*#__PURE__*/function () {
59
59
  key: "getRawData",
60
60
  value: function () {
61
61
  var _getRawData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
62
- var entries, startTime, stopTime, isPageVisible, isVCClean, dirtyReason, getVCCleanStatusResult, viewportEntries, windowEventEntries, targetNameToIdMap, elementMapEntriesMap, nextElementId, typeMap, typeMapEntriesMap, nextTypeId, attributeMap, attributeEntriesMap, nextAttributeId, eventTypeMap, eventTypeMapEntriesMap, nextEventTypeId, rawObservations, rawEventObservations, firstObservation, lastObservations, referencedEids, referencedChgs, referencedAtts, _iterator, _step, observation, _iterator2, _step2, eid, _iterator3, _step3, chg, _iterator4, _step4, att, firstEventObservation, lastEventObservations, referencedEvts, _iterator5, _step5, _observation, _iterator6, _step6, evt, result;
62
+ var entries, startTime, stopTime, isPageVisible, isVCClean, dirtyReason, getVCCleanStatusResult, viewportEntries, windowEventEntries, targetNameToIdMap, elementMapEntriesMap, nextElementId, typeMap, typeMapEntriesMap, nextTypeId, attributeMap, attributeEntriesMap, nextAttributeId, eventTypeMap, eventTypeMapEntriesMap, nextEventTypeId, rawObservations, rawEventObservations, firstObservation, lastObservations, ssrEid, ssrObservation, ssrAlreadyIncluded, referencedEids, referencedChgs, referencedAtts, _iterator, _step, observation, _iterator2, _step2, eid, _iterator3, _step3, chg, _iterator4, _step4, att, firstEventObservation, lastEventObservations, referencedEvts, _iterator5, _step5, _observation, _iterator6, _step6, evt, result;
63
63
  return _regenerator.default.wrap(function _callee$(_context) {
64
64
  while (1) switch (_context.prev = _context.next) {
65
65
  case 0:
@@ -157,12 +157,19 @@ var RawDataHandler = exports.default = /*#__PURE__*/function () {
157
157
  };
158
158
  return eventObservation;
159
159
  }); // If the number of observations is greater than the maximum allowed, we need to trim the observations to the maximum allowed.
160
- // We do this by keeping the first observation and the last MAX_OBSERVATIONS observations.
160
+ // We do this by keeping the first observation, the SSR observation (if present), and the last MAX_OBSERVATIONS observations.
161
161
  // We then collect the referenced IDs from the remaining observations and remove the unreferenced entries from the maps
162
162
  if (rawObservations.length > MAX_OBSERVATIONS) {
163
163
  firstObservation = rawObservations[0];
164
- lastObservations = rawObservations.slice(-MAX_OBSERVATIONS);
165
- rawObservations = [firstObservation].concat((0, _toConsumableArray2.default)(lastObservations));
164
+ lastObservations = rawObservations.slice(-MAX_OBSERVATIONS); // Find the SSR observation by looking up the eid that corresponds to 'SSR' element name
165
+ ssrEid = targetNameToIdMap.get('SSR');
166
+ ssrObservation = ssrEid ? rawObservations.find(function (obs) {
167
+ return obs.eid === ssrEid && obs !== firstObservation;
168
+ }) : undefined; // Include SSR observation if it exists and is not already in the kept observations
169
+ ssrAlreadyIncluded = ssrObservation && lastObservations.some(function (obs) {
170
+ return obs === ssrObservation;
171
+ });
172
+ rawObservations = [firstObservation].concat((0, _toConsumableArray2.default)(ssrObservation && !ssrAlreadyIncluded ? [ssrObservation] : []), (0, _toConsumableArray2.default)(lastObservations));
166
173
 
167
174
  // Collect referenced IDs from remaining observations
168
175
  referencedEids = new Set();
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { getConfig } from '../config';
4
3
  import { getPageVisibilityState } from '../hidden-timing';
5
4
  import { VCObserverWrapper } from '../vc';
@@ -93,7 +92,7 @@ export default class PostInteractionLog {
93
92
  */
94
93
  async sendPostInteractionLog() {
95
94
  var _this$vcObserver4, _config$vc, _config$vc2, _this$vcObserver5;
96
- if (!this.lastInteractionFinish || !this.sinkHandlerFn || !this.hasData() && !fg('platform_ufo_always_send_post_interaction_log')) {
95
+ if (!this.lastInteractionFinish || !this.sinkHandlerFn) {
97
96
  var _this$vcObserver3;
98
97
  this.reset();
99
98
  (_this$vcObserver3 = this.vcObserver) === null || _this$vcObserver3 === void 0 ? void 0 : _this$vcObserver3.stop();
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import getViewportHeight from '../metric-calculator/utils/get-viewport-height';
3
3
  import getViewportWidth from '../metric-calculator/utils/get-viewport-width';
4
4
  const ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
5
- const MAX_OBSERVATIONS = 100;
5
+ const MAX_OBSERVATIONS = 200;
6
6
  function isWindowEventEntryData(data) {
7
7
  return data.type === 'window:event' && 'eventType' in data;
8
8
  }
@@ -137,12 +137,19 @@ export default class RawDataHandler {
137
137
  });
138
138
 
139
139
  // If the number of observations is greater than the maximum allowed, we need to trim the observations to the maximum allowed.
140
- // We do this by keeping the first observation and the last MAX_OBSERVATIONS observations.
140
+ // We do this by keeping the first observation, the SSR observation (if present), and the last MAX_OBSERVATIONS observations.
141
141
  // We then collect the referenced IDs from the remaining observations and remove the unreferenced entries from the maps
142
142
  if (rawObservations.length > MAX_OBSERVATIONS) {
143
143
  const firstObservation = rawObservations[0];
144
144
  const lastObservations = rawObservations.slice(-MAX_OBSERVATIONS);
145
- rawObservations = [firstObservation, ...lastObservations];
145
+
146
+ // Find the SSR observation by looking up the eid that corresponds to 'SSR' element name
147
+ const ssrEid = targetNameToIdMap.get('SSR');
148
+ const ssrObservation = ssrEid ? rawObservations.find(obs => obs.eid === ssrEid && obs !== firstObservation) : undefined;
149
+
150
+ // Include SSR observation if it exists and is not already in the kept observations
151
+ const ssrAlreadyIncluded = ssrObservation && lastObservations.some(obs => obs === ssrObservation);
152
+ rawObservations = [firstObservation, ...(ssrObservation && !ssrAlreadyIncluded ? [ssrObservation] : []), ...lastObservations];
146
153
 
147
154
  // Collect referenced IDs from remaining observations
148
155
  const referencedEids = new Set();
@@ -5,7 +5,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  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; }
7
7
  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; }
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import { getConfig } from '../config';
10
9
  import { getPageVisibilityState } from '../hidden-timing';
11
10
  import { VCObserverWrapper } from '../vc';
@@ -122,7 +121,7 @@ var PostInteractionLog = /*#__PURE__*/function () {
122
121
  return _regeneratorRuntime.wrap(function _callee$(_context) {
123
122
  while (1) switch (_context.prev = _context.next) {
124
123
  case 0:
125
- if (!(!this.lastInteractionFinish || !this.sinkHandlerFn || !this.hasData() && !fg('platform_ufo_always_send_post_interaction_log'))) {
124
+ if (!(!this.lastInteractionFinish || !this.sinkHandlerFn)) {
126
125
  _context.next = 4;
127
126
  break;
128
127
  }
@@ -12,7 +12,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
12
12
  import getViewportHeight from '../metric-calculator/utils/get-viewport-height';
13
13
  import getViewportWidth from '../metric-calculator/utils/get-viewport-width';
14
14
  var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
15
- var MAX_OBSERVATIONS = 100;
15
+ var MAX_OBSERVATIONS = 200;
16
16
  function isWindowEventEntryData(data) {
17
17
  return data.type === 'window:event' && 'eventType' in data;
18
18
  }
@@ -52,7 +52,7 @@ var RawDataHandler = /*#__PURE__*/function () {
52
52
  key: "getRawData",
53
53
  value: function () {
54
54
  var _getRawData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
55
- var entries, startTime, stopTime, isPageVisible, isVCClean, dirtyReason, getVCCleanStatusResult, viewportEntries, windowEventEntries, targetNameToIdMap, elementMapEntriesMap, nextElementId, typeMap, typeMapEntriesMap, nextTypeId, attributeMap, attributeEntriesMap, nextAttributeId, eventTypeMap, eventTypeMapEntriesMap, nextEventTypeId, rawObservations, rawEventObservations, firstObservation, lastObservations, referencedEids, referencedChgs, referencedAtts, _iterator, _step, observation, _iterator2, _step2, eid, _iterator3, _step3, chg, _iterator4, _step4, att, firstEventObservation, lastEventObservations, referencedEvts, _iterator5, _step5, _observation, _iterator6, _step6, evt, result;
55
+ var entries, startTime, stopTime, isPageVisible, isVCClean, dirtyReason, getVCCleanStatusResult, viewportEntries, windowEventEntries, targetNameToIdMap, elementMapEntriesMap, nextElementId, typeMap, typeMapEntriesMap, nextTypeId, attributeMap, attributeEntriesMap, nextAttributeId, eventTypeMap, eventTypeMapEntriesMap, nextEventTypeId, rawObservations, rawEventObservations, firstObservation, lastObservations, ssrEid, ssrObservation, ssrAlreadyIncluded, referencedEids, referencedChgs, referencedAtts, _iterator, _step, observation, _iterator2, _step2, eid, _iterator3, _step3, chg, _iterator4, _step4, att, firstEventObservation, lastEventObservations, referencedEvts, _iterator5, _step5, _observation, _iterator6, _step6, evt, result;
56
56
  return _regeneratorRuntime.wrap(function _callee$(_context) {
57
57
  while (1) switch (_context.prev = _context.next) {
58
58
  case 0:
@@ -150,12 +150,19 @@ var RawDataHandler = /*#__PURE__*/function () {
150
150
  };
151
151
  return eventObservation;
152
152
  }); // If the number of observations is greater than the maximum allowed, we need to trim the observations to the maximum allowed.
153
- // We do this by keeping the first observation and the last MAX_OBSERVATIONS observations.
153
+ // We do this by keeping the first observation, the SSR observation (if present), and the last MAX_OBSERVATIONS observations.
154
154
  // We then collect the referenced IDs from the remaining observations and remove the unreferenced entries from the maps
155
155
  if (rawObservations.length > MAX_OBSERVATIONS) {
156
156
  firstObservation = rawObservations[0];
157
- lastObservations = rawObservations.slice(-MAX_OBSERVATIONS);
158
- rawObservations = [firstObservation].concat(_toConsumableArray(lastObservations));
157
+ lastObservations = rawObservations.slice(-MAX_OBSERVATIONS); // Find the SSR observation by looking up the eid that corresponds to 'SSR' element name
158
+ ssrEid = targetNameToIdMap.get('SSR');
159
+ ssrObservation = ssrEid ? rawObservations.find(function (obs) {
160
+ return obs.eid === ssrEid && obs !== firstObservation;
161
+ }) : undefined; // Include SSR observation if it exists and is not already in the kept observations
162
+ ssrAlreadyIncluded = ssrObservation && lastObservations.some(function (obs) {
163
+ return obs === ssrObservation;
164
+ });
165
+ rawObservations = [firstObservation].concat(_toConsumableArray(ssrObservation && !ssrAlreadyIncluded ? [ssrObservation] : []), _toConsumableArray(lastObservations));
159
166
 
160
167
  // Collect referenced IDs from remaining observations
161
168
  referencedEids = new Set();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.16.7",
3
+ "version": "4.16.8",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -168,9 +168,6 @@
168
168
  "platform_ufo_enable_finish_interaction_transition": {
169
169
  "type": "boolean"
170
170
  },
171
- "platform_ufo_always_send_post_interaction_log": {
172
- "type": "boolean"
173
- },
174
171
  "platform_ufo_drop_prior_fg_interactions": {
175
172
  "type": "boolean"
176
173
  },