@atlaskit/react-ufo 5.0.2 → 5.0.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,19 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 5.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`461f1fb9cf949`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/461f1fb9cf949) -
8
+ FG cleanup - platform_ufo_add_segment_names_to_dom_offenders
9
+
10
+ ## 5.0.3
11
+
12
+ ### Patch Changes
13
+
14
+ - [`0c485e6a6efa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0c485e6a6efa4) -
15
+ round off reported VC ratios
16
+
3
17
  ## 5.0.2
4
18
 
5
19
  ### Patch Changes
@@ -93,7 +93,7 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
93
93
  oldValue: mutationData === null || mutationData === void 0 ? void 0 : mutationData.oldValue,
94
94
  newValue: mutationData === null || mutationData === void 0 ? void 0 : mutationData.newValue
95
95
  };
96
- if (element && (_this.isPostInteraction || (0, _platformFeatureFlags.fg)('platform_ufo_add_segment_names_to_dom_offenders'))) {
96
+ if (element) {
97
97
  var labelStacks = getLabelStacks(element);
98
98
  if (labelStacks) {
99
99
  Object.assign(data, {
@@ -22,6 +22,13 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
22
22
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
23
23
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
24
24
  // Create comprehensive debug details including ignored entries
25
+
26
+ // Helper function for reporting ratios
27
+ function roundDecimal(value) {
28
+ var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
29
+ var factor = Math.pow(10, decimals);
30
+ return Math.round(value * factor) / factor;
31
+ }
25
32
  var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
26
33
  function AbstractVCCalculatorBase(revisionNo) {
27
34
  (0, _classCallCheck2.default)(this, AbstractVCCalculatorBase);
@@ -72,7 +79,11 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
72
79
  elementName = _step2$value[0],
73
80
  rect = _step2$value[1];
74
81
  var elementArea = rect.width * rect.height;
75
- ratios[elementName] = elementArea / totalViewportArea;
82
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_round_vc_ratios')) {
83
+ ratios[elementName] = roundDecimal(elementArea / totalViewportArea);
84
+ } else {
85
+ ratios[elementName] = elementArea / totalViewportArea;
86
+ }
76
87
  }
77
88
  } catch (err) {
78
89
  _iterator2.e(err);
@@ -96,7 +107,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
96
107
  segment: _entry2.data.labelStacks.segment,
97
108
  labelStack: _entry2.data.labelStacks.labelStack
98
109
  };
99
- } else if ((0, _platformFeatureFlags.fg)('platform_ufo_add_segment_names_to_dom_offenders')) {
110
+ } else {
100
111
  labelStacks[_entry2.data.elementName] = _entry2.data.labelStacks.labelStack;
101
112
  }
102
113
  }
@@ -428,9 +439,7 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
428
439
  if (ssrRatio !== -1) {
429
440
  result.ssrRatio = ssrRatio;
430
441
  }
431
- if (isPostInteraction || (0, _platformFeatureFlags.fg)('platform_ufo_add_segment_names_to_dom_offenders')) {
432
- result.labelStacks = this.getLabelStacks(filteredEntries, isPostInteraction);
433
- }
442
+ result.labelStacks = this.getLabelStacks(filteredEntries, isPostInteraction);
434
443
  return _context2.abrupt("return", result);
435
444
  case 17:
436
445
  case "end":
@@ -77,7 +77,7 @@ export default class VCObserverNew {
77
77
  oldValue: mutationData === null || mutationData === void 0 ? void 0 : mutationData.oldValue,
78
78
  newValue: mutationData === null || mutationData === void 0 ? void 0 : mutationData.newValue
79
79
  };
80
- if (element && (this.isPostInteraction || fg('platform_ufo_add_segment_names_to_dom_offenders'))) {
80
+ if (element) {
81
81
  const labelStacks = getLabelStacks(element);
82
82
  if (labelStacks) {
83
83
  Object.assign(data, {
@@ -5,6 +5,11 @@ import getViewportWidth from './utils/get-viewport-width';
5
5
 
6
6
  // Create comprehensive debug details including ignored entries
7
7
 
8
+ // Helper function for reporting ratios
9
+ function roundDecimal(value, decimals = 3) {
10
+ const factor = Math.pow(10, decimals);
11
+ return Math.round(value * factor) / factor;
12
+ }
8
13
  export default class AbstractVCCalculatorBase {
9
14
  constructor(revisionNo) {
10
15
  this.revisionNo = revisionNo;
@@ -35,7 +40,11 @@ export default class AbstractVCCalculatorBase {
35
40
  }
36
41
  for (const [elementName, rect] of elementRects) {
37
42
  const elementArea = rect.width * rect.height;
38
- ratios[elementName] = elementArea / totalViewportArea;
43
+ if (fg('platform_ufo_round_vc_ratios')) {
44
+ ratios[elementName] = roundDecimal(elementArea / totalViewportArea);
45
+ } else {
46
+ ratios[elementName] = elementArea / totalViewportArea;
47
+ }
39
48
  }
40
49
  return ratios;
41
50
  }
@@ -48,7 +57,7 @@ export default class AbstractVCCalculatorBase {
48
57
  segment: entry.data.labelStacks.segment,
49
58
  labelStack: entry.data.labelStacks.labelStack
50
59
  };
51
- } else if (fg('platform_ufo_add_segment_names_to_dom_offenders')) {
60
+ } else {
52
61
  labelStacks[entry.data.elementName] = entry.data.labelStacks.labelStack;
53
62
  }
54
63
  }
@@ -309,9 +318,7 @@ export default class AbstractVCCalculatorBase {
309
318
  if (ssrRatio !== -1) {
310
319
  result.ssrRatio = ssrRatio;
311
320
  }
312
- if (isPostInteraction || fg('platform_ufo_add_segment_names_to_dom_offenders')) {
313
- result.labelStacks = this.getLabelStacks(filteredEntries, isPostInteraction);
314
- }
321
+ result.labelStacks = this.getLabelStacks(filteredEntries, isPostInteraction);
315
322
  return result;
316
323
  }
317
324
  }
@@ -86,7 +86,7 @@ var VCObserverNew = /*#__PURE__*/function () {
86
86
  oldValue: mutationData === null || mutationData === void 0 ? void 0 : mutationData.oldValue,
87
87
  newValue: mutationData === null || mutationData === void 0 ? void 0 : mutationData.newValue
88
88
  };
89
- if (element && (_this.isPostInteraction || fg('platform_ufo_add_segment_names_to_dom_offenders'))) {
89
+ if (element) {
90
90
  var labelStacks = getLabelStacks(element);
91
91
  if (labelStacks) {
92
92
  Object.assign(data, {
@@ -16,6 +16,13 @@ import getViewportHeight from './utils/get-viewport-height';
16
16
  import getViewportWidth from './utils/get-viewport-width';
17
17
 
18
18
  // Create comprehensive debug details including ignored entries
19
+
20
+ // Helper function for reporting ratios
21
+ function roundDecimal(value) {
22
+ var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
23
+ var factor = Math.pow(10, decimals);
24
+ return Math.round(value * factor) / factor;
25
+ }
19
26
  var AbstractVCCalculatorBase = /*#__PURE__*/function () {
20
27
  function AbstractVCCalculatorBase(revisionNo) {
21
28
  _classCallCheck(this, AbstractVCCalculatorBase);
@@ -66,7 +73,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
66
73
  elementName = _step2$value[0],
67
74
  rect = _step2$value[1];
68
75
  var elementArea = rect.width * rect.height;
69
- ratios[elementName] = elementArea / totalViewportArea;
76
+ if (fg('platform_ufo_round_vc_ratios')) {
77
+ ratios[elementName] = roundDecimal(elementArea / totalViewportArea);
78
+ } else {
79
+ ratios[elementName] = elementArea / totalViewportArea;
80
+ }
70
81
  }
71
82
  } catch (err) {
72
83
  _iterator2.e(err);
@@ -90,7 +101,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
90
101
  segment: _entry2.data.labelStacks.segment,
91
102
  labelStack: _entry2.data.labelStacks.labelStack
92
103
  };
93
- } else if (fg('platform_ufo_add_segment_names_to_dom_offenders')) {
104
+ } else {
94
105
  labelStacks[_entry2.data.elementName] = _entry2.data.labelStacks.labelStack;
95
106
  }
96
107
  }
@@ -422,9 +433,7 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
422
433
  if (ssrRatio !== -1) {
423
434
  result.ssrRatio = ssrRatio;
424
435
  }
425
- if (isPostInteraction || fg('platform_ufo_add_segment_names_to_dom_offenders')) {
426
- result.labelStacks = this.getLabelStacks(filteredEntries, isPostInteraction);
427
- }
436
+ result.labelStacks = this.getLabelStacks(filteredEntries, isPostInteraction);
428
437
  return _context2.abrupt("return", result);
429
438
  case 17:
430
439
  case "end":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -123,6 +123,9 @@
123
123
  "platform_ufo_exclude_3p_elements_from_ttai": {
124
124
  "type": "boolean"
125
125
  },
126
+ "platform_ufo_round_vc_ratios": {
127
+ "type": "boolean"
128
+ },
126
129
  "platform_ufo_exclude_3p_elements_from_ttvc": {
127
130
  "type": "boolean"
128
131
  },
@@ -153,9 +156,6 @@
153
156
  "platform_ufo_enable_late_holds_post_interaction": {
154
157
  "type": "boolean"
155
158
  },
156
- "platform_ufo_add_segment_names_to_dom_offenders": {
157
- "type": "boolean"
158
- },
159
159
  "platform_ufo_filter_cls_logs_same_rects_positions": {
160
160
  "type": "boolean"
161
161
  },