@atlaskit/react-ufo 3.12.1 → 3.12.3

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,22 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.12.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#155959](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/155959)
8
+ [`eeaa8485061ce`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eeaa8485061ce) -
9
+ Add further error handling to CPU monitoring logic
10
+
11
+ ## 3.12.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#152526](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/152526)
16
+ [`418c1f18e4a6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/418c1f18e4a6e) -
17
+ FG cleanup for platform_ufo_set_event_failed_status_in_client and
18
+ platform_ufo_ignore_bm3_tti_event_status
19
+
3
20
  ## 3.12.1
4
21
 
5
22
  ### Patch Changes
@@ -4,40 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
- /**
9
- * Determines the interaction status based on abort reason and BM3 TTI presence.
10
- *
11
- * @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
12
- * @returns {{
13
- * originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
14
- * overrideStatus: 'ABORTED' | 'SUCCEEDED'
15
- * }} An object containing both the original and override status
16
- *
17
- * @description
18
- * This function evaluates the interaction status in two ways:
19
- * 1. originalInteractionStatus: Based on whether there's an abort reason
20
- * 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
21
- *
22
- * @example
23
- * const interaction = {
24
- * abortReason: null,
25
- * apdex: [1, 2, 3]
26
- * };
27
- * const result = getInteractionStatus(interaction);
28
- * // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
29
- */
30
7
  function getInteractionStatus(interaction) {
31
8
  var originalInteractionStatus = interaction.abortReason ? 'ABORTED' : 'SUCCEEDED';
32
9
  var hasErrors = interaction.errors.length > 0;
33
- if ((0, _platformFeatureFlags.fg)('platform_ufo_set_event_failed_status_in_client')) {
34
- originalInteractionStatus = hasErrors ? 'FAILED' : originalInteractionStatus;
35
- }
36
- var hasBm3TTI = interaction.apdex.length > 0;
37
- var overrideStatus = hasBm3TTI && !(0, _platformFeatureFlags.fg)('platform_ufo_ignore_bm3_tti_event_status') ? 'SUCCEEDED' : originalInteractionStatus;
10
+ originalInteractionStatus = hasErrors ? 'FAILED' : originalInteractionStatus;
11
+
12
+ // `overrideStatus` is to be deprecated - https://product-fabric.atlassian.net/browse/AFO-3760
38
13
  return {
39
14
  originalInteractionStatus: originalInteractionStatus,
40
- overrideStatus: overrideStatus
15
+ overrideStatus: originalInteractionStatus
41
16
  };
42
17
  }
43
18
  var _default = exports.default = getInteractionStatus;
@@ -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 */
@@ -1,37 +1,12 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
- /**
3
- * Determines the interaction status based on abort reason and BM3 TTI presence.
4
- *
5
- * @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
6
- * @returns {{
7
- * originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
8
- * overrideStatus: 'ABORTED' | 'SUCCEEDED'
9
- * }} An object containing both the original and override status
10
- *
11
- * @description
12
- * This function evaluates the interaction status in two ways:
13
- * 1. originalInteractionStatus: Based on whether there's an abort reason
14
- * 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
15
- *
16
- * @example
17
- * const interaction = {
18
- * abortReason: null,
19
- * apdex: [1, 2, 3]
20
- * };
21
- * const result = getInteractionStatus(interaction);
22
- * // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
23
- */
24
1
  function getInteractionStatus(interaction) {
25
2
  let originalInteractionStatus = interaction.abortReason ? 'ABORTED' : 'SUCCEEDED';
26
3
  const hasErrors = interaction.errors.length > 0;
27
- if (fg('platform_ufo_set_event_failed_status_in_client')) {
28
- originalInteractionStatus = hasErrors ? 'FAILED' : originalInteractionStatus;
29
- }
30
- const hasBm3TTI = interaction.apdex.length > 0;
31
- const overrideStatus = hasBm3TTI && !fg('platform_ufo_ignore_bm3_tti_event_status') ? 'SUCCEEDED' : originalInteractionStatus;
4
+ originalInteractionStatus = hasErrors ? 'FAILED' : originalInteractionStatus;
5
+
6
+ // `overrideStatus` is to be deprecated - https://product-fabric.atlassian.net/browse/AFO-3760
32
7
  return {
33
8
  originalInteractionStatus,
34
- overrideStatus
9
+ overrideStatus: originalInteractionStatus
35
10
  };
36
11
  }
37
12
  export default getInteractionStatus;
@@ -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 */
@@ -1,37 +1,12 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
- /**
3
- * Determines the interaction status based on abort reason and BM3 TTI presence.
4
- *
5
- * @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
6
- * @returns {{
7
- * originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
8
- * overrideStatus: 'ABORTED' | 'SUCCEEDED'
9
- * }} An object containing both the original and override status
10
- *
11
- * @description
12
- * This function evaluates the interaction status in two ways:
13
- * 1. originalInteractionStatus: Based on whether there's an abort reason
14
- * 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
15
- *
16
- * @example
17
- * const interaction = {
18
- * abortReason: null,
19
- * apdex: [1, 2, 3]
20
- * };
21
- * const result = getInteractionStatus(interaction);
22
- * // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
23
- */
24
1
  function getInteractionStatus(interaction) {
25
2
  var originalInteractionStatus = interaction.abortReason ? 'ABORTED' : 'SUCCEEDED';
26
3
  var hasErrors = interaction.errors.length > 0;
27
- if (fg('platform_ufo_set_event_failed_status_in_client')) {
28
- originalInteractionStatus = hasErrors ? 'FAILED' : originalInteractionStatus;
29
- }
30
- var hasBm3TTI = interaction.apdex.length > 0;
31
- var overrideStatus = hasBm3TTI && !fg('platform_ufo_ignore_bm3_tti_event_status') ? 'SUCCEEDED' : originalInteractionStatus;
4
+ originalInteractionStatus = hasErrors ? 'FAILED' : originalInteractionStatus;
5
+
6
+ // `overrideStatus` is to be deprecated - https://product-fabric.atlassian.net/browse/AFO-3760
32
7
  return {
33
8
  originalInteractionStatus: originalInteractionStatus,
34
- overrideStatus: overrideStatus
9
+ overrideStatus: originalInteractionStatus
35
10
  };
36
11
  }
37
12
  export default getInteractionStatus;
@@ -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 */
@@ -1,26 +1,4 @@
1
1
  import type { InteractionMetrics } from '../../common';
2
- /**
3
- * Determines the interaction status based on abort reason and BM3 TTI presence.
4
- *
5
- * @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
6
- * @returns {{
7
- * originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
8
- * overrideStatus: 'ABORTED' | 'SUCCEEDED'
9
- * }} An object containing both the original and override status
10
- *
11
- * @description
12
- * This function evaluates the interaction status in two ways:
13
- * 1. originalInteractionStatus: Based on whether there's an abort reason
14
- * 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
15
- *
16
- * @example
17
- * const interaction = {
18
- * abortReason: null,
19
- * apdex: [1, 2, 3]
20
- * };
21
- * const result = getInteractionStatus(interaction);
22
- * // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
23
- */
24
2
  declare function getInteractionStatus(interaction: InteractionMetrics): {
25
3
  readonly originalInteractionStatus: string;
26
4
  readonly overrideStatus: string;
@@ -1,26 +1,4 @@
1
1
  import type { InteractionMetrics } from '../../common';
2
- /**
3
- * Determines the interaction status based on abort reason and BM3 TTI presence.
4
- *
5
- * @param {InteractionMetrics} interaction - The interaction metrics object containing abort reason and apdex data
6
- * @returns {{
7
- * originalInteractionStatus: 'ABORTED' | 'SUCCEEDED',
8
- * overrideStatus: 'ABORTED' | 'SUCCEEDED'
9
- * }} An object containing both the original and override status
10
- *
11
- * @description
12
- * This function evaluates the interaction status in two ways:
13
- * 1. originalInteractionStatus: Based on whether there's an abort reason
14
- * 2. overrideStatus: Based on the presence of BM3 TTI (apdex data)
15
- *
16
- * @example
17
- * const interaction = {
18
- * abortReason: null,
19
- * apdex: [1, 2, 3]
20
- * };
21
- * const result = getInteractionStatus(interaction);
22
- * // Returns: { originalInteractionStatus: 'SUCCEEDED', overrideStatus: 'SUCCEEDED' }
23
- */
24
2
  declare function getInteractionStatus(interaction: InteractionMetrics): {
25
3
  readonly originalInteractionStatus: string;
26
4
  readonly overrideStatus: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.12.1",
3
+ "version": "3.12.3",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -154,12 +154,6 @@
154
154
  "platform_ufo_no_vc_on_aborted": {
155
155
  "type": "boolean"
156
156
  },
157
- "platform_ufo_set_event_failed_status_in_client": {
158
- "type": "boolean"
159
- },
160
- "platform_ufo_ignore_bm3_tti_event_status": {
161
- "type": "boolean"
162
- },
163
157
  "ufo_payload_use_idle_callback": {
164
158
  "type": "boolean"
165
159
  },