@atlaskit/react-ufo 5.0.0 → 5.0.1

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,12 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 5.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`60444262e8606`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/60444262e8606) -
8
+ Deduplicate reported VC offenders in UFO payload
9
+
3
10
  ## 5.0.0
4
11
 
5
12
  ### Major Changes
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
13
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -164,9 +164,18 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
164
164
  case 19:
165
165
  // Check if this entry matches any checkpoint percentiles
166
166
  if (viewportPercentage >= percentiles[percentileIndex]) {
167
- elementNames = entries.map(function (e) {
168
- return e.elementName;
169
- }); // Process all matching percentiles in one go
167
+ elementNames = [];
168
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_dedupe_repeated_vc_offenders')) {
169
+ elementNames = (0, _toConsumableArray2.default)(new Set(entries.map(function (e) {
170
+ return e.elementName;
171
+ })));
172
+ } else {
173
+ elementNames = entries.map(function (e) {
174
+ return e.elementName;
175
+ });
176
+ }
177
+
178
+ // Process all matching percentiles in one go
170
179
  while (percentileIndex < percentiles.length && viewportPercentage >= percentiles[percentileIndex]) {
171
180
  vcDetails["".concat(percentiles[percentileIndex])] = {
172
181
  t: Math.round(time),
@@ -43,13 +43,13 @@ function createMutationObserver(_ref) {
43
43
  if (mut.type === 'attributes') {
44
44
  var _mut$oldValue;
45
45
  /*
46
- "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
47
- I think it might have been something along the lines that for consistency every setAttribute call should create a record.
48
- Conceptually there is after all a mutation: there is an old value replaced with a new one,
49
- and whether or not they are the same doesn't really matter.
50
- And Custom elements should work the same way as MutationObserver."
51
- https://github.com/whatwg/dom/issues/520#issuecomment-336574796
52
- */
46
+ "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
47
+ I think it might have been something along the lines that for consistency every setAttribute call should create a record.
48
+ Conceptually there is after all a mutation: there is an old value replaced with a new one,
49
+ and whether or not they are the same doesn't really matter.
50
+ And Custom elements should work the same way as MutationObserver."
51
+ https://github.com/whatwg/dom/issues/520#issuecomment-336574796
52
+ */
53
53
  var oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
54
54
  var newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
55
55
  if (oldValue !== newValue) {
@@ -90,7 +90,12 @@ export default class AbstractVCCalculatorBase {
90
90
 
91
91
  // Check if this entry matches any checkpoint percentiles
92
92
  if (viewportPercentage >= percentiles[percentileIndex]) {
93
- const elementNames = entries.map(e => e.elementName);
93
+ let elementNames = [];
94
+ if (fg('platform_ufo_dedupe_repeated_vc_offenders')) {
95
+ elementNames = [...new Set(entries.map(e => e.elementName))];
96
+ } else {
97
+ elementNames = entries.map(e => e.elementName);
98
+ }
94
99
 
95
100
  // Process all matching percentiles in one go
96
101
  while (percentileIndex < percentiles.length && viewportPercentage >= percentiles[percentileIndex]) {
@@ -30,13 +30,13 @@ function createMutationObserver({
30
30
  if (mut.type === 'attributes') {
31
31
  var _mut$oldValue;
32
32
  /*
33
- "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
34
- I think it might have been something along the lines that for consistency every setAttribute call should create a record.
35
- Conceptually there is after all a mutation: there is an old value replaced with a new one,
36
- and whether or not they are the same doesn't really matter.
37
- And Custom elements should work the same way as MutationObserver."
38
- https://github.com/whatwg/dom/issues/520#issuecomment-336574796
39
- */
33
+ "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
34
+ I think it might have been something along the lines that for consistency every setAttribute call should create a record.
35
+ Conceptually there is after all a mutation: there is an old value replaced with a new one,
36
+ and whether or not they are the same doesn't really matter.
37
+ And Custom elements should work the same way as MutationObserver."
38
+ https://github.com/whatwg/dom/issues/520#issuecomment-336574796
39
+ */
40
40
  const oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
41
41
  const newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
42
42
  if (oldValue !== newValue) {
@@ -1,5 +1,5 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
@@ -158,9 +158,18 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
158
158
  case 19:
159
159
  // Check if this entry matches any checkpoint percentiles
160
160
  if (viewportPercentage >= percentiles[percentileIndex]) {
161
- elementNames = entries.map(function (e) {
162
- return e.elementName;
163
- }); // Process all matching percentiles in one go
161
+ elementNames = [];
162
+ if (fg('platform_ufo_dedupe_repeated_vc_offenders')) {
163
+ elementNames = _toConsumableArray(new Set(entries.map(function (e) {
164
+ return e.elementName;
165
+ })));
166
+ } else {
167
+ elementNames = entries.map(function (e) {
168
+ return e.elementName;
169
+ });
170
+ }
171
+
172
+ // Process all matching percentiles in one go
164
173
  while (percentileIndex < percentiles.length && viewportPercentage >= percentiles[percentileIndex]) {
165
174
  vcDetails["".concat(percentiles[percentileIndex])] = {
166
175
  t: Math.round(time),
@@ -38,13 +38,13 @@ function createMutationObserver(_ref) {
38
38
  if (mut.type === 'attributes') {
39
39
  var _mut$oldValue;
40
40
  /*
41
- "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
42
- I think it might have been something along the lines that for consistency every setAttribute call should create a record.
43
- Conceptually there is after all a mutation: there is an old value replaced with a new one,
44
- and whether or not they are the same doesn't really matter.
45
- And Custom elements should work the same way as MutationObserver."
46
- https://github.com/whatwg/dom/issues/520#issuecomment-336574796
47
- */
41
+ "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
42
+ I think it might have been something along the lines that for consistency every setAttribute call should create a record.
43
+ Conceptually there is after all a mutation: there is an old value replaced with a new one,
44
+ and whether or not they are the same doesn't really matter.
45
+ And Custom elements should work the same way as MutationObserver."
46
+ https://github.com/whatwg/dom/issues/520#issuecomment-336574796
47
+ */
48
48
  var oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
49
49
  var newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
50
50
  if (oldValue !== newValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -192,6 +192,9 @@
192
192
  "platform_ufo_enable_vc_raw_data": {
193
193
  "type": "boolean"
194
194
  },
195
+ "platform_ufo_dedupe_repeated_vc_offenders": {
196
+ "type": "boolean"
197
+ },
195
198
  "platform_mark_ufo_segment_first_load": {
196
199
  "type": "boolean"
197
200
  },