@atlaskit/react-ufo 3.12.0 → 3.12.2

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.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#152526](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/152526)
8
+ [`418c1f18e4a6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/418c1f18e4a6e) -
9
+ FG cleanup for platform_ufo_set_event_failed_status_in_client and
10
+ platform_ufo_ignore_bm3_tti_event_status
11
+
12
+ ## 3.12.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#155148](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/155148)
17
+ [`ae195d27027a7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ae195d27027a7) -
18
+ [HOT-117381] Remove circular dependency on HTMLElement by using an array of WeakRef
19
+
3
20
  ## 3.12.0
4
21
 
5
22
  ### Minor 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;
@@ -87,12 +87,24 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
87
87
  (0, _defineProperty2.default)(this, "handleChildListMutation", function (_ref4) {
88
88
  var addedNodes = _ref4.addedNodes,
89
89
  removedNodes = _ref4.removedNodes;
90
- var removedNodeRects = removedNodes.map(function (n) {
90
+ var removedNodeRects = removedNodes.map(function (ref) {
91
+ var n = ref.deref();
92
+ if (!n) {
93
+ return;
94
+ }
91
95
  return _this.mapVisibleNodeRects.get(n);
92
96
  });
93
- addedNodes.forEach(function (addedNode) {
97
+ addedNodes.forEach(function (addedNodeRef) {
94
98
  var _this$intersectionObs3;
95
- var sameDeletedNode = removedNodes.find(function (n) {
99
+ var addedNode = addedNodeRef.deref();
100
+ if (!addedNode) {
101
+ return;
102
+ }
103
+ var sameDeletedNode = removedNodes.find(function (ref) {
104
+ var n = ref.deref();
105
+ if (!n || !addedNode) {
106
+ return false;
107
+ }
96
108
  return n.isEqualNode(addedNode);
97
109
  });
98
110
  if (sameDeletedNode) {
@@ -50,12 +50,12 @@ function createMutationObserver(_ref) {
50
50
  var _mut$addedNodes, _mut$removedNodes;
51
51
  ((_mut$addedNodes = mut.addedNodes) !== null && _mut$addedNodes !== void 0 ? _mut$addedNodes : []).forEach(function (node) {
52
52
  if (node instanceof HTMLElement) {
53
- addedNodes.push(node);
53
+ addedNodes.push(new WeakRef(node));
54
54
  }
55
55
  });
56
56
  ((_mut$removedNodes = mut.removedNodes) !== null && _mut$removedNodes !== void 0 ? _mut$removedNodes : []).forEach(function (node) {
57
57
  if (node instanceof HTMLElement) {
58
- removedNodes.push(node);
58
+ removedNodes.push(new WeakRef(node));
59
59
  }
60
60
  });
61
61
  }
@@ -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;
@@ -73,10 +73,26 @@ export default class ViewportObserver {
73
73
  addedNodes,
74
74
  removedNodes
75
75
  }) => {
76
- const removedNodeRects = removedNodes.map(n => this.mapVisibleNodeRects.get(n));
77
- addedNodes.forEach(addedNode => {
76
+ const removedNodeRects = removedNodes.map(ref => {
77
+ const n = ref.deref();
78
+ if (!n) {
79
+ return;
80
+ }
81
+ return this.mapVisibleNodeRects.get(n);
82
+ });
83
+ addedNodes.forEach(addedNodeRef => {
78
84
  var _this$intersectionObs3;
79
- const sameDeletedNode = removedNodes.find(n => n.isEqualNode(addedNode));
85
+ const addedNode = addedNodeRef.deref();
86
+ if (!addedNode) {
87
+ return;
88
+ }
89
+ const sameDeletedNode = removedNodes.find(ref => {
90
+ const n = ref.deref();
91
+ if (!n || !addedNode) {
92
+ return false;
93
+ }
94
+ return n.isEqualNode(addedNode);
95
+ });
80
96
  if (sameDeletedNode) {
81
97
  var _this$intersectionObs;
82
98
  (_this$intersectionObs = this.intersectionObserver) === null || _this$intersectionObs === void 0 ? void 0 : _this$intersectionObs.watchAndTag(addedNode, 'mutation:remount');
@@ -38,12 +38,12 @@ function createMutationObserver({
38
38
  var _mut$addedNodes, _mut$removedNodes;
39
39
  ((_mut$addedNodes = mut.addedNodes) !== null && _mut$addedNodes !== void 0 ? _mut$addedNodes : []).forEach(node => {
40
40
  if (node instanceof HTMLElement) {
41
- addedNodes.push(node);
41
+ addedNodes.push(new WeakRef(node));
42
42
  }
43
43
  });
44
44
  ((_mut$removedNodes = mut.removedNodes) !== null && _mut$removedNodes !== void 0 ? _mut$removedNodes : []).forEach(node => {
45
45
  if (node instanceof HTMLElement) {
46
- removedNodes.push(node);
46
+ removedNodes.push(new WeakRef(node));
47
47
  }
48
48
  });
49
49
  }
@@ -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;
@@ -80,12 +80,24 @@ var ViewportObserver = /*#__PURE__*/function () {
80
80
  _defineProperty(this, "handleChildListMutation", function (_ref4) {
81
81
  var addedNodes = _ref4.addedNodes,
82
82
  removedNodes = _ref4.removedNodes;
83
- var removedNodeRects = removedNodes.map(function (n) {
83
+ var removedNodeRects = removedNodes.map(function (ref) {
84
+ var n = ref.deref();
85
+ if (!n) {
86
+ return;
87
+ }
84
88
  return _this.mapVisibleNodeRects.get(n);
85
89
  });
86
- addedNodes.forEach(function (addedNode) {
90
+ addedNodes.forEach(function (addedNodeRef) {
87
91
  var _this$intersectionObs3;
88
- var sameDeletedNode = removedNodes.find(function (n) {
92
+ var addedNode = addedNodeRef.deref();
93
+ if (!addedNode) {
94
+ return;
95
+ }
96
+ var sameDeletedNode = removedNodes.find(function (ref) {
97
+ var n = ref.deref();
98
+ if (!n || !addedNode) {
99
+ return false;
100
+ }
89
101
  return n.isEqualNode(addedNode);
90
102
  });
91
103
  if (sameDeletedNode) {
@@ -44,12 +44,12 @@ function createMutationObserver(_ref) {
44
44
  var _mut$addedNodes, _mut$removedNodes;
45
45
  ((_mut$addedNodes = mut.addedNodes) !== null && _mut$addedNodes !== void 0 ? _mut$addedNodes : []).forEach(function (node) {
46
46
  if (node instanceof HTMLElement) {
47
- addedNodes.push(node);
47
+ addedNodes.push(new WeakRef(node));
48
48
  }
49
49
  });
50
50
  ((_mut$removedNodes = mut.removedNodes) !== null && _mut$removedNodes !== void 0 ? _mut$removedNodes : []).forEach(function (node) {
51
51
  if (node instanceof HTMLElement) {
52
- removedNodes.push(node);
52
+ removedNodes.push(new WeakRef(node));
53
53
  }
54
54
  });
55
55
  }
@@ -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;
@@ -7,8 +7,8 @@ export type CreateMutationObserverProps = {
7
7
  targets: Array<HTMLElement>;
8
8
  }) => void;
9
9
  onChildListMutation: (props: {
10
- addedNodes: ReadonlyArray<HTMLElement>;
11
- removedNodes: ReadonlyArray<HTMLElement>;
10
+ addedNodes: ReadonlyArray<WeakRef<HTMLElement>>;
11
+ removedNodes: ReadonlyArray<WeakRef<HTMLElement>>;
12
12
  }) => void;
13
13
  };
14
14
  declare function createMutationObserver({ onAttributeMutation, onChildListMutation, onMutationFinished, }: CreateMutationObserverProps): MutationObserver | null;
@@ -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;
@@ -7,8 +7,8 @@ export type CreateMutationObserverProps = {
7
7
  targets: Array<HTMLElement>;
8
8
  }) => void;
9
9
  onChildListMutation: (props: {
10
- addedNodes: ReadonlyArray<HTMLElement>;
11
- removedNodes: ReadonlyArray<HTMLElement>;
10
+ addedNodes: ReadonlyArray<WeakRef<HTMLElement>>;
11
+ removedNodes: ReadonlyArray<WeakRef<HTMLElement>>;
12
12
  }) => void;
13
13
  };
14
14
  declare function createMutationObserver({ onAttributeMutation, onChildListMutation, onMutationFinished, }: CreateMutationObserverProps): MutationObserver | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.12.0",
3
+ "version": "3.12.2",
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
  },