@atlaskit/react-ufo 4.14.0 → 4.14.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,19 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.14.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`dd1f939b8a7f7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dd1f939b8a7f7) -
8
+ FG cleanup - react_ufo_unified_search_ignoring_sain_metric
9
+
10
+ ## 4.14.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`1cd3b31cac6ef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1cd3b31cac6ef) -
15
+ FG cleanup - platform_ufo_ssr_placeholders_for_display_contents
16
+
3
17
  ## 4.14.0
4
18
 
5
19
  ### Minor Changes
@@ -895,7 +895,7 @@ function tryComplete(interactionId, endTime) {
895
895
  if ((_getConfig1 = (0, _config.getConfig)()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.extraInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
896
896
  interactionExtraMetrics.updateFinishedInteraction(interaction);
897
897
  }
898
- if ((_getConfig10 = (0, _config.getConfig)()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10 !== void 0 && _getConfig10.enabled && interaction.ufoName === ((_getConfig11 = (0, _config.getConfig)()) === null || _getConfig11 === void 0 || (_getConfig11 = _getConfig11.extraSearchPageInteraction) === null || _getConfig11 === void 0 ? void 0 : _getConfig11.searchPageMetricName) && (0, _platformFeatureFlags.fg)('react_ufo_unified_search_ignoring_sain_metric')) {
898
+ if ((_getConfig10 = (0, _config.getConfig)()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10 !== void 0 && _getConfig10.enabled && interaction.ufoName === ((_getConfig11 = (0, _config.getConfig)()) === null || _getConfig11 === void 0 || (_getConfig11 = _getConfig11.extraSearchPageInteraction) === null || _getConfig11 === void 0 ? void 0 : _getConfig11.searchPageMetricName)) {
899
899
  (0, _createExtraSearchPageInteractionPayload.onSearchPageInteractionComplete)(interactionId, interaction);
900
900
  }
901
901
  activeSubmitted = true;
@@ -919,7 +919,7 @@ function tryComplete(interactionId, endTime) {
919
919
  if (!activeSubmitted) {
920
920
  var _getConfig13, _getConfig14;
921
921
  finishInteraction(interactionId, interaction, endTime);
922
- if ((_getConfig13 = (0, _config.getConfig)()) !== null && _getConfig13 !== void 0 && (_getConfig13 = _getConfig13.extraSearchPageInteraction) !== null && _getConfig13 !== void 0 && _getConfig13.enabled && interaction.ufoName === ((_getConfig14 = (0, _config.getConfig)()) === null || _getConfig14 === void 0 || (_getConfig14 = _getConfig14.extraSearchPageInteraction) === null || _getConfig14 === void 0 ? void 0 : _getConfig14.searchPageMetricName) && (0, _platformFeatureFlags.fg)('react_ufo_unified_search_ignoring_sain_metric')) {
922
+ if ((_getConfig13 = (0, _config.getConfig)()) !== null && _getConfig13 !== void 0 && (_getConfig13 = _getConfig13.extraSearchPageInteraction) !== null && _getConfig13 !== void 0 && _getConfig13.enabled && interaction.ufoName === ((_getConfig14 = (0, _config.getConfig)()) === null || _getConfig14 === void 0 || (_getConfig14 = _getConfig14.extraSearchPageInteraction) === null || _getConfig14 === void 0 ? void 0 : _getConfig14.searchPageMetricName)) {
923
923
  (0, _createExtraSearchPageInteractionPayload.onSearchPageInteractionComplete)(interactionId, interaction);
924
924
  }
925
925
  activeSubmitted = true;
@@ -194,7 +194,7 @@ function init(analyticsWebClientAsync, config) {
194
194
  if (config !== null && config !== void 0 && (_config$extraInteract2 = config.extraInteractionMetrics) !== null && _config$extraInteract2 !== void 0 && _config$extraInteract2.enabled && (0, _platformFeatureFlags.fg)('platform_ufo_enable_ttai_with_3p')) {
195
195
  sinkInteractionExtraMetrics(instance, createInteractionExtraMetricsPayloadPackage.default);
196
196
  }
197
- if (config !== null && config !== void 0 && (_config$extraSearchPa = config.extraSearchPageInteraction) !== null && _config$extraSearchPa !== void 0 && _config$extraSearchPa.enabled && (0, _platformFeatureFlags.fg)('react_ufo_unified_search_ignoring_sain_metric')) {
197
+ if (config !== null && config !== void 0 && (_config$extraSearchPa = config.extraSearchPageInteraction) !== null && _config$extraSearchPa !== void 0 && _config$extraSearchPa.enabled) {
198
198
  sinkExtraSearchPageInteraction(instance, payloadPackage);
199
199
  }
200
200
  });
@@ -8,7 +8,6 @@ exports.SSRPlaceholderHandlers = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
11
  var ANCESTOR_LOOKUP_LIMIT = 10;
13
12
  var PAGE_LAYOUT_ID = 'page-layout.root';
14
13
  var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/function () {
@@ -291,45 +290,40 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
291
290
  }, {
292
291
  key: "getEffectiveBoundingRect",
293
292
  value: function getEffectiveBoundingRect(el) {
294
- var enableDisplayContentsSupport = (0, _platformFeatureFlags.fg)('platform_ufo_ssr_placeholders_for_display_contents');
293
+ var computedStyle = window.getComputedStyle(el);
295
294
 
296
- // Only handle display: contents if feature flag is enabled
297
- if (enableDisplayContentsSupport) {
298
- var computedStyle = window.getComputedStyle(el);
295
+ // If element has display: contents, collect bounding rect from children
296
+ if (computedStyle.display === 'contents') {
297
+ var children = Array.from(el.children);
298
+ if (children.length === 0) {
299
+ // No children, return zero rect
300
+ return new DOMRect(0, 0, 0, 0);
301
+ }
299
302
 
300
- // If element has display: contents, collect bounding rect from children
301
- if (computedStyle.display === 'contents') {
302
- var children = Array.from(el.children);
303
- if (children.length === 0) {
304
- // No children, return zero rect
305
- return new DOMRect(0, 0, 0, 0);
303
+ // Calculate union of all children's bounding rects
304
+ var minX = Infinity;
305
+ var minY = Infinity;
306
+ var maxX = -Infinity;
307
+ var maxY = -Infinity;
308
+ children.forEach(function (child) {
309
+ var childRect = child.getBoundingClientRect();
310
+ // Skip children with zero dimensions (likely also display: contents)
311
+ if (childRect.width > 0 || childRect.height > 0) {
312
+ minX = Math.min(minX, childRect.left);
313
+ minY = Math.min(minY, childRect.top);
314
+ maxX = Math.max(maxX, childRect.right);
315
+ maxY = Math.max(maxY, childRect.bottom);
306
316
  }
317
+ });
307
318
 
308
- // Calculate union of all children's bounding rects
309
- var minX = Infinity;
310
- var minY = Infinity;
311
- var maxX = -Infinity;
312
- var maxY = -Infinity;
313
- children.forEach(function (child) {
314
- var childRect = child.getBoundingClientRect();
315
- // Skip children with zero dimensions (likely also display: contents)
316
- if (childRect.width > 0 || childRect.height > 0) {
317
- minX = Math.min(minX, childRect.left);
318
- minY = Math.min(minY, childRect.top);
319
- maxX = Math.max(maxX, childRect.right);
320
- maxY = Math.max(maxY, childRect.bottom);
321
- }
322
- });
323
-
324
- // If no children with dimensions found, return zero rect
325
- if (minX === Infinity) {
326
- return new DOMRect(0, 0, 0, 0);
327
- }
328
- return new DOMRect(minX, minY, maxX - minX, maxY - minY);
319
+ // If no children with dimensions found, return zero rect
320
+ if (minX === Infinity) {
321
+ return new DOMRect(0, 0, 0, 0);
329
322
  }
323
+ return new DOMRect(minX, minY, maxX - minX, maxY - minY);
330
324
  }
331
325
 
332
- // Normal element or feature flag disabled, return its bounding rect
326
+ // Normal element, return its bounding rect
333
327
  return el.getBoundingClientRect();
334
328
  }
335
329
  }, {
@@ -4,34 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.collectSSRPlaceholderDimensions = collectSSRPlaceholderDimensions;
7
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
7
  // lightweight script to scan the SSR response and collect all elements with data-ssr-placeholder attribute
9
8
  // and save their size/positions in a map __SSR_PLACEHOLDERS_DIMENSIONS__ on the Window object. Each placeholderId is
10
9
  // unique and maps to its corresponding elements bounding client rectangle dimensions.
11
10
  function collectSSRPlaceholderDimensions(document, window) {
12
11
  var enablePageLayoutPlaceholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
13
- var enableDisplayContentsSupport = (0, _platformFeatureFlags.fg)('platform_ufo_ssr_placeholders_for_display_contents');
14
12
  var ssrPlaceholders = document === null || document === void 0 ? void 0 : document.querySelectorAll('[data-ssr-placeholder]');
15
13
  ssrPlaceholders.forEach(function (elem) {
16
14
  var placeholderId = elem.getAttribute('data-ssr-placeholder');
17
15
  if (placeholderId) {
18
16
  window.__SSR_PLACEHOLDERS_DIMENSIONS__ = window.__SSR_PLACEHOLDERS_DIMENSIONS__ || {};
19
- if (enableDisplayContentsSupport) {
20
- window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = getEffectiveBoundingRect(elem, window);
21
- } else {
22
- window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = elem.getBoundingClientRect();
23
- }
17
+ window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = getEffectiveBoundingRect(elem, window);
24
18
  }
25
19
  });
26
20
  if (enablePageLayoutPlaceholder) {
27
21
  var pageLayoutRoot = document === null || document === void 0 ? void 0 : document.getElementById('unsafe-design-system-page-layout-root');
28
22
  if (pageLayoutRoot) {
29
23
  window.__SSR_PLACEHOLDERS_DIMENSIONS__ = window.__SSR_PLACEHOLDERS_DIMENSIONS__ || {};
30
- if (enableDisplayContentsSupport) {
31
- window.__SSR_PLACEHOLDERS_DIMENSIONS__['page-layout.root'] = getEffectiveBoundingRect(pageLayoutRoot, window);
32
- } else {
33
- window.__SSR_PLACEHOLDERS_DIMENSIONS__['page-layout.root'] = pageLayoutRoot.getBoundingClientRect();
34
- }
24
+ window.__SSR_PLACEHOLDERS_DIMENSIONS__['page-layout.root'] = getEffectiveBoundingRect(pageLayoutRoot, window);
35
25
  }
36
26
  }
37
27
  }