@atlaskit/react-ufo 2.4.5 → 2.4.6

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,16 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 2.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#174829](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/174829)
8
+ [`381735c03773b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/381735c03773b) -
9
+ add ufo: prefix to error count and stylesheet count metrics
10
+ - [#174760](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/174760)
11
+ [`0c5bbf0079bee`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c5bbf0079bee) -
12
+ Remove display style attribute mutation check
13
+
3
14
  ## 2.4.5
4
15
 
5
16
  ### Patch Changes
@@ -638,16 +638,22 @@ function getStylesheetMetrics() {
638
638
  }
639
639
  }, 0);
640
640
  return {
641
- stylesheets: stylesheetCount,
642
- styleElements: styleElements,
643
- styleProps: styleProps.length,
644
- styleDeclarations: styleDeclarations,
645
- cssrules: cssrules
641
+ 'ufo:stylesheets': stylesheetCount,
642
+ 'ufo:styleElements': styleElements,
643
+ 'ufo:styleProps': styleProps.length,
644
+ 'ufo:styleDeclarations': styleDeclarations,
645
+ 'ufo:cssrules': cssrules
646
646
  };
647
647
  } catch (e) {
648
648
  return {};
649
649
  }
650
650
  }
651
+ function getErrorCounts(interaction) {
652
+ return {
653
+ 'ufo:errors:globalCount': (0, _globalErrorHandler.getGlobalErrorCount)(),
654
+ 'ufo:errors:count': interaction.errors.length
655
+ };
656
+ }
651
657
  function createInteractionMetricsPayload(interaction, interactionId) {
652
658
  var _window$location, _config$additionalPay;
653
659
  var interactionPayloadStart = performance.now();
@@ -742,7 +748,7 @@ function createInteractionMetricsPayload(interaction, interactionId) {
742
748
  source: 'measured',
743
749
  tags: ['observability'],
744
750
  attributes: {
745
- properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
751
+ properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
746
752
  // basic
747
753
  'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
748
754
  'event:product': config.product,
@@ -756,8 +762,7 @@ function createInteractionMetricsPayload(interaction, interactionId) {
756
762
  'event:region': config.region || 'unknown',
757
763
  'experience:key': 'custom.interaction-metrics',
758
764
  'experience:name': newUFOName
759
- }, getBrowserMetadata()), getSSRProperties(type)), getPPSMetrics(interaction)), getPaintMetrics(type)), getNavigationMetrics(type)), getVCMetrics(interaction)), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), {}, {
760
- errorCount: (0, _globalErrorHandler.getGlobalErrorCount)(),
765
+ }, getBrowserMetadata()), getSSRProperties(type)), getPPSMetrics(interaction)), getPaintMetrics(type)), getNavigationMetrics(type)), getVCMetrics(interaction)), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), {}, {
761
766
  interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
762
767
  namePrefix: config.namePrefix || '',
763
768
  segmentPrefix: config.segmentPrefix || '',
@@ -788,8 +793,7 @@ function createInteractionMetricsPayload(interaction, interactionId) {
788
793
  }),
789
794
  marks: optimizeMarks(interaction.marks),
790
795
  customData: optimizeCustomData(interaction),
791
- reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start),
792
- errorCount: interaction.errors.length
796
+ reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start)
793
797
  }, labelStack), getPageLoadInteractionMetrics()), getDetailedInteractionMetrics()), getPageLoadDetailedInteractionMetrics()), getBm3TrackerTimings(interaction)),
794
798
  'ufo:payloadTime': (0, _roundNumber.roundEpsilon)(performance.now() - interactionPayloadStart)
795
799
  })
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.Observers = void 0;
8
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -13,9 +12,6 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
12
  var _vcUtils = require("../media-wrapper/vc-utils");
14
13
  var _editorLnv = require("./editor-lnv");
15
14
  var _ssrPlaceholders = require("./ssr-placeholders");
16
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
17
- 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; } }
18
- 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; }
19
15
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
16
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
17
  var state = {
@@ -202,8 +198,7 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
202
198
  });
203
199
  } else if (mutation.type === 'attributes') {
204
200
  if (mutation.target instanceof HTMLElement) {
205
- var isDisplayStyleAttributeMutation = mutation.attributeName === 'style' && _this2.getStyleDisplay(mutation.target.getAttribute('style')) !== _this2.getStyleDisplay(mutation.oldValue);
206
- if ((0, _platformFeatureFlags.fg)('platform-ufo-vc-observe-attributes') || isDisplayStyleAttributeMutation) {
201
+ if ((0, _platformFeatureFlags.fg)('platform-ufo-vc-observe-attributes')) {
207
202
  _this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
208
203
  }
209
204
  }
@@ -212,40 +207,6 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
212
207
  _this2.measureStop();
213
208
  }) : null;
214
209
  }
215
- }, {
216
- key: "getStyleDisplay",
217
- value: function getStyleDisplay(styleAttributeValue) {
218
- if (!styleAttributeValue) {
219
- return undefined;
220
- }
221
-
222
- // Split the style string into individual declarations
223
- var declarations = styleAttributeValue.split(';');
224
- // Iterate over each declaration
225
- var _iterator = _createForOfIteratorHelper(declarations),
226
- _step;
227
- try {
228
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
229
- var declaration = _step.value;
230
- // Trim whitespace and split into property and value
231
- var _declaration$split$ma = declaration.split(':').map(function (part) {
232
- return part.trim();
233
- }),
234
- _declaration$split$ma2 = (0, _slicedToArray2.default)(_declaration$split$ma, 2),
235
- property = _declaration$split$ma2[0],
236
- value = _declaration$split$ma2[1];
237
- // Check if the property is 'display'
238
- if (property && property.toLowerCase() === 'display') {
239
- return value;
240
- }
241
- }
242
- } catch (err) {
243
- _iterator.e(err);
244
- } finally {
245
- _iterator.f();
246
- }
247
- return undefined;
248
- }
249
210
  }, {
250
211
  key: "getElementName",
251
212
  value: function getElementName(element) {
@@ -630,16 +630,22 @@ function getStylesheetMetrics() {
630
630
  }
631
631
  }, 0);
632
632
  return {
633
- stylesheets: stylesheetCount,
634
- styleElements,
635
- styleProps: styleProps.length,
636
- styleDeclarations,
637
- cssrules: cssrules
633
+ 'ufo:stylesheets': stylesheetCount,
634
+ 'ufo:styleElements': styleElements,
635
+ 'ufo:styleProps': styleProps.length,
636
+ 'ufo:styleDeclarations': styleDeclarations,
637
+ 'ufo:cssrules': cssrules
638
638
  };
639
639
  } catch (e) {
640
640
  return {};
641
641
  }
642
642
  }
643
+ function getErrorCounts(interaction) {
644
+ return {
645
+ 'ufo:errors:globalCount': getGlobalErrorCount(),
646
+ 'ufo:errors:count': interaction.errors.length
647
+ };
648
+ }
643
649
  function createInteractionMetricsPayload(interaction, interactionId) {
644
650
  var _window$location, _config$additionalPay;
645
651
  const interactionPayloadStart = performance.now();
@@ -759,7 +765,7 @@ function createInteractionMetricsPayload(interaction, interactionId) {
759
765
  ...((_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)),
760
766
  ...getTracingContextData(interaction),
761
767
  ...getStylesheetMetrics(),
762
- errorCount: getGlobalErrorCount(),
768
+ ...getErrorCounts(interaction),
763
769
  interactionMetrics: {
764
770
  namePrefix: config.namePrefix || '',
765
771
  segmentPrefix: config.segmentPrefix || '',
@@ -791,7 +797,6 @@ function createInteractionMetricsPayload(interaction, interactionId) {
791
797
  marks: optimizeMarks(interaction.marks),
792
798
  customData: optimizeCustomData(interaction),
793
799
  reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start),
794
- errorCount: interaction.errors.length,
795
800
  ...labelStack,
796
801
  ...getPageLoadInteractionMetrics(),
797
802
  ...getDetailedInteractionMetrics(),
@@ -170,8 +170,7 @@ export class Observers {
170
170
  });
171
171
  } else if (mutation.type === 'attributes') {
172
172
  if (mutation.target instanceof HTMLElement) {
173
- const isDisplayStyleAttributeMutation = mutation.attributeName === 'style' && this.getStyleDisplay(mutation.target.getAttribute('style')) !== this.getStyleDisplay(mutation.oldValue);
174
- if (fg('platform-ufo-vc-observe-attributes') || isDisplayStyleAttributeMutation) {
173
+ if (fg('platform-ufo-vc-observe-attributes')) {
175
174
  this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
176
175
  }
177
176
  }
@@ -180,24 +179,6 @@ export class Observers {
180
179
  this.measureStop();
181
180
  }) : null;
182
181
  }
183
- getStyleDisplay(styleAttributeValue) {
184
- if (!styleAttributeValue) {
185
- return undefined;
186
- }
187
-
188
- // Split the style string into individual declarations
189
- const declarations = styleAttributeValue.split(';');
190
- // Iterate over each declaration
191
- for (const declaration of declarations) {
192
- // Trim whitespace and split into property and value
193
- const [property, value] = declaration.split(':').map(part => part.trim());
194
- // Check if the property is 'display'
195
- if (property && property.toLowerCase() === 'display') {
196
- return value;
197
- }
198
- }
199
- return undefined;
200
- }
201
182
  getElementName(element) {
202
183
  try {
203
184
  const tagName = element.localName;
@@ -628,16 +628,22 @@ function getStylesheetMetrics() {
628
628
  }
629
629
  }, 0);
630
630
  return {
631
- stylesheets: stylesheetCount,
632
- styleElements: styleElements,
633
- styleProps: styleProps.length,
634
- styleDeclarations: styleDeclarations,
635
- cssrules: cssrules
631
+ 'ufo:stylesheets': stylesheetCount,
632
+ 'ufo:styleElements': styleElements,
633
+ 'ufo:styleProps': styleProps.length,
634
+ 'ufo:styleDeclarations': styleDeclarations,
635
+ 'ufo:cssrules': cssrules
636
636
  };
637
637
  } catch (e) {
638
638
  return {};
639
639
  }
640
640
  }
641
+ function getErrorCounts(interaction) {
642
+ return {
643
+ 'ufo:errors:globalCount': getGlobalErrorCount(),
644
+ 'ufo:errors:count': interaction.errors.length
645
+ };
646
+ }
641
647
  function createInteractionMetricsPayload(interaction, interactionId) {
642
648
  var _window$location, _config$additionalPay;
643
649
  var interactionPayloadStart = performance.now();
@@ -732,7 +738,7 @@ function createInteractionMetricsPayload(interaction, interactionId) {
732
738
  source: 'measured',
733
739
  tags: ['observability'],
734
740
  attributes: {
735
- properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
741
+ properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
736
742
  // basic
737
743
  'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
738
744
  'event:product': config.product,
@@ -746,8 +752,7 @@ function createInteractionMetricsPayload(interaction, interactionId) {
746
752
  'event:region': config.region || 'unknown',
747
753
  'experience:key': 'custom.interaction-metrics',
748
754
  'experience:name': newUFOName
749
- }, getBrowserMetadata()), getSSRProperties(type)), getPPSMetrics(interaction)), getPaintMetrics(type)), getNavigationMetrics(type)), getVCMetrics(interaction)), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), {}, {
750
- errorCount: getGlobalErrorCount(),
755
+ }, getBrowserMetadata()), getSSRProperties(type)), getPPSMetrics(interaction)), getPaintMetrics(type)), getNavigationMetrics(type)), getVCMetrics(interaction)), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), {}, {
751
756
  interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
752
757
  namePrefix: config.namePrefix || '',
753
758
  segmentPrefix: config.segmentPrefix || '',
@@ -778,8 +783,7 @@ function createInteractionMetricsPayload(interaction, interactionId) {
778
783
  }),
779
784
  marks: optimizeMarks(interaction.marks),
780
785
  customData: optimizeCustomData(interaction),
781
- reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start),
782
- errorCount: interaction.errors.length
786
+ reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start)
783
787
  }, labelStack), getPageLoadInteractionMetrics()), getDetailedInteractionMetrics()), getPageLoadDetailedInteractionMetrics()), getBm3TrackerTimings(interaction)),
784
788
  'ufo:payloadTime': roundEpsilon(performance.now() - interactionPayloadStart)
785
789
  })
@@ -1,10 +1,6 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/createClass";
4
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
6
- 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; } }
7
- 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; }
8
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
6
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -195,8 +191,7 @@ export var Observers = /*#__PURE__*/function () {
195
191
  });
196
192
  } else if (mutation.type === 'attributes') {
197
193
  if (mutation.target instanceof HTMLElement) {
198
- var isDisplayStyleAttributeMutation = mutation.attributeName === 'style' && _this2.getStyleDisplay(mutation.target.getAttribute('style')) !== _this2.getStyleDisplay(mutation.oldValue);
199
- if (fg('platform-ufo-vc-observe-attributes') || isDisplayStyleAttributeMutation) {
194
+ if (fg('platform-ufo-vc-observe-attributes')) {
200
195
  _this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
201
196
  }
202
197
  }
@@ -205,40 +200,6 @@ export var Observers = /*#__PURE__*/function () {
205
200
  _this2.measureStop();
206
201
  }) : null;
207
202
  }
208
- }, {
209
- key: "getStyleDisplay",
210
- value: function getStyleDisplay(styleAttributeValue) {
211
- if (!styleAttributeValue) {
212
- return undefined;
213
- }
214
-
215
- // Split the style string into individual declarations
216
- var declarations = styleAttributeValue.split(';');
217
- // Iterate over each declaration
218
- var _iterator = _createForOfIteratorHelper(declarations),
219
- _step;
220
- try {
221
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
222
- var declaration = _step.value;
223
- // Trim whitespace and split into property and value
224
- var _declaration$split$ma = declaration.split(':').map(function (part) {
225
- return part.trim();
226
- }),
227
- _declaration$split$ma2 = _slicedToArray(_declaration$split$ma, 2),
228
- property = _declaration$split$ma2[0],
229
- value = _declaration$split$ma2[1];
230
- // Check if the property is 'display'
231
- if (property && property.toLowerCase() === 'display') {
232
- return value;
233
- }
234
- }
235
- } catch (err) {
236
- _iterator.e(err);
237
- } finally {
238
- _iterator.f();
239
- }
240
- return undefined;
241
- }
242
203
  }, {
243
204
  key: "getElementName",
244
205
  value: function getElementName(element) {