@atlaskit/react-ufo 3.12.2 → 3.12.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.12.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#156458](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/156458)
8
+ [`98659a9117f77`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/98659a9117f77) -
9
+ FG cleanup - platform_ufo_post_interaction_use_vc_rev
10
+
11
+ ## 3.12.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [#155959](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/155959)
16
+ [`eeaa8485061ce`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eeaa8485061ce) -
17
+ Add further error handling to CPU monitoring logic
18
+
3
19
  ## 3.12.2
4
20
 
5
21
  ### Patch Changes
@@ -136,13 +136,12 @@ function createPostInteractionLogPayload(_ref2) {
136
136
 
137
137
  // Align post-interaction-logs closer to UFO event behaviour,
138
138
  // e.g. also check for aborted or failed events
139
- if ((0, _platformFeatureFlags.fg)('platform_ufo_vc_align_revisions_on_watchdog_event')) {
140
- if (lastInteractionFinish.abortReason) {
141
- return null;
142
- }
143
- if (lastInteractionFinish.errors.length > 0) {
144
- return null;
145
- }
139
+
140
+ if (lastInteractionFinish.abortReason) {
141
+ return null;
142
+ }
143
+ if (lastInteractionFinish.errors.length > 0) {
144
+ return null;
146
145
  }
147
146
  var maxEndTimeFromProfiler = reactProfilerTimings ? Math.max.apply(Math, (0, _toConsumableArray2.default)(reactProfilerTimings.map(function (t) {
148
147
  return t.commitTime;
@@ -10,10 +10,8 @@ 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 _vc = require("../vc");
16
- var _vcObserver = require("../vc/vc-observer");
17
15
  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; }
18
16
  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
17
  var POST_INTERACTION_LOG_SEND_DEFAULT_TIMEOUT = 3000;
@@ -45,15 +43,9 @@ var PostInteractionLog = exports.default = /*#__PURE__*/function () {
45
43
  return (0, _createClass2.default)(PostInteractionLog, [{
46
44
  key: "initializeVCObserver",
47
45
  value: function initializeVCObserver(options) {
48
- if ((0, _platformFeatureFlags.fg)('platform_ufo_vc_align_revisions_on_watchdog_event')) {
49
- this.vcObserver = new _vc.VCObserverWrapper(_objectSpread(_objectSpread({}, options), {}, {
50
- isPostInteraction: true
51
- }));
52
- } else if (this.vcObserver === null) {
53
- this.vcObserver = new _vcObserver.VCObserver(_objectSpread(_objectSpread({}, options), {}, {
54
- isPostInteraction: true
55
- }));
56
- }
46
+ this.vcObserver = new _vc.VCObserverWrapper(_objectSpread(_objectSpread({}, options), {}, {
47
+ isPostInteraction: true
48
+ }));
57
49
  }
58
50
  }, {
59
51
  key: "startVCObserver",
@@ -23,49 +23,54 @@ function removeOldBufferRecords(filter) {
23
23
  });
24
24
  }
25
25
  function createPressureStateReport(start, end) {
26
- // To differentiate between the API not available, vs no PressureRecords added
27
- if (!('PressureObserver' in globalThis)) {
26
+ try {
27
+ // To differentiate between the API not available, vs no PressureRecords added
28
+ if (!('PressureObserver' in globalThis)) {
29
+ return null;
30
+ }
31
+ var pressureStateCount = pressureRecordBuffer.reduce(function (pressureReport, _ref2) {
32
+ var time = _ref2.time,
33
+ state = _ref2.state;
34
+ if (time >= start && time <= end) {
35
+ pressureReport[state] += 1;
36
+ }
37
+ return pressureReport;
38
+ }, {
39
+ nominal: 0,
40
+ fair: 0,
41
+ serious: 0,
42
+ critical: 0
43
+ });
44
+ var pressureStateTotal = Object.values(pressureStateCount).reduce(function (total, count) {
45
+ return total + count;
46
+ }) || 1;
47
+ removeOldBufferRecords(end);
48
+ return {
49
+ count: pressureStateCount,
50
+ percentage: {
51
+ nominal: Math.round(pressureStateCount.nominal / pressureStateTotal * 100),
52
+ fair: Math.round(pressureStateCount.fair / pressureStateTotal * 100),
53
+ serious: Math.round(pressureStateCount.serious / pressureStateTotal * 100),
54
+ critical: Math.round(pressureStateCount.critical / pressureStateTotal * 100)
55
+ }
56
+ };
57
+ } catch (_unused) {
28
58
  return null;
29
59
  }
30
- var pressureStateCount = pressureRecordBuffer.reduce(function (pressureReport, _ref2) {
31
- var time = _ref2.time,
32
- state = _ref2.state;
33
- if (time >= start && time <= end) {
34
- pressureReport[state] += 1;
35
- }
36
- return pressureReport;
37
- }, {
38
- nominal: 0,
39
- fair: 0,
40
- serious: 0,
41
- critical: 0
42
- });
43
- var pressureStateTotal = Object.values(pressureStateCount).reduce(function (total, count) {
44
- return total + count;
45
- }) || 1;
46
- removeOldBufferRecords(end);
47
- return {
48
- count: pressureStateCount,
49
- percentage: {
50
- nominal: Math.round(pressureStateCount.nominal / pressureStateTotal * 100),
51
- fair: Math.round(pressureStateCount.fair / pressureStateTotal * 100),
52
- serious: Math.round(pressureStateCount.serious / pressureStateTotal * 100),
53
- critical: Math.round(pressureStateCount.critical / pressureStateTotal * 100)
54
- }
55
- };
56
60
  }
57
61
  function initialisePressureObserver() {
58
62
  try {
59
63
  if ('PressureObserver' in globalThis) {
64
+ var _pressureObserver$obs;
60
65
  pressureObserver = new PressureObserver(function (records) {
61
66
  if (pressureRecordBuffer.length + records.length <= BUFFER_MAX_LENGTH) {
62
67
  var _pressureRecordBuffer;
63
68
  (_pressureRecordBuffer = pressureRecordBuffer).push.apply(_pressureRecordBuffer, (0, _toConsumableArray2.default)(records));
64
69
  }
65
70
  });
66
- pressureObserver.observe('cpu', {
71
+ (_pressureObserver$obs = pressureObserver.observe('cpu', {
67
72
  sampleInterval: 100
68
- });
73
+ })) === null || _pressureObserver$obs === void 0 || _pressureObserver$obs.catch();
69
74
  }
70
75
  } catch (err) {
71
76
  /* do nothing, this is a best efforts metric */
@@ -123,13 +123,12 @@ function createPostInteractionLogPayload({
123
123
 
124
124
  // Align post-interaction-logs closer to UFO event behaviour,
125
125
  // e.g. also check for aborted or failed events
126
- if (fg('platform_ufo_vc_align_revisions_on_watchdog_event')) {
127
- if (lastInteractionFinish.abortReason) {
128
- return null;
129
- }
130
- if (lastInteractionFinish.errors.length > 0) {
131
- return null;
132
- }
126
+
127
+ if (lastInteractionFinish.abortReason) {
128
+ return null;
129
+ }
130
+ if (lastInteractionFinish.errors.length > 0) {
131
+ return null;
133
132
  }
134
133
  const maxEndTimeFromProfiler = reactProfilerTimings ? Math.max(...reactProfilerTimings.map(t => t.commitTime)) : lastInteractionFinish.end;
135
134
  const revisedEndTime = Math.round(maxEndTimeFromProfiler);
@@ -1,8 +1,6 @@
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 { VCObserverWrapper } from '../vc';
5
- import { VCObserver } from '../vc/vc-observer';
6
4
  const POST_INTERACTION_LOG_SEND_DEFAULT_TIMEOUT = 3000;
7
5
  export default class PostInteractionLog {
8
6
  constructor() {
@@ -29,17 +27,10 @@ export default class PostInteractionLog {
29
27
  _defineProperty(this, "sinkHandlerFn", () => {});
30
28
  }
31
29
  initializeVCObserver(options) {
32
- if (fg('platform_ufo_vc_align_revisions_on_watchdog_event')) {
33
- this.vcObserver = new VCObserverWrapper({
34
- ...options,
35
- isPostInteraction: true
36
- });
37
- } else if (this.vcObserver === null) {
38
- this.vcObserver = new VCObserver({
39
- ...options,
40
- isPostInteraction: true
41
- });
42
- }
30
+ this.vcObserver = new VCObserverWrapper({
31
+ ...options,
32
+ isPostInteraction: true
33
+ });
43
34
  }
44
35
  startVCObserver({
45
36
  startTime
@@ -10,47 +10,52 @@ export function removeOldBufferRecords(filter) {
10
10
  }) => time > filter);
11
11
  }
12
12
  export function createPressureStateReport(start, end) {
13
- // To differentiate between the API not available, vs no PressureRecords added
14
- if (!('PressureObserver' in globalThis)) {
13
+ try {
14
+ // To differentiate between the API not available, vs no PressureRecords added
15
+ if (!('PressureObserver' in globalThis)) {
16
+ return null;
17
+ }
18
+ const pressureStateCount = pressureRecordBuffer.reduce((pressureReport, {
19
+ time,
20
+ state
21
+ }) => {
22
+ if (time >= start && time <= end) {
23
+ pressureReport[state] += 1;
24
+ }
25
+ return pressureReport;
26
+ }, {
27
+ nominal: 0,
28
+ fair: 0,
29
+ serious: 0,
30
+ critical: 0
31
+ });
32
+ const pressureStateTotal = Object.values(pressureStateCount).reduce((total, count) => total + count) || 1;
33
+ removeOldBufferRecords(end);
34
+ return {
35
+ count: pressureStateCount,
36
+ percentage: {
37
+ nominal: Math.round(pressureStateCount.nominal / pressureStateTotal * 100),
38
+ fair: Math.round(pressureStateCount.fair / pressureStateTotal * 100),
39
+ serious: Math.round(pressureStateCount.serious / pressureStateTotal * 100),
40
+ critical: Math.round(pressureStateCount.critical / pressureStateTotal * 100)
41
+ }
42
+ };
43
+ } catch {
15
44
  return null;
16
45
  }
17
- const pressureStateCount = pressureRecordBuffer.reduce((pressureReport, {
18
- time,
19
- state
20
- }) => {
21
- if (time >= start && time <= end) {
22
- pressureReport[state] += 1;
23
- }
24
- return pressureReport;
25
- }, {
26
- nominal: 0,
27
- fair: 0,
28
- serious: 0,
29
- critical: 0
30
- });
31
- const pressureStateTotal = Object.values(pressureStateCount).reduce((total, count) => total + count) || 1;
32
- removeOldBufferRecords(end);
33
- return {
34
- count: pressureStateCount,
35
- percentage: {
36
- nominal: Math.round(pressureStateCount.nominal / pressureStateTotal * 100),
37
- fair: Math.round(pressureStateCount.fair / pressureStateTotal * 100),
38
- serious: Math.round(pressureStateCount.serious / pressureStateTotal * 100),
39
- critical: Math.round(pressureStateCount.critical / pressureStateTotal * 100)
40
- }
41
- };
42
46
  }
43
47
  export function initialisePressureObserver() {
44
48
  try {
45
49
  if ('PressureObserver' in globalThis) {
50
+ var _pressureObserver$obs;
46
51
  pressureObserver = new PressureObserver(records => {
47
52
  if (pressureRecordBuffer.length + records.length <= BUFFER_MAX_LENGTH) {
48
53
  pressureRecordBuffer.push(...records);
49
54
  }
50
55
  });
51
- pressureObserver.observe('cpu', {
56
+ (_pressureObserver$obs = pressureObserver.observe('cpu', {
52
57
  sampleInterval: 100
53
- });
58
+ })) === null || _pressureObserver$obs === void 0 ? void 0 : _pressureObserver$obs.catch();
54
59
  }
55
60
  } catch (err) {
56
61
  /* do nothing, this is a best efforts metric */
@@ -129,13 +129,12 @@ function createPostInteractionLogPayload(_ref2) {
129
129
 
130
130
  // Align post-interaction-logs closer to UFO event behaviour,
131
131
  // e.g. also check for aborted or failed events
132
- if (fg('platform_ufo_vc_align_revisions_on_watchdog_event')) {
133
- if (lastInteractionFinish.abortReason) {
134
- return null;
135
- }
136
- if (lastInteractionFinish.errors.length > 0) {
137
- return null;
138
- }
132
+
133
+ if (lastInteractionFinish.abortReason) {
134
+ return null;
135
+ }
136
+ if (lastInteractionFinish.errors.length > 0) {
137
+ return null;
139
138
  }
140
139
  var maxEndTimeFromProfiler = reactProfilerTimings ? Math.max.apply(Math, _toConsumableArray(reactProfilerTimings.map(function (t) {
141
140
  return t.commitTime;
@@ -5,10 +5,8 @@ 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 { VCObserverWrapper } from '../vc';
11
- import { VCObserver } from '../vc/vc-observer';
12
10
  var POST_INTERACTION_LOG_SEND_DEFAULT_TIMEOUT = 3000;
13
11
  var PostInteractionLog = /*#__PURE__*/function () {
14
12
  function PostInteractionLog() {
@@ -38,15 +36,9 @@ var PostInteractionLog = /*#__PURE__*/function () {
38
36
  return _createClass(PostInteractionLog, [{
39
37
  key: "initializeVCObserver",
40
38
  value: function initializeVCObserver(options) {
41
- if (fg('platform_ufo_vc_align_revisions_on_watchdog_event')) {
42
- this.vcObserver = new VCObserverWrapper(_objectSpread(_objectSpread({}, options), {}, {
43
- isPostInteraction: true
44
- }));
45
- } else if (this.vcObserver === null) {
46
- this.vcObserver = new VCObserver(_objectSpread(_objectSpread({}, options), {}, {
47
- isPostInteraction: true
48
- }));
49
- }
39
+ this.vcObserver = new VCObserverWrapper(_objectSpread(_objectSpread({}, options), {}, {
40
+ isPostInteraction: true
41
+ }));
50
42
  }
51
43
  }, {
52
44
  key: "startVCObserver",
@@ -12,49 +12,54 @@ export function removeOldBufferRecords(filter) {
12
12
  });
13
13
  }
14
14
  export function createPressureStateReport(start, end) {
15
- // To differentiate between the API not available, vs no PressureRecords added
16
- if (!('PressureObserver' in globalThis)) {
15
+ try {
16
+ // To differentiate between the API not available, vs no PressureRecords added
17
+ if (!('PressureObserver' in globalThis)) {
18
+ return null;
19
+ }
20
+ var pressureStateCount = pressureRecordBuffer.reduce(function (pressureReport, _ref2) {
21
+ var time = _ref2.time,
22
+ state = _ref2.state;
23
+ if (time >= start && time <= end) {
24
+ pressureReport[state] += 1;
25
+ }
26
+ return pressureReport;
27
+ }, {
28
+ nominal: 0,
29
+ fair: 0,
30
+ serious: 0,
31
+ critical: 0
32
+ });
33
+ var pressureStateTotal = Object.values(pressureStateCount).reduce(function (total, count) {
34
+ return total + count;
35
+ }) || 1;
36
+ removeOldBufferRecords(end);
37
+ return {
38
+ count: pressureStateCount,
39
+ percentage: {
40
+ nominal: Math.round(pressureStateCount.nominal / pressureStateTotal * 100),
41
+ fair: Math.round(pressureStateCount.fair / pressureStateTotal * 100),
42
+ serious: Math.round(pressureStateCount.serious / pressureStateTotal * 100),
43
+ critical: Math.round(pressureStateCount.critical / pressureStateTotal * 100)
44
+ }
45
+ };
46
+ } catch (_unused) {
17
47
  return null;
18
48
  }
19
- var pressureStateCount = pressureRecordBuffer.reduce(function (pressureReport, _ref2) {
20
- var time = _ref2.time,
21
- state = _ref2.state;
22
- if (time >= start && time <= end) {
23
- pressureReport[state] += 1;
24
- }
25
- return pressureReport;
26
- }, {
27
- nominal: 0,
28
- fair: 0,
29
- serious: 0,
30
- critical: 0
31
- });
32
- var pressureStateTotal = Object.values(pressureStateCount).reduce(function (total, count) {
33
- return total + count;
34
- }) || 1;
35
- removeOldBufferRecords(end);
36
- return {
37
- count: pressureStateCount,
38
- percentage: {
39
- nominal: Math.round(pressureStateCount.nominal / pressureStateTotal * 100),
40
- fair: Math.round(pressureStateCount.fair / pressureStateTotal * 100),
41
- serious: Math.round(pressureStateCount.serious / pressureStateTotal * 100),
42
- critical: Math.round(pressureStateCount.critical / pressureStateTotal * 100)
43
- }
44
- };
45
49
  }
46
50
  export function initialisePressureObserver() {
47
51
  try {
48
52
  if ('PressureObserver' in globalThis) {
53
+ var _pressureObserver$obs;
49
54
  pressureObserver = new PressureObserver(function (records) {
50
55
  if (pressureRecordBuffer.length + records.length <= BUFFER_MAX_LENGTH) {
51
56
  var _pressureRecordBuffer;
52
57
  (_pressureRecordBuffer = pressureRecordBuffer).push.apply(_pressureRecordBuffer, _toConsumableArray(records));
53
58
  }
54
59
  });
55
- pressureObserver.observe('cpu', {
60
+ (_pressureObserver$obs = pressureObserver.observe('cpu', {
56
61
  sampleInterval: 100
57
- });
62
+ })) === null || _pressureObserver$obs === void 0 || _pressureObserver$obs.catch();
58
63
  }
59
64
  } catch (err) {
60
65
  /* do nothing, this is a best efforts metric */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.12.2",
3
+ "version": "3.12.4",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -130,9 +130,6 @@
130
130
  "platform_ufo_use_offscreen_canvas": {
131
131
  "type": "boolean"
132
132
  },
133
- "platform_ufo_vc_align_revisions_on_watchdog_event": {
134
- "type": "boolean"
135
- },
136
133
  "platform_ufo_canvas_heatmap_full_precision": {
137
134
  "type": "boolean"
138
135
  },