@atlaskit/react-ufo 3.14.9 → 3.14.10

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,13 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.14.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#180425](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/180425)
8
+ [`b932e1047acb7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b932e1047acb7) -
9
+ Check if responsiveness exists before updating for press interactions
10
+
3
11
  ## 3.14.9
4
12
 
5
13
  ### Patch Changes
@@ -29,6 +29,12 @@ function getTestIdName(memoizedProps) {
29
29
  }
30
30
  return null;
31
31
  }
32
+ function getUFOSegmentName(componentName, memoizedProps) {
33
+ if (memoizedProps && memoizedProps['name']) {
34
+ return "UFOSegment[name=".concat(memoizedProps['name'], "]");
35
+ }
36
+ return componentName;
37
+ }
32
38
  function getReactComponentHierarchy(element) {
33
39
  var componentHierarchy = [];
34
40
  // Function to traverse up the fiber tree
@@ -40,11 +46,12 @@ function getReactComponentHierarchy(element) {
40
46
  var componentName = currentFiber.type.displayName || currentFiber.type.name;
41
47
  // checking when component name is bigger than the minimized name produced by react
42
48
  if (componentName && componentName.length > 2 && !componentName.includes('Listener') && !componentName.includes('Provider')) {
49
+ if (componentName === 'UFOSegment') {
50
+ componentHierarchy.push(getUFOSegmentName(componentName, currentFiber.memoizedProps));
51
+ break;
52
+ }
43
53
  componentHierarchy.push(componentName);
44
54
  }
45
- if (componentName === 'UFOSegment') {
46
- break;
47
- }
48
55
  }
49
56
  if (currentFiber.memoizedProps) {
50
57
  var dataIdInfo = getTestIdName(currentFiber.memoizedProps);
@@ -90,23 +97,20 @@ var getPerformanceObserver = exports.getPerformanceObserver = function getPerfor
90
97
  var setInteractionPerformanceEvent = exports.setInteractionPerformanceEvent = function setInteractionPerformanceEvent(entry) {
91
98
  var interaction = (0, _interactionMetrics.getActiveInteraction)();
92
99
  if ((interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
93
- var _interaction$responsi, _interaction$responsi2;
94
- // if happens there is another event interaction that has started after
95
- // the initial one, we don't want to replace the values if they have already been set up
96
- interaction.responsiveness = _objectSpread(_objectSpread({}, interaction.responsiveness), {}, {
97
- experimentalInputToNextPaint: ((_interaction$responsi = interaction.responsiveness) === null || _interaction$responsi === void 0 ? void 0 : _interaction$responsi.experimentalInputToNextPaint) || entry.duration,
98
- inputDelay: ((_interaction$responsi2 = interaction.responsiveness) === null || _interaction$responsi2 === void 0 ? void 0 : _interaction$responsi2.inputDelay) || entry.processingStart - entry.startTime
99
- });
100
- // if the entry start time is lower than the one in the interaction
101
- // it means the interaction start time is not accurate, we assign
102
- // this value which will match the timestamp in the event
103
- interaction.start = Math.min(interaction.start, entry.startTime);
104
- if (interaction.ufoName === 'unknown' && (0, _platformFeatureFlags.fg)('platform_ufo_enable_unknown_interactions_elements')) {
105
- if (entry.target) {
106
- var componentHierarchy = getReactComponentHierarchy(entry.target);
107
- interaction.unknownElementHierarchy = componentHierarchy;
100
+ var _interaction$responsi;
101
+ if (!((_interaction$responsi = interaction.responsiveness) !== null && _interaction$responsi !== void 0 && _interaction$responsi.experimentalInputToNextPaint)) {
102
+ var _interaction$responsi2, _interaction$responsi3;
103
+ interaction.responsiveness = _objectSpread(_objectSpread({}, interaction.responsiveness), {}, {
104
+ experimentalInputToNextPaint: ((_interaction$responsi2 = interaction.responsiveness) === null || _interaction$responsi2 === void 0 ? void 0 : _interaction$responsi2.experimentalInputToNextPaint) || entry.duration,
105
+ inputDelay: ((_interaction$responsi3 = interaction.responsiveness) === null || _interaction$responsi3 === void 0 ? void 0 : _interaction$responsi3.inputDelay) || entry.processingStart - entry.startTime
106
+ });
107
+ if (interaction.ufoName === 'unknown' && (0, _platformFeatureFlags.fg)('platform_ufo_enable_unknown_interactions_elements')) {
108
+ if (entry.target) {
109
+ var componentHierarchy = getReactComponentHierarchy(entry.target);
110
+ interaction.unknownElementHierarchy = componentHierarchy;
111
+ }
112
+ interaction.unknownElementName = (0, _getUniqueElementName.default)(selectorConfig, entry.target);
108
113
  }
109
- interaction.unknownElementName = (0, _getUniqueElementName.default)(selectorConfig, entry.target);
110
114
  }
111
115
  }
112
116
  };
@@ -16,6 +16,12 @@ function getTestIdName(memoizedProps) {
16
16
  }
17
17
  return null;
18
18
  }
19
+ function getUFOSegmentName(componentName, memoizedProps) {
20
+ if (memoizedProps && memoizedProps['name']) {
21
+ return `UFOSegment[name=${memoizedProps['name']}]`;
22
+ }
23
+ return componentName;
24
+ }
19
25
  function getReactComponentHierarchy(element) {
20
26
  const componentHierarchy = [];
21
27
  // Function to traverse up the fiber tree
@@ -27,11 +33,12 @@ function getReactComponentHierarchy(element) {
27
33
  const componentName = currentFiber.type.displayName || currentFiber.type.name;
28
34
  // checking when component name is bigger than the minimized name produced by react
29
35
  if (componentName && componentName.length > 2 && !componentName.includes('Listener') && !componentName.includes('Provider')) {
36
+ if (componentName === 'UFOSegment') {
37
+ componentHierarchy.push(getUFOSegmentName(componentName, currentFiber.memoizedProps));
38
+ break;
39
+ }
30
40
  componentHierarchy.push(componentName);
31
41
  }
32
- if (componentName === 'UFOSegment') {
33
- break;
34
- }
35
42
  }
36
43
  if (currentFiber.memoizedProps) {
37
44
  const dataIdInfo = getTestIdName(currentFiber.memoizedProps);
@@ -66,24 +73,21 @@ export const getPerformanceObserver = () => {
66
73
  export const setInteractionPerformanceEvent = entry => {
67
74
  const interaction = getActiveInteraction();
68
75
  if ((interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
69
- var _interaction$responsi, _interaction$responsi2;
70
- // if happens there is another event interaction that has started after
71
- // the initial one, we don't want to replace the values if they have already been set up
72
- interaction.responsiveness = {
73
- ...interaction.responsiveness,
74
- experimentalInputToNextPaint: ((_interaction$responsi = interaction.responsiveness) === null || _interaction$responsi === void 0 ? void 0 : _interaction$responsi.experimentalInputToNextPaint) || entry.duration,
75
- inputDelay: ((_interaction$responsi2 = interaction.responsiveness) === null || _interaction$responsi2 === void 0 ? void 0 : _interaction$responsi2.inputDelay) || entry.processingStart - entry.startTime
76
- };
77
- // if the entry start time is lower than the one in the interaction
78
- // it means the interaction start time is not accurate, we assign
79
- // this value which will match the timestamp in the event
80
- interaction.start = Math.min(interaction.start, entry.startTime);
81
- if (interaction.ufoName === 'unknown' && fg('platform_ufo_enable_unknown_interactions_elements')) {
82
- if (entry.target) {
83
- const componentHierarchy = getReactComponentHierarchy(entry.target);
84
- interaction.unknownElementHierarchy = componentHierarchy;
76
+ var _interaction$responsi;
77
+ if (!((_interaction$responsi = interaction.responsiveness) !== null && _interaction$responsi !== void 0 && _interaction$responsi.experimentalInputToNextPaint)) {
78
+ var _interaction$responsi2, _interaction$responsi3;
79
+ interaction.responsiveness = {
80
+ ...interaction.responsiveness,
81
+ experimentalInputToNextPaint: ((_interaction$responsi2 = interaction.responsiveness) === null || _interaction$responsi2 === void 0 ? void 0 : _interaction$responsi2.experimentalInputToNextPaint) || entry.duration,
82
+ inputDelay: ((_interaction$responsi3 = interaction.responsiveness) === null || _interaction$responsi3 === void 0 ? void 0 : _interaction$responsi3.inputDelay) || entry.processingStart - entry.startTime
83
+ };
84
+ if (interaction.ufoName === 'unknown' && fg('platform_ufo_enable_unknown_interactions_elements')) {
85
+ if (entry.target) {
86
+ const componentHierarchy = getReactComponentHierarchy(entry.target);
87
+ interaction.unknownElementHierarchy = componentHierarchy;
88
+ }
89
+ interaction.unknownElementName = getElementName(selectorConfig, entry.target);
85
90
  }
86
- interaction.unknownElementName = getElementName(selectorConfig, entry.target);
87
91
  }
88
92
  }
89
93
  };
@@ -22,6 +22,12 @@ function getTestIdName(memoizedProps) {
22
22
  }
23
23
  return null;
24
24
  }
25
+ function getUFOSegmentName(componentName, memoizedProps) {
26
+ if (memoizedProps && memoizedProps['name']) {
27
+ return "UFOSegment[name=".concat(memoizedProps['name'], "]");
28
+ }
29
+ return componentName;
30
+ }
25
31
  function getReactComponentHierarchy(element) {
26
32
  var componentHierarchy = [];
27
33
  // Function to traverse up the fiber tree
@@ -33,11 +39,12 @@ function getReactComponentHierarchy(element) {
33
39
  var componentName = currentFiber.type.displayName || currentFiber.type.name;
34
40
  // checking when component name is bigger than the minimized name produced by react
35
41
  if (componentName && componentName.length > 2 && !componentName.includes('Listener') && !componentName.includes('Provider')) {
42
+ if (componentName === 'UFOSegment') {
43
+ componentHierarchy.push(getUFOSegmentName(componentName, currentFiber.memoizedProps));
44
+ break;
45
+ }
36
46
  componentHierarchy.push(componentName);
37
47
  }
38
- if (componentName === 'UFOSegment') {
39
- break;
40
- }
41
48
  }
42
49
  if (currentFiber.memoizedProps) {
43
50
  var dataIdInfo = getTestIdName(currentFiber.memoizedProps);
@@ -83,23 +90,20 @@ export var getPerformanceObserver = function getPerformanceObserver() {
83
90
  export var setInteractionPerformanceEvent = function setInteractionPerformanceEvent(entry) {
84
91
  var interaction = getActiveInteraction();
85
92
  if ((interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
86
- var _interaction$responsi, _interaction$responsi2;
87
- // if happens there is another event interaction that has started after
88
- // the initial one, we don't want to replace the values if they have already been set up
89
- interaction.responsiveness = _objectSpread(_objectSpread({}, interaction.responsiveness), {}, {
90
- experimentalInputToNextPaint: ((_interaction$responsi = interaction.responsiveness) === null || _interaction$responsi === void 0 ? void 0 : _interaction$responsi.experimentalInputToNextPaint) || entry.duration,
91
- inputDelay: ((_interaction$responsi2 = interaction.responsiveness) === null || _interaction$responsi2 === void 0 ? void 0 : _interaction$responsi2.inputDelay) || entry.processingStart - entry.startTime
92
- });
93
- // if the entry start time is lower than the one in the interaction
94
- // it means the interaction start time is not accurate, we assign
95
- // this value which will match the timestamp in the event
96
- interaction.start = Math.min(interaction.start, entry.startTime);
97
- if (interaction.ufoName === 'unknown' && fg('platform_ufo_enable_unknown_interactions_elements')) {
98
- if (entry.target) {
99
- var componentHierarchy = getReactComponentHierarchy(entry.target);
100
- interaction.unknownElementHierarchy = componentHierarchy;
93
+ var _interaction$responsi;
94
+ if (!((_interaction$responsi = interaction.responsiveness) !== null && _interaction$responsi !== void 0 && _interaction$responsi.experimentalInputToNextPaint)) {
95
+ var _interaction$responsi2, _interaction$responsi3;
96
+ interaction.responsiveness = _objectSpread(_objectSpread({}, interaction.responsiveness), {}, {
97
+ experimentalInputToNextPaint: ((_interaction$responsi2 = interaction.responsiveness) === null || _interaction$responsi2 === void 0 ? void 0 : _interaction$responsi2.experimentalInputToNextPaint) || entry.duration,
98
+ inputDelay: ((_interaction$responsi3 = interaction.responsiveness) === null || _interaction$responsi3 === void 0 ? void 0 : _interaction$responsi3.inputDelay) || entry.processingStart - entry.startTime
99
+ });
100
+ if (interaction.ufoName === 'unknown' && fg('platform_ufo_enable_unknown_interactions_elements')) {
101
+ if (entry.target) {
102
+ var componentHierarchy = getReactComponentHierarchy(entry.target);
103
+ interaction.unknownElementHierarchy = componentHierarchy;
104
+ }
105
+ interaction.unknownElementName = getElementName(selectorConfig, entry.target);
101
106
  }
102
- interaction.unknownElementName = getElementName(selectorConfig, entry.target);
103
107
  }
104
108
  }
105
109
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.14.9",
3
+ "version": "3.14.10",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",